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
|
|---|---|---|---|---|---|---|---|
f9c29b084b68563c10f07599e0d789a105958592
|
2024-08-12 12:03:12
|
Loaki07
|
feat(analytics): populate status_code, initial_attempt_id & delivery_attempt on clickhouse for outgoing webhook events (#5383)
| false
|
diff --git a/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql b/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql
index 30f3f293bfa..a104bc506fd 100644
--- a/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql
+++ b/crates/analytics/docs/clickhouse/scripts/outgoing_webhook_events.sql
@@ -12,6 +12,9 @@ CREATE TABLE outgoing_webhook_events_queue (
`content` Nullable(String),
`is_error` Bool,
`error` Nullable(String),
+ `initial_attempt_id` Nullable(String),
+ `status_code` Nullable(UInt16),
+ `delivery_attempt` LowCardinality(String),
`created_at_timestamp` DateTime64(3)
) ENGINE = Kafka SETTINGS kafka_broker_list = 'kafka0:29092',
kafka_topic_list = 'hyperswitch-outgoing-webhook-events',
@@ -33,6 +36,9 @@ CREATE TABLE outgoing_webhook_events (
`content` Nullable(String),
`is_error` Bool,
`error` Nullable(String),
+ `initial_attempt_id` Nullable(String),
+ `status_code` Nullable(UInt16),
+ `delivery_attempt` LowCardinality(String),
`created_at` DateTime64(3),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4),
INDEX eventIndex event_type TYPE bloom_filter GRANULARITY 1,
@@ -61,6 +67,9 @@ CREATE TABLE outgoing_webhook_events_audit (
`content` Nullable(String),
`is_error` Bool,
`error` Nullable(String),
+ `initial_attempt_id` Nullable(String),
+ `status_code` Nullable(UInt16),
+ `delivery_attempt` LowCardinality(String),
`created_at` DateTime64(3),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4)
) ENGINE = MergeTree PARTITION BY merchant_id
@@ -81,6 +90,9 @@ CREATE MATERIALIZED VIEW outgoing_webhook_events_mv TO outgoing_webhook_events (
`content` Nullable(String),
`is_error` Bool,
`error` Nullable(String),
+ `initial_attempt_id` Nullable(String),
+ `status_code` Nullable(UInt16),
+ `delivery_attempt` LowCardinality(String),
`created_at` DateTime64(3),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4)
) AS
@@ -98,6 +110,9 @@ SELECT
content,
is_error,
error,
+ initial_attempt_id,
+ status_code,
+ delivery_attempt,
created_at_timestamp AS created_at,
now() AS inserted_at
FROM
@@ -119,6 +134,9 @@ CREATE MATERIALIZED VIEW outgoing_webhook_events_audit_mv TO outgoing_webhook_ev
`content` Nullable(String),
`is_error` Bool,
`error` Nullable(String),
+ `initial_attempt_id` Nullable(String),
+ `status_code` Nullable(UInt16),
+ `delivery_attempt` LowCardinality(String),
`created_at` DateTime64(3),
`inserted_at` DateTime DEFAULT now() CODEC(T64, LZ4)
) AS
@@ -136,6 +154,9 @@ SELECT
content,
is_error,
error,
+ initial_attempt_id,
+ status_code,
+ delivery_attempt,
created_at_timestamp AS created_at,
now() AS inserted_at
FROM
diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs
index 86ba8869246..1a0e78a75a7 100644
--- a/crates/router/src/core/webhooks/outgoing.rs
+++ b/crates/router/src/core/webhooks/outgoing.rs
@@ -5,7 +5,10 @@ use api_models::{
webhooks,
};
use common_utils::{
- ext_traits::Encode, request::RequestContent, type_name, types::keymanager::Identifier,
+ ext_traits::{Encode, StringExt},
+ request::RequestContent,
+ type_name,
+ types::keymanager::{Identifier, KeyManagerState},
};
use diesel_models::process_tracker::business_status;
use error_stack::{report, ResultExt};
@@ -33,7 +36,8 @@ use crate::{
routes::{app::SessionStateInfo, SessionState},
services,
types::{
- api, domain,
+ api,
+ domain::{self},
storage::{self, enums},
transformers::ForeignFrom,
},
@@ -220,7 +224,15 @@ pub(crate) async fn trigger_webhook_and_raise_event(
)
.await;
- raise_webhooks_analytics_event(state, trigger_webhook_result, content, merchant_id, event);
+ let _ = raise_webhooks_analytics_event(
+ state,
+ trigger_webhook_result,
+ content,
+ merchant_id,
+ event,
+ merchant_key_store,
+ )
+ .await;
}
async fn trigger_webhook_to_merchant(
@@ -430,13 +442,17 @@ async fn trigger_webhook_to_merchant(
Ok(())
}
-fn raise_webhooks_analytics_event(
+async fn raise_webhooks_analytics_event(
state: SessionState,
trigger_webhook_result: CustomResult<(), errors::WebhooksFlowError>,
content: Option<api::OutgoingWebhookContent>,
merchant_id: common_utils::id_type::MerchantId,
event: domain::Event,
+ merchant_key_store: &domain::MerchantKeyStore,
) {
+ let key_manager_state: &KeyManagerState = &(&state).into();
+ let event_id = event.event_id;
+
let error = if let Err(error) = trigger_webhook_result {
logger::error!(?error, "Failed to send webhook to merchant");
@@ -456,13 +472,47 @@ fn raise_webhooks_analytics_event(
.and_then(api::OutgoingWebhookContent::get_outgoing_webhook_event_content)
.or_else(|| get_outgoing_webhook_event_content_from_event_metadata(event.metadata));
+ // Fetch updated_event from db
+ let updated_event = state
+ .store
+ .find_event_by_merchant_id_event_id(
+ key_manager_state,
+ &merchant_id,
+ &event_id,
+ merchant_key_store,
+ )
+ .await
+ .attach_printable_lazy(|| format!("event not found for id: {}", &event_id))
+ .map_err(|error| {
+ logger::error!(?error);
+ error
+ })
+ .ok();
+
+ // Get status_code from webhook response
+ let status_code = updated_event.and_then(|updated_event| {
+ let webhook_response: Option<OutgoingWebhookResponseContent> =
+ updated_event.response.and_then(|res| {
+ res.peek()
+ .parse_struct("OutgoingWebhookResponseContent")
+ .map_err(|error| {
+ logger::error!(?error, "Error deserializing webhook response");
+ error
+ })
+ .ok()
+ });
+ webhook_response.and_then(|res| res.status_code)
+ });
+
let webhook_event = OutgoingWebhookEvent::new(
merchant_id,
- event.event_id,
+ event_id,
event.event_type,
outgoing_webhook_event_content,
error,
event.initial_attempt_id,
+ status_code,
+ event.delivery_attempt,
);
state.event_handler().log_event(&webhook_event);
}
diff --git a/crates/router/src/events/outgoing_webhook_logs.rs b/crates/router/src/events/outgoing_webhook_logs.rs
index 7ab100c2503..2a56f60ecac 100644
--- a/crates/router/src/events/outgoing_webhook_logs.rs
+++ b/crates/router/src/events/outgoing_webhook_logs.rs
@@ -1,4 +1,5 @@
use api_models::{enums::EventType as OutgoingWebhookEventType, webhooks::OutgoingWebhookContent};
+use common_enums::WebhookDeliveryAttempt;
use serde::Serialize;
use serde_json::Value;
use time::OffsetDateTime;
@@ -18,6 +19,8 @@ pub struct OutgoingWebhookEvent {
error: Option<Value>,
created_at_timestamp: i128,
initial_attempt_id: Option<String>,
+ status_code: Option<u16>,
+ delivery_attempt: Option<WebhookDeliveryAttempt>,
}
#[derive(Clone, Debug, PartialEq, Serialize)]
@@ -89,6 +92,7 @@ impl OutgoingWebhookEventMetric for OutgoingWebhookContent {
}
impl OutgoingWebhookEvent {
+ #[allow(clippy::too_many_arguments)]
pub fn new(
merchant_id: common_utils::id_type::MerchantId,
event_id: String,
@@ -96,6 +100,8 @@ impl OutgoingWebhookEvent {
content: Option<OutgoingWebhookEventContent>,
error: Option<Value>,
initial_attempt_id: Option<String>,
+ status_code: Option<u16>,
+ delivery_attempt: Option<WebhookDeliveryAttempt>,
) -> Self {
Self {
merchant_id,
@@ -106,6 +112,8 @@ impl OutgoingWebhookEvent {
error,
created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
initial_attempt_id,
+ status_code,
+ delivery_attempt,
}
}
}
|
feat
|
populate status_code, initial_attempt_id & delivery_attempt on clickhouse for outgoing webhook events (#5383)
|
17eeda4dfea3c41cf90222b154f0c399e81665b0
|
2025-01-16 06:00:31
|
github-actions
|
chore(version): 2025.01.16.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 358c6bd8817..0d101670e1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2025.01.16.0
+
+### Features
+
+- **connector:** [Xendit] ADD Cards & Mandates Flow ([#6966](https://github.com/juspay/hyperswitch/pull/6966)) ([`bbf8844`](https://github.com/juspay/hyperswitch/commit/bbf884460c010e6ebc5f93f6fe6ff079e2463d90))
+- **core:** Diesel models, domain models and db interface changes for callback_mapper table ([#6571](https://github.com/juspay/hyperswitch/pull/6571)) ([`043cf8e`](https://github.com/juspay/hyperswitch/commit/043cf8e0c14e1818ec8e931140f1694d10b7b837))
+
+### Refactors
+
+- **dynamic_routing:** Perform db operations for dynamic_routing_stats table only when payments are in terminal state ([#6900](https://github.com/juspay/hyperswitch/pull/6900)) ([`1ec91e5`](https://github.com/juspay/hyperswitch/commit/1ec91e54e2420d4bed10e82ba1e3da5a1f29251a))
+- **proxy:** Specify hosts for proxy exclusion instead of complete URLs ([#6957](https://github.com/juspay/hyperswitch/pull/6957)) ([`bd1f077`](https://github.com/juspay/hyperswitch/commit/bd1f07705747ebe915ddf88cf860f2ac7c65e9b5))
+
+### Miscellaneous Tasks
+
+- Address Rust 1.84.0 clippy lints ([#7021](https://github.com/juspay/hyperswitch/pull/7021)) ([`4664d4b`](https://github.com/juspay/hyperswitch/commit/4664d4bc4b7e685ab6dfb9176a3309026d3032e9))
+
+**Full Changelog:** [`2025.01.14.0...2025.01.16.0`](https://github.com/juspay/hyperswitch/compare/2025.01.14.0...2025.01.16.0)
+
+- - -
+
## 2025.01.14.0
### Features
|
chore
|
2025.01.16.0
|
3d55e3ba45619978e8ca9e5012c156dc017d2879
|
2024-01-30 14:26:55
|
AkshayaFoiger
|
feat(pm_list): add required fields for sofort (#3192)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index d53a6e28ef6..00c325f058e 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -374,13 +374,14 @@ slack_invite_url = "https://www.example.com/" # Slack invite url for hyperswit
discord_invite_url = "https://www.example.com/" # Discord invite url for hyperswitch
[mandates.supported_payment_methods]
-card.credit = { connector_list = "stripe,adyen,cybersource" } # Mandate supported payment method type and connector for card
-wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
-pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
-bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
-bank_redirect.ideal = { connector_list = "stripe,adyen" } # Mandate supported payment method type and connector for bank_redirect
+card.credit = { connector_list = "stripe,adyen,cybersource" } # Mandate supported payment method type and connector for card
+wallet.paypal = { connector_list = "adyen" } # Mandate supported payment method type and connector for wallets
+pay_later.klarna = { connector_list = "adyen" } # Mandate supported payment method type and connector for pay_later
+bank_debit.ach = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_debit.becs = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_debit.sepa = { connector_list = "gocardless" } # Mandate supported payment method type and connector for bank_debit
+bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"} # Mandate supported payment method type and connector for bank_redirect
+bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
# Required fields info used while listing the payment_method_data
diff --git a/config/development.toml b/config/development.toml
index 7c494ea2852..d447930b590 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -474,7 +474,8 @@ card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,global
bank_debit.ach = { connector_list = "gocardless"}
bank_debit.becs = { connector_list = "gocardless"}
bank_debit.sepa = { connector_list = "gocardless"}
-bank_redirect.ideal = {connector_list = "stripe,adyen"}
+bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
+bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
[connector_request_reference_id_config]
merchant_ids_send_payment_id_as_connector_request_id = []
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 79039e13679..d468f1dd412 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -340,7 +340,8 @@ card.debit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalp
bank_debit.ach = { connector_list = "gocardless"}
bank_debit.becs = { connector_list = "gocardless"}
bank_debit.sepa = { connector_list = "gocardless"}
-bank_redirect.ideal = {connector_list = "stripe,adyen"}
+bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
+bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
[connector_customer]
connector_list = "gocardless,stax,stripe"
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 8c27f498d7a..f8d31c6e414 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1336,15 +1336,15 @@ pub enum BankRedirectData {
},
Sofort {
/// The billing details for bank redirection
- billing_details: BankRedirectBilling,
+ billing_details: Option<BankRedirectBilling>,
/// The country for bank payment
#[schema(value_type = CountryAlpha2, example = "US")]
- country: api_enums::CountryAlpha2,
+ country: Option<api_enums::CountryAlpha2>,
/// The preferred language
#[schema(example = "en")]
- preferred_language: String,
+ preferred_language: Option<String>,
},
Trustly {
/// The country for bank payment
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index e4a470d0da3..b6d8fa114b9 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -4750,14 +4750,303 @@ impl Default for super::settings::RequiredFields {
ConnectorFields {
fields: HashMap::from([
(
- enums::Connector::Stripe,
+ enums::Connector::Aci,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::from([
+ ("payment_method_data.bank_redirect.sofort.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserCountry {
+ options: vec![
+ "ES".to_string(),
+ "GB".to_string(),
+ "SE".to_string(),
+ "AT".to_string(),
+ "NL".to_string(),
+ "DE".to_string(),
+ "CH".to_string(),
+ "BE".to_string(),
+ "FR".to_string(),
+ "FI".to_string(),
+ "IT".to_string(),
+ "PL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Adyen,
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
- ]),
+ (
+ enums::Connector::Globalpay,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from([
+ ("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![
+ "AT".to_string(),
+ "BE".to_string(),
+ "DE".to_string(),
+ "ES".to_string(),
+ "IT".to_string(),
+ "NL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+ ]),
+ }
+ ),
+ (
+ enums::Connector::Mollie,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Nexinets,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Nuvei,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate:HashMap::from([
+ (
+ "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.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ES".to_string(),
+ "GB".to_string(),
+ "IT".to_string(),
+ "DE".to_string(),
+ "FR".to_string(),
+ "AT".to_string(),
+ "BE".to_string(),
+ "NL".to_string(),
+ "BE".to_string(),
+ "SK".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )]
+ ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Paypal,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::from([
+ ("payment_method_data.bank_redirect.sofort.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserCountry {
+ options: vec![
+ "ES".to_string(),
+ "GB".to_string(),
+ "AT".to_string(),
+ "NL".to_string(),
+ "DE".to_string(),
+ "BE".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.bank_redirect.sofort.billing_details.billing_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.billing_details.billing_name".to_string(),
+ display_name: "billing_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ )
+ ]),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Shift4,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Stripe,
+ RequiredFieldFinal {
+ mandate: HashMap::from([
+ (
+ "payment_method_data.bank_redirect.sofort.billing_details.email".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.billing_details.email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.bank_redirect.sofort.billing_details.billing_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.billing_details.billing_name".to_string(),
+ display_name: "billing_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ }
+ )
+ ]),
+ non_mandate : HashMap::from([
+ ("payment_method_data.bank_redirect.sofort.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.bank_redirect.sofort.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserCountry {
+ options: vec![
+ "ES".to_string(),
+ "AT".to_string(),
+ "NL".to_string(),
+ "DE".to_string(),
+ "BE".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )]),
+ common: HashMap::new(
+
+ ),
+ }
+ ),
+ (
+ enums::Connector::Trustpay,
+ 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,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry {
+ options: vec![
+ "ES".to_string(),
+ "GB".to_string(),
+ "SE".to_string(),
+ "AT".to_string(),
+ "NL".to_string(),
+ "DE".to_string(),
+ "CH".to_string(),
+ "BE".to_string(),
+ "FR".to_string(),
+ "FI".to_string(),
+ "IT".to_string(),
+ "PL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
+ ]),
+ common: HashMap::new(),
+ }
+ ),
+ ]),
},
),
(
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index f34909f5489..97cef72b02a 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -202,7 +202,11 @@ impl
api_models::payments::BankRedirectData::Sofort { country, .. } => {
Self::BankRedirect(Box::new(BankRedirectionPMData {
payment_brand: PaymentBrand::Sofortueberweisung,
- bank_account_country: Some(country.to_owned()),
+ bank_account_country: Some(country.to_owned().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "sofort.country",
+ },
+ )?),
bank_account_bank_name: None,
bank_account_bic: None,
bank_account_iban: None,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 76678a1b33b..8da5d15c444 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2715,10 +2715,7 @@ fn get_redirect_extra_details(
country,
preferred_language,
..
- } => Ok((
- Some(preferred_language.to_string()),
- Some(country.to_owned()),
- )),
+ } => Ok((preferred_language.clone(), *country)),
api_models::payments::BankRedirectData::OpenBankingUk { country, .. } => {
let country = country.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "country",
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index d384bc4cfd5..baf8f48279d 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -360,8 +360,15 @@ fn get_payment_source(
preferred_language: _,
billing_details,
} => Ok(PaymentSourceItem::Sofort(RedirectRequest {
- name: billing_details.get_billing_name()?,
- country_code: *country,
+ name: billing_details
+ .clone()
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "sofort.billing_details",
+ })?
+ .get_billing_name()?,
+ country_code: country.ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "sofort.country",
+ })?,
experience_context: ContextStruct {
return_url: item.request.complete_authorize_url.clone(),
cancel_url: item.request.complete_authorize_url.clone(),
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 1dbb310868a..70582c41aa4 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -290,7 +290,7 @@ pub struct StripeSofort {
#[serde(rename = "payment_method_data[type]")]
pub payment_method_data_type: StripePaymentMethodType,
#[serde(rename = "payment_method_options[sofort][preferred_language]")]
- preferred_language: String,
+ preferred_language: Option<String>,
#[serde(rename = "payment_method_data[sofort][country]")]
country: api_enums::CountryAlpha2,
}
@@ -1115,36 +1115,10 @@ impl TryFrom<(&payments::BankRedirectData, Option<bool>)> for StripeBillingAddre
}),
payments::BankRedirectData::Ideal {
billing_details, ..
- } => {
- let billing_name = billing_details
- .clone()
- .and_then(|billing_data| billing_data.billing_name.clone());
-
- let billing_email = billing_details
- .clone()
- .and_then(|billing_data| billing_data.email.clone());
- match is_customer_initiated_mandate_payment {
- Some(true) => Ok(Self {
- name: Some(billing_name.ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "billing_name",
- },
- )?),
-
- email: Some(billing_email.ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "billing_email",
- },
- )?),
- ..Self::default()
- }),
- Some(false) | None => Ok(Self {
- name: billing_name,
- email: billing_email,
- ..Self::default()
- }),
- }
- }
+ } => Ok(get_stripe_sepa_dd_mandate_billing_details(
+ billing_details,
+ is_customer_initiated_mandate_payment,
+ )?),
payments::BankRedirectData::Przelewy24 {
billing_details, ..
} => Ok(Self {
@@ -1183,11 +1157,11 @@ impl TryFrom<(&payments::BankRedirectData, Option<bool>)> for StripeBillingAddre
}
payments::BankRedirectData::Sofort {
billing_details, ..
- } => Ok(Self {
- name: billing_details.billing_name.clone(),
- email: billing_details.email.clone(),
- ..Self::default()
- }),
+ } => Ok(get_stripe_sepa_dd_mandate_billing_details(
+ billing_details,
+ is_customer_initiated_mandate_payment,
+ )?),
+
payments::BankRedirectData::Bizum {}
| payments::BankRedirectData::Blik { .. }
| payments::BankRedirectData::Interac { .. }
@@ -1674,8 +1648,10 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData {
} => Ok(Self::BankRedirect(StripeBankRedirectData::StripeSofort(
Box::new(StripeSofort {
payment_method_data_type,
- country: country.to_owned(),
- preferred_language: preferred_language.to_owned(),
+ country: country.ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "sofort.country",
+ })?,
+ preferred_language: preferred_language.clone(),
}),
))),
payments::BankRedirectData::OnlineBankingFpx { .. } => {
@@ -3593,6 +3569,41 @@ pub struct Evidence {
pub submit: bool,
}
+// Mandates for bank redirects - ideal and sofort happens through sepa direct debit in stripe
+fn get_stripe_sepa_dd_mandate_billing_details(
+ billing_details: &Option<payments::BankRedirectBilling>,
+ is_customer_initiated_mandate_payment: Option<bool>,
+) -> Result<StripeBillingAddress, errors::ConnectorError> {
+ let billing_name = billing_details
+ .clone()
+ .and_then(|billing_data| billing_data.billing_name.clone());
+
+ let billing_email = billing_details
+ .clone()
+ .and_then(|billing_data| billing_data.email.clone());
+ match is_customer_initiated_mandate_payment {
+ Some(true) => Ok(StripeBillingAddress {
+ name: Some(
+ billing_name.ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "billing_name",
+ })?,
+ ),
+
+ email: Some(
+ billing_email.ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "billing_email",
+ })?,
+ ),
+ ..StripeBillingAddress::default()
+ }),
+ Some(false) | None => Ok(StripeBillingAddress {
+ name: billing_name,
+ email: billing_email,
+ ..StripeBillingAddress::default()
+ }),
+ }
+}
+
impl TryFrom<&types::SubmitEvidenceRouterData> for Evidence {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::SubmitEvidenceRouterData) -> Result<Self, Self::Error> {
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 268ebd1d3ac..954336070d5 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -246,7 +246,8 @@ card.debit = {connector_list = "stripe,adyen,authorizedotnet,cybersource,globalp
bank_debit.ach = { connector_list = "gocardless"}
bank_debit.becs = { connector_list = "gocardless"}
bank_debit.sepa = { connector_list = "gocardless"}
-bank_redirect.ideal = {connector_list = "stripe,adyen"}
+bank_redirect.ideal = {connector_list = "stripe,adyen,globalpay"}
+bank_redirect.sofort = {connector_list = "stripe,adyen,globalpay"}
[analytics]
source = "sqlx"
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 5696b6fd692..d516eeed4cc 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -5367,13 +5367,16 @@
"sofort": {
"type": "object",
"required": [
- "billing_details",
- "country",
- "preferred_language"
+ "country"
],
"properties": {
"billing_details": {
- "$ref": "#/components/schemas/BankRedirectBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankRedirectBilling"
+ }
+ ],
+ "nullable": true
},
"country": {
"$ref": "#/components/schemas/CountryAlpha2"
@@ -5381,7 +5384,8 @@
"preferred_language": {
"type": "string",
"description": "The preferred language",
- "example": "en"
+ "example": "en",
+ "nullable": true
}
}
}
|
feat
|
add required fields for sofort (#3192)
|
1d48a83c485c27cced7ce1441060333bbb54dbc7
|
2023-11-17 17:51:10
|
github-actions
|
chore(version): v1.83.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4270442611a..d5d04d15669 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 1.83.0 (2023-11-17)
+
+### Features
+
+- **events:** Add incoming webhook payload to api events logger ([#2852](https://github.com/juspay/hyperswitch/pull/2852)) ([`aea390a`](https://github.com/juspay/hyperswitch/commit/aea390a6a1c331f8e0dbea4f41218e43f7323508))
+- **router:** Custom payment link config for payment create ([#2741](https://github.com/juspay/hyperswitch/pull/2741)) ([`c39beb2`](https://github.com/juspay/hyperswitch/commit/c39beb2501e63bbf7fd41bbc947280d7ff5a71dc))
+
+### Bug Fixes
+
+- **router:** Add rust locker url in proxy_bypass_urls ([#2902](https://github.com/juspay/hyperswitch/pull/2902)) ([`9a201ae`](https://github.com/juspay/hyperswitch/commit/9a201ae698c2cf52e617660f82d5bf1df2e797ae))
+
+### Documentation
+
+- **README:** Replace cloudformation deployment template with latest s3 url. ([#2891](https://github.com/juspay/hyperswitch/pull/2891)) ([`375108b`](https://github.com/juspay/hyperswitch/commit/375108b6df50e041fc9dbeb35a6a6b46b146037a))
+
+**Full Changelog:** [`v1.82.0...v1.83.0`](https://github.com/juspay/hyperswitch/compare/v1.82.0...v1.83.0)
+
+- - -
+
+
## 1.82.0 (2023-11-17)
### Features
|
chore
|
v1.83.0
|
21f2ccd47c3627c760ade1b5fe90c3c13a46210e
|
2023-06-21 13:10:03
|
Jeeva
|
feat(router): add route to invalidate cache entry (#1100)
| false
|
diff --git a/crates/drainer/src/utils.rs b/crates/drainer/src/utils.rs
index c06615759f1..7ba10185952 100644
--- a/crates/drainer/src/utils.rs
+++ b/crates/drainer/src/utils.rs
@@ -96,11 +96,14 @@ pub async fn make_stream_available(
stream_name_flag: &str,
redis: &redis::RedisConnectionPool,
) -> errors::DrainerResult<()> {
- redis
- .delete_key(stream_name_flag)
- .await
- .map_err(DrainerError::from)
- .into_report()
+ match redis.delete_key(stream_name_flag).await {
+ Ok(redis::DelReply::KeyDeleted) => Ok(()),
+ Ok(redis::DelReply::KeyNotDeleted) => {
+ logger::error!("Tried to unlock a stream which is already unlocked");
+ Ok(())
+ }
+ Err(error) => Err(DrainerError::from(error).into()),
+ }
}
pub fn parse_stream_entries<'a>(
diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs
index 1547158e6eb..f88870a982c 100644
--- a/crates/redis_interface/src/commands.rs
+++ b/crates/redis_interface/src/commands.rs
@@ -26,7 +26,7 @@ use router_env::{instrument, logger, tracing};
use crate::{
errors,
- types::{HsetnxReply, MsetnxReply, RedisEntryId, SetnxReply},
+ types::{DelReply, HsetnxReply, MsetnxReply, RedisEntryId, SetnxReply},
};
impl super::RedisConnectionPool {
@@ -148,7 +148,7 @@ impl super::RedisConnectionPool {
}
#[instrument(level = "DEBUG", skip(self))]
- pub async fn delete_key(&self, key: &str) -> CustomResult<(), errors::RedisError> {
+ pub async fn delete_key(&self, key: &str) -> CustomResult<DelReply, errors::RedisError> {
self.pool
.del(key)
.await
@@ -664,30 +664,81 @@ impl super::RedisConnectionPool {
#[cfg(test)]
mod tests {
- #![allow(clippy::unwrap_used)]
+ #![allow(clippy::expect_used, clippy::unwrap_used)]
use crate::{errors::RedisError, RedisConnectionPool, RedisEntryId, RedisSettings};
#[tokio::test]
async fn test_consumer_group_create() {
- let redis_conn = RedisConnectionPool::new(&RedisSettings::default())
- .await
- .unwrap();
-
- let result1 = redis_conn
- .consumer_group_create("TEST1", "GTEST", &RedisEntryId::AutoGeneratedID)
- .await;
- let result2 = redis_conn
- .consumer_group_create("TEST3", "GTEST", &RedisEntryId::UndeliveredEntryID)
- .await;
-
- assert!(matches!(
- result1.unwrap_err().current_context(),
- RedisError::InvalidRedisEntryId
- ));
- assert!(matches!(
- result2.unwrap_err().current_context(),
- RedisError::InvalidRedisEntryId
- ));
+ let is_invalid_redis_entry_error = tokio::task::spawn_blocking(move || {
+ futures::executor::block_on(async {
+ // Arrange
+ let redis_conn = RedisConnectionPool::new(&RedisSettings::default())
+ .await
+ .expect("failed to create redis connection pool");
+
+ // Act
+ let result1 = redis_conn
+ .consumer_group_create("TEST1", "GTEST", &RedisEntryId::AutoGeneratedID)
+ .await;
+
+ let result2 = redis_conn
+ .consumer_group_create("TEST3", "GTEST", &RedisEntryId::UndeliveredEntryID)
+ .await;
+
+ // Assert Setup
+ *result1.unwrap_err().current_context() == RedisError::InvalidRedisEntryId
+ && *result2.unwrap_err().current_context() == RedisError::InvalidRedisEntryId
+ })
+ })
+ .await
+ .expect("Spawn block failure");
+
+ assert!(is_invalid_redis_entry_error);
+ }
+
+ #[tokio::test]
+ async fn test_delete_existing_key_success() {
+ let is_success = tokio::task::spawn_blocking(move || {
+ futures::executor::block_on(async {
+ // Arrange
+ let pool = RedisConnectionPool::new(&RedisSettings::default())
+ .await
+ .expect("failed to create redis connection pool");
+ let _ = pool.set_key("key", "value".to_string()).await;
+
+ // Act
+ let result = pool.delete_key("key").await;
+
+ // Assert setup
+ result.is_ok()
+ })
+ })
+ .await
+ .expect("Spawn block failure");
+
+ assert!(is_success);
+ }
+
+ #[tokio::test]
+ async fn test_delete_non_existing_key_success() {
+ let is_success = tokio::task::spawn_blocking(move || {
+ futures::executor::block_on(async {
+ // Arrange
+ let pool = RedisConnectionPool::new(&RedisSettings::default())
+ .await
+ .expect("failed to create redis connection pool");
+
+ // Act
+ let result = pool.delete_key("key not exists").await;
+
+ // Assert Setup
+ result.is_ok()
+ })
+ })
+ .await
+ .expect("Spawn block failure");
+
+ assert!(is_success);
}
}
diff --git a/crates/redis_interface/src/errors.rs b/crates/redis_interface/src/errors.rs
index b506957b9b1..fa11874e601 100644
--- a/crates/redis_interface/src/errors.rs
+++ b/crates/redis_interface/src/errors.rs
@@ -2,7 +2,7 @@
//! Errors specific to this custom redis interface
//!
-#[derive(Debug, thiserror::Error)]
+#[derive(Debug, thiserror::Error, PartialEq)]
pub enum RedisError {
#[error("Invalid Redis configuration: {0}")]
InvalidConfiguration(String),
diff --git a/crates/redis_interface/src/types.rs b/crates/redis_interface/src/types.rs
index c5b82ec2f42..5dc93070014 100644
--- a/crates/redis_interface/src/types.rs
+++ b/crates/redis_interface/src/types.rs
@@ -226,3 +226,22 @@ impl From<StreamCapTrim> for fred::types::XCapTrim {
}
}
}
+
+#[derive(Debug)]
+pub enum DelReply {
+ KeyDeleted,
+ KeyNotDeleted, // Key not found
+}
+
+impl fred::types::FromRedis for DelReply {
+ fn from_value(value: fred::types::RedisValue) -> Result<Self, fred::error::RedisError> {
+ match value {
+ fred::types::RedisValue::Integer(1) => Ok(Self::KeyDeleted),
+ fred::types::RedisValue::Integer(0) => Ok(Self::KeyNotDeleted),
+ _ => Err(fred::error::RedisError::new(
+ fred::error::RedisErrorKind::Unknown,
+ "Unexpected del command reply",
+ )),
+ }
+ }
+}
diff --git a/crates/router/src/cache.rs b/crates/router/src/cache.rs
index a3a4d325968..c8907dad289 100644
--- a/crates/router/src/cache.rs
+++ b/crates/router/src/cache.rs
@@ -117,6 +117,10 @@ impl Cache {
let val = self.get(key)?;
(*val).as_any().downcast_ref::<T>().cloned()
}
+
+ pub async fn remove(&self, key: &str) {
+ self.invalidate(key).await;
+ }
}
#[cfg(test)]
@@ -131,17 +135,27 @@ mod cache_tests {
}
#[tokio::test]
- async fn eviction_on_time_test() {
- let cache = Cache::new(2, 2, None);
+ async fn eviction_on_size_test() {
+ let cache = Cache::new(2, 2, Some(0));
cache.push("key".to_string(), "val".to_string()).await;
- tokio::time::sleep(std::time::Duration::from_secs(3)).await;
assert_eq!(cache.get_val::<String>("key"), None);
}
#[tokio::test]
- async fn eviction_on_size_test() {
- let cache = Cache::new(2, 2, Some(0));
+ async fn invalidate_cache_for_key() {
+ let cache = Cache::new(1800, 1800, None);
cache.push("key".to_string(), "val".to_string()).await;
+
+ cache.remove("key").await;
+
+ assert_eq!(cache.get_val::<String>("key"), None);
+ }
+
+ #[tokio::test]
+ async fn eviction_on_time_test() {
+ let cache = Cache::new(2, 2, None);
+ cache.push("key".to_string(), "val".to_string()).await;
+ tokio::time::sleep(std::time::Duration::from_secs(3)).await;
assert_eq!(cache.get_val::<String>("key"), None);
}
}
diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs
index ada93005f68..3ade4a33462 100644
--- a/crates/router/src/core.rs
+++ b/crates/router/src/core.rs
@@ -1,5 +1,6 @@
pub mod admin;
pub mod api_keys;
+pub mod cache;
pub mod cards_info;
pub mod configs;
pub mod customers;
diff --git a/crates/router/src/core/cache.rs b/crates/router/src/core/cache.rs
new file mode 100644
index 00000000000..b8c3593a7aa
--- /dev/null
+++ b/crates/router/src/core/cache.rs
@@ -0,0 +1,25 @@
+use common_utils::errors::CustomResult;
+use redis_interface::DelReply;
+
+use super::errors;
+use crate::{
+ cache::{ACCOUNTS_CACHE, CONFIG_CACHE},
+ db::StorageInterface,
+ services,
+};
+
+pub async fn invalidate(
+ store: &dyn StorageInterface,
+ key: &str,
+) -> CustomResult<services::api::ApplicationResponse<serde_json::Value>, errors::ApiErrorResponse> {
+ CONFIG_CACHE.remove(key).await;
+ ACCOUNTS_CACHE.remove(key).await;
+
+ match store.get_redis_conn().delete_key(key).await {
+ Ok(DelReply::KeyDeleted) => Ok(services::api::ApplicationResponse::StatusOk),
+ Ok(DelReply::KeyNotDeleted) => Err(errors::ApiErrorResponse::InvalidRequestUrl.into()),
+ Err(error) => Err(error
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to invalidate cache")),
+ }
+}
diff --git a/crates/router/src/db/queue.rs b/crates/router/src/db/queue.rs
index 590dd55918a..ff246e1ec25 100644
--- a/crates/router/src/db/queue.rs
+++ b/crates/router/src/db/queue.rs
@@ -109,7 +109,7 @@ impl QueueInterface for Store {
async fn release_pt_lock(&self, tag: &str, lock_key: &str) -> CustomResult<bool, RedisError> {
let is_lock_released = self.redis_conn()?.delete_key(lock_key).await;
Ok(match is_lock_released {
- Ok(()) => true,
+ Ok(_del_reply) => true,
Err(error) => {
logger::error!(error=%error.current_context(), %tag, "Error while releasing lock");
false
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index a81a619ceb7..34550a3a52f 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -138,7 +138,9 @@ pub fn mk_app(
server_app = server_app.service(routes::StripeApis::server(state.clone()));
}
server_app = server_app.service(routes::Cards::server(state.clone()));
+ server_app = server_app.service(routes::Cache::server(state.clone()));
server_app = server_app.service(routes::Health::server(state));
+
server_app
}
diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs
index f97484ca341..8596be380d4 100644
--- a/crates/router/src/routes.rs
+++ b/crates/router/src/routes.rs
@@ -1,6 +1,7 @@
pub mod admin;
pub mod api_keys;
pub mod app;
+pub mod cache;
pub mod cards_info;
pub mod configs;
pub mod customers;
@@ -21,9 +22,9 @@ pub mod webhooks;
#[cfg(feature = "dummy_connector")]
pub use self::app::DummyConnector;
pub use self::app::{
- ApiKeys, AppState, Cards, Configs, Customers, Disputes, EphemeralKey, Files, Health, Mandates,
- MerchantAccount, MerchantConnectorAccount, PaymentMethods, Payments, Payouts, Refunds,
- Webhooks,
+ ApiKeys, AppState, Cache, Cards, Configs, Customers, Disputes, EphemeralKey, Files, Health,
+ Mandates, MerchantAccount, MerchantConnectorAccount, PaymentMethods, Payments, Payouts,
+ Refunds, 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 44cfaa9984a..f153850ce87 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -5,9 +5,9 @@ use tokio::sync::oneshot;
#[cfg(feature = "dummy_connector")]
use super::dummy_connector::*;
-use super::health::*;
#[cfg(feature = "olap")]
use super::{admin::*, api_keys::*, disputes::*, files::*};
+use super::{cache::*, health::*};
#[cfg(any(feature = "olap", feature = "oltp"))]
use super::{configs::*, customers::*, mandates::*, payments::*, payouts::*, refunds::*};
#[cfg(feature = "oltp")]
@@ -424,7 +424,6 @@ impl Configs {
pub fn server(config: AppState) -> Scope {
web::scope("/configs")
.app_data(web::Data::new(config))
- .service(web::resource("/").route(web::post().to(config_key_create)))
.service(
web::resource("/{key}")
.route(web::get().to(config_key_retrieve))
@@ -465,10 +464,6 @@ impl Disputes {
.route(web::post().to(submit_dispute_evidence))
.route(web::put().to(attach_dispute_evidence)),
)
- .service(
- web::resource("/evidence/{dispute_id}")
- .route(web::get().to(retrieve_dispute_evidence)),
- )
.service(web::resource("/{dispute_id}").route(web::get().to(retrieve_dispute)))
}
}
@@ -498,3 +493,13 @@ impl Files {
)
}
}
+
+pub struct Cache;
+
+impl Cache {
+ pub fn server(state: AppState) -> Scope {
+ web::scope("/cache")
+ .app_data(web::Data::new(state))
+ .service(web::resource("/invalidate/{key}").route(web::post().to(invalidate)))
+ }
+}
diff --git a/crates/router/src/routes/cache.rs b/crates/router/src/routes/cache.rs
new file mode 100644
index 00000000000..4a54a9bb627
--- /dev/null
+++ b/crates/router/src/routes/cache.rs
@@ -0,0 +1,29 @@
+use actix_web::{web, HttpRequest, Responder};
+use router_env::{instrument, tracing, Flow};
+
+use super::AppState;
+use crate::{
+ core::cache,
+ services::{api, authentication as auth},
+};
+
+#[instrument(skip_all)]
+pub async fn invalidate(
+ state: web::Data<AppState>,
+ req: HttpRequest,
+ key: web::Path<String>,
+) -> impl Responder {
+ let flow = Flow::CacheInvalidate;
+
+ let key = key.into_inner().to_owned();
+
+ api::server_wrap(
+ flow,
+ state.get_ref(),
+ &req,
+ &key,
+ |state, _, key| cache::invalidate(&*state.store, key),
+ &auth::AdminApiAuth,
+ )
+ .await
+}
diff --git a/crates/router/tests/cache.rs b/crates/router/tests/cache.rs
new file mode 100644
index 00000000000..e918d0f4c7b
--- /dev/null
+++ b/crates/router/tests/cache.rs
@@ -0,0 +1,76 @@
+#![allow(clippy::unwrap_used)]
+use router::{
+ cache::{self},
+ configs::settings::Settings,
+ routes,
+};
+
+mod utils;
+
+#[actix_web::test]
+async fn invalidate_existing_cache_success() {
+ // Arrange
+ utils::setup().await;
+ let (tx, _) = tokio::sync::oneshot::channel();
+ let state = routes::AppState::new(Settings::default(), tx).await;
+
+ let cache_key = "cacheKey".to_string();
+ let cache_key_value = "val".to_string();
+ let _ = state
+ .store
+ .get_redis_conn()
+ .set_key(&cache_key.clone(), cache_key_value.clone())
+ .await;
+
+ let api_key = ("api-key", "test_admin");
+ let client = awc::Client::default();
+
+ cache::CONFIG_CACHE
+ .push(cache_key.clone(), cache_key_value.clone())
+ .await;
+
+ cache::ACCOUNTS_CACHE
+ .push(cache_key.clone(), cache_key_value.clone())
+ .await;
+
+ // Act
+ let mut response = client
+ .post(format!(
+ "http://127.0.0.1:8080/cache/invalidate/{cache_key}"
+ ))
+ .insert_header(api_key)
+ .send()
+ .await
+ .unwrap();
+
+ // Assert
+ 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).is_none());
+ assert!(cache::ACCOUNTS_CACHE.get(&cache_key).is_none());
+}
+
+#[actix_web::test]
+async fn invalidate_non_existing_cache_success() {
+ // Arrange
+ utils::setup().await;
+ let cache_key = "cacheKey".to_string();
+ let api_key = ("api-key", "test_admin");
+ let client = awc::Client::default();
+
+ // Act
+ let mut response = client
+ .post(format!(
+ "http://127.0.0.1:8080/cache/invalidate/{cache_key}"
+ ))
+ .insert_header(api_key)
+ .send()
+ .await
+ .unwrap();
+
+ // Assert
+ let response_body = response.body().await;
+ println!("invalidate Cache: {response:?} : {response_body:?}");
+ assert_eq!(response.status(), awc::http::StatusCode::NOT_FOUND);
+}
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 8ccfb730110..b9fd06876ec 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -184,6 +184,8 @@ pub enum Flow {
AttachDisputeEvidence,
/// Retrieve Dispute Evidence flow
RetrieveDisputeEvidence,
+ /// Invalidate cache flow
+ CacheInvalidate,
}
///
|
feat
|
add route to invalidate cache entry (#1100)
|
02479a12b18dc68e2787ae237580fcb46348374e
|
2024-11-26 17:46:32
|
Mani Chandra
|
refactor(authn): Enable cookies in Integ (#6599)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 0436cea6b48..4bdcdcf79df 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -403,6 +403,7 @@ two_factor_auth_expiry_in_secs = 300 # Number of seconds after which 2FA should
totp_issuer_name = "Hyperswitch" # Name of the issuer for TOTP
base_url = "" # Base url used for user specific redirects and emails
force_two_factor_auth = false # Whether to force two factor authentication for all users
+force_cookies = true # Whether to use only cookies for JWT extraction and authentication
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index ce6f38d84a4..a4e1b1e9b13 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -145,6 +145,7 @@ two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Integ"
base_url = "https://integ.hyperswitch.io"
force_two_factor_auth = false
+force_cookies = true
[frm]
enabled = true
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 81985e83bcc..a859d08ac4a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -152,6 +152,7 @@ two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Production"
base_url = "https://live.hyperswitch.io"
force_two_factor_auth = true
+force_cookies = false
[frm]
enabled = false
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 4f98dc1ef09..070a32ef87b 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -152,6 +152,7 @@ two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Sandbox"
base_url = "https://app.hyperswitch.io"
force_two_factor_auth = false
+force_cookies = false
[frm]
enabled = true
diff --git a/config/development.toml b/config/development.toml
index 4cf2e1d4a80..2388607a489 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -329,6 +329,7 @@ two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch Dev"
base_url = "http://localhost:8080"
force_two_factor_auth = false
+force_cookies = true
[bank_config.eps]
stripe = { banks = "arzte_und_apotheker_bank,austrian_anadi_bank_ag,bank_austria,bankhaus_carl_spangler,bankhaus_schelhammer_und_schattera_ag,bawag_psk_ag,bks_bank_ag,brull_kallmus_bank_ag,btv_vier_lander_bank,capital_bank_grawe_gruppe_ag,dolomitenbank,easybank_ag,erste_bank_und_sparkassen,hypo_alpeadriabank_international_ag,hypo_noe_lb_fur_niederosterreich_u_wien,hypo_oberosterreich_salzburg_steiermark,hypo_tirol_bank_ag,hypo_vorarlberg_bank_ag,hypo_bank_burgenland_aktiengesellschaft,marchfelder_bank,oberbank_ag,raiffeisen_bankengruppe_osterreich,schoellerbank_ag,sparda_bank_wien,volksbank_gruppe,volkskreditbank_ag,vr_bank_braunau" }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index bf7779863ca..d72141d9c37 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -57,6 +57,7 @@ two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch"
base_url = "http://localhost:8080"
force_two_factor_auth = false
+force_cookies = true
[locker]
host = ""
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 7b212ec6d1d..4e559a261b9 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -557,6 +557,7 @@ pub struct UserSettings {
pub totp_issuer_name: String,
pub base_url: String,
pub force_two_factor_auth: bool,
+ pub force_cookies: bool,
}
#[derive(Debug, Deserialize, Clone)]
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index f01f6c5d749..c6501dac3bd 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -294,7 +294,7 @@ pub async fn connect_account(
pub async fn signout(
state: SessionState,
- user_from_token: auth::UserFromToken,
+ user_from_token: auth::UserIdFromAuth,
) -> UserResponse<()> {
tfa_utils::delete_totp_from_redis(&state, &user_from_token.user_id).await?;
tfa_utils::delete_recovery_code_from_redis(&state, &user_from_token.user_id).await?;
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 068c2f30c79..8fc0dad452a 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -130,7 +130,7 @@ pub async fn signout(state: web::Data<AppState>, http_req: HttpRequest) -> HttpR
&http_req,
(),
|state, user, _, _| user_core::signout(state, user),
- &auth::DashboardNoPermissionAuth,
+ &auth::AnyPurposeOrLoginTokenAuth,
api_locking::LockAction::NotApplicable,
))
.await
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 2f5f55b8434..c05e4514aaa 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -871,6 +871,47 @@ where
}
}
+#[cfg(feature = "olap")]
+#[derive(Debug)]
+pub struct AnyPurposeOrLoginTokenAuth;
+
+#[cfg(feature = "olap")]
+#[async_trait]
+impl<A> AuthenticateAndFetch<UserIdFromAuth, A> for AnyPurposeOrLoginTokenAuth
+where
+ A: SessionStateInfo + Sync,
+{
+ async fn authenticate_and_fetch(
+ &self,
+ request_headers: &HeaderMap,
+ state: &A,
+ ) -> RouterResult<(UserIdFromAuth, AuthenticationType)> {
+ let payload =
+ parse_jwt_payload::<A, SinglePurposeOrLoginToken>(request_headers, state).await?;
+ if payload.check_in_blacklist(state).await? {
+ return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
+ }
+
+ let purpose_exists = payload.purpose.is_some();
+ let role_id_exists = payload.role_id.is_some();
+
+ if purpose_exists ^ role_id_exists {
+ Ok((
+ UserIdFromAuth {
+ user_id: payload.user_id.clone(),
+ },
+ AuthenticationType::SinglePurposeOrLoginJwt {
+ user_id: payload.user_id,
+ purpose: payload.purpose,
+ role_id: payload.role_id,
+ },
+ ))
+ } else {
+ Err(errors::ApiErrorResponse::InvalidJwtToken.into())
+ }
+ }
+}
+
#[derive(Debug, Default)]
pub struct AdminApiAuth;
@@ -2504,17 +2545,27 @@ where
T: serde::de::DeserializeOwned,
A: SessionStateInfo + Sync,
{
- let token = match get_cookie_from_header(headers).and_then(cookies::parse_cookie) {
- Ok(cookies) => cookies,
- Err(error) => {
- let token = get_jwt_from_authorization_header(headers);
- if token.is_err() {
- logger::error!(?error);
- }
- token?.to_owned()
- }
+ let cookie_token_result = get_cookie_from_header(headers).and_then(cookies::parse_cookie);
+ let auth_header_token_result = get_jwt_from_authorization_header(headers);
+ let force_cookie = state.conf().user.force_cookies;
+
+ logger::info!(
+ user_agent = ?headers.get(headers::USER_AGENT),
+ header_names = ?headers.keys().collect::<Vec<_>>(),
+ is_token_equal =
+ auth_header_token_result.as_deref().ok() == cookie_token_result.as_deref().ok(),
+ cookie_error = ?cookie_token_result.as_ref().err(),
+ token_error = ?auth_header_token_result.as_ref().err(),
+ force_cookie,
+ );
+
+ let final_token = if force_cookie {
+ cookie_token_result?
+ } else {
+ auth_header_token_result?.to_owned()
};
- decode_jwt(&token, state).await
+
+ decode_jwt(&final_token, state).await
}
#[cfg(feature = "v1")]
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index dab85eb3cdd..a3ac1159ddb 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -36,6 +36,7 @@ password_validity_in_days = 90
two_factor_auth_expiry_in_secs = 300
totp_issuer_name = "Hyperswitch"
force_two_factor_auth = false
+force_cookies = true
[locker]
host = ""
|
refactor
|
Enable cookies in Integ (#6599)
|
be44447c09ea8814dc8b88aa971e08cc749db5f3
|
2024-05-02 15:05:19
|
Apoorv Dixit
|
feat(user): add route to get user details (#4510)
| false
|
diff --git a/crates/api_models/src/events/user.rs b/crates/api_models/src/events/user.rs
index 9884dbc4f41..8f017ca8c20 100644
--- a/crates/api_models/src/events/user.rs
+++ b/crates/api_models/src/events/user.rs
@@ -12,10 +12,11 @@ use crate::user::{
},
AcceptInviteFromEmailRequest, AuthorizeResponse, ChangePasswordRequest, ConnectAccountRequest,
CreateInternalUserRequest, DashboardEntryResponse, ForgotPasswordRequest,
- GetUserDetailsRequest, GetUserDetailsResponse, InviteUserRequest, ListUsersResponse,
- ReInviteUserRequest, ResetPasswordRequest, SendVerifyEmailRequest, SignInResponse,
- SignUpRequest, SignUpWithMerchantIdRequest, SwitchMerchantIdRequest,
- UpdateUserAccountDetailsRequest, UserMerchantCreate, VerifyEmailRequest,
+ GetUserDetailsResponse, GetUserRoleDetailsRequest, GetUserRoleDetailsResponse,
+ InviteUserRequest, ListUsersResponse, ReInviteUserRequest, ResetPasswordRequest,
+ SendVerifyEmailRequest, SignInResponse, SignUpRequest, SignUpWithMerchantIdRequest,
+ SwitchMerchantIdRequest, UpdateUserAccountDetailsRequest, UserMerchantCreate,
+ VerifyEmailRequest,
};
impl ApiEventMetric for DashboardEntryResponse {
@@ -60,8 +61,9 @@ common_utils::impl_misc_api_event_type!(
AcceptInviteFromEmailRequest,
SignInResponse,
UpdateUserAccountDetailsRequest,
- GetUserDetailsRequest,
- GetUserDetailsResponse
+ GetUserDetailsResponse,
+ GetUserRoleDetailsRequest,
+ GetUserRoleDetailsResponse
);
#[cfg(feature = "dummy_connector")]
diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs
index 9b3d7a2e654..700c27461cd 100644
--- a/crates/api_models/src/user.rs
+++ b/crates/api_models/src/user.rs
@@ -149,13 +149,25 @@ pub struct UserDetails {
pub last_modified_at: time::PrimitiveDateTime,
}
+#[derive(serde::Serialize, Debug, Clone)]
+pub struct GetUserDetailsResponse {
+ pub merchant_id: String,
+ pub name: Secret<String>,
+ pub email: pii::Email,
+ pub verification_days_left: Option<i64>,
+ pub role_id: String,
+ // This field is added for audit/debug reasons
+ #[serde(skip_serializing)]
+ pub user_id: String,
+ pub org_id: String,
+}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
-pub struct GetUserDetailsRequest {
+pub struct GetUserRoleDetailsRequest {
pub email: pii::Email,
}
#[derive(Debug, serde::Serialize)]
-pub struct GetUserDetailsResponse {
+pub struct GetUserRoleDetailsResponse {
pub email: pii::Email,
pub name: Secret<String>,
pub role_id: String,
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs
index 71d18774cb8..2e439a6eb52 100644
--- a/crates/router/src/core/user.rs
+++ b/crates/router/src/core/user.rs
@@ -71,6 +71,26 @@ pub async fn signup_with_merchant_id(
}))
}
+pub async fn get_user_details(
+ state: AppState,
+ user_from_token: auth::UserFromToken,
+) -> UserResponse<user_api::GetUserDetailsResponse> {
+ let user = user_from_token.get_user_from_db(&state).await?;
+ let verification_days_left = utils::user::get_verification_days_left(&state, &user)?;
+
+ Ok(ApplicationResponse::Json(
+ user_api::GetUserDetailsResponse {
+ merchant_id: user_from_token.merchant_id,
+ name: user.get_name(),
+ email: user.get_email(),
+ user_id: user.get_user_id().to_string(),
+ verification_days_left,
+ role_id: user_from_token.role_id,
+ org_id: user_from_token.org_id,
+ },
+ ))
+}
+
pub async fn signup(
state: AppState,
request: user_api::SignUpRequest,
@@ -1001,9 +1021,9 @@ pub async fn list_merchants_for_user(
pub async fn get_user_details_in_merchant_account(
state: AppState,
user_from_token: auth::UserFromToken,
- request: user_api::GetUserDetailsRequest,
+ request: user_api::GetUserRoleDetailsRequest,
_req_state: ReqState,
-) -> UserResponse<user_api::GetUserDetailsResponse> {
+) -> UserResponse<user_api::GetUserRoleDetailsResponse> {
let required_user = utils::user::get_user_from_db_by_email(&state, request.email.try_into()?)
.await
.to_not_found_response(UserErrors::InvalidRoleOperation)?;
@@ -1029,7 +1049,7 @@ pub async fn get_user_details_in_merchant_account(
.attach_printable("User role exists but the corresponding role doesn't")?;
Ok(ApplicationResponse::Json(
- user_api::GetUserDetailsResponse {
+ user_api::GetUserRoleDetailsResponse {
email: required_user.get_email(),
name: required_user.get_name(),
role_id: role_info.get_role_id().to_string(),
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index d42d3fe0039..5b59ebb692d 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1163,6 +1163,7 @@ impl User {
let mut route = web::scope("/user").app_data(web::Data::new(state));
route = route
+ .service(web::resource("").route(web::get().to(get_user_details)))
.service(web::resource("/v2/signin").route(web::post().to(user_signin)))
.service(web::resource("/signout").route(web::post().to(signout)))
.service(web::resource("/change_password").route(web::post().to(change_password)))
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index f8a0a6a5ff0..faef85f3901 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -198,6 +198,7 @@ impl From<Flow> for ApiIdentifier {
| Flow::DeleteSampleData
| Flow::UserMerchantAccountList
| Flow::GetUserDetails
+ | Flow::GetUserRoleDetails
| Flow::ListUsersForMerchantAccount
| Flow::ForgotPassword
| Flow::ResetPassword
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index bf3ddbc4491..0657d781b08 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -19,6 +19,20 @@ use crate::{
utils::user::dashboard_metadata::{parse_string_to_enums, set_ip_address_if_required},
};
+pub async fn get_user_details(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
+ let flow = Flow::GetUserDetails;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ (),
+ |state, user, _, _| user_core::get_user_details(state, user),
+ &auth::DashboardNoPermissionAuth,
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
+
#[cfg(feature = "email")]
pub async fn user_signup_with_merchant_id(
state: web::Data<AppState>,
@@ -295,7 +309,7 @@ pub async fn list_merchants_for_user(state: web::Data<AppState>, req: HttpReques
pub async fn get_user_role_details(
state: web::Data<AppState>,
req: HttpRequest,
- payload: web::Query<user_api::GetUserDetailsRequest>,
+ payload: web::Query<user_api::GetUserRoleDetailsRequest>,
) -> HttpResponse {
let flow = Flow::GetUserDetails;
Box::pin(api::server_wrap(
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index a7aac03db51..26cb619d74c 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -348,8 +348,10 @@ pub enum Flow {
DeleteSampleData,
/// List merchant accounts for user
UserMerchantAccountList,
- /// Get details of a user in a merchant account
+ /// Get details of a user
GetUserDetails,
+ /// Get details of a user role in a merchant account
+ GetUserRoleDetails,
/// List users for merchant account
ListUsersForMerchantAccount,
/// PaymentMethodAuth Link token create
|
feat
|
add route to get user details (#4510)
|
517c5c41655f82ab773f6875447d7d88390d538e
|
2023-09-08 12:47:43
|
Hrithikesh
|
feat(connector): (checkout.com) add support for multiple captures PSync (#2043)
| false
|
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index 588023f30fa..9d7afb0ccbf 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -375,14 +375,19 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
req: &types::PaymentsSyncRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
+ let suffix = match req.request.sync_type {
+ types::SyncRequestType::MultipleCaptureSync(_) => "/actions",
+ types::SyncRequestType::SinglePaymentSync => "",
+ };
Ok(format!(
- "{}{}{}",
+ "{}{}{}{}",
self.base_url(connectors),
"payments/",
req.request
.connector_transaction_id
.get_connector_transaction_id()
- .change_context(errors::ConnectorError::MissingConnectorTransactionID)?
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
+ suffix
))
}
@@ -412,17 +417,40 @@ impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsRe
types::PaymentsSyncData: Clone,
types::PaymentsResponseData: Clone,
{
- let response: checkout::PaymentsResponse = res
- .response
- .parse_struct("PaymentsResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- router_env::logger::info!(connector_response=?response);
- types::RouterData::try_from(types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- })
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ match &data.request.sync_type {
+ types::SyncRequestType::MultipleCaptureSync(_) => {
+ let response: checkout::PaymentsResponseEnum = res
+ .response
+ .parse_struct("checkout::PaymentsResponseEnum")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+ types::SyncRequestType::SinglePaymentSync => {
+ let response: checkout::PaymentsResponse = res
+ .response
+ .parse_struct("PaymentsResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }
+ }
+ }
+
+ fn get_multiple_capture_sync_method(
+ &self,
+ ) -> CustomResult<services::CaptureSyncMethod, errors::ConnectorError> {
+ Ok(services::CaptureSyncMethod::Bulk)
}
fn get_error_response(
@@ -1185,12 +1213,26 @@ impl api::IncomingWebhook for Checkout {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<serde_json::Value, errors::ConnectorError> {
- let details: checkout::CheckoutWebhookObjectResource = request
+ let event_type_data: checkout::CheckoutWebhookEventTypeBody = request
.body
- .parse_struct("CheckoutWebhookObjectResource")
- .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
-
- Ok(details.data)
+ .parse_struct("CheckoutWebhookBody")
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ let resource_object = if checkout::is_chargeback_event(&event_type_data.transaction_type)
+ && checkout::is_refund_event(&event_type_data.transaction_type)
+ {
+ // if other event, just return the json data.
+ let resource_object_data: checkout::CheckoutWebhookObjectResource = request
+ .body
+ .parse_struct("CheckoutWebhookObjectResource")
+ .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
+ resource_object_data.data
+ } else {
+ // if payment_event, construct PaymentResponse and then serialize it to json and return.
+ let payment_response = checkout::PaymentsResponse::try_from(request)?;
+ utils::Encode::<checkout::PaymentsResponse>::encode_to_value(&payment_response)
+ .change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?
+ };
+ Ok(resource_object)
}
fn get_dispute_details(
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 25403568a75..688ef9226fb 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -1,4 +1,4 @@
-use common_utils::errors::CustomResult;
+use common_utils::{errors::CustomResult, ext_traits::ByteSliceExt};
use error_stack::{IntoReport, ResultExt};
use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -394,7 +394,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentsRequest {
}
}
-#[derive(Default, Clone, Debug, Eq, PartialEq, Deserialize)]
+#[derive(Default, Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub enum CheckoutPaymentStatus {
Authorized,
#[default]
@@ -405,6 +405,35 @@ pub enum CheckoutPaymentStatus {
Captured,
}
+impl TryFrom<CheckoutWebhookEventType> for CheckoutPaymentStatus {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(value: CheckoutWebhookEventType) -> Result<Self, Self::Error> {
+ match value {
+ CheckoutWebhookEventType::PaymentApproved => Ok(Self::Authorized),
+ CheckoutWebhookEventType::PaymentCaptured => Ok(Self::Captured),
+ CheckoutWebhookEventType::PaymentDeclined => Ok(Self::Declined),
+ CheckoutWebhookEventType::AuthenticationStarted
+ | CheckoutWebhookEventType::AuthenticationApproved => Ok(Self::Pending),
+ CheckoutWebhookEventType::PaymentRefunded
+ | CheckoutWebhookEventType::PaymentRefundDeclined
+ | CheckoutWebhookEventType::DisputeReceived
+ | CheckoutWebhookEventType::DisputeExpired
+ | CheckoutWebhookEventType::DisputeAccepted
+ | CheckoutWebhookEventType::DisputeCanceled
+ | CheckoutWebhookEventType::DisputeEvidenceSubmitted
+ | CheckoutWebhookEventType::DisputeEvidenceAcknowledgedByScheme
+ | CheckoutWebhookEventType::DisputeEvidenceRequired
+ | CheckoutWebhookEventType::DisputeArbitrationLost
+ | CheckoutWebhookEventType::DisputeArbitrationWon
+ | CheckoutWebhookEventType::DisputeWon
+ | CheckoutWebhookEventType::DisputeLost
+ | CheckoutWebhookEventType::Unknown => {
+ Err(errors::ConnectorError::WebhookEventTypeNotFound.into())
+ }
+ }
+ }
+}
+
impl ForeignFrom<(CheckoutPaymentStatus, Option<enums::CaptureMethod>)> for enums::AttemptStatus {
fn foreign_from(item: (CheckoutPaymentStatus, Option<enums::CaptureMethod>)) -> Self {
let (status, capture_method) = item;
@@ -449,20 +478,21 @@ impl ForeignFrom<(CheckoutPaymentStatus, Option<Balances>)> for enums::AttemptSt
}
}
-#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct Href {
#[serde(rename = "href")]
redirection_url: Url,
}
-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct Links {
redirect: Option<Href>,
}
-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct PaymentsResponse {
id: String,
amount: Option<i32>,
+ action_id: Option<String>,
status: CheckoutPaymentStatus,
#[serde(rename = "_links")]
links: Links,
@@ -472,7 +502,14 @@ pub struct PaymentsResponse {
response_summary: Option<String>,
}
-#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize)]
+#[derive(Debug, Deserialize)]
+#[serde(untagged)]
+pub enum PaymentsResponseEnum {
+ ActionResponse(Vec<ActionResponse>),
+ PaymentResponse(Box<PaymentsResponse>),
+}
+
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct Balances {
available_to_capture: i32,
}
@@ -573,6 +610,33 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponse>>
}
}
+impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponseEnum>>
+ for types::PaymentsSyncRouterData
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(
+ item: types::PaymentsSyncResponseRouterData<PaymentsResponseEnum>,
+ ) -> Result<Self, Self::Error> {
+ let capture_sync_response_list = match item.response {
+ PaymentsResponseEnum::PaymentResponse(payments_response) => {
+ // for webhook consumption flow
+ utils::construct_captures_response_hashmap(vec![payments_response])
+ }
+ PaymentsResponseEnum::ActionResponse(action_list) => {
+ // for captures sync
+ utils::construct_captures_response_hashmap(action_list)
+ }
+ };
+ Ok(Self {
+ response: Ok(types::PaymentsResponseData::MultipleCaptureResponse {
+ capture_sync_response_list,
+ }),
+ ..item.data
+ })
+ }
+}
+
#[derive(Clone, Default, Debug, Eq, PartialEq, Serialize)]
pub struct PaymentVoidRequest {
reference: String,
@@ -795,7 +859,7 @@ pub struct ErrorResponse {
pub error_codes: Option<Vec<String>>,
}
-#[derive(Deserialize, Debug)]
+#[derive(Deserialize, Debug, PartialEq)]
pub enum ActionType {
Authorization,
Void,
@@ -828,6 +892,46 @@ impl From<&ActionResponse> for enums::RefundStatus {
}
}
+impl utils::MultipleCaptureSyncResponse for ActionResponse {
+ fn get_connector_capture_id(&self) -> String {
+ self.action_id.clone()
+ }
+
+ fn get_capture_attempt_status(&self) -> enums::AttemptStatus {
+ match self.approved {
+ Some(true) => enums::AttemptStatus::Charged,
+ Some(false) => enums::AttemptStatus::Failure,
+ None => enums::AttemptStatus::Pending,
+ }
+ }
+
+ fn get_connector_reference_id(&self) -> Option<String> {
+ self.reference.clone()
+ }
+
+ fn is_capture_response(&self) -> bool {
+ self.action_type == ActionType::Capture
+ }
+}
+
+impl utils::MultipleCaptureSyncResponse for Box<PaymentsResponse> {
+ fn get_connector_capture_id(&self) -> String {
+ self.action_id.clone().unwrap_or("".into())
+ }
+
+ fn get_capture_attempt_status(&self) -> enums::AttemptStatus {
+ enums::AttemptStatus::foreign_from((self.status.clone(), self.balances.clone()))
+ }
+
+ fn get_connector_reference_id(&self) -> Option<String> {
+ self.reference.clone()
+ }
+
+ fn is_capture_response(&self) -> bool {
+ self.status == CheckoutPaymentStatus::Captured
+ }
+}
+
#[derive(Debug, Clone, serde::Deserialize, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum CheckoutRedirectResponseStatus {
@@ -947,7 +1051,11 @@ pub struct CheckoutWebhookData {
pub id: String,
pub payment_id: Option<String>,
pub action_id: Option<String>,
+ pub reference: Option<String>,
pub amount: i32,
+ pub balances: Option<Balances>,
+ pub response_code: Option<String>,
+ pub response_summary: Option<String>,
pub currency: String,
}
@@ -956,6 +1064,8 @@ pub struct CheckoutWebhookBody {
#[serde(rename = "type")]
pub transaction_type: CheckoutWebhookEventType,
pub data: CheckoutWebhookData,
+ #[serde(rename = "_links")]
+ pub links: Links,
}
#[derive(Debug, Deserialize)]
@@ -1087,6 +1197,31 @@ pub struct Evidence {
pub additional_evidence_file: Option<String>,
}
+impl TryFrom<&api::IncomingWebhookRequestDetails<'_>> for PaymentsResponse {
+ type Error = error_stack::Report<errors::ConnectorError>;
+
+ fn try_from(request: &api::IncomingWebhookRequestDetails<'_>) -> Result<Self, Self::Error> {
+ let details: CheckoutWebhookBody = request
+ .body
+ .parse_struct("CheckoutWebhookBody")
+ .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
+ let data = details.data;
+ let psync_struct = Self {
+ id: data.payment_id.unwrap_or(data.id),
+ amount: Some(data.amount),
+ status: CheckoutPaymentStatus::try_from(details.transaction_type)?,
+ links: details.links,
+ balances: data.balances,
+ reference: data.reference,
+ response_code: data.response_code,
+ response_summary: data.response_summary,
+ action_id: data.action_id,
+ };
+
+ Ok(psync_struct)
+ }
+}
+
impl TryFrom<&types::SubmitEvidenceRouterData> for Evidence {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::SubmitEvidenceRouterData) -> Result<Self, Self::Error> {
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 727875d0018..2ba223e6bdb 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -21,7 +21,10 @@ use crate::{
consts,
core::errors::{self, CustomResult},
pii::PeekInterface,
- types::{self, api, transformers::ForeignTryFrom, PaymentsCancelData, ResponseId},
+ types::{
+ self, api, storage::enums as storage_enums, transformers::ForeignTryFrom,
+ PaymentsCancelData, ResponseId,
+ },
utils::{OptionExt, ValueExt},
};
@@ -1332,6 +1335,41 @@ mod error_code_error_message_tests {
}
}
+pub trait MultipleCaptureSyncResponse {
+ fn get_connector_capture_id(&self) -> String;
+ fn get_capture_attempt_status(&self) -> storage_enums::AttemptStatus;
+ fn is_capture_response(&self) -> bool;
+ fn get_connector_reference_id(&self) -> Option<String> {
+ None
+ }
+}
+
+pub fn construct_captures_response_hashmap<T>(
+ capture_sync_response_list: Vec<T>,
+) -> HashMap<String, types::CaptureSyncResponse>
+where
+ T: MultipleCaptureSyncResponse,
+{
+ let mut hashmap = HashMap::new();
+ capture_sync_response_list
+ .into_iter()
+ .for_each(|capture_sync_response| {
+ let connector_capture_id = capture_sync_response.get_connector_capture_id();
+ if capture_sync_response.is_capture_response() {
+ hashmap.insert(
+ connector_capture_id.clone(),
+ types::CaptureSyncResponse::Success {
+ resource_id: ResponseId::ConnectorTransactionId(connector_capture_id),
+ status: capture_sync_response.get_capture_attempt_status(),
+ connector_response_reference_id: capture_sync_response
+ .get_connector_reference_id(),
+ },
+ );
+ }
+ });
+ hashmap
+}
+
pub fn validate_currency(
request_currency: types::storage::enums::Currency,
merchant_config_currency: Option<types::storage::enums::Currency>,
diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs
index 82a7f672868..5da9ff035cb 100644
--- a/crates/router/src/core/payments/flows/psync_flow.rs
+++ b/crates/router/src/core/payments/flows/psync_flow.rs
@@ -66,12 +66,9 @@ impl Feature<api::PSync, types::PaymentsSyncData>
.get_multiple_capture_sync_method()
.to_payment_failed_response();
- match (
- self.request.capture_sync_type.clone(),
- capture_sync_method_result,
- ) {
+ match (self.request.sync_type.clone(), capture_sync_method_result) {
(
- types::CaptureSyncType::MultipleCaptureSync(pending_connector_capture_id_list),
+ types::SyncRequestType::MultipleCaptureSync(pending_connector_capture_id_list),
Ok(services::CaptureSyncMethod::Individual),
) => {
let resp = self
@@ -84,7 +81,7 @@ impl Feature<api::PSync, types::PaymentsSyncData>
.await?;
Ok(resp)
}
- (types::CaptureSyncType::MultipleCaptureSync(_), Err(err)) => Err(err),
+ (types::SyncRequestType::MultipleCaptureSync(_), Err(err)) => Err(err),
_ => {
// for bulk sync of captures, above logic needs to be handled at connector end
let resp = services::execute_connector_processing_step(
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index d1cde60ca81..cde3a3d4012 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -978,11 +978,11 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsSyncData
encoded_data: payment_data.connector_response.encoded_data,
capture_method: payment_data.payment_attempt.capture_method,
connector_meta: payment_data.payment_attempt.connector_metadata,
- capture_sync_type: match payment_data.multiple_capture_data {
- Some(multiple_capture_data) => types::CaptureSyncType::MultipleCaptureSync(
+ sync_type: match payment_data.multiple_capture_data {
+ Some(multiple_capture_data) => types::SyncRequestType::MultipleCaptureSync(
multiple_capture_data.get_pending_connector_capture_ids(),
),
- None => types::CaptureSyncType::SingleCaptureSync,
+ None => types::SyncRequestType::SinglePaymentSync,
},
})
}
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 9f0b77a7d78..af989ac2f58 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -452,15 +452,15 @@ pub struct PaymentsSyncData {
pub encoded_data: Option<String>,
pub capture_method: Option<storage_enums::CaptureMethod>,
pub connector_meta: Option<serde_json::Value>,
- pub capture_sync_type: CaptureSyncType,
+ pub sync_type: SyncRequestType,
pub mandate_id: Option<api_models::payments::MandateIds>,
}
#[derive(Debug, Default, Clone)]
-pub enum CaptureSyncType {
+pub enum SyncRequestType {
MultipleCaptureSync(Vec<String>),
#[default]
- SingleCaptureSync,
+ SinglePaymentSync,
}
#[derive(Debug, Default, Clone)]
diff --git a/crates/router/tests/connectors/bambora.rs b/crates/router/tests/connectors/bambora.rs
index 121bad9d93d..5638214202b 100644
--- a/crates/router/tests/connectors/bambora.rs
+++ b/crates/router/tests/connectors/bambora.rs
@@ -106,7 +106,7 @@ async fn should_sync_authorized_payment() {
),
encoded_data: None,
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
}),
None,
@@ -220,7 +220,7 @@ async fn should_sync_auto_captured_payment() {
),
encoded_data: None,
capture_method: Some(enums::CaptureMethod::Automatic),
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
}),
None,
diff --git a/crates/router/tests/connectors/forte.rs b/crates/router/tests/connectors/forte.rs
index 89af2e1b64b..703b8900b69 100644
--- a/crates/router/tests/connectors/forte.rs
+++ b/crates/router/tests/connectors/forte.rs
@@ -150,7 +150,7 @@ async fn should_sync_authorized_payment() {
),
encoded_data: None,
capture_method: None,
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
mandate_id: None,
}),
diff --git a/crates/router/tests/connectors/nexinets.rs b/crates/router/tests/connectors/nexinets.rs
index ec77ede13a0..f9b8affb062 100644
--- a/crates/router/tests/connectors/nexinets.rs
+++ b/crates/router/tests/connectors/nexinets.rs
@@ -120,7 +120,7 @@ async fn should_sync_authorized_payment() {
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta,
mandate_id: None,
}),
diff --git a/crates/router/tests/connectors/paypal.rs b/crates/router/tests/connectors/paypal.rs
index faf8f4d2287..e9df6556693 100644
--- a/crates/router/tests/connectors/paypal.rs
+++ b/crates/router/tests/connectors/paypal.rs
@@ -138,7 +138,7 @@ async fn should_sync_authorized_payment() {
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta,
}),
get_default_payment_info(),
@@ -334,7 +334,7 @@ async fn should_sync_auto_captured_payment() {
),
encoded_data: None,
capture_method: Some(enums::CaptureMethod::Automatic),
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta,
}),
get_default_payment_info(),
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index eac50482a67..8a043261ed5 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -938,7 +938,7 @@ impl Default for PaymentSyncType {
),
encoded_data: None,
capture_method: None,
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
};
Self(data)
diff --git a/crates/router/tests/connectors/zen.rs b/crates/router/tests/connectors/zen.rs
index 83d79d90a84..ca71fd0c622 100644
--- a/crates/router/tests/connectors/zen.rs
+++ b/crates/router/tests/connectors/zen.rs
@@ -99,7 +99,7 @@ async fn should_sync_authorized_payment() {
),
encoded_data: None,
capture_method: None,
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
mandate_id: None,
}),
@@ -213,7 +213,7 @@ async fn should_sync_auto_captured_payment() {
),
encoded_data: None,
capture_method: Some(enums::CaptureMethod::Automatic),
- capture_sync_type: types::CaptureSyncType::SingleCaptureSync,
+ sync_type: types::SyncRequestType::SinglePaymentSync,
connector_meta: None,
mandate_id: None,
}),
|
feat
|
(checkout.com) add support for multiple captures PSync (#2043)
|
ca4e242d206dc69a10a1fbf51805a4cf4885a35e
|
2023-07-06 13:22:48
|
AkshayaFoiger
|
feat(connector): [Stripe] implement Multibanco Bank Transfer for stripe (#1420)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index cf0de8e088a..a5647e72266 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -436,6 +436,7 @@ pub enum PaymentMethodType {
Klarna,
MbWay,
MobilePay,
+ Multibanco,
OnlineBankingCzechRepublic,
OnlineBankingFinland,
OnlineBankingPoland,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 206b504d3b2..2d4a539c1e9 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -807,6 +807,12 @@ pub struct AchBillingDetails {
pub email: Email,
}
+#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct MultibancoBillingDetails {
+ #[schema(value_type = String, example = "[email protected]")]
+ pub email: Email,
+}
+
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SepaAndBacsBillingDetails {
/// The Email ID for SEPA and BACS billing
@@ -866,6 +872,10 @@ pub enum BankTransferData {
/// The billing details for SEPA
billing_details: SepaAndBacsBillingDetails,
},
+ MultibancoBankTransfer {
+ /// The billing details for Multibanco
+ billing_details: MultibancoBillingDetails,
+ },
}
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
@@ -1241,6 +1251,8 @@ pub enum BankTransferInstructions {
SepaBankInstructions(Box<SepaBankTransferInstructions>),
/// The instructions for BACS bank transactions
BacsBankInstructions(Box<BacsBankTransferInstructions>),
+ /// The instructions for Multibanco bank transactions
+ Multibanco(Box<MultibancoTransferInstructions>),
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -1264,6 +1276,14 @@ pub struct BacsBankTransferInstructions {
pub sort_code: Secret<String>,
}
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+pub struct MultibancoTransferInstructions {
+ #[schema(value_type = String, example = "122385736258")]
+ pub reference: Secret<String>,
+ #[schema(value_type = String, example = "12345")]
+ pub entity: String,
+}
+
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct AchTransfer {
#[schema(value_type = String, example = "122385736258")]
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 9bfd7e9ba8e..4f4f27c7b0a 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -130,12 +130,13 @@ impl
&self,
req: &types::PaymentsPreProcessingRouterData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
- let req = stripe::StripeAchSourceRequest::try_from(req)?;
+ let req = stripe::StripeCreditTransferSourceRequest::try_from(req)?;
let pre_processing_request = types::RequestBody::log_and_get_request_body(
&req,
- utils::Encode::<stripe::StripeAchSourceRequest>::url_encode,
+ utils::Encode::<stripe::StripeCreditTransferSourceRequest>::url_encode,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
+
Ok(Some(pre_processing_request))
}
@@ -721,7 +722,8 @@ impl
match &req.request.payment_method_data {
api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => {
match bank_transfer_data.deref() {
- api_models::payments::BankTransferData::AchBankTransfer { .. } => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {
Ok(format!("{}{}", self.base_url(connectors), "v1/charges"))
}
_ => Ok(format!(
@@ -1772,7 +1774,9 @@ impl api::IncomingWebhook for Stripe {
}
stripe::WebhookEventType::ChargeSucceeded => {
if let Some(stripe::WebhookPaymentMethodDetails {
- payment_method: stripe::WebhookPaymentMethodType::AchCreditTransfer,
+ payment_method:
+ stripe::WebhookPaymentMethodType::AchCreditTransfer
+ | stripe::WebhookPaymentMethodType::MultibancoBankTransfers,
}) = details.event_data.event_object.payment_method_details
{
api::IncomingWebhookEvent::PaymentIntentSuccess
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 1ce506fbeca..7a9c9ef4e27 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -15,10 +15,7 @@ use uuid::Uuid;
use crate::{
collect_missing_value_keys,
- connector::{
- self,
- utils::{ApplePay, RouterData},
- },
+ connector::utils::{ApplePay, PaymentsPreProcessingData, RouterData},
core::errors,
services,
types::{self, api, storage::enums, transformers::ForeignFrom},
@@ -292,7 +289,13 @@ pub struct StripeBankRedirectData {
}
#[derive(Debug, Eq, PartialEq, Serialize)]
-pub struct AchBankTransferData {
+pub struct AchTransferData {
+ #[serde(rename = "owner[email]")]
+ pub email: Email,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct MultibancoTransferData {
#[serde(rename = "owner[email]")]
pub email: Email,
}
@@ -326,12 +329,31 @@ pub struct SepaBankTransferData {
}
#[derive(Debug, Eq, PartialEq, Serialize)]
-pub struct StripeAchSourceRequest {
+#[serde(untagged)]
+pub enum StripeCreditTransferSourceRequest {
+ AchBankTansfer(AchCreditTransferSourceRequest),
+ MultibancoBankTansfer(MultibancoCreditTransferSourceRequest),
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct AchCreditTransferSourceRequest {
#[serde(rename = "type")]
pub transfer_type: StripePaymentMethodType,
#[serde(flatten)]
- pub payment_method_data: AchBankTransferData,
- pub currency: String,
+ pub payment_method_data: AchTransferData,
+ pub currency: enums::Currency,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct MultibancoCreditTransferSourceRequest {
+ #[serde(rename = "type")]
+ pub transfer_type: StripePaymentMethodType,
+ #[serde(flatten)]
+ pub payment_method_data: MultibancoTransferData,
+ pub currency: enums::Currency,
+ pub amount: Option<i64>,
+ #[serde(rename = "redirect[return_url]")]
+ pub return_url: Option<String>,
}
// Remove untagged when Deserialize is added
@@ -395,9 +417,10 @@ pub struct BankTransferData {
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeBankTransferData {
- AchBankTransfer(Box<AchBankTransferData>),
+ AchBankTransfer(Box<AchTransferData>),
SepaBankTransfer(Box<SepaBankTransferData>),
BacsBankTransfers(Box<BacsBankTransferData>),
+ MultibancoBankTransfers(Box<MultibancoTransferData>),
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -494,6 +517,7 @@ pub enum StripePaymentMethodType {
#[serde(rename = "p24")]
Przelewy24,
CustomerBalance,
+ Multibanco,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
@@ -1078,13 +1102,24 @@ fn create_stripe_payment_method(
match bank_transfer_data.deref() {
payments::BankTransferData::AchBankTransfer { billing_details } => Ok((
StripePaymentMethodData::BankTransfer(StripeBankTransferData::AchBankTransfer(
- Box::new(AchBankTransferData {
+ Box::new(AchTransferData {
email: billing_details.email.to_owned(),
}),
)),
StripePaymentMethodType::AchCreditTransfer,
StripeBillingAddress::default(),
)),
+ payments::BankTransferData::MultibancoBankTransfer { billing_details } => Ok((
+ StripePaymentMethodData::BankTransfer(
+ StripeBankTransferData::MultibancoBankTransfers(Box::new(
+ MultibancoTransferData {
+ email: billing_details.email.to_owned(),
+ },
+ )),
+ ),
+ StripePaymentMethodType::Multibanco,
+ StripeBillingAddress::default(),
+ )),
payments::BankTransferData::SepaBankTransfer {
billing_details,
country,
@@ -1444,7 +1479,10 @@ pub struct PaymentIntentResponse {
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct StripeSourceResponse {
pub id: String,
- pub ach_credit_transfer: AchCreditTransferResponse,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub ach_credit_transfer: Option<AchCreditTransferResponse>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub multibanco: Option<MultibancoCreditTansferResponse>,
pub receiver: AchReceiverDetails,
pub status: StripePaymentStatus,
}
@@ -1457,6 +1495,12 @@ pub struct AchCreditTransferResponse {
pub swift_code: Secret<String>,
}
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
+pub struct MultibancoCreditTansferResponse {
+ pub reference: Secret<String>,
+ pub entity: Secret<String>,
+}
+
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct AchReceiverDetails {
pub amount_received: i64,
@@ -1597,7 +1641,8 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat
| StripePaymentMethodOptions::Sepa {}
| StripePaymentMethodOptions::Bancontact {}
| StripePaymentMethodOptions::Przelewy24 {}
- | StripePaymentMethodOptions::CustomerBalance {} => None,
+ | StripePaymentMethodOptions::CustomerBalance {}
+ | StripePaymentMethodOptions::Multibanco {} => None,
}),
payment_method_id: Some(payment_method_id),
}
@@ -2088,6 +2133,7 @@ pub enum StripePaymentMethodOptions {
#[serde(rename = "p24")]
Przelewy24 {},
CustomerBalance {},
+ Multibanco {},
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
@@ -2127,23 +2173,42 @@ impl TryFrom<&types::PaymentsCaptureRouterData> for CaptureRequest {
}
}
-impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeAchSourceRequest {
+impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeCreditTransferSourceRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {
- Ok(Self {
- transfer_type: StripePaymentMethodType::AchCreditTransfer,
- payment_method_data: AchBankTransferData {
- email: connector::utils::PaymentsPreProcessingData::get_email(&item.request)?,
- },
- currency: item
- .request
- .currency
- .get_required_value("currency")
- .change_context(errors::ConnectorError::MissingRequiredField {
- field_name: "currency",
- })?
- .to_string(),
- })
+ let currency = item.request.get_currency()?;
+
+ match &item.request.payment_method_data {
+ Some(payments::PaymentMethodData::BankTransfer(bank_transfer_data)) => {
+ match **bank_transfer_data {
+ payments::BankTransferData::MultibancoBankTransfer { .. } => Ok(
+ Self::MultibancoBankTansfer(MultibancoCreditTransferSourceRequest {
+ transfer_type: StripePaymentMethodType::Multibanco,
+ currency,
+ payment_method_data: MultibancoTransferData {
+ email: item.request.get_email()?,
+ },
+ amount: Some(item.request.get_amount()?),
+ return_url: Some(item.get_return_url()?),
+ }),
+ ),
+ payments::BankTransferData::AchBankTransfer { .. } => {
+ Ok(Self::AchBankTansfer(AchCreditTransferSourceRequest {
+ transfer_type: StripePaymentMethodType::AchCreditTransfer,
+ payment_method_data: AchTransferData {
+ email: item.request.get_email()?,
+ },
+ currency,
+ }))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Bank Transfer Method".to_string(),
+ )
+ .into()),
+ }
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment Method".to_string()).into()),
+ }
}
}
@@ -2342,6 +2407,7 @@ pub struct WebhookStatusObjectData {
#[serde(rename_all = "snake_case")]
pub enum WebhookPaymentMethodType {
AchCreditTransfer,
+ MultibancoBankTransfers,
#[serde(other)]
Unknown,
}
@@ -2546,11 +2612,18 @@ impl
match bank_transfer_data.deref() {
payments::BankTransferData::AchBankTransfer { billing_details } => {
Ok(Self::BankTransfer(StripeBankTransferData::AchBankTransfer(
- Box::new(AchBankTransferData {
+ Box::new(AchTransferData {
email: billing_details.email.to_owned(),
}),
)))
}
+ payments::BankTransferData::MultibancoBankTransfer { billing_details } => Ok(
+ Self::BankTransfer(StripeBankTransferData::MultibancoBankTransfers(
+ Box::new(MultibancoTransferData {
+ email: billing_details.email.to_owned(),
+ }),
+ )),
+ ),
payments::BankTransferData::SepaBankTransfer { country, .. } => Ok(
Self::BankTransfer(StripeBankTransferData::SepaBankTransfer(Box::new(
SepaBankTransferData {
@@ -2594,7 +2667,8 @@ pub fn get_bank_transfer_request_data(
bank_transfer_data: &api_models::payments::BankTransferData,
) -> CustomResult<Option<types::RequestBody>, errors::ConnectorError> {
match bank_transfer_data {
- api_models::payments::BankTransferData::AchBankTransfer { .. } => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {
let req = ChargesRequest::try_from(req)?;
let request = types::RequestBody::log_and_get_request_body(
&req,
@@ -2621,7 +2695,8 @@ pub fn get_bank_transfer_authorize_response(
bank_transfer_data: &api_models::payments::BankTransferData,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
match bank_transfer_data {
- api_models::payments::BankTransferData::AchBankTransfer { .. } => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {
let response: ChargesResponse = res
.response
.parse_struct("ChargesResponse")
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 65278d6c212..0cb76064ea0 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -171,6 +171,8 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
pub trait PaymentsPreProcessingData {
fn get_email(&self) -> Result<Email, Error>;
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error>;
+ fn get_currency(&self) -> Result<storage_models::enums::Currency, Error>;
+ fn get_amount(&self) -> Result<i64, Error>;
}
impl PaymentsPreProcessingData for types::PaymentsPreProcessingData {
@@ -182,6 +184,12 @@ impl PaymentsPreProcessingData for types::PaymentsPreProcessingData {
.to_owned()
.ok_or_else(missing_field_err("payment_method_type"))
}
+ fn get_currency(&self) -> Result<storage_models::enums::Currency, Error> {
+ self.currency.ok_or_else(missing_field_err("currency"))
+ }
+ fn get_amount(&self) -> Result<i64, Error> {
+ self.amount.ok_or_else(missing_field_err("amount"))
+ }
}
pub trait PaymentsAuthorizeRequestData {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 9008b97b975..c5a25b993e5 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -838,7 +838,8 @@ where
//TODO: For ACH transfers, if preprocessing_step is not required for connectors encountered in future, add the check
let router_data_and_should_continue_payment = match payment_data.payment_method_data.clone() {
Some(api_models::payments::PaymentMethodData::BankTransfer(data)) => match data.deref() {
- api_models::payments::BankTransferData::AchBankTransfer { .. } => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. }
+ | api_models::payments::BankTransferData::MultibancoBankTransfer { .. } => {
if payment_data.payment_attempt.preprocessing_step_id.is_none() {
(
router_data.preprocessing_steps(state, connector).await?,
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index 7a58fa54423..a9abcfde370 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -342,9 +342,10 @@ impl TryFrom<types::PaymentsAuthorizeData> for types::PaymentsPreProcessingData
fn try_from(data: types::PaymentsAuthorizeData) -> Result<Self, Self::Error> {
Ok(Self {
+ payment_method_data: Some(data.payment_method_data),
+ amount: Some(data.amount),
email: data.email,
currency: Some(data.currency),
- amount: Some(data.amount),
payment_method_type: data.payment_method_type,
})
}
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index a3ead3fb17a..64cb0bc5e21 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -951,7 +951,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsPreProce
fn try_from(additional_data: PaymentAdditionalData<'_, F>) -> Result<Self, Self::Error> {
let payment_data = additional_data.payment_data;
+ let payment_method_data = payment_data.payment_method_data;
+
Ok(Self {
+ payment_method_data,
email: payment_data.email,
currency: Some(payment_data.currency),
amount: Some(payment_data.amount.into()),
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 3c7c1777076..a53c57bc05e 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -244,9 +244,11 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::BankTransferNextStepsData,
api_models::payments::SepaAndBacsBillingDetails,
api_models::payments::AchBillingDetails,
+ api_models::payments::MultibancoBillingDetails,
api_models::payments::BankTransferInstructions,
api_models::payments::ReceiverDetails,
api_models::payments::AchTransfer,
+ api_models::payments::MultibancoTransferInstructions,
api_models::payments::ApplePayRedirectData,
api_models::payments::ApplePayThirdPartySdkData,
api_models::payments::GooglePayRedirectData,
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 3b437d80c1b..313b22fb80e 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -268,9 +268,10 @@ pub struct PaymentMethodTokenizationData {
#[derive(Debug, Clone)]
pub struct PaymentsPreProcessingData {
+ pub payment_method_data: Option<payments::PaymentMethodData>,
+ pub amount: Option<i64>,
pub email: Option<Email>,
pub currency: Option<storage_enums::Currency>,
- pub amount: Option<i64>,
pub payment_method_type: Option<storage_enums::PaymentMethodType>,
}
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index 0f0430511af..712e0f686f2 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -696,6 +696,7 @@ pub enum PaymentMethodType {
Klarna,
MbWay,
MobilePay,
+ Multibanco,
OnlineBankingCzechRepublic,
OnlineBankingFinland,
OnlineBankingPoland,
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 88378d8ff47..53bc3c7c29a 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -2648,6 +2648,25 @@
}
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "multibanco_bank_transfer"
+ ],
+ "properties": {
+ "multibanco_bank_transfer": {
+ "type": "object",
+ "required": [
+ "billing_details"
+ ],
+ "properties": {
+ "billing_details": {
+ "$ref": "#/components/schemas/MultibancoBillingDetails"
+ }
+ }
+ }
+ }
}
]
},
@@ -2685,6 +2704,17 @@
"$ref": "#/components/schemas/BacsBankTransferInstructions"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "multibanco"
+ ],
+ "properties": {
+ "multibanco": {
+ "$ref": "#/components/schemas/MultibancoTransferInstructions"
+ }
+ }
}
]
},
@@ -5422,6 +5452,35 @@
"MobilePayRedirection": {
"type": "object"
},
+ "MultibancoBillingDetails": {
+ "type": "object",
+ "required": [
+ "email"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "example": "[email protected]"
+ }
+ }
+ },
+ "MultibancoTransferInstructions": {
+ "type": "object",
+ "required": [
+ "reference",
+ "entity"
+ ],
+ "properties": {
+ "reference": {
+ "type": "string",
+ "example": "122385736258"
+ },
+ "entity": {
+ "type": "string",
+ "example": "12345"
+ }
+ }
+ },
"NextActionCall": {
"type": "string",
"enum": [
@@ -6304,6 +6363,7 @@
"klarna",
"mb_way",
"mobile_pay",
+ "multibanco",
"online_banking_czech_republic",
"online_banking_finland",
"online_banking_poland",
|
feat
|
[Stripe] implement Multibanco Bank Transfer for stripe (#1420)
|
797a0db7733c5b387564fb1bbc106d054c8dffa6
|
2024-12-02 15:29:28
|
Sanchith Hegde
|
feat(payment_methods_v2): implement a barebones version of list customer payment methods v2 (#6649)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 2b66d1755ff..e3f54813a43 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -7153,6 +7153,7 @@
"customer_id",
"payment_method_type",
"recurring_enabled",
+ "created",
"requires_cvv",
"is_default"
],
@@ -7210,9 +7211,8 @@
"created": {
"type": "string",
"format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the customer was created",
- "example": "2023-01-18T11:04:09.922Z",
- "nullable": true
+ "description": "A timestamp (ISO 8601 code) that determines when the payment method was created",
+ "example": "2023-01-18T11:04:09.922Z"
},
"surcharge_details": {
"allOf": [
@@ -13542,7 +13542,7 @@
"created": {
"type": "string",
"format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the customer was created",
+ "description": "A timestamp (ISO 8601 code) that determines when the payment method was created",
"example": "2023-01-18T11:04:09.922Z",
"nullable": true
},
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index d2133a3e68e..25ed2648cd4 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -9739,7 +9739,7 @@
"created": {
"type": "string",
"format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the customer was created",
+ "description": "A timestamp (ISO 8601 code) that determines when the payment method was created",
"example": "2023-01-18T11:04:09.922Z",
"nullable": true
},
@@ -16326,7 +16326,7 @@
"created": {
"type": "string",
"format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the customer was created",
+ "description": "A timestamp (ISO 8601 code) that determines when the payment method was created",
"example": "2023-01-18T11:04:09.922Z",
"nullable": true
},
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 2c2aa4861c5..283a0d662d7 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -755,7 +755,7 @@ pub struct PaymentMethodResponse {
#[schema(value_type = Option<Object>, example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<pii::SecretSerdeValue>,
- /// A timestamp (ISO 8601 code) that determines when the customer was created
+ /// A timestamp (ISO 8601 code) that determines when the payment method was created
#[schema(value_type = Option<PrimitiveDateTime>, example = "2023-01-18T11:04:09.922Z")]
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<time::PrimitiveDateTime>,
@@ -801,7 +801,7 @@ pub struct PaymentMethodResponse {
#[schema(example = true)]
pub recurring_enabled: bool,
- /// A timestamp (ISO 8601 code) that determines when the customer was created
+ /// A timestamp (ISO 8601 code) that determines when the payment method was created
#[schema(value_type = Option<PrimitiveDateTime>, example = "2023-01-18T11:04:09.922Z")]
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<time::PrimitiveDateTime>,
@@ -1802,10 +1802,10 @@ pub struct CustomerPaymentMethod {
#[schema(example = json!({"mask": "0000"}))]
pub bank: Option<MaskedBankDetails>,
- /// A timestamp (ISO 8601 code) that determines when the customer was created
- #[schema(value_type = Option<PrimitiveDateTime>,example = "2023-01-18T11:04:09.922Z")]
- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
- pub created: Option<time::PrimitiveDateTime>,
+ /// A timestamp (ISO 8601 code) that determines when the payment method was created
+ #[schema(value_type = PrimitiveDateTime, example = "2023-01-18T11:04:09.922Z")]
+ #[serde(with = "common_utils::custom_serde::iso8601")]
+ pub created: time::PrimitiveDateTime,
/// Surcharge details for this saved card
pub surcharge_details: Option<SurchargeDetailsResponse>,
@@ -1890,7 +1890,7 @@ pub struct CustomerPaymentMethod {
#[schema(value_type = Option<Object>,example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<pii::SecretSerdeValue>,
- /// A timestamp (ISO 8601 code) that determines when the customer was created
+ /// A timestamp (ISO 8601 code) that determines when the payment method was created
#[schema(value_type = Option<PrimitiveDateTime>,example = "2023-01-18T11:04:09.922Z")]
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<time::PrimitiveDateTime>,
diff --git a/crates/common_utils/src/id_type/global_id.rs b/crates/common_utils/src/id_type/global_id.rs
index 5490dcda7bd..a54df758587 100644
--- a/crates/common_utils/src/id_type/global_id.rs
+++ b/crates/common_utils/src/id_type/global_id.rs
@@ -120,7 +120,7 @@ pub(crate) enum GlobalIdError {
impl GlobalId {
/// Create a new global id from entity and cell information
/// The entity prefix is used to identify the entity, `cus` for customers, `pay`` for payments etc.
- pub fn generate(cell_id: CellId, entity: GlobalEntity) -> Self {
+ pub fn generate(cell_id: &CellId, entity: GlobalEntity) -> Self {
let prefix = format!("{}_{}", cell_id.get_string_repr(), entity.prefix());
let id = generate_time_ordered_id(&prefix);
let alphanumeric_id = AlphaNumericId::new_unchecked(id);
@@ -201,7 +201,7 @@ mod global_id_tests {
let cell_id_string = "12345";
let entity = GlobalEntity::Customer;
let cell_id = CellId::from_str(cell_id_string).unwrap();
- let global_id = GlobalId::generate(cell_id, entity);
+ let global_id = GlobalId::generate(&cell_id, entity);
/// Generate a regex for globalid
/// Eg - 12abc_cus_abcdefghijklmnopqrstuvwxyz1234567890
diff --git a/crates/common_utils/src/id_type/global_id/payment.rs b/crates/common_utils/src/id_type/global_id/payment.rs
index 934d710604c..5a2da3998bb 100644
--- a/crates/common_utils/src/id_type/global_id/payment.rs
+++ b/crates/common_utils/src/id_type/global_id/payment.rs
@@ -20,7 +20,7 @@ impl GlobalPaymentId {
}
/// Generate a new GlobalPaymentId from a cell id
- pub fn generate(cell_id: crate::id_type::CellId) -> Self {
+ pub fn generate(cell_id: &crate::id_type::CellId) -> Self {
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Payment);
Self(global_id)
}
@@ -57,7 +57,7 @@ crate::impl_to_sql_from_sql_global_id_type!(GlobalAttemptId);
impl GlobalAttemptId {
/// Generate a new GlobalAttemptId from a cell id
pub fn generate(cell_id: &super::CellId) -> Self {
- let global_id = super::GlobalId::generate(cell_id.clone(), super::GlobalEntity::Attempt);
+ let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Attempt);
Self(global_id)
}
diff --git a/crates/common_utils/src/id_type/global_id/payment_methods.rs b/crates/common_utils/src/id_type/global_id/payment_methods.rs
index f6f394242cc..40bd6ec0df4 100644
--- a/crates/common_utils/src/id_type/global_id/payment_methods.rs
+++ b/crates/common_utils/src/id_type/global_id/payment_methods.rs
@@ -28,10 +28,7 @@ pub enum GlobalPaymentMethodIdError {
impl GlobalPaymentMethodId {
/// Create a new GlobalPaymentMethodId from cell id information
- pub fn generate(cell_id: &str) -> error_stack::Result<Self, GlobalPaymentMethodIdError> {
- let cell_id = CellId::from_str(cell_id)
- .change_context(GlobalPaymentMethodIdError::ConstructionError)
- .attach_printable("Failed to construct CellId from str")?;
+ pub fn generate(cell_id: &CellId) -> error_stack::Result<Self, GlobalPaymentMethodIdError> {
let global_id = GlobalId::generate(cell_id, GlobalEntity::PaymentMethod);
Ok(Self(global_id))
}
diff --git a/crates/common_utils/src/id_type/global_id/refunds.rs b/crates/common_utils/src/id_type/global_id/refunds.rs
index 64e47516114..0aac9bf5808 100644
--- a/crates/common_utils/src/id_type/global_id/refunds.rs
+++ b/crates/common_utils/src/id_type/global_id/refunds.rs
@@ -26,7 +26,7 @@ impl GlobalRefundId {
}
/// Generate a new GlobalRefundId from a cell id
- pub fn generate(cell_id: crate::id_type::CellId) -> Self {
+ pub fn generate(cell_id: &crate::id_type::CellId) -> Self {
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Refund);
Self(global_id)
}
diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs
index 083d6e47501..4e7d727839b 100644
--- a/crates/hyperswitch_domain_models/src/payment_methods.rs
+++ b/crates/hyperswitch_domain_models/src/payment_methods.rs
@@ -12,7 +12,7 @@ use masking::{PeekInterface, Secret};
use time::PrimitiveDateTime;
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-use crate::type_encryption::EncryptedJsonType;
+use crate::type_encryption::OptionalEncryptableJsonType;
use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
@@ -80,9 +80,8 @@ pub struct PaymentMethod {
pub last_modified: PrimitiveDateTime,
pub payment_method_type: Option<storage_enums::PaymentMethod>,
pub payment_method_subtype: Option<storage_enums::PaymentMethodType>,
- pub payment_method_data: Option<
- Encryptable<Secret<EncryptedJsonType<api_models::payment_methods::PaymentMethodsData>>>,
- >,
+ pub payment_method_data:
+ OptionalEncryptableJsonType<api_models::payment_methods::PaymentMethodsData>,
pub locker_id: Option<VaultId>,
pub last_used_at: PrimitiveDateTime,
pub connector_mandate_details: Option<diesel_models::PaymentsMandateReference>,
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs
index 8b8b3f33ed8..599d696ec06 100644
--- a/crates/router/src/core/payment_methods.rs
+++ b/crates/router/src/core/payment_methods.rs
@@ -865,9 +865,10 @@ pub async fn create_payment_method(
.attach_printable("Unable to encrypt Payment method billing address")?;
// create pm
- let payment_method_id = id_type::GlobalPaymentMethodId::generate("random_cell_id")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to generate GlobalPaymentMethodId")?;
+ let payment_method_id =
+ id_type::GlobalPaymentMethodId::generate(&state.conf.cell_information.id)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to generate GlobalPaymentMethodId")?;
let payment_method = create_payment_method_for_intent(
state,
@@ -978,9 +979,10 @@ pub async fn payment_method_intent_create(
// create pm entry
- let payment_method_id = id_type::GlobalPaymentMethodId::generate("random_cell_id")
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Unable to generate GlobalPaymentMethodId")?;
+ let payment_method_id =
+ id_type::GlobalPaymentMethodId::generate(&state.conf.cell_information.id)
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to generate GlobalPaymentMethodId")?;
let payment_method = create_payment_method_for_intent(
state,
@@ -1324,69 +1326,82 @@ pub async fn vault_payment_method(
feature = "customer_v2"
))]
async fn get_pm_list_context(
- state: &SessionState,
- payment_method: &enums::PaymentMethod,
- _key_store: &domain::MerchantKeyStore,
- pm: &domain::PaymentMethod,
- _parent_payment_method_token: Option<String>,
+ payment_method_type: enums::PaymentMethod,
+ payment_method: &domain::PaymentMethod,
is_payment_associated: bool,
) -> Result<Option<PaymentMethodListContext>, error_stack::Report<errors::ApiErrorResponse>> {
- let payment_method_retrieval_context = match payment_method {
- enums::PaymentMethod::Card => {
- let card_details = cards::get_card_details_with_locker_fallback(pm, state).await?;
-
- card_details.as_ref().map(|card| PaymentMethodListContext {
- card_details: Some(card.clone()),
- #[cfg(feature = "payouts")]
- bank_transfer_details: None,
- hyperswitch_token_data: is_payment_associated.then_some(
+ let payment_method_data = payment_method
+ .payment_method_data
+ .clone()
+ .map(|payment_method_data| payment_method_data.into_inner().expose().into_inner());
+
+ let payment_method_retrieval_context = match payment_method_data {
+ Some(payment_methods::PaymentMethodsData::Card(card)) => {
+ Some(PaymentMethodListContext::Card {
+ card_details: api::CardDetailFromLocker::from(card),
+ token_data: is_payment_associated.then_some(
storage::PaymentTokenData::permanent_card(
- Some(pm.get_id().clone()),
- pm.locker_id
+ Some(payment_method.get_id().clone()),
+ payment_method
+ .locker_id
.as_ref()
- .map(|id| id.get_string_repr().clone())
- .or(Some(pm.get_id().get_string_repr().to_owned())),
- pm.locker_id
+ .map(|id| id.get_string_repr().to_owned())
+ .or_else(|| Some(payment_method.get_id().get_string_repr().to_owned())),
+ payment_method
+ .locker_id
.as_ref()
- .map(|id| id.get_string_repr().clone())
- .unwrap_or(pm.get_id().get_string_repr().to_owned()),
+ .map(|id| id.get_string_repr().to_owned())
+ .unwrap_or_else(|| {
+ payment_method.get_id().get_string_repr().to_owned()
+ }),
),
),
})
}
+ Some(payment_methods::PaymentMethodsData::BankDetails(bank_details)) => {
+ let get_bank_account_token_data =
+ || -> errors::CustomResult<payment_methods::BankAccountTokenData, errors::ApiErrorResponse> {
+ let connector_details = bank_details
+ .connector_details
+ .first()
+ .cloned()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to obtain bank account connector details")?;
+
+ let payment_method_subtype = payment_method
+ .get_payment_method_subtype()
+ .get_required_value("payment_method_subtype")
+ .attach_printable("PaymentMethodType not found")?;
+
+ Ok(payment_methods::BankAccountTokenData {
+ payment_method_type: payment_method_subtype,
+ payment_method: payment_method_type,
+ connector_details,
+ })
+ };
- enums::PaymentMethod::BankDebit => {
// Retrieve the pm_auth connector details so that it can be tokenized
- let bank_account_token_data = cards::get_bank_account_connector_details(pm)
- .await
- .unwrap_or_else(|err| {
- logger::error!(error=?err);
- None
- });
-
+ let bank_account_token_data = get_bank_account_token_data()
+ .inspect_err(|error| logger::error!(?error))
+ .ok();
bank_account_token_data.map(|data| {
let token_data = storage::PaymentTokenData::AuthBankDebit(data);
- PaymentMethodListContext {
- card_details: None,
- #[cfg(feature = "payouts")]
- bank_transfer_details: None,
- hyperswitch_token_data: is_payment_associated.then_some(token_data),
+ PaymentMethodListContext::Bank {
+ token_data: is_payment_associated.then_some(token_data),
}
})
}
-
- _ => Some(PaymentMethodListContext {
- card_details: None,
- #[cfg(feature = "payouts")]
- bank_transfer_details: None,
- hyperswitch_token_data: is_payment_associated.then_some(
- storage::PaymentTokenData::temporary_generic(generate_id(
- consts::ID_LENGTH,
- "token",
- )),
- ),
- }),
+ Some(payment_methods::PaymentMethodsData::WalletDetails(_)) | None => {
+ Some(PaymentMethodListContext::TemporaryToken {
+ token_data: is_payment_associated.then_some(
+ storage::PaymentTokenData::temporary_generic(generate_id(
+ consts::ID_LENGTH,
+ "token",
+ )),
+ ),
+ })
+ }
};
Ok(payment_method_retrieval_context)
@@ -1471,9 +1486,9 @@ pub async fn list_customer_payment_method(
let key_manager_state = &(state).into();
let customer = db
- .find_customer_by_merchant_reference_id_merchant_id(
+ .find_customer_by_global_id(
key_manager_state,
- customer_id,
+ customer_id.get_string_repr(),
merchant_account.get_id(),
&key_store,
merchant_account.storage_scheme,
@@ -1509,25 +1524,23 @@ pub async fn list_customer_payment_method(
.to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;
let mut filtered_saved_payment_methods_ctx = Vec::new();
- for pm in saved_payment_methods.into_iter() {
- let payment_method = pm
+ for payment_method in saved_payment_methods.into_iter() {
+ let payment_method_type = payment_method
.get_payment_method_type()
.get_required_value("payment_method")?;
let parent_payment_method_token =
is_payment_associated.then(|| generate_id(consts::ID_LENGTH, "token"));
- let pm_list_context = get_pm_list_context(
- state,
- &payment_method,
- &key_store,
- &pm,
- parent_payment_method_token.clone(),
- is_payment_associated,
- )
- .await?;
+ let pm_list_context =
+ get_pm_list_context(payment_method_type, &payment_method, is_payment_associated)
+ .await?;
if let Some(ctx) = pm_list_context {
- filtered_saved_payment_methods_ctx.push((ctx, parent_payment_method_token, pm));
+ filtered_saved_payment_methods_ctx.push((
+ ctx,
+ parent_payment_method_token,
+ payment_method,
+ ));
}
}
@@ -1576,6 +1589,8 @@ pub async fn list_customer_payment_method(
is_guest_customer: is_payment_associated.then_some(false), //to return this key only when the request is tied to a payment intent
};
+ /*
+ TODO: Implement surcharge for v2
if is_payment_associated {
Box::pin(cards::perform_surcharge_ops(
payments_info.as_ref().map(|pi| pi.payment_intent.clone()),
@@ -1587,6 +1602,7 @@ pub async fn list_customer_payment_method(
))
.await?;
}
+ */
Ok(services::ApplicationResponse::Json(response))
}
@@ -1661,15 +1677,20 @@ async fn generate_saved_pm_response(
requires_cvv && !(off_session_payment_flag && pm.connector_mandate_details.is_some())
};
- let pmd = if let Some(card) = pm_list_context.card_details.as_ref() {
- Some(api::PaymentMethodListData::Card(card.clone()))
- } else if cfg!(feature = "payouts") {
- pm_list_context
- .bank_transfer_details
- .clone()
- .map(api::PaymentMethodListData::Bank)
- } else {
- None
+ let pmd = match &pm_list_context {
+ PaymentMethodListContext::Card { card_details, .. } => {
+ Some(api::PaymentMethodListData::Card(card_details.clone()))
+ }
+ #[cfg(feature = "payouts")]
+ PaymentMethodListContext::BankTransfer {
+ bank_transfer_details,
+ ..
+ } => Some(api::PaymentMethodListData::Bank(
+ bank_transfer_details.clone(),
+ )),
+ PaymentMethodListContext::Bank { .. } | PaymentMethodListContext::TemporaryToken { .. } => {
+ None
+ }
};
let pma = api::CustomerPaymentMethod {
@@ -1680,7 +1701,7 @@ async fn generate_saved_pm_response(
payment_method_subtype: pm.get_payment_method_subtype(),
payment_method_data: pmd,
recurring_enabled: mca_enabled,
- created: Some(pm.created_at),
+ created: pm.created_at,
bank: bank_details,
surcharge_details: None,
requires_cvv: requires_cvv
@@ -1952,8 +1973,8 @@ impl pm_types::SavedPMLPaymentsInfo {
let token = parent_payment_method_token
.as_ref()
.get_required_value("parent_payment_method_token")?;
- let hyperswitch_token_data = pm_list_context
- .hyperswitch_token_data
+ let token_data = pm_list_context
+ .get_token_data()
.get_required_value("PaymentTokenData")?;
let intent_fulfillment_time = self
@@ -1962,7 +1983,7 @@ impl pm_types::SavedPMLPaymentsInfo {
.unwrap_or(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME);
pm_routes::ParentPaymentMethodToken::create_key_for_token((token, pma.payment_method_type))
- .insert(intent_fulfillment_time, hyperswitch_token_data, state)
+ .insert(intent_fulfillment_time, token_data, state)
.await?;
Ok(())
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 955cc37b0d9..9cfe6e6ec73 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -5328,14 +5328,6 @@ pub async fn get_card_details_with_locker_fallback(
})
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-pub async fn get_card_details_with_locker_fallback(
- pm: &domain::PaymentMethod,
- state: &routes::SessionState,
-) -> errors::RouterResult<Option<api::CardDetailFromLocker>> {
- todo!()
-}
-
#[cfg(all(
any(feature = "v2", feature = "v1"),
not(feature = "payment_methods_v2")
@@ -5365,14 +5357,6 @@ pub async fn get_card_details_without_locker_fallback(
})
}
-#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
-pub async fn get_card_details_without_locker_fallback(
- pm: &domain::PaymentMethod,
- state: &routes::SessionState,
-) -> errors::RouterResult<api::CardDetailFromLocker> {
- todo!()
-}
-
#[cfg(all(
any(feature = "v2", feature = "v1"),
not(feature = "payment_methods_v2")
@@ -5460,13 +5444,13 @@ pub async fn get_masked_bank_details(
}
}
+#[cfg(all(
+ any(feature = "v2", feature = "v1"),
+ not(feature = "payment_methods_v2")
+))]
pub async fn get_bank_account_connector_details(
pm: &domain::PaymentMethod,
) -> errors::RouterResult<Option<BankAccountTokenData>> {
- #[cfg(all(
- any(feature = "v2", feature = "v1"),
- not(feature = "payment_methods_v2")
- ))]
let payment_method_data = pm
.payment_method_data
.clone()
@@ -5481,12 +5465,6 @@ pub async fn get_bank_account_connector_details(
)
.transpose()?;
- #[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
- let payment_method_data = pm
- .payment_method_data
- .clone()
- .map(|x| x.into_inner().expose().into_inner());
-
match payment_method_data {
Some(pmd) => match pmd {
PaymentMethodsData::Card(_) => Err(errors::ApiErrorResponse::UnprocessableEntity {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 5eb97e6eebe..fd61fcacf5a 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1019,7 +1019,7 @@ where
.to_validate_request()?
.validate_request(&req, &merchant_account)?;
- let payment_id = id_type::GlobalPaymentId::generate(state.conf.cell_information.id.clone());
+ let payment_id = id_type::GlobalPaymentId::generate(&state.conf.cell_information.id.clone());
tracing::Span::current().record("global_payment_id", payment_id.get_string_repr());
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 829216db1dd..839dd472423 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -132,7 +132,7 @@ pub fn mk_app(
.service(routes::Forex::server(state.clone()));
}
- server_app = server_app.service(routes::Profile::server(state.clone()))
+ server_app = server_app.service(routes::Profile::server(state.clone()));
}
server_app = server_app
.service(routes::Payments::server(state.clone()))
@@ -141,6 +141,11 @@ pub fn mk_app(
.service(routes::MerchantConnectorAccount::server(state.clone()))
.service(routes::Webhooks::server(state.clone()));
+ #[cfg(feature = "oltp")]
+ {
+ server_app = server_app.service(routes::PaymentMethods::server(state.clone()));
+ }
+
#[cfg(feature = "v1")]
{
server_app = server_app
@@ -157,8 +162,6 @@ pub fn mk_app(
{
server_app = server_app
.service(routes::EphemeralKey::server(state.clone()))
- .service(routes::Webhooks::server(state.clone()))
- .service(routes::PaymentMethods::server(state.clone()))
.service(routes::Poll::server(state.clone()))
}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 7a8571479f4..1964c1cbfa5 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -954,6 +954,10 @@ pub struct Customers;
impl Customers {
pub fn server(state: AppState) -> Scope {
let mut route = web::scope("/v2/customers").app_data(web::Data::new(state));
+ #[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))]
+ {
+ route = route.service(web::resource("/list").route(web::get().to(customers_list)))
+ }
#[cfg(all(feature = "oltp", feature = "v2", feature = "customer_v2"))]
{
route = route
@@ -965,10 +969,6 @@ impl Customers {
.route(web::delete().to(customers_delete)),
)
}
- #[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))]
- {
- route = route.service(web::resource("/list").route(web::get().to(customers_list)))
- }
#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))]
{
route = route.service(
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 724539ad08a..1967eafd180 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -1323,7 +1323,6 @@ where
#[derive(Debug)]
pub struct EphemeralKeyAuth;
-// #[cfg(feature = "v1")]
#[async_trait]
impl<A> AuthenticateAndFetch<AuthenticationData, A> for EphemeralKeyAuth
where
@@ -2987,43 +2986,6 @@ pub fn get_auth_type_and_flow<A: SessionStateInfo + Sync + Send>(
Ok((Box::new(HeaderAuth(ApiKeyAuth)), api::AuthFlow::Merchant))
}
-#[cfg(feature = "v1")]
-pub fn check_client_secret_and_get_auth<T>(
- headers: &HeaderMap,
- payload: &impl ClientSecretFetch,
-) -> RouterResult<(
- Box<dyn AuthenticateAndFetch<AuthenticationData, T>>,
- api::AuthFlow,
-)>
-where
- T: SessionStateInfo + Sync + Send,
- ApiKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
- PublishableKeyAuth: AuthenticateAndFetch<AuthenticationData, T>,
-{
- let api_key = get_api_key(headers)?;
- if api_key.starts_with("pk_") {
- payload
- .get_client_secret()
- .check_value_present("client_secret")
- .map_err(|_| errors::ApiErrorResponse::MissingRequiredField {
- field_name: "client_secret",
- })?;
- return Ok((
- Box::new(HeaderAuth(PublishableKeyAuth)),
- api::AuthFlow::Client,
- ));
- }
-
- if payload.get_client_secret().is_some() {
- return Err(errors::ApiErrorResponse::InvalidRequestData {
- message: "client_secret is not a valid parameter".to_owned(),
- }
- .into());
- }
- Ok((Box::new(HeaderAuth(ApiKeyAuth)), api::AuthFlow::Merchant))
-}
-
-#[cfg(feature = "v2")]
pub fn check_client_secret_and_get_auth<T>(
headers: &HeaderMap,
payload: &impl ClientSecretFetch,
@@ -3056,11 +3018,9 @@ where
}
.into());
}
-
Ok((Box::new(HeaderAuth(ApiKeyAuth)), api::AuthFlow::Merchant))
}
-#[cfg(feature = "v1")]
pub async fn get_ephemeral_or_other_auth<T>(
headers: &HeaderMap,
is_merchant_flow: bool,
@@ -3093,7 +3053,6 @@ where
}
}
-#[cfg(feature = "v1")]
pub fn is_ephemeral_auth<A: SessionStateInfo + Sync + Send>(
headers: &HeaderMap,
) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
@@ -3106,13 +3065,6 @@ pub fn is_ephemeral_auth<A: SessionStateInfo + Sync + Send>(
}
}
-#[cfg(feature = "v2")]
-pub fn is_ephemeral_auth<A: SessionStateInfo + Sync + Send>(
- headers: &HeaderMap,
-) -> RouterResult<Box<dyn AuthenticateAndFetch<AuthenticationData, A>>> {
- todo!()
-}
-
pub fn is_jwt_auth(headers: &HeaderMap) -> bool {
headers.get(headers::AUTHORIZATION).is_some()
|| get_cookie_from_header(headers)
diff --git a/crates/router/src/types/storage/payment_method.rs b/crates/router/src/types/storage/payment_method.rs
index 3214f911f56..bc5f6651b6b 100644
--- a/crates/router/src/types/storage/payment_method.rs
+++ b/crates/router/src/types/storage/payment_method.rs
@@ -105,6 +105,10 @@ impl PaymentTokenData {
}
}
+#[cfg(all(
+ any(feature = "v1", feature = "v2"),
+ not(feature = "payment_methods_v2")
+))]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodListContext {
pub card_details: Option<api::CardDetailFromLocker>,
@@ -113,6 +117,38 @@ pub struct PaymentMethodListContext {
pub bank_transfer_details: Option<api::BankPayout>,
}
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub enum PaymentMethodListContext {
+ Card {
+ card_details: api::CardDetailFromLocker,
+ token_data: Option<PaymentTokenData>,
+ },
+ Bank {
+ token_data: Option<PaymentTokenData>,
+ },
+ #[cfg(feature = "payouts")]
+ BankTransfer {
+ bank_transfer_details: api::BankPayout,
+ token_data: Option<PaymentTokenData>,
+ },
+ TemporaryToken {
+ token_data: Option<PaymentTokenData>,
+ },
+}
+
+#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
+impl PaymentMethodListContext {
+ pub(crate) fn get_token_data(&self) -> Option<PaymentTokenData> {
+ match self {
+ Self::Card { token_data, .. }
+ | Self::Bank { token_data }
+ | Self::BankTransfer { token_data, .. }
+ | Self::TemporaryToken { token_data } => token_data.clone(),
+ }
+ }
+}
+
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
pub struct PaymentMethodStatusTrackingData {
pub payment_method_id: String,
|
feat
|
implement a barebones version of list customer payment methods v2 (#6649)
|
eb0101fa7d617afb226cd024881b53dcd080d129
|
2024-06-10 18:18:27
|
Abhishek Kanojia
|
feat(events): Add audit events payment confirm (#4763)
| false
|
diff --git a/config/development.toml b/config/development.toml
index 95cadf56617..2c6d67e7515 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -646,4 +646,4 @@ sdk_eligible_payment_methods = "card"
enabled = false
[multitenancy.tenants]
-public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
\ No newline at end of file
+public = { name = "hyperswitch", base_url = "http://localhost:8080", schema = "public", redis_key_prefix = ""}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index ea5f2c0ecb4..cff51ed8091 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -29,6 +29,7 @@ use crate::{
utils as core_utils,
},
db::StorageInterface,
+ events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
services,
types::{
@@ -935,7 +936,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
async fn update_trackers<'b>(
&'b self,
state: &'b SessionState,
- _req_state: ReqState,
+ req_state: ReqState,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
storage_scheme: storage_enums::MerchantStorageScheme,
@@ -1294,6 +1295,19 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
payment_data.payment_intent = payment_intent;
payment_data.payment_attempt = payment_attempt;
+ let client_src = payment_data.payment_attempt.client_source.clone();
+ let client_ver = payment_data.payment_attempt.client_version.clone();
+
+ let frm_message = payment_data.frm_message.clone();
+ req_state
+ .event_context
+ .event(AuditEvent::new(AuditEventType::PaymentConfirm {
+ client_src,
+ client_ver,
+ frm_message,
+ }))
+ .with(payment_data.to_event())
+ .emit();
Ok((Box::new(self), payment_data))
}
}
diff --git a/crates/router/src/events/audit_events.rs b/crates/router/src/events/audit_events.rs
index 0f186e691b9..6fc19018655 100644
--- a/crates/router/src/events/audit_events.rs
+++ b/crates/router/src/events/audit_events.rs
@@ -1,18 +1,27 @@
+use diesel_models::fraud_check::FraudCheck;
use events::{Event, EventInfo};
use serde::Serialize;
use time::PrimitiveDateTime;
-
#[derive(Debug, Clone, Serialize)]
#[serde(tag = "event_type")]
pub enum AuditEventType {
- Error { error_message: String },
+ Error {
+ error_message: String,
+ },
PaymentCreated,
ConnectorDecided,
ConnectorCalled,
RefundCreated,
RefundSuccess,
RefundFail,
- PaymentCancelled { cancellation_reason: Option<String> },
+ PaymentConfirm {
+ client_src: Option<String>,
+ client_ver: Option<String>,
+ frm_message: Option<FraudCheck>,
+ },
+ PaymentCancelled {
+ cancellation_reason: Option<String>,
+ },
}
#[derive(Debug, Clone, Serialize)]
@@ -43,6 +52,7 @@ impl Event for AuditEvent {
let event_type = match &self.event_type {
AuditEventType::Error { .. } => "error",
AuditEventType::PaymentCreated => "payment_created",
+ AuditEventType::PaymentConfirm { .. } => "payment_confirm",
AuditEventType::ConnectorDecided => "connector_decided",
AuditEventType::ConnectorCalled => "connector_called",
AuditEventType::RefundCreated => "refund_created",
|
feat
|
Add audit events payment confirm (#4763)
|
2ee22cdf8aced4881c1aab70cd10797a4deb57ed
|
2025-02-14 16:19:58
|
CHALLA NISHANTH BABU
|
refactor(router): add revenue_recovery_metadata to payment intent in diesel and api model for v2 flow (#7176)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index cadae4fa45c..3a43b1bfca2 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -5793,6 +5793,23 @@
}
}
},
+ "BillingConnectorPaymentDetails": {
+ "type": "object",
+ "required": [
+ "payment_processor_token",
+ "connector_customer_id"
+ ],
+ "properties": {
+ "payment_processor_token": {
+ "type": "string",
+ "description": "Payment Processor Token to process the Revenue Recovery Payment"
+ },
+ "connector_customer_id": {
+ "type": "string",
+ "description": "Billing Connector's Customer Id"
+ }
+ }
+ },
"BlikBankRedirectAdditionalData": {
"type": "object",
"properties": {
@@ -9025,6 +9042,14 @@
}
],
"nullable": true
+ },
+ "payment_revenue_recovery_metadata": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentRevenueRecoveryMetadata"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -13167,6 +13192,13 @@
"bank_acquirer"
]
},
+ "PaymentConnectorTransmission": {
+ "type": "string",
+ "enum": [
+ "ConnectorCallFailed",
+ "ConnectorCallSucceeded"
+ ]
+ },
"PaymentCreatePaymentLinkConfig": {
"allOf": [
{
@@ -14926,6 +14958,49 @@
}
}
},
+ "PaymentRevenueRecoveryMetadata": {
+ "type": "object",
+ "required": [
+ "total_retry_count",
+ "payment_connector_transmission",
+ "billing_connector_id",
+ "active_attempt_payment_connector_id",
+ "billing_connector_payment_details",
+ "payment_method_type",
+ "payment_method_subtype"
+ ],
+ "properties": {
+ "total_retry_count": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Total number of billing connector + recovery retries for a payment intent.",
+ "example": "1",
+ "minimum": 0
+ },
+ "payment_connector_transmission": {
+ "$ref": "#/components/schemas/PaymentConnectorTransmission"
+ },
+ "billing_connector_id": {
+ "type": "string",
+ "description": "Billing Connector Id to update the invoices",
+ "example": "mca_1234567890"
+ },
+ "active_attempt_payment_connector_id": {
+ "type": "string",
+ "description": "Payment Connector Id to retry the payments",
+ "example": "mca_1234567890"
+ },
+ "billing_connector_payment_details": {
+ "$ref": "#/components/schemas/BillingConnectorPaymentDetails"
+ },
+ "payment_method_type": {
+ "$ref": "#/components/schemas/PaymentMethod"
+ },
+ "payment_method_subtype": {
+ "$ref": "#/components/schemas/PaymentMethodType"
+ }
+ }
+ },
"PaymentType": {
"type": "string",
"description": "The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow.",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 47f43f982f5..fb033230654 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5,6 +5,8 @@ use std::{
};
pub mod additional_info;
use cards::CardNumber;
+#[cfg(feature = "v2")]
+use common_enums::enums::PaymentConnectorTransmission;
use common_enums::ProductType;
#[cfg(feature = "v2")]
use common_utils::id_type::GlobalPaymentId;
@@ -7111,12 +7113,28 @@ pub struct PaymentsStartRequest {
}
/// additional data that might be required by hyperswitch
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct FeatureMetadata {
+ /// Redirection response coming in request as metadata field only for redirection scenarios
+ #[schema(value_type = Option<RedirectResponse>)]
+ pub redirect_response: Option<RedirectResponse>,
+ /// Additional tags to be used for global search
+ #[schema(value_type = Option<Vec<String>>)]
+ pub search_tags: Option<Vec<HashedString<WithType>>>,
+ /// Recurring payment details required for apple pay Merchant Token
+ pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
+ /// revenue recovery data for payment intent
+ pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
+}
+
+/// additional data that might be required by hyperswitch
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
#[schema(value_type = Option<RedirectResponse>)]
pub redirect_response: Option<RedirectResponse>,
- // TODO: Convert this to hashedstrings to avoid PII sensitive data
/// Additional tags to be used for global search
#[schema(value_type = Option<Vec<String>>)]
pub search_tags: Option<Vec<HashedString<WithType>>>,
@@ -7977,3 +7995,36 @@ mod billing_from_payment_method_data {
assert!(billing_details.is_none());
}
}
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+pub struct PaymentRevenueRecoveryMetadata {
+ /// Total number of billing connector + recovery retries for a payment intent.
+ #[schema(value_type = u16,example = "1")]
+ pub total_retry_count: u16,
+ /// Flag for the payment connector's call
+ pub payment_connector_transmission: PaymentConnectorTransmission,
+ /// Billing Connector Id to update the invoices
+ #[schema(value_type = String, example = "mca_1234567890")]
+ pub billing_connector_id: id_type::MerchantConnectorAccountId,
+ /// Payment Connector Id to retry the payments
+ #[schema(value_type = String, example = "mca_1234567890")]
+ pub active_attempt_payment_connector_id: id_type::MerchantConnectorAccountId,
+ /// Billing Connector Payment Details
+ #[schema(value_type = BillingConnectorPaymentDetails)]
+ pub billing_connector_payment_details: BillingConnectorPaymentDetails,
+ /// Payment Method Type
+ #[schema(example = "pay_later", value_type = PaymentMethod)]
+ pub payment_method_type: common_enums::PaymentMethod,
+ /// PaymentMethod Subtype
+ #[schema(example = "klarna", value_type = PaymentMethodType)]
+ pub payment_method_subtype: common_enums::PaymentMethodType,
+}
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[cfg(feature = "v2")]
+pub struct BillingConnectorPaymentDetails {
+ /// Payment Processor Token to process the Revenue Recovery Payment
+ pub payment_processor_token: String,
+ /// Billing Connector's Customer Id
+ pub connector_customer_id: String,
+}
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 99442d3080c..f7ea487e91e 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3768,3 +3768,12 @@ pub enum AdyenSplitType {
/// The value-added tax charged on the payment, booked to your platforms liable balance account.
Vat,
}
+
+#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(rename = "snake_case")]
+pub enum PaymentConnectorTransmission {
+ /// Failed to call the payment connector
+ ConnectorCallFailed,
+ /// Payment Connector call succeeded
+ ConnectorCallSucceeded,
+}
diff --git a/crates/diesel_models/src/types.rs b/crates/diesel_models/src/types.rs
index 7806a7c6e1b..6bc8aee2893 100644
--- a/crates/diesel_models/src/types.rs
+++ b/crates/diesel_models/src/types.rs
@@ -1,10 +1,12 @@
+#[cfg(feature = "v2")]
+use common_enums::{enums::PaymentConnectorTransmission, PaymentMethod, PaymentMethodType};
use common_utils::{hashing::HashedString, pii, types::MinorUnit};
use diesel::{
sql_types::{Json, Jsonb},
AsExpression, FromSqlRow,
};
use masking::{Secret, WithType};
-use serde::{Deserialize, Serialize};
+use serde::{self, Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Jsonb)]
pub struct OrderDetailsWithAmount {
@@ -40,12 +42,26 @@ impl masking::SerializableSecret for OrderDetailsWithAmount {}
common_utils::impl_to_sql_from_sql_json!(OrderDetailsWithAmount);
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
+#[diesel(sql_type = Json)]
+pub struct FeatureMetadata {
+ /// Redirection response coming in request as metadata field only for redirection scenarios
+ pub redirect_response: Option<RedirectResponse>,
+ /// Additional tags to be used for global search
+ pub search_tags: Option<Vec<HashedString<WithType>>>,
+ /// Recurring payment details required for apple pay Merchant Token
+ pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
+ /// revenue recovery data for payment intent
+ pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
+}
+
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
pub redirect_response: Option<RedirectResponse>,
- // TODO: Convert this to hashedstrings to avoid PII sensitive data
/// Additional tags to be used for global search
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
@@ -106,3 +122,31 @@ pub struct RedirectResponse {
}
impl masking::SerializableSecret for RedirectResponse {}
common_utils::impl_to_sql_from_sql_json!(RedirectResponse);
+
+#[cfg(feature = "v2")]
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+pub struct PaymentRevenueRecoveryMetadata {
+ /// Total number of billing connector + recovery retries for a payment intent.
+ pub total_retry_count: u16,
+ /// Flag for the payment connector's call
+ pub payment_connector_transmission: PaymentConnectorTransmission,
+ /// Billing Connector Id to update the invoices
+ pub billing_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+ /// Payment Connector Id to retry the payments
+ pub active_attempt_payment_connector_id: common_utils::id_type::MerchantConnectorAccountId,
+ /// Billing Connector Payment Details
+ pub billing_connector_payment_details: BillingConnectorPaymentDetails,
+ ///Payment Method Type
+ pub payment_method_type: PaymentMethod,
+ /// PaymentMethod Subtype
+ pub payment_method_subtype: PaymentMethodType,
+}
+
+#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
+#[cfg(feature = "v2")]
+pub struct BillingConnectorPaymentDetails {
+ /// Payment Processor Token to process the Revenue Recovery Payment
+ pub payment_processor_token: String,
+ /// Billing Connector's Customer Id
+ pub connector_customer_id: String,
+}
diff --git a/crates/hyperswitch_domain_models/src/lib.rs b/crates/hyperswitch_domain_models/src/lib.rs
index bd6dd2e5371..b2546e3a049 100644
--- a/crates/hyperswitch_domain_models/src/lib.rs
+++ b/crates/hyperswitch_domain_models/src/lib.rs
@@ -40,10 +40,17 @@ use api_models::payments::{
RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit,
RedirectResponse as ApiRedirectResponse,
};
+#[cfg(feature = "v2")]
+use api_models::payments::{
+ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails,
+ PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata,
+};
use diesel_models::types::{
ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata,
OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse,
};
+#[cfg(feature = "v2")]
+use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata};
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub enum RemoteStorageObject<T: ForeignIDRef> {
@@ -78,18 +85,57 @@ pub trait ApiModelToDieselModelConvertor<F> {
fn convert_back(self) -> F;
}
+#[cfg(feature = "v1")]
+impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
+ fn convert_from(from: ApiFeatureMetadata) -> Self {
+ let ApiFeatureMetadata {
+ redirect_response,
+ search_tags,
+ apple_pay_recurring_details,
+ } = from;
+
+ Self {
+ redirect_response: redirect_response.map(RedirectResponse::convert_from),
+ search_tags,
+ apple_pay_recurring_details: apple_pay_recurring_details
+ .map(ApplePayRecurringDetails::convert_from),
+ }
+ }
+
+ fn convert_back(self) -> ApiFeatureMetadata {
+ let Self {
+ redirect_response,
+ search_tags,
+ apple_pay_recurring_details,
+ } = self;
+
+ ApiFeatureMetadata {
+ redirect_response: redirect_response
+ .map(|redirect_response| redirect_response.convert_back()),
+ search_tags,
+ apple_pay_recurring_details: apple_pay_recurring_details
+ .map(|value| value.convert_back()),
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
fn convert_from(from: ApiFeatureMetadata) -> Self {
let ApiFeatureMetadata {
redirect_response,
search_tags,
apple_pay_recurring_details,
+ payment_revenue_recovery_metadata,
} = from;
+
Self {
redirect_response: redirect_response.map(RedirectResponse::convert_from),
search_tags,
apple_pay_recurring_details: apple_pay_recurring_details
.map(ApplePayRecurringDetails::convert_from),
+ payment_revenue_recovery_metadata: payment_revenue_recovery_metadata
+ .map(PaymentRevenueRecoveryMetadata::convert_from),
}
}
@@ -98,13 +144,17 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
redirect_response,
search_tags,
apple_pay_recurring_details,
+ payment_revenue_recovery_metadata,
} = self;
+
ApiFeatureMetadata {
redirect_response: redirect_response
.map(|redirect_response| redirect_response.convert_back()),
search_tags,
apple_pay_recurring_details: apple_pay_recurring_details
.map(|value| value.convert_back()),
+ payment_revenue_recovery_metadata: payment_revenue_recovery_metadata
+ .map(|value| value.convert_back()),
}
}
}
@@ -204,6 +254,56 @@ impl ApiModelToDieselModelConvertor<ApiApplePayRecurringDetails> for ApplePayRec
}
}
+#[cfg(feature = "v2")]
+impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for PaymentRevenueRecoveryMetadata {
+ fn convert_from(from: ApiRevenueRecoveryMetadata) -> Self {
+ Self {
+ total_retry_count: from.total_retry_count,
+ payment_connector_transmission: from.payment_connector_transmission,
+ billing_connector_id: from.billing_connector_id,
+ active_attempt_payment_connector_id: from.active_attempt_payment_connector_id,
+ billing_connector_payment_details: BillingConnectorPaymentDetails::convert_from(
+ from.billing_connector_payment_details,
+ ),
+ payment_method_type: from.payment_method_type,
+ payment_method_subtype: from.payment_method_subtype,
+ }
+ }
+
+ fn convert_back(self) -> ApiRevenueRecoveryMetadata {
+ ApiRevenueRecoveryMetadata {
+ total_retry_count: self.total_retry_count,
+ payment_connector_transmission: self.payment_connector_transmission,
+ billing_connector_id: self.billing_connector_id,
+ active_attempt_payment_connector_id: self.active_attempt_payment_connector_id,
+ billing_connector_payment_details: self
+ .billing_connector_payment_details
+ .convert_back(),
+ payment_method_type: self.payment_method_type,
+ payment_method_subtype: self.payment_method_subtype,
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
+impl ApiModelToDieselModelConvertor<ApiBillingConnectorPaymentDetails>
+ for BillingConnectorPaymentDetails
+{
+ fn convert_from(from: ApiBillingConnectorPaymentDetails) -> Self {
+ Self {
+ payment_processor_token: from.payment_processor_token,
+ connector_customer_id: from.connector_customer_id,
+ }
+ }
+
+ fn convert_back(self) -> ApiBillingConnectorPaymentDetails {
+ ApiBillingConnectorPaymentDetails {
+ payment_processor_token: self.payment_processor_token,
+ connector_customer_id: self.connector_customer_id,
+ }
+ }
+}
+
impl ApiModelToDieselModelConvertor<ApiOrderDetailsWithAmount> for OrderDetailsWithAmount {
fn convert_from(from: ApiOrderDetailsWithAmount) -> Self {
let ApiOrderDetailsWithAmount {
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index cc6f1b0e411..e5c9c6fa81f 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -466,6 +466,9 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::BacsBankTransferInstructions,
api_models::payments::RedirectResponse,
api_models::payments::RequestSurchargeDetails,
+ api_models::payments::PaymentRevenueRecoveryMetadata,
+ api_models::payments::BillingConnectorPaymentDetails,
+ api_models::enums::PaymentConnectorTransmission,
api_models::payments::PaymentAttemptResponse,
api_models::payments::PaymentAttemptAmountDetails,
api_models::payments::CaptureResponse,
|
refactor
|
add revenue_recovery_metadata to payment intent in diesel and api model for v2 flow (#7176)
|
1d607d7970abe204bc6101a81ba26652eadcbd04
|
2025-02-11 16:12:49
|
Debarati Ghatak
|
fix(payments): [Payment links] Add fix for payment link redirection url (#7232)
| 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 bc851bbeb19..2d2b2c30ae2 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
@@ -32,7 +32,7 @@ function initializeSDK() {
redirectionFlags: {
shouldRemoveBeforeUnloadEvents: true,
shouldUseTopRedirection: true,
- }
+ },
});
// @ts-ignore
widgets = hyper.widgets({
@@ -86,9 +86,19 @@ function initializeSDK() {
function redirectToStatus() {
var paymentDetails = window.__PAYMENT_DETAILS;
var arr = window.location.pathname.split("/");
- arr.splice(0, 2);
- arr.unshift("status");
- arr.unshift("payment_link");
+
+ // NOTE - This code preserves '/api' in url for integ and sbx
+ // e.g. url for integ/sbx - https://integ.hyperswitch.io/api/payment_link/merchant_1234/pay_1234?locale=en
+ // e.g. url for others - https://abc.dev.com/payment_link/merchant_1234/pay_1234?locale=en
+ var hasApiInPath = arr.includes("api");
+ if (hasApiInPath) {
+ arr.splice(0, 3);
+ arr.unshift("api", "payment_link", "status");
+ } else {
+ arr.splice(0, 2);
+ arr.unshift("payment_link", "status");
+ }
+
window.location.href =
window.location.origin +
"/" +
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
index 290df7d1203..9ae64ec3133 100644
--- a/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
+++ b/crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js
@@ -53,7 +53,7 @@ if (!isFramed) {
redirectionFlags: {
shouldRemoveBeforeUnloadEvents: true,
shouldUseTopRedirection: true,
- }
+ },
});
// @ts-ignore
widgets = hyper.widgets({
@@ -63,7 +63,7 @@ if (!isFramed) {
});
var type =
paymentDetails.sdk_layout === "spaced_accordion" ||
- paymentDetails.sdk_layout === "accordion"
+ paymentDetails.sdk_layout === "accordion"
? "accordion"
: paymentDetails.sdk_layout;
@@ -109,9 +109,19 @@ if (!isFramed) {
function redirectToStatus() {
var paymentDetails = window.__PAYMENT_DETAILS;
var arr = window.location.pathname.split("/");
- arr.splice(0, 3);
- arr.unshift("status");
- arr.unshift("payment_link");
+
+ // NOTE - This code preserves '/api' in url for integ and sbx envs
+ // e.g. url for integ/sbx - https://integ.hyperswitch.io/api/payment_link/s/merchant_1234/pay_1234?locale=en
+ // e.g. url for others - https://abc.dev.com/payment_link/s/merchant_1234/pay_1234?locale=en
+ var hasApiInPath = arr.includes("api");
+ if (hasApiInPath) {
+ arr.splice(0, 4);
+ arr.unshift("api", "payment_link", "status");
+ } else {
+ arr.splice(0, 3);
+ arr.unshift("payment_link", "status");
+ }
+
let returnUrl =
window.location.origin +
"/" +
@@ -127,9 +137,10 @@ if (!isFramed) {
var { paymentId, merchantId, attemptId, connector } = parseRoute(url);
var urlToPost = getEnvRoute(url);
var message = {
- message: "CRITICAL ERROR - Failed to redirect top document. Falling back to redirecting using window.location",
+ message:
+ "CRITICAL ERROR - Failed to redirect top document. Falling back to redirecting using window.location",
reason: error.message,
- }
+ };
var log = {
message,
url,
|
fix
|
[Payment links] Add fix for payment link redirection url (#7232)
|
886e2aacd7dcd8a04a33884ceafb1562aa7c365f
|
2024-12-17 05:52:18
|
github-actions
|
chore(version): 2024.12.17.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 37e49d94784..11293a2f7e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.12.17.0
+
+### Features
+
+- **connector:**
+ - [AIRWALLEX] Add refferer data to whitelist hyperswitch ([#6806](https://github.com/juspay/hyperswitch/pull/6806)) ([`ed276ec`](https://github.com/juspay/hyperswitch/commit/ed276ecc0017f7f98b6f8fa3841e6b8971f609f1))
+ - [Adyen ] Add fixes for AdyenPaymentRequest struct ([#6803](https://github.com/juspay/hyperswitch/pull/6803)) ([`c22be0c`](https://github.com/juspay/hyperswitch/commit/c22be0c9274350a531cd74b64eb6b311579dca79))
+- **core:** Add click to pay support in hyperswitch ([#6769](https://github.com/juspay/hyperswitch/pull/6769)) ([`165ead6`](https://github.com/juspay/hyperswitch/commit/165ead61084a48f268829c281e932b278f0a6730))
+- **payments:** Add audit events for PaymentStatus update ([#6520](https://github.com/juspay/hyperswitch/pull/6520)) ([`ae00a10`](https://github.com/juspay/hyperswitch/commit/ae00a103de5bd283695969270a421c7609a699e8))
+- **users:** Incorporate themes in user APIs ([#6772](https://github.com/juspay/hyperswitch/pull/6772)) ([`4b989fe`](https://github.com/juspay/hyperswitch/commit/4b989fe0fb7931479e127fecbaace42d989c0620))
+
+### Bug Fixes
+
+- **router:**
+ - Handle default case for card_network for co-badged cards ([#6825](https://github.com/juspay/hyperswitch/pull/6825)) ([`f95ee51`](https://github.com/juspay/hyperswitch/commit/f95ee51bb3b879762d493953b4b6e7c2e0359946))
+ - Change click_to_pay const to snake_case and remove camel_case serde rename for clicktopay metadata ([#6852](https://github.com/juspay/hyperswitch/pull/6852)) ([`3d4fd2f`](https://github.com/juspay/hyperswitch/commit/3d4fd2f719b38dcbb675de83c0ba384d1573df00))
+- **user_roles:** Migrations for backfilling user_roles entity_id ([#6837](https://github.com/juspay/hyperswitch/pull/6837)) ([`986de77`](https://github.com/juspay/hyperswitch/commit/986de77b4868e48d00161c9d30071d809360e9a6))
+
+### Refactors
+
+- **authz:** Make connector list accessible by operation groups ([#6792](https://github.com/juspay/hyperswitch/pull/6792)) ([`6081283`](https://github.com/juspay/hyperswitch/commit/6081283afc5ab5a6503c8f0f81181cd323b12297))
+
+### Miscellaneous Tasks
+
+- **deps:** Update scylla driver ([#6799](https://github.com/juspay/hyperswitch/pull/6799)) ([`71574a8`](https://github.com/juspay/hyperswitch/commit/71574a85e6aba6bc614e1d7f6775dcef4b481201))
+
+**Full Changelog:** [`2024.12.16.0...2024.12.17.0`](https://github.com/juspay/hyperswitch/compare/2024.12.16.0...2024.12.17.0)
+
+- - -
+
## 2024.12.16.0
### Features
|
chore
|
2024.12.17.0
|
b2b9fab31dc838958e59a7a6755a0585d5a10302
|
2024-04-26 14:53:12
|
Rachit Naithani
|
feat(users): use cookie for auth (#4434)
| false
|
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 5203b20c55b..03db3987eaa 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -611,19 +611,17 @@ where
T: serde::de::DeserializeOwned,
A: AppStateInfo + Sync,
{
- let token = get_jwt_from_authorization_header(headers)?;
- if let Some(token_from_cookies) = get_cookie_from_header(headers)
- .ok()
- .and_then(|cookies| cookies::parse_cookie(cookies).ok())
- {
- logger::info!(
- "Cookie header and authorization header JWT comparison result: {}",
- token == token_from_cookies
- );
- }
- let payload = decode_jwt(token, state).await?;
-
- Ok(payload)
+ let token = match get_cookie_from_header(headers).and_then(cookies::parse_cookie) {
+ Ok(cookies) => cookies,
+ Err(e) => {
+ let token = get_jwt_from_authorization_header(headers);
+ if token.is_err() {
+ logger::error!(?e);
+ }
+ token?.to_owned()
+ }
+ };
+ decode_jwt(&token, state).await
}
#[async_trait]
@@ -949,6 +947,9 @@ pub async fn is_ephemeral_auth<A: AppStateInfo + Sync>(
pub fn is_jwt_auth(headers: &HeaderMap) -> bool {
headers.get(crate::headers::AUTHORIZATION).is_some()
+ || get_cookie_from_header(headers)
+ .and_then(cookies::parse_cookie)
+ .is_ok()
}
pub async fn decode_jwt<T>(token: &str, state: &impl AppStateInfo) -> RouterResult<T>
|
feat
|
use cookie for auth (#4434)
|
dd0d2dc2dd9a6263bbb8a99d1f0b2077f38dd621
|
2024-01-29 15:30:35
|
Sai Harsha Vardhan
|
feat(router): add request_details logger middleware for 400 bad requests (#3414)
| false
|
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index ef6ea41d524..2c3ef2911c2 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -124,6 +124,7 @@ storage_impl = { version = "0.1.0", path = "../storage_impl", default-features =
erased-serde = "0.3.31"
quick-xml = { version = "0.31.0", features = ["serialize"] }
rdkafka = "0.36.0"
+actix-http = "3.3.1"
[build-dependencies]
router_env = { version = "0.1.0", path = "../router_env", default-features = false }
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index 7b1aba14106..ee22e40190b 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -268,5 +268,7 @@ pub fn get_application_builder(
.wrap(middleware::RequestId)
.wrap(cors::cors())
.wrap(middleware::LogSpanInitializer)
+ // this middleware works only for Http1.1 requests
+ .wrap(middleware::Http400RequestDetailsLogger)
.wrap(router_env::tracing_actix_web::TracingLogger::default())
}
diff --git a/crates/router/src/middleware.rs b/crates/router/src/middleware.rs
index 1feba66a34f..587a15693f2 100644
--- a/crates/router/src/middleware.rs
+++ b/crates/router/src/middleware.rs
@@ -1,4 +1,8 @@
-use router_env::tracing::{field::Empty, Instrument};
+use futures::StreamExt;
+use router_env::{
+ logger,
+ tracing::{field::Empty, Instrument},
+};
/// Middleware to include request ID in response header.
pub struct RequestId;
@@ -149,3 +153,114 @@ where
)
}
}
+
+fn get_request_details_from_value(json_value: &serde_json::Value, parent_key: &str) -> String {
+ match json_value {
+ serde_json::Value::Null => format!("{}: null", parent_key),
+ serde_json::Value::Bool(b) => format!("{}: {}", parent_key, b),
+ serde_json::Value::Number(num) => format!("{}: {}", parent_key, num.to_string().len()),
+ serde_json::Value::String(s) => format!("{}: {}", parent_key, s.len()),
+ serde_json::Value::Array(arr) => {
+ let mut result = String::new();
+ for (index, value) in arr.iter().enumerate() {
+ let child_key = format!("{}[{}]", parent_key, index);
+ result.push_str(&get_request_details_from_value(value, &child_key));
+ if index < arr.len() - 1 {
+ result.push_str(", ");
+ }
+ }
+ result
+ }
+ serde_json::Value::Object(obj) => {
+ let mut result = String::new();
+ for (index, (key, value)) in obj.iter().enumerate() {
+ let child_key = format!("{}[{}]", parent_key, key);
+ result.push_str(&get_request_details_from_value(value, &child_key));
+ if index < obj.len() - 1 {
+ result.push_str(", ");
+ }
+ }
+ result
+ }
+ }
+}
+
+/// Middleware for Logging request_details of HTTP 400 Bad Requests
+pub struct Http400RequestDetailsLogger;
+
+impl<S: 'static, B> actix_web::dev::Transform<S, actix_web::dev::ServiceRequest>
+ for Http400RequestDetailsLogger
+where
+ S: actix_web::dev::Service<
+ actix_web::dev::ServiceRequest,
+ Response = actix_web::dev::ServiceResponse<B>,
+ Error = actix_web::Error,
+ >,
+ S::Future: 'static,
+ B: 'static,
+{
+ type Response = actix_web::dev::ServiceResponse<B>;
+ type Error = actix_web::Error;
+ type Transform = Http400RequestDetailsLoggerMiddleware<S>;
+ type InitError = ();
+ type Future = std::future::Ready<Result<Self::Transform, Self::InitError>>;
+
+ fn new_transform(&self, service: S) -> Self::Future {
+ std::future::ready(Ok(Http400RequestDetailsLoggerMiddleware {
+ service: std::rc::Rc::new(service),
+ }))
+ }
+}
+
+pub struct Http400RequestDetailsLoggerMiddleware<S> {
+ service: std::rc::Rc<S>,
+}
+
+impl<S, B> actix_web::dev::Service<actix_web::dev::ServiceRequest>
+ for Http400RequestDetailsLoggerMiddleware<S>
+where
+ S: actix_web::dev::Service<
+ actix_web::dev::ServiceRequest,
+ Response = actix_web::dev::ServiceResponse<B>,
+ Error = actix_web::Error,
+ > + 'static,
+ S::Future: 'static,
+ B: 'static,
+{
+ type Response = actix_web::dev::ServiceResponse<B>;
+ type Error = actix_web::Error;
+ type Future = futures::future::LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;
+
+ actix_web::dev::forward_ready!(service);
+
+ fn call(&self, mut req: actix_web::dev::ServiceRequest) -> Self::Future {
+ let svc = self.service.clone();
+ let request_id_fut = req.extract::<router_env::tracing_actix_web::RequestId>();
+ Box::pin(async move {
+ let (http_req, payload) = req.into_parts();
+ let result_payload: Vec<Result<bytes::Bytes, actix_web::error::PayloadError>> =
+ payload.collect().await;
+ let payload = result_payload
+ .into_iter()
+ .collect::<Result<Vec<bytes::Bytes>, actix_web::error::PayloadError>>()?;
+ let bytes = payload.clone().concat().to_vec();
+ // we are creating h1 payload manually from bytes, currently there's no way to create http2 payload with actix
+ let (_, mut new_payload) = actix_http::h1::Payload::create(true);
+ new_payload.unread_data(bytes.to_vec().clone().into());
+ let new_req = actix_web::dev::ServiceRequest::from_parts(http_req, new_payload.into());
+ let response_fut = svc.call(new_req);
+ let response = response_fut.await?;
+ // Log the request_details when we receive 400 status from the application
+ if response.status() == 400 {
+ let value: serde_json::Value = serde_json::from_slice(&bytes)?;
+ let request_id = request_id_fut.await?.as_hyphenated().to_string();
+ logger::info!(
+ "request_id: {}, request_details: {}",
+ request_id,
+ get_request_details_from_value(&value, "")
+ );
+ }
+ Ok(response)
+ })
+ }
+}
|
feat
|
add request_details logger middleware for 400 bad requests (#3414)
|
6739b59bc8c94650e398901b402e977de28661e6
|
2023-07-03 15:07:33
|
Sarthak Soni
|
refactor(payment_methods): added clone derivation for PaymentMethodId (#1568)
| false
|
diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs
index 05e2a1307de..1c28617d745 100644
--- a/crates/api_models/src/customers.rs
+++ b/crates/api_models/src/customers.rs
@@ -93,7 +93,7 @@ pub struct CustomerResponse {
pub metadata: Option<pii::SecretSerdeValue>,
}
-#[derive(Default, Debug, Deserialize, Serialize)]
+#[derive(Default, Clone, Debug, Deserialize, Serialize)]
pub struct CustomerId {
pub customer_id: String,
}
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 4dcaad09fb3..f4e9ffacf8f 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -293,7 +293,7 @@ pub struct RequestPaymentMethodTypes {
}
//List Payment Method
-#[derive(Debug, serde::Serialize, Default, ToSchema)]
+#[derive(Debug, Clone, serde::Serialize, Default, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct PaymentMethodListRequest {
/// This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK
@@ -543,7 +543,7 @@ pub struct CustomerPaymentMethod {
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<time::PrimitiveDateTime>,
}
-#[derive(Debug, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodId {
pub payment_method_id: String,
}
|
refactor
|
added clone derivation for PaymentMethodId (#1568)
|
534e03b393fc3487dcb52dd9562f740480890a51
|
2023-01-11 16:27:10
|
Kartikeya Hegde
|
feat: Filter payment methods based on payment (#331)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 6556f043f1b..96b5bc02d04 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -71,7 +71,7 @@ pub struct ListPaymentMethodRequest {
pub client_secret: Option<String>,
pub accepted_countries: Option<Vec<String>>,
pub accepted_currencies: Option<Vec<api_enums::Currency>>,
- pub amount: Option<i32>,
+ pub amount: Option<i64>,
pub recurring_enabled: Option<bool>,
pub installment_payment_enabled: Option<bool>,
}
@@ -174,8 +174,8 @@ pub struct ListPaymentMethodResponse {
pub payment_schemes: Option<Vec<String>>,
pub accepted_countries: Option<Vec<String>>,
pub accepted_currencies: Option<Vec<api_enums::Currency>>,
- pub minimum_amount: Option<i32>,
- pub maximum_amount: Option<i32>,
+ pub minimum_amount: Option<i64>,
+ pub maximum_amount: Option<i64>,
pub recurring_enabled: bool,
pub installment_payment_enabled: bool,
pub payment_experience: Option<Vec<PaymentExperience>>,
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 06ba52964df..a4d3b1cdfdd 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -1,6 +1,6 @@
use std::collections;
-use common_utils::{consts, generate_id};
+use common_utils::{consts, ext_traits::AsyncExt, generate_id};
use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
@@ -355,13 +355,35 @@ pub async fn list_payment_methods(
merchant_account: storage::MerchantAccount,
mut req: api::ListPaymentMethodRequest,
) -> errors::RouterResponse<Vec<api::ListPaymentMethodResponse>> {
- helpers::verify_client_secret(
+ let payment_intent = helpers::verify_client_secret(
db,
merchant_account.storage_scheme,
req.client_secret.clone(),
&merchant_account.merchant_id,
)
.await?;
+ let address = payment_intent
+ .as_ref()
+ .async_map(|pi| async {
+ helpers::get_address_by_id(db, pi.billing_address_id.clone()).await
+ })
+ .await
+ .transpose()?
+ .flatten();
+
+ let payment_attempt = payment_intent
+ .as_ref()
+ .async_map(|pi| async {
+ db.find_payment_attempt_by_payment_id_merchant_id(
+ &pi.payment_id,
+ &pi.merchant_id,
+ merchant_account.storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::PaymentNotFound)
+ })
+ .await
+ .transpose()?;
let all_mcas = db
.find_merchant_connector_account_by_merchant_id_list(&merchant_account.merchant_id)
@@ -378,19 +400,31 @@ pub async fn list_payment_methods(
None => continue,
};
- filter_payment_methods(payment_methods, &mut req, &mut response);
+ filter_payment_methods(
+ payment_methods,
+ &mut req,
+ &mut response,
+ payment_intent.as_ref(),
+ payment_attempt.as_ref(),
+ address.as_ref(),
+ )
+ .await?;
}
+
response
.is_empty()
.then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound)))
.unwrap_or(Ok(services::ApplicationResponse::Json(response)))
}
-fn filter_payment_methods(
+async fn filter_payment_methods(
payment_methods: Vec<serde_json::Value>,
req: &mut api::ListPaymentMethodRequest,
resp: &mut Vec<api::ListPaymentMethodResponse>,
-) {
+ payment_intent: Option<&storage::PaymentIntent>,
+ payment_attempt: Option<&storage::PaymentAttempt>,
+ address: Option<&storage::Address>,
+) -> errors::CustomResult<(), errors::ApiErrorResponse> {
for payment_method in payment_methods.into_iter() {
if let Ok(payment_method_object) =
serde_json::from_value::<api::ListPaymentMethodResponse>(payment_method)
@@ -420,13 +454,23 @@ fn filter_payment_methods(
&payment_method_object.accepted_currencies,
&req.accepted_currencies,
);
+ let filter3 = if let Some(payment_intent) = payment_intent {
+ filter_payment_country_based(&payment_method_object, address).await?
+ && filter_payment_currency_based(payment_intent, &payment_method_object)
+ && filter_payment_amount_based(payment_intent, &payment_method_object)
+ && filter_payment_mandate_based(payment_attempt, &payment_method_object)
+ .await?
+ } else {
+ true
+ };
- if filter && filter2 {
+ if filter && filter2 && filter3 {
resp.push(payment_method_object);
}
}
}
}
+ Ok(())
}
fn filter_accepted_enum_based<T: Eq + std::hash::Hash + Clone>(
@@ -449,7 +493,7 @@ fn filter_accepted_enum_based<T: Eq + std::hash::Hash + Clone>(
fn filter_amount_based(
payment_method: &api::ListPaymentMethodResponse,
- amount: Option<i32>,
+ amount: Option<i64>,
) -> bool {
let min_check = amount
.and_then(|amt| payment_method.minimum_amount.map(|min_amt| amt >= min_amt))
@@ -484,6 +528,51 @@ fn filter_installment_based(
})
}
+async fn filter_payment_country_based(
+ pm: &api::ListPaymentMethodResponse,
+ address: Option<&storage::Address>,
+) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
+ Ok(address.map_or(true, |address| {
+ address.country.as_ref().map_or(true, |country| {
+ pm.accepted_countries
+ .clone()
+ .map_or(true, |ac| ac.contains(country))
+ })
+ }))
+}
+
+fn filter_payment_currency_based(
+ payment_intent: &storage::PaymentIntent,
+ pm: &api::ListPaymentMethodResponse,
+) -> bool {
+ payment_intent.currency.map_or(true, |currency| {
+ pm.accepted_currencies
+ .clone()
+ .map_or(true, |ac| ac.contains(¤cy.foreign_into()))
+ })
+}
+
+fn filter_payment_amount_based(
+ payment_intent: &storage::PaymentIntent,
+ pm: &api::ListPaymentMethodResponse,
+) -> bool {
+ let amount = payment_intent.amount;
+ pm.maximum_amount.map_or(true, |amt| amount < amt)
+ && pm.minimum_amount.map_or(true, |amt| amount > amt)
+}
+
+async fn filter_payment_mandate_based(
+ payment_attempt: Option<&storage::PaymentAttempt>,
+ pm: &api::ListPaymentMethodResponse,
+) -> errors::CustomResult<bool, errors::ApiErrorResponse> {
+ let recurring_filter = if !pm.recurring_enabled {
+ payment_attempt.map_or(true, |pa| pa.mandate_id.is_none())
+ } else {
+ true
+ };
+ Ok(recurring_filter)
+}
+
pub async fn list_customer_payment_method(
state: &routes::AppState,
merchant_account: storage::MerchantAccount,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 0b8f13656ff..d1f25cb1f5f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1,5 +1,6 @@
use std::borrow::Cow;
+use common_utils::ext_traits::AsyncExt;
// TODO : Evaluate all the helper functions ()
use error_stack::{report, IntoReport, ResultExt};
use masking::{ExposeOptionInterface, PeekInterface};
@@ -1353,11 +1354,10 @@ pub(crate) async fn verify_client_secret(
storage_scheme: storage_enums::MerchantStorageScheme,
client_secret: Option<String>,
merchant_id: &str,
-) -> error_stack::Result<(), errors::ApiErrorResponse> {
- match client_secret {
- None => Ok(()),
- Some(cs) => {
- let payment_id = cs.split('_').take(2).collect::<Vec<&str>>().join("_");
+) -> error_stack::Result<Option<storage::PaymentIntent>, errors::ApiErrorResponse> {
+ client_secret
+ .async_map(|cs| async move {
+ let payment_id = get_payment_id_from_client_secret(&cs);
let payment_intent = db
.find_payment_intent_by_payment_id_merchant_id(
@@ -1369,9 +1369,16 @@ pub(crate) async fn verify_client_secret(
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
authenticate_client_secret(Some(&cs), payment_intent.client_secret.as_ref())
- .map_err(|err| err.into())
- }
- }
+ .map_err(errors::ApiErrorResponse::from)?;
+ Ok(payment_intent)
+ })
+ .await
+ .transpose()
+}
+
+#[inline]
+pub(crate) fn get_payment_id_from_client_secret(cs: &str) -> String {
+ cs.split('_').take(2).collect::<Vec<&str>>().join("_")
}
#[cfg(test)]
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index f7b7d868ffb..360989662f1 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -181,8 +181,7 @@ impl MerchantConnectorAccount {
.route(web::get().to(payment_connector_list)),
)
.service(
- web::resource("/{merchant_id}/payment_methods")
- .route(web::get().to(list_payment_method_api)),
+ web::resource("/payment_methods").route(web::get().to(list_payment_method_api)),
)
.service(
web::resource("/{merchant_id}/connectors/{merchant_connector_id}")
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 93da254a9e8..d21d584c1ec 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -32,7 +32,6 @@ pub async fn create_payment_method_api(
pub async fn list_payment_method_api(
state: web::Data<AppState>,
req: HttpRequest,
- _merchant_id: web::Path<String>,
json_payload: web::Query<payment_methods::ListPaymentMethodRequest>,
) -> HttpResponse {
let payload = json_payload.into_inner();
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 4df1897b99c..b05984bdf60 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -279,6 +279,11 @@ impl From<F<api_enums::Currency>> for F<storage_enums::Currency> {
Self(frunk::labelled_convert_from(currency.0))
}
}
+impl From<F<storage_enums::Currency>> for F<api_enums::Currency> {
+ fn from(currency: F<storage_enums::Currency>) -> Self {
+ Self(frunk::labelled_convert_from(currency.0))
+ }
+}
impl<'a> From<F<&'a api_types::Address>> for F<storage::AddressUpdate> {
fn from(address: F<&api_types::Address>) -> Self {
|
feat
|
Filter payment methods based on payment (#331)
|
37f10fb5b4363244bbe133407e632cece1d9a1c6
|
2025-01-17 15:37:55
|
Pa1NarK
|
chore: update creds (#7054)
| false
|
diff --git a/.github/workflows/cypress-tests-runner.yml b/.github/workflows/cypress-tests-runner.yml
index c4a4a326c69..6272da95ced 100644
--- a/.github/workflows/cypress-tests-runner.yml
+++ b/.github/workflows/cypress-tests-runner.yml
@@ -128,7 +128,7 @@ jobs:
CONNECTOR_AUTH_PASSPHRASE: ${{ secrets.CONNECTOR_AUTH_PASSPHRASE }}
CONNECTOR_CREDS_S3_BUCKET_URI: ${{ secrets.CONNECTOR_CREDS_S3_BUCKET_URI}}
DESTINATION_FILE_NAME: "creds.json.gpg"
- S3_SOURCE_FILE_NAME: "ae17cddf-4e13-471e-a78d-58eafcfd66a5.json.gpg"
+ S3_SOURCE_FILE_NAME: "5b3ebdad-1067-421b-83e5-3ceb73c3eeeb.json.gpg"
shell: bash
run: |
mkdir -p ".github/secrets" ".github/test"
|
chore
|
update creds (#7054)
|
50e4d797da31b570b5920b33d77c24a21d9871e2
|
2024-01-10 13:52:37
|
Sahkal Poddar
|
feat(payment_link): add status page for payment link (#3213)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 9749a01a8ae..4cb2bc085bc 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -473,7 +473,7 @@ apple_pay_merchant_cert = "APPLE_PAY_MERCHNAT_CERTIFICATE" #Merchant Cer
apple_pay_merchant_cert_key = "APPLE_PAY_MERCHNAT_CERTIFICATE_KEY" #Private key generate by RSA:2048 algorithm
[payment_link]
-sdk_url = "http://localhost:9090/dist/HyperLoader.js"
+sdk_url = "http://localhost:9090/0.16.7/v0/HyperLoader.js"
[payment_method_auth]
redis_expiry = 900
diff --git a/config/development.toml b/config/development.toml
index 65ec470d19d..23917cec3aa 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -494,7 +494,7 @@ apple_pay_merchant_cert = "APPLE_PAY_MERCHNAT_CERTIFICATE"
apple_pay_merchant_cert_key = "APPLE_PAY_MERCHNAT_CERTIFICATE_KEY"
[payment_link]
-sdk_url = "http://localhost:9090/dist/HyperLoader.js"
+sdk_url = "http://localhost:9050/HyperLoader.js"
[payment_method_auth]
redis_expiry = 900
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 76d62605a43..4ef0c540b51 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -3358,6 +3358,13 @@ pub struct PaymentLinkInitiateRequest {
pub payment_id: String,
}
+#[derive(Debug, serde::Serialize)]
+#[serde(untagged)]
+pub enum PaymentLinkData {
+ PaymentLinkDetails(PaymentLinkDetails),
+ PaymentLinkStatusDetails(PaymentLinkStatusDetails),
+}
+
#[derive(Debug, serde::Serialize)]
pub struct PaymentLinkDetails {
pub amount: String,
@@ -3376,6 +3383,21 @@ pub struct PaymentLinkDetails {
pub merchant_description: Option<String>,
}
+#[derive(Debug, serde::Serialize)]
+pub struct PaymentLinkStatusDetails {
+ pub amount: String,
+ pub currency: api_enums::Currency,
+ pub payment_id: String,
+ pub merchant_logo: String,
+ pub merchant_name: String,
+ #[serde(with = "common_utils::custom_serde::iso8601")]
+ pub created: PrimitiveDateTime,
+ pub intent_status: api_enums::IntentStatus,
+ pub payment_link_status: PaymentLinkStatus,
+ pub error_code: Option<String>,
+ pub error_message: Option<String>,
+}
+
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
#[serde(deny_unknown_fields)]
@@ -3451,7 +3473,8 @@ pub struct OrderDetailsWithStringAmount {
pub product_img_link: Option<String>,
}
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+#[derive(PartialEq, Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(rename_all = "snake_case")]
pub enum PaymentLinkStatus {
Active,
Expired,
diff --git a/crates/router/src/compatibility/wrap.rs b/crates/router/src/compatibility/wrap.rs
index 1ab156d32ad..d3ca0172f26 100644
--- a/crates/router/src/compatibility/wrap.rs
+++ b/crates/router/src/compatibility/wrap.rs
@@ -133,19 +133,34 @@ where
.map_into_boxed_body()
}
- Ok(api::ApplicationResponse::PaymenkLinkForm(payment_link_data)) => {
- match api::build_payment_link_html(*payment_link_data) {
- Ok(rendered_html) => api::http_response_html_data(rendered_html),
- Err(_) => api::http_response_err(
- r#"{
- "error": {
- "message": "Error while rendering payment link html page"
- }
- }"#,
- ),
+ Ok(api::ApplicationResponse::PaymenkLinkForm(boxed_payment_link_data)) => {
+ match *boxed_payment_link_data {
+ api::PaymentLinkAction::PaymentLinkFormData(payment_link_data) => {
+ match api::build_payment_link_html(payment_link_data) {
+ Ok(rendered_html) => api::http_response_html_data(rendered_html),
+ Err(_) => api::http_response_err(
+ r#"{
+ "error": {
+ "message": "Error while rendering payment link html page"
+ }
+ }"#,
+ ),
+ }
+ }
+ api::PaymentLinkAction::PaymentLinkStatus(payment_link_data) => {
+ match api::get_payment_link_status(payment_link_data) {
+ Ok(rendered_html) => api::http_response_html_data(rendered_html),
+ Err(_) => api::http_response_err(
+ r#"{
+ "error": {
+ "message": "Error while rendering payment link status page"
+ }
+ }"#,
+ ),
+ }
+ }
}
}
-
Err(error) => api::log_and_return_error_response(error),
};
diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs
index f2043d392ab..9adf9031793 100644
--- a/crates/router/src/core/payment_link.rs
+++ b/crates/router/src/core/payment_link.rs
@@ -13,7 +13,6 @@ use time::PrimitiveDateTime;
use super::errors::{self, RouterResult, StorageErrorExt};
use crate::{
- core::payments::helpers,
errors::RouterResponse,
routes::AppState,
services,
@@ -68,18 +67,6 @@ pub async fn intiate_payment_link_flow(
.get_required_value("payment_link_id")
.change_context(errors::ApiErrorResponse::PaymentLinkNotFound)?;
- helpers::validate_payment_status_against_not_allowed_statuses(
- &payment_intent.status,
- &[
- storage_enums::IntentStatus::Cancelled,
- storage_enums::IntentStatus::Succeeded,
- storage_enums::IntentStatus::Processing,
- storage_enums::IntentStatus::RequiresCapture,
- storage_enums::IntentStatus::RequiresMerchantAction,
- ],
- "use payment link for",
- )?;
-
let merchant_name_from_merchant_account = merchant_account
.merchant_name
.clone()
@@ -101,7 +88,7 @@ pub async fn intiate_payment_link_flow(
}
};
- let return_url = if let Some(payment_create_return_url) = payment_intent.return_url {
+ let return_url = if let Some(payment_create_return_url) = payment_intent.return_url.clone() {
payment_create_return_url
} else {
merchant_account
@@ -114,23 +101,73 @@ pub async fn intiate_payment_link_flow(
let (pub_key, currency, client_secret) = validate_sdk_requirements(
merchant_account.publishable_key,
payment_intent.currency,
- payment_intent.client_secret,
+ payment_intent.client_secret.clone(),
)?;
- let order_details = validate_order_details(payment_intent.order_details, currency)?;
+ let amount = currency
+ .to_currency_base_unit(payment_intent.amount)
+ .into_report()
+ .change_context(errors::ApiErrorResponse::CurrencyConversionFailed)?;
+ let order_details = validate_order_details(payment_intent.order_details.clone(), currency)?;
let session_expiry = payment_link.fulfilment_time.unwrap_or_else(|| {
- common_utils::date_time::now()
+ payment_intent
+ .created_at
.saturating_add(time::Duration::seconds(DEFAULT_SESSION_EXPIRY))
});
// converting first letter of merchant name to upperCase
let merchant_name = capitalize_first_char(&payment_link_config.seller_name);
+ let css_script = get_color_scheme_css(payment_link_config.clone());
+ let payment_link_status = check_payment_link_status(session_expiry);
+
+ if check_payment_link_invalid_conditions(
+ &payment_intent.status,
+ &[
+ storage_enums::IntentStatus::Cancelled,
+ storage_enums::IntentStatus::Failed,
+ storage_enums::IntentStatus::Processing,
+ storage_enums::IntentStatus::RequiresCapture,
+ storage_enums::IntentStatus::RequiresMerchantAction,
+ storage_enums::IntentStatus::Succeeded,
+ ],
+ ) || payment_link_status == api_models::payments::PaymentLinkStatus::Expired
+ {
+ let attempt_id = payment_intent.active_attempt.get_id().clone();
+ let payment_attempt = db
+ .find_payment_attempt_by_payment_id_merchant_id_attempt_id(
+ &payment_intent.payment_id,
+ &merchant_id,
+ &attempt_id.clone(),
+ merchant_account.storage_scheme,
+ )
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ let payment_details = api_models::payments::PaymentLinkStatusDetails {
+ amount,
+ currency,
+ payment_id: payment_intent.payment_id,
+ merchant_name,
+ merchant_logo: payment_link_config.clone().logo,
+ created: payment_link.created_at,
+ intent_status: payment_intent.status,
+ payment_link_status,
+ error_code: payment_attempt.error_code,
+ error_message: payment_attempt.error_message,
+ };
+ let js_script = get_js_script(
+ api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details),
+ )?;
+ let payment_link_error_data = services::PaymentLinkStatusData {
+ js_script,
+ css_script,
+ };
+ return Ok(services::ApplicationResponse::PaymenkLinkForm(Box::new(
+ services::api::PaymentLinkAction::PaymentLinkStatus(payment_link_error_data),
+ )));
+ };
let payment_details = api_models::payments::PaymentLinkDetails {
- amount: currency
- .to_currency_base_unit(payment_intent.amount)
- .into_report()
- .change_context(errors::ApiErrorResponse::CurrencyConversionFailed)?,
+ amount,
currency,
payment_id: payment_intent.payment_id,
merchant_name,
@@ -145,15 +182,16 @@ pub async fn intiate_payment_link_flow(
merchant_description: payment_intent.description,
};
- let js_script = get_js_script(payment_details)?;
- let css_script = get_color_scheme_css(payment_link_config.clone());
+ let js_script = get_js_script(api_models::payments::PaymentLinkData::PaymentLinkDetails(
+ payment_details,
+ ))?;
let payment_link_data = services::PaymentLinkFormData {
js_script,
sdk_url: state.conf.payment_link.sdk_url.clone(),
css_script,
};
Ok(services::ApplicationResponse::PaymenkLinkForm(Box::new(
- payment_link_data,
+ services::api::PaymentLinkAction::PaymentLinkFormData(payment_link_data),
)))
}
@@ -161,13 +199,11 @@ pub async fn intiate_payment_link_flow(
The get_js_script function is used to inject dynamic value to payment_link sdk, which is unique to every payment.
*/
-fn get_js_script(
- payment_details: api_models::payments::PaymentLinkDetails,
-) -> RouterResult<String> {
+fn get_js_script(payment_details: api_models::payments::PaymentLinkData) -> RouterResult<String> {
let payment_details_str = serde_json::to_string(&payment_details)
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to serialize PaymentLinkDetails")?;
+ .attach_printable("Failed to serialize PaymentLinkData")?;
Ok(format!("window.__PAYMENT_DETAILS = {payment_details_str};"))
}
@@ -218,11 +254,11 @@ pub async fn list_payment_link(
}
pub fn check_payment_link_status(
- max_age: PrimitiveDateTime,
+ payment_link_expiry: PrimitiveDateTime,
) -> api_models::payments::PaymentLinkStatus {
let curr_time = common_utils::date_time::now();
- if curr_time > max_age {
+ if curr_time > payment_link_expiry {
api_models::payments::PaymentLinkStatus::Expired
} else {
api_models::payments::PaymentLinkStatus::Active
@@ -369,3 +405,10 @@ fn capitalize_first_char(s: &str) -> String {
s.to_owned()
}
}
+
+fn check_payment_link_invalid_conditions(
+ intent_status: &storage_enums::IntentStatus,
+ not_allowed_statuses: &[storage_enums::IntentStatus],
+) -> bool {
+ not_allowed_statuses.contains(intent_status)
+}
diff --git a/crates/router/src/core/payment_link/payment_link.html b/crates/router/src/core/payment_link/payment_link.html
index 4fb5bb98efe..3a3ed4fffe0 100644
--- a/crates/router/src/core/payment_link/payment_link.html
+++ b/crates/router/src/core/payment_link/payment_link.html
@@ -63,7 +63,6 @@
width: 100vw;
display: flex;
justify-content: center;
- background-color: white;
padding: 20px 0;
}
@@ -133,7 +132,6 @@
#hyper-checkout-cart-image {
height: 64px;
width: 64px;
- border: 1px solid #e6e6e6;
border-radius: 4px;
display: flex;
align-self: flex-start;
@@ -344,10 +342,6 @@
font-size: 25px;
}
- .payNow {
- margin-top: 10px;
- }
-
.page-spinner {
position: absolute;
width: 100vw;
@@ -605,9 +599,38 @@
text-align: center;
}
+ #submit {
+ cursor: pointer;
+ margin-top: 20px;
+ width: 100%;
+ height: 38px;
+ background-color: var(--primary-color);
+ border: 0;
+ border-radius: 4px;
+ font-size: 18px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ #submit.disabled {
+ cursor: not-allowed;
+ }
+
+ #submit-spinner {
+ width: 28px;
+ height: 28px;
+ border: 4px solid #fff;
+ border-bottom-color: #ff3d00;
+ border-radius: 50%;
+ display: inline-block;
+ box-sizing: border-box;
+ animation: loading 1s linear infinite;
+ }
+
@media only screen and (max-width: 1400px) {
body {
- overflow: scroll;
+ overflow-y: scroll;
}
.hyper-checkout {
@@ -720,6 +743,7 @@
background-color: transparent;
width: auto;
min-width: 300px;
+ box-shadow: none;
}
#payment-form-wrap {
@@ -748,7 +772,7 @@
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
/>
</head>
- <body>
+ <body class="hide-scrollbar">
<!-- SVG ICONS -->
<svg xmlns="http://www.w3.org/2000/svg" display="none">
<defs>
@@ -920,7 +944,7 @@
<div></div>
</div>
</div>
- <div class="hyper-checkout">
+ <div class="hyper-checkout hide-scrollbar">
<div class="main hidden" id="hyper-checkout-status-canvas">
<div class="hyper-checkout-status-wrap">
<div id="hyper-checkout-status-header"></div>
@@ -1035,8 +1059,12 @@
<div></div>
</div>
</div>
- <form id="payment-form">
+ <form id="payment-form" onclick="handleSubmit(); return false;">
<div id="unified-checkout"></div>
+ <button id="submit" class="hidden">
+ <span id="submit-spinner" class="hidden"></span>
+ <span id="submit-button-text">Pay now</span>
+ </button>
<div id="payment-message" class="hidden"></div>
</form>
</div>
@@ -1060,7 +1088,7 @@
window.state = {
prevHeight: window.innerHeight,
prevWidth: window.innerWidth,
- isMobileView: window.innerWidth <= 1200,
+ isMobileView: window.innerWidth <= 1400,
currentScreen: "payment_link",
};
@@ -1088,9 +1116,9 @@
}
// Render UI
- renderPaymentDetails();
- renderSDKHeader();
- renderCart();
+ renderPaymentDetails(paymentDetails);
+ renderSDKHeader(paymentDetails);
+ renderCart(paymentDetails);
// Deal w loaders
show("#sdk-spinner");
@@ -1098,7 +1126,7 @@
hide("#unified-checkout");
// Add event listeners
- initializeEventListeners();
+ initializeEventListeners(paymentDetails);
// Initialize SDK
if (window.Hyper) {
@@ -1115,30 +1143,46 @@
}
boot();
- function initializeEventListeners() {
- var primaryColor = window
- .getComputedStyle(document.documentElement)
- .getPropertyValue("--primary-color");
+ function initializeEventListeners(paymentDetails) {
+ var primaryColor = paymentDetails.theme;
var lighterColor = adjustLightness(primaryColor, 1.4);
var darkerColor = adjustLightness(primaryColor, 0.8);
var contrastBWColor = invert(primaryColor, true);
+ var contrastingTone =
+ Array.isArray(a) && a.length > 4 ? darkerColor : lighterColor;
var hyperCheckoutNode = document.getElementById(
"hyper-checkout-payment"
);
+ var hyperCheckoutCartImageNode = document.getElementById(
+ "hyper-checkout-cart-image"
+ );
var hyperCheckoutFooterNode = document.getElementById(
"hyper-checkout-payment-footer"
);
var statusRedirectTextNode = document.getElementById(
"hyper-checkout-status-redirect-message"
);
+ var submitButtonNode = document.getElementById("submit");
+ var submitButtonLoaderNode = document.getElementById("submit-spinner");
+
+ if (submitButtonLoaderNode instanceof HTMLSpanElement) {
+ submitButtonLoaderNode.style.borderBottomColor = contrastingTone;
+ }
+
+ if (submitButtonNode instanceof HTMLButtonElement) {
+ submitButtonNode.style.color = contrastBWColor;
+ }
- if (window.innerWidth <= 1200) {
+ if (hyperCheckoutCartImageNode instanceof HTMLDivElement) {
+ hyperCheckoutCartImageNode.style.backgroundColor = contrastingTone;
+ }
+
+ if (window.innerWidth <= 1400) {
statusRedirectTextNode.style.color = "#333333";
hyperCheckoutNode.style.color = contrastBWColor;
var a = lighterColor.match(/[fF]/gi);
- hyperCheckoutFooterNode.style.backgroundColor =
- Array.isArray(a) && a.length > 4 ? darkerColor : lighterColor;
- } else if (window.innerWidth > 1200) {
+ hyperCheckoutFooterNode.style.backgroundColor = contrastingTone;
+ } else if (window.innerWidth > 1400) {
statusRedirectTextNode.style.color = contrastBWColor;
hyperCheckoutNode.style.color = "#333333";
hyperCheckoutFooterNode.style.backgroundColor = "#F5F5F5";
@@ -1147,7 +1191,7 @@
window.addEventListener("resize", function (event) {
var currentHeight = window.innerHeight;
var currentWidth = window.innerWidth;
- if (currentWidth <= 1200 && window.state.prevWidth > 1200) {
+ if (currentWidth <= 1400 && window.state.prevWidth > 1400) {
hide("#hyper-checkout-cart");
if (window.state.currentScreen === "payment_link") {
show("#hyper-footer");
@@ -1162,7 +1206,7 @@
error
);
}
- } else if (currentWidth > 1200 && window.state.prevWidth <= 1200) {
+ } else if (currentWidth > 1400 && window.state.prevWidth <= 1400) {
if (window.state.currentScreen === "payment_link") {
hide("#hyper-footer");
}
@@ -1178,16 +1222,17 @@
window.state.prevHeight = currentHeight;
window.state.prevWidth = currentWidth;
- window.state.isMobileView = currentWidth <= 1200;
+ window.state.isMobileView = currentWidth <= 1400;
});
}
- function showSDK() {
- checkStatus()
+ function showSDK(paymentDetails) {
+ checkStatus(paymentDetails)
.then(function (res) {
if (res.showSdk) {
show("#hyper-checkout-sdk");
show("#hyper-checkout-details");
+ show("#submit");
} else {
hide("#hyper-checkout-details");
hide("#hyper-checkout-sdk");
@@ -1195,6 +1240,8 @@
hide("#hyper-footer");
window.state.currentScreen = "status";
}
+ show("#unified-checkout");
+ hide("#sdk-spinner");
})
.catch(function (err) {
console.error("Failed to check status", err);
@@ -1217,14 +1264,13 @@
colorBackground: "rgb(255, 255, 255)",
},
};
- hyper = window.Hyper(pub_key);
+ hyper = window.Hyper(pub_key, { isPreloadEnabled: false });
widgets = hyper.widgets({
appearance: appearance,
clientSecret: client_secret,
});
var unifiedCheckoutOptions = {
layout: "tabs",
- sdkHandleConfirmPayment: true,
branding: "never",
wallets: {
walletReturnUrl: paymentDetails.return_url,
@@ -1237,35 +1283,7 @@
};
unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions);
mountUnifiedCheckout("#unified-checkout");
-
- // Add event listener for SDK iframe mutations
- var orcaIFrame = document.getElementById(
- "orca-payment-element-iframeRef-unified-checkout"
- );
- var callback = function (mutationList, observer) {
- for (var i = 0; i < mutationList.length; i++) {
- var mutation = mutationList[i];
-
- if (
- mutation.type === "attributes" &&
- mutation.attributeName === "style"
- ) {
- show("#unified-checkout");
- hide("#sdk-spinner");
- }
- }
- };
- var observer = new MutationObserver(callback);
- observer.observe(orcaIFrame, { attributes: true });
-
- // Handle button press callback
- var paymentElement = widgets.getElement("payment");
- if (paymentElement) {
- paymentElement.on("confirmTriggered", function (event) {
- handleSubmit(event);
- });
- }
- showSDK();
+ showSDK(paymentDetails);
}
// Util functions
@@ -1277,6 +1295,14 @@
function handleSubmit(e) {
var paymentDetails = window.__PAYMENT_DETAILS;
+
+ // Update button loader
+ hide("#submit-button-text");
+ show("#submit-spinner");
+ var submitButtonNode = document.getElementById("submit");
+ submitButtonNode.disabled = true;
+ submitButtonNode.classList.add("disabled");
+
hyper
.confirmPayment({
widgets: widgets,
@@ -1293,9 +1319,6 @@
} else {
showMessage("An unexpected error occurred.");
}
-
- // Re-initialize SDK
- mountUnifiedCheckout("#unified-checkout");
} else {
// This point will only be reached if there is an immediate error occurring while confirming the payment. Otherwise, your customer will be redirected to your 'return_url'.
// For some payment flows such as Sofort, iDEAL, your customer will be redirected to an intermediate page to complete authorization of the payment, and then redirected to the 'return_url'.
@@ -1320,13 +1343,18 @@
})
.catch(function (error) {
console.error("Error confirming payment_intent", error);
+ })
+ .finally(() => {
+ hide("#submit-spinner");
+ show("#submit-button-text");
+ submitButtonNode.disabled = false;
+ submitButtonNode.classList.remove("disabled");
});
}
// Fetches the payment status after payment submission
- function checkStatus() {
+ function checkStatus(paymentDetails) {
return new window.Promise(function (resolve, reject) {
- var paymentDetails = window.__PAYMENT_DETAILS;
var res = {
showSdk: true,
};
@@ -1669,9 +1697,7 @@
return formatted;
}
- function renderPaymentDetails() {
- var paymentDetails = window.__PAYMENT_DETAILS;
-
+ function renderPaymentDetails(paymentDetails) {
// Create price node
var priceNode = document.createElement("div");
priceNode.className = "hyper-checkout-payment-price";
@@ -1720,8 +1746,7 @@
footerNode.append(paymentExpiryNode);
}
- function renderCart() {
- var paymentDetails = window.__PAYMENT_DETAILS;
+ function renderCart(paymentDetails) {
var orderDetails = paymentDetails.order_details;
// Cart items
@@ -1749,7 +1774,9 @@
if (totalItems > MAX_ITEMS_VISIBLE_AFTER_COLLAPSE) {
var expandButtonNode = document.createElement("div");
expandButtonNode.className = "hyper-checkout-cart-button";
- expandButtonNode.onclick = handleCartView;
+ expandButtonNode.onclick = () => {
+ handleCartView(paymentDetails);
+ };
var buttonImageNode = document.createElement("svg");
buttonImageNode.id = "hyper-checkout-cart-button-arrow";
buttonImageNode.innerHTML =
@@ -1822,8 +1849,7 @@
cartItemsNode.append(itemWrapperNode);
}
- function handleCartView() {
- var paymentDetails = window.__PAYMENT_DETAILS;
+ function handleCartView(paymentDetails) {
var orderDetails = paymentDetails.order_details;
var MAX_ITEMS_VISIBLE_AFTER_COLLAPSE =
paymentDetails.max_items_visible_after_collapse;
@@ -1911,9 +1937,7 @@
show("#hyper-checkout-cart");
}
- function renderSDKHeader() {
- var paymentDetails = window.__PAYMENT_DETAILS;
-
+ function renderSDKHeader(paymentDetails) {
// SDK headers' items
var sdkHeaderItemNode = document.createElement("div");
sdkHeaderItemNode.className = "hyper-checkout-sdk-items";
diff --git a/crates/router/src/core/payment_link/status.html b/crates/router/src/core/payment_link/status.html
new file mode 100644
index 00000000000..d3bb97d294d
--- /dev/null
+++ b/crates/router/src/core/payment_link/status.html
@@ -0,0 +1,355 @@
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>404 Not Found</title>
+ <style>
+ {{ css_color_scheme }}
+
+ body,
+ body > div {
+ height: 100vh;
+ width: 100vw;
+ }
+
+ body {
+ font-family: "Montserrat";
+ background-color: var(--primary-color);
+ color: #333;
+ text-align: center;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ }
+
+ body > div {
+ height: 100vh;
+ width: 100vw;
+ overflow: scroll;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .hyper-checkout-status-wrap {
+ display: flex;
+ flex-flow: column;
+ font-family: "Montserrat";
+ width: auto;
+ min-width: 400px;
+ max-width: 800px;
+ background-color: white;
+ border-radius: 5px;
+ }
+
+ #hyper-checkout-status-header {
+ max-width: 1200px;
+ border-radius: 3px;
+ border-bottom: 1px solid #e6e6e6;
+ }
+
+ #hyper-checkout-status-header,
+ #hyper-checkout-status-content {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ font-size: 24px;
+ font-weight: 600;
+ padding: 15px 20px;
+ }
+
+ .hyper-checkout-status-amount {
+ font-family: "Montserrat";
+ font-size: 35px;
+ font-weight: 700;
+ }
+
+ .hyper-checkout-status-merchant-logo {
+ border: 1px solid #e6e6e6;
+ border-radius: 5px;
+ padding: 9px;
+ height: 48px;
+ width: 48px;
+ }
+
+ #hyper-checkout-status-content {
+ height: 100%;
+ flex-flow: column;
+ min-height: 500px;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .hyper-checkout-status-image {
+ height: 200px;
+ width: 200px;
+ }
+
+ .hyper-checkout-status-text {
+ text-align: center;
+ font-size: 21px;
+ font-weight: 600;
+ margin-top: 20px;
+ }
+
+ .hyper-checkout-status-message {
+ text-align: center;
+ font-size: 12px !important;
+ margin-top: 10px;
+ font-size: 14px;
+ font-weight: 500;
+ max-width: 400px;
+ }
+
+ .hyper-checkout-status-details {
+ display: flex;
+ flex-flow: column;
+ margin-top: 20px;
+ border-radius: 3px;
+ border: 1px solid #e6e6e6;
+ max-width: calc(100vw - 40px);
+ }
+
+ .hyper-checkout-status-item {
+ display: flex;
+ align-items: center;
+ padding: 5px 10px;
+ border-bottom: 1px solid #e6e6e6;
+ word-wrap: break-word;
+ }
+
+ .hyper-checkout-status-item:last-child {
+ border-bottom: 0;
+ }
+
+ .hyper-checkout-item-header {
+ min-width: 13ch;
+ font-size: 12px;
+ }
+
+ .hyper-checkout-item-value {
+ font-size: 12px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ word-wrap: break-word;
+ font-weight: 400;
+ text-align: center;
+ }
+
+ .ellipsis-container-2 {
+ height: 2.5em;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ text-overflow: ellipsis;
+ white-space: normal;
+ }
+
+ @media only screen and (max-width: 1136px) {
+ .info {
+ flex-flow: column;
+ align-self: flex-start;
+ align-items: flex-start;
+ min-width: auto;
+ }
+
+ .value {
+ margin: 0;
+ }
+ }
+ </style>
+ <link
+ rel="stylesheet"
+ href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800"
+ />
+ <script>
+ {{ payment_details_js_script }}
+
+ function boot() {
+ var paymentDetails = window.__PAYMENT_DETAILS;
+
+ // Attach document icon
+ if (paymentDetails.merchant_logo) {
+ var link = document.createElement("link");
+ link.rel = "icon";
+ link.href = paymentDetails.merchant_logo;
+ link.type = "image/x-icon";
+ document.head.appendChild(link);
+ }
+
+ var statusDetails = {
+ imageSource: "",
+ message: "",
+ status: "",
+ items: [],
+ };
+
+ var paymentId = createItem("Ref Id", paymentDetails.payment_id);
+ statusDetails.items.push(paymentId);
+
+ // Decide screen to render
+ switch (paymentDetails.payment_link_status) {
+ case "expired": {
+ statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
+ statusDetails.status = "Payment Link Expired!";
+ statusDetails.message = "This payment link is expired.";
+ break;
+ }
+
+ default: {
+ statusDetails.status = paymentDetails.intent_status;
+ // Render status screen
+ switch (paymentDetails.intent_status) {
+ case "succeeded": {
+ statusDetails.imageSource = "https://i.imgur.com/5BOmYVl.png";
+ statusDetails.message =
+ "We have successfully received your payment";
+ break;
+ }
+
+ case "processing": {
+ statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
+ statusDetails.message =
+ "Sorry! Your payment is taking longer than expected. Please check back again in sometime.";
+ statusDetails.status = "Payment Pending";
+ break;
+ }
+
+ case "failed": {
+ statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
+ statusDetails.status = "Payment Failed!";
+ var errorCodeNode = createItem(
+ "Error code",
+ paymentDetails.error_code
+ );
+ var errorMessageNode = createItem(
+ "Error message",
+ paymentDetails.error_message
+ );
+ // @ts-ignore
+ statusDetails.items.push(errorMessageNode, errorCodeNode);
+ break;
+ }
+
+ case "cancelled": {
+ statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
+ statusDetails.status = "Payment Cancelled";
+ break;
+ }
+
+ case "requires_merchant_action": {
+ statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
+ statusDetails.status = "Payment under review";
+ break;
+ }
+
+ case "requires_capture": {
+ statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
+ statusDetails.status = "Payment Pending";
+ break;
+ }
+
+ case "partially_captured": {
+ statusDetails.imageSource = "https://i.imgur.com/Yb79Qt4.png";
+ statusDetails.message = "Partial payment was captured.";
+ statusDetails.status = "Partial Payment Pending";
+ break;
+ }
+
+ default:
+ statusDetails.imageSource = "https://i.imgur.com/UD8CEuY.png";
+ statusDetails.status = "Something went wrong";
+ // Error details
+ if (typeof paymentDetails.error === "object") {
+ var errorCodeNode = createItem(
+ "Error Code",
+ paymentDetails.error.code
+ );
+ var errorMessageNode = createItem(
+ "Error Message",
+ paymentDetails.error.message
+ );
+ // @ts-ignore
+ statusDetails.items.push(errorMessageNode, errorCodeNode);
+ }
+ }
+ }
+ }
+
+ // Form header
+ var hyperCheckoutImageNode = document.createElement("img");
+ var hyperCheckoutAmountNode = document.createElement("div");
+
+ hyperCheckoutImageNode.src = paymentDetails.merchant_logo;
+ hyperCheckoutImageNode.className =
+ "hyper-checkout-status-merchant-logo";
+ hyperCheckoutAmountNode.innerText =
+ paymentDetails.currency + " " + paymentDetails.amount;
+ hyperCheckoutAmountNode.className = "hyper-checkout-status-amount";
+ var hyperCheckoutHeaderNode = document.getElementById(
+ "hyper-checkout-status-header"
+ );
+ if (hyperCheckoutHeaderNode instanceof HTMLDivElement) {
+ hyperCheckoutHeaderNode.append(
+ hyperCheckoutAmountNode,
+ hyperCheckoutImageNode
+ );
+ }
+
+ // Form and append items
+ var hyperCheckoutStatusTextNode = document.createElement("div");
+ hyperCheckoutStatusTextNode.innerText = statusDetails.status;
+ hyperCheckoutStatusTextNode.className = "hyper-checkout-status-text";
+
+ var merchantLogoNode = document.createElement("img");
+ merchantLogoNode.src = statusDetails.imageSource;
+ merchantLogoNode.className = "hyper-checkout-status-image";
+
+ var hyperCheckoutStatusMessageNode = document.createElement("div");
+ hyperCheckoutStatusMessageNode.innerText = statusDetails.message;
+
+ var hyperCheckoutDetailsNode = document.createElement("div");
+ hyperCheckoutDetailsNode.className = "hyper-checkout-status-details";
+ if (hyperCheckoutDetailsNode instanceof HTMLDivElement) {
+ hyperCheckoutDetailsNode.append(...statusDetails.items);
+ }
+
+ var hyperCheckoutContentNode = document.getElementById(
+ "hyper-checkout-status-content"
+ );
+ if (hyperCheckoutContentNode instanceof HTMLDivElement) {
+ hyperCheckoutContentNode.prepend(
+ merchantLogoNode,
+ hyperCheckoutStatusTextNode,
+ hyperCheckoutDetailsNode
+ );
+ }
+ }
+
+ function createItem(heading, value) {
+ var itemNode = document.createElement("div");
+ itemNode.className = "hyper-checkout-status-item";
+ var headerNode = document.createElement("div");
+ headerNode.className = "hyper-checkout-item-header";
+ headerNode.innerText = heading;
+ var valueNode = document.createElement("div");
+ valueNode.classList.add("hyper-checkout-item-value");
+ // valueNode.classList.add("ellipsis-container-2");
+ valueNode.innerText = value;
+ itemNode.append(headerNode);
+ itemNode.append(valueNode);
+ return itemNode;
+ }
+ </script>
+ </head>
+
+ <body onload="boot()">
+ <div>
+ <div class="hyper-checkout-status-wrap">
+ <div id="hyper-checkout-status-header"></div>
+ <div id="hyper-checkout-status-content"></div>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 54df0285512..fdaaa87bf40 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -733,11 +733,17 @@ pub enum ApplicationResponse<R> {
TextPlain(String),
JsonForRedirection(api::RedirectionResponse),
Form(Box<RedirectionFormData>),
- PaymenkLinkForm(Box<PaymentLinkFormData>),
+ PaymenkLinkForm(Box<PaymentLinkAction>),
FileData((Vec<u8>, mime::Mime)),
JsonWithHeaders((R, Vec<(String, String)>)),
}
+#[derive(Debug, Eq, PartialEq)]
+pub enum PaymentLinkAction {
+ PaymentLinkFormData(PaymentLinkFormData),
+ PaymentLinkStatus(PaymentLinkStatusData),
+}
+
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkFormData {
pub js_script: String,
@@ -745,6 +751,12 @@ pub struct PaymentLinkFormData {
pub sdk_url: String,
}
+#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
+pub struct PaymentLinkStatusData {
+ pub js_script: String,
+ pub css_script: String,
+}
+
#[derive(Debug, Eq, PartialEq)]
pub struct RedirectionFormData {
pub redirect_form: RedirectForm,
@@ -1051,16 +1063,32 @@ where
.map_into_boxed_body()
}
- Ok(ApplicationResponse::PaymenkLinkForm(payment_link_data)) => {
- match build_payment_link_html(*payment_link_data) {
- Ok(rendered_html) => http_response_html_data(rendered_html),
- Err(_) => http_response_err(
- r#"{
- "error": {
- "message": "Error while rendering payment link html page"
- }
- }"#,
- ),
+ Ok(ApplicationResponse::PaymenkLinkForm(boxed_payment_link_data)) => {
+ match *boxed_payment_link_data {
+ PaymentLinkAction::PaymentLinkFormData(payment_link_data) => {
+ match build_payment_link_html(payment_link_data) {
+ Ok(rendered_html) => http_response_html_data(rendered_html),
+ Err(_) => http_response_err(
+ r#"{
+ "error": {
+ "message": "Error while rendering payment link html page"
+ }
+ }"#,
+ ),
+ }
+ }
+ PaymentLinkAction::PaymentLinkStatus(payment_link_data) => {
+ match get_payment_link_status(payment_link_data) {
+ Ok(rendered_html) => http_response_html_data(rendered_html),
+ Err(_) => http_response_err(
+ r#"{
+ "error": {
+ "message": "Error while rendering payment link status page"
+ }
+ }"#,
+ ),
+ }
+ }
}
}
@@ -1634,6 +1662,26 @@ fn get_hyper_loader_sdk(sdk_url: &str) -> String {
format!("<script src=\"{sdk_url}\" onload=\"initializeSDK()\"></script>")
}
+pub fn get_payment_link_status(
+ payment_link_data: PaymentLinkStatusData,
+) -> CustomResult<String, errors::ApiErrorResponse> {
+ let html_template = include_str!("../core/payment_link/status.html").to_string();
+ let mut tera = Tera::default();
+ let _ = tera.add_raw_template("payment_link_status", &html_template);
+
+ let mut context = Context::new();
+ context.insert("css_color_scheme", &payment_link_data.css_script);
+ context.insert("payment_details_js_script", &payment_link_data.js_script);
+
+ match tera.render("payment_link_status", &context) {
+ Ok(rendered_html) => Ok(rendered_html),
+ Err(tera_error) => {
+ crate::logger::warn!("{tera_error}");
+ Err(errors::ApiErrorResponse::InternalServerError)?
+ }
+ }
+}
+
#[cfg(test)]
mod tests {
#[test]
diff --git a/crates/router/src/types/api/payment_link.rs b/crates/router/src/types/api/payment_link.rs
index d0ce8c043ba..85cb539d411 100644
--- a/crates/router/src/types/api/payment_link.rs
+++ b/crates/router/src/types/api/payment_link.rs
@@ -15,7 +15,8 @@ pub(crate) trait PaymentLinkResponseExt: Sized {
impl PaymentLinkResponseExt for RetrievePaymentLinkResponse {
async fn from_db_payment_link(payment_link: storage::PaymentLink) -> RouterResult<Self> {
let session_expiry = payment_link.fulfilment_time.unwrap_or_else(|| {
- common_utils::date_time::now()
+ payment_link
+ .created_at
.saturating_add(time::Duration::seconds(DEFAULT_SESSION_EXPIRY))
});
let status = payment_link::check_payment_link_status(session_expiry);
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index bf0df4dc4b2..4e6c69b2ebd 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -8760,8 +8760,8 @@
"PaymentLinkStatus": {
"type": "string",
"enum": [
- "Active",
- "Expired"
+ "active",
+ "expired"
]
},
"PaymentListConstraints": {
|
feat
|
add status page for payment link (#3213)
|
f3ca2009c1902094a72b8bf43e89b406e44ecfd4
|
2025-02-19 16:30:14
|
Sakil Mostak
|
refactor(utils): match string for state with SDK's naming convention (#7300)
| false
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index c3421185e79..54514f6e05a 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -2943,128 +2943,274 @@ pub enum FinlandStatesAbbreviation {
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display, strum::EnumString,
)]
pub enum FranceStatesAbbreviation {
- #[strum(serialize = "WF-AL")]
- Alo,
- #[strum(serialize = "A")]
+ #[strum(serialize = "01")]
+ Ain,
+ #[strum(serialize = "02")]
+ Aisne,
+ #[strum(serialize = "03")]
+ Allier,
+ #[strum(serialize = "04")]
+ AlpesDeHauteProvence,
+ #[strum(serialize = "06")]
+ AlpesMaritimes,
+ #[strum(serialize = "6AE")]
Alsace,
- #[strum(serialize = "B")]
- Aquitaine,
- #[strum(serialize = "C")]
- Auvergne,
+ #[strum(serialize = "07")]
+ Ardeche,
+ #[strum(serialize = "08")]
+ Ardennes,
+ #[strum(serialize = "09")]
+ Ariege,
+ #[strum(serialize = "10")]
+ Aube,
+ #[strum(serialize = "11")]
+ Aude,
#[strum(serialize = "ARA")]
AuvergneRhoneAlpes,
+ #[strum(serialize = "12")]
+ Aveyron,
+ #[strum(serialize = "67")]
+ BasRhin,
+ #[strum(serialize = "13")]
+ BouchesDuRhone,
#[strum(serialize = "BFC")]
BourgogneFrancheComte,
#[strum(serialize = "BRE")]
- Brittany,
- #[strum(serialize = "D")]
- Burgundy,
+ Bretagne,
+ #[strum(serialize = "14")]
+ Calvados,
+ #[strum(serialize = "15")]
+ Cantal,
#[strum(serialize = "CVL")]
CentreValDeLoire,
- #[strum(serialize = "G")]
- ChampagneArdenne,
- #[strum(serialize = "COR")]
- Corsica,
- #[strum(serialize = "I")]
- FrancheComte,
- #[strum(serialize = "GF")]
+ #[strum(serialize = "16")]
+ Charente,
+ #[strum(serialize = "17")]
+ CharenteMaritime,
+ #[strum(serialize = "18")]
+ Cher,
+ #[strum(serialize = "CP")]
+ Clipperton,
+ #[strum(serialize = "19")]
+ Correze,
+ #[strum(serialize = "20R")]
+ Corse,
+ #[strum(serialize = "2A")]
+ CorseDuSud,
+ #[strum(serialize = "21")]
+ CoteDor,
+ #[strum(serialize = "22")]
+ CotesDarmor,
+ #[strum(serialize = "23")]
+ Creuse,
+ #[strum(serialize = "79")]
+ DeuxSevres,
+ #[strum(serialize = "24")]
+ Dordogne,
+ #[strum(serialize = "25")]
+ Doubs,
+ #[strum(serialize = "26")]
+ Drome,
+ #[strum(serialize = "91")]
+ Essonne,
+ #[strum(serialize = "27")]
+ Eure,
+ #[strum(serialize = "28")]
+ EureEtLoir,
+ #[strum(serialize = "29")]
+ Finistere,
+ #[strum(serialize = "973")]
FrenchGuiana,
#[strum(serialize = "PF")]
FrenchPolynesia,
+ #[strum(serialize = "TF")]
+ FrenchSouthernAndAntarcticLands,
+ #[strum(serialize = "30")]
+ Gard,
+ #[strum(serialize = "32")]
+ Gers,
+ #[strum(serialize = "33")]
+ Gironde,
#[strum(serialize = "GES")]
GrandEst,
- #[strum(serialize = "GP")]
+ #[strum(serialize = "971")]
Guadeloupe,
+ #[strum(serialize = "68")]
+ HautRhin,
+ #[strum(serialize = "2B")]
+ HauteCorse,
+ #[strum(serialize = "31")]
+ HauteGaronne,
+ #[strum(serialize = "43")]
+ HauteLoire,
+ #[strum(serialize = "52")]
+ HauteMarne,
+ #[strum(serialize = "70")]
+ HauteSaone,
+ #[strum(serialize = "74")]
+ HauteSavoie,
+ #[strum(serialize = "87")]
+ HauteVienne,
+ #[strum(serialize = "05")]
+ HautesAlpes,
+ #[strum(serialize = "65")]
+ HautesPyrenees,
#[strum(serialize = "HDF")]
HautsDeFrance,
- #[strum(serialize = "K")]
- LanguedocRoussillon,
- #[strum(serialize = "L")]
- Limousin,
- #[strum(serialize = "M")]
- Lorraine,
- #[strum(serialize = "P")]
- LowerNormandy,
- #[strum(serialize = "MQ")]
+ #[strum(serialize = "92")]
+ HautsDeSeine,
+ #[strum(serialize = "34")]
+ Herault,
+ #[strum(serialize = "IDF")]
+ IleDeFrance,
+ #[strum(serialize = "35")]
+ IlleEtVilaine,
+ #[strum(serialize = "36")]
+ Indre,
+ #[strum(serialize = "37")]
+ IndreEtLoire,
+ #[strum(serialize = "38")]
+ Isere,
+ #[strum(serialize = "39")]
+ Jura,
+ #[strum(serialize = "974")]
+ LaReunion,
+ #[strum(serialize = "40")]
+ Landes,
+ #[strum(serialize = "41")]
+ LoirEtCher,
+ #[strum(serialize = "42")]
+ Loire,
+ #[strum(serialize = "44")]
+ LoireAtlantique,
+ #[strum(serialize = "45")]
+ Loiret,
+ #[strum(serialize = "46")]
+ Lot,
+ #[strum(serialize = "47")]
+ LotEtGaronne,
+ #[strum(serialize = "48")]
+ Lozere,
+ #[strum(serialize = "49")]
+ MaineEtLoire,
+ #[strum(serialize = "50")]
+ Manche,
+ #[strum(serialize = "51")]
+ Marne,
+ #[strum(serialize = "972")]
Martinique,
- #[strum(serialize = "YT")]
+ #[strum(serialize = "53")]
+ Mayenne,
+ #[strum(serialize = "976")]
Mayotte,
- #[strum(serialize = "O")]
- NordPasDeCalais,
+ #[strum(serialize = "69M")]
+ MetropoleDeLyon,
+ #[strum(serialize = "54")]
+ MeurtheEtMoselle,
+ #[strum(serialize = "55")]
+ Meuse,
+ #[strum(serialize = "56")]
+ Morbihan,
+ #[strum(serialize = "57")]
+ Moselle,
+ #[strum(serialize = "58")]
+ Nievre,
+ #[strum(serialize = "59")]
+ Nord,
#[strum(serialize = "NOR")]
- Normandy,
+ Normandie,
#[strum(serialize = "NAQ")]
NouvelleAquitaine,
#[strum(serialize = "OCC")]
- Occitania,
- #[strum(serialize = "75")]
+ Occitanie,
+ #[strum(serialize = "60")]
+ Oise,
+ #[strum(serialize = "61")]
+ Orne,
+ #[strum(serialize = "75C")]
Paris,
+ #[strum(serialize = "62")]
+ PasDeCalais,
#[strum(serialize = "PDL")]
PaysDeLaLoire,
- #[strum(serialize = "S")]
- Picardy,
- #[strum(serialize = "T")]
- PoitouCharentes,
#[strum(serialize = "PAC")]
- ProvenceAlpesCoteDAzur,
- #[strum(serialize = "V")]
- RhoneAlpes,
- #[strum(serialize = "RE")]
- Reunion,
+ ProvenceAlpesCoteDazur,
+ #[strum(serialize = "63")]
+ PuyDeDome,
+ #[strum(serialize = "64")]
+ PyreneesAtlantiques,
+ #[strum(serialize = "66")]
+ PyreneesOrientales,
+ #[strum(serialize = "69")]
+ Rhone,
+ #[strum(serialize = "PM")]
+ SaintPierreAndMiquelon,
#[strum(serialize = "BL")]
SaintBarthelemy,
#[strum(serialize = "MF")]
SaintMartin,
- #[strum(serialize = "PM")]
- SaintPierreAndMiquelon,
- #[strum(serialize = "WF-SG")]
- Sigave,
- #[strum(serialize = "Q")]
- UpperNormandy,
- #[strum(serialize = "WF-UV")]
- Uvea,
+ #[strum(serialize = "71")]
+ SaoneEtLoire,
+ #[strum(serialize = "72")]
+ Sarthe,
+ #[strum(serialize = "73")]
+ Savoie,
+ #[strum(serialize = "77")]
+ SeineEtMarne,
+ #[strum(serialize = "76")]
+ SeineMaritime,
+ #[strum(serialize = "93")]
+ SeineSaintDenis,
+ #[strum(serialize = "80")]
+ Somme,
+ #[strum(serialize = "81")]
+ Tarn,
+ #[strum(serialize = "82")]
+ TarnEtGaronne,
+ #[strum(serialize = "90")]
+ TerritoireDeBelfort,
+ #[strum(serialize = "95")]
+ ValDoise,
+ #[strum(serialize = "94")]
+ ValDeMarne,
+ #[strum(serialize = "83")]
+ Var,
+ #[strum(serialize = "84")]
+ Vaucluse,
+ #[strum(serialize = "85")]
+ Vendee,
+ #[strum(serialize = "86")]
+ Vienne,
+ #[strum(serialize = "88")]
+ Vosges,
#[strum(serialize = "WF")]
WallisAndFutuna,
- #[strum(serialize = "IDF")]
- IleDeFrance,
+ #[strum(serialize = "89")]
+ Yonne,
+ #[strum(serialize = "78")]
+ Yvelines,
}
#[derive(
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display, strum::EnumString,
)]
pub enum GermanyStatesAbbreviation {
- #[strum(serialize = "BW")]
- BadenWurttemberg,
- #[strum(serialize = "BY")]
- Bavaria,
- #[strum(serialize = "BE")]
- Berlin,
- #[strum(serialize = "BB")]
- Brandenburg,
- #[strum(serialize = "HB")]
- Bremen,
- #[strum(serialize = "HH")]
- Hamburg,
- #[strum(serialize = "HE")]
- Hesse,
- #[strum(serialize = "NI")]
- LowerSaxony,
- #[strum(serialize = "MV")]
- MecklenburgVorpommern,
- #[strum(serialize = "NW")]
- NorthRhineWestphalia,
- #[strum(serialize = "RP")]
- RhinelandPalatinate,
- #[strum(serialize = "SL")]
- Saarland,
- #[strum(serialize = "SN")]
- Saxony,
- #[strum(serialize = "ST")]
- SaxonyAnhalt,
- #[strum(serialize = "SH")]
- SchleswigHolstein,
- #[strum(serialize = "TH")]
- Thuringia,
+ BW,
+ BY,
+ BE,
+ BB,
+ HB,
+ HH,
+ HE,
+ NI,
+ MV,
+ NW,
+ RP,
+ SL,
+ SN,
+ ST,
+ SH,
+ TH,
}
#[derive(
@@ -3802,7 +3948,7 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "04")]
Birkirkara,
#[strum(serialize = "05")]
- Birzebbuga,
+ Birżebbuġa,
#[strum(serialize = "06")]
Cospicua,
#[strum(serialize = "07")]
@@ -3816,19 +3962,19 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "11")]
Gudja,
#[strum(serialize = "12")]
- Gzira,
+ Gżira,
#[strum(serialize = "13")]
- Ghajnsielem,
+ Għajnsielem,
#[strum(serialize = "14")]
- Gharb,
+ Għarb,
#[strum(serialize = "15")]
- Gharghur,
+ Għargħur,
#[strum(serialize = "16")]
- Ghasri,
+ Għasri,
#[strum(serialize = "17")]
- Ghaxaq,
+ Għaxaq,
#[strum(serialize = "18")]
- Hamrun,
+ Ħamrun,
#[strum(serialize = "19")]
Iklin,
#[strum(serialize = "20")]
@@ -3836,7 +3982,7 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "21")]
Kalkara,
#[strum(serialize = "22")]
- Kercem,
+ Kerċem,
#[strum(serialize = "23")]
Kirkop,
#[strum(serialize = "24")]
@@ -3852,9 +3998,9 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "29")]
Mdina,
#[strum(serialize = "30")]
- Mellieha,
+ Mellieħa,
#[strum(serialize = "31")]
- Mgarr,
+ Mġarr,
#[strum(serialize = "32")]
Mosta,
#[strum(serialize = "33")]
@@ -3874,7 +4020,7 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "40")]
Pembroke,
#[strum(serialize = "41")]
- Pieta,
+ Pietà,
#[strum(serialize = "42")]
Qala,
#[strum(serialize = "43")]
@@ -3888,7 +4034,7 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "48")]
StJulians,
#[strum(serialize = "49")]
- SanGwann,
+ SanĠwann,
#[strum(serialize = "50")]
SaintLawrence,
#[strum(serialize = "51")]
@@ -3896,11 +4042,11 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "52")]
Sannat,
#[strum(serialize = "53")]
- SantaLucija,
+ SantaLuċija,
#[strum(serialize = "54")]
SantaVenera,
#[strum(serialize = "55")]
- Siggiewi,
+ Siġġiewi,
#[strum(serialize = "56")]
Sliema,
#[strum(serialize = "57")]
@@ -3912,21 +4058,21 @@ pub enum MaltaStatesAbbreviation {
#[strum(serialize = "60")]
Valletta,
#[strum(serialize = "61")]
- Xaghra,
+ Xagħra,
#[strum(serialize = "62")]
Xewkija,
#[strum(serialize = "63")]
- Xghajra,
+ Xgħajra,
#[strum(serialize = "64")]
- Zabbar,
+ Żabbar,
#[strum(serialize = "65")]
- ZebbugGozo,
+ ŻebbuġGozo,
#[strum(serialize = "66")]
- ZebbugMalta,
+ ŻebbuġMalta,
#[strum(serialize = "67")]
- Zejtun,
+ Żejtun,
#[strum(serialize = "68")]
- Zurrieq,
+ Żurrieq,
}
#[derive(
@@ -3942,69 +4088,69 @@ pub enum MoldovaStatesAbbreviation {
#[strum(serialize = "BR")]
BriceniDistrict,
#[strum(serialize = "BA")]
- BaltiMunicipality,
+ BălțiMunicipality,
#[strum(serialize = "CA")]
CahulDistrict,
#[strum(serialize = "CT")]
CantemirDistrict,
#[strum(serialize = "CU")]
- ChisinauMunicipality,
+ ChișinăuMunicipality,
#[strum(serialize = "CM")]
- CimisliaDistrict,
+ CimișliaDistrict,
#[strum(serialize = "CR")]
CriuleniDistrict,
#[strum(serialize = "CL")]
- CalarasiDistrict,
+ CălărașiDistrict,
#[strum(serialize = "CS")]
- CauseniDistrict,
+ CăușeniDistrict,
#[strum(serialize = "DO")]
- DonduseniDistrict,
+ DondușeniDistrict,
#[strum(serialize = "DR")]
DrochiaDistrict,
#[strum(serialize = "DU")]
- DubasariDistrict,
+ DubăsariDistrict,
#[strum(serialize = "ED")]
- EdinetDistrict,
+ EdinețDistrict,
#[strum(serialize = "FL")]
- FlorestiDistrict,
+ FloreștiDistrict,
#[strum(serialize = "FA")]
- FalestiDistrict,
+ FăleștiDistrict,
#[strum(serialize = "GA")]
- Gagauzia,
+ Găgăuzia,
#[strum(serialize = "GL")]
GlodeniDistrict,
#[strum(serialize = "HI")]
- HincestiDistrict,
+ HînceștiDistrict,
#[strum(serialize = "IA")]
IaloveniDistrict,
#[strum(serialize = "NI")]
NisporeniDistrict,
#[strum(serialize = "OC")]
- OcnitaDistrict,
+ OcnițaDistrict,
#[strum(serialize = "OR")]
OrheiDistrict,
#[strum(serialize = "RE")]
RezinaDistrict,
#[strum(serialize = "RI")]
- RiscaniDistrict,
+ RîșcaniDistrict,
#[strum(serialize = "SO")]
SorocaDistrict,
#[strum(serialize = "ST")]
- StraseniDistrict,
+ StrășeniDistrict,
#[strum(serialize = "SI")]
- SingereiDistrict,
+ SîngereiDistrict,
#[strum(serialize = "TA")]
TaracliaDistrict,
#[strum(serialize = "TE")]
- TelenestiDistrict,
+ TeleneștiDistrict,
#[strum(serialize = "SN")]
TransnistriaAutonomousTerritorialUnit,
#[strum(serialize = "UN")]
UngheniDistrict,
#[strum(serialize = "SD")]
- SoldanestiDistrict,
+ ȘoldăneștiDistrict,
#[strum(serialize = "SV")]
- StefanVodaDistrict,
+ ȘtefanVodăDistrict,
}
#[derive(
@@ -4049,11 +4195,11 @@ pub enum MontenegroStatesAbbreviation {
#[strum(serialize = "14")]
PljevljaMunicipality,
#[strum(serialize = "15")]
- PluzineMunicipality,
+ PlužineMunicipality,
#[strum(serialize = "16")]
PodgoricaMunicipality,
#[strum(serialize = "17")]
- RozajeMunicipality,
+ RožajeMunicipality,
#[strum(serialize = "19")]
TivatMunicipality,
#[strum(serialize = "20")]
@@ -4061,7 +4207,7 @@ pub enum MontenegroStatesAbbreviation {
#[strum(serialize = "18")]
SavnikMunicipality,
#[strum(serialize = "21")]
- ZabljakMunicipality,
+ ŽabljakMunicipality,
}
#[derive(
@@ -4211,7 +4357,7 @@ pub enum NorthMacedoniaStatesAbbreviation {
#[strum(serialize = "62")]
PrilepMunicipality,
#[strum(serialize = "63")]
- ProbistipMunicipality,
+ ProbishtipMunicipality,
#[strum(serialize = "64")]
RadovisMunicipality,
#[strum(serialize = "65")]
@@ -4269,7 +4415,7 @@ pub enum NorthMacedoniaStatesAbbreviation {
#[strum(serialize = "83")]
StipMunicipality,
#[strum(serialize = "84")]
- SutoOrizariMunicipality,
+ ShutoOrizariMunicipality,
#[strum(serialize = "30")]
ZelinoMunicipality,
}
@@ -4326,40 +4472,38 @@ pub enum NorwayStatesAbbreviation {
Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display, strum::EnumString,
)]
pub enum PolandStatesAbbreviation {
- #[strum(serialize = "WP")]
- GreaterPolandVoivodeship,
- #[strum(serialize = "KI")]
- Kielce,
- #[strum(serialize = "KP")]
- KuyavianPomeranianVoivodeship,
- #[strum(serialize = "MA")]
- LesserPolandVoivodeship,
- #[strum(serialize = "DS")]
- LowerSilesianVoivodeship,
- #[strum(serialize = "LU")]
- LublinVoivodeship,
- #[strum(serialize = "LB")]
- LubuszVoivodeship,
- #[strum(serialize = "MZ")]
- MasovianVoivodeship,
- #[strum(serialize = "OP")]
- OpoleVoivodeship,
- #[strum(serialize = "PK")]
- PodkarpackieVoivodeship,
- #[strum(serialize = "PD")]
- PodlaskieVoivodeship,
- #[strum(serialize = "PM")]
- PomeranianVoivodeship,
- #[strum(serialize = "SL")]
- SilesianVoivodeship,
- #[strum(serialize = "WN")]
- WarmianMasurianVoivodeship,
- #[strum(serialize = "ZP")]
- WestPomeranianVoivodeship,
- #[strum(serialize = "LD")]
- LodzVoivodeship,
- #[strum(serialize = "SK")]
- SwietokrzyskieVoivodeship,
+ #[strum(serialize = "30")]
+ GreaterPoland,
+ #[strum(serialize = "26")]
+ HolyCross,
+ #[strum(serialize = "04")]
+ KuyaviaPomerania,
+ #[strum(serialize = "12")]
+ LesserPoland,
+ #[strum(serialize = "02")]
+ LowerSilesia,
+ #[strum(serialize = "06")]
+ Lublin,
+ #[strum(serialize = "08")]
+ Lubusz,
+ #[strum(serialize = "10")]
+ Łódź,
+ #[strum(serialize = "14")]
+ Mazovia,
+ #[strum(serialize = "20")]
+ Podlaskie,
+ #[strum(serialize = "22")]
+ Pomerania,
+ #[strum(serialize = "24")]
+ Silesia,
+ #[strum(serialize = "18")]
+ Subcarpathia,
+ #[strum(serialize = "16")]
+ UpperSilesia,
+ #[strum(serialize = "28")]
+ WarmiaMasuria,
+ #[strum(serialize = "32")]
+ WestPomerania,
}
#[derive(
@@ -4603,23 +4747,33 @@ pub enum SwitzerlandStatesAbbreviation {
)]
pub enum UnitedKingdomStatesAbbreviation {
#[strum(serialize = "ABE")]
- AberdeenCity,
+ Aberdeen,
#[strum(serialize = "ABD")]
Aberdeenshire,
#[strum(serialize = "ANS")]
Angus,
+ #[strum(serialize = "ANT")]
+ Antrim,
#[strum(serialize = "ANN")]
AntrimAndNewtownabbey,
+ #[strum(serialize = "ARD")]
+ Ards,
#[strum(serialize = "AND")]
ArdsAndNorthDown,
#[strum(serialize = "AGB")]
ArgyllAndBute,
+ #[strum(serialize = "ARM")]
+ ArmaghCityAndDistrictCouncil,
#[strum(serialize = "ABC")]
- ArmaghCityBanbridgeAndCraigavon,
- #[strum(serialize = "BDG")]
- BarkingAndDagenham,
- #[strum(serialize = "BNE")]
- Barnet,
+ ArmaghBanbridgeAndCraigavon,
+ #[strum(serialize = "SH-AC")]
+ AscensionIsland,
+ #[strum(serialize = "BLA")]
+ BallymenaBorough,
+ #[strum(serialize = "BLY")]
+ Ballymoney,
+ #[strum(serialize = "BNB")]
+ Banbridge,
#[strum(serialize = "BNS")]
Barnsley,
#[strum(serialize = "BAS")]
@@ -4627,9 +4781,7 @@ pub enum UnitedKingdomStatesAbbreviation {
#[strum(serialize = "BDF")]
Bedford,
#[strum(serialize = "BFS")]
- BelfastCity,
- #[strum(serialize = "BEX")]
- Bexley,
+ BelfastDistrict,
#[strum(serialize = "BIR")]
Birmingham,
#[strum(serialize = "BBD")]
@@ -4637,41 +4789,35 @@ pub enum UnitedKingdomStatesAbbreviation {
#[strum(serialize = "BPL")]
Blackpool,
#[strum(serialize = "BGW")]
- BlaenauGwent,
+ BlaenauGwentCountyBorough,
#[strum(serialize = "BOL")]
Bolton,
- #[strum(serialize = "BCP")]
- BournemouthChristchurchAndPoole,
+ #[strum(serialize = "BMH")]
+ Bournemouth,
#[strum(serialize = "BRC")]
BracknellForest,
#[strum(serialize = "BRD")]
Bradford,
- #[strum(serialize = "BEN")]
- Brent,
#[strum(serialize = "BGE")]
- Bridgend,
+ BridgendCountyBorough,
#[strum(serialize = "BNH")]
BrightonAndHove,
- #[strum(serialize = "BST")]
- BristolCityOf,
- #[strum(serialize = "BRY")]
- Bromley,
#[strum(serialize = "BKM")]
Buckinghamshire,
#[strum(serialize = "BUR")]
Bury,
#[strum(serialize = "CAY")]
- Caerphilly,
+ CaerphillyCountyBorough,
#[strum(serialize = "CLD")]
Calderdale,
#[strum(serialize = "CAM")]
Cambridgeshire,
- #[strum(serialize = "CMD")]
- Camden,
- #[strum(serialize = "CRF")]
- Cardiff,
#[strum(serialize = "CMN")]
Carmarthenshire,
+ #[strum(serialize = "CKF")]
+ CarrickfergusBoroughCouncil,
+ #[strum(serialize = "CSR")]
+ Castlereagh,
#[strum(serialize = "CCG")]
CausewayCoastAndGlens,
#[strum(serialize = "CBF")]
@@ -4682,44 +4828,84 @@ pub enum UnitedKingdomStatesAbbreviation {
CheshireEast,
#[strum(serialize = "CHW")]
CheshireWestAndChester,
+ #[strum(serialize = "CRF")]
+ CityAndCountyOfCardiff,
+ #[strum(serialize = "SWA")]
+ CityAndCountyOfSwansea,
+ #[strum(serialize = "BST")]
+ CityOfBristol,
+ #[strum(serialize = "DER")]
+ CityOfDerby,
+ #[strum(serialize = "KHL")]
+ CityOfKingstonUponHull,
+ #[strum(serialize = "LCE")]
+ CityOfLeicester,
+ #[strum(serialize = "LND")]
+ CityOfLondon,
+ #[strum(serialize = "NGM")]
+ CityOfNottingham,
+ #[strum(serialize = "PTE")]
+ CityOfPeterborough,
+ #[strum(serialize = "PLY")]
+ CityOfPlymouth,
+ #[strum(serialize = "POR")]
+ CityOfPortsmouth,
+ #[strum(serialize = "STH")]
+ CityOfSouthampton,
+ #[strum(serialize = "STE")]
+ CityOfStokeOnTrent,
+ #[strum(serialize = "SND")]
+ CityOfSunderland,
+ #[strum(serialize = "WSM")]
+ CityOfWestminster,
+ #[strum(serialize = "WLV")]
+ CityOfWolverhampton,
+ #[strum(serialize = "YOR")]
+ CityOfYork,
#[strum(serialize = "CLK")]
Clackmannanshire,
+ #[strum(serialize = "CLR")]
+ ColeraineBoroughCouncil,
#[strum(serialize = "CWY")]
- Conwy,
+ ConwyCountyBorough,
+ #[strum(serialize = "CKT")]
+ CookstownDistrictCouncil,
#[strum(serialize = "CON")]
Cornwall,
+ #[strum(serialize = "DUR")]
+ CountyDurham,
#[strum(serialize = "COV")]
Coventry,
- #[strum(serialize = "CRY")]
- Croydon,
+ #[strum(serialize = "CGV")]
+ CraigavonBoroughCouncil,
#[strum(serialize = "CMA")]
Cumbria,
#[strum(serialize = "DAL")]
Darlington,
#[strum(serialize = "DEN")]
Denbighshire,
- #[strum(serialize = "DER")]
- Derby,
#[strum(serialize = "DBY")]
Derbyshire,
#[strum(serialize = "DRS")]
- DerryAndStrabane,
+ DerryCityAndStrabane,
+ #[strum(serialize = "DRY")]
+ DerryCityCouncil,
#[strum(serialize = "DEV")]
Devon,
#[strum(serialize = "DNC")]
Doncaster,
#[strum(serialize = "DOR")]
Dorset,
+ #[strum(serialize = "DOW")]
+ DownDistrictCouncil,
#[strum(serialize = "DUD")]
Dudley,
#[strum(serialize = "DGY")]
DumfriesAndGalloway,
#[strum(serialize = "DND")]
- DundeeCity,
- #[strum(serialize = "DUR")]
- DurhamCounty,
- #[strum(serialize = "EAL")]
- Ealing,
+ Dundee,
+ #[strum(serialize = "DGN")]
+ DungannonAndSouthTyroneBoroughCouncil,
#[strum(serialize = "EAY")]
EastAyrshire,
#[strum(serialize = "EDU")]
@@ -4733,17 +4919,17 @@ pub enum UnitedKingdomStatesAbbreviation {
#[strum(serialize = "ESX")]
EastSussex,
#[strum(serialize = "EDH")]
- EdinburghCityOf,
- #[strum(serialize = "ELS")]
- EileanSiar,
- #[strum(serialize = "ENF")]
- Enfield,
+ Edinburgh,
+ #[strum(serialize = "ENG")]
+ England,
#[strum(serialize = "ESS")]
Essex,
#[strum(serialize = "FAL")]
Falkirk,
#[strum(serialize = "FMO")]
FermanaghAndOmagh,
+ #[strum(serialize = "FER")]
+ FermanaghDistrictCouncil,
#[strum(serialize = "FIF")]
Fife,
#[strum(serialize = "FLN")]
@@ -4751,91 +4937,119 @@ pub enum UnitedKingdomStatesAbbreviation {
#[strum(serialize = "GAT")]
Gateshead,
#[strum(serialize = "GLG")]
- GlasgowCity,
+ Glasgow,
#[strum(serialize = "GLS")]
Gloucestershire,
- #[strum(serialize = "GRE")]
- Greenwich,
#[strum(serialize = "GWN")]
Gwynedd,
- #[strum(serialize = "HCK")]
- Hackney,
#[strum(serialize = "HAL")]
Halton,
- #[strum(serialize = "HMF")]
- HammersmithAndFulham,
#[strum(serialize = "HAM")]
Hampshire,
- #[strum(serialize = "HRY")]
- Haringey,
- #[strum(serialize = "HRW")]
- Harrow,
#[strum(serialize = "HPL")]
Hartlepool,
- #[strum(serialize = "HAV")]
- Havering,
#[strum(serialize = "HEF")]
Herefordshire,
#[strum(serialize = "HRT")]
Hertfordshire,
#[strum(serialize = "HLD")]
Highland,
- #[strum(serialize = "HIL")]
- Hillingdon,
- #[strum(serialize = "HNS")]
- Hounslow,
#[strum(serialize = "IVC")]
Inverclyde,
- #[strum(serialize = "AGY")]
- IsleOfAnglesey,
#[strum(serialize = "IOW")]
IsleOfWight,
#[strum(serialize = "IOS")]
IslesOfScilly,
- #[strum(serialize = "ISL")]
- Islington,
- #[strum(serialize = "KEC")]
- KensingtonAndChelsea,
#[strum(serialize = "KEN")]
Kent,
- #[strum(serialize = "KHL")]
- KingstonUponHull,
- #[strum(serialize = "KTT")]
- KingstonUponThames,
#[strum(serialize = "KIR")]
Kirklees,
#[strum(serialize = "KWL")]
Knowsley,
- #[strum(serialize = "LBH")]
- Lambeth,
#[strum(serialize = "LAN")]
Lancashire,
+ #[strum(serialize = "LRN")]
+ LarneBoroughCouncil,
#[strum(serialize = "LDS")]
Leeds,
- #[strum(serialize = "LCE")]
- Leicester,
#[strum(serialize = "LEC")]
Leicestershire,
- #[strum(serialize = "LEW")]
- Lewisham,
+ #[strum(serialize = "LMV")]
+ LimavadyBoroughCouncil,
#[strum(serialize = "LIN")]
Lincolnshire,
#[strum(serialize = "LBC")]
LisburnAndCastlereagh,
+ #[strum(serialize = "LSB")]
+ LisburnCityCouncil,
#[strum(serialize = "LIV")]
Liverpool,
- #[strum(serialize = "LND")]
- LondonCityOf,
- #[strum(serialize = "LUT")]
- Luton,
+ #[strum(serialize = "BDG")]
+ LondonBoroughOfBarkingAndDagenham,
+ #[strum(serialize = "BNE")]
+ LondonBoroughOfBarnet,
+ #[strum(serialize = "BEX")]
+ LondonBoroughOfBexley,
+ #[strum(serialize = "BEN")]
+ LondonBoroughOfBrent,
+ #[strum(serialize = "BRY")]
+ LondonBoroughOfBromley,
+ #[strum(serialize = "CMD")]
+ LondonBoroughOfCamden,
+ #[strum(serialize = "CRY")]
+ LondonBoroughOfCroydon,
+ #[strum(serialize = "EAL")]
+ LondonBoroughOfEaling,
+ #[strum(serialize = "ENF")]
+ LondonBoroughOfEnfield,
+ #[strum(serialize = "HCK")]
+ LondonBoroughOfHackney,
+ #[strum(serialize = "HMF")]
+ LondonBoroughOfHammersmithAndFulham,
+ #[strum(serialize = "HRY")]
+ LondonBoroughOfHaringey,
+ #[strum(serialize = "HRW")]
+ LondonBoroughOfHarrow,
+ #[strum(serialize = "HAV")]
+ LondonBoroughOfHavering,
+ #[strum(serialize = "HIL")]
+ LondonBoroughOfHillingdon,
+ #[strum(serialize = "HNS")]
+ LondonBoroughOfHounslow,
+ #[strum(serialize = "ISL")]
+ LondonBoroughOfIslington,
+ #[strum(serialize = "LBH")]
+ LondonBoroughOfLambeth,
+ #[strum(serialize = "LEW")]
+ LondonBoroughOfLewisham,
+ #[strum(serialize = "MRT")]
+ LondonBoroughOfMerton,
+ #[strum(serialize = "NWM")]
+ LondonBoroughOfNewham,
+ #[strum(serialize = "RDB")]
+ LondonBoroughOfRedbridge,
+ #[strum(serialize = "RIC")]
+ LondonBoroughOfRichmondUponThames,
+ #[strum(serialize = "SWK")]
+ LondonBoroughOfSouthwark,
+ #[strum(serialize = "STN")]
+ LondonBoroughOfSutton,
+ #[strum(serialize = "TWH")]
+ LondonBoroughOfTowerHamlets,
+ #[strum(serialize = "WFT")]
+ LondonBoroughOfWalthamForest,
+ #[strum(serialize = "WND")]
+ LondonBoroughOfWandsworth,
+ #[strum(serialize = "MFT")]
+ MagherafeltDistrictCouncil,
#[strum(serialize = "MAN")]
Manchester,
#[strum(serialize = "MDW")]
Medway,
#[strum(serialize = "MTY")]
- MerthyrTydfil,
- #[strum(serialize = "MRT")]
- Merton,
+ MerthyrTydfilCountyBorough,
+ #[strum(serialize = "WGN")]
+ MetropolitanBoroughOfWigan,
#[strum(serialize = "MEA")]
MidAndEastAntrim,
#[strum(serialize = "MUL")]
@@ -4850,20 +5064,26 @@ pub enum UnitedKingdomStatesAbbreviation {
Monmouthshire,
#[strum(serialize = "MRY")]
Moray,
+ #[strum(serialize = "MYL")]
+ MoyleDistrictCouncil,
#[strum(serialize = "NTL")]
- NeathPortTalbot,
+ NeathPortTalbotCountyBorough,
#[strum(serialize = "NET")]
NewcastleUponTyne,
- #[strum(serialize = "NWM")]
- Newham,
#[strum(serialize = "NWP")]
Newport,
+ #[strum(serialize = "NYM")]
+ NewryAndMourneDistrictCouncil,
#[strum(serialize = "NMD")]
NewryMourneAndDown,
+ #[strum(serialize = "NTA")]
+ NewtownabbeyBoroughCouncil,
#[strum(serialize = "NFK")]
Norfolk,
#[strum(serialize = "NAY")]
NorthAyrshire,
+ #[strum(serialize = "NDN")]
+ NorthDownBoroughCouncil,
#[strum(serialize = "NEL")]
NorthEastLincolnshire,
#[strum(serialize = "NLK")]
@@ -4878,52 +5098,58 @@ pub enum UnitedKingdomStatesAbbreviation {
NorthYorkshire,
#[strum(serialize = "NTH")]
Northamptonshire,
+ #[strum(serialize = "NIR")]
+ NorthernIreland,
#[strum(serialize = "NBL")]
Northumberland,
- #[strum(serialize = "NGM")]
- Nottingham,
#[strum(serialize = "NTT")]
Nottinghamshire,
#[strum(serialize = "OLD")]
Oldham,
+ #[strum(serialize = "OMH")]
+ OmaghDistrictCouncil,
#[strum(serialize = "ORK")]
OrkneyIslands,
+ #[strum(serialize = "ELS")]
+ OuterHebrides,
#[strum(serialize = "OXF")]
Oxfordshire,
#[strum(serialize = "PEM")]
Pembrokeshire,
#[strum(serialize = "PKN")]
PerthAndKinross,
- #[strum(serialize = "PTE")]
- Peterborough,
- #[strum(serialize = "PLY")]
- Plymouth,
- #[strum(serialize = "POR")]
- Portsmouth,
+ #[strum(serialize = "POL")]
+ Poole,
#[strum(serialize = "POW")]
Powys,
#[strum(serialize = "RDG")]
Reading,
- #[strum(serialize = "RDB")]
- Redbridge,
#[strum(serialize = "RCC")]
RedcarAndCleveland,
#[strum(serialize = "RFW")]
Renfrewshire,
#[strum(serialize = "RCT")]
- RhonddaCynonTaff,
- #[strum(serialize = "RIC")]
- RichmondUponThames,
+ RhonddaCynonTaf,
#[strum(serialize = "RCH")]
Rochdale,
#[strum(serialize = "ROT")]
Rotherham,
+ #[strum(serialize = "GRE")]
+ RoyalBoroughOfGreenwich,
+ #[strum(serialize = "KEC")]
+ RoyalBoroughOfKensingtonAndChelsea,
+ #[strum(serialize = "KTT")]
+ RoyalBoroughOfKingstonUponThames,
#[strum(serialize = "RUT")]
Rutland,
+ #[strum(serialize = "SH-HL")]
+ SaintHelena,
#[strum(serialize = "SLF")]
Salford,
#[strum(serialize = "SAW")]
Sandwell,
+ #[strum(serialize = "SCT")]
+ Scotland,
#[strum(serialize = "SCB")]
ScottishBorders,
#[strum(serialize = "SFT")]
@@ -4948,12 +5174,8 @@ pub enum UnitedKingdomStatesAbbreviation {
SouthLanarkshire,
#[strum(serialize = "STY")]
SouthTyneside,
- #[strum(serialize = "STH")]
- Southampton,
#[strum(serialize = "SOS")]
SouthendOnSea,
- #[strum(serialize = "SWK")]
- Southwark,
#[strum(serialize = "SHN")]
StHelens,
#[strum(serialize = "STS")]
@@ -4964,18 +5186,12 @@ pub enum UnitedKingdomStatesAbbreviation {
Stockport,
#[strum(serialize = "STT")]
StocktonOnTees,
- #[strum(serialize = "STE")]
- StokeOnTrent,
+ #[strum(serialize = "STB")]
+ StrabaneDistrictCouncil,
#[strum(serialize = "SFK")]
Suffolk,
- #[strum(serialize = "SND")]
- Sunderland,
#[strum(serialize = "SRY")]
Surrey,
- #[strum(serialize = "STN")]
- Sutton,
- #[strum(serialize = "SWA")]
- Swansea,
#[strum(serialize = "SWD")]
Swindon,
#[strum(serialize = "TAM")]
@@ -4988,20 +5204,18 @@ pub enum UnitedKingdomStatesAbbreviation {
Torbay,
#[strum(serialize = "TOF")]
Torfaen,
- #[strum(serialize = "TWH")]
- TowerHamlets,
#[strum(serialize = "TRF")]
Trafford,
+ #[strum(serialize = "UKM")]
+ UnitedKingdom,
#[strum(serialize = "VGL")]
ValeOfGlamorgan,
#[strum(serialize = "WKF")]
Wakefield,
+ #[strum(serialize = "WLS")]
+ Wales,
#[strum(serialize = "WLL")]
Walsall,
- #[strum(serialize = "WFT")]
- WalthamForest,
- #[strum(serialize = "WND")]
- Wandsworth,
#[strum(serialize = "WRT")]
Warrington,
#[strum(serialize = "WAR")]
@@ -5014,10 +5228,6 @@ pub enum UnitedKingdomStatesAbbreviation {
WestLothian,
#[strum(serialize = "WSX")]
WestSussex,
- #[strum(serialize = "WSM")]
- Westminster,
- #[strum(serialize = "WGN")]
- Wigan,
#[strum(serialize = "WIL")]
Wiltshire,
#[strum(serialize = "WNM")]
@@ -5026,14 +5236,10 @@ pub enum UnitedKingdomStatesAbbreviation {
Wirral,
#[strum(serialize = "WOK")]
Wokingham,
- #[strum(serialize = "WLV")]
- Wolverhampton,
#[strum(serialize = "WOR")]
Worcestershire,
#[strum(serialize = "WRX")]
- Wrexham,
- #[strum(serialize = "YOR")]
- York,
+ WrexhamCountyBorough,
}
#[derive(
@@ -5517,6 +5723,320 @@ pub enum SloveniaStatesAbbreviation {
Jesenice,
#[strum(serialize = "163")]
Jezersko,
+ #[strum(serialize = "042")]
+ Jursinci,
+ #[strum(serialize = "043")]
+ Kamnik,
+ #[strum(serialize = "044")]
+ KanalObSoci,
+ #[strum(serialize = "045")]
+ Kidricevo,
+ #[strum(serialize = "046")]
+ Kobarid,
+ #[strum(serialize = "047")]
+ Kobilje,
+ #[strum(serialize = "049")]
+ Komen,
+ #[strum(serialize = "164")]
+ Komenda,
+ #[strum(serialize = "050")]
+ Koper,
+ #[strum(serialize = "197")]
+ KostanjevicaNaKrki,
+ #[strum(serialize = "165")]
+ Kostel,
+ #[strum(serialize = "051")]
+ Kozje,
+ #[strum(serialize = "048")]
+ Kocevje,
+ #[strum(serialize = "052")]
+ Kranj,
+ #[strum(serialize = "053")]
+ KranjskaGora,
+ #[strum(serialize = "166")]
+ Krizevci,
+ #[strum(serialize = "055")]
+ Kungota,
+ #[strum(serialize = "056")]
+ Kuzma,
+ #[strum(serialize = "057")]
+ Lasko,
+ #[strum(serialize = "058")]
+ Lenart,
+ #[strum(serialize = "059")]
+ Lendava,
+ #[strum(serialize = "060")]
+ Litija,
+ #[strum(serialize = "061")]
+ Ljubljana,
+ #[strum(serialize = "062")]
+ Ljubno,
+ #[strum(serialize = "063")]
+ Ljutomer,
+ #[strum(serialize = "064")]
+ Logatec,
+ #[strum(serialize = "208")]
+ LogDragomer,
+ #[strum(serialize = "167")]
+ LovrencNaPohorju,
+ #[strum(serialize = "065")]
+ LoskaDolina,
+ #[strum(serialize = "066")]
+ LoskiPotok,
+ #[strum(serialize = "068")]
+ Lukovica,
+ #[strum(serialize = "067")]
+ Luče,
+ #[strum(serialize = "069")]
+ Majsperk,
+ #[strum(serialize = "198")]
+ Makole,
+ #[strum(serialize = "070")]
+ Maribor,
+ #[strum(serialize = "168")]
+ Markovci,
+ #[strum(serialize = "071")]
+ Medvode,
+ #[strum(serialize = "072")]
+ Menges,
+ #[strum(serialize = "073")]
+ Metlika,
+ #[strum(serialize = "074")]
+ Mezica,
+ #[strum(serialize = "169")]
+ MiklavzNaDravskemPolju,
+ #[strum(serialize = "075")]
+ MirenKostanjevica,
+ #[strum(serialize = "212")]
+ Mirna,
+ #[strum(serialize = "170")]
+ MirnaPec,
+ #[strum(serialize = "076")]
+ Mislinja,
+ #[strum(serialize = "199")]
+ MokronogTrebelno,
+ #[strum(serialize = "078")]
+ MoravskeToplice,
+ #[strum(serialize = "077")]
+ Moravce,
+ #[strum(serialize = "079")]
+ Mozirje,
+ #[strum(serialize = "195")]
+ Apače,
+ #[strum(serialize = "196")]
+ Cirkulane,
+ #[strum(serialize = "038")]
+ IlirskaBistrica,
+ #[strum(serialize = "054")]
+ Krsko,
+ #[strum(serialize = "123")]
+ Skofljica,
+ #[strum(serialize = "080")]
+ MurskaSobota,
+ #[strum(serialize = "081")]
+ Muta,
+ #[strum(serialize = "082")]
+ Naklo,
+ #[strum(serialize = "083")]
+ Nazarje,
+ #[strum(serialize = "084")]
+ NovaGorica,
+ #[strum(serialize = "086")]
+ Odranci,
+ #[strum(serialize = "171")]
+ Oplotnica,
+ #[strum(serialize = "087")]
+ Ormoz,
+ #[strum(serialize = "088")]
+ Osilnica,
+ #[strum(serialize = "089")]
+ Pesnica,
+ #[strum(serialize = "090")]
+ Piran,
+ #[strum(serialize = "091")]
+ Pivka,
+ #[strum(serialize = "172")]
+ Podlehnik,
+ #[strum(serialize = "093")]
+ Podvelka,
+ #[strum(serialize = "092")]
+ Podcetrtek,
+ #[strum(serialize = "200")]
+ Poljcane,
+ #[strum(serialize = "173")]
+ Polzela,
+ #[strum(serialize = "094")]
+ Postojna,
+ #[strum(serialize = "174")]
+ Prebold,
+ #[strum(serialize = "095")]
+ Preddvor,
+ #[strum(serialize = "175")]
+ Prevalje,
+ #[strum(serialize = "096")]
+ Ptuj,
+ #[strum(serialize = "097")]
+ Puconci,
+ #[strum(serialize = "100")]
+ Radenci,
+ #[strum(serialize = "099")]
+ Radece,
+ #[strum(serialize = "101")]
+ RadljeObDravi,
+ #[strum(serialize = "102")]
+ Radovljica,
+ #[strum(serialize = "103")]
+ RavneNaKoroskem,
+ #[strum(serialize = "176")]
+ Razkrizje,
+ #[strum(serialize = "098")]
+ RaceFram,
+ #[strum(serialize = "201")]
+ RenčeVogrsko,
+ #[strum(serialize = "209")]
+ RecicaObSavinji,
+ #[strum(serialize = "104")]
+ Ribnica,
+ #[strum(serialize = "177")]
+ RibnicaNaPohorju,
+ #[strum(serialize = "107")]
+ Rogatec,
+ #[strum(serialize = "106")]
+ RogaskaSlatina,
+ #[strum(serialize = "105")]
+ Rogasovci,
+ #[strum(serialize = "108")]
+ Ruse,
+ #[strum(serialize = "178")]
+ SelnicaObDravi,
+ #[strum(serialize = "109")]
+ Semic,
+ #[strum(serialize = "110")]
+ Sevnica,
+ #[strum(serialize = "111")]
+ Sezana,
+ #[strum(serialize = "112")]
+ SlovenjGradec,
+ #[strum(serialize = "113")]
+ SlovenskaBistrica,
+ #[strum(serialize = "114")]
+ SlovenskeKonjice,
+ #[strum(serialize = "179")]
+ Sodrazica,
+ #[strum(serialize = "180")]
+ Solcava,
+ #[strum(serialize = "202")]
+ SredisceObDravi,
+ #[strum(serialize = "115")]
+ Starse,
+ #[strum(serialize = "203")]
+ Straza,
+ #[strum(serialize = "181")]
+ SvetaAna,
+ #[strum(serialize = "204")]
+ SvetaTrojica,
+ #[strum(serialize = "182")]
+ SvetiAndraz,
+ #[strum(serialize = "116")]
+ SvetiJurijObScavnici,
+ #[strum(serialize = "210")]
+ SvetiJurijVSlovenskihGoricah,
+ #[strum(serialize = "205")]
+ SvetiTomaz,
+ #[strum(serialize = "184")]
+ Tabor,
+ #[strum(serialize = "010")]
+ Tišina,
+ #[strum(serialize = "128")]
+ Tolmin,
+ #[strum(serialize = "129")]
+ Trbovlje,
+ #[strum(serialize = "130")]
+ Trebnje,
+ #[strum(serialize = "185")]
+ TrnovskaVas,
+ #[strum(serialize = "186")]
+ Trzin,
+ #[strum(serialize = "131")]
+ Tržič,
+ #[strum(serialize = "132")]
+ Turnišče,
+ #[strum(serialize = "187")]
+ VelikaPolana,
+ #[strum(serialize = "134")]
+ VelikeLašče,
+ #[strum(serialize = "188")]
+ Veržej,
+ #[strum(serialize = "135")]
+ Videm,
+ #[strum(serialize = "136")]
+ Vipava,
+ #[strum(serialize = "137")]
+ Vitanje,
+ #[strum(serialize = "138")]
+ Vodice,
+ #[strum(serialize = "139")]
+ Vojnik,
+ #[strum(serialize = "189")]
+ Vransko,
+ #[strum(serialize = "140")]
+ Vrhnika,
+ #[strum(serialize = "141")]
+ Vuzenica,
+ #[strum(serialize = "142")]
+ ZagorjeObSavi,
+ #[strum(serialize = "143")]
+ Zavrč,
+ #[strum(serialize = "144")]
+ Zreče,
+ #[strum(serialize = "015")]
+ Črenšovci,
+ #[strum(serialize = "016")]
+ ČrnaNaKoroškem,
+ #[strum(serialize = "017")]
+ Črnomelj,
+ #[strum(serialize = "033")]
+ Šalovci,
+ #[strum(serialize = "183")]
+ ŠempeterVrtojba,
+ #[strum(serialize = "118")]
+ Šentilj,
+ #[strum(serialize = "119")]
+ Šentjernej,
+ #[strum(serialize = "120")]
+ Šentjur,
+ #[strum(serialize = "211")]
+ Šentrupert,
+ #[strum(serialize = "117")]
+ Šenčur,
+ #[strum(serialize = "121")]
+ Škocjan,
+ #[strum(serialize = "122")]
+ ŠkofjaLoka,
+ #[strum(serialize = "124")]
+ ŠmarjePriJelšah,
+ #[strum(serialize = "206")]
+ ŠmarješkeToplice,
+ #[strum(serialize = "125")]
+ ŠmartnoObPaki,
+ #[strum(serialize = "194")]
+ ŠmartnoPriLitiji,
+ #[strum(serialize = "126")]
+ Šoštanj,
+ #[strum(serialize = "127")]
+ Štore,
+ #[strum(serialize = "190")]
+ Žalec,
+ #[strum(serialize = "146")]
+ Železniki,
+ #[strum(serialize = "191")]
+ Žetale,
+ #[strum(serialize = "147")]
+ Žiri,
+ #[strum(serialize = "192")]
+ Žirovnica,
+ #[strum(serialize = "193")]
+ Žužemberk,
}
#[derive(
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index efb8eb86f34..05657216d9d 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -2465,36 +2465,31 @@ impl ForeignTryFrom<String> for PolandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "PolandStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "PolandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "greater poland voivodeship" => Ok(Self::GreaterPolandVoivodeship),
- "kielce" => Ok(Self::Kielce),
- "kuyavian pomeranian voivodeship" => Ok(Self::KuyavianPomeranianVoivodeship),
- "lesser poland voivodeship" => Ok(Self::LesserPolandVoivodeship),
- "lower silesian voivodeship" => Ok(Self::LowerSilesianVoivodeship),
- "lublin voivodeship" => Ok(Self::LublinVoivodeship),
- "lubusz voivodeship" => Ok(Self::LubuszVoivodeship),
- "masovian voivodeship" => Ok(Self::MasovianVoivodeship),
- "opole voivodeship" => Ok(Self::OpoleVoivodeship),
- "podkarpackie voivodeship" => Ok(Self::PodkarpackieVoivodeship),
- "podlaskie voivodeship" => Ok(Self::PodlaskieVoivodeship),
- "pomeranian voivodeship" => Ok(Self::PomeranianVoivodeship),
- "silesian voivodeship" => Ok(Self::SilesianVoivodeship),
- "warmian masurian voivodeship" => Ok(Self::WarmianMasurianVoivodeship),
- "west pomeranian voivodeship" => Ok(Self::WestPomeranianVoivodeship),
- "lodz voivodeship" => Ok(Self::LodzVoivodeship),
- "swietokrzyskie voivodeship" => Ok(Self::SwietokrzyskieVoivodeship),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Greater Poland" => Ok(Self::GreaterPoland),
+ "Holy Cross" => Ok(Self::HolyCross),
+ "Kuyavia-Pomerania" => Ok(Self::KuyaviaPomerania),
+ "Lesser Poland" => Ok(Self::LesserPoland),
+ "Lower Silesia" => Ok(Self::LowerSilesia),
+ "Lublin" => Ok(Self::Lublin),
+ "Lubusz" => Ok(Self::Lubusz),
+ "Łódź" => Ok(Self::Łódź),
+ "Mazovia" => Ok(Self::Mazovia),
+ "Podlaskie" => Ok(Self::Podlaskie),
+ "Pomerania" => Ok(Self::Pomerania),
+ "Silesia" => Ok(Self::Silesia),
+ "Subcarpathia" => Ok(Self::Subcarpathia),
+ "Upper Silesia" => Ok(Self::UpperSilesia),
+ "Warmia-Masuria" => Ok(Self::WarmiaMasuria),
+ "West Pomerania" => Ok(Self::WestPomerania),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2503,49 +2498,138 @@ impl ForeignTryFrom<String> for FranceStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "FranceStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "FranceStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "alo" => Ok(Self::Alo),
- "alsace" => Ok(Self::Alsace),
- "aquitaine" => Ok(Self::Aquitaine),
- "auvergne" => Ok(Self::Auvergne),
- "auvergne rhone alpes" => Ok(Self::AuvergneRhoneAlpes),
- "bourgogne franche comte" => Ok(Self::BourgogneFrancheComte),
- "brittany" => Ok(Self::Brittany),
- "burgundy" => Ok(Self::Burgundy),
- "centre val de loire" => Ok(Self::CentreValDeLoire),
- "champagne ardenne" => Ok(Self::ChampagneArdenne),
- "corsica" => Ok(Self::Corsica),
- "franche comte" => Ok(Self::FrancheComte),
- "french guiana" => Ok(Self::FrenchGuiana),
- "french polynesia" => Ok(Self::FrenchPolynesia),
- "grand est" => Ok(Self::GrandEst),
- "guadeloupe" => Ok(Self::Guadeloupe),
- "hauts de france" => Ok(Self::HautsDeFrance),
- "ile de france" => Ok(Self::IleDeFrance),
- "normandy" => Ok(Self::Normandy),
- "nouvelle aquitaine" => Ok(Self::NouvelleAquitaine),
- "occitania" => Ok(Self::Occitania),
- "paris" => Ok(Self::Paris),
- "pays de la loire" => Ok(Self::PaysDeLaLoire),
- "provence alpes cote d azur" => Ok(Self::ProvenceAlpesCoteDAzur),
- "reunion" => Ok(Self::Reunion),
- "saint barthelemy" => Ok(Self::SaintBarthelemy),
- "saint martin" => Ok(Self::SaintMartin),
- "saint pierre and miquelon" => Ok(Self::SaintPierreAndMiquelon),
- "upper normandy" => Ok(Self::UpperNormandy),
- "wallis and futuna" => Ok(Self::WallisAndFutuna),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Ain" => Ok(Self::Ain),
+ "Aisne" => Ok(Self::Aisne),
+ "Allier" => Ok(Self::Allier),
+ "Alpes-de-Haute-Provence" => Ok(Self::AlpesDeHauteProvence),
+ "Alpes-Maritimes" => Ok(Self::AlpesMaritimes),
+ "Alsace" => Ok(Self::Alsace),
+ "Ardèche" => Ok(Self::Ardeche),
+ "Ardennes" => Ok(Self::Ardennes),
+ "Ariège" => Ok(Self::Ariege),
+ "Aube" => Ok(Self::Aube),
+ "Aude" => Ok(Self::Aude),
+ "Auvergne-Rhône-Alpes" => Ok(Self::AuvergneRhoneAlpes),
+ "Aveyron" => Ok(Self::Aveyron),
+ "Bas-Rhin" => Ok(Self::BasRhin),
+ "Bouches-du-Rhône" => Ok(Self::BouchesDuRhone),
+ "Bourgogne-Franche-Comté" => Ok(Self::BourgogneFrancheComte),
+ "Bretagne" => Ok(Self::Bretagne),
+ "Calvados" => Ok(Self::Calvados),
+ "Cantal" => Ok(Self::Cantal),
+ "Centre-Val de Loire" => Ok(Self::CentreValDeLoire),
+ "Charente" => Ok(Self::Charente),
+ "Charente-Maritime" => Ok(Self::CharenteMaritime),
+ "Cher" => Ok(Self::Cher),
+ "Clipperton" => Ok(Self::Clipperton),
+ "Corrèze" => Ok(Self::Correze),
+ "Corse" => Ok(Self::Corse),
+ "Corse-du-Sud" => Ok(Self::CorseDuSud),
+ "Côte-d'Or" => Ok(Self::CoteDor),
+ "Côtes-d'Armor" => Ok(Self::CotesDarmor),
+ "Creuse" => Ok(Self::Creuse),
+ "Deux-Sèvres" => Ok(Self::DeuxSevres),
+ "Dordogne" => Ok(Self::Dordogne),
+ "Doubs" => Ok(Self::Doubs),
+ "Drôme" => Ok(Self::Drome),
+ "Essonne" => Ok(Self::Essonne),
+ "Eure" => Ok(Self::Eure),
+ "Eure-et-Loir" => Ok(Self::EureEtLoir),
+ "Finistère" => Ok(Self::Finistere),
+ "French Guiana" => Ok(Self::FrenchGuiana),
+ "French Polynesia" => Ok(Self::FrenchPolynesia),
+ "French Southern and Antarctic Lands" => Ok(Self::FrenchSouthernAndAntarcticLands),
+ "Gard" => Ok(Self::Gard),
+ "Gers" => Ok(Self::Gers),
+ "Gironde" => Ok(Self::Gironde),
+ "Grand-Est" => Ok(Self::GrandEst),
+ "Guadeloupe" => Ok(Self::Guadeloupe),
+ "Haut-Rhin" => Ok(Self::HautRhin),
+ "Haute-Corse" => Ok(Self::HauteCorse),
+ "Haute-Garonne" => Ok(Self::HauteGaronne),
+ "Haute-Loire" => Ok(Self::HauteLoire),
+ "Haute-Marne" => Ok(Self::HauteMarne),
+ "Haute-Saône" => Ok(Self::HauteSaone),
+ "Haute-Savoie" => Ok(Self::HauteSavoie),
+ "Haute-Vienne" => Ok(Self::HauteVienne),
+ "Hautes-Alpes" => Ok(Self::HautesAlpes),
+ "Hautes-Pyrénées" => Ok(Self::HautesPyrenees),
+ "Hauts-de-France" => Ok(Self::HautsDeFrance),
+ "Hauts-de-Seine" => Ok(Self::HautsDeSeine),
+ "Hérault" => Ok(Self::Herault),
+ "Île-de-France" => Ok(Self::IleDeFrance),
+ "Ille-et-Vilaine" => Ok(Self::IlleEtVilaine),
+ "Indre" => Ok(Self::Indre),
+ "Indre-et-Loire" => Ok(Self::IndreEtLoire),
+ "Isère" => Ok(Self::Isere),
+ "Jura" => Ok(Self::Jura),
+ "La Réunion" => Ok(Self::LaReunion),
+ "Landes" => Ok(Self::Landes),
+ "Loir-et-Cher" => Ok(Self::LoirEtCher),
+ "Loire" => Ok(Self::Loire),
+ "Loire-Atlantique" => Ok(Self::LoireAtlantique),
+ "Loiret" => Ok(Self::Loiret),
+ "Lot" => Ok(Self::Lot),
+ "Lot-et-Garonne" => Ok(Self::LotEtGaronne),
+ "Lozère" => Ok(Self::Lozere),
+ "Maine-et-Loire" => Ok(Self::MaineEtLoire),
+ "Manche" => Ok(Self::Manche),
+ "Marne" => Ok(Self::Marne),
+ "Martinique" => Ok(Self::Martinique),
+ "Mayenne" => Ok(Self::Mayenne),
+ "Mayotte" => Ok(Self::Mayotte),
+ "Métropole de Lyon" => Ok(Self::MetropoleDeLyon),
+ "Meurthe-et-Moselle" => Ok(Self::MeurtheEtMoselle),
+ "Meuse" => Ok(Self::Meuse),
+ "Morbihan" => Ok(Self::Morbihan),
+ "Moselle" => Ok(Self::Moselle),
+ "Nièvre" => Ok(Self::Nievre),
+ "Nord" => Ok(Self::Nord),
+ "Normandie" => Ok(Self::Normandie),
+ "Nouvelle-Aquitaine" => Ok(Self::NouvelleAquitaine),
+ "Occitanie" => Ok(Self::Occitanie),
+ "Oise" => Ok(Self::Oise),
+ "Orne" => Ok(Self::Orne),
+ "Paris" => Ok(Self::Paris),
+ "Pas-de-Calais" => Ok(Self::PasDeCalais),
+ "Pays-de-la-Loire" => Ok(Self::PaysDeLaLoire),
+ "Provence-Alpes-Côte-d'Azur" => Ok(Self::ProvenceAlpesCoteDazur),
+ "Puy-de-Dôme" => Ok(Self::PuyDeDome),
+ "Pyrénées-Atlantiques" => Ok(Self::PyreneesAtlantiques),
+ "Pyrénées-Orientales" => Ok(Self::PyreneesOrientales),
+ "Rhône" => Ok(Self::Rhone),
+ "Saint Pierre and Miquelon" => Ok(Self::SaintPierreAndMiquelon),
+ "Saint-Barthélemy" => Ok(Self::SaintBarthelemy),
+ "Saint-Martin" => Ok(Self::SaintMartin),
+ "Saône-et-Loire" => Ok(Self::SaoneEtLoire),
+ "Sarthe" => Ok(Self::Sarthe),
+ "Savoie" => Ok(Self::Savoie),
+ "Seine-et-Marne" => Ok(Self::SeineEtMarne),
+ "Seine-Maritime" => Ok(Self::SeineMaritime),
+ "Seine-Saint-Denis" => Ok(Self::SeineSaintDenis),
+ "Somme" => Ok(Self::Somme),
+ "Tarn" => Ok(Self::Tarn),
+ "Tarn-et-Garonne" => Ok(Self::TarnEtGaronne),
+ "Territoire de Belfort" => Ok(Self::TerritoireDeBelfort),
+ "Val-d'Oise" => Ok(Self::ValDoise),
+ "Val-de-Marne" => Ok(Self::ValDeMarne),
+ "Var" => Ok(Self::Var),
+ "Vaucluse" => Ok(Self::Vaucluse),
+ "Vendée" => Ok(Self::Vendee),
+ "Vienne" => Ok(Self::Vienne),
+ "Vosges" => Ok(Self::Vosges),
+ "Wallis and Futuna" => Ok(Self::WallisAndFutuna),
+ "Yonne" => Ok(Self::Yonne),
+ "Yvelines" => Ok(Self::Yvelines),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2553,38 +2637,32 @@ impl ForeignTryFrom<String> for FranceStatesAbbreviation {
impl ForeignTryFrom<String> for GermanyStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "GermanyStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "GermanyStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "baden wurttemberg" => Ok(Self::BadenWurttemberg),
- "bavaria" => Ok(Self::Bavaria),
- "berlin" => Ok(Self::Berlin),
- "brandenburg" => Ok(Self::Brandenburg),
- "bremen" => Ok(Self::Bremen),
- "hamburg" => Ok(Self::Hamburg),
- "hesse" => Ok(Self::Hesse),
- "lower saxony" => Ok(Self::LowerSaxony),
- "mecklenburg vorpommern" => Ok(Self::MecklenburgVorpommern),
- "north rhine westphalia" => Ok(Self::NorthRhineWestphalia),
- "rhineland palatinate" => Ok(Self::RhinelandPalatinate),
- "saarland" => Ok(Self::Saarland),
- "saxony" => Ok(Self::Saxony),
- "saxony anhalt" => Ok(Self::SaxonyAnhalt),
- "schleswig holstein" => Ok(Self::SchleswigHolstein),
- "thuringia" => Ok(Self::Thuringia),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Baden-Württemberg" => Ok(Self::BW),
+ "Bavaria" => Ok(Self::BY),
+ "Berlin" => Ok(Self::BE),
+ "Brandenburg" => Ok(Self::BB),
+ "Bremen" => Ok(Self::HB),
+ "Hamburg" => Ok(Self::HH),
+ "Hessen" => Ok(Self::HE),
+ "Lower Saxony" => Ok(Self::NI),
+ "Mecklenburg-Vorpommern" => Ok(Self::MV),
+ "North Rhine-Westphalia" => Ok(Self::NW),
+ "Rhineland-Palatinate" => Ok(Self::RP),
+ "Saarland" => Ok(Self::SL),
+ "Saxony" => Ok(Self::SN),
+ "Saxony-Anhalt" => Ok(Self::ST),
+ "Schleswig-Holstein" => Ok(Self::SH),
+ "Thuringia" => Ok(Self::TH),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2593,83 +2671,79 @@ impl ForeignTryFrom<String> for SpainStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "SpainStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "SpainStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "a coruna province" => Ok(Self::ACorunaProvince),
- "albacete province" => Ok(Self::AlbaceteProvince),
- "alicante province" => Ok(Self::AlicanteProvince),
- "almeria province" => Ok(Self::AlmeriaProvince),
- "andalusia" => Ok(Self::Andalusia),
- "araba alava" => Ok(Self::ArabaAlava),
- "aragon" => Ok(Self::Aragon),
- "badajoz province" => Ok(Self::BadajozProvince),
- "balearic islands" => Ok(Self::BalearicIslands),
- "barcelona province" => Ok(Self::BarcelonaProvince),
- "basque country" => Ok(Self::BasqueCountry),
- "biscay" => Ok(Self::Biscay),
- "burgos province" => Ok(Self::BurgosProvince),
- "canary islands" => Ok(Self::CanaryIslands),
- "cantabria" => Ok(Self::Cantabria),
- "castellon province" => Ok(Self::CastellonProvince),
- "castile and leon" => Ok(Self::CastileAndLeon),
- "castile la mancha" => Ok(Self::CastileLaMancha),
- "catalonia" => Ok(Self::Catalonia),
- "ceuta" => Ok(Self::Ceuta),
- "ciudad real province" => Ok(Self::CiudadRealProvince),
- "community of madrid" => Ok(Self::CommunityOfMadrid),
- "cuenca province" => Ok(Self::CuencaProvince),
- "caceres province" => Ok(Self::CaceresProvince),
- "cadiz province" => Ok(Self::CadizProvince),
- "cordoba province" => Ok(Self::CordobaProvince),
- "extremadura" => Ok(Self::Extremadura),
- "galicia" => Ok(Self::Galicia),
- "gipuzkoa" => Ok(Self::Gipuzkoa),
- "girona province" => Ok(Self::GironaProvince),
- "granada province" => Ok(Self::GranadaProvince),
- "guadalajara province" => Ok(Self::GuadalajaraProvince),
- "huelva province" => Ok(Self::HuelvaProvince),
- "huesca province" => Ok(Self::HuescaProvince),
- "jaen province" => Ok(Self::JaenProvince),
- "la rioja" => Ok(Self::LaRioja),
- "las palmas province" => Ok(Self::LasPalmasProvince),
- "leon province" => Ok(Self::LeonProvince),
- "lleida province" => Ok(Self::LleidaProvince),
- "lugo province" => Ok(Self::LugoProvince),
- "madrid province" => Ok(Self::MadridProvince),
- "melilla" => Ok(Self::Melilla),
- "murcia province" => Ok(Self::MurciaProvince),
- "malaga province" => Ok(Self::MalagaProvince),
- "navarre" => Ok(Self::Navarre),
- "ourense province" => Ok(Self::OurenseProvince),
- "palencia province" => Ok(Self::PalenciaProvince),
- "pontevedra province" => Ok(Self::PontevedraProvince),
- "province of asturias" => Ok(Self::ProvinceOfAsturias),
- "province of avila" => Ok(Self::ProvinceOfAvila),
- "region of murcia" => Ok(Self::RegionOfMurcia),
- "salamanca province" => Ok(Self::SalamancaProvince),
- "santa cruz de tenerife province" => Ok(Self::SantaCruzDeTenerifeProvince),
- "segovia province" => Ok(Self::SegoviaProvince),
- "seville province" => Ok(Self::SevilleProvince),
- "soria province" => Ok(Self::SoriaProvince),
- "tarragona province" => Ok(Self::TarragonaProvince),
- "teruel province" => Ok(Self::TeruelProvince),
- "toledo province" => Ok(Self::ToledoProvince),
- "valencia province" => Ok(Self::ValenciaProvince),
- "valencian community" => Ok(Self::ValencianCommunity),
- "valladolid province" => Ok(Self::ValladolidProvince),
- "zamora province" => Ok(Self::ZamoraProvince),
- "zaragoza province" => Ok(Self::ZaragozaProvince),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "A Coruña Province" => Ok(Self::ACorunaProvince),
+ "Albacete Province" => Ok(Self::AlbaceteProvince),
+ "Alicante Province" => Ok(Self::AlicanteProvince),
+ "Almería Province" => Ok(Self::AlmeriaProvince),
+ "Andalusia" => Ok(Self::Andalusia),
+ "Araba / Álava" => Ok(Self::ArabaAlava),
+ "Aragon" => Ok(Self::Aragon),
+ "Badajoz Province" => Ok(Self::BadajozProvince),
+ "Balearic Islands" => Ok(Self::BalearicIslands),
+ "Barcelona Province" => Ok(Self::BarcelonaProvince),
+ "Basque Country" => Ok(Self::BasqueCountry),
+ "Biscay" => Ok(Self::Biscay),
+ "Burgos Province" => Ok(Self::BurgosProvince),
+ "Canary Islands" => Ok(Self::CanaryIslands),
+ "Cantabria" => Ok(Self::Cantabria),
+ "Castellón Province" => Ok(Self::CastellonProvince),
+ "Castile and León" => Ok(Self::CastileAndLeon),
+ "Castilla-La Mancha" => Ok(Self::CastileLaMancha),
+ "Catalonia" => Ok(Self::Catalonia),
+ "Ceuta" => Ok(Self::Ceuta),
+ "Ciudad Real Province" => Ok(Self::CiudadRealProvince),
+ "Community of Madrid" => Ok(Self::CommunityOfMadrid),
+ "Cuenca Province" => Ok(Self::CuencaProvince),
+ "Cáceres Province" => Ok(Self::CaceresProvince),
+ "Cádiz Province" => Ok(Self::CadizProvince),
+ "Córdoba Province" => Ok(Self::CordobaProvince),
+ "Extremadura" => Ok(Self::Extremadura),
+ "Galicia" => Ok(Self::Galicia),
+ "Gipuzkoa" => Ok(Self::Gipuzkoa),
+ "Girona Province" => Ok(Self::GironaProvince),
+ "Granada Province" => Ok(Self::GranadaProvince),
+ "Guadalajara Province" => Ok(Self::GuadalajaraProvince),
+ "Huelva Province" => Ok(Self::HuelvaProvince),
+ "Huesca Province" => Ok(Self::HuescaProvince),
+ "Jaén Province" => Ok(Self::JaenProvince),
+ "La Rioja" => Ok(Self::LaRioja),
+ "Las Palmas Province" => Ok(Self::LasPalmasProvince),
+ "León Province" => Ok(Self::LeonProvince),
+ "Lleida Province" => Ok(Self::LleidaProvince),
+ "Lugo Province" => Ok(Self::LugoProvince),
+ "Madrid Province" => Ok(Self::MadridProvince),
+ "Melilla" => Ok(Self::Melilla),
+ "Murcia Province" => Ok(Self::MurciaProvince),
+ "Málaga Province" => Ok(Self::MalagaProvince),
+ "Navarre" => Ok(Self::Navarre),
+ "Ourense Province" => Ok(Self::OurenseProvince),
+ "Palencia Province" => Ok(Self::PalenciaProvince),
+ "Pontevedra Province" => Ok(Self::PontevedraProvince),
+ "Province of Asturias" => Ok(Self::ProvinceOfAsturias),
+ "Province of Ávila" => Ok(Self::ProvinceOfAvila),
+ "Region of Murcia" => Ok(Self::RegionOfMurcia),
+ "Salamanca Province" => Ok(Self::SalamancaProvince),
+ "Santa Cruz de Tenerife Province" => Ok(Self::SantaCruzDeTenerifeProvince),
+ "Segovia Province" => Ok(Self::SegoviaProvince),
+ "Seville Province" => Ok(Self::SevilleProvince),
+ "Soria Province" => Ok(Self::SoriaProvince),
+ "Tarragona Province" => Ok(Self::TarragonaProvince),
+ "Teruel Province" => Ok(Self::TeruelProvince),
+ "Toledo Province" => Ok(Self::ToledoProvince),
+ "Valencia Province" => Ok(Self::ValenciaProvince),
+ "Valencian Community" => Ok(Self::ValencianCommunity),
+ "Valladolid Province" => Ok(Self::ValladolidProvince),
+ "Zamora Province" => Ok(Self::ZamoraProvince),
+ "Zaragoza Province" => Ok(Self::ZaragozaProvince),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2678,60 +2752,56 @@ impl ForeignTryFrom<String> for ItalyStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "ItalyStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "ItalyStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "abruzzo" => Ok(Self::Abruzzo),
- "aosta valley" => Ok(Self::AostaValley),
- "apulia" => Ok(Self::Apulia),
- "basilicata" => Ok(Self::Basilicata),
- "benevento province" => Ok(Self::BeneventoProvince),
- "calabria" => Ok(Self::Calabria),
- "campania" => Ok(Self::Campania),
- "emilia romagna" => Ok(Self::EmiliaRomagna),
- "friuli venezia giulia" => Ok(Self::FriuliVeneziaGiulia),
- "lazio" => Ok(Self::Lazio),
- "liguria" => Ok(Self::Liguria),
- "lombardy" => Ok(Self::Lombardy),
- "marche" => Ok(Self::Marche),
- "molise" => Ok(Self::Molise),
- "piedmont" => Ok(Self::Piedmont),
- "sardinia" => Ok(Self::Sardinia),
- "sicily" => Ok(Self::Sicily),
- "trentino south tyrol" => Ok(Self::TrentinoSouthTyrol),
- "tuscany" => Ok(Self::Tuscany),
- "umbria" => Ok(Self::Umbria),
- "veneto" => Ok(Self::Veneto),
- "agrigento" => Ok(Self::Agrigento),
- "caltanissetta" => Ok(Self::Caltanissetta),
- "enna" => Ok(Self::Enna),
- "ragusa" => Ok(Self::Ragusa),
- "siracusa" => Ok(Self::Siracusa),
- "trapani" => Ok(Self::Trapani),
- "bari" => Ok(Self::Bari),
- "bologna" => Ok(Self::Bologna),
- "cagliari" => Ok(Self::Cagliari),
- "catania" => Ok(Self::Catania),
- "florence" => Ok(Self::Florence),
- "genoa" => Ok(Self::Genoa),
- "messina" => Ok(Self::Messina),
- "milan" => Ok(Self::Milan),
- "naples" => Ok(Self::Naples),
- "palermo" => Ok(Self::Palermo),
- "reggio calabria" => Ok(Self::ReggioCalabria),
- "rome" => Ok(Self::Rome),
- "turin" => Ok(Self::Turin),
- "venice" => Ok(Self::Venice),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Abruzzo" => Ok(Self::Abruzzo),
+ "Aosta Valley" => Ok(Self::AostaValley),
+ "Apulia" => Ok(Self::Apulia),
+ "Basilicata" => Ok(Self::Basilicata),
+ "Benevento Province" => Ok(Self::BeneventoProvince),
+ "Calabria" => Ok(Self::Calabria),
+ "Campania" => Ok(Self::Campania),
+ "Emilia-Romagna" => Ok(Self::EmiliaRomagna),
+ "Friuli–Venezia Giulia" => Ok(Self::FriuliVeneziaGiulia),
+ "Lazio" => Ok(Self::Lazio),
+ "Liguria" => Ok(Self::Liguria),
+ "Lombardy" => Ok(Self::Lombardy),
+ "Marche" => Ok(Self::Marche),
+ "Molise" => Ok(Self::Molise),
+ "Piedmont" => Ok(Self::Piedmont),
+ "Sardinia" => Ok(Self::Sardinia),
+ "Sicily" => Ok(Self::Sicily),
+ "Trentino-South Tyrol" => Ok(Self::TrentinoSouthTyrol),
+ "Tuscany" => Ok(Self::Tuscany),
+ "Umbria" => Ok(Self::Umbria),
+ "Veneto" => Ok(Self::Veneto),
+ "Libero consorzio comunale di Agrigento" => Ok(Self::Agrigento),
+ "Libero consorzio comunale di Caltanissetta" => Ok(Self::Caltanissetta),
+ "Libero consorzio comunale di Enna" => Ok(Self::Enna),
+ "Libero consorzio comunale di Ragusa" => Ok(Self::Ragusa),
+ "Libero consorzio comunale di Siracusa" => Ok(Self::Siracusa),
+ "Libero consorzio comunale di Trapani" => Ok(Self::Trapani),
+ "Metropolitan City of Bari" => Ok(Self::Bari),
+ "Metropolitan City of Bologna" => Ok(Self::Bologna),
+ "Metropolitan City of Cagliari" => Ok(Self::Cagliari),
+ "Metropolitan City of Catania" => Ok(Self::Catania),
+ "Metropolitan City of Florence" => Ok(Self::Florence),
+ "Metropolitan City of Genoa" => Ok(Self::Genoa),
+ "Metropolitan City of Messina" => Ok(Self::Messina),
+ "Metropolitan City of Milan" => Ok(Self::Milan),
+ "Metropolitan City of Naples" => Ok(Self::Naples),
+ "Metropolitan City of Palermo" => Ok(Self::Palermo),
+ "Metropolitan City of Reggio Calabria" => Ok(Self::ReggioCalabria),
+ "Metropolitan City of Rome" => Ok(Self::Rome),
+ "Metropolitan City of Turin" => Ok(Self::Turin),
+ "Metropolitan City of Venice" => Ok(Self::Venice),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2740,39 +2810,36 @@ impl ForeignTryFrom<String> for NorwayStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "NorwayStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "NorwayStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "akershus" => Ok(Self::Akershus),
- "buskerud" => Ok(Self::Buskerud),
- "finnmark" => Ok(Self::Finnmark),
- "hedmark" => Ok(Self::Hedmark),
- "hordaland" => Ok(Self::Hordaland),
- "janmayen" => Ok(Self::JanMayen),
- "nordtrondelag" => Ok(Self::NordTrondelag),
- "nordland" => Ok(Self::Nordland),
- "oppland" => Ok(Self::Oppland),
- "oslo" => Ok(Self::Oslo),
- "rogaland" => Ok(Self::Rogaland),
- "sognogfjordane" => Ok(Self::SognOgFjordane),
- "svalbard" => Ok(Self::Svalbard),
- "sortrondelag" => Ok(Self::SorTrondelag),
- "telemark" => Ok(Self::Telemark),
- "troms" => Ok(Self::Troms),
- "trondelag" => Ok(Self::Trondelag),
- "vestagder" => Ok(Self::VestAgder),
- "vestfold" => Ok(Self::Vestfold),
- "ostfold" => Ok(Self::Ostfold),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Akershus" => Ok(Self::Akershus),
+ "Buskerud" => Ok(Self::Buskerud),
+ "Finnmark" => Ok(Self::Finnmark),
+ "Hedmark" => Ok(Self::Hedmark),
+ "Hordaland" => Ok(Self::Hordaland),
+ "Jan Mayen" => Ok(Self::JanMayen),
+ "Møre og Romsdal" => Ok(Self::MoreOgRomsdal),
+ "Nord-Trøndelag" => Ok(Self::NordTrondelag),
+ "Nordland" => Ok(Self::Nordland),
+ "Oppland" => Ok(Self::Oppland),
+ "Oslo" => Ok(Self::Oslo),
+ "Rogaland" => Ok(Self::Rogaland),
+ "Sogn og Fjordane" => Ok(Self::SognOgFjordane),
+ "Svalbard" => Ok(Self::Svalbard),
+ "Sør-Trøndelag" => Ok(Self::SorTrondelag),
+ "Telemark" => Ok(Self::Telemark),
+ "Troms" => Ok(Self::Troms),
+ "Trøndelag" => Ok(Self::Trondelag),
+ "Vest-Agder" => Ok(Self::VestAgder),
+ "Vestfold" => Ok(Self::Vestfold),
+ "Østfold" => Ok(Self::Ostfold),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2780,34 +2847,28 @@ impl ForeignTryFrom<String> for NorwayStatesAbbreviation {
impl ForeignTryFrom<String> for AlbaniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "AlbaniaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "AlbaniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "berat" => Ok(Self::Berat),
- "diber" => Ok(Self::Diber),
- "durres" => Ok(Self::Durres),
- "elbasan" => Ok(Self::Elbasan),
- "fier" => Ok(Self::Fier),
- "gjirokaster" => Ok(Self::Gjirokaster),
- "korce" => Ok(Self::Korce),
- "kukes" => Ok(Self::Kukes),
- "lezhe" => Ok(Self::Lezhe),
- "shkoder" => Ok(Self::Shkoder),
- "tirane" => Ok(Self::Tirane),
- "vlore" => Ok(Self::Vlore),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Berat" => Ok(Self::Berat),
+ "Dibër" => Ok(Self::Diber),
+ "Durrës" => Ok(Self::Durres),
+ "Elbasan" => Ok(Self::Elbasan),
+ "Fier" => Ok(Self::Fier),
+ "Gjirokastër" => Ok(Self::Gjirokaster),
+ "Korçë" => Ok(Self::Korce),
+ "Kukës" => Ok(Self::Kukes),
+ "Lezhë" => Ok(Self::Lezhe),
+ "Shkodër" => Ok(Self::Shkoder),
+ "Tiranë" => Ok(Self::Tirane),
+ "Vlorë" => Ok(Self::Vlore),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2815,29 +2876,23 @@ impl ForeignTryFrom<String> for AlbaniaStatesAbbreviation {
impl ForeignTryFrom<String> for AndorraStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "AndorraStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "AndorraStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "andorra la vella" => Ok(Self::AndorraLaVella),
- "canillo" => Ok(Self::Canillo),
- "encamp" => Ok(Self::Encamp),
- "escaldes engordany" => Ok(Self::EscaldesEngordany),
- "la massana" => Ok(Self::LaMassana),
- "ordino" => Ok(Self::Ordino),
- "sant julia de loria" => Ok(Self::SantJuliaDeLoria),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Andorra la Vella" => Ok(Self::AndorraLaVella),
+ "Canillo" => Ok(Self::Canillo),
+ "Encamp" => Ok(Self::Encamp),
+ "Escaldes-Engordany" => Ok(Self::EscaldesEngordany),
+ "La Massana" => Ok(Self::LaMassana),
+ "Ordino" => Ok(Self::Ordino),
+ "Sant Julià de Lòria" => Ok(Self::SantJuliaDeLoria),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2845,31 +2900,25 @@ impl ForeignTryFrom<String> for AndorraStatesAbbreviation {
impl ForeignTryFrom<String> for AustriaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "AustriaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "AustriaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "burgenland" => Ok(Self::Burgenland),
- "carinthia" => Ok(Self::Carinthia),
- "lower austria" => Ok(Self::LowerAustria),
- "salzburg" => Ok(Self::Salzburg),
- "styria" => Ok(Self::Styria),
- "tyrol" => Ok(Self::Tyrol),
- "upper austria" => Ok(Self::UpperAustria),
- "vienna" => Ok(Self::Vienna),
- "vorarlberg" => Ok(Self::Vorarlberg),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Burgenland" => Ok(Self::Burgenland),
+ "Carinthia" => Ok(Self::Carinthia),
+ "Lower Austria" => Ok(Self::LowerAustria),
+ "Salzburg" => Ok(Self::Salzburg),
+ "Styria" => Ok(Self::Styria),
+ "Tyrol" => Ok(Self::Tyrol),
+ "Upper Austria" => Ok(Self::UpperAustria),
+ "Vienna" => Ok(Self::Vienna),
+ "Vorarlberg" => Ok(Self::Vorarlberg),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2877,63 +2926,57 @@ impl ForeignTryFrom<String> for AustriaStatesAbbreviation {
impl ForeignTryFrom<String> for RomaniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "RomaniaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "RomaniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "alba" => Ok(Self::Alba),
- "arad county" => Ok(Self::AradCounty),
- "arges" => Ok(Self::Arges),
- "bacau county" => Ok(Self::BacauCounty),
- "bihor county" => Ok(Self::BihorCounty),
- "bistrita nasaud county" => Ok(Self::BistritaNasaudCounty),
- "botosani county" => Ok(Self::BotosaniCounty),
- "braila" => Ok(Self::Braila),
- "brasov county" => Ok(Self::BrasovCounty),
- "bucharest" => Ok(Self::Bucharest),
- "buzau county" => Ok(Self::BuzauCounty),
- "caras severin county" => Ok(Self::CarasSeverinCounty),
- "cluj county" => Ok(Self::ClujCounty),
- "constanta county" => Ok(Self::ConstantaCounty),
- "covasna county" => Ok(Self::CovasnaCounty),
- "calarasi county" => Ok(Self::CalarasiCounty),
- "dolj county" => Ok(Self::DoljCounty),
- "dambovita county" => Ok(Self::DambovitaCounty),
- "galati county" => Ok(Self::GalatiCounty),
- "giurgiu county" => Ok(Self::GiurgiuCounty),
- "gorj county" => Ok(Self::GorjCounty),
- "harghita county" => Ok(Self::HarghitaCounty),
- "hunedoara county" => Ok(Self::HunedoaraCounty),
- "ialomita county" => Ok(Self::IalomitaCounty),
- "iasi county" => Ok(Self::IasiCounty),
- "ilfov county" => Ok(Self::IlfovCounty),
- "mehedinti county" => Ok(Self::MehedintiCounty),
- "mures county" => Ok(Self::MuresCounty),
- "neamt county" => Ok(Self::NeamtCounty),
- "olt county" => Ok(Self::OltCounty),
- "prahova county" => Ok(Self::PrahovaCounty),
- "satu mare county" => Ok(Self::SatuMareCounty),
- "sibiu county" => Ok(Self::SibiuCounty),
- "suceava county" => Ok(Self::SuceavaCounty),
- "salaj county" => Ok(Self::SalajCounty),
- "teleorman county" => Ok(Self::TeleormanCounty),
- "timis county" => Ok(Self::TimisCounty),
- "tulcea county" => Ok(Self::TulceaCounty),
- "vaslui county" => Ok(Self::VasluiCounty),
- "vrancea county" => Ok(Self::VranceaCounty),
- "valcea county" => Ok(Self::ValceaCounty),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Alba" => Ok(Self::Alba),
+ "Arad County" => Ok(Self::AradCounty),
+ "Argeș" => Ok(Self::Arges),
+ "Bacău County" => Ok(Self::BacauCounty),
+ "Bihor County" => Ok(Self::BihorCounty),
+ "Bistrița-Năsăud County" => Ok(Self::BistritaNasaudCounty),
+ "Botoșani County" => Ok(Self::BotosaniCounty),
+ "Brăila" => Ok(Self::Braila),
+ "Brașov County" => Ok(Self::BrasovCounty),
+ "Bucharest" => Ok(Self::Bucharest),
+ "Buzău County" => Ok(Self::BuzauCounty),
+ "Caraș-Severin County" => Ok(Self::CarasSeverinCounty),
+ "Cluj County" => Ok(Self::ClujCounty),
+ "Constanța County" => Ok(Self::ConstantaCounty),
+ "Covasna County" => Ok(Self::CovasnaCounty),
+ "Călărași County" => Ok(Self::CalarasiCounty),
+ "Dolj County" => Ok(Self::DoljCounty),
+ "Dâmbovița County" => Ok(Self::DambovitaCounty),
+ "Galați County" => Ok(Self::GalatiCounty),
+ "Giurgiu County" => Ok(Self::GiurgiuCounty),
+ "Gorj County" => Ok(Self::GorjCounty),
+ "Harghita County" => Ok(Self::HarghitaCounty),
+ "Hunedoara County" => Ok(Self::HunedoaraCounty),
+ "Ialomița County" => Ok(Self::IalomitaCounty),
+ "Iași County" => Ok(Self::IasiCounty),
+ "Ilfov County" => Ok(Self::IlfovCounty),
+ "Mehedinți County" => Ok(Self::MehedintiCounty),
+ "Mureș County" => Ok(Self::MuresCounty),
+ "Neamț County" => Ok(Self::NeamtCounty),
+ "Olt County" => Ok(Self::OltCounty),
+ "Prahova County" => Ok(Self::PrahovaCounty),
+ "Satu Mare County" => Ok(Self::SatuMareCounty),
+ "Sibiu County" => Ok(Self::SibiuCounty),
+ "Suceava County" => Ok(Self::SuceavaCounty),
+ "Sălaj County" => Ok(Self::SalajCounty),
+ "Teleorman County" => Ok(Self::TeleormanCounty),
+ "Timiș County" => Ok(Self::TimisCounty),
+ "Tulcea County" => Ok(Self::TulceaCounty),
+ "Vaslui County" => Ok(Self::VasluiCounty),
+ "Vrancea County" => Ok(Self::VranceaCounty),
+ "Vâlcea County" => Ok(Self::ValceaCounty),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2941,42 +2984,36 @@ impl ForeignTryFrom<String> for RomaniaStatesAbbreviation {
impl ForeignTryFrom<String> for PortugalStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "PortugalStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "PortugalStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "aveiro district" => Ok(Self::AveiroDistrict),
- "azores" => Ok(Self::Azores),
- "beja district" => Ok(Self::BejaDistrict),
- "braga district" => Ok(Self::BragaDistrict),
- "braganca district" => Ok(Self::BragancaDistrict),
- "castelo branco district" => Ok(Self::CasteloBrancoDistrict),
- "coimbra district" => Ok(Self::CoimbraDistrict),
- "faro district" => Ok(Self::FaroDistrict),
- "guarda district" => Ok(Self::GuardaDistrict),
- "leiria district" => Ok(Self::LeiriaDistrict),
- "lisbon district" => Ok(Self::LisbonDistrict),
- "madeira" => Ok(Self::Madeira),
- "portalegre district" => Ok(Self::PortalegreDistrict),
- "porto district" => Ok(Self::PortoDistrict),
- "santarem district" => Ok(Self::SantaremDistrict),
- "setubal district" => Ok(Self::SetubalDistrict),
- "viana do castelo district" => Ok(Self::VianaDoCasteloDistrict),
- "vila real district" => Ok(Self::VilaRealDistrict),
- "viseu district" => Ok(Self::ViseuDistrict),
- "evora district" => Ok(Self::EvoraDistrict),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Aveiro District" => Ok(Self::AveiroDistrict),
+ "Azores" => Ok(Self::Azores),
+ "Beja District" => Ok(Self::BejaDistrict),
+ "Braga District" => Ok(Self::BragaDistrict),
+ "Bragança District" => Ok(Self::BragancaDistrict),
+ "Castelo Branco District" => Ok(Self::CasteloBrancoDistrict),
+ "Coimbra District" => Ok(Self::CoimbraDistrict),
+ "Faro District" => Ok(Self::FaroDistrict),
+ "Guarda District" => Ok(Self::GuardaDistrict),
+ "Leiria District" => Ok(Self::LeiriaDistrict),
+ "Lisbon District" => Ok(Self::LisbonDistrict),
+ "Madeira" => Ok(Self::Madeira),
+ "Portalegre District" => Ok(Self::PortalegreDistrict),
+ "Porto District" => Ok(Self::PortoDistrict),
+ "Santarém District" => Ok(Self::SantaremDistrict),
+ "Setúbal District" => Ok(Self::SetubalDistrict),
+ "Viana do Castelo District" => Ok(Self::VianaDoCasteloDistrict),
+ "Vila Real District" => Ok(Self::VilaRealDistrict),
+ "Viseu District" => Ok(Self::ViseuDistrict),
+ "Évora District" => Ok(Self::EvoraDistrict),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -2984,47 +3021,41 @@ impl ForeignTryFrom<String> for PortugalStatesAbbreviation {
impl ForeignTryFrom<String> for SwitzerlandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "SwitzerlandStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "SwitzerlandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "aargau" => Ok(Self::Aargau),
- "appenzell ausserrhoden" => Ok(Self::AppenzellAusserrhoden),
- "appenzell innerrhoden" => Ok(Self::AppenzellInnerrhoden),
- "basel landschaft" => Ok(Self::BaselLandschaft),
- "canton of fribourg" => Ok(Self::CantonOfFribourg),
- "canton of geneva" => Ok(Self::CantonOfGeneva),
- "canton of jura" => Ok(Self::CantonOfJura),
- "canton of lucerne" => Ok(Self::CantonOfLucerne),
- "canton of neuchatel" => Ok(Self::CantonOfNeuchatel),
- "canton of schaffhausen" => Ok(Self::CantonOfSchaffhausen),
- "canton of solothurn" => Ok(Self::CantonOfSolothurn),
- "canton of st gallen" => Ok(Self::CantonOfStGallen),
- "canton of valais" => Ok(Self::CantonOfValais),
- "canton of vaud" => Ok(Self::CantonOfVaud),
- "canton of zug" => Ok(Self::CantonOfZug),
- "glarus" => Ok(Self::Glarus),
- "graubunden" => Ok(Self::Graubunden),
- "nidwalden" => Ok(Self::Nidwalden),
- "obwalden" => Ok(Self::Obwalden),
- "schwyz" => Ok(Self::Schwyz),
- "thurgau" => Ok(Self::Thurgau),
- "ticino" => Ok(Self::Ticino),
- "uri" => Ok(Self::Uri),
- "canton of bern" => Ok(Self::CantonOfBern),
- "canton of zurich" => Ok(Self::CantonOfZurich),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Aargau" => Ok(Self::Aargau),
+ "Appenzell Ausserrhoden" => Ok(Self::AppenzellAusserrhoden),
+ "Appenzell Innerrhoden" => Ok(Self::AppenzellInnerrhoden),
+ "Basel-Landschaft" => Ok(Self::BaselLandschaft),
+ "Canton of Fribourg" => Ok(Self::CantonOfFribourg),
+ "Canton of Geneva" => Ok(Self::CantonOfGeneva),
+ "Canton of Jura" => Ok(Self::CantonOfJura),
+ "Canton of Lucerne" => Ok(Self::CantonOfLucerne),
+ "Canton of Neuchâtel" => Ok(Self::CantonOfNeuchatel),
+ "Canton of Schaffhausen" => Ok(Self::CantonOfSchaffhausen),
+ "Canton of Solothurn" => Ok(Self::CantonOfSolothurn),
+ "Canton of St. Gallen" => Ok(Self::CantonOfStGallen),
+ "Canton of Valais" => Ok(Self::CantonOfValais),
+ "Canton of Vaud" => Ok(Self::CantonOfVaud),
+ "Canton of Zug" => Ok(Self::CantonOfZug),
+ "Glarus" => Ok(Self::Glarus),
+ "Graubünden" => Ok(Self::Graubunden),
+ "Nidwalden" => Ok(Self::Nidwalden),
+ "Obwalden" => Ok(Self::Obwalden),
+ "Schwyz" => Ok(Self::Schwyz),
+ "Thurgau" => Ok(Self::Thurgau),
+ "Ticino" => Ok(Self::Ticino),
+ "Uri" => Ok(Self::Uri),
+ "canton of Bern" => Ok(Self::CantonOfBern),
+ "canton of Zürich" => Ok(Self::CantonOfZurich),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3032,54 +3063,100 @@ impl ForeignTryFrom<String> for SwitzerlandStatesAbbreviation {
impl ForeignTryFrom<String> for NorthMacedoniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "NorthMacedoniaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "NorthMacedoniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "aerodrom municipality" => Ok(Self::AerodromMunicipality),
- "aracinovo municipality" => Ok(Self::AracinovoMunicipality),
- "berovo municipality" => Ok(Self::BerovoMunicipality),
- "bitola municipality" => Ok(Self::BitolaMunicipality),
- "bogdanci municipality" => Ok(Self::BogdanciMunicipality),
- "bogovinje municipality" => Ok(Self::BogovinjeMunicipality),
- "bosilovo municipality" => Ok(Self::BosilovoMunicipality),
- "brvenica municipality" => Ok(Self::BrvenicaMunicipality),
- "butel municipality" => Ok(Self::ButelMunicipality),
- "centar municipality" => Ok(Self::CentarMunicipality),
- "centar zupa municipality" => Ok(Self::CentarZupaMunicipality),
- "debarca municipality" => Ok(Self::DebarcaMunicipality),
- "delcevo municipality" => Ok(Self::DelcevoMunicipality),
- "demir hisar municipality" => Ok(Self::DemirHisarMunicipality),
- "demir kapija municipality" => Ok(Self::DemirKapijaMunicipality),
- "dojran municipality" => Ok(Self::DojranMunicipality),
- "dolneni municipality" => Ok(Self::DolneniMunicipality),
- "drugovo municipality" => Ok(Self::DrugovoMunicipality),
- "gazi baba municipality" => Ok(Self::GaziBabaMunicipality),
- "gevgelija municipality" => Ok(Self::GevgelijaMunicipality),
- "gjorce petrov municipality" => Ok(Self::GjorcePetrovMunicipality),
- "gostivar municipality" => Ok(Self::GostivarMunicipality),
- "gradsko municipality" => Ok(Self::GradskoMunicipality),
- "greater skopje" => Ok(Self::GreaterSkopje),
- "ilinden municipality" => Ok(Self::IlindenMunicipality),
- "jegunovce municipality" => Ok(Self::JegunovceMunicipality),
- "karbinci" => Ok(Self::Karbinci),
- "karpos municipality" => Ok(Self::KarposMunicipality),
- "kavadarci municipality" => Ok(Self::KavadarciMunicipality),
- "kisela voda municipality" => Ok(Self::KiselaVodaMunicipality),
- "kicevo municipality" => Ok(Self::KicevoMunicipality),
- "konce municipality" => Ok(Self::KonceMunicipality),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Aerodrom Municipality" => Ok(Self::AerodromMunicipality),
+ "Aračinovo Municipality" => Ok(Self::AracinovoMunicipality),
+ "Berovo Municipality" => Ok(Self::BerovoMunicipality),
+ "Bitola Municipality" => Ok(Self::BitolaMunicipality),
+ "Bogdanci Municipality" => Ok(Self::BogdanciMunicipality),
+ "Bogovinje Municipality" => Ok(Self::BogovinjeMunicipality),
+ "Bosilovo Municipality" => Ok(Self::BosilovoMunicipality),
+ "Brvenica Municipality" => Ok(Self::BrvenicaMunicipality),
+ "Butel Municipality" => Ok(Self::ButelMunicipality),
+ "Centar Municipality" => Ok(Self::CentarMunicipality),
+ "Centar Župa Municipality" => Ok(Self::CentarZupaMunicipality),
+ "Debarca Municipality" => Ok(Self::DebarcaMunicipality),
+ "Delčevo Municipality" => Ok(Self::DelcevoMunicipality),
+ "Demir Hisar Municipality" => Ok(Self::DemirHisarMunicipality),
+ "Demir Kapija Municipality" => Ok(Self::DemirKapijaMunicipality),
+ "Dojran Municipality" => Ok(Self::DojranMunicipality),
+ "Dolneni Municipality" => Ok(Self::DolneniMunicipality),
+ "Drugovo Municipality" => Ok(Self::DrugovoMunicipality),
+ "Gazi Baba Municipality" => Ok(Self::GaziBabaMunicipality),
+ "Gevgelija Municipality" => Ok(Self::GevgelijaMunicipality),
+ "Gjorče Petrov Municipality" => Ok(Self::GjorcePetrovMunicipality),
+ "Gostivar Municipality" => Ok(Self::GostivarMunicipality),
+ "Gradsko Municipality" => Ok(Self::GradskoMunicipality),
+ "Greater Skopje" => Ok(Self::GreaterSkopje),
+ "Ilinden Municipality" => Ok(Self::IlindenMunicipality),
+ "Jegunovce Municipality" => Ok(Self::JegunovceMunicipality),
+ "Karbinci" => Ok(Self::Karbinci),
+ "Karpoš Municipality" => Ok(Self::KarposMunicipality),
+ "Kavadarci Municipality" => Ok(Self::KavadarciMunicipality),
+ "Kisela Voda Municipality" => Ok(Self::KiselaVodaMunicipality),
+ "Kičevo Municipality" => Ok(Self::KicevoMunicipality),
+ "Konče Municipality" => Ok(Self::KonceMunicipality),
+ "Kočani Municipality" => Ok(Self::KocaniMunicipality),
+ "Kratovo Municipality" => Ok(Self::KratovoMunicipality),
+ "Kriva Palanka Municipality" => Ok(Self::KrivaPalankaMunicipality),
+ "Krivogaštani Municipality" => Ok(Self::KrivogastaniMunicipality),
+ "Kruševo Municipality" => Ok(Self::KrusevoMunicipality),
+ "Kumanovo Municipality" => Ok(Self::KumanovoMunicipality),
+ "Lipkovo Municipality" => Ok(Self::LipkovoMunicipality),
+ "Lozovo Municipality" => Ok(Self::LozovoMunicipality),
+ "Makedonska Kamenica Municipality" => Ok(Self::MakedonskaKamenicaMunicipality),
+ "Makedonski Brod Municipality" => Ok(Self::MakedonskiBrodMunicipality),
+ "Mavrovo and Rostuša Municipality" => Ok(Self::MavrovoAndRostusaMunicipality),
+ "Mogila Municipality" => Ok(Self::MogilaMunicipality),
+ "Negotino Municipality" => Ok(Self::NegotinoMunicipality),
+ "Novaci Municipality" => Ok(Self::NovaciMunicipality),
+ "Novo Selo Municipality" => Ok(Self::NovoSeloMunicipality),
+ "Ohrid Municipality" => Ok(Self::OhridMunicipality),
+ "Oslomej Municipality" => Ok(Self::OslomejMunicipality),
+ "Pehčevo Municipality" => Ok(Self::PehcevoMunicipality),
+ "Petrovec Municipality" => Ok(Self::PetrovecMunicipality),
+ "Plasnica Municipality" => Ok(Self::PlasnicaMunicipality),
+ "Prilep Municipality" => Ok(Self::PrilepMunicipality),
+ "Probištip Municipality" => Ok(Self::ProbishtipMunicipality),
+ "Radoviš Municipality" => Ok(Self::RadovisMunicipality),
+ "Rankovce Municipality" => Ok(Self::RankovceMunicipality),
+ "Resen Municipality" => Ok(Self::ResenMunicipality),
+ "Rosoman Municipality" => Ok(Self::RosomanMunicipality),
+ "Saraj Municipality" => Ok(Self::SarajMunicipality),
+ "Sopište Municipality" => Ok(Self::SopisteMunicipality),
+ "Staro Nagoričane Municipality" => Ok(Self::StaroNagoricaneMunicipality),
+ "Struga Municipality" => Ok(Self::StrugaMunicipality),
+ "Strumica Municipality" => Ok(Self::StrumicaMunicipality),
+ "Studeničani Municipality" => Ok(Self::StudenicaniMunicipality),
+ "Sveti Nikole Municipality" => Ok(Self::SvetiNikoleMunicipality),
+ "Tearce Municipality" => Ok(Self::TearceMunicipality),
+ "Tetovo Municipality" => Ok(Self::TetovoMunicipality),
+ "Valandovo Municipality" => Ok(Self::ValandovoMunicipality),
+ "Vasilevo Municipality" => Ok(Self::VasilevoMunicipality),
+ "Veles Municipality" => Ok(Self::VelesMunicipality),
+ "Vevčani Municipality" => Ok(Self::VevcaniMunicipality),
+ "Vinica Municipality" => Ok(Self::VinicaMunicipality),
+ "Vraneštica Municipality" => Ok(Self::VranesticaMunicipality),
+ "Vrapčište Municipality" => Ok(Self::VrapcisteMunicipality),
+ "Zajas Municipality" => Ok(Self::ZajasMunicipality),
+ "Zelenikovo Municipality" => Ok(Self::ZelenikovoMunicipality),
+ "Zrnovci Municipality" => Ok(Self::ZrnovciMunicipality),
+ "Čair Municipality" => Ok(Self::CairMunicipality),
+ "Čaška Municipality" => Ok(Self::CaskaMunicipality),
+ "Češinovo-Obleševo Municipality" => Ok(Self::CesinovoOblesevoMunicipality),
+ "Čučer-Sandevo Municipality" => Ok(Self::CucerSandevoMunicipality),
+ "Štip Municipality" => Ok(Self::StipMunicipality),
+ "Šuto Orizari Municipality" => Ok(Self::ShutoOrizariMunicipality),
+ "Želino Municipality" => Ok(Self::ZelinoMunicipality),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3087,44 +3164,36 @@ impl ForeignTryFrom<String> for NorthMacedoniaStatesAbbreviation {
impl ForeignTryFrom<String> for MontenegroStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "MontenegroStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "MontenegroStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "andrijevica municipality" => Ok(Self::AndrijevicaMunicipality),
- "bar municipality" => Ok(Self::BarMunicipality),
- "berane municipality" => Ok(Self::BeraneMunicipality),
- "bijelo polje municipality" => Ok(Self::BijeloPoljeMunicipality),
- "budva municipality" => Ok(Self::BudvaMunicipality),
- "danilovgrad municipality" => Ok(Self::DanilovgradMunicipality),
- "gusinje municipality" => Ok(Self::GusinjeMunicipality),
- "kolasin municipality" => Ok(Self::KolasinMunicipality),
- "kotor municipality" => Ok(Self::KotorMunicipality),
- "mojkovac municipality" => Ok(Self::MojkovacMunicipality),
- "niksic municipality" => Ok(Self::NiksicMunicipality),
- "old royal capital cetinje" => Ok(Self::OldRoyalCapitalCetinje),
- "petnjica municipality" => Ok(Self::PetnjicaMunicipality),
- "plav municipality" => Ok(Self::PlavMunicipality),
- "pljevlja municipality" => Ok(Self::PljevljaMunicipality),
- "pluzine municipality" => Ok(Self::PluzineMunicipality),
- "podgorica municipality" => Ok(Self::PodgoricaMunicipality),
- "rozaje municipality" => Ok(Self::RozajeMunicipality),
- "tivat municipality" => Ok(Self::TivatMunicipality),
- "ulcinj municipality" => Ok(Self::UlcinjMunicipality),
- "savnik municipality" => Ok(Self::SavnikMunicipality),
- "zabljak municipality" => Ok(Self::ZabljakMunicipality),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Andrijevica Municipality" => Ok(Self::AndrijevicaMunicipality),
+ "Bar Municipality" => Ok(Self::BarMunicipality),
+ "Berane Municipality" => Ok(Self::BeraneMunicipality),
+ "Bijelo Polje Municipality" => Ok(Self::BijeloPoljeMunicipality),
+ "Budva Municipality" => Ok(Self::BudvaMunicipality),
+ "Danilovgrad Municipality" => Ok(Self::DanilovgradMunicipality),
+ "Gusinje Municipality" => Ok(Self::GusinjeMunicipality),
+ "Kolašin Municipality" => Ok(Self::KolasinMunicipality),
+ "Kotor Municipality" => Ok(Self::KotorMunicipality),
+ "Mojkovac Municipality" => Ok(Self::MojkovacMunicipality),
+ "Nikšić Municipality" => Ok(Self::NiksicMunicipality),
+ "Petnjica Municipality" => Ok(Self::PetnjicaMunicipality),
+ "Plav Municipality" => Ok(Self::PlavMunicipality),
+ "Pljevlja Municipality" => Ok(Self::PljevljaMunicipality),
+ "Plužine Municipality" => Ok(Self::PlužineMunicipality),
+ "Podgorica Municipality" => Ok(Self::PodgoricaMunicipality),
+ "Rožaje Municipality" => Ok(Self::RožajeMunicipality),
+ "Tivat Municipality" => Ok(Self::TivatMunicipality),
+ "Ulcinj Municipality" => Ok(Self::UlcinjMunicipality),
+ "Žabljak Municipality" => Ok(Self::ŽabljakMunicipality),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3133,20 +3202,16 @@ impl ForeignTryFrom<String> for MonacoStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "MonacoStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "MonacoStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "monaco" => Ok(Self::Monaco),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Monaco" => Ok(Self::Monaco),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3154,37 +3219,31 @@ impl ForeignTryFrom<String> for MonacoStatesAbbreviation {
impl ForeignTryFrom<String> for NetherlandsStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "NetherlandsStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "NetherlandsStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "bonaire" => Ok(Self::Bonaire),
- "drenthe" => Ok(Self::Drenthe),
- "flevoland" => Ok(Self::Flevoland),
- "friesland" => Ok(Self::Friesland),
- "gelderland" => Ok(Self::Gelderland),
- "groningen" => Ok(Self::Groningen),
- "limburg" => Ok(Self::Limburg),
- "north brabant" => Ok(Self::NorthBrabant),
- "north holland" => Ok(Self::NorthHolland),
- "overijssel" => Ok(Self::Overijssel),
- "saba" => Ok(Self::Saba),
- "sint eustatius" => Ok(Self::SintEustatius),
- "south holland" => Ok(Self::SouthHolland),
- "utrecht" => Ok(Self::Utrecht),
- "zeeland" => Ok(Self::Zeeland),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Bonaire" => Ok(Self::Bonaire),
+ "Drenthe" => Ok(Self::Drenthe),
+ "Flevoland" => Ok(Self::Flevoland),
+ "Friesland" => Ok(Self::Friesland),
+ "Gelderland" => Ok(Self::Gelderland),
+ "Groningen" => Ok(Self::Groningen),
+ "Limburg" => Ok(Self::Limburg),
+ "North Brabant" => Ok(Self::NorthBrabant),
+ "North Holland" => Ok(Self::NorthHolland),
+ "Overijssel" => Ok(Self::Overijssel),
+ "Saba" => Ok(Self::Saba),
+ "Sint Eustatius" => Ok(Self::SintEustatius),
+ "South Holland" => Ok(Self::SouthHolland),
+ "Utrecht" => Ok(Self::Utrecht),
+ "Zeeland" => Ok(Self::Zeeland),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3192,60 +3251,54 @@ impl ForeignTryFrom<String> for NetherlandsStatesAbbreviation {
impl ForeignTryFrom<String> for MoldovaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "MoldovaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "MoldovaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "anenii noi district" => Ok(Self::AneniiNoiDistrict),
- "basarabeasca district" => Ok(Self::BasarabeascaDistrict),
- "bender municipality" => Ok(Self::BenderMunicipality),
- "briceni district" => Ok(Self::BriceniDistrict),
- "balti municipality" => Ok(Self::BaltiMunicipality),
- "cahul district" => Ok(Self::CahulDistrict),
- "cantemir district" => Ok(Self::CantemirDistrict),
- "chisinau municipality" => Ok(Self::ChisinauMunicipality),
- "cimislia district" => Ok(Self::CimisliaDistrict),
- "criuleni district" => Ok(Self::CriuleniDistrict),
- "calarasi district" => Ok(Self::CalarasiDistrict),
- "causeni district" => Ok(Self::CauseniDistrict),
- "donduseni district" => Ok(Self::DonduseniDistrict),
- "drochia district" => Ok(Self::DrochiaDistrict),
- "dubasari district" => Ok(Self::DubasariDistrict),
- "edinet district" => Ok(Self::EdinetDistrict),
- "floresti district" => Ok(Self::FlorestiDistrict),
- "falesti district" => Ok(Self::FalestiDistrict),
- "gagauzia" => Ok(Self::Gagauzia),
- "glodeni district" => Ok(Self::GlodeniDistrict),
- "hincesti district" => Ok(Self::HincestiDistrict),
- "ialoveni district" => Ok(Self::IaloveniDistrict),
- "nisporeni district" => Ok(Self::NisporeniDistrict),
- "ocnita district" => Ok(Self::OcnitaDistrict),
- "orhei district" => Ok(Self::OrheiDistrict),
- "rezina district" => Ok(Self::RezinaDistrict),
- "riscani district" => Ok(Self::RiscaniDistrict),
- "soroca district" => Ok(Self::SorocaDistrict),
- "straseni district" => Ok(Self::StraseniDistrict),
- "singerei district" => Ok(Self::SingereiDistrict),
- "taraclia district" => Ok(Self::TaracliaDistrict),
- "telenesti district" => Ok(Self::TelenestiDistrict),
- "transnistria autonomous territorial unit" => {
- Ok(Self::TransnistriaAutonomousTerritorialUnit)
- }
- "ungheni district" => Ok(Self::UngheniDistrict),
- "soldanesti district" => Ok(Self::SoldanestiDistrict),
- "stefan voda district" => Ok(Self::StefanVodaDistrict),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Anenii Noi District" => Ok(Self::AneniiNoiDistrict),
+ "Basarabeasca District" => Ok(Self::BasarabeascaDistrict),
+ "Bender Municipality" => Ok(Self::BenderMunicipality),
+ "Briceni District" => Ok(Self::BriceniDistrict),
+ "Bălți Municipality" => Ok(Self::BălțiMunicipality),
+ "Cahul District" => Ok(Self::CahulDistrict),
+ "Cantemir District" => Ok(Self::CantemirDistrict),
+ "Chișinău Municipality" => Ok(Self::ChișinăuMunicipality),
+ "Cimișlia District" => Ok(Self::CimișliaDistrict),
+ "Criuleni District" => Ok(Self::CriuleniDistrict),
+ "Călărași District" => Ok(Self::CălărașiDistrict),
+ "Căușeni District" => Ok(Self::CăușeniDistrict),
+ "Dondușeni District" => Ok(Self::DondușeniDistrict),
+ "Drochia District" => Ok(Self::DrochiaDistrict),
+ "Dubăsari District" => Ok(Self::DubăsariDistrict),
+ "Edineț District" => Ok(Self::EdinețDistrict),
+ "Florești District" => Ok(Self::FloreștiDistrict),
+ "Fălești District" => Ok(Self::FăleștiDistrict),
+ "Găgăuzia" => Ok(Self::Găgăuzia),
+ "Glodeni District" => Ok(Self::GlodeniDistrict),
+ "Hîncești District" => Ok(Self::HînceștiDistrict),
+ "Ialoveni District" => Ok(Self::IaloveniDistrict),
+ "Nisporeni District" => Ok(Self::NisporeniDistrict),
+ "Ocnița District" => Ok(Self::OcnițaDistrict),
+ "Orhei District" => Ok(Self::OrheiDistrict),
+ "Rezina District" => Ok(Self::RezinaDistrict),
+ "Rîșcani District" => Ok(Self::RîșcaniDistrict),
+ "Soroca District" => Ok(Self::SorocaDistrict),
+ "Strășeni District" => Ok(Self::StrășeniDistrict),
+ "Sîngerei District" => Ok(Self::SîngereiDistrict),
+ "Taraclia District" => Ok(Self::TaracliaDistrict),
+ "Telenești District" => Ok(Self::TeleneștiDistrict),
+ "Transnistria Autonomous Territorial Unit" => {
+ Ok(Self::TransnistriaAutonomousTerritorialUnit)
}
- }
+ "Ungheni District" => Ok(Self::UngheniDistrict),
+ "Șoldănești District" => Ok(Self::ȘoldăneștiDistrict),
+ "Ștefan Vodă District" => Ok(Self::ȘtefanVodăDistrict),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
+ }
+ .into()),
+ },
}
}
}
@@ -3253,99 +3306,85 @@ impl ForeignTryFrom<String> for MoldovaStatesAbbreviation {
impl ForeignTryFrom<String> for LithuaniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "LithuaniaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "LithuaniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "akmene district municipality" => Ok(Self::AkmeneDistrictMunicipality),
- "alytus city municipality" => Ok(Self::AlytusCityMunicipality),
- "alytus county" => Ok(Self::AlytusCounty),
- "alytus district municipality" => Ok(Self::AlytusDistrictMunicipality),
- "birstonas municipality" => Ok(Self::BirstonasMunicipality),
- "birzai district municipality" => Ok(Self::BirzaiDistrictMunicipality),
- "druskininkai municipality" => Ok(Self::DruskininkaiMunicipality),
- "elektrenai municipality" => Ok(Self::ElektrenaiMunicipality),
- "ignalina district municipality" => Ok(Self::IgnalinaDistrictMunicipality),
- "jonava district municipality" => Ok(Self::JonavaDistrictMunicipality),
- "joniskis district municipality" => Ok(Self::JoniskisDistrictMunicipality),
- "jurbarkas district municipality" => Ok(Self::JurbarkasDistrictMunicipality),
- "kaisiadorys district municipality" => {
- Ok(Self::KaisiadorysDistrictMunicipality)
- }
- "kalvarija municipality" => Ok(Self::KalvarijaMunicipality),
- "kaunas city municipality" => Ok(Self::KaunasCityMunicipality),
- "kaunas county" => Ok(Self::KaunasCounty),
- "kaunas district municipality" => Ok(Self::KaunasDistrictMunicipality),
- "kazlu ruda municipality" => Ok(Self::KazluRudaMunicipality),
- "kelme district municipality" => Ok(Self::KelmeDistrictMunicipality),
- "klaipeda city municipality" => Ok(Self::KlaipedaCityMunicipality),
- "klaipeda county" => Ok(Self::KlaipedaCounty),
- "klaipeda district municipality" => Ok(Self::KlaipedaDistrictMunicipality),
- "kretinga district municipality" => Ok(Self::KretingaDistrictMunicipality),
- "kupiskis district municipality" => Ok(Self::KupiskisDistrictMunicipality),
- "kedainiai district municipality" => Ok(Self::KedainiaiDistrictMunicipality),
- "lazdijai district municipality" => Ok(Self::LazdijaiDistrictMunicipality),
- "marijampole county" => Ok(Self::MarijampoleCounty),
- "marijampole municipality" => Ok(Self::MarijampoleMunicipality),
- "mazeikiai district municipality" => Ok(Self::MazeikiaiDistrictMunicipality),
- "moletai district municipality" => Ok(Self::MoletaiDistrictMunicipality),
- "neringa municipality" => Ok(Self::NeringaMunicipality),
- "pagegiai municipality" => Ok(Self::PagegiaiMunicipality),
- "pakruojis district municipality" => Ok(Self::PakruojisDistrictMunicipality),
- "palanga city municipality" => Ok(Self::PalangaCityMunicipality),
- "panevezys city municipality" => Ok(Self::PanevezysCityMunicipality),
- "panevezys county" => Ok(Self::PanevezysCounty),
- "panevezys district municipality" => Ok(Self::PanevezysDistrictMunicipality),
- "pasvalys district municipality" => Ok(Self::PasvalysDistrictMunicipality),
- "plunge district municipality" => Ok(Self::PlungeDistrictMunicipality),
- "prienai district municipality" => Ok(Self::PrienaiDistrictMunicipality),
- "radviliskis district municipality" => {
- Ok(Self::RadviliskisDistrictMunicipality)
- }
- "raseiniai district municipality" => Ok(Self::RaseiniaiDistrictMunicipality),
- "rietavas municipality" => Ok(Self::RietavasMunicipality),
- "rokiskis district municipality" => Ok(Self::RokiskisDistrictMunicipality),
- "skuodas district municipality" => Ok(Self::SkuodasDistrictMunicipality),
- "taurage county" => Ok(Self::TaurageCounty),
- "taurage district municipality" => Ok(Self::TaurageDistrictMunicipality),
- "telsiai county" => Ok(Self::TelsiaiCounty),
- "telsiai district municipality" => Ok(Self::TelsiaiDistrictMunicipality),
- "trakai district municipality" => Ok(Self::TrakaiDistrictMunicipality),
- "ukmerge district municipality" => Ok(Self::UkmergeDistrictMunicipality),
- "utena county" => Ok(Self::UtenaCounty),
- "utena district municipality" => Ok(Self::UtenaDistrictMunicipality),
- "varena district municipality" => Ok(Self::VarenaDistrictMunicipality),
- "vilkaviskis district municipality" => {
- Ok(Self::VilkaviskisDistrictMunicipality)
- }
- "vilnius city municipality" => Ok(Self::VilniusCityMunicipality),
- "vilnius county" => Ok(Self::VilniusCounty),
- "vilnius district municipality" => Ok(Self::VilniusDistrictMunicipality),
- "visaginas municipality" => Ok(Self::VisaginasMunicipality),
- "zarasai district municipality" => Ok(Self::ZarasaiDistrictMunicipality),
- "sakiai district municipality" => Ok(Self::SakiaiDistrictMunicipality),
- "salcininkai district municipality" => {
- Ok(Self::SalcininkaiDistrictMunicipality)
- }
- "siauliai city municipality" => Ok(Self::SiauliaiCityMunicipality),
- "siauliai county" => Ok(Self::SiauliaiCounty),
- "siauliai district municipality" => Ok(Self::SiauliaiDistrictMunicipality),
- "silale district municipality" => Ok(Self::SilaleDistrictMunicipality),
- "silute district municipality" => Ok(Self::SiluteDistrictMunicipality),
- "sirvintos district municipality" => Ok(Self::SirvintosDistrictMunicipality),
- "svencionys district municipality" => Ok(Self::SvencionysDistrictMunicipality),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Akmenė District Municipality" => Ok(Self::AkmeneDistrictMunicipality),
+ "Alytus City Municipality" => Ok(Self::AlytusCityMunicipality),
+ "Alytus County" => Ok(Self::AlytusCounty),
+ "Alytus District Municipality" => Ok(Self::AlytusDistrictMunicipality),
+ "Birštonas Municipality" => Ok(Self::BirstonasMunicipality),
+ "Biržai District Municipality" => Ok(Self::BirzaiDistrictMunicipality),
+ "Druskininkai municipality" => Ok(Self::DruskininkaiMunicipality),
+ "Elektrėnai municipality" => Ok(Self::ElektrenaiMunicipality),
+ "Ignalina District Municipality" => Ok(Self::IgnalinaDistrictMunicipality),
+ "Jonava District Municipality" => Ok(Self::JonavaDistrictMunicipality),
+ "Joniškis District Municipality" => Ok(Self::JoniskisDistrictMunicipality),
+ "Jurbarkas District Municipality" => Ok(Self::JurbarkasDistrictMunicipality),
+ "Kaišiadorys District Municipality" => Ok(Self::KaisiadorysDistrictMunicipality),
+ "Kalvarija municipality" => Ok(Self::KalvarijaMunicipality),
+ "Kaunas City Municipality" => Ok(Self::KaunasCityMunicipality),
+ "Kaunas County" => Ok(Self::KaunasCounty),
+ "Kaunas District Municipality" => Ok(Self::KaunasDistrictMunicipality),
+ "Kazlų Rūda municipality" => Ok(Self::KazluRudaMunicipality),
+ "Kelmė District Municipality" => Ok(Self::KelmeDistrictMunicipality),
+ "Klaipeda City Municipality" => Ok(Self::KlaipedaCityMunicipality),
+ "Klaipėda County" => Ok(Self::KlaipedaCounty),
+ "Klaipėda District Municipality" => Ok(Self::KlaipedaDistrictMunicipality),
+ "Kretinga District Municipality" => Ok(Self::KretingaDistrictMunicipality),
+ "Kupiškis District Municipality" => Ok(Self::KupiskisDistrictMunicipality),
+ "Kėdainiai District Municipality" => Ok(Self::KedainiaiDistrictMunicipality),
+ "Lazdijai District Municipality" => Ok(Self::LazdijaiDistrictMunicipality),
+ "Marijampolė County" => Ok(Self::MarijampoleCounty),
+ "Marijampolė Municipality" => Ok(Self::MarijampoleMunicipality),
+ "Mažeikiai District Municipality" => Ok(Self::MazeikiaiDistrictMunicipality),
+ "Molėtai District Municipality" => Ok(Self::MoletaiDistrictMunicipality),
+ "Neringa Municipality" => Ok(Self::NeringaMunicipality),
+ "Pagėgiai municipality" => Ok(Self::PagegiaiMunicipality),
+ "Pakruojis District Municipality" => Ok(Self::PakruojisDistrictMunicipality),
+ "Palanga City Municipality" => Ok(Self::PalangaCityMunicipality),
+ "Panevėžys City Municipality" => Ok(Self::PanevezysCityMunicipality),
+ "Panevėžys County" => Ok(Self::PanevezysCounty),
+ "Panevėžys District Municipality" => Ok(Self::PanevezysDistrictMunicipality),
+ "Pasvalys District Municipality" => Ok(Self::PasvalysDistrictMunicipality),
+ "Plungė District Municipality" => Ok(Self::PlungeDistrictMunicipality),
+ "Prienai District Municipality" => Ok(Self::PrienaiDistrictMunicipality),
+ "Radviliškis District Municipality" => Ok(Self::RadviliskisDistrictMunicipality),
+ "Raseiniai District Municipality" => Ok(Self::RaseiniaiDistrictMunicipality),
+ "Rietavas municipality" => Ok(Self::RietavasMunicipality),
+ "Rokiškis District Municipality" => Ok(Self::RokiskisDistrictMunicipality),
+ "Skuodas District Municipality" => Ok(Self::SkuodasDistrictMunicipality),
+ "Tauragė County" => Ok(Self::TaurageCounty),
+ "Tauragė District Municipality" => Ok(Self::TaurageDistrictMunicipality),
+ "Telšiai County" => Ok(Self::TelsiaiCounty),
+ "Telšiai District Municipality" => Ok(Self::TelsiaiDistrictMunicipality),
+ "Trakai District Municipality" => Ok(Self::TrakaiDistrictMunicipality),
+ "Ukmergė District Municipality" => Ok(Self::UkmergeDistrictMunicipality),
+ "Utena County" => Ok(Self::UtenaCounty),
+ "Utena District Municipality" => Ok(Self::UtenaDistrictMunicipality),
+ "Varėna District Municipality" => Ok(Self::VarenaDistrictMunicipality),
+ "Vilkaviškis District Municipality" => Ok(Self::VilkaviskisDistrictMunicipality),
+ "Vilnius City Municipality" => Ok(Self::VilniusCityMunicipality),
+ "Vilnius County" => Ok(Self::VilniusCounty),
+ "Vilnius District Municipality" => Ok(Self::VilniusDistrictMunicipality),
+ "Visaginas Municipality" => Ok(Self::VisaginasMunicipality),
+ "Zarasai District Municipality" => Ok(Self::ZarasaiDistrictMunicipality),
+ "Šakiai District Municipality" => Ok(Self::SakiaiDistrictMunicipality),
+ "Šalčininkai District Municipality" => Ok(Self::SalcininkaiDistrictMunicipality),
+ "Šiauliai City Municipality" => Ok(Self::SiauliaiCityMunicipality),
+ "Šiauliai County" => Ok(Self::SiauliaiCounty),
+ "Šiauliai District Municipality" => Ok(Self::SiauliaiDistrictMunicipality),
+ "Šilalė District Municipality" => Ok(Self::SilaleDistrictMunicipality),
+ "Šilutė District Municipality" => Ok(Self::SiluteDistrictMunicipality),
+ "Širvintos District Municipality" => Ok(Self::SirvintosDistrictMunicipality),
+ "Švenčionys District Municipality" => Ok(Self::SvencionysDistrictMunicipality),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3353,33 +3392,27 @@ impl ForeignTryFrom<String> for LithuaniaStatesAbbreviation {
impl ForeignTryFrom<String> for LiechtensteinStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "LiechtensteinStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "LiechtensteinStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "balzers" => Ok(Self::Balzers),
- "eschen" => Ok(Self::Eschen),
- "gamprin" => Ok(Self::Gamprin),
- "mauren" => Ok(Self::Mauren),
- "planken" => Ok(Self::Planken),
- "ruggell" => Ok(Self::Ruggell),
- "schaan" => Ok(Self::Schaan),
- "schellenberg" => Ok(Self::Schellenberg),
- "triesen" => Ok(Self::Triesen),
- "triesenberg" => Ok(Self::Triesenberg),
- "vaduz" => Ok(Self::Vaduz),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Balzers" => Ok(Self::Balzers),
+ "Eschen" => Ok(Self::Eschen),
+ "Gamprin" => Ok(Self::Gamprin),
+ "Mauren" => Ok(Self::Mauren),
+ "Planken" => Ok(Self::Planken),
+ "Ruggell" => Ok(Self::Ruggell),
+ "Schaan" => Ok(Self::Schaan),
+ "Schellenberg" => Ok(Self::Schellenberg),
+ "Triesen" => Ok(Self::Triesen),
+ "Triesenberg" => Ok(Self::Triesenberg),
+ "Vaduz" => Ok(Self::Vaduz),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3388,118 +3421,114 @@ impl ForeignTryFrom<String> for LatviaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "LatviaStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "LatviaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "aglona municipality" => Ok(Self::AglonaMunicipality),
- "aizkraukle municipality" => Ok(Self::AizkraukleMunicipality),
- "aizpute municipality" => Ok(Self::AizputeMunicipality),
- "akniiste municipality" => Ok(Self::AknīsteMunicipality),
- "aloja municipality" => Ok(Self::AlojaMunicipality),
- "alsunga municipality" => Ok(Self::AlsungaMunicipality),
- "aluksne municipality" => Ok(Self::AlūksneMunicipality),
- "amata municipality" => Ok(Self::AmataMunicipality),
- "ape municipality" => Ok(Self::ApeMunicipality),
- "auce municipality" => Ok(Self::AuceMunicipality),
- "babite municipality" => Ok(Self::BabīteMunicipality),
- "baldone municipality" => Ok(Self::BaldoneMunicipality),
- "baltinava municipality" => Ok(Self::BaltinavaMunicipality),
- "balvi municipality" => Ok(Self::BalviMunicipality),
- "bauska municipality" => Ok(Self::BauskaMunicipality),
- "beverina municipality" => Ok(Self::BeverīnaMunicipality),
- "broceni municipality" => Ok(Self::BrocēniMunicipality),
- "burtnieki municipality" => Ok(Self::BurtniekiMunicipality),
- "carnikava municipality" => Ok(Self::CarnikavaMunicipality),
- "cesvaine municipality" => Ok(Self::CesvaineMunicipality),
- "cibla municipality" => Ok(Self::CiblaMunicipality),
- "cesis municipality" => Ok(Self::CēsisMunicipality),
- "dagda municipality" => Ok(Self::DagdaMunicipality),
- "daugavpils" => Ok(Self::Daugavpils),
- "daugavpils municipality" => Ok(Self::DaugavpilsMunicipality),
- "dobele municipality" => Ok(Self::DobeleMunicipality),
- "dundaga municipality" => Ok(Self::DundagaMunicipality),
- "durbe municipality" => Ok(Self::DurbeMunicipality),
- "engure municipality" => Ok(Self::EngureMunicipality),
- "garkalne municipality" => Ok(Self::GarkalneMunicipality),
- "grobina municipality" => Ok(Self::GrobiņaMunicipality),
- "gulbene municipality" => Ok(Self::GulbeneMunicipality),
- "iecava municipality" => Ok(Self::IecavaMunicipality),
- "ikskile municipality" => Ok(Self::IkšķileMunicipality),
- "ilukste municipality" => Ok(Self::IlūksteMunicipality),
- "incukalns municipality" => Ok(Self::InčukalnsMunicipality),
- "jaunjelgava municipality" => Ok(Self::JaunjelgavaMunicipality),
- "jaunpiebalga municipality" => Ok(Self::JaunpiebalgaMunicipality),
- "jaunpils municipality" => Ok(Self::JaunpilsMunicipality),
- "jelgava" => Ok(Self::Jelgava),
- "jelgava municipality" => Ok(Self::JelgavaMunicipality),
- "jekabpils" => Ok(Self::Jēkabpils),
- "jekabpils municipality" => Ok(Self::JēkabpilsMunicipality),
- "jurmala" => Ok(Self::Jūrmala),
- "kandava municipality" => Ok(Self::KandavaMunicipality),
- "koceni municipality" => Ok(Self::KocēniMunicipality),
- "koknese municipality" => Ok(Self::KokneseMunicipality),
- "krimulda municipality" => Ok(Self::KrimuldaMunicipality),
- "kustpils municipality" => Ok(Self::KrustpilsMunicipality),
- "kraslava municipality" => Ok(Self::KrāslavaMunicipality),
- "kuldiga municipality" => Ok(Self::KuldīgaMunicipality),
- "karsava municipality" => Ok(Self::KārsavaMunicipality),
- "lielvarde municipality" => Ok(Self::LielvārdeMunicipality),
- "liepaja" => Ok(Self::Liepāja),
- "limbazi municipality" => Ok(Self::LimbažiMunicipality),
- "lubana municipality" => Ok(Self::LubānaMunicipality),
- "ludza municipality" => Ok(Self::LudzaMunicipality),
- "ligatne municipality" => Ok(Self::LīgatneMunicipality),
- "livani municipality" => Ok(Self::LīvāniMunicipality),
- "madona municipality" => Ok(Self::MadonaMunicipality),
- "mazsalaca municipality" => Ok(Self::MazsalacaMunicipality),
- "malpils municipality" => Ok(Self::MālpilsMunicipality),
- "marupe municipality" => Ok(Self::MārupeMunicipality),
- "mersrags municipality" => Ok(Self::MērsragsMunicipality),
- "naukseni municipality" => Ok(Self::NaukšēniMunicipality),
- "nereta municipality" => Ok(Self::NeretaMunicipality),
- "nica municipality" => Ok(Self::NīcaMunicipality),
- "ogre municipality" => Ok(Self::OgreMunicipality),
- "olaine municipality" => Ok(Self::OlaineMunicipality),
- "ozolnieki municipality" => Ok(Self::OzolniekiMunicipality),
- "preili municipality" => Ok(Self::PreiļiMunicipality),
- "priekule municipality" => Ok(Self::PriekuleMunicipality),
- "priekuli municipality" => Ok(Self::PriekuļiMunicipality),
- "pargauja municipality" => Ok(Self::PārgaujaMunicipality),
- "pavilosta municipality" => Ok(Self::PāvilostaMunicipality),
- "plavinas municipality" => Ok(Self::PļaviņasMunicipality),
- "rauna municipality" => Ok(Self::RaunaMunicipality),
- "riebini municipality" => Ok(Self::RiebiņiMunicipality),
- "riga" => Ok(Self::Riga),
- "roja municipality" => Ok(Self::RojaMunicipality),
- "ropazi municipality" => Ok(Self::RopažiMunicipality),
- "rucava municipality" => Ok(Self::RucavaMunicipality),
- "rugaji municipality" => Ok(Self::RugājiMunicipality),
- "rundale municipality" => Ok(Self::RundāleMunicipality),
- "rezekne" => Ok(Self::Rēzekne),
- "rezekne municipality" => Ok(Self::RēzekneMunicipality),
- "rujiena municipality" => Ok(Self::RūjienaMunicipality),
- "sala municipality" => Ok(Self::SalaMunicipality),
- "salacgriva municipality" => Ok(Self::SalacgrīvaMunicipality),
- "salaspils municipality" => Ok(Self::SalaspilsMunicipality),
- "saldus municipality" => Ok(Self::SaldusMunicipality),
- "saulkrasti municipality" => Ok(Self::SaulkrastiMunicipality),
- "sigulda municipality" => Ok(Self::SiguldaMunicipality),
- "skrunda municipality" => Ok(Self::SkrundaMunicipality),
- "skriveri municipality" => Ok(Self::SkrīveriMunicipality),
- "smiltene municipality" => Ok(Self::SmilteneMunicipality),
- "stopini municipality" => Ok(Self::StopiņiMunicipality),
- "strenci municipality" => Ok(Self::StrenčiMunicipality),
- "seja municipality" => Ok(Self::SējaMunicipality),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Aglona Municipality" => Ok(Self::AglonaMunicipality),
+ "Aizkraukle Municipality" => Ok(Self::AizkraukleMunicipality),
+ "Aizpute Municipality" => Ok(Self::AizputeMunicipality),
+ "Aknīste Municipality" => Ok(Self::AknīsteMunicipality),
+ "Aloja Municipality" => Ok(Self::AlojaMunicipality),
+ "Alsunga Municipality" => Ok(Self::AlsungaMunicipality),
+ "Alūksne Municipality" => Ok(Self::AlūksneMunicipality),
+ "Amata Municipality" => Ok(Self::AmataMunicipality),
+ "Ape Municipality" => Ok(Self::ApeMunicipality),
+ "Auce Municipality" => Ok(Self::AuceMunicipality),
+ "Babīte Municipality" => Ok(Self::BabīteMunicipality),
+ "Baldone Municipality" => Ok(Self::BaldoneMunicipality),
+ "Baltinava Municipality" => Ok(Self::BaltinavaMunicipality),
+ "Balvi Municipality" => Ok(Self::BalviMunicipality),
+ "Bauska Municipality" => Ok(Self::BauskaMunicipality),
+ "Beverīna Municipality" => Ok(Self::BeverīnaMunicipality),
+ "Brocēni Municipality" => Ok(Self::BrocēniMunicipality),
+ "Burtnieki Municipality" => Ok(Self::BurtniekiMunicipality),
+ "Carnikava Municipality" => Ok(Self::CarnikavaMunicipality),
+ "Cesvaine Municipality" => Ok(Self::CesvaineMunicipality),
+ "Cibla Municipality" => Ok(Self::CiblaMunicipality),
+ "Cēsis Municipality" => Ok(Self::CēsisMunicipality),
+ "Dagda Municipality" => Ok(Self::DagdaMunicipality),
+ "Daugavpils" => Ok(Self::Daugavpils),
+ "Daugavpils Municipality" => Ok(Self::DaugavpilsMunicipality),
+ "Dobele Municipality" => Ok(Self::DobeleMunicipality),
+ "Dundaga Municipality" => Ok(Self::DundagaMunicipality),
+ "Durbe Municipality" => Ok(Self::DurbeMunicipality),
+ "Engure Municipality" => Ok(Self::EngureMunicipality),
+ "Garkalne Municipality" => Ok(Self::GarkalneMunicipality),
+ "Grobiņa Municipality" => Ok(Self::GrobiņaMunicipality),
+ "Gulbene Municipality" => Ok(Self::GulbeneMunicipality),
+ "Iecava Municipality" => Ok(Self::IecavaMunicipality),
+ "Ikšķile Municipality" => Ok(Self::IkšķileMunicipality),
+ "Ilūkste Municipalityy" => Ok(Self::IlūksteMunicipality),
+ "Inčukalns Municipality" => Ok(Self::InčukalnsMunicipality),
+ "Jaunjelgava Municipality" => Ok(Self::JaunjelgavaMunicipality),
+ "Jaunpiebalga Municipality" => Ok(Self::JaunpiebalgaMunicipality),
+ "Jaunpils Municipality" => Ok(Self::JaunpilsMunicipality),
+ "Jelgava" => Ok(Self::Jelgava),
+ "Jelgava Municipality" => Ok(Self::JelgavaMunicipality),
+ "Jēkabpils" => Ok(Self::Jēkabpils),
+ "Jēkabpils Municipality" => Ok(Self::JēkabpilsMunicipality),
+ "Jūrmala" => Ok(Self::Jūrmala),
+ "Kandava Municipality" => Ok(Self::KandavaMunicipality),
+ "Kocēni Municipality" => Ok(Self::KocēniMunicipality),
+ "Koknese Municipality" => Ok(Self::KokneseMunicipality),
+ "Krimulda Municipality" => Ok(Self::KrimuldaMunicipality),
+ "Krustpils Municipality" => Ok(Self::KrustpilsMunicipality),
+ "Krāslava Municipality" => Ok(Self::KrāslavaMunicipality),
+ "Kuldīga Municipality" => Ok(Self::KuldīgaMunicipality),
+ "Kārsava Municipality" => Ok(Self::KārsavaMunicipality),
+ "Lielvārde Municipality" => Ok(Self::LielvārdeMunicipality),
+ "Liepāja" => Ok(Self::Liepāja),
+ "Limbaži Municipality" => Ok(Self::LimbažiMunicipality),
+ "Lubāna Municipality" => Ok(Self::LubānaMunicipality),
+ "Ludza Municipality" => Ok(Self::LudzaMunicipality),
+ "Līgatne Municipality" => Ok(Self::LīgatneMunicipality),
+ "Līvāni Municipality" => Ok(Self::LīvāniMunicipality),
+ "Madona Municipality" => Ok(Self::MadonaMunicipality),
+ "Mazsalaca Municipality" => Ok(Self::MazsalacaMunicipality),
+ "Mālpils Municipality" => Ok(Self::MālpilsMunicipality),
+ "Mārupe Municipality" => Ok(Self::MārupeMunicipality),
+ "Mērsrags Municipality" => Ok(Self::MērsragsMunicipality),
+ "Naukšēni Municipality" => Ok(Self::NaukšēniMunicipality),
+ "Nereta Municipality" => Ok(Self::NeretaMunicipality),
+ "Nīca Municipality" => Ok(Self::NīcaMunicipality),
+ "Ogre Municipality" => Ok(Self::OgreMunicipality),
+ "Olaine Municipality" => Ok(Self::OlaineMunicipality),
+ "Ozolnieki Municipality" => Ok(Self::OzolniekiMunicipality),
+ "Preiļi Municipality" => Ok(Self::PreiļiMunicipality),
+ "Priekule Municipality" => Ok(Self::PriekuleMunicipality),
+ "Priekuļi Municipality" => Ok(Self::PriekuļiMunicipality),
+ "Pārgauja Municipality" => Ok(Self::PārgaujaMunicipality),
+ "Pāvilosta Municipality" => Ok(Self::PāvilostaMunicipality),
+ "Pļaviņas Municipality" => Ok(Self::PļaviņasMunicipality),
+ "Rauna Municipality" => Ok(Self::RaunaMunicipality),
+ "Riebiņi Municipality" => Ok(Self::RiebiņiMunicipality),
+ "Riga" => Ok(Self::Riga),
+ "Roja Municipality" => Ok(Self::RojaMunicipality),
+ "Ropaži Municipality" => Ok(Self::RopažiMunicipality),
+ "Rucava Municipality" => Ok(Self::RucavaMunicipality),
+ "Rugāji Municipality" => Ok(Self::RugājiMunicipality),
+ "Rundāle Municipality" => Ok(Self::RundāleMunicipality),
+ "Rēzekne" => Ok(Self::Rēzekne),
+ "Rēzekne Municipality" => Ok(Self::RēzekneMunicipality),
+ "Rūjiena Municipality" => Ok(Self::RūjienaMunicipality),
+ "Sala Municipality" => Ok(Self::SalaMunicipality),
+ "Salacgrīva Municipality" => Ok(Self::SalacgrīvaMunicipality),
+ "Salaspils Municipality" => Ok(Self::SalaspilsMunicipality),
+ "Saldus Municipality" => Ok(Self::SaldusMunicipality),
+ "Saulkrasti Municipality" => Ok(Self::SaulkrastiMunicipality),
+ "Sigulda Municipality" => Ok(Self::SiguldaMunicipality),
+ "Skrunda Municipality" => Ok(Self::SkrundaMunicipality),
+ "Skrīveri Municipality" => Ok(Self::SkrīveriMunicipality),
+ "Smiltene Municipality" => Ok(Self::SmilteneMunicipality),
+ "Stopiņi Municipality" => Ok(Self::StopiņiMunicipality),
+ "Strenči Municipality" => Ok(Self::StrenčiMunicipality),
+ "Sēja Municipality" => Ok(Self::SējaMunicipality),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3508,87 +3537,83 @@ impl ForeignTryFrom<String> for MaltaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "MaltaStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "MaltaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "attard" => Ok(Self::Attard),
- "balzan" => Ok(Self::Balzan),
- "birgu" => Ok(Self::Birgu),
- "birkirkara" => Ok(Self::Birkirkara),
- "birzebbuga" => Ok(Self::Birzebbuga),
- "cospicua" => Ok(Self::Cospicua),
- "dingli" => Ok(Self::Dingli),
- "fgura" => Ok(Self::Fgura),
- "floriana" => Ok(Self::Floriana),
- "fontana" => Ok(Self::Fontana),
- "gudja" => Ok(Self::Gudja),
- "gzira" => Ok(Self::Gzira),
- "ghajnsielem" => Ok(Self::Ghajnsielem),
- "gharb" => Ok(Self::Gharb),
- "gharghur" => Ok(Self::Gharghur),
- "ghasri" => Ok(Self::Ghasri),
- "ghaxaq" => Ok(Self::Ghaxaq),
- "hamrun" => Ok(Self::Hamrun),
- "iklin" => Ok(Self::Iklin),
- "senglea" => Ok(Self::Senglea),
- "kalkara" => Ok(Self::Kalkara),
- "kercem" => Ok(Self::Kercem),
- "kirkop" => Ok(Self::Kirkop),
- "lija" => Ok(Self::Lija),
- "luqa" => Ok(Self::Luqa),
- "marsa" => Ok(Self::Marsa),
- "marsaskala" => Ok(Self::Marsaskala),
- "marsaxlokk" => Ok(Self::Marsaxlokk),
- "mdina" => Ok(Self::Mdina),
- "mellieha" => Ok(Self::Mellieha),
- "mgarr" => Ok(Self::Mgarr),
- "mosta" => Ok(Self::Mosta),
- "mqabba" => Ok(Self::Mqabba),
- "msida" => Ok(Self::Msida),
- "mtarfa" => Ok(Self::Mtarfa),
- "munxar" => Ok(Self::Munxar),
- "nadur" => Ok(Self::Nadur),
- "naxxar" => Ok(Self::Naxxar),
- "paola" => Ok(Self::Paola),
- "pembroke" => Ok(Self::Pembroke),
- "pieta" => Ok(Self::Pieta),
- "qala" => Ok(Self::Qala),
- "qormi" => Ok(Self::Qormi),
- "qrendi" => Ok(Self::Qrendi),
- "victoria" => Ok(Self::Victoria),
- "rabat" => Ok(Self::Rabat),
- "st julians" => Ok(Self::StJulians),
- "san gwann" => Ok(Self::SanGwann),
- "saint lawrence" => Ok(Self::SaintLawrence),
- "st pauls bay" => Ok(Self::StPaulsBay),
- "sannat" => Ok(Self::Sannat),
- "santa lucija" => Ok(Self::SantaLucija),
- "santa venera" => Ok(Self::SantaVenera),
- "siggiewi" => Ok(Self::Siggiewi),
- "sliema" => Ok(Self::Sliema),
- "swieqi" => Ok(Self::Swieqi),
- "ta xbiex" => Ok(Self::TaXbiex),
- "tarxien" => Ok(Self::Tarxien),
- "valletta" => Ok(Self::Valletta),
- "xaghra" => Ok(Self::Xaghra),
- "xewkija" => Ok(Self::Xewkija),
- "xghajra" => Ok(Self::Xghajra),
- "zabbar" => Ok(Self::Zabbar),
- "zebbug gozo" => Ok(Self::ZebbugGozo),
- "zebbug malta" => Ok(Self::ZebbugMalta),
- "zejtun" => Ok(Self::Zejtun),
- "zurrieq" => Ok(Self::Zurrieq),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Attard" => Ok(Self::Attard),
+ "Balzan" => Ok(Self::Balzan),
+ "Birgu" => Ok(Self::Birgu),
+ "Birkirkara" => Ok(Self::Birkirkara),
+ "Birżebbuġa" => Ok(Self::Birżebbuġa),
+ "Cospicua" => Ok(Self::Cospicua),
+ "Dingli" => Ok(Self::Dingli),
+ "Fgura" => Ok(Self::Fgura),
+ "Floriana" => Ok(Self::Floriana),
+ "Fontana" => Ok(Self::Fontana),
+ "Gudja" => Ok(Self::Gudja),
+ "Gżira" => Ok(Self::Gżira),
+ "Għajnsielem" => Ok(Self::Għajnsielem),
+ "Għarb" => Ok(Self::Għarb),
+ "Għargħur" => Ok(Self::Għargħur),
+ "Għasri" => Ok(Self::Għasri),
+ "Għaxaq" => Ok(Self::Għaxaq),
+ "Ħamrun" => Ok(Self::Ħamrun),
+ "Iklin" => Ok(Self::Iklin),
+ "Senglea" => Ok(Self::Senglea),
+ "Kalkara" => Ok(Self::Kalkara),
+ "Kerċem" => Ok(Self::Kerċem),
+ "Kirkop" => Ok(Self::Kirkop),
+ "Lija" => Ok(Self::Lija),
+ "Luqa" => Ok(Self::Luqa),
+ "Marsa" => Ok(Self::Marsa),
+ "Marsaskala" => Ok(Self::Marsaskala),
+ "Marsaxlokk" => Ok(Self::Marsaxlokk),
+ "Mdina" => Ok(Self::Mdina),
+ "Mellieħa" => Ok(Self::Mellieħa),
+ "Mosta" => Ok(Self::Mosta),
+ "Mqabba" => Ok(Self::Mqabba),
+ "Msida" => Ok(Self::Msida),
+ "Mtarfa" => Ok(Self::Mtarfa),
+ "Munxar" => Ok(Self::Munxar),
+ "Mġarr" => Ok(Self::Mġarr),
+ "Nadur" => Ok(Self::Nadur),
+ "Naxxar" => Ok(Self::Naxxar),
+ "Paola" => Ok(Self::Paola),
+ "Pembroke" => Ok(Self::Pembroke),
+ "Pietà" => Ok(Self::Pietà),
+ "Qala" => Ok(Self::Qala),
+ "Qormi" => Ok(Self::Qormi),
+ "Qrendi" => Ok(Self::Qrendi),
+ "Rabat" => Ok(Self::Rabat),
+ "Saint Lawrence" => Ok(Self::SaintLawrence),
+ "San Ġwann" => Ok(Self::SanĠwann),
+ "Sannat" => Ok(Self::Sannat),
+ "Santa Luċija" => Ok(Self::SantaLuċija),
+ "Santa Venera" => Ok(Self::SantaVenera),
+ "Siġġiewi" => Ok(Self::Siġġiewi),
+ "Sliema" => Ok(Self::Sliema),
+ "St. Julian's" => Ok(Self::StJulians),
+ "St. Paul's Bay" => Ok(Self::StPaulsBay),
+ "Swieqi" => Ok(Self::Swieqi),
+ "Ta' Xbiex" => Ok(Self::TaXbiex),
+ "Tarxien" => Ok(Self::Tarxien),
+ "Valletta" => Ok(Self::Valletta),
+ "Victoria" => Ok(Self::Victoria),
+ "Xagħra" => Ok(Self::Xagħra),
+ "Xewkija" => Ok(Self::Xewkija),
+ "Xgħajra" => Ok(Self::Xgħajra),
+ "Żabbar" => Ok(Self::Żabbar),
+ "Żebbuġ Gozo" => Ok(Self::ŻebbuġGozo),
+ "Żebbuġ Malta" => Ok(Self::ŻebbuġMalta),
+ "Żejtun" => Ok(Self::Żejtun),
+ "Żurrieq" => Ok(Self::Żurrieq),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3596,29 +3621,23 @@ impl ForeignTryFrom<String> for MaltaStatesAbbreviation {
impl ForeignTryFrom<String> for BelarusStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "BelarusStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "BelarusStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "brest region" => Ok(Self::BrestRegion),
- "gomel region" => Ok(Self::GomelRegion),
- "grodno region" => Ok(Self::GrodnoRegion),
- "minsk" => Ok(Self::Minsk),
- "minsk region" => Ok(Self::MinskRegion),
- "mogilev region" => Ok(Self::MogilevRegion),
- "vitebsk region" => Ok(Self::VitebskRegion),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Brest Region" => Ok(Self::BrestRegion),
+ "Gomel Region" => Ok(Self::GomelRegion),
+ "Grodno Region" => Ok(Self::GrodnoRegion),
+ "Minsk" => Ok(Self::Minsk),
+ "Minsk Region" => Ok(Self::MinskRegion),
+ "Mogilev Region" => Ok(Self::MogilevRegion),
+ "Vitebsk Region" => Ok(Self::VitebskRegion),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3626,51 +3645,45 @@ impl ForeignTryFrom<String> for BelarusStatesAbbreviation {
impl ForeignTryFrom<String> for IrelandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "IrelandStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "IrelandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "connacht" => Ok(Self::Connacht),
- "county carlow" => Ok(Self::CountyCarlow),
- "county cavan" => Ok(Self::CountyCavan),
- "county clare" => Ok(Self::CountyClare),
- "county cork" => Ok(Self::CountyCork),
- "county donegal" => Ok(Self::CountyDonegal),
- "county dublin" => Ok(Self::CountyDublin),
- "county galway" => Ok(Self::CountyGalway),
- "county kerry" => Ok(Self::CountyKerry),
- "county kildare" => Ok(Self::CountyKildare),
- "county kilkenny" => Ok(Self::CountyKilkenny),
- "county laois" => Ok(Self::CountyLaois),
- "county limerick" => Ok(Self::CountyLimerick),
- "county longford" => Ok(Self::CountyLongford),
- "county louth" => Ok(Self::CountyLouth),
- "county mayo" => Ok(Self::CountyMayo),
- "county meath" => Ok(Self::CountyMeath),
- "county monaghan" => Ok(Self::CountyMonaghan),
- "county offaly" => Ok(Self::CountyOffaly),
- "county roscommon" => Ok(Self::CountyRoscommon),
- "county sligo" => Ok(Self::CountySligo),
- "county tipperary" => Ok(Self::CountyTipperary),
- "county waterford" => Ok(Self::CountyWaterford),
- "county westmeath" => Ok(Self::CountyWestmeath),
- "county wexford" => Ok(Self::CountyWexford),
- "county wicklow" => Ok(Self::CountyWicklow),
- "leinster" => Ok(Self::Leinster),
- "munster" => Ok(Self::Munster),
- "ulster" => Ok(Self::Ulster),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Connacht" => Ok(Self::Connacht),
+ "County Carlow" => Ok(Self::CountyCarlow),
+ "County Cavan" => Ok(Self::CountyCavan),
+ "County Clare" => Ok(Self::CountyClare),
+ "County Cork" => Ok(Self::CountyCork),
+ "County Donegal" => Ok(Self::CountyDonegal),
+ "County Dublin" => Ok(Self::CountyDublin),
+ "County Galway" => Ok(Self::CountyGalway),
+ "County Kerry" => Ok(Self::CountyKerry),
+ "County Kildare" => Ok(Self::CountyKildare),
+ "County Kilkenny" => Ok(Self::CountyKilkenny),
+ "County Laois" => Ok(Self::CountyLaois),
+ "County Limerick" => Ok(Self::CountyLimerick),
+ "County Longford" => Ok(Self::CountyLongford),
+ "County Louth" => Ok(Self::CountyLouth),
+ "County Mayo" => Ok(Self::CountyMayo),
+ "County Meath" => Ok(Self::CountyMeath),
+ "County Monaghan" => Ok(Self::CountyMonaghan),
+ "County Offaly" => Ok(Self::CountyOffaly),
+ "County Roscommon" => Ok(Self::CountyRoscommon),
+ "County Sligo" => Ok(Self::CountySligo),
+ "County Tipperary" => Ok(Self::CountyTipperary),
+ "County Waterford" => Ok(Self::CountyWaterford),
+ "County Westmeath" => Ok(Self::CountyWestmeath),
+ "County Wexford" => Ok(Self::CountyWexford),
+ "County Wicklow" => Ok(Self::CountyWicklow),
+ "Leinster" => Ok(Self::Leinster),
+ "Munster" => Ok(Self::Munster),
+ "Ulster" => Ok(Self::Ulster),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3678,30 +3691,24 @@ impl ForeignTryFrom<String> for IrelandStatesAbbreviation {
impl ForeignTryFrom<String> for IcelandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "IcelandStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "IcelandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "capital region" => Ok(Self::CapitalRegion),
- "eastern region" => Ok(Self::EasternRegion),
- "northeastern region" => Ok(Self::NortheasternRegion),
- "northwestern region" => Ok(Self::NorthwesternRegion),
- "southern peninsula region" => Ok(Self::SouthernPeninsulaRegion),
- "southern region" => Ok(Self::SouthernRegion),
- "western region" => Ok(Self::WesternRegion),
- "westfjords" => Ok(Self::Westfjords),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Capital Region" => Ok(Self::CapitalRegion),
+ "Eastern Region" => Ok(Self::EasternRegion),
+ "Northeastern Region" => Ok(Self::NortheasternRegion),
+ "Northwestern Region" => Ok(Self::NorthwesternRegion),
+ "Southern Peninsula Region" => Ok(Self::SouthernPeninsulaRegion),
+ "Southern Region" => Ok(Self::SouthernRegion),
+ "Western Region" => Ok(Self::WesternRegion),
+ "Westfjords" => Ok(Self::Westfjords),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3709,64 +3716,58 @@ impl ForeignTryFrom<String> for IcelandStatesAbbreviation {
impl ForeignTryFrom<String> for HungaryStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "HungaryStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "HungaryStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "baranya county" => Ok(Self::BaranyaCounty),
- "borsod abauj zemplen county" => Ok(Self::BorsodAbaujZemplenCounty),
- "budapest" => Ok(Self::Budapest),
- "bacs kiskun county" => Ok(Self::BacsKiskunCounty),
- "bekes county" => Ok(Self::BekesCounty),
- "bekescsaba" => Ok(Self::Bekescsaba),
- "csongrad county" => Ok(Self::CsongradCounty),
- "debrecen" => Ok(Self::Debrecen),
- "dunaujvaros" => Ok(Self::Dunaujvaros),
- "eger" => Ok(Self::Eger),
- "fejer county" => Ok(Self::FejerCounty),
- "gyor" => Ok(Self::Gyor),
- "gyor moson sopron county" => Ok(Self::GyorMosonSopronCounty),
- "hajdu bihar county" => Ok(Self::HajduBiharCounty),
- "heves county" => Ok(Self::HevesCounty),
- "hodmezovasarhely" => Ok(Self::Hodmezovasarhely),
- "jasz nagykun szolnok county" => Ok(Self::JaszNagykunSzolnokCounty),
- "kaposvar" => Ok(Self::Kaposvar),
- "kecskemet" => Ok(Self::Kecskemet),
- "miskolc" => Ok(Self::Miskolc),
- "nagykanizsa" => Ok(Self::Nagykanizsa),
- "nyiregyhaza" => Ok(Self::Nyiregyhaza),
- "nograd county" => Ok(Self::NogradCounty),
- "pest county" => Ok(Self::PestCounty),
- "pecs" => Ok(Self::Pecs),
- "salgotarjan" => Ok(Self::Salgotarjan),
- "somogy county" => Ok(Self::SomogyCounty),
- "sopron" => Ok(Self::Sopron),
- "szabolcs szatmar bereg county" => Ok(Self::SzabolcsSzatmarBeregCounty),
- "szeged" => Ok(Self::Szeged),
- "szekszard" => Ok(Self::Szekszard),
- "szolnok" => Ok(Self::Szolnok),
- "szombathely" => Ok(Self::Szombathely),
- "szekesfehervar" => Ok(Self::Szekesfehervar),
- "tatabanya" => Ok(Self::Tatabanya),
- "tolna county" => Ok(Self::TolnaCounty),
- "vas county" => Ok(Self::VasCounty),
- "veszprem" => Ok(Self::Veszprem),
- "veszprem county" => Ok(Self::VeszpremCounty),
- "zala county" => Ok(Self::ZalaCounty),
- "zalaegerszeg" => Ok(Self::Zalaegerszeg),
- "erd" => Ok(Self::Erd),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Baranya County" => Ok(Self::BaranyaCounty),
+ "Borsod-Abaúj-Zemplén County" => Ok(Self::BorsodAbaujZemplenCounty),
+ "Budapest" => Ok(Self::Budapest),
+ "Bács-Kiskun County" => Ok(Self::BacsKiskunCounty),
+ "Békés County" => Ok(Self::BekesCounty),
+ "Békéscsaba" => Ok(Self::Bekescsaba),
+ "Csongrád County" => Ok(Self::CsongradCounty),
+ "Debrecen" => Ok(Self::Debrecen),
+ "Dunaújváros" => Ok(Self::Dunaujvaros),
+ "Eger" => Ok(Self::Eger),
+ "Fejér County" => Ok(Self::FejerCounty),
+ "Győr" => Ok(Self::Gyor),
+ "Győr-Moson-Sopron County" => Ok(Self::GyorMosonSopronCounty),
+ "Hajdú-Bihar County" => Ok(Self::HajduBiharCounty),
+ "Heves County" => Ok(Self::HevesCounty),
+ "Hódmezővásárhely" => Ok(Self::Hodmezovasarhely),
+ "Jász-Nagykun-Szolnok County" => Ok(Self::JaszNagykunSzolnokCounty),
+ "Kaposvár" => Ok(Self::Kaposvar),
+ "Kecskemét" => Ok(Self::Kecskemet),
+ "Miskolc" => Ok(Self::Miskolc),
+ "Nagykanizsa" => Ok(Self::Nagykanizsa),
+ "Nyíregyháza" => Ok(Self::Nyiregyhaza),
+ "Nógrád County" => Ok(Self::NogradCounty),
+ "Pest County" => Ok(Self::PestCounty),
+ "Pécs" => Ok(Self::Pecs),
+ "Salgótarján" => Ok(Self::Salgotarjan),
+ "Somogy County" => Ok(Self::SomogyCounty),
+ "Sopron" => Ok(Self::Sopron),
+ "Szabolcs-Szatmár-Bereg County" => Ok(Self::SzabolcsSzatmarBeregCounty),
+ "Szeged" => Ok(Self::Szeged),
+ "Szekszárd" => Ok(Self::Szekszard),
+ "Szolnok" => Ok(Self::Szolnok),
+ "Szombathely" => Ok(Self::Szombathely),
+ "Székesfehérvár" => Ok(Self::Szekesfehervar),
+ "Tatabánya" => Ok(Self::Tatabanya),
+ "Tolna County" => Ok(Self::TolnaCounty),
+ "Vas County" => Ok(Self::VasCounty),
+ "Veszprém" => Ok(Self::Veszprem),
+ "Veszprém County" => Ok(Self::VeszpremCounty),
+ "Zala County" => Ok(Self::ZalaCounty),
+ "Zalaegerszeg" => Ok(Self::Zalaegerszeg),
+ "Érd" => Ok(Self::Erd),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3775,57 +3776,53 @@ impl ForeignTryFrom<String> for GreeceStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "GreeceStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "GreeceStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "achaea regional unit" => Ok(Self::AchaeaRegionalUnit),
- "aetolia acarnania regional unit" => Ok(Self::AetoliaAcarnaniaRegionalUnit),
- "arcadia prefecture" => Ok(Self::ArcadiaPrefecture),
- "argolis regional unit" => Ok(Self::ArgolisRegionalUnit),
- "attica region" => Ok(Self::AtticaRegion),
- "boeotia regional unit" => Ok(Self::BoeotiaRegionalUnit),
- "central greece region" => Ok(Self::CentralGreeceRegion),
- "central macedonia" => Ok(Self::CentralMacedonia),
- "chania regional unit" => Ok(Self::ChaniaRegionalUnit),
- "corfu prefecture" => Ok(Self::CorfuPrefecture),
- "corinthia regional unit" => Ok(Self::CorinthiaRegionalUnit),
- "crete region" => Ok(Self::CreteRegion),
- "drama regional unit" => Ok(Self::DramaRegionalUnit),
- "east attica regional unit" => Ok(Self::EastAtticaRegionalUnit),
- "east macedonia and thrace" => Ok(Self::EastMacedoniaAndThrace),
- "epirus region" => Ok(Self::EpirusRegion),
- "euboea" => Ok(Self::Euboea),
- "grevena prefecture" => Ok(Self::GrevenaPrefecture),
- "imathia regional unit" => Ok(Self::ImathiaRegionalUnit),
- "ioannina regional unit" => Ok(Self::IoanninaRegionalUnit),
- "ionian islands region" => Ok(Self::IonianIslandsRegion),
- "karditsa regional unit" => Ok(Self::KarditsaRegionalUnit),
- "kastoria regional unit" => Ok(Self::KastoriaRegionalUnit),
- "kefalonia prefecture" => Ok(Self::KefaloniaPrefecture),
- "kilkis regional unit" => Ok(Self::KilkisRegionalUnit),
- "kozani prefecture" => Ok(Self::KozaniPrefecture),
- "laconia" => Ok(Self::Laconia),
- "larissa prefecture" => Ok(Self::LarissaPrefecture),
- "lefkada regional unit" => Ok(Self::LefkadaRegionalUnit),
- "pella regional unit" => Ok(Self::PellaRegionalUnit),
- "peloponnese region" => Ok(Self::PeloponneseRegion),
- "phthiotis prefecture" => Ok(Self::PhthiotisPrefecture),
- "preveza prefecture" => Ok(Self::PrevezaPrefecture),
- "serres prefecture" => Ok(Self::SerresPrefecture),
- "south aegean" => Ok(Self::SouthAegean),
- "thessaloniki regional unit" => Ok(Self::ThessalonikiRegionalUnit),
- "west greece region" => Ok(Self::WestGreeceRegion),
- "west macedonia region" => Ok(Self::WestMacedoniaRegion),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Achaea Regional Unit" => Ok(Self::AchaeaRegionalUnit),
+ "Aetolia-Acarnania Regional Unit" => Ok(Self::AetoliaAcarnaniaRegionalUnit),
+ "Arcadia Prefecture" => Ok(Self::ArcadiaPrefecture),
+ "Argolis Regional Unit" => Ok(Self::ArgolisRegionalUnit),
+ "Attica Region" => Ok(Self::AtticaRegion),
+ "Boeotia Regional Unit" => Ok(Self::BoeotiaRegionalUnit),
+ "Central Greece Region" => Ok(Self::CentralGreeceRegion),
+ "Central Macedonia" => Ok(Self::CentralMacedonia),
+ "Chania Regional Unit" => Ok(Self::ChaniaRegionalUnit),
+ "Corfu Prefecture" => Ok(Self::CorfuPrefecture),
+ "Corinthia Regional Unit" => Ok(Self::CorinthiaRegionalUnit),
+ "Crete Region" => Ok(Self::CreteRegion),
+ "Drama Regional Unit" => Ok(Self::DramaRegionalUnit),
+ "East Attica Regional Unit" => Ok(Self::EastAtticaRegionalUnit),
+ "East Macedonia and Thrace" => Ok(Self::EastMacedoniaAndThrace),
+ "Epirus Region" => Ok(Self::EpirusRegion),
+ "Euboea" => Ok(Self::Euboea),
+ "Grevena Prefecture" => Ok(Self::GrevenaPrefecture),
+ "Imathia Regional Unit" => Ok(Self::ImathiaRegionalUnit),
+ "Ioannina Regional Unit" => Ok(Self::IoanninaRegionalUnit),
+ "Ionian Islands Region" => Ok(Self::IonianIslandsRegion),
+ "Karditsa Regional Unit" => Ok(Self::KarditsaRegionalUnit),
+ "Kastoria Regional Unit" => Ok(Self::KastoriaRegionalUnit),
+ "Kefalonia Prefecture" => Ok(Self::KefaloniaPrefecture),
+ "Kilkis Regional Unit" => Ok(Self::KilkisRegionalUnit),
+ "Kozani Prefecture" => Ok(Self::KozaniPrefecture),
+ "Laconia" => Ok(Self::Laconia),
+ "Larissa Prefecture" => Ok(Self::LarissaPrefecture),
+ "Lefkada Regional Unit" => Ok(Self::LefkadaRegionalUnit),
+ "Pella Regional Unit" => Ok(Self::PellaRegionalUnit),
+ "Peloponnese Region" => Ok(Self::PeloponneseRegion),
+ "Phthiotis Prefecture" => Ok(Self::PhthiotisPrefecture),
+ "Preveza Prefecture" => Ok(Self::PrevezaPrefecture),
+ "Serres Prefecture" => Ok(Self::SerresPrefecture),
+ "South Aegean" => Ok(Self::SouthAegean),
+ "Thessaloniki Regional Unit" => Ok(Self::ThessalonikiRegionalUnit),
+ "West Greece Region" => Ok(Self::WestGreeceRegion),
+ "West Macedonia Region" => Ok(Self::WestMacedoniaRegion),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3833,43 +3830,37 @@ impl ForeignTryFrom<String> for GreeceStatesAbbreviation {
impl ForeignTryFrom<String> for FinlandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "FinlandStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "FinlandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "central finland" => Ok(Self::CentralFinland),
- "central ostrobothnia" => Ok(Self::CentralOstrobothnia),
- "eastern finland province" => Ok(Self::EasternFinlandProvince),
- "finland proper" => Ok(Self::FinlandProper),
- "kainuu" => Ok(Self::Kainuu),
- "kymenlaakso" => Ok(Self::Kymenlaakso),
- "lapland" => Ok(Self::Lapland),
- "north karelia" => Ok(Self::NorthKarelia),
- "northern ostrobothnia" => Ok(Self::NorthernOstrobothnia),
- "northern savonia" => Ok(Self::NorthernSavonia),
- "ostrobothnia" => Ok(Self::Ostrobothnia),
- "oulu province" => Ok(Self::OuluProvince),
- "pirkanmaa" => Ok(Self::Pirkanmaa),
- "paijanne tavastia" => Ok(Self::PaijanneTavastia),
- "satakunta" => Ok(Self::Satakunta),
- "south karelia" => Ok(Self::SouthKarelia),
- "southern ostrobothnia" => Ok(Self::SouthernOstrobothnia),
- "southern savonia" => Ok(Self::SouthernSavonia),
- "tavastia proper" => Ok(Self::TavastiaProper),
- "uusimaa" => Ok(Self::Uusimaa),
- "aland islands" => Ok(Self::AlandIslands),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Central Finland" => Ok(Self::CentralFinland),
+ "Central Ostrobothnia" => Ok(Self::CentralOstrobothnia),
+ "Eastern Finland Province" => Ok(Self::EasternFinlandProvince),
+ "Finland Proper" => Ok(Self::FinlandProper),
+ "Kainuu" => Ok(Self::Kainuu),
+ "Kymenlaakso" => Ok(Self::Kymenlaakso),
+ "Lapland" => Ok(Self::Lapland),
+ "North Karelia" => Ok(Self::NorthKarelia),
+ "Northern Ostrobothnia" => Ok(Self::NorthernOstrobothnia),
+ "Northern Savonia" => Ok(Self::NorthernSavonia),
+ "Ostrobothnia" => Ok(Self::Ostrobothnia),
+ "Oulu Province" => Ok(Self::OuluProvince),
+ "Pirkanmaa" => Ok(Self::Pirkanmaa),
+ "Päijänne Tavastia" => Ok(Self::PaijanneTavastia),
+ "Satakunta" => Ok(Self::Satakunta),
+ "South Karelia" => Ok(Self::SouthKarelia),
+ "Southern Ostrobothnia" => Ok(Self::SouthernOstrobothnia),
+ "Southern Savonia" => Ok(Self::SouthernSavonia),
+ "Tavastia Proper" => Ok(Self::TavastiaProper),
+ "Uusimaa" => Ok(Self::Uusimaa),
+ "Åland Islands" => Ok(Self::AlandIslands),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3877,27 +3868,21 @@ impl ForeignTryFrom<String> for FinlandStatesAbbreviation {
impl ForeignTryFrom<String> for DenmarkStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "DenmarkStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "DenmarkStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "capital region of denmark" => Ok(Self::CapitalRegionOfDenmark),
- "central denmark region" => Ok(Self::CentralDenmarkRegion),
- "north denmark region" => Ok(Self::NorthDenmarkRegion),
- "region zealand" => Ok(Self::RegionZealand),
- "region of southern denmark" => Ok(Self::RegionOfSouthernDenmark),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Capital Region of Denmark" => Ok(Self::CapitalRegionOfDenmark),
+ "Central Denmark Region" => Ok(Self::CentralDenmarkRegion),
+ "North Denmark Region" => Ok(Self::NorthDenmarkRegion),
+ "Region Zealand" => Ok(Self::RegionZealand),
+ "Region of Southern Denmark" => Ok(Self::RegionOfSouthernDenmark),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -3905,129 +3890,123 @@ impl ForeignTryFrom<String> for DenmarkStatesAbbreviation {
impl ForeignTryFrom<String> for CzechRepublicStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "CzechRepublicStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "CzechRepublicStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "benesov district" => Ok(Self::BenesovDistrict),
- "beroun district" => Ok(Self::BerounDistrict),
- "blansko district" => Ok(Self::BlanskoDistrict),
- "brno city district" => Ok(Self::BrnoCityDistrict),
- "brno country district" => Ok(Self::BrnoCountryDistrict),
- "bruntal district" => Ok(Self::BruntalDistrict),
- "breclav district" => Ok(Self::BreclavDistrict),
- "central bohemian region" => Ok(Self::CentralBohemianRegion),
- "cheb district" => Ok(Self::ChebDistrict),
- "chomutov district" => Ok(Self::ChomutovDistrict),
- "chrudim district" => Ok(Self::ChrudimDistrict),
- "domazlice district" => Ok(Self::DomazliceDistrict),
- "decin district" => Ok(Self::DecinDistrict),
- "frydek mistek district" => Ok(Self::FrydekMistekDistrict),
- "havlickuv brod district" => Ok(Self::HavlickuvBrodDistrict),
- "hodonin district" => Ok(Self::HodoninDistrict),
- "horni pocernice" => Ok(Self::HorniPocernice),
- "hradec kralove district" => Ok(Self::HradecKraloveDistrict),
- "hradec kralove region" => Ok(Self::HradecKraloveRegion),
- "jablonec nad nisou district" => Ok(Self::JablonecNadNisouDistrict),
- "jesenik district" => Ok(Self::JesenikDistrict),
- "jihlava district" => Ok(Self::JihlavaDistrict),
- "jindrichuv hradec district" => Ok(Self::JindrichuvHradecDistrict),
- "jicin district" => Ok(Self::JicinDistrict),
- "karlovy vary district" => Ok(Self::KarlovyVaryDistrict),
- "karlovy vary region" => Ok(Self::KarlovyVaryRegion),
- "karvina district" => Ok(Self::KarvinaDistrict),
- "kladno district" => Ok(Self::KladnoDistrict),
- "klatovy district" => Ok(Self::KlatovyDistrict),
- "kolin district" => Ok(Self::KolinDistrict),
- "kromeriz district" => Ok(Self::KromerizDistrict),
- "liberec district" => Ok(Self::LiberecDistrict),
- "liberec region" => Ok(Self::LiberecRegion),
- "litomerice district" => Ok(Self::LitomericeDistrict),
- "louny district" => Ok(Self::LounyDistrict),
- "mlada boleslav district" => Ok(Self::MladaBoleslavDistrict),
- "moravian silesian region" => Ok(Self::MoravianSilesianRegion),
- "most district" => Ok(Self::MostDistrict),
- "melnik district" => Ok(Self::MelnikDistrict),
- "novy jicin district" => Ok(Self::NovyJicinDistrict),
- "nymburk district" => Ok(Self::NymburkDistrict),
- "nachod district" => Ok(Self::NachodDistrict),
- "olomouc district" => Ok(Self::OlomoucDistrict),
- "olomouc region" => Ok(Self::OlomoucRegion),
- "opava district" => Ok(Self::OpavaDistrict),
- "ostrava city district" => Ok(Self::OstravaCityDistrict),
- "pardubice district" => Ok(Self::PardubiceDistrict),
- "pardubice region" => Ok(Self::PardubiceRegion),
- "pelhrimov district" => Ok(Self::PelhrimovDistrict),
- "plzen region" => Ok(Self::PlzenRegion),
- "plzen city district" => Ok(Self::PlzenCityDistrict),
- "plzen north district" => Ok(Self::PlzenNorthDistrict),
- "plzen south district" => Ok(Self::PlzenSouthDistrict),
- "prachatice district" => Ok(Self::PrachaticeDistrict),
- "prague" => Ok(Self::Prague),
- "prague1" => Ok(Self::Prague1),
- "prague10" => Ok(Self::Prague10),
- "prague11" => Ok(Self::Prague11),
- "prague12" => Ok(Self::Prague12),
- "prague13" => Ok(Self::Prague13),
- "prague14" => Ok(Self::Prague14),
- "prague15" => Ok(Self::Prague15),
- "prague16" => Ok(Self::Prague16),
- "prague2" => Ok(Self::Prague2),
- "prague21" => Ok(Self::Prague21),
- "prague3" => Ok(Self::Prague3),
- "prague4" => Ok(Self::Prague4),
- "prague5" => Ok(Self::Prague5),
- "prague6" => Ok(Self::Prague6),
- "prague7" => Ok(Self::Prague7),
- "prague8" => Ok(Self::Prague8),
- "prague9" => Ok(Self::Prague9),
- "prague east district" => Ok(Self::PragueEastDistrict),
- "prague west district" => Ok(Self::PragueWestDistrict),
- "prostejov district" => Ok(Self::ProstejovDistrict),
- "pisek district" => Ok(Self::PisekDistrict),
- "prerov district" => Ok(Self::PrerovDistrict),
- "pribram district" => Ok(Self::PribramDistrict),
- "rakovnik district" => Ok(Self::RakovnikDistrict),
- "rokycany district" => Ok(Self::RokycanyDistrict),
- "rychnov nad kneznou district" => Ok(Self::RychnovNadKneznouDistrict),
- "semily district" => Ok(Self::SemilyDistrict),
- "sokolov district" => Ok(Self::SokolovDistrict),
- "south bohemian region" => Ok(Self::SouthBohemianRegion),
- "south moravian region" => Ok(Self::SouthMoravianRegion),
- "strakonice district" => Ok(Self::StrakoniceDistrict),
- "svitavy district" => Ok(Self::SvitavyDistrict),
- "tachov district" => Ok(Self::TachovDistrict),
- "teplice district" => Ok(Self::TepliceDistrict),
- "trutnov district" => Ok(Self::TrutnovDistrict),
- "tabor district" => Ok(Self::TaborDistrict),
- "trebic district" => Ok(Self::TrebicDistrict),
- "uherske hradiste district" => Ok(Self::UherskeHradisteDistrict),
- "vsetin district" => Ok(Self::VsetinDistrict),
- "vysocina region" => Ok(Self::VysocinaRegion),
- "vyskov district" => Ok(Self::VyskovDistrict),
- "zlin district" => Ok(Self::ZlinDistrict),
- "zlin region" => Ok(Self::ZlinRegion),
- "znojmo district" => Ok(Self::ZnojmoDistrict),
- "usti nad labem district" => Ok(Self::UstiNadLabemDistrict),
- "usti nad labem region" => Ok(Self::UstiNadLabemRegion),
- "usti nad orlici district" => Ok(Self::UstiNadOrliciDistrict),
- "ceska lipa district" => Ok(Self::CeskaLipaDistrict),
- "ceske budejovice district" => Ok(Self::CeskeBudejoviceDistrict),
- "cesky krumlov district" => Ok(Self::CeskyKrumlovDistrict),
- "sumperk district" => Ok(Self::SumperkDistrict),
- "zdar nad sazavou district" => Ok(Self::ZdarNadSazavouDistrict),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Benešov District" => Ok(Self::BenesovDistrict),
+ "Beroun District" => Ok(Self::BerounDistrict),
+ "Blansko District" => Ok(Self::BlanskoDistrict),
+ "Brno-City District" => Ok(Self::BrnoCityDistrict),
+ "Brno-Country District" => Ok(Self::BrnoCountryDistrict),
+ "Bruntál District" => Ok(Self::BruntalDistrict),
+ "Břeclav District" => Ok(Self::BreclavDistrict),
+ "Central Bohemian Region" => Ok(Self::CentralBohemianRegion),
+ "Cheb District" => Ok(Self::ChebDistrict),
+ "Chomutov District" => Ok(Self::ChomutovDistrict),
+ "Chrudim District" => Ok(Self::ChrudimDistrict),
+ "Domažlice Distric" => Ok(Self::DomazliceDistrict),
+ "Děčín District" => Ok(Self::DecinDistrict),
+ "Frýdek-Místek District" => Ok(Self::FrydekMistekDistrict),
+ "Havlíčkův Brod District" => Ok(Self::HavlickuvBrodDistrict),
+ "Hodonín District" => Ok(Self::HodoninDistrict),
+ "Horní Počernice" => Ok(Self::HorniPocernice),
+ "Hradec Králové District" => Ok(Self::HradecKraloveDistrict),
+ "Hradec Králové Region" => Ok(Self::HradecKraloveRegion),
+ "Jablonec nad Nisou District" => Ok(Self::JablonecNadNisouDistrict),
+ "Jeseník District" => Ok(Self::JesenikDistrict),
+ "Jihlava District" => Ok(Self::JihlavaDistrict),
+ "Jindřichův Hradec District" => Ok(Self::JindrichuvHradecDistrict),
+ "Jičín District" => Ok(Self::JicinDistrict),
+ "Karlovy Vary District" => Ok(Self::KarlovyVaryDistrict),
+ "Karlovy Vary Region" => Ok(Self::KarlovyVaryRegion),
+ "Karviná District" => Ok(Self::KarvinaDistrict),
+ "Kladno District" => Ok(Self::KladnoDistrict),
+ "Klatovy District" => Ok(Self::KlatovyDistrict),
+ "Kolín District" => Ok(Self::KolinDistrict),
+ "Kroměříž District" => Ok(Self::KromerizDistrict),
+ "Liberec District" => Ok(Self::LiberecDistrict),
+ "Liberec Region" => Ok(Self::LiberecRegion),
+ "Litoměřice District" => Ok(Self::LitomericeDistrict),
+ "Louny District" => Ok(Self::LounyDistrict),
+ "Mladá Boleslav District" => Ok(Self::MladaBoleslavDistrict),
+ "Moravian-Silesian Region" => Ok(Self::MoravianSilesianRegion),
+ "Most District" => Ok(Self::MostDistrict),
+ "Mělník District" => Ok(Self::MelnikDistrict),
+ "Nový Jičín District" => Ok(Self::NovyJicinDistrict),
+ "Nymburk District" => Ok(Self::NymburkDistrict),
+ "Náchod District" => Ok(Self::NachodDistrict),
+ "Olomouc District" => Ok(Self::OlomoucDistrict),
+ "Olomouc Region" => Ok(Self::OlomoucRegion),
+ "Opava District" => Ok(Self::OpavaDistrict),
+ "Ostrava-City District" => Ok(Self::OstravaCityDistrict),
+ "Pardubice District" => Ok(Self::PardubiceDistrict),
+ "Pardubice Region" => Ok(Self::PardubiceRegion),
+ "Pelhřimov District" => Ok(Self::PelhrimovDistrict),
+ "Plzeň Region" => Ok(Self::PlzenRegion),
+ "Plzeň-City District" => Ok(Self::PlzenCityDistrict),
+ "Plzeň-North District" => Ok(Self::PlzenNorthDistrict),
+ "Plzeň-South District" => Ok(Self::PlzenSouthDistrict),
+ "Prachatice District" => Ok(Self::PrachaticeDistrict),
+ "Prague" => Ok(Self::Prague),
+ "Prague 1" => Ok(Self::Prague1),
+ "Prague 10" => Ok(Self::Prague10),
+ "Prague 11" => Ok(Self::Prague11),
+ "Prague 12" => Ok(Self::Prague12),
+ "Prague 13" => Ok(Self::Prague13),
+ "Prague 14" => Ok(Self::Prague14),
+ "Prague 15" => Ok(Self::Prague15),
+ "Prague 16" => Ok(Self::Prague16),
+ "Prague 2" => Ok(Self::Prague2),
+ "Prague 21" => Ok(Self::Prague21),
+ "Prague 3" => Ok(Self::Prague3),
+ "Prague 4" => Ok(Self::Prague4),
+ "Prague 5" => Ok(Self::Prague5),
+ "Prague 6" => Ok(Self::Prague6),
+ "Prague 7" => Ok(Self::Prague7),
+ "Prague 8" => Ok(Self::Prague8),
+ "Prague 9" => Ok(Self::Prague9),
+ "Prague-East District" => Ok(Self::PragueEastDistrict),
+ "Prague-West District" => Ok(Self::PragueWestDistrict),
+ "Prostějov District" => Ok(Self::ProstejovDistrict),
+ "Písek District" => Ok(Self::PisekDistrict),
+ "Přerov District" => Ok(Self::PrerovDistrict),
+ "Příbram District" => Ok(Self::PribramDistrict),
+ "Rakovník District" => Ok(Self::RakovnikDistrict),
+ "Rokycany District" => Ok(Self::RokycanyDistrict),
+ "Rychnov nad Kněžnou District" => Ok(Self::RychnovNadKneznouDistrict),
+ "Semily District" => Ok(Self::SemilyDistrict),
+ "Sokolov District" => Ok(Self::SokolovDistrict),
+ "South Bohemian Region" => Ok(Self::SouthBohemianRegion),
+ "South Moravian Region" => Ok(Self::SouthMoravianRegion),
+ "Strakonice District" => Ok(Self::StrakoniceDistrict),
+ "Svitavy District" => Ok(Self::SvitavyDistrict),
+ "Tachov District" => Ok(Self::TachovDistrict),
+ "Teplice District" => Ok(Self::TepliceDistrict),
+ "Trutnov District" => Ok(Self::TrutnovDistrict),
+ "Tábor District" => Ok(Self::TaborDistrict),
+ "Třebíč District" => Ok(Self::TrebicDistrict),
+ "Uherské Hradiště District" => Ok(Self::UherskeHradisteDistrict),
+ "Vsetín District" => Ok(Self::VsetinDistrict),
+ "Vysočina Region" => Ok(Self::VysocinaRegion),
+ "Vyškov District" => Ok(Self::VyskovDistrict),
+ "Zlín District" => Ok(Self::ZlinDistrict),
+ "Zlín Region" => Ok(Self::ZlinRegion),
+ "Znojmo District" => Ok(Self::ZnojmoDistrict),
+ "Ústí nad Labem District" => Ok(Self::UstiNadLabemDistrict),
+ "Ústí nad Labem Region" => Ok(Self::UstiNadLabemRegion),
+ "Ústí nad Orlicí District" => Ok(Self::UstiNadOrliciDistrict),
+ "Česká Lípa District" => Ok(Self::CeskaLipaDistrict),
+ "České Budějovice District" => Ok(Self::CeskeBudejoviceDistrict),
+ "Český Krumlov District" => Ok(Self::CeskyKrumlovDistrict),
+ "Šumperk District" => Ok(Self::SumperkDistrict),
+ "Žďár nad Sázavou District" => Ok(Self::ZdarNadSazavouDistrict),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4035,42 +4014,36 @@ impl ForeignTryFrom<String> for CzechRepublicStatesAbbreviation {
impl ForeignTryFrom<String> for CroatiaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "CroatiaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "CroatiaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "bjelovar bilogora county" => Ok(Self::BjelovarBilogoraCounty),
- "brod posavina county" => Ok(Self::BrodPosavinaCounty),
- "dubrovnik neretva county" => Ok(Self::DubrovnikNeretvaCounty),
- "istria county" => Ok(Self::IstriaCounty),
- "koprivnica krizevci county" => Ok(Self::KoprivnicaKrizevciCounty),
- "krapina zagorje county" => Ok(Self::KrapinaZagorjeCounty),
- "lika senj county" => Ok(Self::LikaSenjCounty),
- "medimurje county" => Ok(Self::MedimurjeCounty),
- "osijek baranja county" => Ok(Self::OsijekBaranjaCounty),
- "pozega slavonian county" => Ok(Self::PozegaSlavoniaCounty),
- "primorje gorski kotar county" => Ok(Self::PrimorjeGorskiKotarCounty),
- "sisak moslavina county" => Ok(Self::SisakMoslavinaCounty),
- "split dalmatia county" => Ok(Self::SplitDalmatiaCounty),
- "varazdin county" => Ok(Self::VarazdinCounty),
- "virovitica podravina county" => Ok(Self::ViroviticaPodravinaCounty),
- "vukovar syrmia county" => Ok(Self::VukovarSyrmiaCounty),
- "zadar county" => Ok(Self::ZadarCounty),
- "zagreb" => Ok(Self::Zagreb),
- "zagreb county" => Ok(Self::ZagrebCounty),
- "sibenik knin county" => Ok(Self::SibenikKninCounty),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Bjelovar-Bilogora County" => Ok(Self::BjelovarBilogoraCounty),
+ "Brod-Posavina County" => Ok(Self::BrodPosavinaCounty),
+ "Dubrovnik-Neretva County" => Ok(Self::DubrovnikNeretvaCounty),
+ "Istria County" => Ok(Self::IstriaCounty),
+ "Koprivnica-Križevci County" => Ok(Self::KoprivnicaKrizevciCounty),
+ "Krapina-Zagorje County" => Ok(Self::KrapinaZagorjeCounty),
+ "Lika-Senj County" => Ok(Self::LikaSenjCounty),
+ "Međimurje County" => Ok(Self::MedimurjeCounty),
+ "Osijek-Baranja County" => Ok(Self::OsijekBaranjaCounty),
+ "Požega-Slavonia County" => Ok(Self::PozegaSlavoniaCounty),
+ "Primorje-Gorski Kotar County" => Ok(Self::PrimorjeGorskiKotarCounty),
+ "Sisak-Moslavina County" => Ok(Self::SisakMoslavinaCounty),
+ "Split-Dalmatia County" => Ok(Self::SplitDalmatiaCounty),
+ "Varaždin County" => Ok(Self::VarazdinCounty),
+ "Virovitica-Podravina County" => Ok(Self::ViroviticaPodravinaCounty),
+ "Vukovar-Syrmia County" => Ok(Self::VukovarSyrmiaCounty),
+ "Zadar County" => Ok(Self::ZadarCounty),
+ "Zagreb" => Ok(Self::Zagreb),
+ "Zagreb County" => Ok(Self::ZagrebCounty),
+ "Šibenik-Knin County" => Ok(Self::SibenikKninCounty),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4078,50 +4051,44 @@ impl ForeignTryFrom<String> for CroatiaStatesAbbreviation {
impl ForeignTryFrom<String> for BulgariaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "BulgariaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "BulgariaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "blagoevgrad province" => Ok(Self::BlagoevgradProvince),
- "burgas province" => Ok(Self::BurgasProvince),
- "dobrich province" => Ok(Self::DobrichProvince),
- "gabrovo province" => Ok(Self::GabrovoProvince),
- "haskovo province" => Ok(Self::HaskovoProvince),
- "kardzhali province" => Ok(Self::KardzhaliProvince),
- "kyustendil province" => Ok(Self::KyustendilProvince),
- "lovech province" => Ok(Self::LovechProvince),
- "montana province" => Ok(Self::MontanaProvince),
- "pazardzhik province" => Ok(Self::PazardzhikProvince),
- "pernik province" => Ok(Self::PernikProvince),
- "pleven province" => Ok(Self::PlevenProvince),
- "plovdiv province" => Ok(Self::PlovdivProvince),
- "razgrad province" => Ok(Self::RazgradProvince),
- "ruse province" => Ok(Self::RuseProvince),
- "shumen" => Ok(Self::Shumen),
- "silistra province" => Ok(Self::SilistraProvince),
- "sliven province" => Ok(Self::SlivenProvince),
- "smolyan province" => Ok(Self::SmolyanProvince),
- "sofia city province" => Ok(Self::SofiaCityProvince),
- "sofia province" => Ok(Self::SofiaProvince),
- "stara zagora province" => Ok(Self::StaraZagoraProvince),
- "targovishte province" => Ok(Self::TargovishteProvince),
- "varna province" => Ok(Self::VarnaProvince),
- "veliko tarnovo province" => Ok(Self::VelikoTarnovoProvince),
- "vidin province" => Ok(Self::VidinProvince),
- "vratsa province" => Ok(Self::VratsaProvince),
- "yambol province" => Ok(Self::YambolProvince),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Blagoevgrad Province" => Ok(Self::BlagoevgradProvince),
+ "Burgas Province" => Ok(Self::BurgasProvince),
+ "Dobrich Province" => Ok(Self::DobrichProvince),
+ "Gabrovo Province" => Ok(Self::GabrovoProvince),
+ "Haskovo Province" => Ok(Self::HaskovoProvince),
+ "Kardzhali Province" => Ok(Self::KardzhaliProvince),
+ "Kyustendil Province" => Ok(Self::KyustendilProvince),
+ "Lovech Province" => Ok(Self::LovechProvince),
+ "Montana Province" => Ok(Self::MontanaProvince),
+ "Pazardzhik Province" => Ok(Self::PazardzhikProvince),
+ "Pernik Province" => Ok(Self::PernikProvince),
+ "Pleven Province" => Ok(Self::PlevenProvince),
+ "Plovdiv Province" => Ok(Self::PlovdivProvince),
+ "Razgrad Province" => Ok(Self::RazgradProvince),
+ "Ruse Province" => Ok(Self::RuseProvince),
+ "Shumen" => Ok(Self::Shumen),
+ "Silistra Province" => Ok(Self::SilistraProvince),
+ "Sliven Province" => Ok(Self::SlivenProvince),
+ "Smolyan Province" => Ok(Self::SmolyanProvince),
+ "Sofia City Province" => Ok(Self::SofiaCityProvince),
+ "Sofia Province" => Ok(Self::SofiaProvince),
+ "Stara Zagora Province" => Ok(Self::StaraZagoraProvince),
+ "Targovishte Provinc" => Ok(Self::TargovishteProvince),
+ "Varna Province" => Ok(Self::VarnaProvince),
+ "Veliko Tarnovo Province" => Ok(Self::VelikoTarnovoProvince),
+ "Vidin Province" => Ok(Self::VidinProvince),
+ "Vratsa Province" => Ok(Self::VratsaProvince),
+ "Yambol Province" => Ok(Self::YambolProvince),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4129,37 +4096,31 @@ impl ForeignTryFrom<String> for BulgariaStatesAbbreviation {
impl ForeignTryFrom<String> for BosniaAndHerzegovinaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "BosniaAndHerzegovinaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "BosniaAndHerzegovinaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "bosnian podrinje canton" => Ok(Self::BosnianPodrinjeCanton),
- "brcko district" => Ok(Self::BrckoDistrict),
- "canton 10" => Ok(Self::Canton10),
- "central bosnia canton" => Ok(Self::CentralBosniaCanton),
- "federation of bosnia and herzegovina" => {
- Ok(Self::FederationOfBosniaAndHerzegovina)
- }
- "herzegovina neretva canton" => Ok(Self::HerzegovinaNeretvaCanton),
- "posavina canton" => Ok(Self::PosavinaCanton),
- "republika srpska" => Ok(Self::RepublikaSrpska),
- "sarajevo canton" => Ok(Self::SarajevoCanton),
- "tuzla canton" => Ok(Self::TuzlaCanton),
- "una sana canton" => Ok(Self::UnaSanaCanton),
- "west herzegovina canton" => Ok(Self::WestHerzegovinaCanton),
- "zenica doboj canton" => Ok(Self::ZenicaDobojCanton),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Bosnian Podrinje Canton" => Ok(Self::BosnianPodrinjeCanton),
+ "Brčko District" => Ok(Self::BrckoDistrict),
+ "Canton 10" => Ok(Self::Canton10),
+ "Central Bosnia Canton" => Ok(Self::CentralBosniaCanton),
+ "Federation of Bosnia and Herzegovina" => {
+ Ok(Self::FederationOfBosniaAndHerzegovina)
}
- }
+ "Herzegovina-Neretva Canton" => Ok(Self::HerzegovinaNeretvaCanton),
+ "Posavina Canton" => Ok(Self::PosavinaCanton),
+ "Republika Srpska" => Ok(Self::RepublikaSrpska),
+ "Sarajevo Canton" => Ok(Self::SarajevoCanton),
+ "Tuzla Canton" => Ok(Self::TuzlaCanton),
+ "Una-Sana Canton" => Ok(Self::UnaSanaCanton),
+ "West Herzegovina Canton" => Ok(Self::WestHerzegovinaCanton),
+ "Zenica-Doboj Canton" => Ok(Self::ZenicaDobojCanton),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
+ }
+ .into()),
+ },
}
}
}
@@ -4167,242 +4128,275 @@ impl ForeignTryFrom<String> for BosniaAndHerzegovinaStatesAbbreviation {
impl ForeignTryFrom<String> for UnitedKingdomStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "UnitedKingdomStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "UnitedKingdomStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "aberdeen city" => Ok(Self::AberdeenCity),
- "aberdeenshire" => Ok(Self::Aberdeenshire),
- "angus" => Ok(Self::Angus),
- "antrim and newtownabbey" => Ok(Self::AntrimAndNewtownabbey),
- "ards and north down" => Ok(Self::ArdsAndNorthDown),
- "argyll and bute" => Ok(Self::ArgyllAndBute),
- "armagh city banbridge and craigavon" => {
- Ok(Self::ArmaghCityBanbridgeAndCraigavon)
- }
- "barking and dagenham" => Ok(Self::BarkingAndDagenham),
- "barnet" => Ok(Self::Barnet),
- "barnsley" => Ok(Self::Barnsley),
- "bath and north east somerset" => Ok(Self::BathAndNorthEastSomerset),
- "bedford" => Ok(Self::Bedford),
- "belfast city" => Ok(Self::BelfastCity),
- "bexley" => Ok(Self::Bexley),
- "birmingham" => Ok(Self::Birmingham),
- "blackburn with darwen" => Ok(Self::BlackburnWithDarwen),
- "blackpool" => Ok(Self::Blackpool),
- "blaenau gwent" => Ok(Self::BlaenauGwent),
- "bolton" => Ok(Self::Bolton),
- "bournemouth christchurch and poole" => {
- Ok(Self::BournemouthChristchurchAndPoole)
- }
- "bracknell forest" => Ok(Self::BracknellForest),
- "bradford" => Ok(Self::Bradford),
- "brent" => Ok(Self::Brent),
- "bridgend" => Ok(Self::Bridgend),
- "brighton and hove" => Ok(Self::BrightonAndHove),
- "bristol city of" => Ok(Self::BristolCityOf),
- "bromley" => Ok(Self::Bromley),
- "buckinghamshire" => Ok(Self::Buckinghamshire),
- "bury" => Ok(Self::Bury),
- "caerphilly" => Ok(Self::Caerphilly),
- "calderdale" => Ok(Self::Calderdale),
- "cambridgeshire" => Ok(Self::Cambridgeshire),
- "camden" => Ok(Self::Camden),
- "cardiff" => Ok(Self::Cardiff),
- "carmarthenshire" => Ok(Self::Carmarthenshire),
- "causeway coast and glens" => Ok(Self::CausewayCoastAndGlens),
- "central bedfordshire" => Ok(Self::CentralBedfordshire),
- "ceredigion" => Ok(Self::Ceredigion),
- "cheshire east" => Ok(Self::CheshireEast),
- "cheshire west and chester" => Ok(Self::CheshireWestAndChester),
- "clackmannanshire" => Ok(Self::Clackmannanshire),
- "conwy" => Ok(Self::Conwy),
- "cornwall" => Ok(Self::Cornwall),
- "coventry" => Ok(Self::Coventry),
- "croydon" => Ok(Self::Croydon),
- "cumbria" => Ok(Self::Cumbria),
- "darlington" => Ok(Self::Darlington),
- "denbighshire" => Ok(Self::Denbighshire),
- "derby" => Ok(Self::Derby),
- "derbyshire" => Ok(Self::Derbyshire),
- "derry and strabane" => Ok(Self::DerryAndStrabane),
- "devon" => Ok(Self::Devon),
- "doncaster" => Ok(Self::Doncaster),
- "dorset" => Ok(Self::Dorset),
- "dudley" => Ok(Self::Dudley),
- "dumfries and galloway" => Ok(Self::DumfriesAndGalloway),
- "dundee city" => Ok(Self::DundeeCity),
- "durham county" => Ok(Self::DurhamCounty),
- "ealing" => Ok(Self::Ealing),
- "east ayrshire" => Ok(Self::EastAyrshire),
- "east dunbartonshire" => Ok(Self::EastDunbartonshire),
- "east lothian" => Ok(Self::EastLothian),
- "east renfrewshire" => Ok(Self::EastRenfrewshire),
- "east riding of yorkshire" => Ok(Self::EastRidingOfYorkshire),
- "east sussex" => Ok(Self::EastSussex),
- "edinburgh city of" => Ok(Self::EdinburghCityOf),
- "eilean siar" => Ok(Self::EileanSiar),
- "enfield" => Ok(Self::Enfield),
- "essex" => Ok(Self::Essex),
- "falkirk" => Ok(Self::Falkirk),
- "fermanagh and omagh" => Ok(Self::FermanaghAndOmagh),
- "fife" => Ok(Self::Fife),
- "flintshire" => Ok(Self::Flintshire),
- "gateshead" => Ok(Self::Gateshead),
- "glasgow city" => Ok(Self::GlasgowCity),
- "gloucestershire" => Ok(Self::Gloucestershire),
- "greenwich" => Ok(Self::Greenwich),
- "gwynedd" => Ok(Self::Gwynedd),
- "hackney" => Ok(Self::Hackney),
- "halton" => Ok(Self::Halton),
- "hammersmith and fulham" => Ok(Self::HammersmithAndFulham),
- "hampshire" => Ok(Self::Hampshire),
- "haringey" => Ok(Self::Haringey),
- "harrow" => Ok(Self::Harrow),
- "hartlepool" => Ok(Self::Hartlepool),
- "havering" => Ok(Self::Havering),
- "herefordshire" => Ok(Self::Herefordshire),
- "hertfordshire" => Ok(Self::Hertfordshire),
- "highland" => Ok(Self::Highland),
- "hillingdon" => Ok(Self::Hillingdon),
- "hounslow" => Ok(Self::Hounslow),
- "inverclyde" => Ok(Self::Inverclyde),
- "isle of anglesey" => Ok(Self::IsleOfAnglesey),
- "isle of wight" => Ok(Self::IsleOfWight),
- "isles of scilly" => Ok(Self::IslesOfScilly),
- "islington" => Ok(Self::Islington),
- "kensington and chelsea" => Ok(Self::KensingtonAndChelsea),
- "kent" => Ok(Self::Kent),
- "kingston upon hull" => Ok(Self::KingstonUponHull),
- "kingston upon thames" => Ok(Self::KingstonUponThames),
- "kirklees" => Ok(Self::Kirklees),
- "knowsley" => Ok(Self::Knowsley),
- "lambeth" => Ok(Self::Lambeth),
- "lancashire" => Ok(Self::Lancashire),
- "leeds" => Ok(Self::Leeds),
- "leicester" => Ok(Self::Leicester),
- "leicestershire" => Ok(Self::Leicestershire),
- "lewisham" => Ok(Self::Lewisham),
- "lincolnshire" => Ok(Self::Lincolnshire),
- "lisburn and castlereagh" => Ok(Self::LisburnAndCastlereagh),
- "liverpool" => Ok(Self::Liverpool),
- "london city of" => Ok(Self::LondonCityOf),
- "luton" => Ok(Self::Luton),
- "manchester" => Ok(Self::Manchester),
- "medway" => Ok(Self::Medway),
- "merthyr tydfil" => Ok(Self::MerthyrTydfil),
- "merton" => Ok(Self::Merton),
- "mid and east antrim" => Ok(Self::MidAndEastAntrim),
- "mid ulster" => Ok(Self::MidUlster),
- "middlesbrough" => Ok(Self::Middlesbrough),
- "midlothian" => Ok(Self::Midlothian),
- "milton keynes" => Ok(Self::MiltonKeynes),
- "monmouthshire" => Ok(Self::Monmouthshire),
- "moray" => Ok(Self::Moray),
- "neath port talbot" => Ok(Self::NeathPortTalbot),
- "newcastle upon tyne" => Ok(Self::NewcastleUponTyne),
- "newham" => Ok(Self::Newham),
- "newport" => Ok(Self::Newport),
- "newry mourne and down" => Ok(Self::NewryMourneAndDown),
- "norfolk" => Ok(Self::Norfolk),
- "north ayrshire" => Ok(Self::NorthAyrshire),
- "north east lincolnshire" => Ok(Self::NorthEastLincolnshire),
- "north lanarkshire" => Ok(Self::NorthLanarkshire),
- "north lincolnshire" => Ok(Self::NorthLincolnshire),
- "north somerset" => Ok(Self::NorthSomerset),
- "north tyneside" => Ok(Self::NorthTyneside),
- "north yorkshire" => Ok(Self::NorthYorkshire),
- "northamptonshire" => Ok(Self::Northamptonshire),
- "northumberland" => Ok(Self::Northumberland),
- "nottingham" => Ok(Self::Nottingham),
- "nottinghamshire" => Ok(Self::Nottinghamshire),
- "oldham" => Ok(Self::Oldham),
- "orkney islands" => Ok(Self::OrkneyIslands),
- "oxfordshire" => Ok(Self::Oxfordshire),
- "pembrokeshire" => Ok(Self::Pembrokeshire),
- "perth and kinross" => Ok(Self::PerthAndKinross),
- "peterborough" => Ok(Self::Peterborough),
- "plymouth" => Ok(Self::Plymouth),
- "portsmouth" => Ok(Self::Portsmouth),
- "powys" => Ok(Self::Powys),
- "reading" => Ok(Self::Reading),
- "redbridge" => Ok(Self::Redbridge),
- "redcar and cleveland" => Ok(Self::RedcarAndCleveland),
- "renfrewshire" => Ok(Self::Renfrewshire),
- "rhondda cynon taff" => Ok(Self::RhonddaCynonTaff),
- "richmond upon thames" => Ok(Self::RichmondUponThames),
- "rochdale" => Ok(Self::Rochdale),
- "rotherham" => Ok(Self::Rotherham),
- "rutland" => Ok(Self::Rutland),
- "salford" => Ok(Self::Salford),
- "sandwell" => Ok(Self::Sandwell),
- "scottish borders" => Ok(Self::ScottishBorders),
- "sefton" => Ok(Self::Sefton),
- "sheffield" => Ok(Self::Sheffield),
- "shetland islands" => Ok(Self::ShetlandIslands),
- "shropshire" => Ok(Self::Shropshire),
- "slough" => Ok(Self::Slough),
- "solihull" => Ok(Self::Solihull),
- "somerset" => Ok(Self::Somerset),
- "south ayrshire" => Ok(Self::SouthAyrshire),
- "south gloucestershire" => Ok(Self::SouthGloucestershire),
- "south lanarkshire" => Ok(Self::SouthLanarkshire),
- "south tyneside" => Ok(Self::SouthTyneside),
- "southampton" => Ok(Self::Southampton),
- "southend on sea" => Ok(Self::SouthendOnSea),
- "southwark" => Ok(Self::Southwark),
- "st helens" => Ok(Self::StHelens),
- "staffordshire" => Ok(Self::Staffordshire),
- "stirling" => Ok(Self::Stirling),
- "stockport" => Ok(Self::Stockport),
- "stockton on tees" => Ok(Self::StocktonOnTees),
- "stoke on trent" => Ok(Self::StokeOnTrent),
- "suffolk" => Ok(Self::Suffolk),
- "sunderland" => Ok(Self::Sunderland),
- "surrey" => Ok(Self::Surrey),
- "sutton" => Ok(Self::Sutton),
- "swansea" => Ok(Self::Swansea),
- "swindon" => Ok(Self::Swindon),
- "tameside" => Ok(Self::Tameside),
- "telford and wrekin" => Ok(Self::TelfordAndWrekin),
- "thurrock" => Ok(Self::Thurrock),
- "torbay" => Ok(Self::Torbay),
- "torfaen" => Ok(Self::Torfaen),
- "tower hamlets" => Ok(Self::TowerHamlets),
- "trafford" => Ok(Self::Trafford),
- "vale of glamorgan" => Ok(Self::ValeOfGlamorgan),
- "wakefield" => Ok(Self::Wakefield),
- "walsall" => Ok(Self::Walsall),
- "waltham forest" => Ok(Self::WalthamForest),
- "wandsworth" => Ok(Self::Wandsworth),
- "warrington" => Ok(Self::Warrington),
- "warwickshire" => Ok(Self::Warwickshire),
- "west berkshire" => Ok(Self::WestBerkshire),
- "west dunbartonshire" => Ok(Self::WestDunbartonshire),
- "west lothian" => Ok(Self::WestLothian),
- "west sussex" => Ok(Self::WestSussex),
- "westminster" => Ok(Self::Westminster),
- "wigan" => Ok(Self::Wigan),
- "wiltshire" => Ok(Self::Wiltshire),
- "windsor and maidenhead" => Ok(Self::WindsorAndMaidenhead),
- "wirral" => Ok(Self::Wirral),
- "wokingham" => Ok(Self::Wokingham),
- "wolverhampton" => Ok(Self::Wolverhampton),
- "worcestershire" => Ok(Self::Worcestershire),
- "wrexham" => Ok(Self::Wrexham),
- "york" => Ok(Self::York),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Aberdeen" => Ok(Self::Aberdeen),
+ "Aberdeenshire" => Ok(Self::Aberdeenshire),
+ "Angus" => Ok(Self::Angus),
+ "Antrim" => Ok(Self::Antrim),
+ "Antrim and Newtownabbey" => Ok(Self::AntrimAndNewtownabbey),
+ "Ards" => Ok(Self::Ards),
+ "Ards and North Down" => Ok(Self::ArdsAndNorthDown),
+ "Argyll and Bute" => Ok(Self::ArgyllAndBute),
+ "Armagh City and District Council" => Ok(Self::ArmaghCityAndDistrictCouncil),
+ "Armagh, Banbridge and Craigavon" => Ok(Self::ArmaghBanbridgeAndCraigavon),
+ "Ascension Island" => Ok(Self::AscensionIsland),
+ "Ballymena Borough" => Ok(Self::BallymenaBorough),
+ "Ballymoney" => Ok(Self::Ballymoney),
+ "Banbridge" => Ok(Self::Banbridge),
+ "Barnsley" => Ok(Self::Barnsley),
+ "Bath and North East Somerset" => Ok(Self::BathAndNorthEastSomerset),
+ "Bedford" => Ok(Self::Bedford),
+ "Belfast district" => Ok(Self::BelfastDistrict),
+ "Birmingham" => Ok(Self::Birmingham),
+ "Blackburn with Darwen" => Ok(Self::BlackburnWithDarwen),
+ "Blackpool" => Ok(Self::Blackpool),
+ "Blaenau Gwent County Borough" => Ok(Self::BlaenauGwentCountyBorough),
+ "Bolton" => Ok(Self::Bolton),
+ "Bournemouth" => Ok(Self::Bournemouth),
+ "Bracknell Forest" => Ok(Self::BracknellForest),
+ "Bradford" => Ok(Self::Bradford),
+ "Bridgend County Borough" => Ok(Self::BridgendCountyBorough),
+ "Brighton and Hove" => Ok(Self::BrightonAndHove),
+ "Buckinghamshire" => Ok(Self::Buckinghamshire),
+ "Bury" => Ok(Self::Bury),
+ "Caerphilly County Borough" => Ok(Self::CaerphillyCountyBorough),
+ "Calderdale" => Ok(Self::Calderdale),
+ "Cambridgeshire" => Ok(Self::Cambridgeshire),
+ "Carmarthenshire" => Ok(Self::Carmarthenshire),
+ "Carrickfergus Borough Council" => Ok(Self::CarrickfergusBoroughCouncil),
+ "Castlereagh" => Ok(Self::Castlereagh),
+ "Causeway Coast and Glens" => Ok(Self::CausewayCoastAndGlens),
+ "Central Bedfordshire" => Ok(Self::CentralBedfordshire),
+ "Ceredigion" => Ok(Self::Ceredigion),
+ "Cheshire East" => Ok(Self::CheshireEast),
+ "Cheshire West and Chester" => Ok(Self::CheshireWestAndChester),
+ "City and County of Cardiff" => Ok(Self::CityAndCountyOfCardiff),
+ "City and County of Swansea" => Ok(Self::CityAndCountyOfSwansea),
+ "City of Bristol" => Ok(Self::CityOfBristol),
+ "City of Derby" => Ok(Self::CityOfDerby),
+ "City of Kingston upon Hull" => Ok(Self::CityOfKingstonUponHull),
+ "City of Leicester" => Ok(Self::CityOfLeicester),
+ "City of London" => Ok(Self::CityOfLondon),
+ "City of Nottingham" => Ok(Self::CityOfNottingham),
+ "City of Peterborough" => Ok(Self::CityOfPeterborough),
+ "City of Plymouth" => Ok(Self::CityOfPlymouth),
+ "City of Portsmouth" => Ok(Self::CityOfPortsmouth),
+ "City of Southampton" => Ok(Self::CityOfSouthampton),
+ "City of Stoke-on-Trent" => Ok(Self::CityOfStokeOnTrent),
+ "City of Sunderland" => Ok(Self::CityOfSunderland),
+ "City of Westminster" => Ok(Self::CityOfWestminster),
+ "City of Wolverhampton" => Ok(Self::CityOfWolverhampton),
+ "City of York" => Ok(Self::CityOfYork),
+ "Clackmannanshire" => Ok(Self::Clackmannanshire),
+ "Coleraine Borough Council" => Ok(Self::ColeraineBoroughCouncil),
+ "Conwy County Borough" => Ok(Self::ConwyCountyBorough),
+ "Cookstown District Council" => Ok(Self::CookstownDistrictCouncil),
+ "Cornwall" => Ok(Self::Cornwall),
+ "County Durham" => Ok(Self::CountyDurham),
+ "Coventry" => Ok(Self::Coventry),
+ "Craigavon Borough Council" => Ok(Self::CraigavonBoroughCouncil),
+ "Cumbria" => Ok(Self::Cumbria),
+ "Darlington" => Ok(Self::Darlington),
+ "Denbighshire" => Ok(Self::Denbighshire),
+ "Derbyshire" => Ok(Self::Derbyshire),
+ "Derry City and Strabane" => Ok(Self::DerryCityAndStrabane),
+ "Derry City Council" => Ok(Self::DerryCityCouncil),
+ "Devon" => Ok(Self::Devon),
+ "Doncaster" => Ok(Self::Doncaster),
+ "Dorset" => Ok(Self::Dorset),
+ "Down District Council" => Ok(Self::DownDistrictCouncil),
+ "Dudley" => Ok(Self::Dudley),
+ "Dumfries and Galloway" => Ok(Self::DumfriesAndGalloway),
+ "Dundee" => Ok(Self::Dundee),
+ "Dungannon and South Tyrone Borough Council" => {
+ Ok(Self::DungannonAndSouthTyroneBoroughCouncil)
}
- }
+ "East Ayrshire" => Ok(Self::EastAyrshire),
+ "East Dunbartonshire" => Ok(Self::EastDunbartonshire),
+ "East Lothian" => Ok(Self::EastLothian),
+ "East Renfrewshire" => Ok(Self::EastRenfrewshire),
+ "East Riding of Yorkshire" => Ok(Self::EastRidingOfYorkshire),
+ "East Sussex" => Ok(Self::EastSussex),
+ "Edinburgh" => Ok(Self::Edinburgh),
+ "England" => Ok(Self::England),
+ "Essex" => Ok(Self::Essex),
+ "Falkirk" => Ok(Self::Falkirk),
+ "Fermanagh and Omagh" => Ok(Self::FermanaghAndOmagh),
+ "Fermanagh District Council" => Ok(Self::FermanaghDistrictCouncil),
+ "Fife" => Ok(Self::Fife),
+ "Flintshire" => Ok(Self::Flintshire),
+ "Gateshead" => Ok(Self::Gateshead),
+ "Glasgow" => Ok(Self::Glasgow),
+ "Gloucestershire" => Ok(Self::Gloucestershire),
+ "Gwynedd" => Ok(Self::Gwynedd),
+ "Halton" => Ok(Self::Halton),
+ "Hampshire" => Ok(Self::Hampshire),
+ "Hartlepool" => Ok(Self::Hartlepool),
+ "Herefordshire" => Ok(Self::Herefordshire),
+ "Hertfordshire" => Ok(Self::Hertfordshire),
+ "Highland" => Ok(Self::Highland),
+ "Inverclyde" => Ok(Self::Inverclyde),
+ "Isle of Wight" => Ok(Self::IsleOfWight),
+ "Isles of Scilly" => Ok(Self::IslesOfScilly),
+ "Kent" => Ok(Self::Kent),
+ "Kirklees" => Ok(Self::Kirklees),
+ "Knowsley" => Ok(Self::Knowsley),
+ "Lancashire" => Ok(Self::Lancashire),
+ "Larne Borough Council" => Ok(Self::LarneBoroughCouncil),
+ "Leeds" => Ok(Self::Leeds),
+ "Leicestershire" => Ok(Self::Leicestershire),
+ "Limavady Borough Council" => Ok(Self::LimavadyBoroughCouncil),
+ "Lincolnshire" => Ok(Self::Lincolnshire),
+ "Lisburn and Castlereagh" => Ok(Self::LisburnAndCastlereagh),
+ "Lisburn City Council" => Ok(Self::LisburnCityCouncil),
+ "Liverpool" => Ok(Self::Liverpool),
+ "London Borough of Barking and Dagenham" => {
+ Ok(Self::LondonBoroughOfBarkingAndDagenham)
+ }
+ "London Borough of Barnet" => Ok(Self::LondonBoroughOfBarnet),
+ "London Borough of Bexley" => Ok(Self::LondonBoroughOfBexley),
+ "London Borough of Brent" => Ok(Self::LondonBoroughOfBrent),
+ "London Borough of Bromley" => Ok(Self::LondonBoroughOfBromley),
+ "London Borough of Camden" => Ok(Self::LondonBoroughOfCamden),
+ "London Borough of Croydon" => Ok(Self::LondonBoroughOfCroydon),
+ "London Borough of Ealing" => Ok(Self::LondonBoroughOfEaling),
+ "London Borough of Enfield" => Ok(Self::LondonBoroughOfEnfield),
+ "London Borough of Hackney" => Ok(Self::LondonBoroughOfHackney),
+ "London Borough of Hammersmith and Fulham" => {
+ Ok(Self::LondonBoroughOfHammersmithAndFulham)
+ }
+ "London Borough of Haringey" => Ok(Self::LondonBoroughOfHaringey),
+ "London Borough of Harrow" => Ok(Self::LondonBoroughOfHarrow),
+ "London Borough of Havering" => Ok(Self::LondonBoroughOfHavering),
+ "London Borough of Hillingdon" => Ok(Self::LondonBoroughOfHillingdon),
+ "London Borough of Hounslow" => Ok(Self::LondonBoroughOfHounslow),
+ "London Borough of Islington" => Ok(Self::LondonBoroughOfIslington),
+ "London Borough of Lambeth" => Ok(Self::LondonBoroughOfLambeth),
+ "London Borough of Lewisham" => Ok(Self::LondonBoroughOfLewisham),
+ "London Borough of Merton" => Ok(Self::LondonBoroughOfMerton),
+ "London Borough of Newham" => Ok(Self::LondonBoroughOfNewham),
+ "London Borough of Redbridge" => Ok(Self::LondonBoroughOfRedbridge),
+ "London Borough of Richmond upon Thames" => {
+ Ok(Self::LondonBoroughOfRichmondUponThames)
+ }
+ "London Borough of Southwark" => Ok(Self::LondonBoroughOfSouthwark),
+ "London Borough of Sutton" => Ok(Self::LondonBoroughOfSutton),
+ "London Borough of Tower Hamlets" => Ok(Self::LondonBoroughOfTowerHamlets),
+ "London Borough of Waltham Forest" => Ok(Self::LondonBoroughOfWalthamForest),
+ "London Borough of Wandsworth" => Ok(Self::LondonBoroughOfWandsworth),
+ "Magherafelt District Council" => Ok(Self::MagherafeltDistrictCouncil),
+ "Manchester" => Ok(Self::Manchester),
+ "Medway" => Ok(Self::Medway),
+ "Merthyr Tydfil County Borough" => Ok(Self::MerthyrTydfilCountyBorough),
+ "Metropolitan Borough of Wigan" => Ok(Self::MetropolitanBoroughOfWigan),
+ "Mid and East Antrim" => Ok(Self::MidAndEastAntrim),
+ "Mid Ulster" => Ok(Self::MidUlster),
+ "Middlesbrough" => Ok(Self::Middlesbrough),
+ "Midlothian" => Ok(Self::Midlothian),
+ "Milton Keynes" => Ok(Self::MiltonKeynes),
+ "Monmouthshire" => Ok(Self::Monmouthshire),
+ "Moray" => Ok(Self::Moray),
+ "Moyle District Council" => Ok(Self::MoyleDistrictCouncil),
+ "Neath Port Talbot County Borough" => Ok(Self::NeathPortTalbotCountyBorough),
+ "Newcastle upon Tyne" => Ok(Self::NewcastleUponTyne),
+ "Newport" => Ok(Self::Newport),
+ "Newry and Mourne District Council" => Ok(Self::NewryAndMourneDistrictCouncil),
+ "Newry, Mourne and Down" => Ok(Self::NewryMourneAndDown),
+ "Newtownabbey Borough Council" => Ok(Self::NewtownabbeyBoroughCouncil),
+ "Norfolk" => Ok(Self::Norfolk),
+ "North Ayrshire" => Ok(Self::NorthAyrshire),
+ "North Down Borough Council" => Ok(Self::NorthDownBoroughCouncil),
+ "North East Lincolnshire" => Ok(Self::NorthEastLincolnshire),
+ "North Lanarkshire" => Ok(Self::NorthLanarkshire),
+ "North Lincolnshire" => Ok(Self::NorthLincolnshire),
+ "North Somerset" => Ok(Self::NorthSomerset),
+ "North Tyneside" => Ok(Self::NorthTyneside),
+ "North Yorkshire" => Ok(Self::NorthYorkshire),
+ "Northamptonshire" => Ok(Self::Northamptonshire),
+ "Northern Ireland" => Ok(Self::NorthernIreland),
+ "Northumberland" => Ok(Self::Northumberland),
+ "Nottinghamshire" => Ok(Self::Nottinghamshire),
+ "Oldham" => Ok(Self::Oldham),
+ "Omagh District Council" => Ok(Self::OmaghDistrictCouncil),
+ "Orkney Islands" => Ok(Self::OrkneyIslands),
+ "Outer Hebrides" => Ok(Self::OuterHebrides),
+ "Oxfordshire" => Ok(Self::Oxfordshire),
+ "Pembrokeshire" => Ok(Self::Pembrokeshire),
+ "Perth and Kinross" => Ok(Self::PerthAndKinross),
+ "Poole" => Ok(Self::Poole),
+ "Powys" => Ok(Self::Powys),
+ "Reading" => Ok(Self::Reading),
+ "Redcar and Cleveland" => Ok(Self::RedcarAndCleveland),
+ "Renfrewshire" => Ok(Self::Renfrewshire),
+ "Rhondda Cynon Taf" => Ok(Self::RhonddaCynonTaf),
+ "Rochdale" => Ok(Self::Rochdale),
+ "Rotherham" => Ok(Self::Rotherham),
+ "Royal Borough of Greenwich" => Ok(Self::RoyalBoroughOfGreenwich),
+ "Royal Borough of Kensington and Chelsea" => {
+ Ok(Self::RoyalBoroughOfKensingtonAndChelsea)
+ }
+ "Royal Borough of Kingston upon Thames" => {
+ Ok(Self::RoyalBoroughOfKingstonUponThames)
+ }
+ "Rutland" => Ok(Self::Rutland),
+ "Saint Helena" => Ok(Self::SaintHelena),
+ "Salford" => Ok(Self::Salford),
+ "Sandwell" => Ok(Self::Sandwell),
+ "Scotland" => Ok(Self::Scotland),
+ "Scottish Borders" => Ok(Self::ScottishBorders),
+ "Sefton" => Ok(Self::Sefton),
+ "Sheffield" => Ok(Self::Sheffield),
+ "Shetland Islands" => Ok(Self::ShetlandIslands),
+ "Shropshire" => Ok(Self::Shropshire),
+ "Slough" => Ok(Self::Slough),
+ "Solihull" => Ok(Self::Solihull),
+ "Somerset" => Ok(Self::Somerset),
+ "South Ayrshire" => Ok(Self::SouthAyrshire),
+ "South Gloucestershire" => Ok(Self::SouthGloucestershire),
+ "South Lanarkshire" => Ok(Self::SouthLanarkshire),
+ "South Tyneside" => Ok(Self::SouthTyneside),
+ "Southend-on-Sea" => Ok(Self::SouthendOnSea),
+ "St Helens" => Ok(Self::StHelens),
+ "Staffordshire" => Ok(Self::Staffordshire),
+ "Stirling" => Ok(Self::Stirling),
+ "Stockport" => Ok(Self::Stockport),
+ "Stockton-on-Tees" => Ok(Self::StocktonOnTees),
+ "Strabane District Council" => Ok(Self::StrabaneDistrictCouncil),
+ "Suffolk" => Ok(Self::Suffolk),
+ "Surrey" => Ok(Self::Surrey),
+ "Swindon" => Ok(Self::Swindon),
+ "Tameside" => Ok(Self::Tameside),
+ "Telford and Wrekin" => Ok(Self::TelfordAndWrekin),
+ "Thurrock" => Ok(Self::Thurrock),
+ "Torbay" => Ok(Self::Torbay),
+ "Torfaen" => Ok(Self::Torfaen),
+ "Trafford" => Ok(Self::Trafford),
+ "United Kingdom" => Ok(Self::UnitedKingdom),
+ "Vale of Glamorgan" => Ok(Self::ValeOfGlamorgan),
+ "Wakefield" => Ok(Self::Wakefield),
+ "Wales" => Ok(Self::Wales),
+ "Walsall" => Ok(Self::Walsall),
+ "Warrington" => Ok(Self::Warrington),
+ "Warwickshire" => Ok(Self::Warwickshire),
+ "West Berkshire" => Ok(Self::WestBerkshire),
+ "West Dunbartonshire" => Ok(Self::WestDunbartonshire),
+ "West Lothian" => Ok(Self::WestLothian),
+ "West Sussex" => Ok(Self::WestSussex),
+ "Wiltshire" => Ok(Self::Wiltshire),
+ "Windsor and Maidenhead" => Ok(Self::WindsorAndMaidenhead),
+ "Wirral" => Ok(Self::Wirral),
+ "Wokingham" => Ok(Self::Wokingham),
+ "Worcestershire" => Ok(Self::Worcestershire),
+ "Wrexham County Borough" => Ok(Self::WrexhamCountyBorough),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
+ }
+ .into()),
+ },
}
}
}
@@ -4410,35 +4404,29 @@ impl ForeignTryFrom<String> for UnitedKingdomStatesAbbreviation {
impl ForeignTryFrom<String> for BelgiumStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "BelgiumStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "BelgiumStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "antwerp" => Ok(Self::Antwerp),
- "brussels capital region" => Ok(Self::BrusselsCapitalRegion),
- "east flanders" => Ok(Self::EastFlanders),
- "flanders" => Ok(Self::Flanders),
- "flemish brabant" => Ok(Self::FlemishBrabant),
- "hainaut" => Ok(Self::Hainaut),
- "limburg" => Ok(Self::Limburg),
- "liege" => Ok(Self::Liege),
- "luxembourg" => Ok(Self::Luxembourg),
- "namur" => Ok(Self::Namur),
- "wallonia" => Ok(Self::Wallonia),
- "walloon brabant" => Ok(Self::WalloonBrabant),
- "west flanders" => Ok(Self::WestFlanders),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Antwerp" => Ok(Self::Antwerp),
+ "Brussels-Capital Region" => Ok(Self::BrusselsCapitalRegion),
+ "East Flanders" => Ok(Self::EastFlanders),
+ "Flanders" => Ok(Self::Flanders),
+ "Flemish Brabant" => Ok(Self::FlemishBrabant),
+ "Hainaut" => Ok(Self::Hainaut),
+ "Limburg" => Ok(Self::Limburg),
+ "Liège" => Ok(Self::Liege),
+ "Luxembourg" => Ok(Self::Luxembourg),
+ "Namur" => Ok(Self::Namur),
+ "Wallonia" => Ok(Self::Wallonia),
+ "Walloon Brabant" => Ok(Self::WalloonBrabant),
+ "West Flanders" => Ok(Self::WestFlanders),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4446,37 +4434,31 @@ impl ForeignTryFrom<String> for BelgiumStatesAbbreviation {
impl ForeignTryFrom<String> for LuxembourgStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "LuxembourgStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "LuxembourgStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "canton of capellen" => Ok(Self::CantonOfCapellen),
- "canton of clervaux" => Ok(Self::CantonOfClervaux),
- "canton of diekirch" => Ok(Self::CantonOfDiekirch),
- "canton of echternach" => Ok(Self::CantonOfEchternach),
- "canton of esch sur alzette" => Ok(Self::CantonOfEschSurAlzette),
- "canton of grevenmacher" => Ok(Self::CantonOfGrevenmacher),
- "canton of luxembourg" => Ok(Self::CantonOfLuxembourg),
- "canton of mersch" => Ok(Self::CantonOfMersch),
- "canton of redange" => Ok(Self::CantonOfRedange),
- "canton of remich" => Ok(Self::CantonOfRemich),
- "canton of vianden" => Ok(Self::CantonOfVianden),
- "canton of wiltz" => Ok(Self::CantonOfWiltz),
- "diekirch district" => Ok(Self::DiekirchDistrict),
- "grevenmacher district" => Ok(Self::GrevenmacherDistrict),
- "luxembourg district" => Ok(Self::LuxembourgDistrict),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Canton of Capellen" => Ok(Self::CantonOfCapellen),
+ "Canton of Clervaux" => Ok(Self::CantonOfClervaux),
+ "Canton of Diekirch" => Ok(Self::CantonOfDiekirch),
+ "Canton of Echternach" => Ok(Self::CantonOfEchternach),
+ "Canton of Esch-sur-Alzette" => Ok(Self::CantonOfEschSurAlzette),
+ "Canton of Grevenmacher" => Ok(Self::CantonOfGrevenmacher),
+ "Canton of Luxembourg" => Ok(Self::CantonOfLuxembourg),
+ "Canton of Mersch" => Ok(Self::CantonOfMersch),
+ "Canton of Redange" => Ok(Self::CantonOfRedange),
+ "Canton of Remich" => Ok(Self::CantonOfRemich),
+ "Canton of Vianden" => Ok(Self::CantonOfVianden),
+ "Canton of Wiltz" => Ok(Self::CantonOfWiltz),
+ "Diekirch District" => Ok(Self::DiekirchDistrict),
+ "Grevenmacher District" => Ok(Self::GrevenmacherDistrict),
+ "Luxembourg District" => Ok(Self::LuxembourgDistrict),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4485,102 +4467,98 @@ impl ForeignTryFrom<String> for RussiaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "RussiaStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "RussiaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "altai krai" => Ok(Self::AltaiKrai),
- "altai republic" => Ok(Self::AltaiRepublic),
- "amur oblast" => Ok(Self::AmurOblast),
- "arkhangelsk" => Ok(Self::Arkhangelsk),
- "astrakhan oblast" => Ok(Self::AstrakhanOblast),
- "belgorod oblast" => Ok(Self::BelgorodOblast),
- "bryansk oblast" => Ok(Self::BryanskOblast),
- "chechen republic" => Ok(Self::ChechenRepublic),
- "chelyabinsk oblast" => Ok(Self::ChelyabinskOblast),
- "chukotka autonomous okrug" => Ok(Self::ChukotkaAutonomousOkrug),
- "chuvash republic" => Ok(Self::ChuvashRepublic),
- "irkutsk" => Ok(Self::Irkutsk),
- "ivanovo oblast" => Ok(Self::IvanovoOblast),
- "jewish autonomous oblast" => Ok(Self::JewishAutonomousOblast),
- "kabardino-balkar republic" => Ok(Self::KabardinoBalkarRepublic),
- "kaliningrad" => Ok(Self::Kaliningrad),
- "kaluga oblast" => Ok(Self::KalugaOblast),
- "kamchatka krai" => Ok(Self::KamchatkaKrai),
- "karachay-cherkess republic" => Ok(Self::KarachayCherkessRepublic),
- "kemerovo oblast" => Ok(Self::KemerovoOblast),
- "khabarovsk krai" => Ok(Self::KhabarovskKrai),
- "khanty-mansi autonomous okrug" => Ok(Self::KhantyMansiAutonomousOkrug),
- "kirov oblast" => Ok(Self::KirovOblast),
- "komi republic" => Ok(Self::KomiRepublic),
- "kostroma oblast" => Ok(Self::KostromaOblast),
- "krasnodar krai" => Ok(Self::KrasnodarKrai),
- "krasnoyarsk krai" => Ok(Self::KrasnoyarskKrai),
- "kurgan oblast" => Ok(Self::KurganOblast),
- "kursk oblast" => Ok(Self::KurskOblast),
- "leningrad oblast" => Ok(Self::LeningradOblast),
- "lipetsk oblast" => Ok(Self::LipetskOblast),
- "magadan oblast" => Ok(Self::MagadanOblast),
- "mari el republic" => Ok(Self::MariElRepublic),
- "moscow" => Ok(Self::Moscow),
- "moscow oblast" => Ok(Self::MoscowOblast),
- "murmansk oblast" => Ok(Self::MurmanskOblast),
- "nenets autonomous okrug" => Ok(Self::NenetsAutonomousOkrug),
- "nizhny novgorod oblast" => Ok(Self::NizhnyNovgorodOblast),
- "novgorod oblast" => Ok(Self::NovgorodOblast),
- "novosibirsk" => Ok(Self::Novosibirsk),
- "omsk oblast" => Ok(Self::OmskOblast),
- "orenburg oblast" => Ok(Self::OrenburgOblast),
- "oryol oblast" => Ok(Self::OryolOblast),
- "penza oblast" => Ok(Self::PenzaOblast),
- "perm krai" => Ok(Self::PermKrai),
- "primorsky krai" => Ok(Self::PrimorskyKrai),
- "pskov oblast" => Ok(Self::PskovOblast),
- "republic of adygea" => Ok(Self::RepublicOfAdygea),
- "republic of bashkortostan" => Ok(Self::RepublicOfBashkortostan),
- "republic of buryatia" => Ok(Self::RepublicOfBuryatia),
- "republic of dagestan" => Ok(Self::RepublicOfDagestan),
- "republic of ingushetia" => Ok(Self::RepublicOfIngushetia),
- "republic of kalmykia" => Ok(Self::RepublicOfKalmykia),
- "republic of karelia" => Ok(Self::RepublicOfKarelia),
- "republic of khakassia" => Ok(Self::RepublicOfKhakassia),
- "republic of mordovia" => Ok(Self::RepublicOfMordovia),
- "republic of north ossetia-alania" => Ok(Self::RepublicOfNorthOssetiaAlania),
- "republic of tatarstan" => Ok(Self::RepublicOfTatarstan),
- "rostov oblast" => Ok(Self::RostovOblast),
- "ryazan oblast" => Ok(Self::RyazanOblast),
- "saint petersburg" => Ok(Self::SaintPetersburg),
- "sakha republic" => Ok(Self::SakhaRepublic),
- "sakhalin" => Ok(Self::Sakhalin),
- "samara oblast" => Ok(Self::SamaraOblast),
- "saratov oblast" => Ok(Self::SaratovOblast),
- "sevastopol" => Ok(Self::Sevastopol),
- "smolensk oblast" => Ok(Self::SmolenskOblast),
- "stavropol krai" => Ok(Self::StavropolKrai),
- "sverdlovsk" => Ok(Self::Sverdlovsk),
- "tambov oblast" => Ok(Self::TambovOblast),
- "tomsk oblast" => Ok(Self::TomskOblast),
- "tula oblast" => Ok(Self::TulaOblast),
- "tuva republic" => Ok(Self::TuvaRepublic),
- "tver oblast" => Ok(Self::TverOblast),
- "tyumen oblast" => Ok(Self::TyumenOblast),
- "udmurt republic" => Ok(Self::UdmurtRepublic),
- "ulyanovsk oblast" => Ok(Self::UlyanovskOblast),
- "vladimir oblast" => Ok(Self::VladimirOblast),
- "vologda oblast" => Ok(Self::VologdaOblast),
- "voronezh oblast" => Ok(Self::VoronezhOblast),
- "yamalo-nenets autonomous okrug" => Ok(Self::YamaloNenetsAutonomousOkrug),
- "yaroslavl oblast" => Ok(Self::YaroslavlOblast),
- "zabaykalsky krai" => Ok(Self::ZabaykalskyKrai),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Altai Krai" => Ok(Self::AltaiKrai),
+ "Altai Republic" => Ok(Self::AltaiRepublic),
+ "Amur Oblast" => Ok(Self::AmurOblast),
+ "Arkhangelsk" => Ok(Self::Arkhangelsk),
+ "Astrakhan Oblast" => Ok(Self::AstrakhanOblast),
+ "Belgorod Oblast" => Ok(Self::BelgorodOblast),
+ "Bryansk Oblast" => Ok(Self::BryanskOblast),
+ "Chechen Republic" => Ok(Self::ChechenRepublic),
+ "Chelyabinsk Oblast" => Ok(Self::ChelyabinskOblast),
+ "Chukotka Autonomous Okrug" => Ok(Self::ChukotkaAutonomousOkrug),
+ "Chuvash Republic" => Ok(Self::ChuvashRepublic),
+ "Irkutsk" => Ok(Self::Irkutsk),
+ "Ivanovo Oblast" => Ok(Self::IvanovoOblast),
+ "Jewish Autonomous Oblast" => Ok(Self::JewishAutonomousOblast),
+ "Kabardino-Balkar Republic" => Ok(Self::KabardinoBalkarRepublic),
+ "Kaliningrad" => Ok(Self::Kaliningrad),
+ "Kaluga Oblast" => Ok(Self::KalugaOblast),
+ "Kamchatka Krai" => Ok(Self::KamchatkaKrai),
+ "Karachay-Cherkess Republic" => Ok(Self::KarachayCherkessRepublic),
+ "Kemerovo Oblast" => Ok(Self::KemerovoOblast),
+ "Khabarovsk Krai" => Ok(Self::KhabarovskKrai),
+ "Khanty-Mansi Autonomous Okrug" => Ok(Self::KhantyMansiAutonomousOkrug),
+ "Kirov Oblast" => Ok(Self::KirovOblast),
+ "Komi Republic" => Ok(Self::KomiRepublic),
+ "Kostroma Oblast" => Ok(Self::KostromaOblast),
+ "Krasnodar Krai" => Ok(Self::KrasnodarKrai),
+ "Krasnoyarsk Krai" => Ok(Self::KrasnoyarskKrai),
+ "Kurgan Oblast" => Ok(Self::KurganOblast),
+ "Kursk Oblast" => Ok(Self::KurskOblast),
+ "Leningrad Oblast" => Ok(Self::LeningradOblast),
+ "Lipetsk Oblast" => Ok(Self::LipetskOblast),
+ "Magadan Oblast" => Ok(Self::MagadanOblast),
+ "Mari El Republic" => Ok(Self::MariElRepublic),
+ "Moscow" => Ok(Self::Moscow),
+ "Moscow Oblast" => Ok(Self::MoscowOblast),
+ "Murmansk Oblast" => Ok(Self::MurmanskOblast),
+ "Nenets Autonomous Okrug" => Ok(Self::NenetsAutonomousOkrug),
+ "Nizhny Novgorod Oblast" => Ok(Self::NizhnyNovgorodOblast),
+ "Novgorod Oblast" => Ok(Self::NovgorodOblast),
+ "Novosibirsk" => Ok(Self::Novosibirsk),
+ "Omsk Oblast" => Ok(Self::OmskOblast),
+ "Orenburg Oblast" => Ok(Self::OrenburgOblast),
+ "Oryol Oblast" => Ok(Self::OryolOblast),
+ "Penza Oblast" => Ok(Self::PenzaOblast),
+ "Perm Krai" => Ok(Self::PermKrai),
+ "Primorsky Krai" => Ok(Self::PrimorskyKrai),
+ "Pskov Oblast" => Ok(Self::PskovOblast),
+ "Republic of Adygea" => Ok(Self::RepublicOfAdygea),
+ "Republic of Bashkortostan" => Ok(Self::RepublicOfBashkortostan),
+ "Republic of Buryatia" => Ok(Self::RepublicOfBuryatia),
+ "Republic of Dagestan" => Ok(Self::RepublicOfDagestan),
+ "Republic of Ingushetia" => Ok(Self::RepublicOfIngushetia),
+ "Republic of Kalmykia" => Ok(Self::RepublicOfKalmykia),
+ "Republic of Karelia" => Ok(Self::RepublicOfKarelia),
+ "Republic of Khakassia" => Ok(Self::RepublicOfKhakassia),
+ "Republic of Mordovia" => Ok(Self::RepublicOfMordovia),
+ "Republic of North Ossetia-Alania" => Ok(Self::RepublicOfNorthOssetiaAlania),
+ "Republic of Tatarstan" => Ok(Self::RepublicOfTatarstan),
+ "Rostov Oblast" => Ok(Self::RostovOblast),
+ "Ryazan Oblast" => Ok(Self::RyazanOblast),
+ "Saint Petersburg" => Ok(Self::SaintPetersburg),
+ "Sakha Republic" => Ok(Self::SakhaRepublic),
+ "Sakhalin" => Ok(Self::Sakhalin),
+ "Samara Oblast" => Ok(Self::SamaraOblast),
+ "Saratov Oblast" => Ok(Self::SaratovOblast),
+ "Sevastopol" => Ok(Self::Sevastopol),
+ "Smolensk Oblast" => Ok(Self::SmolenskOblast),
+ "Stavropol Krai" => Ok(Self::StavropolKrai),
+ "Sverdlovsk" => Ok(Self::Sverdlovsk),
+ "Tambov Oblast" => Ok(Self::TambovOblast),
+ "Tomsk Oblast" => Ok(Self::TomskOblast),
+ "Tula Oblast" => Ok(Self::TulaOblast),
+ "Tuva Republic" => Ok(Self::TuvaRepublic),
+ "Tver Oblast" => Ok(Self::TverOblast),
+ "Tyumen Oblast" => Ok(Self::TyumenOblast),
+ "Udmurt Republic" => Ok(Self::UdmurtRepublic),
+ "Ulyanovsk Oblast" => Ok(Self::UlyanovskOblast),
+ "Vladimir Oblast" => Ok(Self::VladimirOblast),
+ "Vologda Oblast" => Ok(Self::VologdaOblast),
+ "Voronezh Oblast" => Ok(Self::VoronezhOblast),
+ "Yamalo-Nenets Autonomous Okrug" => Ok(Self::YamaloNenetsAutonomousOkrug),
+ "Yaroslavl Oblast" => Ok(Self::YaroslavlOblast),
+ "Zabaykalsky Krai" => Ok(Self::ZabaykalskyKrai),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4588,31 +4566,25 @@ impl ForeignTryFrom<String> for RussiaStatesAbbreviation {
impl ForeignTryFrom<String> for SanMarinoStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "SanMarinoStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "SanMarinoStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "acquaviva" => Ok(Self::Acquaviva),
- "borgo maggiore" => Ok(Self::BorgoMaggiore),
- "chiesanuova" => Ok(Self::Chiesanuova),
- "domagnano" => Ok(Self::Domagnano),
- "faetano" => Ok(Self::Faetano),
- "fiorentino" => Ok(Self::Fiorentino),
- "montegiardino" => Ok(Self::Montegiardino),
- "san marino" => Ok(Self::SanMarino),
- "serravalle" => Ok(Self::Serravalle),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Acquaviva" => Ok(Self::Acquaviva),
+ "Borgo Maggiore" => Ok(Self::BorgoMaggiore),
+ "Chiesanuova" => Ok(Self::Chiesanuova),
+ "Domagnano" => Ok(Self::Domagnano),
+ "Faetano" => Ok(Self::Faetano),
+ "Fiorentino" => Ok(Self::Fiorentino),
+ "Montegiardino" => Ok(Self::Montegiardino),
+ "San Marino" => Ok(Self::SanMarino),
+ "Serravalle" => Ok(Self::Serravalle),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4621,45 +4593,41 @@ impl ForeignTryFrom<String> for SerbiaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "SerbiaStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "SerbiaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "belgrade" => Ok(Self::Belgrade),
- "bor district" => Ok(Self::BorDistrict),
- "braničevo district" => Ok(Self::BraničevoDistrict),
- "central banat district" => Ok(Self::CentralBanatDistrict),
- "jablanica district" => Ok(Self::JablanicaDistrict),
- "kolubara district" => Ok(Self::KolubaraDistrict),
- "mačva district" => Ok(Self::MačvaDistrict),
- "moravica district" => Ok(Self::MoravicaDistrict),
- "nišava district" => Ok(Self::NišavaDistrict),
- "north banat district" => Ok(Self::NorthBanatDistrict),
- "north bačka district" => Ok(Self::NorthBačkaDistrict),
- "pirot district" => Ok(Self::PirotDistrict),
- "podunavlje district" => Ok(Self::PodunavljeDistrict),
- "pomoravlje district" => Ok(Self::PomoravljeDistrict),
- "pčinja district" => Ok(Self::PčinjaDistrict),
- "rasina district" => Ok(Self::RasinaDistrict),
- "raška district" => Ok(Self::RaškaDistrict),
- "south banat district" => Ok(Self::SouthBanatDistrict),
- "south bačka district" => Ok(Self::SouthBačkaDistrict),
- "srem district" => Ok(Self::SremDistrict),
- "toplica district" => Ok(Self::ToplicaDistrict),
- "vojvodina" => Ok(Self::Vojvodina),
- "west bačka district" => Ok(Self::WestBačkaDistrict),
- "zaječar district" => Ok(Self::ZaječarDistrict),
- "zlatibor district" => Ok(Self::ZlatiborDistrict),
- "šumadija district" => Ok(Self::ŠumadijaDistrict),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Belgrade" => Ok(Self::Belgrade),
+ "Bor District" => Ok(Self::BorDistrict),
+ "Braničevo District" => Ok(Self::BraničevoDistrict),
+ "Central Banat District" => Ok(Self::CentralBanatDistrict),
+ "Jablanica District" => Ok(Self::JablanicaDistrict),
+ "Kolubara District" => Ok(Self::KolubaraDistrict),
+ "Mačva District" => Ok(Self::MačvaDistrict),
+ "Moravica District" => Ok(Self::MoravicaDistrict),
+ "Nišava District" => Ok(Self::NišavaDistrict),
+ "North Banat District" => Ok(Self::NorthBanatDistrict),
+ "North Bačka District" => Ok(Self::NorthBačkaDistrict),
+ "Pirot District" => Ok(Self::PirotDistrict),
+ "Podunavlje District" => Ok(Self::PodunavljeDistrict),
+ "Pomoravlje District" => Ok(Self::PomoravljeDistrict),
+ "Pčinja District" => Ok(Self::PčinjaDistrict),
+ "Rasina District" => Ok(Self::RasinaDistrict),
+ "Raška District" => Ok(Self::RaškaDistrict),
+ "South Banat District" => Ok(Self::SouthBanatDistrict),
+ "South Bačka District" => Ok(Self::SouthBačkaDistrict),
+ "Srem District" => Ok(Self::SremDistrict),
+ "Toplica District" => Ok(Self::ToplicaDistrict),
+ "Vojvodina" => Ok(Self::Vojvodina),
+ "West Bačka District" => Ok(Self::WestBačkaDistrict),
+ "Zaječar District" => Ok(Self::ZaječarDistrict),
+ "Zlatibor District" => Ok(Self::ZlatiborDistrict),
+ "Šumadija District" => Ok(Self::ŠumadijaDistrict),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4667,30 +4635,24 @@ impl ForeignTryFrom<String> for SerbiaStatesAbbreviation {
impl ForeignTryFrom<String> for SlovakiaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "SlovakiaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "SlovakiaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "banska bystrica region" => Ok(Self::BanskaBystricaRegion),
- "bratislava region" => Ok(Self::BratislavaRegion),
- "kosice region" => Ok(Self::KosiceRegion),
- "nitra region" => Ok(Self::NitraRegion),
- "presov region" => Ok(Self::PresovRegion),
- "trencin region" => Ok(Self::TrencinRegion),
- "trnava region" => Ok(Self::TrnavaRegion),
- "zilina region" => Ok(Self::ZilinaRegion),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Banská Bystrica Region" => Ok(Self::BanskaBystricaRegion),
+ "Bratislava Region" => Ok(Self::BratislavaRegion),
+ "Košice Region" => Ok(Self::KosiceRegion),
+ "Nitra Region" => Ok(Self::NitraRegion),
+ "Prešov Region" => Ok(Self::PresovRegion),
+ "Trenčín Region" => Ok(Self::TrencinRegion),
+ "Trnava Region" => Ok(Self::TrnavaRegion),
+ "Žilina Region" => Ok(Self::ZilinaRegion),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4699,39 +4661,35 @@ impl ForeignTryFrom<String> for SwedenStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
- StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "SwedenStatesAbbreviation");
+ StringExt::<Self>::parse_enum(value.clone(), "SwedenStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "blekinge" => Ok(Self::Blekinge),
- "dalarna county" => Ok(Self::DalarnaCounty),
- "gotland county" => Ok(Self::GotlandCounty),
- "gävleborg county" => Ok(Self::GävleborgCounty),
- "halland county" => Ok(Self::HallandCounty),
- "jönköping county" => Ok(Self::JönköpingCounty),
- "kalmar county" => Ok(Self::KalmarCounty),
- "kronoberg county" => Ok(Self::KronobergCounty),
- "norrbotten county" => Ok(Self::NorrbottenCounty),
- "skåne county" => Ok(Self::SkåneCounty),
- "stockholm county" => Ok(Self::StockholmCounty),
- "södermanland county" => Ok(Self::SödermanlandCounty),
- "uppsala county" => Ok(Self::UppsalaCounty),
- "värmland county" => Ok(Self::VärmlandCounty),
- "västerbotten county" => Ok(Self::VästerbottenCounty),
- "västernorrland county" => Ok(Self::VästernorrlandCounty),
- "västmanland county" => Ok(Self::VästmanlandCounty),
- "västra götaland county" => Ok(Self::VästraGötalandCounty),
- "örebro county" => Ok(Self::ÖrebroCounty),
- "östergötland county" => Ok(Self::ÖstergötlandCounty),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Blekinge" => Ok(Self::Blekinge),
+ "Dalarna County" => Ok(Self::DalarnaCounty),
+ "Gotland County" => Ok(Self::GotlandCounty),
+ "Gävleborg County" => Ok(Self::GävleborgCounty),
+ "Halland County" => Ok(Self::HallandCounty),
+ "Jönköping County" => Ok(Self::JönköpingCounty),
+ "Kalmar County" => Ok(Self::KalmarCounty),
+ "Kronoberg County" => Ok(Self::KronobergCounty),
+ "Norrbotten County" => Ok(Self::NorrbottenCounty),
+ "Skåne County" => Ok(Self::SkåneCounty),
+ "Stockholm County" => Ok(Self::StockholmCounty),
+ "Södermanland County" => Ok(Self::SödermanlandCounty),
+ "Uppsala County" => Ok(Self::UppsalaCounty),
+ "Värmland County" => Ok(Self::VärmlandCounty),
+ "Västerbotten County" => Ok(Self::VästerbottenCounty),
+ "Västernorrland County" => Ok(Self::VästernorrlandCounty),
+ "Västmanland County" => Ok(Self::VästmanlandCounty),
+ "Västra Götaland County" => Ok(Self::VästraGötalandCounty),
+ "Örebro County" => Ok(Self::ÖrebroCounty),
+ "Östergötland County" => Ok(Self::ÖstergötlandCounty),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
@@ -4739,76 +4697,229 @@ impl ForeignTryFrom<String> for SwedenStatesAbbreviation {
impl ForeignTryFrom<String> for SloveniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "SloveniaStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "SloveniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
- match state {
- "ajdovščina" => Ok(Self::Ajdovščina),
- "ankaran" => Ok(Self::Ankaran),
- "beltinci" => Ok(Self::Beltinci),
- "benedikt" => Ok(Self::Benedikt),
- "bistrica ob sotli" => Ok(Self::BistricaObSotli),
- "bled" => Ok(Self::Bled),
- "bloke" => Ok(Self::Bloke),
- "bohinj" => Ok(Self::Bohinj),
- "borovnica" => Ok(Self::Borovnica),
- "bovec" => Ok(Self::Bovec),
- "braslovče" => Ok(Self::Braslovče),
- "brda" => Ok(Self::Brda),
- "brezovica" => Ok(Self::Brezovica),
- "brežice" => Ok(Self::Brežice),
- "cankova" => Ok(Self::Cankova),
- "cerklje na gorenjskem" => Ok(Self::CerkljeNaGorenjskem),
- "cerknica" => Ok(Self::Cerknica),
- "cerkno" => Ok(Self::Cerkno),
- "cerkvenjak" => Ok(Self::Cerkvenjak),
- "city municipality of celje" => Ok(Self::CityMunicipalityOfCelje),
- "city municipality of novo mesto" => Ok(Self::CityMunicipalityOfNovoMesto),
- "destrnik" => Ok(Self::Destrnik),
- "divača" => Ok(Self::Divača),
- "dobje" => Ok(Self::Dobje),
- "dobrepolje" => Ok(Self::Dobrepolje),
- "dobrna" => Ok(Self::Dobrna),
- "dobrova-polhov gradec" => Ok(Self::DobrovaPolhovGradec),
- "dobrovnik" => Ok(Self::Dobrovnik),
- "dol pri ljubljani" => Ok(Self::DolPriLjubljani),
- "dolenjske toplice" => Ok(Self::DolenjskeToplice),
- "domžale" => Ok(Self::Domžale),
- "dornava" => Ok(Self::Dornava),
- "dravograd" => Ok(Self::Dravograd),
- "duplek" => Ok(Self::Duplek),
- "gorenja vas-poljane" => Ok(Self::GorenjaVasPoljane),
- "gorišnica" => Ok(Self::Gorišnica),
- "gorje" => Ok(Self::Gorje),
- "gornja radgona" => Ok(Self::GornjaRadgona),
- "gornji grad" => Ok(Self::GornjiGrad),
- "gornji petrovci" => Ok(Self::GornjiPetrovci),
- "grad" => Ok(Self::Grad),
- "grosuplje" => Ok(Self::Grosuplje),
- "hajdina" => Ok(Self::Hajdina),
- "hodoš" => Ok(Self::Hodoš),
- "horjul" => Ok(Self::Horjul),
- "hoče-slivnica" => Ok(Self::HočeSlivnica),
- "hrastnik" => Ok(Self::Hrastnik),
- "hrpelje-kozina" => Ok(Self::HrpeljeKozina),
- "idrija" => Ok(Self::Idrija),
- "ig" => Ok(Self::Ig),
- "ivančna gorica" => Ok(Self::IvančnaGorica),
- "izola" => Ok(Self::Izola),
- "jesenice" => Ok(Self::Jesenice),
- "jezersko" => Ok(Self::Jezersko),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Ajdovščina Municipality" => Ok(Self::Ajdovščina),
+ "Ankaran Municipality" => Ok(Self::Ankaran),
+ "Beltinci Municipality" => Ok(Self::Beltinci),
+ "Benedikt Municipality" => Ok(Self::Benedikt),
+ "Bistrica ob Sotli Municipality" => Ok(Self::BistricaObSotli),
+ "Bled Municipality" => Ok(Self::Bled),
+ "Bloke Municipality" => Ok(Self::Bloke),
+ "Bohinj Municipality" => Ok(Self::Bohinj),
+ "Borovnica Municipality" => Ok(Self::Borovnica),
+ "Bovec Municipality" => Ok(Self::Bovec),
+ "Braslovče Municipality" => Ok(Self::Braslovče),
+ "Brda Municipality" => Ok(Self::Brda),
+ "Brezovica Municipality" => Ok(Self::Brezovica),
+ "Brežice Municipality" => Ok(Self::Brežice),
+ "Cankova Municipality" => Ok(Self::Cankova),
+ "Cerklje na Gorenjskem Municipality" => Ok(Self::CerkljeNaGorenjskem),
+ "Cerknica Municipality" => Ok(Self::Cerknica),
+ "Cerkno Municipality" => Ok(Self::Cerkno),
+ "Cerkvenjak Municipality" => Ok(Self::Cerkvenjak),
+ "City Municipality of Celje" => Ok(Self::CityMunicipalityOfCelje),
+ "City Municipality of Novo Mesto" => Ok(Self::CityMunicipalityOfNovoMesto),
+ "Destrnik Municipality" => Ok(Self::Destrnik),
+ "Divača Municipality" => Ok(Self::Divača),
+ "Dobje Municipality" => Ok(Self::Dobje),
+ "Dobrepolje Municipality" => Ok(Self::Dobrepolje),
+ "Dobrna Municipality" => Ok(Self::Dobrna),
+ "Dobrova–Polhov Gradec Municipality" => Ok(Self::DobrovaPolhovGradec),
+ "Dobrovnik Municipality" => Ok(Self::Dobrovnik),
+ "Dol pri Ljubljani Municipality" => Ok(Self::DolPriLjubljani),
+ "Dolenjske Toplice Municipality" => Ok(Self::DolenjskeToplice),
+ "Domžale Municipality" => Ok(Self::Domžale),
+ "Dornava Municipality" => Ok(Self::Dornava),
+ "Dravograd Municipality" => Ok(Self::Dravograd),
+ "Duplek Municipality" => Ok(Self::Duplek),
+ "Gorenja Vas–Poljane Municipality" => Ok(Self::GorenjaVasPoljane),
+ "Gorišnica Municipality" => Ok(Self::Gorišnica),
+ "Gorje Municipality" => Ok(Self::Gorje),
+ "Gornja Radgona Municipality" => Ok(Self::GornjaRadgona),
+ "Gornji Grad Municipality" => Ok(Self::GornjiGrad),
+ "Gornji Petrovci Municipality" => Ok(Self::GornjiPetrovci),
+ "Grad Municipality" => Ok(Self::Grad),
+ "Grosuplje Municipality" => Ok(Self::Grosuplje),
+ "Hajdina Municipality" => Ok(Self::Hajdina),
+ "Hodoš Municipality" => Ok(Self::Hodoš),
+ "Horjul Municipality" => Ok(Self::Horjul),
+ "Hoče–Slivnica Municipality" => Ok(Self::HočeSlivnica),
+ "Hrastnik Municipality" => Ok(Self::Hrastnik),
+ "Hrpelje–Kozina Municipality" => Ok(Self::HrpeljeKozina),
+ "Idrija Municipality" => Ok(Self::Idrija),
+ "Ig Municipality" => Ok(Self::Ig),
+ "Ivančna Gorica Municipality" => Ok(Self::IvančnaGorica),
+ "Izola Municipality" => Ok(Self::Izola),
+ "Jesenice Municipality" => Ok(Self::Jesenice),
+ "Jezersko Municipality" => Ok(Self::Jezersko),
+ "Juršinci Municipality" => Ok(Self::Jursinci),
+ "Kamnik Municipality" => Ok(Self::Kamnik),
+ "Kanal ob Soči Municipality" => Ok(Self::KanalObSoci),
+ "Kidričevo Municipality" => Ok(Self::Kidricevo),
+ "Kobarid Municipality" => Ok(Self::Kobarid),
+ "Kobilje Municipality" => Ok(Self::Kobilje),
+ "Komen Municipality" => Ok(Self::Komen),
+ "Komenda Municipality" => Ok(Self::Komenda),
+ "Koper City Municipality" => Ok(Self::Koper),
+ "Kostanjevica na Krki Municipality" => Ok(Self::KostanjevicaNaKrki),
+ "Kostel Municipality" => Ok(Self::Kostel),
+ "Kozje Municipality" => Ok(Self::Kozje),
+ "Kočevje Municipality" => Ok(Self::Kocevje),
+ "Kranj City Municipality" => Ok(Self::Kranj),
+ "Kranjska Gora Municipality" => Ok(Self::KranjskaGora),
+ "Križevci Municipality" => Ok(Self::Krizevci),
+ "Kungota" => Ok(Self::Kungota),
+ "Kuzma Municipality" => Ok(Self::Kuzma),
+ "Laško Municipality" => Ok(Self::Lasko),
+ "Lenart Municipality" => Ok(Self::Lenart),
+ "Lendava Municipality" => Ok(Self::Lendava),
+ "Litija Municipality" => Ok(Self::Litija),
+ "Ljubljana City Municipality" => Ok(Self::Ljubljana),
+ "Ljubno Municipality" => Ok(Self::Ljubno),
+ "Ljutomer Municipality" => Ok(Self::Ljutomer),
+ "Logatec Municipality" => Ok(Self::Logatec),
+ "Log–Dragomer Municipality" => Ok(Self::LogDragomer),
+ "Lovrenc na Pohorju Municipality" => Ok(Self::LovrencNaPohorju),
+ "Loška Dolina Municipality" => Ok(Self::LoskaDolina),
+ "Loški Potok Municipality" => Ok(Self::LoskiPotok),
+ "Lukovica Municipality" => Ok(Self::Lukovica),
+ "Luče Municipality" => Ok(Self::Luče),
+ "Majšperk Municipality" => Ok(Self::Majsperk),
+ "Makole Municipality" => Ok(Self::Makole),
+ "Maribor City Municipality" => Ok(Self::Maribor),
+ "Markovci Municipality" => Ok(Self::Markovci),
+ "Medvode Municipality" => Ok(Self::Medvode),
+ "Mengeš Municipality" => Ok(Self::Menges),
+ "Metlika Municipality" => Ok(Self::Metlika),
+ "Mežica Municipality" => Ok(Self::Mezica),
+ "Miklavž na Dravskem Polju Municipality" => Ok(Self::MiklavzNaDravskemPolju),
+ "Miren–Kostanjevica Municipality" => Ok(Self::MirenKostanjevica),
+ "Mirna Municipality" => Ok(Self::Mirna),
+ "Mirna Peč Municipality" => Ok(Self::MirnaPec),
+ "Mislinja Municipality" => Ok(Self::Mislinja),
+ "Mokronog–Trebelno Municipality" => Ok(Self::MokronogTrebelno),
+ "Moravske Toplice Municipality" => Ok(Self::MoravskeToplice),
+ "Moravče Municipality" => Ok(Self::Moravce),
+ "Mozirje Municipality" => Ok(Self::Mozirje),
+ "Municipality of Apače" => Ok(Self::Apače),
+ "Municipality of Cirkulane" => Ok(Self::Cirkulane),
+ "Municipality of Ilirska Bistrica" => Ok(Self::IlirskaBistrica),
+ "Municipality of Krško" => Ok(Self::Krsko),
+ "Municipality of Škofljica" => Ok(Self::Skofljica),
+ "Murska Sobota City Municipality" => Ok(Self::MurskaSobota),
+ "Muta Municipality" => Ok(Self::Muta),
+ "Naklo Municipality" => Ok(Self::Naklo),
+ "Nazarje Municipality" => Ok(Self::Nazarje),
+ "Nova Gorica City Municipality" => Ok(Self::NovaGorica),
+ "Odranci Municipality" => Ok(Self::Odranci),
+ "Oplotnica" => Ok(Self::Oplotnica),
+ "Ormož Municipality" => Ok(Self::Ormoz),
+ "Osilnica Municipality" => Ok(Self::Osilnica),
+ "Pesnica Municipality" => Ok(Self::Pesnica),
+ "Piran Municipality" => Ok(Self::Piran),
+ "Pivka Municipality" => Ok(Self::Pivka),
+ "Podlehnik Municipality" => Ok(Self::Podlehnik),
+ "Podvelka Municipality" => Ok(Self::Podvelka),
+ "Podčetrtek Municipality" => Ok(Self::Podcetrtek),
+ "Poljčane Municipality" => Ok(Self::Poljcane),
+ "Polzela Municipality" => Ok(Self::Polzela),
+ "Postojna Municipality" => Ok(Self::Postojna),
+ "Prebold Municipality" => Ok(Self::Prebold),
+ "Preddvor Municipality" => Ok(Self::Preddvor),
+ "Prevalje Municipality" => Ok(Self::Prevalje),
+ "Ptuj City Municipality" => Ok(Self::Ptuj),
+ "Puconci Municipality" => Ok(Self::Puconci),
+ "Radenci Municipality" => Ok(Self::Radenci),
+ "Radeče Municipality" => Ok(Self::Radece),
+ "Radlje ob Dravi Municipality" => Ok(Self::RadljeObDravi),
+ "Radovljica Municipality" => Ok(Self::Radovljica),
+ "Ravne na Koroškem Municipality" => Ok(Self::RavneNaKoroskem),
+ "Razkrižje Municipality" => Ok(Self::Razkrizje),
+ "Rače–Fram Municipality" => Ok(Self::RaceFram),
+ "Renče–Vogrsko Municipality" => Ok(Self::RenčeVogrsko),
+ "Rečica ob Savinji Municipality" => Ok(Self::RecicaObSavinji),
+ "Ribnica Municipality" => Ok(Self::Ribnica),
+ "Ribnica na Pohorju Municipality" => Ok(Self::RibnicaNaPohorju),
+ "Rogatec Municipality" => Ok(Self::Rogatec),
+ "Rogaška Slatina Municipality" => Ok(Self::RogaskaSlatina),
+ "Rogašovci Municipality" => Ok(Self::Rogasovci),
+ "Ruše Municipality" => Ok(Self::Ruse),
+ "Selnica ob Dravi Municipality" => Ok(Self::SelnicaObDravi),
+ "Semič Municipality" => Ok(Self::Semic),
+ "Sevnica Municipality" => Ok(Self::Sevnica),
+ "Sežana Municipality" => Ok(Self::Sezana),
+ "Slovenj Gradec City Municipality" => Ok(Self::SlovenjGradec),
+ "Slovenska Bistrica Municipality" => Ok(Self::SlovenskaBistrica),
+ "Slovenske Konjice Municipality" => Ok(Self::SlovenskeKonjice),
+ "Sodražica Municipality" => Ok(Self::Sodrazica),
+ "Solčava Municipality" => Ok(Self::Solcava),
+ "Središče ob Dravi" => Ok(Self::SredisceObDravi),
+ "Starše Municipality" => Ok(Self::Starse),
+ "Straža Municipality" => Ok(Self::Straza),
+ "Sveta Ana Municipality" => Ok(Self::SvetaAna),
+ "Sveta Trojica v Slovenskih Goricah Municipality" => Ok(Self::SvetaTrojica),
+ "Sveti Andraž v Slovenskih Goricah Municipality" => Ok(Self::SvetiAndraz),
+ "Sveti Jurij ob Ščavnici Municipality" => Ok(Self::SvetiJurijObScavnici),
+ "Sveti Jurij v Slovenskih Goricah Municipality" => {
+ Ok(Self::SvetiJurijVSlovenskihGoricah)
}
- }
+ "Sveti Tomaž Municipality" => Ok(Self::SvetiTomaz),
+ "Tabor Municipality" => Ok(Self::Tabor),
+ "Tišina Municipality" => Ok(Self::Tišina),
+ "Tolmin Municipality" => Ok(Self::Tolmin),
+ "Trbovlje Municipality" => Ok(Self::Trbovlje),
+ "Trebnje Municipality" => Ok(Self::Trebnje),
+ "Trnovska Vas Municipality" => Ok(Self::TrnovskaVas),
+ "Trzin Municipality" => Ok(Self::Trzin),
+ "Tržič Municipality" => Ok(Self::Tržič),
+ "Turnišče Municipality" => Ok(Self::Turnišče),
+ "Velika Polana Municipality" => Ok(Self::VelikaPolana),
+ "Velike Lašče Municipality" => Ok(Self::VelikeLašče),
+ "Veržej Municipality" => Ok(Self::Veržej),
+ "Videm Municipality" => Ok(Self::Videm),
+ "Vipava Municipality" => Ok(Self::Vipava),
+ "Vitanje Municipality" => Ok(Self::Vitanje),
+ "Vodice Municipality" => Ok(Self::Vodice),
+ "Vojnik Municipality" => Ok(Self::Vojnik),
+ "Vransko Municipality" => Ok(Self::Vransko),
+ "Vrhnika Municipality" => Ok(Self::Vrhnika),
+ "Vuzenica Municipality" => Ok(Self::Vuzenica),
+ "Zagorje ob Savi Municipality" => Ok(Self::ZagorjeObSavi),
+ "Zavrč Municipality" => Ok(Self::Zavrč),
+ "Zreče Municipality" => Ok(Self::Zreče),
+ "Črenšovci Municipality" => Ok(Self::Črenšovci),
+ "Črna na Koroškem Municipality" => Ok(Self::ČrnaNaKoroškem),
+ "Črnomelj Municipality" => Ok(Self::Črnomelj),
+ "Šalovci Municipality" => Ok(Self::Šalovci),
+ "Šempeter–Vrtojba Municipality" => Ok(Self::ŠempeterVrtojba),
+ "Šentilj Municipality" => Ok(Self::Šentilj),
+ "Šentjernej Municipality" => Ok(Self::Šentjernej),
+ "Šentjur Municipality" => Ok(Self::Šentjur),
+ "Šentrupert Municipality" => Ok(Self::Šentrupert),
+ "Šenčur Municipality" => Ok(Self::Šenčur),
+ "Škocjan Municipality" => Ok(Self::Škocjan),
+ "Škofja Loka Municipality" => Ok(Self::ŠkofjaLoka),
+ "Šmarje pri Jelšah Municipality" => Ok(Self::ŠmarjePriJelšah),
+ "Šmarješke Toplice Municipality" => Ok(Self::ŠmarješkeToplice),
+ "Šmartno ob Paki Municipality" => Ok(Self::ŠmartnoObPaki),
+ "Šmartno pri Litiji Municipality" => Ok(Self::ŠmartnoPriLitiji),
+ "Šoštanj Municipality" => Ok(Self::Šoštanj),
+ "Štore Municipality" => Ok(Self::Štore),
+ "Žalec Municipality" => Ok(Self::Žalec),
+ "Železniki Municipality" => Ok(Self::Železniki),
+ "Žetale Municipality" => Ok(Self::Žetale),
+ "Žiri Municipality" => Ok(Self::Žiri),
+ "Žirovnica Municipality" => Ok(Self::Žirovnica),
+ "Žužemberk Municipality" => Ok(Self::Žužemberk),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
+ }
+ .into()),
+ },
}
}
}
@@ -4817,49 +4928,42 @@ impl ForeignTryFrom<String> for UkraineStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
- let state_abbreviation_check = StringExt::<Self>::parse_enum(
- value.to_uppercase().clone(),
- "UkraineStatesAbbreviation",
- );
+ let state_abbreviation_check =
+ StringExt::<Self>::parse_enum(value.clone(), "UkraineStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
- Err(_) => {
- let binding = value.as_str().to_lowercase();
- let state = binding.as_str();
-
- match state {
- "autonomous republic of crimea" => Ok(Self::AutonomousRepublicOfCrimea),
- "cherkasy oblast" => Ok(Self::CherkasyOblast),
- "chernihiv oblast" => Ok(Self::ChernihivOblast),
- "chernivtsi oblast" => Ok(Self::ChernivtsiOblast),
- "dnipropetrovsk oblast" => Ok(Self::DnipropetrovskOblast),
- "donetsk oblast" => Ok(Self::DonetskOblast),
- "ivano-frankivsk oblast" => Ok(Self::IvanoFrankivskOblast),
- "kharkiv oblast" => Ok(Self::KharkivOblast),
- "kherson oblast" => Ok(Self::KhersonOblast),
- "khmelnytsky oblast" => Ok(Self::KhmelnytskyOblast),
- "kiev" => Ok(Self::Kiev),
- "kirovohrad oblast" => Ok(Self::KirovohradOblast),
- "kyiv oblast" => Ok(Self::KyivOblast),
- "luhansk oblast" => Ok(Self::LuhanskOblast),
- "lviv oblast" => Ok(Self::LvivOblast),
- "mykolaiv oblast" => Ok(Self::MykolaivOblast),
- "odessa oblast" => Ok(Self::OdessaOblast),
- "rivne oblast" => Ok(Self::RivneOblast),
- "sumy oblast" => Ok(Self::SumyOblast),
- "ternopil oblast" => Ok(Self::TernopilOblast),
- "vinnytsia oblast" => Ok(Self::VinnytsiaOblast),
- "volyn oblast" => Ok(Self::VolynOblast),
- "zakarpattia oblast" => Ok(Self::ZakarpattiaOblast),
- "zaporizhzhya oblast" => Ok(Self::ZaporizhzhyaOblast),
- "zhytomyr oblast" => Ok(Self::ZhytomyrOblast),
- _ => Err(errors::ConnectorError::InvalidDataFormat {
- field_name: "address.state",
- }
- .into()),
+ Err(_) => match value.as_str() {
+ "Autonomous Republic of Crimea" => Ok(Self::AutonomousRepublicOfCrimea),
+ "Cherkasy Oblast" => Ok(Self::CherkasyOblast),
+ "Chernihiv Oblast" => Ok(Self::ChernihivOblast),
+ "Chernivtsi Oblast" => Ok(Self::ChernivtsiOblast),
+ "Dnipropetrovsk Oblast" => Ok(Self::DnipropetrovskOblast),
+ "Donetsk Oblast" => Ok(Self::DonetskOblast),
+ "Ivano-Frankivsk Oblast" => Ok(Self::IvanoFrankivskOblast),
+ "Kharkiv Oblast" => Ok(Self::KharkivOblast),
+ "Kherson Oblast" => Ok(Self::KhersonOblast),
+ "Khmelnytsky Oblast" => Ok(Self::KhmelnytskyOblast),
+ "Kiev" => Ok(Self::Kiev),
+ "Kirovohrad Oblast" => Ok(Self::KirovohradOblast),
+ "Kyiv Oblast" => Ok(Self::KyivOblast),
+ "Luhansk Oblast" => Ok(Self::LuhanskOblast),
+ "Lviv Oblast" => Ok(Self::LvivOblast),
+ "Mykolaiv Oblast" => Ok(Self::MykolaivOblast),
+ "Odessa Oblast" => Ok(Self::OdessaOblast),
+ "Rivne Oblast" => Ok(Self::RivneOblast),
+ "Sumy Oblast" => Ok(Self::SumyOblast),
+ "Ternopil Oblast" => Ok(Self::TernopilOblast),
+ "Vinnytsia Oblast" => Ok(Self::VinnytsiaOblast),
+ "Volyn Oblast" => Ok(Self::VolynOblast),
+ "Zakarpattia Oblast" => Ok(Self::ZakarpattiaOblast),
+ "Zaporizhzhya Oblast" => Ok(Self::ZaporizhzhyaOblast),
+ "Zhytomyr Oblast" => Ok(Self::ZhytomyrOblast),
+ _ => Err(errors::ConnectorError::InvalidDataFormat {
+ field_name: "address.state",
}
- }
+ .into()),
+ },
}
}
}
|
refactor
|
match string for state with SDK's naming convention (#7300)
|
89857941b09c5fbe0f3e7d5b4f908bb144ae162d
|
2023-11-08 21:31:53
|
Sampras Lopes
|
feat(events): add extracted fields based on req/res types (#2795)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 886a8b50acc..ac7fde55d8e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1503,7 +1503,6 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
name = "common_enums"
version = "0.1.0"
dependencies = [
- "common_utils",
"diesel",
"router_derive",
"serde",
@@ -1519,6 +1518,7 @@ version = "0.1.0"
dependencies = [
"async-trait",
"bytes",
+ "common_enums",
"diesel",
"error-stack",
"fake",
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 037d223754a..e844d1900a1 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -893,6 +893,8 @@ pub struct ToggleKVResponse {
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ToggleKVRequest {
+ #[serde(skip_deserializing)]
+ pub merchant_id: String,
/// Status of KV for the specific merchant
#[schema(example = true)]
pub kv_enabled: bool,
diff --git a/crates/api_models/src/api_keys.rs b/crates/api_models/src/api_keys.rs
index f0ab403d9c6..805c5616c2a 100644
--- a/crates/api_models/src/api_keys.rs
+++ b/crates/api_models/src/api_keys.rs
@@ -129,6 +129,12 @@ pub struct UpdateApiKeyRequest {
/// rotating your keys once every 6 months.
#[schema(example = "2022-09-10T10:11:12Z")]
pub expiration: Option<ApiKeyExpiration>,
+
+ #[serde(skip_deserializing)]
+ pub key_id: String,
+
+ #[serde(skip_deserializing)]
+ pub merchant_id: String,
}
/// The response body for revoking an API Key.
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
new file mode 100644
index 00000000000..78f34b4b87f
--- /dev/null
+++ b/crates/api_models/src/events.rs
@@ -0,0 +1,74 @@
+pub mod customer;
+pub mod payment;
+#[cfg(feature = "payouts")]
+pub mod payouts;
+pub mod refund;
+pub mod routing;
+
+use common_utils::{
+ events::{ApiEventMetric, ApiEventsType},
+ impl_misc_api_event_type,
+};
+
+use crate::{
+ admin::*, api_keys::*, cards_info::*, disputes::*, files::*, mandates::*, payment_methods::*,
+ payments::*, verifications::*,
+};
+
+impl ApiEventMetric for TimeRange {}
+
+impl_misc_api_event_type!(
+ PaymentMethodId,
+ PaymentsSessionResponse,
+ PaymentMethodListResponse,
+ PaymentMethodCreate,
+ PaymentLinkInitiateRequest,
+ RetrievePaymentLinkResponse,
+ MandateListConstraints,
+ CreateFileResponse,
+ DisputeResponse,
+ SubmitEvidenceRequest,
+ MerchantConnectorResponse,
+ MerchantConnectorId,
+ MandateResponse,
+ MandateRevokedResponse,
+ RetrievePaymentLinkRequest,
+ MandateId,
+ DisputeListConstraints,
+ RetrieveApiKeyResponse,
+ BusinessProfileResponse,
+ BusinessProfileUpdate,
+ BusinessProfileCreate,
+ RevokeApiKeyResponse,
+ ToggleKVResponse,
+ ToggleKVRequest,
+ MerchantAccountDeleteResponse,
+ MerchantAccountUpdate,
+ CardInfoResponse,
+ CreateApiKeyResponse,
+ CreateApiKeyRequest,
+ MerchantConnectorDeleteResponse,
+ MerchantConnectorUpdate,
+ MerchantConnectorCreate,
+ MerchantId,
+ CardsInfoRequest,
+ MerchantAccountResponse,
+ MerchantAccountListRequest,
+ MerchantAccountCreate,
+ PaymentsSessionRequest,
+ ApplepayMerchantVerificationRequest,
+ ApplepayMerchantResponse,
+ ApplepayVerifiedDomainsResponse,
+ UpdateApiKeyRequest
+);
+
+#[cfg(feature = "stripe")]
+impl_misc_api_event_type!(
+ StripeSetupIntentResponse,
+ StripeRefundResponse,
+ StripePaymentIntentListResponse,
+ StripePaymentIntentResponse,
+ CustomerDeleteResponse,
+ CustomerPaymentMethodListResponse,
+ CreateCustomerResponse
+);
diff --git a/crates/api_models/src/events/customer.rs b/crates/api_models/src/events/customer.rs
new file mode 100644
index 00000000000..29f56504218
--- /dev/null
+++ b/crates/api_models/src/events/customer.rs
@@ -0,0 +1,35 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::customers::{CustomerDeleteResponse, CustomerId, CustomerRequest, CustomerResponse};
+
+impl ApiEventMetric for CustomerDeleteResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Customer {
+ customer_id: self.customer_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for CustomerRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Customer {
+ customer_id: self.customer_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for CustomerResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Customer {
+ customer_id: self.customer_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for CustomerId {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Customer {
+ customer_id: self.customer_id.clone(),
+ })
+ }
+}
diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
new file mode 100644
index 00000000000..2f3336fc277
--- /dev/null
+++ b/crates/api_models/src/events/payment.rs
@@ -0,0 +1,151 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::{
+ payment_methods::{
+ CustomerPaymentMethodsListResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest,
+ PaymentMethodResponse, PaymentMethodUpdate,
+ },
+ payments::{
+ PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,
+ PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest,
+ PaymentsCaptureRequest, PaymentsRejectRequest, PaymentsRequest, PaymentsResponse,
+ PaymentsRetrieveRequest, PaymentsStartRequest, RedirectionResponse,
+ },
+};
+impl ApiEventMetric for PaymentsRetrieveRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ match self.resource_id {
+ PaymentIdType::PaymentIntentId(ref id) => Some(ApiEventsType::Payment {
+ payment_id: id.clone(),
+ }),
+ _ => None,
+ }
+ }
+}
+
+impl ApiEventMetric for PaymentsStartRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payment {
+ payment_id: self.payment_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentsCaptureRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payment {
+ payment_id: self.payment_id.to_owned(),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentsCancelRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payment {
+ payment_id: self.payment_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentsApproveRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payment {
+ payment_id: self.payment_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentsRejectRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payment {
+ payment_id: self.payment_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentsRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ match self.payment_id {
+ Some(PaymentIdType::PaymentIntentId(ref id)) => Some(ApiEventsType::Payment {
+ payment_id: id.clone(),
+ }),
+ _ => None,
+ }
+ }
+}
+
+impl ApiEventMetric for PaymentsResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ self.payment_id
+ .clone()
+ .map(|payment_id| ApiEventsType::Payment { payment_id })
+ }
+}
+
+impl ApiEventMetric for PaymentMethodResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::PaymentMethod {
+ payment_method_id: self.payment_method_id.clone(),
+ payment_method: Some(self.payment_method),
+ payment_method_type: self.payment_method_type,
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentMethodUpdate {}
+
+impl ApiEventMetric for PaymentMethodDeleteResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::PaymentMethod {
+ payment_method_id: self.payment_method_id.clone(),
+ payment_method: None,
+ payment_method_type: None,
+ })
+ }
+}
+
+impl ApiEventMetric for CustomerPaymentMethodsListResponse {}
+
+impl ApiEventMetric for PaymentMethodListRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::PaymentMethodList {
+ payment_id: self
+ .client_secret
+ .as_ref()
+ .and_then(|cs| cs.rsplit_once("_secret_"))
+ .map(|(pid, _)| pid.to_string()),
+ })
+ }
+}
+
+impl ApiEventMetric for PaymentListFilterConstraints {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for PaymentListFilters {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for PaymentListConstraints {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for PaymentListResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for PaymentListResponseV2 {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for RedirectionResponse {}
diff --git a/crates/api_models/src/events/payouts.rs b/crates/api_models/src/events/payouts.rs
new file mode 100644
index 00000000000..303709acc47
--- /dev/null
+++ b/crates/api_models/src/events/payouts.rs
@@ -0,0 +1,29 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::payouts::{
+ PayoutActionRequest, PayoutCreateRequest, PayoutCreateResponse, PayoutRetrieveRequest,
+};
+
+impl ApiEventMetric for PayoutRetrieveRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payout)
+ }
+}
+
+impl ApiEventMetric for PayoutCreateRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payout)
+ }
+}
+
+impl ApiEventMetric for PayoutCreateResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payout)
+ }
+}
+
+impl ApiEventMetric for PayoutActionRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Payout)
+ }
+}
diff --git a/crates/api_models/src/events/refund.rs b/crates/api_models/src/events/refund.rs
new file mode 100644
index 00000000000..424a3191db6
--- /dev/null
+++ b/crates/api_models/src/events/refund.rs
@@ -0,0 +1,63 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::refunds::{
+ RefundListMetaData, RefundListRequest, RefundListResponse, RefundRequest, RefundResponse,
+ RefundUpdateRequest, RefundsRetrieveRequest,
+};
+
+impl ApiEventMetric for RefundRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ let payment_id = self.payment_id.clone();
+ self.refund_id
+ .clone()
+ .map(|refund_id| ApiEventsType::Refund {
+ payment_id: Some(payment_id),
+ refund_id,
+ })
+ }
+}
+
+impl ApiEventMetric for RefundResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Refund {
+ payment_id: Some(self.payment_id.clone()),
+ refund_id: self.refund_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for RefundsRetrieveRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Refund {
+ payment_id: None,
+ refund_id: self.refund_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for RefundUpdateRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Refund {
+ payment_id: None,
+ refund_id: self.refund_id.clone(),
+ })
+ }
+}
+
+impl ApiEventMetric for RefundListRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for RefundListResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
+
+impl ApiEventMetric for RefundListMetaData {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
diff --git a/crates/api_models/src/events/routing.rs b/crates/api_models/src/events/routing.rs
new file mode 100644
index 00000000000..5eca01acc6f
--- /dev/null
+++ b/crates/api_models/src/events/routing.rs
@@ -0,0 +1,58 @@
+use common_utils::events::{ApiEventMetric, ApiEventsType};
+
+use crate::routing::{
+ LinkedRoutingConfigRetrieveResponse, MerchantRoutingAlgorithm, RoutingAlgorithmId,
+ RoutingConfigRequest, RoutingDictionaryRecord, RoutingKind,
+};
+#[cfg(feature = "business_profile_routing")]
+use crate::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery};
+
+impl ApiEventMetric for RoutingKind {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+impl ApiEventMetric for MerchantRoutingAlgorithm {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+impl ApiEventMetric for RoutingAlgorithmId {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+impl ApiEventMetric for RoutingDictionaryRecord {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+impl ApiEventMetric for LinkedRoutingConfigRetrieveResponse {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+#[cfg(feature = "business_profile_routing")]
+impl ApiEventMetric for RoutingRetrieveQuery {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+impl ApiEventMetric for RoutingConfigRequest {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
+
+#[cfg(feature = "business_profile_routing")]
+impl ApiEventMetric for RoutingRetrieveLinkQuery {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Routing)
+ }
+}
diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs
index ec272514e38..9fff344b9ff 100644
--- a/crates/api_models/src/lib.rs
+++ b/crates/api_models/src/lib.rs
@@ -9,6 +9,7 @@ pub mod enums;
pub mod ephemeral_key;
#[cfg(feature = "errors")]
pub mod errors;
+pub mod events;
pub mod files;
pub mod mandates;
pub mod organization;
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index dcbdb56bf7b..289f652981e 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -12,7 +12,9 @@ use utoipa::ToSchema;
#[cfg(feature = "payouts")]
use crate::payouts;
use crate::{
- admin, enums as api_enums,
+ admin,
+ customers::CustomerId,
+ enums as api_enums,
payments::{self, BankCodeResponse},
};
@@ -476,6 +478,8 @@ pub struct RequestPaymentMethodTypes {
#[derive(Debug, Clone, serde::Serialize, Default, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct PaymentMethodListRequest {
+ #[serde(skip_deserializing)]
+ pub customer_id: Option<CustomerId>,
/// This is a 15 minute expiry token which shall be used from the client to authenticate and perform sessions from the SDK
#[schema(max_length = 30, min_length = 30, example = "secret_k2uj3he2893ein2d")]
pub client_secret: Option<String>,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index f9cb21dae5f..c1880d58ad1 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2232,7 +2232,9 @@ pub struct PaymentListFilters {
pub authentication_type: Vec<enums::AuthenticationType>,
}
-#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
+#[derive(
+ Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
+)]
pub struct TimeRange {
/// The start time to filter payments list or to get list of filters. To get list of filters start time is needed to be passed
#[serde(with = "common_utils::custom_serde::iso8601")]
diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rs
index 7b4eae4238a..6fe8be8b529 100644
--- a/crates/api_models/src/refunds.rs
+++ b/crates/api_models/src/refunds.rs
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use utoipa::ToSchema;
+use super::payments::TimeRange;
use crate::{admin, enums};
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
@@ -75,6 +76,8 @@ pub struct RefundsRetrieveRequest {
#[derive(Default, Debug, ToSchema, Clone, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct RefundUpdateRequest {
+ #[serde(skip)]
+ pub refund_id: String,
/// An arbitrary string attached to the object. Often useful for displaying to users and your customer support executive
#[schema(max_length = 255, example = "Customer returned the product")]
pub reason: Option<String>,
@@ -152,16 +155,6 @@ pub struct RefundListRequest {
pub refund_status: Option<Vec<enums::RefundStatus>>,
}
-#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash, ToSchema)]
-pub struct TimeRange {
- /// The start time to filter refunds list or to get list of filters. To get list of filters start time is needed to be passed
- #[serde(with = "common_utils::custom_serde::iso8601")]
- pub start_time: PrimitiveDateTime,
- /// The end time to filter refunds list or to get list of filters. If not passed the default time is now
- #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
- pub end_time: Option<PrimitiveDateTime>,
-}
-
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]
pub struct RefundListResponse {
/// The number of refunds included in the list
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 95d4c5e10ec..425ca364191 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -592,3 +592,8 @@ pub enum RoutingKind {
Config(RoutingDictionary),
RoutingAlgorithm(Vec<RoutingDictionaryRecord>),
}
+
+#[repr(transparent)]
+#[derive(serde::Serialize, serde::Deserialize, Debug)]
+#[serde(transparent)]
+pub struct RoutingAlgorithmId(pub String);
diff --git a/crates/common_enums/Cargo.toml b/crates/common_enums/Cargo.toml
index 10b4fb509e8..e9f2dffcc05 100644
--- a/crates/common_enums/Cargo.toml
+++ b/crates/common_enums/Cargo.toml
@@ -19,7 +19,6 @@ time = { version = "0.3.21", features = ["serde", "serde-well-known", "std"] }
utoipa = { version = "3.3.0", features = ["preserve_order"] }
# First party crates
-common_utils = { version = "0.1.0", path = "../common_utils" }
router_derive = { version = "0.1.0", path = "../router_derive" }
[dev-dependencies]
diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml
index c1fd91a351c..62bd747da1b 100644
--- a/crates/common_utils/Cargo.toml
+++ b/crates/common_utils/Cargo.toml
@@ -42,6 +42,7 @@ phonenumber = "0.3.3"
# First party crates
masking = { version = "0.1.0", path = "../masking" }
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"], optional = true }
+common_enums = { version = "0.1.0", path = "../common_enums" }
[target.'cfg(not(target_os = "windows"))'.dependencies]
signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"], optional = true }
diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs
new file mode 100644
index 00000000000..1d487364031
--- /dev/null
+++ b/crates/common_utils/src/events.rs
@@ -0,0 +1,91 @@
+use common_enums::{PaymentMethod, PaymentMethodType};
+use serde::Serialize;
+
+pub trait ApiEventMetric {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ None
+ }
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
+#[serde(tag = "flow_type")]
+pub enum ApiEventsType {
+ Payout,
+ Payment {
+ payment_id: String,
+ },
+ Refund {
+ payment_id: Option<String>,
+ refund_id: String,
+ },
+ PaymentMethod {
+ payment_method_id: String,
+ payment_method: Option<PaymentMethod>,
+ payment_method_type: Option<PaymentMethodType>,
+ },
+ Customer {
+ customer_id: String,
+ },
+ User {
+ //specified merchant_id will overridden on global defined
+ merchant_id: String,
+ user_id: String,
+ },
+ PaymentMethodList {
+ payment_id: Option<String>,
+ },
+ Webhooks {
+ connector: String,
+ payment_id: Option<String>,
+ },
+ Routing,
+ ResourceListAPI,
+ PaymentRedirectionResponse,
+ // TODO: This has to be removed once the corresponding apiEventTypes are created
+ Miscellaneous,
+}
+
+impl ApiEventMetric for serde_json::Value {}
+impl ApiEventMetric for () {}
+
+impl<Q: ApiEventMetric, E> ApiEventMetric for Result<Q, E> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ match self {
+ Ok(q) => q.get_api_event_type(),
+ Err(_) => None,
+ }
+ }
+}
+
+// TODO: Ideally all these types should be replaced by newtype responses
+impl<T> ApiEventMetric for Vec<T> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Miscellaneous)
+ }
+}
+
+#[macro_export]
+macro_rules! impl_misc_api_event_type {
+ ($($type:ty),+) => {
+ $(
+ impl ApiEventMetric for $type {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Miscellaneous)
+ }
+ }
+ )+
+ };
+}
+
+impl_misc_api_event_type!(
+ String,
+ (&String, &String),
+ (Option<i64>, Option<i64>, String),
+ bool
+);
+
+impl<T: ApiEventMetric> ApiEventMetric for &T {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ T::get_api_event_type(self)
+ }
+}
diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rs
index 724c3bca0a2..62428dccfb6 100644
--- a/crates/common_utils/src/lib.rs
+++ b/crates/common_utils/src/lib.rs
@@ -6,6 +6,8 @@ pub mod consts;
pub mod crypto;
pub mod custom_serde;
pub mod errors;
+#[allow(missing_docs)] // Todo: add docs
+pub mod events;
pub mod ext_traits;
pub mod fp_utils;
pub mod pii;
diff --git a/crates/diesel_models/src/ephemeral_key.rs b/crates/diesel_models/src/ephemeral_key.rs
index 96bd6e497c3..77b9c647e43 100644
--- a/crates/diesel_models/src/ephemeral_key.rs
+++ b/crates/diesel_models/src/ephemeral_key.rs
@@ -14,3 +14,9 @@ pub struct EphemeralKey {
pub expires: i64,
pub secret: String,
}
+
+impl common_utils::events::ApiEventMetric for EphemeralKey {
+ fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+ Some(common_utils::events::ApiEventsType::Miscellaneous)
+ }
+}
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index 73ff34030f8..62aec3fb27d 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -227,3 +227,12 @@ pub struct RefundCoreWorkflow {
pub merchant_id: String,
pub payment_id: String,
}
+
+impl common_utils::events::ApiEventMetric for Refund {
+ fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+ Some(common_utils::events::ApiEventsType::Refund {
+ payment_id: Some(self.payment_id.clone()),
+ refund_id: self.refund_id.clone(),
+ })
+ }
+}
diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rs
index dc147443828..ad4accf6ca7 100644
--- a/crates/router/src/compatibility/stripe/refunds.rs
+++ b/crates/router/src/compatibility/stripe/refunds.rs
@@ -149,8 +149,8 @@ pub async fn refund_update(
path: web::Path<String>,
form_payload: web::Form<types::StripeUpdateRefundRequest>,
) -> HttpResponse {
- let refund_id = path.into_inner();
- let payload = form_payload.into_inner();
+ let mut payload = form_payload.into_inner();
+ payload.refund_id = path.into_inner();
let create_refund_update_req: refund_types::RefundUpdateRequest = payload.into();
let flow = Flow::RefundsUpdate;
@@ -169,9 +169,7 @@ pub async fn refund_update(
state.into_inner(),
&req,
create_refund_update_req,
- |state, auth, req| {
- refunds::refund_update_core(state, auth.merchant_account, &refund_id, req)
- },
+ |state, auth, req| refunds::refund_update_core(state, auth.merchant_account, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/compatibility/stripe/refunds/types.rs b/crates/router/src/compatibility/stripe/refunds/types.rs
index e1486186491..8d65a09187d 100644
--- a/crates/router/src/compatibility/stripe/refunds/types.rs
+++ b/crates/router/src/compatibility/stripe/refunds/types.rs
@@ -17,6 +17,8 @@ pub struct StripeCreateRefundRequest {
#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct StripeUpdateRefundRequest {
+ #[serde(skip)]
+ pub refund_id: String,
pub metadata: Option<pii::SecretSerdeValue>,
}
@@ -58,6 +60,7 @@ impl From<StripeCreateRefundRequest> for refunds::RefundRequest {
impl From<StripeUpdateRefundRequest> for refunds::RefundUpdateRequest {
fn from(req: StripeUpdateRefundRequest) -> Self {
Self {
+ refund_id: req.refund_id,
metadata: req.metadata,
reason: None,
}
diff --git a/crates/router/src/compatibility/wrap.rs b/crates/router/src/compatibility/wrap.rs
index 75cb07de02b..1ab156d32ad 100644
--- a/crates/router/src/compatibility/wrap.rs
+++ b/crates/router/src/compatibility/wrap.rs
@@ -7,6 +7,7 @@ use serde::Serialize;
use crate::{
core::{api_locking, errors},
+ events::api_logs::ApiEventMetric,
routes::{app::AppStateInfo, metrics},
services::{self, api, authentication as auth, logger},
};
@@ -25,12 +26,12 @@ where
F: Fn(A, U, T) -> Fut,
Fut: Future<Output = CustomResult<api::ApplicationResponse<Q>, E2>>,
E2: ErrorSwitch<E> + std::error::Error + Send + Sync + 'static,
- Q: Serialize + std::fmt::Debug + 'a,
+ Q: Serialize + std::fmt::Debug + 'a + ApiEventMetric,
S: TryFrom<Q> + Serialize,
E: Serialize + error_stack::Context + actix_web::ResponseError + Clone,
error_stack::Report<E>: services::EmbedError,
errors::ApiErrorResponse: ErrorSwitch<E>,
- T: std::fmt::Debug + Serialize,
+ T: std::fmt::Debug + Serialize + ApiEventMetric,
A: AppStateInfo + Clone,
{
let request_method = request.method().as_str();
diff --git a/crates/router/src/core/api_keys.rs b/crates/router/src/core/api_keys.rs
index 7bda894826a..c1ddc43cd65 100644
--- a/crates/router/src/core/api_keys.rs
+++ b/crates/router/src/core/api_keys.rs
@@ -294,10 +294,10 @@ pub async fn retrieve_api_key(
#[instrument(skip_all)]
pub async fn update_api_key(
state: AppState,
- merchant_id: &str,
- key_id: &str,
api_key: api::UpdateApiKeyRequest,
) -> RouterResponse<api::RetrieveApiKeyResponse> {
+ let merchant_id = api_key.merchant_id.clone();
+ let key_id = api_key.key_id.clone();
let store = state.store.as_ref();
let api_key = store
@@ -313,7 +313,7 @@ pub async fn update_api_key(
{
let expiry_reminder_days = state.conf.api_keys.expiry_reminder_days.clone();
- let task_id = generate_task_id_for_api_key_expiry_workflow(key_id);
+ let task_id = generate_task_id_for_api_key_expiry_workflow(&key_id);
// In order to determine how to update the existing process in the process_tracker table,
// we need access to the current entry in the table.
let existing_process_tracker_task = store
@@ -339,7 +339,7 @@ pub async fn update_api_key(
// If an expiry is set to 'never'
else {
// Process exist in process, revoke it
- revoke_api_key_expiry_task(store, key_id)
+ revoke_api_key_expiry_task(store, &key_id)
.await
.into_report()
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index fcda3c8daf0..a42e46ca62d 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -476,14 +476,13 @@ pub async fn sync_refund_with_gateway(
pub async fn refund_update_core(
state: AppState,
merchant_account: domain::MerchantAccount,
- refund_id: &str,
req: refunds::RefundUpdateRequest,
) -> RouterResponse<refunds::RefundResponse> {
let db = state.store.as_ref();
let refund = db
.find_refund_by_merchant_id_refund_id(
&merchant_account.merchant_id,
- refund_id,
+ &req.refund_id,
merchant_account.storage_scheme,
)
.await
@@ -501,7 +500,9 @@ pub async fn refund_update_core(
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable_lazy(|| format!("Unable to update refund with refund_id: {refund_id}"))?;
+ .attach_printable_lazy(|| {
+ format!("Unable to update refund with refund_id: {}", req.refund_id)
+ })?;
Ok(services::ApplicationResponse::Json(response.foreign_into()))
}
@@ -698,7 +699,7 @@ pub async fn refund_list(
pub async fn refund_filter_list(
state: AppState,
merchant_account: domain::MerchantAccount,
- req: api_models::refunds::TimeRange,
+ req: api_models::payments::TimeRange,
) -> RouterResponse<api_models::refunds::RefundListMetaData> {
let db = state.store;
let filter_list = db
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 8033cc792b5..723611ed500 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -1,7 +1,7 @@
pub mod helpers;
pub mod transformers;
-use api_models::routing as routing_types;
+use api_models::routing::{self as routing_types, RoutingAlgorithmId};
#[cfg(feature = "business_profile_routing")]
use api_models::routing::{RoutingRetrieveLinkQuery, RoutingRetrieveQuery};
#[cfg(not(feature = "business_profile_routing"))]
@@ -319,14 +319,14 @@ pub async fn link_routing_config(
pub async fn retrieve_routing_config(
state: AppState,
merchant_account: domain::MerchantAccount,
- algorithm_id: String,
+ algorithm_id: RoutingAlgorithmId,
) -> RouterResponse<routing_types::MerchantRoutingAlgorithm> {
let db = state.store.as_ref();
#[cfg(feature = "business_profile_routing")]
{
let routing_algorithm = db
.find_routing_algorithm_by_algorithm_id_merchant_id(
- &algorithm_id,
+ &algorithm_id.0,
&merchant_account.merchant_id,
)
.await
@@ -356,13 +356,13 @@ pub async fn retrieve_routing_config(
let record = merchant_dictionary
.records
.into_iter()
- .find(|rec| rec.id == algorithm_id)
+ .find(|rec| rec.id == algorithm_id.0)
.ok_or(errors::ApiErrorResponse::ResourceIdNotFound)
.into_report()
.attach_printable("Algorithm with the given ID not found in the merchant dictionary")?;
let algorithm_config = db
- .find_config_by_key(&algorithm_id)
+ .find_config_by_key(&algorithm_id.0)
.await
.change_context(errors::ApiErrorResponse::ResourceIdNotFound)
.attach_printable("Routing config not found in DB")?;
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index fa700b4cd66..e643e0455b8 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -1,5 +1,4 @@
pub mod utils;
-use actix_web::web;
use api_models::verifications::{self, ApplepayMerchantResponse};
use common_utils::{errors::CustomResult, ext_traits::Encode};
use error_stack::ResultExt;
@@ -18,7 +17,7 @@ const APPLEPAY_INTERNAL_MERCHANT_NAME: &str = "Applepay_merchant";
pub async fn verify_merchant_creds_for_applepay(
state: AppState,
_req: &actix_web::HttpRequest,
- body: web::Json<verifications::ApplepayMerchantVerificationRequest>,
+ body: verifications::ApplepayMerchantVerificationRequest,
kms_config: &kms::KmsConfig,
merchant_id: String,
) -> CustomResult<
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index a6133edad67..c9b9f8ac55f 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -78,7 +78,7 @@ pub trait RefundInterface {
async fn filter_refund_by_meta_constraints(
&self,
merchant_id: &str,
- refund_details: &api_models::refunds::TimeRange,
+ refund_details: &api_models::payments::TimeRange,
storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError>;
@@ -232,7 +232,7 @@ mod storage {
async fn filter_refund_by_meta_constraints(
&self,
merchant_id: &str,
- refund_details: &api_models::refunds::TimeRange,
+ refund_details: &api_models::payments::TimeRange,
_storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
@@ -707,7 +707,7 @@ mod storage {
async fn filter_refund_by_meta_constraints(
&self,
merchant_id: &str,
- refund_details: &api_models::refunds::TimeRange,
+ refund_details: &api_models::payments::TimeRange,
_storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
@@ -979,7 +979,7 @@ impl RefundInterface for MockDb {
async fn filter_refund_by_meta_constraints(
&self,
_merchant_id: &str,
- refund_details: &api_models::refunds::TimeRange,
+ refund_details: &api_models::payments::TimeRange,
_storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::StorageError> {
let refunds = self.refunds.lock().await;
diff --git a/crates/router/src/events/api_logs.rs b/crates/router/src/events/api_logs.rs
index 5a66ba3e0bf..1a47568e7ad 100644
--- a/crates/router/src/events/api_logs.rs
+++ b/crates/router/src/events/api_logs.rs
@@ -1,10 +1,25 @@
use actix_web::HttpRequest;
+pub use common_utils::events::{ApiEventMetric, ApiEventsType};
+use common_utils::impl_misc_api_event_type;
use router_env::{tracing_actix_web::RequestId, types::FlowMetric};
use serde::Serialize;
use time::OffsetDateTime;
use super::{EventType, RawEvent};
-use crate::services::authentication::AuthenticationType;
+#[cfg(feature = "dummy_connector")]
+use crate::routes::dummy_connector::types::{
+ DummyConnectorPaymentCompleteRequest, DummyConnectorPaymentConfirmRequest,
+ DummyConnectorPaymentRequest, DummyConnectorPaymentResponse,
+ DummyConnectorPaymentRetrieveRequest, DummyConnectorRefundRequest,
+ DummyConnectorRefundResponse, DummyConnectorRefundRetrieveRequest,
+};
+use crate::{
+ core::payments::PaymentsRedirectResponseData,
+ services::{authentication::AuthenticationType, ApplicationResponse, PaymentLinkFormData},
+ types::api::{
+ AttachEvidenceRequest, Config, ConfigUpdate, CreateFileRequest, DisputeId, FileId,
+ },
+};
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct ApiEvent {
@@ -20,6 +35,8 @@ pub struct ApiEvent {
ip_addr: Option<String>,
url_path: String,
response: Option<serde_json::Value>,
+ #[serde(flatten)]
+ event_type: ApiEventsType,
}
impl ApiEvent {
@@ -32,6 +49,7 @@ impl ApiEvent {
request: serde_json::Value,
response: Option<serde_json::Value>,
auth_type: AuthenticationType,
+ event_type: ApiEventsType,
http_req: &HttpRequest,
) -> Self {
Self {
@@ -52,6 +70,7 @@ impl ApiEvent {
.get("user-agent")
.and_then(|user_agent_value| user_agent_value.to_str().ok().map(ToOwned::to_owned)),
url_path: http_req.path().to_string(),
+ event_type,
}
}
}
@@ -67,3 +86,35 @@ impl TryFrom<ApiEvent> for RawEvent {
})
}
}
+
+impl<T: ApiEventMetric> ApiEventMetric for ApplicationResponse<T> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ match self {
+ Self::Json(r) => r.get_api_event_type(),
+ Self::JsonWithHeaders((r, _)) => r.get_api_event_type(),
+ _ => None,
+ }
+ }
+}
+impl_misc_api_event_type!(
+ Config,
+ CreateFileRequest,
+ FileId,
+ AttachEvidenceRequest,
+ DisputeId,
+ PaymentLinkFormData,
+ PaymentsRedirectResponseData,
+ ConfigUpdate
+);
+
+#[cfg(feature = "dummy_connector")]
+impl_misc_api_event_type!(
+ DummyConnectorPaymentCompleteRequest,
+ DummyConnectorPaymentRequest,
+ DummyConnectorPaymentResponse,
+ DummyConnectorPaymentRetrieveRequest,
+ DummyConnectorPaymentConfirmRequest,
+ DummyConnectorRefundRetrieveRequest,
+ DummyConnectorRefundResponse,
+ DummyConnectorRefundRequest
+);
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index a5bce200889..dbcd8cbe4ce 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -305,7 +305,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payment_methods::RequiredFieldInfo,
api_models::refunds::RefundListRequest,
api_models::refunds::RefundListResponse,
- api_models::refunds::TimeRange,
+ api_models::payments::TimeRange,
api_models::mandates::MandateRevokedResponse,
api_models::mandates::MandateResponse,
api_models::mandates::MandateCardDetails,
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index a93556202aa..9153e9e747f 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -388,15 +388,15 @@ pub async fn merchant_account_toggle_kv(
json_payload: web::Json<admin::ToggleKVRequest>,
) -> HttpResponse {
let flow = Flow::ConfigKeyUpdate;
- let payload = json_payload.into_inner();
- let merchant_id = path.into_inner();
+ let mut payload = json_payload.into_inner();
+ payload.merchant_id = path.into_inner();
api::server_wrap(
flow,
state,
&req,
- (merchant_id, payload),
- |state, _, (merchant_id, payload)| kv_for_merchant(state, merchant_id, payload.kv_enabled),
+ payload,
+ |state, _, payload| kv_for_merchant(state, payload.merchant_id, payload.kv_enabled),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
)
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 6057b4c5db2..c2e289cd0f7 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -124,16 +124,16 @@ pub async fn api_key_update(
) -> impl Responder {
let flow = Flow::ApiKeyUpdate;
let (merchant_id, key_id) = path.into_inner();
- let payload = json_payload.into_inner();
+ let mut payload = json_payload.into_inner();
+ payload.key_id = key_id;
+ payload.merchant_id = merchant_id;
api::server_wrap(
flow,
state,
&req,
- (&merchant_id, &key_id, payload),
- |state, _, (merchant_id, key_id, payload)| {
- api_keys::update_api_key(state, merchant_id, key_id, payload)
- },
+ payload,
+ |state, _, payload| api_keys::update_api_key(state, payload),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
)
diff --git a/crates/router/src/routes/dummy_connector.rs b/crates/router/src/routes/dummy_connector.rs
index 52a7f7f77c9..7d2aad7e348 100644
--- a/crates/router/src/routes/dummy_connector.rs
+++ b/crates/router/src/routes/dummy_connector.rs
@@ -10,7 +10,7 @@ use crate::{
mod consts;
mod core;
mod errors;
-mod types;
+pub mod types;
mod utils;
#[instrument(skip_all, fields(flow = ?types::Flow::DummyPaymentCreate))]
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 4c4121b5d53..c20f3fbf975 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -161,13 +161,14 @@ pub async fn refunds_update(
path: web::Path<String>,
) -> HttpResponse {
let flow = Flow::RefundsUpdate;
- let refund_id = path.into_inner();
+ let mut refund_update_req = json_payload.into_inner();
+ refund_update_req.refund_id = path.into_inner();
api::server_wrap(
flow,
state,
&req,
- json_payload.into_inner(),
- |state, auth, req| refund_update_core(state, auth.merchant_account, &refund_id, req),
+ refund_update_req,
+ |state, auth, req| refund_update_core(state, auth.merchant_account, req),
&auth::ApiKeyAuth,
api_locking::LockAction::NotApplicable,
)
@@ -225,7 +226,7 @@ pub async fn refunds_list(
pub async fn refunds_filter_list(
state: web::Data<AppState>,
req: HttpRequest,
- payload: web::Json<api_models::refunds::TimeRange>,
+ payload: web::Json<api_models::payments::TimeRange>,
) -> HttpResponse {
let flow = Flow::RefundsList;
api::server_wrap(
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index 1d5ccdf502f..9252c360a9c 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -47,7 +47,7 @@ pub async fn routing_create_config(
pub async fn routing_link_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<routing_types::RoutingAlgorithmId>,
) -> impl Responder {
let flow = Flow::RoutingLinkConfig;
Box::pin(oss_api::server_wrap(
@@ -61,7 +61,7 @@ pub async fn routing_link_config(
auth.merchant_account,
#[cfg(not(feature = "business_profile_routing"))]
auth.key_store,
- algorithm_id,
+ algorithm_id.0,
)
},
#[cfg(not(feature = "release"))]
@@ -78,7 +78,7 @@ pub async fn routing_link_config(
pub async fn routing_retrieve_config(
state: web::Data<AppState>,
req: HttpRequest,
- path: web::Path<String>,
+ path: web::Path<routing_types::RoutingAlgorithmId>,
) -> impl Responder {
let algorithm_id = path.into_inner();
let flow = Flow::RoutingRetrieveConfig;
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index a0861f2b14d..2ad061848c9 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -22,7 +22,7 @@ pub async fn apple_pay_merchant_registration(
flow,
state,
&req,
- json_payload,
+ json_payload.into_inner(),
|state, _, body| {
verification::verify_merchant_creds_for_applepay(
state.clone(),
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 36264490697..bb0e70b4b27 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -34,7 +34,7 @@ use crate::{
errors::{self, CustomResult},
payments,
},
- events::api_logs::ApiEvent,
+ events::api_logs::{ApiEvent, ApiEventMetric, ApiEventsType},
logger,
routes::{
app::AppStateInfo,
@@ -769,8 +769,8 @@ where
F: Fn(A, U, T) -> Fut,
'b: 'a,
Fut: Future<Output = CustomResult<ApplicationResponse<Q>, E>>,
- Q: Serialize + Debug + 'a,
- T: Debug + Serialize,
+ Q: Serialize + Debug + 'a + ApiEventMetric,
+ T: Debug + Serialize + ApiEventMetric,
A: AppStateInfo + Clone,
E: ErrorSwitch<OErr> + error_stack::Context,
OErr: ResponseError + error_stack::Context,
@@ -791,6 +791,8 @@ where
.attach_printable("Failed to serialize json request")
.change_context(errors::ApiErrorResponse::InternalServerError.switch())?;
+ let mut event_type = payload.get_api_event_type();
+
// Currently auth failures are not recorded as API events
let (auth_out, auth_type) = api_auth
.authenticate_and_fetch(request.headers(), &request_state)
@@ -838,6 +840,7 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError.switch())?,
);
}
+ event_type = res.get_api_event_type().or(event_type);
metrics::request::track_response_status_code(res)
}
@@ -852,6 +855,7 @@ where
serialized_request,
serialized_response,
auth_type,
+ event_type.unwrap_or(ApiEventsType::Miscellaneous),
request,
);
match api_event.clone().try_into() {
@@ -884,8 +888,8 @@ pub async fn server_wrap<'a, A, T, U, Q, F, Fut, E>(
where
F: Fn(A, U, T) -> Fut,
Fut: Future<Output = CustomResult<ApplicationResponse<Q>, E>>,
- Q: Serialize + Debug + 'a,
- T: Debug + Serialize,
+ Q: Serialize + Debug + ApiEventMetric + 'a,
+ T: Debug + Serialize + ApiEventMetric,
A: AppStateInfo + Clone,
ApplicationResponse<Q>: Debug,
E: ErrorSwitch<api_models::errors::types::ApiErrorResponse> + error_stack::Context,
diff --git a/crates/router/src/types/api/customers.rs b/crates/router/src/types/api/customers.rs
index 2050b4149ef..32430c0918a 100644
--- a/crates/router/src/types/api/customers.rs
+++ b/crates/router/src/types/api/customers.rs
@@ -10,6 +10,12 @@ newtype!(
derives = (Debug, Clone, Serialize)
);
+impl common_utils::events::ApiEventMetric for CustomerResponse {
+ fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+ self.0.get_api_event_type()
+ }
+}
+
pub(crate) trait CustomerRequestExt: Sized {
fn validate(self) -> RouterResult<Self>;
}
diff --git a/crates/router/src/types/storage/refund.rs b/crates/router/src/types/storage/refund.rs
index bdfa8dc5b5f..4d566770012 100644
--- a/crates/router/src/types/storage/refund.rs
+++ b/crates/router/src/types/storage/refund.rs
@@ -27,7 +27,7 @@ pub trait RefundDbExt: Sized {
async fn filter_by_meta_constraints(
conn: &PgPooledConn,
merchant_id: &str,
- refund_list_details: &api_models::refunds::TimeRange,
+ refund_list_details: &api_models::payments::TimeRange,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::DatabaseError>;
async fn get_refunds_count(
@@ -114,7 +114,7 @@ impl RefundDbExt for Refund {
async fn filter_by_meta_constraints(
conn: &PgPooledConn,
merchant_id: &str,
- refund_list_details: &api_models::refunds::TimeRange,
+ refund_list_details: &api_models::payments::TimeRange,
) -> CustomResult<api_models::refunds::RefundListMetaData, errors::DatabaseError> {
let start_time = refund_list_details.start_time;
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 822b1aacee9..5af67e49927 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -11218,12 +11218,12 @@
"start_time": {
"type": "string",
"format": "date-time",
- "description": "The start time to filter refunds list or to get list of filters. To get list of filters start time is needed to be passed"
+ "description": "The start time to filter payments list or to get list of filters. To get list of filters start time is needed to be passed"
},
"end_time": {
"type": "string",
"format": "date-time",
- "description": "The end time to filter refunds list or to get list of filters. If not passed the default time is now",
+ "description": "The end time to filter payments list or to get list of filters. If not passed the default time is now",
"nullable": true
}
}
|
feat
|
add extracted fields based on req/res types (#2795)
|
7f3ceb42fb95a117a39bc679ce2f7830bffbec54
|
2023-05-11 17:24:27
|
ItsMeShashank
|
fix(router): fix webhooks flow for checkout connector (#1126)
| false
|
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index aba85566260..707e4360a72 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -1075,11 +1075,16 @@ impl api::IncomingWebhook for Checkout {
merchant_id: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let key = format!("whsec_verification_{}_{}", self.id(), merchant_id);
- let secret = db
- .find_config_by_key(&key)
- .await
- .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound)?;
- Ok(secret.config.into_bytes())
+ let secret = match db.find_config_by_key(&key).await {
+ Ok(config) => Some(config),
+ Err(e) => {
+ crate::logger::warn!("Unable to fetch merchant webhook secret from DB: {:#?}", e);
+ None
+ }
+ };
+ Ok(secret
+ .map(|conf| conf.config.into_bytes())
+ .unwrap_or_default())
}
fn get_webhook_object_reference_id(
&self,
@@ -1143,7 +1148,7 @@ impl api::IncomingWebhook for Checkout {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> {
- let dispute_details: checkout::CheckoutWebhookBody = request
+ let dispute_details: checkout::CheckoutDisputeWebhookBody = request
.body
.parse_struct("CheckoutWebhookBody")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 98c24dcc3c8..fdf06eeea25 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -710,15 +710,33 @@ pub struct CheckoutWebhookData {
pub action_id: Option<String>,
pub amount: i32,
pub currency: String,
+}
+#[derive(Debug, Deserialize)]
+pub struct CheckoutWebhookBody {
+ #[serde(rename = "type")]
+ pub transaction_type: CheckoutTransactionType,
+ pub data: CheckoutWebhookData,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct CheckoutDisputeWebhookData {
+ pub id: String,
+ pub payment_id: Option<String>,
+ pub action_id: Option<String>,
+ pub amount: i32,
+ pub currency: String,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
pub evidence_required_by: Option<PrimitiveDateTime>,
pub reason_code: Option<String>,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
pub date: Option<PrimitiveDateTime>,
}
#[derive(Debug, Deserialize)]
-pub struct CheckoutWebhookBody {
+pub struct CheckoutDisputeWebhookBody {
#[serde(rename = "type")]
pub transaction_type: CheckoutTransactionType,
- pub data: CheckoutWebhookData,
+ pub data: CheckoutDisputeWebhookData,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
pub created_on: Option<PrimitiveDateTime>,
}
#[derive(Debug, Deserialize, strum::Display, Clone)]
|
fix
|
fix webhooks flow for checkout connector (#1126)
|
c7b9e9c1b02f1166311ffcf9bcd672717628ff4a
|
2023-02-10 13:14:56
|
Sanchith Hegde
|
ci: run CI checks on merge queue events (#530)
| false
|
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 55ac4615030..ffca6ea0246 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -19,6 +19,10 @@ on:
# - "Cargo.lock"
# - "Cargo.toml"
+ merge_group:
+ types:
+ - checks_requested
+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
|
ci
|
run CI checks on merge queue events (#530)
|
393c2ab94cf1052f6f8fa0b40c09e36555ffecd7
|
2023-08-09 12:17:59
|
AkshayaFoiger
|
fix(router): handle JSON connector response parse error (#1892)
| false
|
diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs
index 745fc4fbc54..41844086196 100644
--- a/crates/router/src/connector/braintree.rs
+++ b/crates/router/src/connector/braintree.rs
@@ -2,7 +2,7 @@ pub mod transformers;
use std::fmt::Debug;
-use error_stack::{IntoReport, ResultExt};
+use error_stack::{IntoReport, Report, ResultExt};
use masking::PeekInterface;
use self::transformers as braintree;
@@ -10,7 +10,7 @@ use crate::{
configs::settings,
consts,
core::errors::{self, CustomResult},
- headers,
+ headers, logger,
services::{
self,
request::{self, Mask},
@@ -46,6 +46,27 @@ impl ConnectorCommon for Braintree {
auth.auth_header.into_masked(),
)])
}
+
+ fn build_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ let response: Result<braintree::ErrorResponse, Report<common_utils::errors::ParsingError>> =
+ res.response.parse_struct("Braintree Error Response");
+
+ match response {
+ Ok(response_data) => Ok(types::ErrorResponse {
+ status_code: res.status_code,
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: response_data.api_error_response.message,
+ reason: None,
+ }),
+ Err(error_msg) => {
+ logger::error!(deserialization_error =? error_msg);
+ utils::handle_json_response_deserialization_failure(res, "braintree".to_owned())
+ }
+ }
+ }
}
impl api::Payment for Braintree {}
@@ -140,17 +161,7 @@ impl
&self,
res: types::Response,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
- let response: braintree::ErrorResponse = res
- .response
- .parse_struct("Error Response")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- Ok(types::ErrorResponse {
- status_code: res.status_code,
- code: consts::NO_ERROR_CODE.to_string(),
- message: response.api_error_response.message,
- reason: None,
- })
+ self.build_error_response(res)
}
fn get_request_body(
@@ -291,17 +302,7 @@ impl
&self,
res: types::Response,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
- let response: braintree::ErrorResponse = res
- .response
- .parse_struct("Braintree Error Response")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- Ok(types::ErrorResponse {
- status_code: res.status_code,
- code: consts::NO_ERROR_CODE.to_string(),
- message: response.api_error_response.message,
- reason: None,
- })
+ self.build_error_response(res)
}
fn get_request_body(
@@ -429,16 +430,7 @@ impl
&self,
res: types::Response,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
- let response: braintree::ErrorResponse = res
- .response
- .parse_struct("Braintree ErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- Ok(types::ErrorResponse {
- status_code: res.status_code,
- code: consts::NO_ERROR_CODE.to_string(),
- message: response.api_error_response.message,
- reason: None,
- })
+ self.build_error_response(res)
}
}
@@ -511,17 +503,7 @@ impl
&self,
res: types::Response,
) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
- let response: braintree::ErrorResponse = res
- .response
- .parse_struct("Braintree ErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- Ok(types::ErrorResponse {
- status_code: res.status_code,
- code: consts::NO_ERROR_CODE.to_string(),
- message: response.api_error_response.message,
- reason: None,
- })
+ self.build_error_response(res)
}
fn get_request_body(
diff --git a/crates/router/src/connector/rapyd.rs b/crates/router/src/connector/rapyd.rs
index 02cc153da49..960b3bbfc95 100644
--- a/crates/router/src/connector/rapyd.rs
+++ b/crates/router/src/connector/rapyd.rs
@@ -3,7 +3,7 @@ use std::fmt::Debug;
use base64::Engine;
use common_utils::{date_time, ext_traits::StringExt};
-use error_stack::{IntoReport, ResultExt};
+use error_stack::{IntoReport, Report, ResultExt};
use masking::{ExposeInterface, PeekInterface};
use rand::distributions::{Alphanumeric, DistString};
use ring::hmac;
@@ -15,7 +15,7 @@ use crate::{
consts,
core::errors::{self, CustomResult},
db::StorageInterface,
- headers,
+ headers, logger,
services::{
self,
request::{self, Mask},
@@ -82,16 +82,23 @@ impl ConnectorCommon for Rapyd {
&self,
res: types::Response,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: rapyd::RapydPaymentsResponse = res
- .response
- .parse_struct("Rapyd ErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- Ok(ErrorResponse {
- status_code: res.status_code,
- code: response.status.error_code,
- message: response.status.status.unwrap_or_default(),
- reason: response.status.message,
- })
+ let response: Result<
+ rapyd::RapydPaymentsResponse,
+ Report<common_utils::errors::ParsingError>,
+ > = res.response.parse_struct("Rapyd ErrorResponse");
+
+ match response {
+ Ok(response_data) => Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response_data.status.error_code,
+ message: response_data.status.status.unwrap_or_default(),
+ reason: response_data.status.message,
+ }),
+ Err(error_msg) => {
+ logger::error!(deserialization_error =? error_msg);
+ utils::handle_json_response_deserialization_failure(res, "rapyd".to_owned())
+ }
+ }
}
}
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index 14155065a6c..14dbe14f4d6 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -4,7 +4,7 @@ use std::fmt::Debug;
use base64::Engine;
use common_utils::{crypto, errors::ReportSwitchExt, ext_traits::ByteSliceExt};
-use error_stack::{IntoReport, ResultExt};
+use error_stack::{IntoReport, Report, ResultExt};
use masking::PeekInterface;
use transformers as trustpay;
@@ -19,7 +19,7 @@ use crate::{
errors::{self, CustomResult},
payments,
},
- headers,
+ headers, logger,
services::{
self,
request::{self, Mask},
@@ -104,34 +104,43 @@ impl ConnectorCommon for Trustpay {
&self,
res: Response,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
- let response: trustpay::TrustpayErrorResponse = res
- .response
- .parse_struct("trustpay ErrorResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
- let error_list = response.errors.clone().unwrap_or(vec![]);
- let option_error_code_message = get_error_code_error_message_based_on_priority(
- self.clone(),
- error_list.into_iter().map(|errors| errors.into()).collect(),
- );
- let reason = response.errors.map(|errors| {
- errors
- .iter()
- .map(|error| error.description.clone())
- .collect::<Vec<String>>()
- .join(" & ")
- });
- Ok(ErrorResponse {
- status_code: res.status_code,
- code: option_error_code_message
- .clone()
- .map(|error_code_message| error_code_message.error_code)
- .unwrap_or(consts::NO_ERROR_CODE.to_string()),
- // message vary for the same code, so relying on code alone as it is unique
- message: option_error_code_message
- .map(|error_code_message| error_code_message.error_code)
- .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
- reason: reason.or(response.description),
- })
+ let response: Result<
+ trustpay::TrustpayErrorResponse,
+ Report<common_utils::errors::ParsingError>,
+ > = res.response.parse_struct("trustpay ErrorResponse");
+
+ match response {
+ Ok(response_data) => {
+ let error_list = response_data.errors.clone().unwrap_or(vec![]);
+ let option_error_code_message = get_error_code_error_message_based_on_priority(
+ self.clone(),
+ error_list.into_iter().map(|errors| errors.into()).collect(),
+ );
+ let reason = response_data.errors.map(|errors| {
+ errors
+ .iter()
+ .map(|error| error.description.clone())
+ .collect::<Vec<String>>()
+ .join(" & ")
+ });
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: option_error_code_message
+ .clone()
+ .map(|error_code_message| error_code_message.error_code)
+ .unwrap_or(consts::NO_ERROR_CODE.to_string()),
+ // message vary for the same code, so relying on code alone as it is unique
+ message: option_error_code_message
+ .map(|error_code_message| error_code_message.error_code)
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: reason.or(response_data.description),
+ })
+ }
+ Err(error_msg) => {
+ logger::error!(deserialization_error =? error_msg);
+ utils::handle_json_response_deserialization_failure(res, "trustpay".to_owned())
+ }
+ }
}
}
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index bf943c09ef9..1c9d6f43001 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -17,13 +17,16 @@ use image::Luma;
use nanoid::nanoid;
use qrcode;
use serde::de::DeserializeOwned;
+use serde_json::Value;
use uuid::Uuid;
pub use self::ext_traits::{OptionExt, ValidateCall};
use crate::{
consts,
- core::errors::{self, RouterResult},
- logger, types,
+ core::errors::{self, CustomResult, RouterResult},
+ logger,
+ routes::metrics,
+ types,
};
pub mod error_parser {
@@ -176,3 +179,36 @@ mod tests {
assert!(qr_image_data_source_url.is_ok());
}
}
+
+// validate json format for the error
+pub fn handle_json_response_deserialization_failure(
+ res: types::Response,
+ connector: String,
+) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ metrics::RESPONSE_DESERIALIZATION_FAILURE.add(
+ &metrics::CONTEXT,
+ 1,
+ &[metrics::request::add_attributes("connector", connector)],
+ );
+
+ let response_data = String::from_utf8(res.response.to_vec())
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ // check for whether the response is in json format
+ match serde_json::from_str::<Value>(&response_data) {
+ // in case of unexpected response but in json format
+ Ok(_) => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
+ // in case of unexpected response but in html or string format
+ Err(error_msg) => {
+ logger::error!(deserialization_error=?error_msg);
+ logger::error!("UNEXPECTED RESPONSE FROM CONNECTOR: {}", response_data);
+ Ok(types::ErrorResponse {
+ status_code: res.status_code,
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(),
+ reason: Some(response_data),
+ })
+ }
+ }
+}
|
fix
|
handle JSON connector response parse error (#1892)
|
cfa6ae895d72cb6c0e79d1ee6616183f35121be1
|
2023-09-05 13:56:47
|
Natarajan K
|
test(postman): update postman collection files (#2070)
| false
|
diff --git a/.github/workflows/postman-collection-runner.yml b/.github/workflows/postman-collection-runner.yml
index f9ef71bed90..c8d3b76c81c 100644
--- a/.github/workflows/postman-collection-runner.yml
+++ b/.github/workflows/postman-collection-runner.yml
@@ -117,7 +117,7 @@ jobs:
- name: Install newman from fork
run: |
- npm install -g 'git+ssh://[email protected]:knutties/newman.git#37708c1fbf6b36240ac796a42dc5a7b435990764'
+ npm ci
- name: Run Tests
if: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}}
@@ -130,7 +130,7 @@ jobs:
run: |
RED='\033[0;31m'
RESET='\033[0m'
- NEWMAN_PATH=$(npm config get prefix)/bin
+ NEWMAN_PATH=$(pwd)/node_modules/.bin
export PATH=${NEWMAN_PATH}:${PATH}
failed_connectors=()
diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml
index 8bd80ee1508..5b8df6b3f28 100644
--- a/.github/workflows/release-new-version.yml
+++ b/.github/workflows/release-new-version.yml
@@ -53,6 +53,29 @@ jobs:
git: https://github.com/SanchithHegde/changelog-gh-usernames
rev: dab6da3ff99dbbff8650c114984c4d8be5161ac8
+ - name: Set Git Configuration
+ shell: bash
+ run: |
+ git config --local user.name 'github-actions'
+ git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
+
+ - name: Update Postman collection files from Postman directories
+ shell: bash
+ run: |
+ # maybe we need to move this package.json as we need it in multiple workflows
+ npm ci
+ POSTMAN_DIR=postman/collection-dir
+ POSTMAN_JSON_DIR=postman/collection-json
+ NEWMAN_PATH=$(pwd)/.node_modules/.bin
+ export PATH=${NEWMAN_PATH}:${PATH}
+ # generate postman collections for all postman directories
+ for connector_dir in ${POSTMAN_DIR}/*
+ do
+ connector=$(basename ${connector_dir})
+ newman dir-import ${POSTMAN_DIR}/${connector} -o ${POSTMAN_JSON_DIR}/${connector}.postman_collection.json
+ done
+ (git diff --quiet && git diff --staged --quiet) || (git commit -am 'test(postman): update postman collection files' && echo "Committed changes") || (echo "Unable to commit the following changes:" && git diff)
+
- name: Obtain previous and new tag information
shell: bash
# Only consider tags on current branch when setting PREVIOUS_TAG
@@ -64,8 +87,6 @@ jobs:
shell: bash
if: ${{ env.NEW_TAG != env.PREVIOUS_TAG }}
run: |
- git config --local user.name 'github-actions'
- git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
cog bump --auto
- name: Push created commit and tag
diff --git a/.gitignore b/.gitignore
index a8e6412fb1a..81ef10ad213 100644
--- a/.gitignore
+++ b/.gitignore
@@ -258,3 +258,6 @@ loadtest/*.tmp/
result*
.idea/
+
+# node_modules
+node_modules/
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 00000000000..9efb15d87ea
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1422 @@
+{
+ "name": "hyperswitch",
+ "version": "0.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "hyperswitch",
+ "version": "0.0.0",
+ "devDependencies": {
+ "newman": "git+ssh://[email protected]:knutties/newman.git#37708c1fbf6b36240ac796a42dc5a7b435990764"
+ }
+ },
+ "node_modules/@postman/form-data": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/@postman/form-data/-/form-data-3.1.1.tgz",
+ "integrity": "sha512-vjh8Q2a8S6UCm/KKs31XFJqEEgmbjBmpPNVV2eVav6905wyFAwaUOBGA1NPBI4ERH9MMZc6w0umFgM6WbEPMdg==",
+ "dev": true,
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/@postman/tunnel-agent": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/@postman/tunnel-agent/-/tunnel-agent-0.6.3.tgz",
+ "integrity": "sha512-k57fzmAZ2PJGxfOA4SGR05ejorHbVAa/84Hxh/2nAztjNXc4ZjOm9NUIk6/Z6LCrBvJZqjRZbN8e/nROVUPVdg==",
+ "dev": true,
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "6.12.6",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
+ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "dev": true,
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/array-back": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz",
+ "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "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,
+ "dependencies": {
+ "safer-buffer": "~2.1.0"
+ }
+ },
+ "node_modules/assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/async": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz",
+ "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==",
+ "dev": true
+ },
+ "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
+ },
+ "node_modules/aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
+ "dev": true,
+ "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
+ },
+ "node_modules/base64-js": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "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,
+ "dependencies": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "node_modules/bluebird": {
+ "version": "2.11.0",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
+ "integrity": "sha512-UfFSr22dmHPQqPP9XWHRhq+gWnHCYguQGkXQlbyPtW5qTnhFWA8/iXg765tH0cAjy7l/zPJ1aBTO0g5XgA7kvQ==",
+ "dev": true
+ },
+ "node_modules/brotli": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",
+ "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",
+ "dev": true,
+ "dependencies": {
+ "base64-js": "^1.1.2"
+ }
+ },
+ "node_modules/caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",
+ "dev": true
+ },
+ "node_modules/chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/chardet": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-1.4.0.tgz",
+ "integrity": "sha512-NpwMDdSIprbYx1CLnfbxEIarI0Z+s9MssEgggMNheGM+WD68yOhV7IEA/3r6tr0yTRgQD0HuZJDw32s99i6L+A==",
+ "dev": true
+ },
+ "node_modules/charset": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/charset/-/charset-1.0.1.tgz",
+ "integrity": "sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/cli-progress": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.10.0.tgz",
+ "integrity": "sha512-kLORQrhYCAtUPLZxqsAt2YJGOvRdt34+O6jl5cQGb7iF3dM55FQZlTR+rQyIK9JUcO9bBMwZsTlND+3dmFU2Cw==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/cli-table3": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.1.tgz",
+ "integrity": "sha512-w0q/enDHhPLq44ovMGdQeeDLvwxwavsJX7oQGYt/LrBlYsyaxyDnp6z3QzFut/6kLLKnlcUVJLrpB7KBfgG/RA==",
+ "dev": true,
+ "dependencies": {
+ "string-width": "^4.2.0"
+ },
+ "engines": {
+ "node": "10.* || >= 12.*"
+ },
+ "optionalDependencies": {
+ "colors": "1.4.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+ "dev": true
+ },
+ "node_modules/colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.1.90"
+ }
+ },
+ "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,
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/command-line-args": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz",
+ "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==",
+ "dev": true,
+ "dependencies": {
+ "array-back": "^3.1.0",
+ "find-replace": "^3.0.0",
+ "lodash.camelcase": "^4.3.0",
+ "typical": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/command-line-usage": {
+ "version": "6.1.3",
+ "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz",
+ "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==",
+ "dev": true,
+ "dependencies": {
+ "array-back": "^4.0.2",
+ "chalk": "^2.4.2",
+ "table-layout": "^1.0.2",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/command-line-usage/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/commander": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
+ "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/core-util-is": {
+ "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
+ },
+ "node_modules/csv-parse": {
+ "version": "4.16.3",
+ "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.16.3.tgz",
+ "integrity": "sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==",
+ "dev": true
+ },
+ "node_modules/dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/directory-tree": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/directory-tree/-/directory-tree-3.5.1.tgz",
+ "integrity": "sha512-HqjZ49fDzUnKYUhHxVw9eKBqbQ+lL0v4kSBInlDlaktmLtGoV9tC54a6A0ZfYeIrkMHWTE6MwwmUXP477+UEKQ==",
+ "dev": true,
+ "dependencies": {
+ "command-line-args": "^5.2.0",
+ "command-line-usage": "^6.1.1"
+ },
+ "bin": {
+ "directory-tree": "bin/index.js"
+ },
+ "engines": {
+ "node": ">=10.0"
+ }
+ },
+ "node_modules/ecc-jsbn": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
+ "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
+ "dev": true,
+ "dependencies": {
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.1.0"
+ }
+ },
+ "node_modules/emoji-regex": {
+ "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
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
+ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
+ "dev": true
+ },
+ "node_modules/extend": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
+ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
+ "dev": true
+ },
+ "node_modules/extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
+ "dev": true,
+ "engines": [
+ "node >=0.6.0"
+ ]
+ },
+ "node_modules/faker": {
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz",
+ "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==",
+ "dev": true
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true
+ },
+ "node_modules/file-type": {
+ "version": "3.9.0",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
+ "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/filesize": {
+ "version": "8.0.7",
+ "resolved": "https://registry.npmjs.org/filesize/-/filesize-8.0.7.tgz",
+ "integrity": "sha512-pjmC+bkIF8XI7fWaH8KxHcZL3DPybs1roSKP4rKDvy20tAWwIObE4+JIseG2byfGKhud5ZnM4YSGKBz7Sh0ndQ==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/find-replace": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz",
+ "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==",
+ "dev": true,
+ "dependencies": {
+ "array-back": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
+ "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
+ "dev": true
+ },
+ "node_modules/forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "node_modules/handlebars": {
+ "version": "4.7.7",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
+ "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
+ "dev": true,
+ "dependencies": {
+ "minimist": "^1.2.5",
+ "neo-async": "^2.6.0",
+ "source-map": "^0.6.1",
+ "wordwrap": "^1.0.0"
+ },
+ "bin": {
+ "handlebars": "bin/handlebars"
+ },
+ "engines": {
+ "node": ">=0.4.7"
+ },
+ "optionalDependencies": {
+ "uglify-js": "^3.1.4"
+ }
+ },
+ "node_modules/har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/har-validator": {
+ "version": "5.1.5",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
+ "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
+ "deprecated": "this library is no longer supported",
+ "dev": true,
+ "dependencies": {
+ "ajv": "^6.12.3",
+ "har-schema": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/http-reasons": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/http-reasons/-/http-reasons-0.1.0.tgz",
+ "integrity": "sha512-P6kYh0lKZ+y29T2Gqz+RlC9WBLhKe8kDmcJ+A+611jFfxdPsbMRQ5aNmFRM3lENqFkK+HTTL+tlQviAiv0AbLQ==",
+ "dev": true
+ },
+ "node_modules/http-signature": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz",
+ "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==",
+ "dev": true,
+ "dependencies": {
+ "assert-plus": "^1.0.0",
+ "jsprim": "^2.0.2",
+ "sshpk": "^1.14.1"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/httpntlm": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/httpntlm/-/httpntlm-1.7.7.tgz",
+ "integrity": "sha512-Pv2Rvrz8H0qv1Dne5mAdZ9JegG1uc6Vu5lwLflIY6s8RKHdZQbW39L4dYswSgqMDT0pkJILUTKjeyU0VPNRZjA==",
+ "dev": true,
+ "dependencies": {
+ "httpreq": ">=0.4.22",
+ "underscore": "~1.12.1"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/httpreq": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/httpreq/-/httpreq-1.1.0.tgz",
+ "integrity": "sha512-P2ROAc2JG4Y1+EL8vRusYb3p6BK5WRZLVj8WLrvtQJL9qQgocqieU9+0cWWwrL2FroUjXGtUDo4lOKXoq+Et+g==",
+ "dev": true,
+ "engines": {
+ "node": ">= 6.15.1"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "dev": true,
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true
+ },
+ "node_modules/ip-regex": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",
+ "integrity": "sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "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,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
+ "dev": true
+ },
+ "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
+ },
+ "node_modules/js-sha512": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz",
+ "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==",
+ "dev": true
+ },
+ "node_modules/jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==",
+ "dev": true
+ },
+ "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
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true
+ },
+ "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
+ },
+ "node_modules/jsprim": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz",
+ "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==",
+ "dev": true,
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "dependencies": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.4.0",
+ "verror": "1.10.0"
+ }
+ },
+ "node_modules/liquid-json": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/liquid-json/-/liquid-json-0.3.1.tgz",
+ "integrity": "sha512-wUayTU8MS827Dam6MxgD72Ui+KOSF+u/eIqpatOtjnvgJ0+mnDq33uC2M7J0tPK+upe/DpUAuK4JUU89iBoNKQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/lodash": {
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
+ "dev": true
+ },
+ "node_modules/lodash.camelcase": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==",
+ "dev": true
+ },
+ "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/mime-db": {
+ "version": "1.51.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
+ "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-format": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/mime-format/-/mime-format-2.0.1.tgz",
+ "integrity": "sha512-XxU3ngPbEnrYnNbIX+lYSaYg0M01v6p2ntd2YaFksTu0vayaw5OJvbdRyWs07EYRlLED5qadUZ+xo+XhOvFhwg==",
+ "dev": true,
+ "dependencies": {
+ "charset": "^1.0.0"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.34",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
+ "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
+ "dev": true,
+ "dependencies": {
+ "mime-db": "1.51.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true,
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/neo-async": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
+ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
+ "dev": true
+ },
+ "node_modules/newman": {
+ "version": "5.3.2",
+ "resolved": "git+ssh://[email protected]/knutties/newman.git#37708c1fbf6b36240ac796a42dc5a7b435990764",
+ "integrity": "sha512-W9KBX5MY6UA9WOYMEcrvduRXCv7Kl2Wtg4gTAVLunC6cY+1VB5+q03xAL7Vbj79Sd4C5eekoGD2VsgTckBFoHA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "async": "3.2.3",
+ "chardet": "1.4.0",
+ "cli-progress": "3.10.0",
+ "cli-table3": "0.6.1",
+ "colors": "1.4.0",
+ "commander": "7.2.0",
+ "csv-parse": "4.16.3",
+ "directory-tree": "3.5.1",
+ "eventemitter3": "4.0.7",
+ "filesize": "8.0.7",
+ "liquid-json": "0.3.1",
+ "lodash": "4.17.21",
+ "mkdirp": "1.0.4",
+ "postman-collection": "4.1.1",
+ "postman-collection-transformer": "4.1.6",
+ "postman-request": "2.88.1-postman.31",
+ "postman-runtime": "7.29.0",
+ "pretty-ms": "7.0.1",
+ "semver": "7.3.5",
+ "serialised-error": "1.1.3",
+ "tough-cookie": "3.0.1",
+ "word-wrap": "1.2.3",
+ "xmlbuilder": "15.1.1"
+ },
+ "bin": {
+ "newman": "bin/newman.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/node-oauth1": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/node-oauth1/-/node-oauth1-1.3.0.tgz",
+ "integrity": "sha512-0yggixNfrA1KcBwvh/Hy2xAS1Wfs9dcg6TdFf2zN7gilcAigMdrtZ4ybrBSXBgLvGDw9V1p2MRnGBMq7XjTWLg==",
+ "dev": true
+ },
+ "node_modules/oauth-sign": {
+ "version": "0.9.0",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
+ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/object-hash": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-1.3.1.tgz",
+ "integrity": "sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
+ "node_modules/parse-ms": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.1.0.tgz",
+ "integrity": "sha512-kHt7kzLoS9VBZfUsiKjv43mr91ea+U05EyKkEtqp7vNbHxmaVuEqN7XxeEVnGrMtYOAxGrDElSi96K7EgO1zCA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "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
+ },
+ "node_modules/postman-collection": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/postman-collection/-/postman-collection-4.1.1.tgz",
+ "integrity": "sha512-ODpJtlf8r99DMcTU7gFmi/yvQYckFzcuE6zL/fWnyrFT34ugdCBFlX+DN7M+AnP6lmR822fv5s60H4DnL4+fAg==",
+ "dev": true,
+ "dependencies": {
+ "faker": "5.5.3",
+ "file-type": "3.9.0",
+ "http-reasons": "0.1.0",
+ "iconv-lite": "0.6.3",
+ "liquid-json": "0.3.1",
+ "lodash": "4.17.21",
+ "mime-format": "2.0.1",
+ "mime-types": "2.1.34",
+ "postman-url-encoder": "3.0.5",
+ "semver": "7.3.5",
+ "uuid": "8.3.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/postman-collection-transformer": {
+ "version": "4.1.6",
+ "resolved": "https://registry.npmjs.org/postman-collection-transformer/-/postman-collection-transformer-4.1.6.tgz",
+ "integrity": "sha512-xvdQb6sZoWcG9xZXUPSuxocjcd6WCZlINlGGiuHdSfxhgiwQhj9qhF0JRFbagZ8xB0+pYUairD5MiCENc6DEVA==",
+ "dev": true,
+ "dependencies": {
+ "commander": "8.3.0",
+ "inherits": "2.0.4",
+ "lodash": "4.17.21",
+ "semver": "7.3.5",
+ "strip-json-comments": "3.1.1"
+ },
+ "bin": {
+ "postman-collection-transformer": "bin/transform-collection.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/postman-collection-transformer/node_modules/commander": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
+ "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
+ "dev": true,
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/postman-request": {
+ "version": "2.88.1-postman.31",
+ "resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.31.tgz",
+ "integrity": "sha512-OJbYqP7ItxQ84yHyuNpDywCZB0HYbpHJisMQ9lb1cSL3N5H3Td6a2+3l/a74UMd3u82BiGC5yQyYmdOIETP/nQ==",
+ "dev": true,
+ "dependencies": {
+ "@postman/form-data": "~3.1.1",
+ "@postman/tunnel-agent": "^0.6.3",
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.8.0",
+ "brotli": "~1.3.2",
+ "caseless": "~0.12.0",
+ "combined-stream": "~1.0.6",
+ "extend": "~3.0.2",
+ "forever-agent": "~0.6.1",
+ "har-validator": "~5.1.3",
+ "http-signature": "~1.3.1",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
+ "json-stringify-safe": "~5.0.1",
+ "mime-types": "~2.1.19",
+ "oauth-sign": "~0.9.0",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.2",
+ "safe-buffer": "^5.1.2",
+ "stream-length": "^1.0.2",
+ "tough-cookie": "~2.5.0",
+ "uuid": "^3.3.2"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/postman-request/node_modules/tough-cookie": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
+ "dev": true,
+ "dependencies": {
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/postman-request/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
+ "node_modules/postman-runtime": {
+ "version": "7.29.0",
+ "resolved": "https://registry.npmjs.org/postman-runtime/-/postman-runtime-7.29.0.tgz",
+ "integrity": "sha512-eXxHREE/fUpohkGPRgBY1YccSGx9cyW3mtGiPyIE4zD5fYzasgBHqW6kbEND3Xrd3yf/uht/YI1H8O7J1+A1+w==",
+ "dev": true,
+ "dependencies": {
+ "async": "3.2.3",
+ "aws4": "1.11.0",
+ "handlebars": "4.7.7",
+ "httpntlm": "1.7.7",
+ "js-sha512": "0.8.0",
+ "lodash": "4.17.21",
+ "mime-types": "2.1.34",
+ "node-oauth1": "1.3.0",
+ "performance-now": "2.1.0",
+ "postman-collection": "4.1.1",
+ "postman-request": "2.88.1-postman.31",
+ "postman-sandbox": "4.0.6",
+ "postman-url-encoder": "3.0.5",
+ "serialised-error": "1.1.3",
+ "tough-cookie": "3.0.1",
+ "uuid": "8.3.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/postman-runtime/node_modules/aws4": {
+ "version": "1.11.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
+ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
+ "dev": true
+ },
+ "node_modules/postman-sandbox": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/postman-sandbox/-/postman-sandbox-4.0.6.tgz",
+ "integrity": "sha512-PPRanSNEE4zy3kO7CeSBHmAfJnGdD9ecHY/Mjh26CQuZZarGkNO8c0U/n+xX3+5M1BRNc82UYq6YCtdsSDqcng==",
+ "dev": true,
+ "dependencies": {
+ "lodash": "4.17.21",
+ "teleport-javascript": "1.0.0",
+ "uvm": "2.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/postman-url-encoder": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/postman-url-encoder/-/postman-url-encoder-3.0.5.tgz",
+ "integrity": "sha512-jOrdVvzUXBC7C+9gkIkpDJ3HIxOHTIqjpQ4C1EMt1ZGeMvSEpbFCKq23DEfgsj46vMnDgyQf+1ZLp2Wm+bKSsA==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/pretty-ms": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-7.0.1.tgz",
+ "integrity": "sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==",
+ "dev": true,
+ "dependencies": {
+ "parse-ms": "^2.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "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
+ },
+ "node_modules/punycode": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
+ "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.5.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
+ "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/reduce-flatten": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz",
+ "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+ },
+ "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
+ },
+ "node_modules/semver": {
+ "version": "7.3.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
+ "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
+ "dev": true,
+ "dependencies": {
+ "lru-cache": "^6.0.0"
+ },
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/serialised-error": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/serialised-error/-/serialised-error-1.1.3.tgz",
+ "integrity": "sha512-vybp3GItaR1ZtO2nxZZo8eOo7fnVaNtP3XE2vJKgzkKR2bagCkdJ1EpYYhEMd3qu/80DwQk9KjsNSxE3fXWq0g==",
+ "dev": true,
+ "dependencies": {
+ "object-hash": "^1.1.2",
+ "stack-trace": "0.0.9",
+ "uuid": "^3.0.0"
+ }
+ },
+ "node_modules/serialised-error/node_modules/uuid": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
+ "dev": true,
+ "bin": {
+ "uuid": "bin/uuid"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/sshpk": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
+ "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==",
+ "dev": true,
+ "dependencies": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ },
+ "bin": {
+ "sshpk-conv": "bin/sshpk-conv",
+ "sshpk-sign": "bin/sshpk-sign",
+ "sshpk-verify": "bin/sshpk-verify"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/stack-trace": {
+ "version": "0.0.9",
+ "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
+ "integrity": "sha512-vjUc6sfgtgY0dxCdnc40mK6Oftjo9+2K8H/NG81TMhgL392FtiPA9tn9RLyTxXmTLPJPjF3VyzFp6bsWFLisMQ==",
+ "dev": true,
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/stream-length": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/stream-length/-/stream-length-1.0.2.tgz",
+ "integrity": "sha512-aI+qKFiwoDV4rsXiS7WRoCt+v2RX1nUj17+KJC5r2gfh5xoSJIfP6Y3Do/HtvesFcTSWthIuJ3l1cvKQY/+nZg==",
+ "dev": true,
+ "dependencies": {
+ "bluebird": "^2.6.2"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/table-layout": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz",
+ "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==",
+ "dev": true,
+ "dependencies": {
+ "array-back": "^4.0.1",
+ "deep-extend": "~0.6.0",
+ "typical": "^5.2.0",
+ "wordwrapjs": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/table-layout/node_modules/array-back": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz",
+ "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/table-layout/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/teleport-javascript": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/teleport-javascript/-/teleport-javascript-1.0.0.tgz",
+ "integrity": "sha512-j1llvWVFyEn/6XIFDfX5LAU43DXe0GCt3NfXDwJ8XpRRMkS+i50SAkonAONBy+vxwPFBd50MFU8a2uj8R/ccLg==",
+ "dev": true
+ },
+ "node_modules/tough-cookie": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",
+ "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",
+ "dev": true,
+ "dependencies": {
+ "ip-regex": "^2.1.0",
+ "psl": "^1.1.28",
+ "punycode": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
+ "dev": true
+ },
+ "node_modules/typical": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz",
+ "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/uglify-js": {
+ "version": "3.17.4",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz",
+ "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==",
+ "dev": true,
+ "optional": true,
+ "bin": {
+ "uglifyjs": "bin/uglifyjs"
+ },
+ "engines": {
+ "node": ">=0.8.0"
+ }
+ },
+ "node_modules/underscore": {
+ "version": "1.12.1",
+ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.12.1.tgz",
+ "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==",
+ "dev": true
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "dev": true,
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/uvm": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/uvm/-/uvm-2.0.2.tgz",
+ "integrity": "sha512-Ra+aPiS5GXAbwXmyNExqdS42sTqmmx4XWEDF8uJlsTfOkKf9Rd9xNgav1Yckv4HfVEZg4iOFODWHFYuJ+9Fzfg==",
+ "dev": true,
+ "dependencies": {
+ "flatted": "3.1.1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
+ "dev": true,
+ "engines": [
+ "node >=0.6.0"
+ ],
+ "dependencies": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
+ "node_modules/word-wrap": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
+ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
+ "dev": true
+ },
+ "node_modules/wordwrapjs": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz",
+ "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==",
+ "dev": true,
+ "dependencies": {
+ "reduce-flatten": "^2.0.0",
+ "typical": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/wordwrapjs/node_modules/typical": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz",
+ "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/xmlbuilder": {
+ "version": "15.1.1",
+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
+ "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "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
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 00000000000..c13e70dafee
--- /dev/null
+++ b/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "hyperswitch",
+ "version": "0.0.0",
+ "private": true,
+ "description": "This is just to run automated newman tests for this service",
+ "devDependencies": {
+ "newman": "git+ssh://[email protected]:knutties/newman.git#37708c1fbf6b36240ac796a42dc5a7b435990764"
+ }
+}
|
test
|
update postman collection files (#2070)
|
070622125f49c4cc9c35f5ba9c634f1fef6b26d2
|
2024-03-27 11:46:22
|
Shankar Singh C
|
fix(log): adding span metadata to `tokio` spawned futures (#4118)
| false
|
diff --git a/crates/common_utils/src/macros.rs b/crates/common_utils/src/macros.rs
index c07b2112db2..b8d5743d8fe 100644
--- a/crates/common_utils/src/macros.rs
+++ b/crates/common_utils/src/macros.rs
@@ -47,13 +47,6 @@ macro_rules! newtype {
};
}
-#[macro_export]
-macro_rules! async_spawn {
- ($t:block) => {
- tokio::spawn(async move { $t });
- };
-}
-
/// Use this to ensure that the corresponding
/// openapi route has been implemented in the openapi crate
#[macro_export]
diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rs
index c93306f49d2..24df19ff737 100644
--- a/crates/diesel_models/src/lib.rs
+++ b/crates/diesel_models/src/lib.rs
@@ -24,7 +24,6 @@ pub mod gsm;
#[cfg(feature = "kv_store")]
pub mod kv;
pub mod locker_mock_up;
-pub mod macros;
pub mod mandate;
pub mod merchant_account;
pub mod merchant_connector_account;
diff --git a/crates/diesel_models/src/macros.rs b/crates/diesel_models/src/macros.rs
deleted file mode 100644
index de3596ecc10..00000000000
--- a/crates/diesel_models/src/macros.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-#[macro_export]
-macro_rules! async_spawn {
- ($t:block) => {
- tokio::spawn(async move { $t });
- };
-}
diff --git a/crates/drainer/src/handler.rs b/crates/drainer/src/handler.rs
index 5aa902d84c5..47b60db80d5 100644
--- a/crates/drainer/src/handler.rs
+++ b/crates/drainer/src/handler.rs
@@ -1,5 +1,6 @@
use std::sync::{atomic, Arc};
+use router_env::tracing::Instrument;
use tokio::{
sync::{mpsc, oneshot},
time::{self, Duration},
@@ -68,13 +69,16 @@ impl Handler {
while self.running.load(atomic::Ordering::SeqCst) {
metrics::DRAINER_HEALTH.add(&metrics::CONTEXT, 1, &[]);
if self.store.is_stream_available(stream_index).await {
- tokio::spawn(drainer_handler(
- self.store.clone(),
- stream_index,
- self.conf.max_read_count,
- self.active_tasks.clone(),
- jobs_picked.clone(),
- ));
+ let _task_handle = tokio::spawn(
+ drainer_handler(
+ self.store.clone(),
+ stream_index,
+ self.conf.max_read_count,
+ self.active_tasks.clone(),
+ jobs_picked.clone(),
+ )
+ .in_current_span(),
+ );
}
stream_index = utils::increment_stream_index(
(stream_index, jobs_picked.clone()),
@@ -116,10 +120,12 @@ impl Handler {
let redis_conn_clone = self.store.redis_conn.clone();
// Spawn a task to monitor if redis is down or not
- tokio::spawn(async move { redis_conn_clone.on_error(redis_error_tx).await });
+ let _task_handle = tokio::spawn(
+ async move { redis_conn_clone.on_error(redis_error_tx).await }.in_current_span(),
+ );
//Spawns a task to send shutdown signal if redis goes down
- tokio::spawn(redis_error_receiver(redis_error_rx, tx));
+ let _task_handle = tokio::spawn(redis_error_receiver(redis_error_rx, tx).in_current_span());
Ok(())
}
diff --git a/crates/drainer/src/lib.rs b/crates/drainer/src/lib.rs
index 0ed6183faef..e7ae7621365 100644
--- a/crates/drainer/src/lib.rs
+++ b/crates/drainer/src/lib.rs
@@ -18,7 +18,10 @@ use common_utils::signals::get_allowed_signals;
use diesel_models::kv;
use error_stack::{IntoReport, ResultExt};
use hyperswitch_interfaces::secrets_interface::secret_state::RawSecret;
-use router_env::{instrument, tracing};
+use router_env::{
+ instrument,
+ tracing::{self, Instrument},
+};
use tokio::sync::mpsc;
pub(crate) type Settings = crate::settings::Settings<RawSecret>;
@@ -39,7 +42,8 @@ pub async fn start_drainer(store: Arc<Store>, conf: DrainerSettings) -> errors::
"Failed while getting allowed signals".to_string(),
))?;
let handle = signal.handle();
- let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx.clone()));
+ let task_handle =
+ tokio::spawn(common_utils::signals::signal_handler(signal, tx.clone()).in_current_span());
let handler_clone = drainer_handler.clone();
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index c586bfecdb7..1df37e9f6d1 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -16,7 +16,10 @@ use router::{
services::{self, api},
workflows,
};
-use router_env::{instrument, tracing};
+use router_env::{
+ instrument,
+ tracing::{self, Instrument},
+};
use scheduler::{
consumer::workflows::ProcessTrackerWorkflow, errors::ProcessTrackerError,
workflows::ProcessTrackerWorkflows, SchedulerAppState,
@@ -49,10 +52,9 @@ async fn main() -> CustomResult<(), ProcessTrackerError> {
.await;
// channel to shutdown scheduler gracefully
let (tx, rx) = mpsc::channel(1);
- tokio::spawn(router::receiver_for_error(
- redis_shutdown_signal_rx,
- tx.clone(),
- ));
+ let _task_handle = tokio::spawn(
+ router::receiver_for_error(redis_shutdown_signal_rx, tx.clone()).in_current_span(),
+ );
#[allow(clippy::expect_used)]
let scheduler_flow_str =
@@ -81,10 +83,13 @@ async fn main() -> CustomResult<(), ProcessTrackerError> {
.await
.expect("Failed to create the server");
- tokio::spawn(async move {
- let _ = web_server.await;
- logger::error!("The health check probe stopped working!");
- });
+ let _task_handle = tokio::spawn(
+ async move {
+ let _ = web_server.await;
+ logger::error!("The health check probe stopped working!");
+ }
+ .in_current_span(),
+ );
logger::debug!(startup_config=?state.conf);
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index efc0e8852da..7757313d867 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -1,5 +1,6 @@
use async_trait::async_trait;
use error_stack;
+use router_env::tracing::Instrument;
use super::{ConstructFlowSpecificData, Feature};
use crate::{
@@ -125,26 +126,32 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
let state = state.clone();
logger::info!("Call to save_payment_method in locker");
- 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 _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)
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 2ab98ae124b..cb4226bcfbe 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -160,18 +160,21 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
let store = state.store.clone();
- let business_profile_fut = tokio::spawn(async move {
- store
- .find_business_profile_by_profile_id(&profile_id)
- .map(|business_profile_result| {
- business_profile_result.to_not_found_response(
- errors::ApiErrorResponse::BusinessProfileNotFound {
- id: profile_id.to_string(),
- },
- )
- })
- .await
- });
+ let business_profile_fut = tokio::spawn(
+ async move {
+ store
+ .find_business_profile_by_profile_id(&profile_id)
+ .map(|business_profile_result| {
+ business_profile_result.to_not_found_response(
+ errors::ApiErrorResponse::BusinessProfileNotFound {
+ id: profile_id.to_string(),
+ },
+ )
+ })
+ .await
+ }
+ .in_current_span(),
+ );
let store = state.store.clone();
@@ -498,13 +501,17 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
let store = state.clone().store;
- let additional_pm_data_fut = tokio::spawn(async move {
- Ok(n_request_payment_method_data
- .async_map(|payment_method_data| async move {
- helpers::get_additional_payment_data(&payment_method_data, store.as_ref()).await
- })
- .await)
- });
+ let additional_pm_data_fut = tokio::spawn(
+ async move {
+ Ok(n_request_payment_method_data
+ .async_map(|payment_method_data| async move {
+ helpers::get_additional_payment_data(&payment_method_data, store.as_ref())
+ .await
+ })
+ .await)
+ }
+ .in_current_span(),
+ );
let store = state.clone().store;
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index cc4adca77c9..a8d6e792f3c 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -31,6 +31,7 @@ use actix_web::{
};
use http::StatusCode;
use hyperswitch_interfaces::secrets_interface::secret_state::SecuredSecret;
+use router_env::tracing::Instrument;
use routes::AppState;
use storage_impl::errors::ApplicationResult;
use tokio::sync::{mpsc, oneshot};
@@ -192,7 +193,7 @@ pub async fn start_server(conf: settings::Settings<SecuredSecret>) -> Applicatio
.workers(server.workers)
.shutdown_timeout(server.shutdown_timeout)
.run();
- tokio::spawn(receiver_for_error(rx, server.handle()));
+ let _task_handle = tokio::spawn(receiver_for_error(rx, server.handle()).in_current_span());
Ok(server)
}
diff --git a/crates/router/tests/utils.rs b/crates/router/tests/utils.rs
index e1ab3e80f32..5d48d6e8ad0 100644
--- a/crates/router/tests/utils.rs
+++ b/crates/router/tests/utils.rs
@@ -12,6 +12,7 @@ use actix_web::{
};
use derive_deref::Deref;
use router::{configs::settings::Settings, routes::AppState, services};
+use router_env::tracing::Instrument;
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::{json, Value};
use tokio::sync::{oneshot, OnceCell};
@@ -24,7 +25,7 @@ async fn spawn_server() -> bool {
.await
.expect("failed to create server");
- let _server = tokio::spawn(server);
+ let _server = tokio::spawn(server.in_current_span());
true
}
diff --git a/crates/scheduler/src/consumer.rs b/crates/scheduler/src/consumer.rs
index e069db28da7..471f689ffc8 100644
--- a/crates/scheduler/src/consumer.rs
+++ b/crates/scheduler/src/consumer.rs
@@ -10,7 +10,10 @@ pub use diesel_models::{self, process_tracker as storage};
use error_stack::{IntoReport, ResultExt};
use futures::future;
use redis_interface::{RedisConnectionPool, RedisEntryId};
-use router_env::{instrument, tracing};
+use router_env::{
+ instrument,
+ tracing::{self, Instrument},
+};
use time::PrimitiveDateTime;
use tokio::sync::mpsc;
use uuid::Uuid;
@@ -64,7 +67,8 @@ pub async fn start_consumer<T: SchedulerAppState + 'static>(
.into_report()
.attach_printable("Failed while creating a signals handler")?;
let handle = signal.handle();
- let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx));
+ let task_handle =
+ tokio::spawn(common_utils::signals::signal_handler(signal, tx).in_current_span());
'consumer: loop {
match rx.try_recv() {
diff --git a/crates/scheduler/src/producer.rs b/crates/scheduler/src/producer.rs
index bcf37cdf6f2..b8081c2b9ae 100644
--- a/crates/scheduler/src/producer.rs
+++ b/crates/scheduler/src/producer.rs
@@ -3,7 +3,10 @@ use std::sync::Arc;
use common_utils::errors::CustomResult;
use diesel_models::enums::ProcessTrackerStatus;
use error_stack::{report, IntoReport, ResultExt};
-use router_env::{instrument, tracing};
+use router_env::{
+ instrument,
+ tracing::{self, Instrument},
+};
use time::Duration;
use tokio::sync::mpsc;
@@ -57,7 +60,8 @@ where
.into_report()
.attach_printable("Failed while creating a signals handler")?;
let handle = signal.handle();
- let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx));
+ let task_handle =
+ tokio::spawn(common_utils::signals::signal_handler(signal, tx).in_current_span());
loop {
match rx.try_recv() {
diff --git a/crates/storage_impl/src/redis.rs b/crates/storage_impl/src/redis.rs
index e4e0c021ac8..be82d4cc293 100644
--- a/crates/storage_impl/src/redis.rs
+++ b/crates/storage_impl/src/redis.rs
@@ -6,7 +6,7 @@ use std::sync::{atomic, Arc};
use error_stack::{IntoReport, ResultExt};
use redis_interface::PubsubInterface;
-use router_env::logger;
+use router_env::{logger, tracing::Instrument};
use self::{kv_store::RedisConnInterface, pub_sub::PubSubInterface};
@@ -35,9 +35,12 @@ impl RedisStore {
pub fn set_error_callback(&self, callback: tokio::sync::oneshot::Sender<()>) {
let redis_clone = self.redis_conn.clone();
- tokio::spawn(async move {
- redis_clone.on_error(callback).await;
- });
+ let _task_handle = tokio::spawn(
+ async move {
+ redis_clone.on_error(callback).await;
+ }
+ .in_current_span(),
+ );
}
pub async fn subscribe_to_channel(
@@ -54,11 +57,14 @@ impl RedisStore {
.change_context(redis_interface::errors::RedisError::SubscribeError)?;
let redis_clone = self.redis_conn.clone();
- tokio::spawn(async move {
- if let Err(e) = redis_clone.on_message().await {
- logger::error!(pubsub_err=?e);
+ let _task_handle = tokio::spawn(
+ async move {
+ if let Err(e) = redis_clone.on_message().await {
+ logger::error!(pubsub_err=?e);
+ }
}
- });
+ .in_current_span(),
+ );
Ok(())
}
}
|
fix
|
adding span metadata to `tokio` spawned futures (#4118)
|
a526d26e0e7e9c889888f8f331952bc05cf57913
|
2023-01-09 14:02:59
|
Narayan Bhat
|
fix(mandate): create mandate only when mandate details are passed (#316)
| false
|
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index b0d0a0e9f2a..d7658e05d26 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -77,7 +77,6 @@ pub struct PaymentIntentRequest {
pub metadata_txn_uuid: String,
pub return_url: String,
pub confirm: bool,
- pub setup_future_usage: Option<enums::FutureUsage>,
pub off_session: Option<bool>,
pub mandate: Option<String>,
pub description: Option<String>,
@@ -247,7 +246,6 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest {
description: item.description.clone(),
off_session: item.request.off_session,
- setup_future_usage: item.request.setup_future_usage,
shipping: shipping_address,
capture_method: StripeCaptureMethod::from(item.request.capture_method),
payment_data,
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index e63ea4f4b85..e1f5a4878a0 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -129,7 +129,7 @@ where
resp.payment_method_id = Some(mandate.payment_method_id);
}
None => {
- if resp.request.get_setup_future_usage().is_some() {
+ if resp.request.get_setup_mandate_details().is_some() {
let payment_method_id = helpers::call_payment_method(
state,
&resp.merchant_id,
|
fix
|
create mandate only when mandate details are passed (#316)
|
323d763087fd7453f05153b97d6b53e211cf74ba
|
2025-02-10 11:56:39
|
AkshayaFoiger
|
feat(router): add adyen split payments support (#6952)
| false
|
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 329bab6f3dd..7cdd6fe9d31 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -3076,6 +3076,79 @@
},
"additionalProperties": false
},
+ "AdyenSplitData": {
+ "type": "object",
+ "description": "Fee information for Split Payments to be charged on the payment being collected for Adyen",
+ "required": [
+ "split_items"
+ ],
+ "properties": {
+ "store": {
+ "type": "string",
+ "description": "The store identifier",
+ "nullable": true
+ },
+ "split_items": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AdyenSplitItem"
+ },
+ "description": "Data for the split items"
+ }
+ },
+ "additionalProperties": false
+ },
+ "AdyenSplitItem": {
+ "type": "object",
+ "description": "Data for the split items",
+ "required": [
+ "amount",
+ "split_type",
+ "reference"
+ ],
+ "properties": {
+ "amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The amount of the split item",
+ "example": 6540
+ },
+ "split_type": {
+ "$ref": "#/components/schemas/AdyenSplitType"
+ },
+ "account": {
+ "type": "string",
+ "description": "The unique identifier of the account to which the split amount is allocated.",
+ "nullable": true
+ },
+ "reference": {
+ "type": "string",
+ "description": "Unique Identifier for the split item"
+ },
+ "description": {
+ "type": "string",
+ "description": "Description for the part of the payment that will be allocated to the specified account.",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false
+ },
+ "AdyenSplitType": {
+ "type": "string",
+ "enum": [
+ "BalanceAccount",
+ "AcquiringFees",
+ "PaymentFee",
+ "AdyenFees",
+ "AdyenCommission",
+ "AdyenMarkup",
+ "Interchange",
+ "SchemeFee",
+ "Commission",
+ "TopUp",
+ "Vat"
+ ]
+ },
"AirwallexData": {
"type": "object",
"properties": {
@@ -6766,6 +6839,33 @@
"zsl"
]
},
+ "ConnectorChargeResponseData": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "stripe_split_payment"
+ ],
+ "properties": {
+ "stripe_split_payment": {
+ "$ref": "#/components/schemas/StripeChargeResponseData"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "adyen_split_payment"
+ ],
+ "properties": {
+ "adyen_split_payment": {
+ "$ref": "#/components/schemas/AdyenSplitData"
+ }
+ }
+ }
+ ],
+ "description": "Charge Information"
+ },
"ConnectorFeatureMatrixResponse": {
"type": "object",
"required": [
@@ -19763,24 +19863,20 @@
"$ref": "#/components/schemas/StripeSplitPaymentRequest"
}
}
- }
- ],
- "description": "Fee information for Split Payments to be charged on the payment being collected"
- },
- "SplitPaymentsResponse": {
- "oneOf": [
+ },
{
"type": "object",
"required": [
- "stripe_split_payment"
+ "adyen_split_payment"
],
"properties": {
- "stripe_split_payment": {
- "$ref": "#/components/schemas/StripeSplitPaymentsResponse"
+ "adyen_split_payment": {
+ "$ref": "#/components/schemas/AdyenSplitData"
}
}
}
- ]
+ ],
+ "description": "Fee information for Split Payments to be charged on the payment being collected"
},
"SplitRefund": {
"oneOf": [
@@ -19794,6 +19890,17 @@
"$ref": "#/components/schemas/StripeSplitRefundRequest"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "adyen_split_refund"
+ ],
+ "properties": {
+ "adyen_split_refund": {
+ "$ref": "#/components/schemas/AdyenSplitData"
+ }
+ }
}
],
"description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details."
@@ -19868,66 +19975,67 @@
"propertyName": "type"
}
},
- "StripeChargeType": {
- "type": "string",
- "enum": [
- "direct",
- "destination"
- ]
- },
- "StripeSplitPaymentRequest": {
+ "StripeChargeResponseData": {
"type": "object",
- "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe",
+ "description": "Fee information to be charged on the payment being collected via Stripe",
"required": [
"charge_type",
"application_fees",
"transfer_account_id"
],
"properties": {
+ "charge_id": {
+ "type": "string",
+ "description": "Identifier for charge created for the payment",
+ "nullable": true
+ },
"charge_type": {
"$ref": "#/components/schemas/PaymentChargeType"
},
"application_fees": {
"type": "integer",
"format": "int64",
- "description": "Platform fees to be collected on the payment",
+ "description": "Platform fees collected on the payment",
"example": 6540
},
"transfer_account_id": {
"type": "string",
- "description": "Identifier for the reseller's account to send the funds to"
+ "description": "Identifier for the reseller's account where the funds were transferred"
}
},
"additionalProperties": false
},
- "StripeSplitPaymentsResponse": {
+ "StripeChargeType": {
+ "type": "string",
+ "enum": [
+ "direct",
+ "destination"
+ ]
+ },
+ "StripeSplitPaymentRequest": {
"type": "object",
- "description": "Fee information to be charged on the payment being collected",
+ "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe",
"required": [
"charge_type",
"application_fees",
"transfer_account_id"
],
"properties": {
- "charge_id": {
- "type": "string",
- "description": "Identifier for charge created for the payment",
- "nullable": true
- },
"charge_type": {
"$ref": "#/components/schemas/PaymentChargeType"
},
"application_fees": {
"type": "integer",
"format": "int64",
- "description": "Platform fees collected on the payment",
+ "description": "Platform fees to be collected on the payment",
"example": 6540
},
"transfer_account_id": {
"type": "string",
"description": "Identifier for the reseller's account where the funds were transferred"
}
- }
+ },
+ "additionalProperties": false
},
"StripeSplitRefundRequest": {
"type": "object",
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index d1bfc5dfdba..60be7f59d67 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -6008,6 +6008,79 @@
},
"additionalProperties": false
},
+ "AdyenSplitData": {
+ "type": "object",
+ "description": "Fee information for Split Payments to be charged on the payment being collected for Adyen",
+ "required": [
+ "split_items"
+ ],
+ "properties": {
+ "store": {
+ "type": "string",
+ "description": "The store identifier",
+ "nullable": true
+ },
+ "split_items": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AdyenSplitItem"
+ },
+ "description": "Data for the split items"
+ }
+ },
+ "additionalProperties": false
+ },
+ "AdyenSplitItem": {
+ "type": "object",
+ "description": "Data for the split items",
+ "required": [
+ "amount",
+ "split_type",
+ "reference"
+ ],
+ "properties": {
+ "amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The amount of the split item",
+ "example": 6540
+ },
+ "split_type": {
+ "$ref": "#/components/schemas/AdyenSplitType"
+ },
+ "account": {
+ "type": "string",
+ "description": "The unique identifier of the account to which the split amount is allocated.",
+ "nullable": true
+ },
+ "reference": {
+ "type": "string",
+ "description": "Unique Identifier for the split item"
+ },
+ "description": {
+ "type": "string",
+ "description": "Description for the part of the payment that will be allocated to the specified account.",
+ "nullable": true
+ }
+ },
+ "additionalProperties": false
+ },
+ "AdyenSplitType": {
+ "type": "string",
+ "enum": [
+ "BalanceAccount",
+ "AcquiringFees",
+ "PaymentFee",
+ "AdyenFees",
+ "AdyenCommission",
+ "AdyenMarkup",
+ "Interchange",
+ "SchemeFee",
+ "Commission",
+ "TopUp",
+ "Vat"
+ ]
+ },
"AirwallexData": {
"type": "object",
"properties": {
@@ -9516,6 +9589,33 @@
"zsl"
]
},
+ "ConnectorChargeResponseData": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "stripe_split_payment"
+ ],
+ "properties": {
+ "stripe_split_payment": {
+ "$ref": "#/components/schemas/StripeChargeResponseData"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "adyen_split_payment"
+ ],
+ "properties": {
+ "adyen_split_payment": {
+ "$ref": "#/components/schemas/AdyenSplitData"
+ }
+ }
+ }
+ ],
+ "description": "Charge Information"
+ },
"ConnectorFeatureMatrixResponse": {
"type": "object",
"required": [
@@ -19083,7 +19183,7 @@
"split_payments": {
"allOf": [
{
- "$ref": "#/components/schemas/SplitPaymentsResponse"
+ "$ref": "#/components/schemas/ConnectorChargeResponseData"
}
],
"nullable": true
@@ -20326,7 +20426,7 @@
"split_payments": {
"allOf": [
{
- "$ref": "#/components/schemas/SplitPaymentsResponse"
+ "$ref": "#/components/schemas/ConnectorChargeResponseData"
}
],
"nullable": true
@@ -25258,24 +25358,20 @@
"$ref": "#/components/schemas/StripeSplitPaymentRequest"
}
}
- }
- ],
- "description": "Fee information for Split Payments to be charged on the payment being collected"
- },
- "SplitPaymentsResponse": {
- "oneOf": [
+ },
{
"type": "object",
"required": [
- "stripe_split_payment"
+ "adyen_split_payment"
],
"properties": {
- "stripe_split_payment": {
- "$ref": "#/components/schemas/StripeSplitPaymentsResponse"
+ "adyen_split_payment": {
+ "$ref": "#/components/schemas/AdyenSplitData"
}
}
}
- ]
+ ],
+ "description": "Fee information for Split Payments to be charged on the payment being collected"
},
"SplitRefund": {
"oneOf": [
@@ -25289,6 +25385,17 @@
"$ref": "#/components/schemas/StripeSplitRefundRequest"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "adyen_split_refund"
+ ],
+ "properties": {
+ "adyen_split_refund": {
+ "$ref": "#/components/schemas/AdyenSplitData"
+ }
+ }
}
],
"description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details."
@@ -25363,66 +25470,67 @@
"propertyName": "type"
}
},
- "StripeChargeType": {
- "type": "string",
- "enum": [
- "direct",
- "destination"
- ]
- },
- "StripeSplitPaymentRequest": {
+ "StripeChargeResponseData": {
"type": "object",
- "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe",
+ "description": "Fee information to be charged on the payment being collected via Stripe",
"required": [
"charge_type",
"application_fees",
"transfer_account_id"
],
"properties": {
+ "charge_id": {
+ "type": "string",
+ "description": "Identifier for charge created for the payment",
+ "nullable": true
+ },
"charge_type": {
"$ref": "#/components/schemas/PaymentChargeType"
},
"application_fees": {
"type": "integer",
"format": "int64",
- "description": "Platform fees to be collected on the payment",
+ "description": "Platform fees collected on the payment",
"example": 6540
},
"transfer_account_id": {
"type": "string",
- "description": "Identifier for the reseller's account to send the funds to"
+ "description": "Identifier for the reseller's account where the funds were transferred"
}
},
"additionalProperties": false
},
- "StripeSplitPaymentsResponse": {
+ "StripeChargeType": {
+ "type": "string",
+ "enum": [
+ "direct",
+ "destination"
+ ]
+ },
+ "StripeSplitPaymentRequest": {
"type": "object",
- "description": "Fee information to be charged on the payment being collected",
+ "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe",
"required": [
"charge_type",
"application_fees",
"transfer_account_id"
],
"properties": {
- "charge_id": {
- "type": "string",
- "description": "Identifier for charge created for the payment",
- "nullable": true
- },
"charge_type": {
"$ref": "#/components/schemas/PaymentChargeType"
},
"application_fees": {
"type": "integer",
"format": "int64",
- "description": "Platform fees collected on the payment",
+ "description": "Platform fees to be collected on the payment",
"example": 6540
},
"transfer_account_id": {
"type": "string",
"description": "Identifier for the reseller's account where the funds were transferred"
}
- }
+ },
+ "additionalProperties": false
},
"StripeSplitRefundRequest": {
"type": "object",
diff --git a/connector-template/transformers.rs b/connector-template/transformers.rs
index b508596cbc0..73e167d89fd 100644
--- a/connector-template/transformers.rs
+++ b/connector-template/transformers.rs
@@ -138,7 +138,7 @@ impl<F,T> TryFrom<ResponseRouterData<F, {{project-name | downcase | pascal_case}
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 45ba71454f4..efd000d830d 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -4734,7 +4734,8 @@ pub struct PaymentsResponse {
pub updated: Option<PrimitiveDateTime>,
/// Fee information to be charged on the payment being collected
- pub split_payments: Option<SplitPaymentsResponse>,
+ #[schema(value_type = Option<ConnectorChargeResponseData>)]
+ pub split_payments: Option<common_types::payments::ConnectorChargeResponseData>,
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. FRM Metadata is useful for storing additional, structured information on an object related to FRM.
#[schema(value_type = Option<Object>, example = r#"{ "fulfillment_method" : "deliver", "coverage_request" : "fraud" }"#)]
@@ -5276,31 +5277,6 @@ pub struct PaymentStartRedirectionParams {
pub profile_id: id_type::ProfileId,
}
-/// Fee information to be charged on the payment being collected
-#[derive(Setter, Clone, Debug, PartialEq, serde::Serialize, ToSchema)]
-pub struct StripeSplitPaymentsResponse {
- /// Identifier for charge created for the payment
- pub charge_id: Option<String>,
-
- /// Type of charge (connector specific)
- #[schema(value_type = PaymentChargeType, example = "direct")]
- pub charge_type: api_enums::PaymentChargeType,
-
- /// Platform fees collected on the payment
- #[schema(value_type = i64, example = 6540)]
- pub application_fees: MinorUnit,
-
- /// Identifier for the reseller's account where the funds were transferred
- pub transfer_account_id: String,
-}
-
-#[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema)]
-#[serde(rename_all = "snake_case")]
-pub enum SplitPaymentsResponse {
- /// StripeSplitPaymentsResponse
- StripeSplitPayment(StripeSplitPaymentsResponse),
-}
-
/// Details of external authentication
#[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)]
pub struct ExternalAuthenticationDetailsResponse {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 1faa3b90aa8..c4ee48ed5ac 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3696,3 +3696,41 @@ pub enum GooglePayAuthMethod {
#[serde(rename = "CRYPTOGRAM_3DS")]
Cryptogram,
}
+
+#[derive(
+ Clone,
+ Debug,
+ Eq,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[strum(serialize_all = "PascalCase")]
+#[serde(rename_all = "PascalCase")]
+pub enum AdyenSplitType {
+ /// Books split amount to the specified account.
+ BalanceAccount,
+ /// The aggregated amount of the interchange and scheme fees.
+ AcquiringFees,
+ /// The aggregated amount of all transaction fees.
+ PaymentFee,
+ /// The aggregated amount of Adyen's commission and markup fees.
+ AdyenFees,
+ /// The transaction fees due to Adyen under blended rates.
+ AdyenCommission,
+ /// The transaction fees due to Adyen under Interchange ++ pricing.
+ AdyenMarkup,
+ /// The fees paid to the issuer for each payment made with the card network.
+ Interchange,
+ /// The fees paid to the card scheme for using their network.
+ SchemeFee,
+ /// Your platform's commission on the payment (specified in amount), booked to your liable balance account.
+ Commission,
+ /// Allows you and your users to top up balance accounts using direct debit, card payments, or other payment methods.
+ TopUp,
+ /// The value-added tax charged on the payment, booked to your platforms liable balance account.
+ Vat,
+}
diff --git a/crates/common_types/src/domain.rs b/crates/common_types/src/domain.rs
new file mode 100644
index 00000000000..65f6ae9ad68
--- /dev/null
+++ b/crates/common_types/src/domain.rs
@@ -0,0 +1,43 @@
+//! Common types
+
+use common_enums::enums;
+use common_utils::{impl_to_sql_from_sql_json, types::MinorUnit};
+use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};
+use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
+
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+#[serde(deny_unknown_fields)]
+/// Fee information for Split Payments to be charged on the payment being collected for Adyen
+pub struct AdyenSplitData {
+ /// The store identifier
+ pub store: Option<String>,
+ /// Data for the split items
+ pub split_items: Vec<AdyenSplitItem>,
+}
+impl_to_sql_from_sql_json!(AdyenSplitData);
+
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+#[serde(deny_unknown_fields)]
+/// Data for the split items
+pub struct AdyenSplitItem {
+ /// The amount of the split item
+ #[schema(value_type = i64, example = 6540)]
+ pub amount: Option<MinorUnit>,
+ /// Defines type of split item
+ #[schema(value_type = AdyenSplitType, example = "BalanceAccount")]
+ pub split_type: enums::AdyenSplitType,
+ /// The unique identifier of the account to which the split amount is allocated.
+ pub account: Option<String>,
+ /// Unique Identifier for the split item
+ pub reference: String,
+ /// Description for the part of the payment that will be allocated to the specified account.
+ pub description: Option<String>,
+}
+impl_to_sql_from_sql_json!(AdyenSplitItem);
diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs
index b0b258ecb6d..6139ddff16a 100644
--- a/crates/common_types/src/lib.rs
+++ b/crates/common_types/src/lib.rs
@@ -2,6 +2,7 @@
#![warn(missing_docs, missing_debug_implementations)]
+pub mod domain;
pub mod payment_methods;
pub mod payments;
pub mod refunds;
diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rs
index ea42fbf7a41..ba96d618c41 100644
--- a/crates/common_types/src/payments.rs
+++ b/crates/common_types/src/payments.rs
@@ -12,6 +12,8 @@ use euclid::frontend::{
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
+use crate::domain::AdyenSplitData;
+
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
)]
@@ -22,9 +24,31 @@ use utoipa::ToSchema;
pub enum SplitPaymentsRequest {
/// StripeSplitPayment
StripeSplitPayment(StripeSplitPaymentRequest),
+ /// AdyenSplitPayment
+ AdyenSplitPayment(AdyenSplitData),
}
impl_to_sql_from_sql_json!(SplitPaymentsRequest);
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+#[serde(deny_unknown_fields)]
+/// Fee information for Split Payments to be charged on the payment being collected for Stripe
+pub struct StripeSplitPaymentRequest {
+ /// Stripe's charge type
+ #[schema(value_type = PaymentChargeType, example = "direct")]
+ pub charge_type: enums::PaymentChargeType,
+
+ /// Platform fees to be collected on the payment
+ #[schema(value_type = i64, example = 6540)]
+ pub application_fees: MinorUnit,
+
+ /// Identifier for the reseller's account where the funds were transferred
+ pub transfer_account_id: String,
+}
+impl_to_sql_from_sql_json!(StripeSplitPaymentRequest);
+
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
)]
@@ -50,26 +74,6 @@ impl AuthenticationConnectorAccountMap {
}
}
-#[derive(
- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
-)]
-#[diesel(sql_type = Jsonb)]
-#[serde(deny_unknown_fields)]
-/// Fee information for Split Payments to be charged on the payment being collected for Stripe
-pub struct StripeSplitPaymentRequest {
- /// Stripe's charge type
- #[schema(value_type = PaymentChargeType, example = "direct")]
- pub charge_type: enums::PaymentChargeType,
-
- /// Platform fees to be collected on the payment
- #[schema(value_type = i64, example = 6540)]
- pub application_fees: MinorUnit,
-
- /// Identifier for the reseller's account to send the funds to
- pub transfer_account_id: String,
-}
-impl_to_sql_from_sql_json!(StripeSplitPaymentRequest);
-
#[derive(
Serialize, Default, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
)]
@@ -116,3 +120,42 @@ impl_to_sql_from_sql_json!(DecisionManagerRecord);
/// DecisionManagerResponse
pub type DecisionManagerResponse = DecisionManagerRecord;
+
+/// Fee information to be charged on the payment being collected via Stripe
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+#[serde(deny_unknown_fields)]
+pub struct StripeChargeResponseData {
+ /// Identifier for charge created for the payment
+ pub charge_id: Option<String>,
+
+ /// Type of charge (connector specific)
+ #[schema(value_type = PaymentChargeType, example = "direct")]
+ pub charge_type: enums::PaymentChargeType,
+
+ /// Platform fees collected on the payment
+ #[schema(value_type = i64, example = 6540)]
+ pub application_fees: MinorUnit,
+
+ /// Identifier for the reseller's account where the funds were transferred
+ pub transfer_account_id: String,
+}
+impl_to_sql_from_sql_json!(StripeChargeResponseData);
+
+/// Charge Information
+#[derive(
+ Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
+)]
+#[diesel(sql_type = Jsonb)]
+#[serde(rename_all = "snake_case")]
+#[serde(deny_unknown_fields)]
+pub enum ConnectorChargeResponseData {
+ /// StripeChargeResponseData
+ StripeSplitPayment(StripeChargeResponseData),
+ /// AdyenChargeResponseData
+ AdyenSplitPayment(AdyenSplitData),
+}
+
+impl_to_sql_from_sql_json!(ConnectorChargeResponseData);
diff --git a/crates/common_types/src/refunds.rs b/crates/common_types/src/refunds.rs
index e4b7c5a336f..c96937021c8 100644
--- a/crates/common_types/src/refunds.rs
+++ b/crates/common_types/src/refunds.rs
@@ -5,6 +5,8 @@ use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
+use crate::domain::AdyenSplitData;
+
#[derive(
Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,
)]
@@ -15,6 +17,8 @@ use utoipa::ToSchema;
pub enum SplitRefund {
/// StripeSplitRefundRequest
StripeSplitRefund(StripeSplitRefundRequest),
+ /// AdyenSplitRefundRequest
+ AdyenSplitRefund(AdyenSplitData),
}
impl_to_sql_from_sql_json!(SplitRefund);
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index a8fdf882e70..eab95f81316 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -73,7 +73,6 @@ pub struct PaymentAttempt {
pub authentication_connector: Option<String>,
pub authentication_id: Option<String>,
pub fingerprint_id: Option<String>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub customer_acceptance: Option<pii::SecretSerdeValue>,
@@ -95,6 +94,7 @@ pub struct PaymentAttempt {
pub shipping_cost: Option<MinorUnit>,
pub order_tax_amount: Option<MinorUnit>,
pub card_discovery: Option<storage_enums::CardDiscovery>,
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
#[cfg(feature = "v1")]
@@ -174,6 +174,7 @@ pub struct PaymentAttempt {
pub connector_transaction_data: Option<String>,
pub connector_mandate_detail: Option<ConnectorMandateReferenceId>,
pub card_discovery: Option<storage_enums::CardDiscovery>,
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
#[cfg(feature = "v1")]
@@ -287,7 +288,6 @@ pub struct PaymentAttemptNew {
pub authentication_id: Option<String>,
pub fingerprint_id: Option<String>,
pub payment_method_billing_address: Option<common_utils::encryption::Encryption>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub customer_acceptance: Option<pii::SecretSerdeValue>,
@@ -301,6 +301,7 @@ pub struct PaymentAttemptNew {
pub id: id_type::GlobalAttemptId,
pub connector_token_details: Option<ConnectorTokenDetails>,
pub card_discovery: Option<storage_enums::CardDiscovery>,
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
#[cfg(feature = "v1")]
@@ -364,7 +365,6 @@ pub struct PaymentAttemptNew {
pub mandate_data: Option<storage_enums::MandateDetails>,
pub fingerprint_id: Option<String>,
pub payment_method_billing_address_id: Option<String>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub customer_acceptance: Option<pii::SecretSerdeValue>,
@@ -494,8 +494,8 @@ pub enum PaymentAttemptUpdate {
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
payment_method_data: Option<serde_json::Value>,
- charge_id: Option<String>,
connector_mandate_detail: Option<ConnectorMandateReferenceId>,
+ charges: Option<common_types::payments::ConnectorChargeResponseData>,
},
UnresolvedResponseUpdate {
status: storage_enums::AttemptStatus,
@@ -550,7 +550,7 @@ pub enum PaymentAttemptUpdate {
encoded_data: Option<String>,
connector_transaction_id: Option<String>,
connector: Option<String>,
- charge_id: Option<String>,
+ charges: Option<common_types::payments::ConnectorChargeResponseData>,
updated_by: String,
},
IncrementalAuthorizationAmountUpdate {
@@ -865,7 +865,6 @@ pub struct PaymentAttemptUpdateInternal {
pub authentication_id: Option<String>,
pub fingerprint_id: Option<String>,
pub payment_method_billing_address_id: Option<String>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub customer_acceptance: Option<pii::SecretSerdeValue>,
@@ -875,6 +874,7 @@ pub struct PaymentAttemptUpdateInternal {
pub connector_transaction_data: Option<String>,
pub connector_mandate_detail: Option<ConnectorMandateReferenceId>,
pub card_discovery: Option<common_enums::CardDiscovery>,
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
#[cfg(feature = "v1")]
@@ -1049,7 +1049,6 @@ impl PaymentAttemptUpdate {
authentication_id,
payment_method_billing_address_id,
fingerprint_id,
- charge_id,
client_source,
client_version,
customer_acceptance,
@@ -1059,6 +1058,7 @@ impl PaymentAttemptUpdate {
connector_transaction_data,
connector_mandate_detail,
card_discovery,
+ charges,
} = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source);
PaymentAttempt {
amount: amount.unwrap_or(source.amount),
@@ -1107,7 +1107,6 @@ impl PaymentAttemptUpdate {
payment_method_billing_address_id: payment_method_billing_address_id
.or(source.payment_method_billing_address_id),
fingerprint_id: fingerprint_id.or(source.fingerprint_id),
- charge_id: charge_id.or(source.charge_id),
client_source: client_source.or(source.client_source),
client_version: client_version.or(source.client_version),
customer_acceptance: customer_acceptance.or(source.customer_acceptance),
@@ -1118,6 +1117,7 @@ impl PaymentAttemptUpdate {
.or(source.connector_transaction_data),
connector_mandate_detail: connector_mandate_detail.or(source.connector_mandate_detail),
card_discovery: card_discovery.or(source.card_discovery),
+ charges: charges.or(source.charges),
..source
}
}
@@ -2161,7 +2161,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
external_three_ds_authentication_attempted: None,
authentication_connector: None,
authentication_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2171,6 +2170,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::AuthenticationTypeUpdate {
authentication_type,
@@ -2218,7 +2218,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2228,6 +2227,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::ConfirmUpdate {
amount,
@@ -2310,13 +2310,13 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
encoded_data: None,
unified_code: None,
unified_message: None,
- charge_id: None,
card_network: None,
shipping_cost,
order_tax_amount,
connector_transaction_data: None,
connector_mandate_detail,
card_discovery,
+ charges: None,
},
PaymentAttemptUpdate::VoidUpdate {
status,
@@ -2365,7 +2365,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2375,6 +2374,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::RejectUpdate {
status,
@@ -2424,7 +2424,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2434,6 +2433,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::BlocklistUpdate {
status,
@@ -2483,7 +2483,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2493,6 +2492,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::ConnectorMandateDetailUpdate {
connector_mandate_detail,
@@ -2540,7 +2540,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2550,6 +2549,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::PaymentMethodDetailsUpdate {
payment_method_id,
@@ -2597,7 +2597,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2607,6 +2606,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::ResponseUpdate {
status,
@@ -2628,8 +2628,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code,
unified_message,
payment_method_data,
- charge_id,
connector_mandate_detail,
+ charges,
} => {
let (connector_transaction_id, connector_transaction_data) =
connector_transaction_id
@@ -2657,7 +2657,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_code,
unified_message,
payment_method_data,
- charge_id,
connector_transaction_data,
amount: None,
net_amount: None,
@@ -2689,6 +2688,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail,
card_discovery: None,
+ charges,
}
}
PaymentAttemptUpdate::ErrorUpdate {
@@ -2754,7 +2754,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2763,6 +2762,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
}
}
PaymentAttemptUpdate::StatusUpdate { status, updated_by } => Self {
@@ -2808,7 +2808,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2818,6 +2817,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::UpdateTrackers {
payment_token,
@@ -2871,7 +2871,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2881,6 +2880,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::UnresolvedResponseUpdate {
status,
@@ -2942,7 +2942,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -2951,6 +2950,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
}
}
PaymentAttemptUpdate::PreprocessingUpdate {
@@ -3011,7 +3011,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3020,6 +3019,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
}
}
PaymentAttemptUpdate::CaptureUpdate {
@@ -3069,7 +3069,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3079,6 +3078,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::AmountToCaptureUpdate {
status,
@@ -3127,7 +3127,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3137,6 +3136,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::ConnectorResponse {
authentication_data,
@@ -3144,7 +3144,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_id,
connector,
updated_by,
- charge_id,
+ charges,
} => {
let (connector_transaction_id, connector_transaction_data) =
connector_transaction_id
@@ -3158,7 +3158,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector: connector.map(Some),
modified_at: common_utils::date_time::now(),
updated_by,
- charge_id,
connector_transaction_data,
amount: None,
net_amount: None,
@@ -3204,6 +3203,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges,
}
}
PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate {
@@ -3252,7 +3252,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3262,6 +3261,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::AuthenticationUpdate {
status,
@@ -3312,7 +3312,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
unified_message: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3322,6 +3321,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
PaymentAttemptUpdate::ManualUpdate {
status,
@@ -3382,7 +3382,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3391,6 +3390,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
}
}
PaymentAttemptUpdate::PostSessionTokensUpdate {
@@ -3439,7 +3439,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -3449,6 +3448,7 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
connector_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
+ charges: None,
},
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 170eb576e34..bbde92ea040 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -910,6 +910,7 @@ diesel::table! {
connector_transaction_data -> Nullable<Varchar>,
connector_mandate_detail -> Nullable<Jsonb>,
card_discovery -> Nullable<CardDiscovery>,
+ charges -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 19456a5c65b..59a265e25f5 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -849,8 +849,6 @@ diesel::table! {
#[max_length = 64]
fingerprint_id -> Nullable<Varchar>,
#[max_length = 64]
- charge_id -> Nullable<Varchar>,
- #[max_length = 64]
client_source -> Nullable<Varchar>,
#[max_length = 64]
client_version -> Nullable<Varchar>,
@@ -881,6 +879,7 @@ diesel::table! {
shipping_cost -> Nullable<Int8>,
order_tax_amount -> Nullable<Int8>,
card_discovery -> Nullable<CardDiscovery>,
+ charges -> Nullable<Jsonb>,
}
}
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 4262276c467..c063545d81f 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -274,7 +274,6 @@ impl PaymentAttemptBatchNew {
mandate_data: self.mandate_data,
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
- charge_id: self.charge_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
diff --git a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
index 3246f7d01d5..9fe45cef21e 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
@@ -745,7 +745,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AciPaymentsResponse, T, PaymentsRespons
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
index 8c5adefc613..9f154103c69 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
@@ -665,7 +665,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AirwallexPaymentsResponse, T, PaymentsR
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -708,7 +708,7 @@ impl
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
index b6132781423..5b11d9e9d47 100644
--- a/crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, AmazonpayPaymentsResponse, T, PaymentsR
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
index f0ea149b0d6..0d9e7e1b14b 100644
--- a/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
@@ -478,7 +478,7 @@ impl<F> TryFrom<ResponseRouterData<F, BamboraResponse, PaymentsAuthorizeData, Pa
network_txn_id: None,
connector_response_reference_id: Some(pg_response.order_number.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -505,7 +505,7 @@ impl<F> TryFrom<ResponseRouterData<F, BamboraResponse, PaymentsAuthorizeData, Pa
item.data.connector_request_reference_id.to_string(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -548,7 +548,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_number.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -593,7 +593,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_number.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -628,7 +628,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_number.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -663,7 +663,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_number.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
index f4399d105c5..5996ba05834 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
@@ -313,7 +313,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(connector_transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -485,7 +485,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -631,7 +631,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(connector_transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -910,7 +910,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(connector_transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
index 11ff53d439c..9804f6c4e6c 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
@@ -431,7 +431,7 @@ impl<F, T>
.unwrap_or(info_response.id),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
},
connector_response,
@@ -1518,7 +1518,7 @@ fn get_payment_response(
.unwrap_or(info_response.id.clone()),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
}
@@ -1816,7 +1816,7 @@ impl<F>
.map(|cref| cref.code)
.unwrap_or(Some(item.response.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
connector_response,
..item.data
@@ -1833,7 +1833,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
index 05b9abae051..9fe00bac046 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
@@ -291,7 +291,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BillwerkPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.handle),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status: enums::AttemptStatus::from(item.response.state),
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
index 4071b58a880..ab9dd25bb7b 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
@@ -169,7 +169,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BitpayPaymentsResponse, T, PaymentsResp
.order_id
.or(Some(item.response.data.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
index 3f319ee74f5..29b0611c979 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
@@ -760,7 +760,7 @@ impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
index 809902fa2a2..7c49cfe93dc 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
@@ -879,7 +879,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BluesnapPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
index 8bc7b3639b7..1565b959a9b 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
@@ -317,7 +317,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BokuResponse, T, PaymentsResponseData>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
index b8253cc411d..e2571e8b58a 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
@@ -458,7 +458,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -481,7 +481,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -634,7 +634,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -657,7 +657,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -717,7 +717,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -782,7 +782,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -1287,7 +1287,7 @@ impl TryFrom<PaymentsCaptureResponseRouterData<BraintreeCaptureResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -1396,7 +1396,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreeCancelResponse, T, PaymentsRes
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -1498,7 +1498,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, BraintreePSyncResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
index 7a70d97a102..c139bc1524d 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
@@ -274,7 +274,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
)
}
@@ -307,7 +307,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CashtocodePaymentsSyncResponse, T, Paym
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
index f825a17acba..3d194caeaa6 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ChargebeePaymentsResponse, T, PaymentsR
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
index 8ac5f86247c..26c7fba3cbc 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
@@ -152,7 +152,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CoinbasePaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.data.id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
|context| {
Ok(PaymentsResponseData::TransactionUnresolvedResponse{
diff --git a/crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs b/crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
index 08b9ae781e1..831f30453ed 100644
--- a/crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CoingatePaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
index cf65b9e5dfe..98d3dd76cdd 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
@@ -194,7 +194,7 @@ impl<F, T>
.custom_id
.or(Some(item.response.data.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
match amount_captured_in_minor_units {
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
index 5e18ee921b4..b42c02606c1 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
@@ -2667,7 +2667,7 @@ fn get_payment_response(
.unwrap_or(info_response.id.clone()),
),
incremental_authorization_allowed,
- charge_id: None,
+ charges: None,
})
}
}
@@ -2761,7 +2761,7 @@ impl<F>
.unwrap_or(info_response.id.clone()),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -3171,7 +3171,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -3422,7 +3422,7 @@ impl
incremental_authorization_allowed: Some(
mandate_status == enums::AttemptStatus::Authorized,
),
- charge_id: None,
+ charges: None,
}),
},
connector_response,
@@ -3540,7 +3540,7 @@ impl<F>
.map(|cref| cref.code)
.unwrap_or(Some(item.response.id)),
incremental_authorization_allowed,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -3556,7 +3556,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
index d2ca3d2d013..f4c3a8ae099 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
@@ -428,7 +428,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
DatatransResponse::ThreeDSResponse(response) => {
@@ -450,7 +450,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
};
@@ -584,7 +584,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
index b026c339e2a..bf8a7fc9528 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
@@ -389,7 +389,7 @@ impl
network_txn_id: None,
connector_response_reference_id: Some(processed.tx_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -421,7 +421,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -594,7 +594,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -645,7 +645,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -895,7 +895,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -984,7 +984,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
index a9408e4e1c5..f67271136f1 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
@@ -167,7 +167,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentsResponse, T, Paymen
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -223,7 +223,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DigitalvirgoPaymentSyncResponse, T, Pay
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
index c5b4b940c10..20b50af355a 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
@@ -335,7 +335,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DlocalPaymentsResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: item.response.order_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
@@ -369,7 +369,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DlocalPaymentsSyncResponse, T, Payments
network_txn_id: None,
connector_response_reference_id: item.response.order_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -400,7 +400,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DlocalPaymentsCaptureResponse, T, Payme
network_txn_id: None,
connector_response_reference_id: item.response.order_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -429,7 +429,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, DlocalPaymentsCancelResponse, T, Paymen
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
index 67561acf8db..a11c608d69f 100644
--- a/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs
@@ -244,7 +244,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(response.ssl_txn_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
}
@@ -391,7 +391,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<ElavonSyncResponse>> for PaymentsSyn
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -450,7 +450,7 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ElavonPaymentsResponse>>
network_txn_id: None,
connector_response_reference_id: Some(response.ssl_txn_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
index f4084525410..d6e2cd54db7 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
@@ -385,7 +385,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, FiservPaymentsResponse, T, PaymentsResp
gateway_resp.transaction_processing_details.order_id,
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -428,7 +428,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, FiservSyncResponse, T, PaymentsResponse
.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
index 24934273a44..53d4bfac606 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
@@ -370,7 +370,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, FiservemeaPaymentsResponse, T, Payments
network_txn_id: None,
connector_response_reference_id: item.response.order_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index b5d4408d6bf..2f8a979ba99 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -814,7 +814,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -850,7 +850,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -906,7 +906,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -952,7 +952,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Self {
@@ -971,7 +971,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
});
Self {
response,
@@ -1253,7 +1253,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
.map(|id| id.clone().expose()),
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
@@ -1315,7 +1315,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<FiuuPaymentResponse>> for PaymentsSy
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
@@ -1486,7 +1486,7 @@ impl TryFrom<PaymentsCaptureResponseRouterData<PaymentCaptureResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
@@ -1599,7 +1599,7 @@ impl TryFrom<PaymentsCancelResponseRouterData<FiuuPaymentCancelResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
diff --git a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
index 2583f47058b..31265162ca0 100644
--- a/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
@@ -308,7 +308,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, FortePaymentsResponse, T, PaymentsRespo
network_txn_id: None,
connector_response_reference_id: Some(transaction_id.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -351,7 +351,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, FortePaymentsSyncResponse, T, PaymentsR
network_txn_id: None,
connector_response_reference_id: Some(transaction_id.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -420,7 +420,7 @@ impl TryFrom<PaymentsCaptureResponseRouterData<ForteCaptureResponse>>
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: None,
..item.data
@@ -488,7 +488,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ForteCancelResponse, T, PaymentsRespons
network_txn_id: None,
connector_response_reference_id: Some(transaction_id.to_string()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
index 2b74b5f8cd4..27ff359a7ad 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs
@@ -296,7 +296,7 @@ fn get_payment_response(
network_txn_id: None,
connector_response_reference_id: response.reference,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
index 36c83859be9..a3c027cb5a2 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
@@ -221,7 +221,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, GlobepayPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -295,7 +295,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, GlobepaySyncResponse, T, PaymentsRespon
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
index f09d30efc9d..e8d83f415b1 100644
--- a/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
@@ -532,7 +532,7 @@ impl<F>
redirection_data: Box::new(None),
mandate_reference: Box::new(mandate_reference),
network_txn_id: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::Charged,
..item.data
@@ -687,7 +687,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -718,7 +718,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
index 4a8ddf68df9..0a5453a49d0 100644
--- a/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
@@ -387,7 +387,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: item.response.invoice_number.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::from(item.response),
..item.data
@@ -438,7 +438,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: item.response.invoice_number.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::from(item.response),
..item.data
@@ -487,7 +487,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: item.response.invoice_number.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::from(item.response),
..item.data
@@ -567,7 +567,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: item.response.invoice_number.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::from(item.response),
..item.data
@@ -624,7 +624,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: item.response.invoice_number.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: enums::AttemptStatus::from(item.response),
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
index 702a7a9b19f..6450839fac3 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
@@ -389,7 +389,7 @@ fn get_iatpay_response(
network_txn_id: None,
connector_response_reference_id: connector_response_reference_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}
}
None => PaymentsResponseData::TransactionResponse {
@@ -400,7 +400,7 @@ fn get_iatpay_response(
network_txn_id: None,
connector_response_reference_id: connector_response_reference_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
},
};
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
index 2739aa66bee..3922929892e 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
@@ -129,7 +129,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPaymentsResponse, T, PaymentsRes
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
)
}
@@ -235,7 +235,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPSyncResponse, T, PaymentsRespon
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -254,7 +254,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, InespayPSyncResponse, T, PaymentsRespon
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
index c5d66d9a156..77823c369b2 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
@@ -287,7 +287,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ItaubankPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.txid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -366,7 +366,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ItaubankPaymentsSyncResponse, T, Paymen
network_txn_id: None,
connector_response_reference_id: Some(item.response.txid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
index 78c1b5eefb5..8497443fbb8 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
@@ -361,7 +361,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, JpmorganPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -447,7 +447,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, JpmorganCaptureResponse, T, PaymentsRes
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -490,7 +490,7 @@ impl<F, PaymentsSyncData>
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -711,7 +711,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs b/crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
index 28584c2a7c4..4bcf4be1ec8 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
@@ -393,7 +393,7 @@ impl TryFrom<PaymentsResponseRouterData<KlarnaAuthResponse>>
network_txn_id: None,
connector_response_reference_id: Some(response.order_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: get_fraud_status(
response.fraud_status.clone(),
@@ -414,7 +414,7 @@ impl TryFrom<PaymentsResponseRouterData<KlarnaAuthResponse>>
network_txn_id: None,
connector_response_reference_id: Some(response.order_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: get_checkout_status(
response.status.clone(),
@@ -576,7 +576,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, KlarnaPsyncResponse, T, PaymentsRespons
.klarna_reference
.or(Some(response.order_id.clone())),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -590,7 +590,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, KlarnaPsyncResponse, T, PaymentsRespons
network_txn_id: None,
connector_response_reference_id: Some(response.order_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -662,7 +662,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status,
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs b/crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
index f89542d7810..ba2fbc4c301 100644
--- a/crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
@@ -270,7 +270,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MifinityPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(trace_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -285,7 +285,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MifinityPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -353,7 +353,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MifinityPsyncResponse, T, PaymentsRespo
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -368,7 +368,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MifinityPsyncResponse, T, PaymentsRespo
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -384,7 +384,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MifinityPsyncResponse, T, PaymentsRespo
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
index fa2cb46c7b7..c449ee05122 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs
@@ -516,7 +516,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MolliePaymentsResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
index 2065fdc232a..61732e5c751 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
@@ -1004,7 +1004,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, MultisafepayAuthResponse, T, PaymentsRe
payment_response.data.order_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
index 21fa1ec3217..88cea9c8edf 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
@@ -371,7 +371,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, NexinetsPreAuthOrDebitResponse, T, Paym
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -451,7 +451,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, NexinetsPaymentResponse, T, PaymentsRes
network_txn_id: None,
connector_response_reference_id: Some(item.response.order.order_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
index 1384102faf8..fd504a7a412 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
@@ -433,7 +433,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.operation.order_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -829,7 +829,7 @@ impl<F>
response_body.operation.order_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -848,7 +848,7 @@ impl<F>
mandate_response.operation.order_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -971,7 +971,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.operation.order_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1143,7 +1143,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1201,7 +1201,7 @@ impl<F>
item.data.request.connector_transaction_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1264,7 +1264,7 @@ impl<F>
item.data.request.connector_transaction_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs
index bea8b607dae..93b38001576 100644
--- a/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, NomupayPaymentsResponse, T, PaymentsRes
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index 112d409d6e2..ba00162281f 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -672,7 +672,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, NovalnetPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: transaction_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1074,7 +1074,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: transaction_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1158,7 +1158,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: transaction_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1327,7 +1327,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: transaction_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
index 84fb7bfecf2..3bc06aa6e19 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
@@ -1647,7 +1647,7 @@ where
network_txn_id: None,
connector_response_reference_id: response.order_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
index 70635e47300..ef4e308d968 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
@@ -702,7 +702,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxCaptureResponse, T, PaymentsRespo
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: None,
..item.data
@@ -761,7 +761,7 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -790,7 +790,7 @@ impl<F> TryFrom<ResponseRouterData<F, PayboxResponse, PaymentsAuthorizeData, Pay
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -833,7 +833,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayboxSyncResponse, T, PaymentsResponse
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -1021,7 +1021,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
index 49188803c4f..8437b660a83 100644
--- a/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs
@@ -447,7 +447,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayeezyPaymentsResponse, T, PaymentsRes
.unwrap_or(item.response.transaction_id),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
index 9bdb52de4f0..45b693ea00e 100644
--- a/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payu/transformers.rs
@@ -240,7 +240,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayuPaymentsResponse, T, PaymentsRespon
.ext_order_id
.or(Some(item.response.order_id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: None,
..item.data
@@ -287,7 +287,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayuPaymentsCaptureResponse, T, Payment
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: None,
..item.data
@@ -365,7 +365,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayuPaymentsCancelResponse, T, Payments
.ext_order_id
.or(Some(item.response.order_id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: None,
..item.data
@@ -494,7 +494,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PayuPaymentsSyncResponse, T, PaymentsRe
.clone()
.or(Some(order.order_id.clone())),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: Some(
order
diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/placetopay/transformers.rs
index e51093c28d8..63520dd1826 100644
--- a/crates/hyperswitch_connectors/src/connectors/placetopay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/placetopay/transformers.rs
@@ -274,7 +274,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PlacetopayPaymentsResponse, T, Payments
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
index 83f861dfdb3..03eaa27281c 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
@@ -343,7 +343,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PowertranzBaseResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: Some(item.response.order_identifier),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
Err,
);
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
index 53f902ff495..cb93caded2c 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
@@ -213,7 +213,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -411,7 +411,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -459,7 +459,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpaySyncResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -507,7 +507,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ProphetpayVoidResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
index 778fe31978c..2e6041368fc 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
@@ -480,7 +480,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsRespo
.merchant_reference_id
.to_owned(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
index c799cf2594e..af9e67f8dbe 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
@@ -796,7 +796,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, RazorpayPaymentsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(second_factor.txn_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -1015,7 +1015,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, RazorpaySyncResponse, T, PaymentsRespon
network_txn_id: None,
connector_response_reference_id: Some(item.response.second_factor.txn_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
index 78329b5719d..36802517277 100644
--- a/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, RedsysPaymentsResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
index 5c5615aa945..b2fd0ed0b49 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
@@ -769,7 +769,7 @@ impl TryFrom<PaymentsPreprocessingResponseRouterData<Shift4ThreeDsResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -807,7 +807,7 @@ impl<T, F> TryFrom<ResponseRouterData<F, Shift4NonThreeDsResponse, T, PaymentsRe
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
index c284212f0f5..95f9979762a 100644
--- a/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square/transformers.rs
@@ -397,7 +397,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, SquarePaymentsResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: item.response.payment.reference_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured,
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
index 327785d2fc8..07515761e72 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
@@ -388,7 +388,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, StaxPaymentsResponse, T, PaymentsRespon
item.response.idempotency_id.unwrap_or(item.response.id),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs b/crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs
index ca18179ff17..a89617ff17b 100644
--- a/crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/thunes/transformers.rs
@@ -135,7 +135,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ThunesPaymentsResponse, T, PaymentsResp
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
index 27b9daaa579..c2c99c88439 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
@@ -250,7 +250,7 @@ fn get_payments_response(connector_response: TsysResponse) -> PaymentsResponseDa
network_txn_id: None,
connector_response_reference_id: Some(connector_response.transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}
}
@@ -275,7 +275,7 @@ fn get_payments_sync_response(
.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
index a0d349eaa98..86816195276 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
@@ -289,7 +289,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponse, T, PaymentsRespon
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -367,7 +367,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
.merchant_internal_reference
.or(Some(payment_response.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
@@ -408,7 +408,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, VoltPaymentsResponseData, T, PaymentsRe
.merchant_internal_reference
.or(Some(webhook_response.payment)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
index 5eaf54065d7..f046b8de707 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
@@ -1744,7 +1744,7 @@ fn get_payment_response(
.unwrap_or(info_response.id.clone()),
),
incremental_authorization_allowed,
- charge_id: None,
+ charges: None,
})
}
}
@@ -1949,7 +1949,7 @@ impl
incremental_authorization_allowed: Some(
mandate_status == enums::AttemptStatus::Authorized,
),
- charge_id: None,
+ charges: None,
}),
},
connector_response,
@@ -2066,7 +2066,7 @@ impl<F>
.map(|cref| cref.code)
.unwrap_or(Some(item.response.id)),
incremental_authorization_allowed,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2082,7 +2082,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
index 09d8d8aef7e..f9d7da5d1ec 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
@@ -583,7 +583,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, Payment, T, PaymentsResponseData>>
network_txn_id: None,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -634,7 +634,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, PaymentResponse, T, PaymentsResponseDat
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index 104e854e6fe..41b2207b175 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -392,7 +392,7 @@ impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Wo
network_txn_id: None,
connector_response_reference_id: optional_correlation_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
@@ -531,7 +531,7 @@ impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Wor
network_txn_id: None,
connector_response_reference_id: optional_correlation_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
@@ -632,7 +632,7 @@ impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> fo
network_txn_id: None,
connector_response_reference_id: optional_correlation_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
index 47a5d3b2b2b..28cbca418a3 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
@@ -771,7 +771,7 @@ impl<F, T>
network_txn_id: network_txn_id.map(|id| id.expose()),
connector_response_reference_id: optional_correlation_id.clone(),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
(Some(reason), _) => Err(ErrorResponse {
code: worldpay_status.to_string(),
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
index 8ff4b74c076..7a7789e73ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
@@ -320,7 +320,7 @@ impl<F>
item.response.reference_id.peek().to_string(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -378,7 +378,7 @@ impl<F>
item.response.reference_id.peek().to_string(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
@@ -427,7 +427,7 @@ impl TryFrom<PaymentsSyncResponseRouterData<XenditPaymentResponse>> for Payments
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
diff --git a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
index 14e0b5ba972..abe528eff29 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
@@ -950,7 +950,7 @@ fn get_zen_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
@@ -994,7 +994,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, CheckoutResponse, T, PaymentsResponseDa
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..value.data
})
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
index b2ba05b7cde..8a39901e5de 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
@@ -334,7 +334,7 @@ impl<F, T> TryFrom<ResponseRouterData<F, ZslPaymentsResponse, T, PaymentsRespons
network_txn_id: None,
connector_response_reference_id: Some(item.response.mer_ref.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -427,7 +427,7 @@ impl<F> TryFrom<ResponseRouterData<F, ZslWebhookResponse, PaymentsSyncData, Paym
network_txn_id: None,
connector_response_reference_id: Some(item.response.mer_ref.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 65455b3b193..361973daf94 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -378,7 +378,6 @@ pub struct PaymentAttempt {
/// The foreign key reference to the authentication details
pub authentication_id: Option<String>,
pub fingerprint_id: Option<String>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
// TODO: use a type here instead of value
@@ -408,6 +407,8 @@ pub struct PaymentAttempt {
pub connector_token_details: Option<diesel_models::ConnectorTokenDetails>,
/// Indicates the method by which a card is discovered during a payment
pub card_discovery: Option<common_enums::CardDiscovery>,
+ /// Split payment data
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
impl PaymentAttempt {
@@ -510,7 +511,7 @@ impl PaymentAttempt {
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
- charge_id: None,
+ charges: None,
client_source: None,
client_version: None,
customer_acceptance: None,
@@ -603,6 +604,7 @@ pub struct PaymentAttempt {
pub organization_id: id_type::OrganizationId,
pub connector_mandate_detail: Option<ConnectorMandateReferenceId>,
pub card_discovery: Option<common_enums::CardDiscovery>,
+ pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
}
#[cfg(feature = "v1")]
@@ -842,7 +844,6 @@ pub struct PaymentAttemptNew {
pub mandate_data: Option<MandateDetails>,
pub payment_method_billing_address_id: Option<String>,
pub fingerprint_id: Option<String>,
- pub charge_id: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub customer_acceptance: Option<pii::SecretSerdeValue>,
@@ -963,8 +964,8 @@ pub enum PaymentAttemptUpdate {
unified_code: Option<Option<String>>,
unified_message: Option<Option<String>>,
payment_method_data: Option<serde_json::Value>,
- charge_id: Option<String>,
connector_mandate_detail: Option<ConnectorMandateReferenceId>,
+ charges: Option<common_types::payments::ConnectorChargeResponseData>,
},
UnresolvedResponseUpdate {
status: storage_enums::AttemptStatus,
@@ -1019,7 +1020,7 @@ pub enum PaymentAttemptUpdate {
encoded_data: Option<String>,
connector_transaction_id: Option<String>,
connector: Option<String>,
- charge_id: Option<String>,
+ charges: Option<common_types::payments::ConnectorChargeResponseData>,
updated_by: String,
},
IncrementalAuthorizationAmountUpdate {
@@ -1235,8 +1236,8 @@ impl PaymentAttemptUpdate {
unified_code,
unified_message,
payment_method_data,
- charge_id,
connector_mandate_detail,
+ charges,
} => DieselPaymentAttemptUpdate::ResponseUpdate {
status,
connector,
@@ -1257,8 +1258,8 @@ impl PaymentAttemptUpdate {
unified_code,
unified_message,
payment_method_data,
- charge_id,
connector_mandate_detail,
+ charges,
},
Self::UnresolvedResponseUpdate {
status,
@@ -1362,14 +1363,14 @@ impl PaymentAttemptUpdate {
encoded_data,
connector_transaction_id,
connector,
- charge_id,
+ charges,
updated_by,
} => DieselPaymentAttemptUpdate::ConnectorResponse {
authentication_data,
encoded_data,
connector_transaction_id,
+ charges,
connector,
- charge_id,
updated_by,
},
Self::IncrementalAuthorizationAmountUpdate {
@@ -1574,6 +1575,7 @@ impl behaviour::Conversion for PaymentAttempt {
shipping_cost: self.net_amount.get_shipping_cost(),
connector_mandate_detail: self.connector_mandate_detail,
card_discovery: self.card_discovery,
+ charges: self.charges,
})
}
@@ -1656,6 +1658,7 @@ impl behaviour::Conversion for PaymentAttempt {
organization_id: storage_model.organization_id,
connector_mandate_detail: storage_model.connector_mandate_detail,
card_discovery: storage_model.card_discovery,
+ charges: storage_model.charges,
})
}
.await
@@ -1728,7 +1731,6 @@ impl behaviour::Conversion for PaymentAttempt {
mandate_data: self.mandate_data.map(Into::into),
fingerprint_id: self.fingerprint_id,
payment_method_billing_address_id: self.payment_method_billing_address_id,
- charge_id: self.charge_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
@@ -1790,7 +1792,6 @@ impl behaviour::Conversion for PaymentAttempt {
authentication_connector,
authentication_id,
fingerprint_id,
- charge_id,
client_source,
client_version,
customer_acceptance,
@@ -1807,6 +1808,7 @@ impl behaviour::Conversion for PaymentAttempt {
connector,
connector_token_details,
card_discovery,
+ charges,
} = self;
let AttemptAmountDetails {
@@ -1866,7 +1868,6 @@ impl behaviour::Conversion for PaymentAttempt {
authentication_connector,
authentication_id,
fingerprint_id,
- charge_id,
client_source,
client_version,
customer_acceptance,
@@ -1885,6 +1886,7 @@ impl behaviour::Conversion for PaymentAttempt {
connector_payment_data,
connector_token_details,
card_discovery,
+ charges,
})
}
@@ -1984,7 +1986,7 @@ impl behaviour::Conversion for PaymentAttempt {
authentication_connector: storage_model.authentication_connector,
authentication_id: storage_model.authentication_id,
fingerprint_id: storage_model.fingerprint_id,
- charge_id: storage_model.charge_id,
+ charges: storage_model.charges,
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
@@ -2064,7 +2066,6 @@ impl behaviour::Conversion for PaymentAttempt {
authentication_connector: self.authentication_connector,
authentication_id: self.authentication_id,
fingerprint_id: self.fingerprint_id,
- charge_id: self.charge_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
@@ -2082,6 +2083,7 @@ impl behaviour::Conversion for PaymentAttempt {
id: self.id,
connector_token_details: self.connector_token_details,
card_discovery: self.card_discovery,
+ charges: self.charges,
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 1ad7d2dcbdd..0c90b0d0244 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -507,7 +507,7 @@ impl
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
- charge_id,
+ charges,
} => {
let attempt_status = self.get_attempt_status_for_db_update(payment_data);
@@ -726,7 +726,7 @@ impl
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
- charge_id,
+ charges,
} => {
let attempt_status = self.status;
@@ -941,7 +941,7 @@ impl
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
- charge_id,
+ charges,
} => {
let attempt_status = self.get_attempt_status_for_db_update(payment_data);
@@ -1160,7 +1160,7 @@ impl
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
- charge_id,
+ charges,
} => {
let attempt_status = self.get_attempt_status_for_db_update(payment_data);
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index 51e4cd5c8ec..13ab97d60dc 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -647,6 +647,7 @@ pub struct RefundIntegrityObject {
#[derive(Debug, serde::Deserialize, Clone)]
pub enum SplitRefundsRequest {
StripeSplitRefund(StripeSplitRefund),
+ AdyenSplitRefund(common_types::domain::AdyenSplitData),
}
#[derive(Debug, serde::Deserialize, Clone)]
diff --git a/crates/hyperswitch_domain_models/src/router_response_types.rs b/crates/hyperswitch_domain_models/src/router_response_types.rs
index 5578647025b..86589ad6801 100644
--- a/crates/hyperswitch_domain_models/src/router_response_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_response_types.rs
@@ -2,7 +2,7 @@ pub mod disputes;
pub mod fraud_check;
use std::collections::HashMap;
-use common_utils::{request::Method, types as common_types, types::MinorUnit};
+use common_utils::{request::Method, types::MinorUnit};
pub use disputes::{AcceptDisputeResponse, DefendDisputeResponse, SubmitEvidenceResponse};
use crate::{
@@ -26,7 +26,7 @@ pub enum PaymentsResponseData {
network_txn_id: Option<String>,
connector_response_reference_id: Option<String>,
incremental_authorization_allowed: Option<bool>,
- charge_id: Option<String>,
+ charges: Option<common_types::payments::ConnectorChargeResponseData>,
},
MultipleCaptureResponse {
// pending_capture_id_list: Vec<String>,
@@ -164,7 +164,7 @@ impl PaymentsResponseData {
network_txn_id: auth_network_txn_id,
connector_response_reference_id: auth_connector_response_reference_id,
incremental_authorization_allowed: auth_incremental_auth_allowed,
- charge_id: auth_charge_id,
+ charges: auth_charges,
},
Self::TransactionResponse {
resource_id: capture_resource_id,
@@ -174,7 +174,7 @@ impl PaymentsResponseData {
network_txn_id: capture_network_txn_id,
connector_response_reference_id: capture_connector_response_reference_id,
incremental_authorization_allowed: capture_incremental_auth_allowed,
- charge_id: capture_charge_id,
+ charges: capture_charges,
},
) => Ok(Self::TransactionResponse {
resource_id: capture_resource_id.clone(),
@@ -199,7 +199,7 @@ impl PaymentsResponseData {
.or(auth_connector_response_reference_id.clone()),
incremental_authorization_allowed: (*capture_incremental_auth_allowed)
.or(*auth_incremental_auth_allowed),
- charge_id: capture_charge_id.clone().or(auth_charge_id.clone()),
+ charges: auth_charges.clone().or(capture_charges.clone()),
}),
_ => Err(ApiErrorResponse::NotSupported {
message: "Invalid Flow ".to_owned(),
@@ -510,7 +510,7 @@ pub struct MandateRevokeResponseData {
#[derive(Debug, Clone)]
pub enum AuthenticationResponseData {
PreAuthVersionCallResponse {
- maximum_supported_3ds_version: common_types::SemanticVersion,
+ maximum_supported_3ds_version: common_utils::types::SemanticVersion,
},
PreAuthThreeDsMethodCallResponse {
threeds_server_transaction_id: String,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 026eae764c4..4a4e7f5c8e9 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -218,11 +218,13 @@ Never share your secret api keys. Keep them guarded and secure.
common_utils::payout_method_utils::VenmoAdditionalData,
common_types::payments::SplitPaymentsRequest,
common_types::payments::StripeSplitPaymentRequest,
+ common_types::domain::AdyenSplitData,
+ common_types::domain::AdyenSplitItem,
common_utils::types::ChargeRefunds,
common_types::refunds::SplitRefund,
common_types::refunds::StripeSplitRefundRequest,
- api_models::payments::SplitPaymentsResponse,
- api_models::payments::StripeSplitPaymentsResponse,
+ common_types::payments::ConnectorChargeResponseData,
+ common_types::payments::StripeChargeResponseData,
api_models::refunds::RefundRequest,
api_models::refunds::RefundType,
api_models::refunds::RefundResponse,
@@ -269,6 +271,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::customers::CustomerResponse,
api_models::admin::AcceptedCountries,
api_models::admin::AcceptedCurrencies,
+ api_models::enums::AdyenSplitType,
api_models::enums::PaymentType,
api_models::enums::ScaExemptionType,
api_models::enums::PaymentMethod,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index ac88908fbd2..0da00cbfd88 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -159,12 +159,14 @@ Never share your secret api keys. Keep them guarded and secure.
common_utils::payout_method_utils::VenmoAdditionalData,
common_types::payments::SplitPaymentsRequest,
common_types::payments::StripeSplitPaymentRequest,
+ common_types::domain::AdyenSplitData,
+ common_types::domain::AdyenSplitItem,
common_types::refunds::StripeSplitRefundRequest,
common_utils::types::ChargeRefunds,
common_types::payment_methods::PaymentMethodsEnabled,
common_types::refunds::SplitRefund,
- api_models::payments::SplitPaymentsResponse,
- api_models::payments::StripeSplitPaymentsResponse,
+ common_types::payments::ConnectorChargeResponseData,
+ common_types::payments::StripeChargeResponseData,
api_models::refunds::RefundRequest,
api_models::refunds::RefundsCreateRequest,
api_models::refunds::RefundErrorDetails,
@@ -221,6 +223,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::customers::CustomerResponse,
api_models::admin::AcceptedCountries,
api_models::admin::AcceptedCurrencies,
+ api_models::enums::AdyenSplitType,
api_models::enums::ProductType,
api_models::enums::PaymentType,
api_models::enums::ScaExemptionType,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 1daa1fbaffc..69749500dab 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -171,6 +171,19 @@ pub struct AdyenPaymentRequest<'a> {
channel: Option<Channel>,
metadata: Option<pii::SecretSerdeValue>,
merchant_order_reference: Option<String>,
+ splits: Option<Vec<AdyenSplitData>>,
+ store: Option<String>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+struct AdyenSplitData {
+ amount: Option<Amount>,
+ #[serde(rename = "type")]
+ split_type: common_enums::AdyenSplitType,
+ account: Option<String>,
+ reference: String,
+ description: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -365,6 +378,8 @@ pub struct Response {
refusal_reason: Option<String>,
refusal_reason_code: Option<String>,
additional_data: Option<AdditionalData>,
+ splits: Option<Vec<AdyenSplitData>>,
+ store: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -411,6 +426,8 @@ pub struct RedirectionResponse {
refusal_reason_code: Option<String>,
psp_reference: Option<String>,
merchant_reference: Option<String>,
+ store: Option<String>,
+ splits: Option<Vec<AdyenSplitData>>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -422,6 +439,8 @@ pub struct PresentToShopperResponse {
refusal_reason: Option<String>,
refusal_reason_code: Option<String>,
merchant_reference: Option<String>,
+ store: Option<String>,
+ splits: Option<Vec<AdyenSplitData>>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -434,6 +453,8 @@ pub struct QrCodeResponseResponse {
additional_data: Option<QrCodeAdditionalData>,
psp_reference: Option<String>,
merchant_reference: Option<String>,
+ store: Option<String>,
+ splits: Option<Vec<AdyenSplitData>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -1240,13 +1261,15 @@ pub struct DokuBankData {
}
// Refunds Request and Response
#[serde_with::skip_serializing_none]
-#[derive(Default, Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenRefundRequest {
merchant_account: Secret<String>,
amount: Amount,
merchant_refund_reason: Option<String>,
reference: String,
+ splits: Option<Vec<AdyenSplitData>>,
+ store: Option<String>,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
@@ -2754,6 +2777,14 @@ impl
}
} //
}?;
+
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
+
Ok(AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -2781,6 +2812,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -2817,6 +2850,12 @@ impl
let payment_method = AdyenPaymentMethod::try_from((card_data, card_holder_name))?;
let shopper_email = item.router_data.get_optional_billing_email();
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
Ok(AdyenPaymentRequest {
amount,
@@ -2845,6 +2884,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -2874,6 +2915,12 @@ impl
let return_url = item.router_data.request.get_router_return_url()?;
let payment_method = AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?;
let country_code = get_country_code(item.router_data.get_optional_billing());
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
let request = AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -2901,6 +2948,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
};
Ok(request)
}
@@ -2933,6 +2982,12 @@ impl
let billing_address =
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
let shopper_name = get_shopper_name(item.router_data.get_optional_billing());
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
let request = AdyenPaymentRequest {
amount,
@@ -2961,6 +3016,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
};
Ok(request)
}
@@ -2986,6 +3043,12 @@ impl
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let payment_method = AdyenPaymentMethod::try_from((bank_transfer_data, item.router_data))?;
let return_url = item.router_data.request.get_router_return_url()?;
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
let request = AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3013,6 +3076,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
};
Ok(request)
}
@@ -3038,6 +3103,13 @@ impl
let shopper_interaction = AdyenShopperInteraction::from(item.router_data);
let return_url = item.router_data.request.get_router_return_url()?;
let payment_method = AdyenPaymentMethod::try_from(gift_card_data)?;
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
+
let request = AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3065,6 +3137,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
};
Ok(request)
}
@@ -3101,6 +3175,12 @@ impl
let line_items = Some(get_line_items(item));
let billing_address =
get_address_info(item.router_data.get_optional_billing()).and_then(Result::ok);
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
Ok(AdyenPaymentRequest {
amount,
@@ -3129,6 +3209,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -3219,6 +3301,12 @@ impl
} else {
None
};
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
Ok(AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3246,6 +3334,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -3295,6 +3385,13 @@ impl
&billing_address,
&delivery_address,
))?;
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
+
Ok(AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3322,6 +3419,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -3355,6 +3454,13 @@ impl
})?
.number
.to_owned();
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
+
Ok(AdyenPaymentRequest {
amount,
merchant_account: auth_type.merchant_account,
@@ -3382,6 +3488,8 @@ impl
shopper_ip: item.router_data.request.get_ip_address_as_optional(),
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
+ store,
+ splits,
})
}
}
@@ -3397,6 +3505,27 @@ impl TryFrom<&types::PaymentsCancelRouterData> for AdyenCancelRequest {
}
}
+fn get_adyen_split_request(
+ split_request: &common_types::domain::AdyenSplitData,
+ currency: common_enums::enums::Currency,
+) -> (Option<String>, Option<Vec<AdyenSplitData>>) {
+ let splits = split_request
+ .split_items
+ .iter()
+ .map(|split_item| {
+ let amount = split_item.amount.map(|value| Amount { currency, value });
+ AdyenSplitData {
+ amount,
+ reference: split_item.reference.clone(),
+ split_type: split_item.split_type.clone(),
+ account: split_item.account.clone(),
+ description: split_item.description.clone(),
+ }
+ })
+ .collect();
+ (split_request.store.clone(), Some(splits))
+}
+
impl TryFrom<types::PaymentsCancelResponseRouterData<AdyenCancelResponse>>
for types::PaymentsCancelRouterData
{
@@ -3416,7 +3545,7 @@ impl TryFrom<types::PaymentsCancelResponseRouterData<AdyenCancelResponse>>
network_txn_id: None,
connector_response_reference_id: Some(item.response.reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -3451,7 +3580,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
payment_method_balance: Some(types::PaymentMethodBalance {
currency: item.response.balance.currency,
@@ -3513,6 +3642,11 @@ pub fn get_adyen_response(
.map(|network_tx_id| network_tx_id.expose())
});
+ let charges = match &response.splits {
+ Some(split_items) => Some(construct_charge_response(response.store, split_items)),
+ None => None,
+ };
+
let payments_response_data = types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(response.psp_reference),
redirection_data: Box::new(None),
@@ -3521,7 +3655,7 @@ pub fn get_adyen_response(
network_txn_id,
connector_response_reference_id: Some(response.merchant_reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges,
};
Ok((status, error, payments_response_data))
}
@@ -3588,7 +3722,7 @@ pub fn get_webhook_response(
network_txn_id: None,
connector_response_reference_id: Some(response.merchant_reference_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payments_response_data))
}
@@ -3650,6 +3784,11 @@ pub fn get_redirection_response(
let connector_metadata = get_wait_screen_metadata(&response)?;
+ let charges = match &response.splits {
+ Some(split_items) => Some(construct_charge_response(response.store, split_items)),
+ None => None,
+ };
+
let payments_response_data = types::PaymentsResponseData::TransactionResponse {
resource_id: match response.psp_reference.as_ref() {
Some(psp) => types::ResponseId::ConnectorTransactionId(psp.to_string()),
@@ -3664,7 +3803,7 @@ pub fn get_redirection_response(
.clone()
.or(response.psp_reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges,
};
Ok((status, error, payments_response_data))
}
@@ -3709,6 +3848,14 @@ pub fn get_present_to_shopper_response(
None
};
+ let charges = match &response.splits {
+ Some(split_items) => Some(construct_charge_response(
+ response.store.clone(),
+ split_items,
+ )),
+ None => None,
+ };
+
let connector_metadata = get_present_to_shopper_metadata(&response)?;
// We don't get connector transaction id for redirections in Adyen.
let payments_response_data = types::PaymentsResponseData::TransactionResponse {
@@ -3725,7 +3872,7 @@ pub fn get_present_to_shopper_response(
.clone()
.or(response.psp_reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges,
};
Ok((status, error, payments_response_data))
}
@@ -3770,6 +3917,14 @@ pub fn get_qr_code_response(
None
};
+ let charges = match &response.splits {
+ Some(split_items) => Some(construct_charge_response(
+ response.store.clone(),
+ split_items,
+ )),
+ None => None,
+ };
+
let connector_metadata = get_qr_metadata(&response)?;
let payments_response_data = types::PaymentsResponseData::TransactionResponse {
resource_id: match response.psp_reference.as_ref() {
@@ -3785,7 +3940,7 @@ pub fn get_qr_code_response(
.clone()
.or(response.psp_reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges,
};
Ok((status, error, payments_response_data))
}
@@ -3828,7 +3983,7 @@ pub fn get_redirection_error_response(
.clone()
.or(response.psp_reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payments_response_data))
@@ -4168,6 +4323,8 @@ pub struct AdyenCaptureResponse {
status: String,
amount: Amount,
merchant_reference: Option<String>,
+ store: Option<String>,
+ splits: Option<Vec<AdyenSplitData>>,
}
impl TryFrom<types::PaymentsCaptureResponseRouterData<AdyenCaptureResponse>>
@@ -4182,6 +4339,11 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<AdyenCaptureResponse>>
} else {
item.response.payment_psp_reference
};
+ let charges = match &item.response.splits {
+ Some(split_items) => Some(construct_charge_response(item.response.store, split_items)),
+ None => None,
+ };
+
Ok(Self {
// From the docs, the only value returned is "received", outcome of refund is available
// through refund notification webhook
@@ -4195,7 +4357,7 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<AdyenCaptureResponse>>
network_txn_id: None,
connector_response_reference_id: Some(item.response.reference),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges,
}),
amount_captured: Some(0),
..item.data
@@ -4203,6 +4365,29 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<AdyenCaptureResponse>>
}
}
+fn construct_charge_response(
+ store: Option<String>,
+ split_item: &[AdyenSplitData],
+) -> common_types::payments::ConnectorChargeResponseData {
+ let splits: Vec<common_types::domain::AdyenSplitItem> = split_item
+ .iter()
+ .map(|split_item| common_types::domain::AdyenSplitItem {
+ amount: split_item.amount.as_ref().map(|amount| amount.value),
+ reference: split_item.reference.clone(),
+ split_type: split_item.split_type.clone(),
+ account: split_item.account.clone(),
+ description: split_item.description.clone(),
+ })
+ .collect();
+
+ common_types::payments::ConnectorChargeResponseData::AdyenSplitPayment(
+ common_types::domain::AdyenSplitData {
+ store,
+ split_items: splits,
+ },
+ )
+}
+
/*
// This is a repeated code block from Stripe inegration. Can we avoid the repetition in every integration
#[derive(Debug, Serialize, Deserialize)]
@@ -4241,6 +4426,16 @@ impl<F> TryFrom<&AdyenRouterData<&types::RefundsRouterData<F>>> for AdyenRefundR
type Error = Error;
fn try_from(item: &AdyenRouterData<&types::RefundsRouterData<F>>) -> Result<Self, Self::Error> {
let auth_type = AdyenAuthType::try_from(&item.router_data.connector_auth_type)?;
+ let (store, splits) = match item
+ .router_data
+ .request
+ .split_refunds
+ .as_ref()
+ {
+ Some(hyperswitch_domain_models::router_request_types::SplitRefundsRequest::AdyenSplitRefund(adyen_split_data)) => get_adyen_split_request(adyen_split_data, item.router_data.request.currency),
+ _ => (None, None),
+ };
+
Ok(Self {
merchant_account: auth_type.merchant_account,
amount: Amount {
@@ -4249,6 +4444,8 @@ impl<F> TryFrom<&AdyenRouterData<&types::RefundsRouterData<F>>> for AdyenRefundR
},
merchant_refund_reason: item.router_data.request.reason.clone(),
reference: item.router_data.request.refund_id.clone(),
+ store,
+ splits,
})
}
}
@@ -5458,6 +5655,12 @@ impl
.unwrap_or_default(),
eci: Some("02".to_string()),
};
+ let (store, splits) = match item.router_data.request.split_payments.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => get_adyen_split_request(adyen_split_payment, item.router_data.request.currency),
+ _ => (None, None),
+ };
Ok(AdyenPaymentRequest {
amount,
@@ -5486,6 +5689,8 @@ impl
metadata: item.router_data.request.metadata.clone().map(Into::into),
merchant_order_reference: item.router_data.request.merchant_order_reference_id.clone(),
mpi_data: Some(mpi_data),
+ store,
+ splits,
})
}
}
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index 276ea6bf77b..3be29293972 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -444,7 +444,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -1205,7 +1205,7 @@ impl<F, T>
transaction_response.transaction_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
},
..item.data
@@ -1278,7 +1278,7 @@ impl<F, T>
transaction_response.transaction_id.clone(),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
},
..item.data
@@ -1603,7 +1603,7 @@ impl<F, Req>
network_txn_id: None,
connector_response_reference_id: Some(transaction.transaction_id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: payment_status,
..item.data
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 321a8cec765..254c0346e8e 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -708,7 +708,7 @@ impl TryFrom<types::PaymentsResponseRouterData<PaymentsResponse>>
item.response.reference.unwrap_or(item.response.id),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
@@ -761,7 +761,7 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponse>>
item.response.reference.unwrap_or(item.response.id),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok(Self {
status,
@@ -837,7 +837,7 @@ impl TryFrom<types::PaymentsCancelResponseRouterData<PaymentVoidResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status: response.into(),
..item.data
@@ -938,7 +938,7 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<PaymentCaptureResponse>>
network_txn_id: None,
connector_response_reference_id: item.response.reference,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
status,
amount_captured,
diff --git a/crates/router/src/connector/dummyconnector/transformers.rs b/crates/router/src/connector/dummyconnector/transformers.rs
index 79caa3d0a76..9d745ca1978 100644
--- a/crates/router/src/connector/dummyconnector/transformers.rs
+++ b/crates/router/src/connector/dummyconnector/transformers.rs
@@ -259,7 +259,7 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, PaymentsResponse, T, types::Paym
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 19f03cb1b2c..e99549893b6 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -212,7 +212,7 @@ impl
network_txn_id: None,
connector_response_reference_id: Some(item.response.transactionid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
enums::AttemptStatus::AuthenticationPending,
),
@@ -366,7 +366,7 @@ impl
network_txn_id: None,
connector_response_reference_id: Some(item.response.orderid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
if let Some(diesel_models::enums::CaptureMethod::Automatic) =
item.data.request.capture_method
@@ -751,7 +751,7 @@ impl
network_txn_id: None,
connector_response_reference_id: Some(item.response.orderid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
enums::AttemptStatus::CaptureInitiated,
),
@@ -846,7 +846,7 @@ impl<T>
network_txn_id: None,
connector_response_reference_id: Some(item.response.orderid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
enums::AttemptStatus::Charged,
),
@@ -903,7 +903,7 @@ impl TryFrom<types::PaymentsResponseRouterData<StandardResponse>>
network_txn_id: None,
connector_response_reference_id: Some(item.response.orderid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
if let Some(diesel_models::enums::CaptureMethod::Automatic) =
item.data.request.capture_method
@@ -954,7 +954,7 @@ impl<T>
network_txn_id: None,
connector_response_reference_id: Some(item.response.orderid),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
enums::AttemptStatus::VoidInitiated,
),
@@ -1005,7 +1005,7 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, SyncResponse, T, types::Payments
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index 5816aaa9295..eaf4ae18465 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -605,7 +605,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
},
diff --git a/crates/router/src/connector/opayo/transformers.rs b/crates/router/src/connector/opayo/transformers.rs
index f55aa4325b0..992acfb5ef0 100644
--- a/crates/router/src/connector/opayo/transformers.rs
+++ b/crates/router/src/connector/opayo/transformers.rs
@@ -151,7 +151,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/router/src/connector/opennode/transformers.rs b/crates/router/src/connector/opennode/transformers.rs
index 44315ac42fa..067237bc3e2 100644
--- a/crates/router/src/connector/opennode/transformers.rs
+++ b/crates/router/src/connector/opennode/transformers.rs
@@ -144,7 +144,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: item.response.data.order_id,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
} else {
Ok(types::PaymentsResponseData::TransactionUnresolvedResponse {
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index c13730529e2..ec9991b4815 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -259,7 +259,7 @@ impl TryFrom<&PaymePaySaleResponse> for types::PaymentsResponseData {
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
}
}
@@ -326,7 +326,7 @@ impl From<&SaleQuery> for types::PaymentsResponseData {
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}
}
}
@@ -547,7 +547,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
}),
@@ -1128,7 +1128,7 @@ impl TryFrom<types::PaymentsCancelResponseRouterData<PaymeVoidResponse>>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
Ok(Self {
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index fb635708c23..c7aef2ddb23 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -1227,7 +1227,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
@@ -1278,7 +1278,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..data.clone()
})
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index 884e67714ff..5989706bf5b 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -622,7 +622,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: Some(info_response.id.clone()),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1859,7 +1859,7 @@ impl<F, T>
.clone()
.or(Some(item.response.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -1984,7 +1984,7 @@ impl<F, T>
purchase_units.map_or(item.response.id, |item| item.invoice_id.clone()),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2039,7 +2039,7 @@ impl
purchase_units.map_or(item.response.id, |item| item.invoice_id.clone()),
),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2092,7 +2092,7 @@ impl
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2130,7 +2130,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2183,7 +2183,7 @@ impl<F>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2252,7 +2252,7 @@ impl<F, T>
.clone()
.or(Some(item.response.supplementary_data.related_ids.order_id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
@@ -2593,7 +2593,7 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<PaypalCaptureResponse>>
.invoice_id
.or(Some(item.response.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
amount_captured: Some(amount_captured),
..item.data
@@ -2645,7 +2645,7 @@ impl<F, T>
.invoice_id
.or(Some(item.response.id)),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/router/src/connector/plaid/transformers.rs b/crates/router/src/connector/plaid/transformers.rs
index 29d4db1297f..4e4fb1863ee 100644
--- a/crates/router/src/connector/plaid/transformers.rs
+++ b/crates/router/src/connector/plaid/transformers.rs
@@ -314,7 +314,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
@@ -400,7 +400,7 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, PlaidSyncResponse, T, types::Pay
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment_id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
},
..item.data
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 6d377171121..66e20e54616 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -766,18 +766,15 @@ impl
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
- if let Some(split_payments) = &req.request.split_payments {
- match split_payments {
- common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_split_payment,
- ) => {
- transformers::transform_headers_for_connect_platform(
- stripe_split_payment.charge_type.clone(),
- stripe_split_payment.transfer_account_id.clone(),
- &mut header,
- );
- }
- }
+ if let Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
+ stripe_split_payment,
+ )) = &req.request.split_payments
+ {
+ transformers::transform_headers_for_connect_platform(
+ stripe_split_payment.charge_type.clone(),
+ stripe_split_payment.transfer_account_id.clone(),
+ &mut header,
+ );
}
Ok(header)
}
@@ -943,26 +940,21 @@ impl
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
- if let Some(split_payments) = &req.request.split_payments {
- match split_payments {
- common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_split_payment,
- ) => {
- if stripe_split_payment.charge_type
- == api::enums::PaymentChargeType::Stripe(
- api::enums::StripeChargeType::Direct,
- )
- {
- let mut customer_account_header = vec![(
- headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(),
- stripe_split_payment
- .transfer_account_id
- .clone()
- .into_masked(),
- )];
- header.append(&mut customer_account_header);
- }
- }
+ if let Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
+ stripe_split_payment,
+ )) = &req.request.split_payments
+ {
+ if stripe_split_payment.charge_type
+ == api::enums::PaymentChargeType::Stripe(api::enums::StripeChargeType::Direct)
+ {
+ let mut customer_account_header = vec![(
+ headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(),
+ stripe_split_payment
+ .transfer_account_id
+ .clone()
+ .into_masked(),
+ )];
+ header.append(&mut customer_account_header);
}
}
Ok(header)
@@ -1484,22 +1476,20 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
- if let Some(split_refunds) = req.request.split_refunds.as_ref() {
- match split_refunds {
- SplitRefundsRequest::StripeSplitRefund(ref stripe_split_refund) => {
- match &stripe_split_refund.charge_type {
- api::enums::PaymentChargeType::Stripe(stripe_charge) => {
- if stripe_charge == &api::enums::StripeChargeType::Direct {
- let mut customer_account_header = vec![(
- headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(),
- stripe_split_refund
- .transfer_account_id
- .clone()
- .into_masked(),
- )];
- header.append(&mut customer_account_header);
- }
- }
+ if let Some(SplitRefundsRequest::StripeSplitRefund(ref stripe_split_refund)) =
+ req.request.split_refunds.as_ref()
+ {
+ match &stripe_split_refund.charge_type {
+ api::enums::PaymentChargeType::Stripe(stripe_charge) => {
+ if stripe_charge == &api::enums::StripeChargeType::Direct {
+ let mut customer_account_header = vec![(
+ headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(),
+ stripe_split_refund
+ .transfer_account_id
+ .clone()
+ .into_masked(),
+ )];
+ header.append(&mut customer_account_header);
}
}
}
@@ -1530,15 +1520,15 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
req.request.currency,
)?;
let request_body = match req.request.split_refunds.as_ref() {
- None => RequestContent::FormUrlEncoded(Box::new(stripe::RefundRequest::try_from((
- req,
- refund_amount,
- ))?)),
- Some(split_refunds) => match split_refunds {
- SplitRefundsRequest::StripeSplitRefund(_) => RequestContent::FormUrlEncoded(
- Box::new(stripe::ChargeRefundRequest::try_from(req)?),
- ),
- },
+ Some(SplitRefundsRequest::AdyenSplitRefund(_)) | None => {
+ RequestContent::FormUrlEncoded(Box::new(stripe::RefundRequest::try_from((
+ req,
+ refund_amount,
+ ))?))
+ }
+ Some(SplitRefundsRequest::StripeSplitRefund(_)) => RequestContent::FormUrlEncoded(
+ Box::new(stripe::ChargeRefundRequest::try_from(req)?),
+ ),
};
Ok(request_body)
}
@@ -1653,16 +1643,14 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
- if let Some(split_refunds) = req.request.split_refunds.as_ref() {
- match split_refunds {
- SplitRefundsRequest::StripeSplitRefund(ref stripe_refund) => {
- transformers::transform_headers_for_connect_platform(
- stripe_refund.charge_type.clone(),
- stripe_refund.transfer_account_id.clone(),
- &mut header,
- );
- }
- }
+ if let Some(SplitRefundsRequest::StripeSplitRefund(ref stripe_refund)) =
+ req.request.split_refunds.as_ref()
+ {
+ transformers::transform_headers_for_connect_platform(
+ stripe_refund.charge_type.clone(),
+ stripe_refund.transfer_account_id.clone(),
+ &mut header,
+ );
}
Ok(header)
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index a93ba6ecaa5..7611f375c09 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1973,7 +1973,9 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
};
(charges, None)
}
- None => (None, item.connector_customer.to_owned().map(Secret::new)),
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(_)) | None => {
+ (None, item.connector_customer.to_owned().map(Secret::new))
+ }
};
Ok(Self {
@@ -2473,6 +2475,8 @@ fn extract_payment_method_connector_response_from_latest_attempt(
impl<F, T>
TryFrom<types::ResponseRouterData<F, PaymentIntentResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
+where
+ T: connector_util::SplitPaymentData,
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -2526,14 +2530,16 @@ impl<F, T>
item.response.id.clone(),
))
} else {
- let charge_id = item
+ let charges = item
.response
.latest_charge
.as_ref()
.map(|charge| match charge {
- StripeChargeEnum::ChargeId(charge_id) => charge_id.clone(),
+ StripeChargeEnum::ChargeId(charges) => charges.clone(),
StripeChargeEnum::ChargeObject(charge) => charge.id.clone(),
- });
+ })
+ .and_then(|charge_id| construct_charge_response(charge_id, &item.data.request));
+
Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: Box::new(redirection_data),
@@ -2542,7 +2548,7 @@ impl<F, T>
network_txn_id,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id,
+ charges,
})
};
@@ -2631,6 +2637,8 @@ pub fn get_connector_metadata(
impl<F, T>
TryFrom<types::ResponseRouterData<F, PaymentIntentSyncResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
+where
+ T: connector_util::SplitPaymentData,
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
@@ -2735,14 +2743,16 @@ impl<F, T>
}),
_ => None,
};
- let charge_id = item
+ let charges = item
.response
.latest_charge
.as_ref()
.map(|charge| match charge {
- StripeChargeEnum::ChargeId(charge_id) => charge_id.clone(),
+ StripeChargeEnum::ChargeId(charges) => charges.clone(),
StripeChargeEnum::ChargeObject(charge) => charge.id.clone(),
- });
+ })
+ .and_then(|charge_id| construct_charge_response(charge_id, &item.data.request));
+
Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: Box::new(redirection_data),
@@ -2751,7 +2761,7 @@ impl<F, T>
network_txn_id: network_transaction_id,
connector_response_reference_id: Some(item.response.id.clone()),
incremental_authorization_allowed: None,
- charge_id,
+ charges,
})
};
@@ -2831,7 +2841,7 @@ impl<F, T>
network_txn_id: network_transaction_id,
connector_response_reference_id: Some(item.response.id),
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
})
};
@@ -3082,6 +3092,11 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for ChargeRefundRequest {
},
})
}
+ types::SplitRefundsRequest::AdyenSplitRefund(_) => {
+ Err(errors::ConnectorError::MissingRequiredField {
+ field_name: "stripe_split_refund",
+ })?
+ }
},
}
}
@@ -3543,7 +3558,7 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, ChargesResponse, T, types::Payme
network_txn_id: None,
connector_response_reference_id: Some(item.response.id.clone()),
incremental_authorization_allowed: None,
- charge_id: Some(item.response.id),
+ charges: None,
})
};
@@ -4172,6 +4187,34 @@ pub(super) fn transform_headers_for_connect_platform(
}
}
+pub fn construct_charge_response<T>(
+ charge_id: String,
+ request: &T,
+) -> Option<common_types::payments::ConnectorChargeResponseData>
+where
+ T: connector_util::SplitPaymentData,
+{
+ let charge_request = request.get_split_payment_data();
+ if let Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
+ stripe_split_payment,
+ )) = charge_request
+ {
+ let stripe_charge_response = common_types::payments::StripeChargeResponseData {
+ charge_id: Some(charge_id),
+ charge_type: stripe_split_payment.charge_type,
+ application_fees: stripe_split_payment.application_fees,
+ transfer_account_id: stripe_split_payment.transfer_account_id,
+ };
+ Some(
+ common_types::payments::ConnectorChargeResponseData::StripeSplitPayment(
+ stripe_charge_response,
+ ),
+ )
+ } else {
+ None
+ }
+}
+
#[cfg(test)]
mod test_validate_shipping_address_against_payment_method {
#![allow(clippy::unwrap_used)]
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index 31c992a7f5a..78641d7e33b 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -738,7 +738,7 @@ fn handle_cards_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
@@ -768,7 +768,7 @@ fn handle_bank_redirects_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
@@ -802,7 +802,7 @@ fn handle_bank_redirects_error_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
@@ -863,7 +863,7 @@ fn handle_bank_redirects_sync_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
@@ -911,7 +911,7 @@ pub fn handle_webhook_response(
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
};
Ok((status, error, payment_response_data))
}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index eff68176f8c..28f5d016e5a 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -753,6 +753,40 @@ impl PaymentsCaptureRequestData for types::PaymentsCaptureData {
}
}
+pub trait SplitPaymentData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest>;
+}
+
+impl SplitPaymentData for types::PaymentsCaptureData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> {
+ None
+ }
+}
+
+impl SplitPaymentData for types::PaymentsAuthorizeData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> {
+ self.split_payments.clone()
+ }
+}
+
+impl SplitPaymentData for types::PaymentsSyncData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> {
+ self.split_payments.clone()
+ }
+}
+
+impl SplitPaymentData for PaymentsCancelData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> {
+ None
+ }
+}
+
+impl SplitPaymentData for types::SetupMandateRequestData {
+ fn get_split_payment_data(&self) -> Option<common_types::payments::SplitPaymentsRequest> {
+ None
+ }
+}
+
pub trait RevokeMandateRequestData {
fn get_connector_mandate_id(&self) -> Result<String, Error>;
}
diff --git a/crates/router/src/connector/wellsfargopayout/transformers.rs b/crates/router/src/connector/wellsfargopayout/transformers.rs
index 135cb5f53cb..3a194550dfd 100644
--- a/crates/router/src/connector/wellsfargopayout/transformers.rs
+++ b/crates/router/src/connector/wellsfargopayout/transformers.rs
@@ -140,7 +140,7 @@ impl<F, T>
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
}),
..item.data
})
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index db12a6282c3..cfa57a35654 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4285,7 +4285,6 @@ impl AttemptType {
// New payment method billing address can be passed for a retry
payment_method_billing_address_id: None,
fingerprint_id: None,
- charge_id: None,
client_source: old_payment_attempt.client_source,
client_version: old_payment_attempt.client_version,
customer_acceptance: old_payment_attempt.customer_acceptance,
@@ -6882,15 +6881,14 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details(
Ok(())
}
-pub fn validate_platform_fees_for_marketplace(
+pub fn validate_platform_request_for_marketplace(
amount: api::Amount,
split_payments: Option<common_types::payments::SplitPaymentsRequest>,
) -> Result<(), errors::ApiErrorResponse> {
- if let Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_split_payment,
- )) = split_payments
- {
- match amount {
+ match split_payments {
+ Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
+ stripe_split_payment,
+ )) => match amount {
api::Amount::Zero => {
if stripe_split_payment.application_fees.get_amount_as_i64() != 0 {
return Err(errors::ApiErrorResponse::InvalidDataValue {
@@ -6905,7 +6903,90 @@ pub fn validate_platform_fees_for_marketplace(
});
}
}
+ },
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(
+ adyen_split_payment,
+ )) => {
+ let total_split_amount: i64 = adyen_split_payment
+ .split_items
+ .iter()
+ .map(|split_item| {
+ split_item
+ .amount
+ .unwrap_or(MinorUnit::new(0))
+ .get_amount_as_i64()
+ })
+ .sum();
+
+ match amount {
+ api::Amount::Zero => {
+ if total_split_amount != 0 {
+ return Err(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "Sum of split amounts should be equal to the total amount",
+ });
+ }
+ }
+ api::Amount::Value(amount) => {
+ let i64_amount: i64 = amount.into();
+ if !adyen_split_payment.split_items.is_empty()
+ && i64_amount != total_split_amount
+ {
+ return Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Sum of split amounts should be equal to the total amount"
+ .to_string(),
+ });
+ }
+ }
+ };
+ adyen_split_payment
+ .split_items
+ .iter()
+ .try_for_each(|split_item| {
+ match split_item.split_type {
+ common_enums::AdyenSplitType::BalanceAccount => {
+ if split_item.account.is_none() {
+ return Err(errors::ApiErrorResponse::MissingRequiredField {
+ field_name:
+ "split_payments.adyen_split_payment.split_items.account",
+ });
+ }
+ }
+ common_enums::AdyenSplitType::Commission
+ | enums::AdyenSplitType::Vat
+ | enums::AdyenSplitType::TopUp => {
+ if split_item.amount.is_none() {
+ return Err(errors::ApiErrorResponse::MissingRequiredField {
+ field_name:
+ "split_payments.adyen_split_payment.split_items.amount",
+ });
+ }
+ if let enums::AdyenSplitType::TopUp = split_item.split_type {
+ if split_item.account.is_none() {
+ return Err(errors::ApiErrorResponse::MissingRequiredField {
+ field_name:
+ "split_payments.adyen_split_payment.split_items.account",
+ });
+ }
+ if adyen_split_payment.store.is_some() {
+ return Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "Topup split payment is not available via Adyen Platform"
+ .to_string(),
+ });
+ }
+ }
+ }
+ enums::AdyenSplitType::AcquiringFees
+ | enums::AdyenSplitType::PaymentFee
+ | enums::AdyenSplitType::AdyenFees
+ | enums::AdyenSplitType::AdyenCommission
+ | enums::AdyenSplitType::AdyenMarkup
+ | enums::AdyenSplitType::Interchange
+ | enums::AdyenSplitType::SchemeFee => {}
+ };
+ Ok(())
+ })?;
}
+ None => (),
}
Ok(())
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index dd72bfff307..1fd9f2404ff 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1038,7 +1038,7 @@ impl<F: Send + Clone + Sync> ValidateRequest<F, api::PaymentsRequest, PaymentDat
if request.split_payments.is_some() {
let amount = request.amount.get_required_value("amount")?;
- helpers::validate_platform_fees_for_marketplace(
+ helpers::validate_platform_request_for_marketplace(
amount,
request.split_payments.clone(),
)?;
@@ -1293,7 +1293,6 @@ impl PaymentCreate {
fingerprint_id: None,
authentication_connector: None,
authentication_id: None,
- charge_id: None,
client_source: None,
client_version: None,
customer_acceptance: customer_acceptance
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 516cebe24d7..4616be81a5f 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -1534,7 +1534,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
connector_metadata,
connector_response_reference_id,
incremental_authorization_allowed,
- charge_id,
+ charges,
..
} => {
payment_data
@@ -1720,11 +1720,11 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
authentication_data,
encoded_data,
payment_method_data: additional_payment_method_data,
- charge_id,
connector_mandate_detail: payment_data
.payment_attempt
.connector_mandate_detail
.clone(),
+ charges,
}),
),
};
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 0401575bc66..1a0a7ad9e5d 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -420,7 +420,7 @@ where
resource_id,
connector_metadata,
redirection_data,
- charge_id,
+ charges,
..
}) => {
let encoded_data = payment_data.get_payment_attempt().encoded_data.clone();
@@ -465,8 +465,8 @@ where
unified_code: None,
unified_message: None,
payment_method_data: additional_payment_method_data,
- charge_id,
connector_mandate_detail: None,
+ charges,
};
#[cfg(feature = "v1")]
@@ -651,7 +651,6 @@ pub fn make_new_payment_attempt(
mandate_data: Default::default(),
payment_method_billing_address_id: Default::default(),
fingerprint_id: Default::default(),
- charge_id: Default::default(),
customer_acceptance: Default::default(),
connector_mandate_detail: Default::default(),
card_discovery: old_payment_attempt.card_discovery,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 1e9adb0a06b..e2967e4ba59 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1082,7 +1082,7 @@ where
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
- charge_id: None,
+ charges: None,
});
let additional_data = PaymentAdditionalData {
@@ -2300,24 +2300,6 @@ where
)
});
- let split_payments_response = match payment_intent.split_payments {
- None => None,
- Some(split_payments) => match split_payments {
- common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_split_payment,
- ) => Some(
- api_models::payments::SplitPaymentsResponse::StripeSplitPayment(
- api_models::payments::StripeSplitPaymentsResponse {
- charge_id: payment_attempt.charge_id.clone(),
- charge_type: stripe_split_payment.charge_type,
- application_fees: stripe_split_payment.application_fees,
- transfer_account_id: stripe_split_payment.transfer_account_id,
- },
- ),
- ),
- },
- };
-
let mandate_data = payment_data.get_setup_mandate().map(|d| api::MandateData {
customer_acceptance: d
.customer_acceptance
@@ -2496,7 +2478,7 @@ where
.get_payment_method_info()
.map(|info| info.status),
updated: Some(payment_intent.modified_at),
- split_payments: split_payments_response,
+ split_payments: payment_attempt.charges,
frm_metadata: payment_intent.frm_metadata,
merchant_order_reference_id: payment_intent.merchant_order_reference_id,
order_tax_amount,
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index a6505f23631..4d8cc195693 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -13,8 +13,7 @@ use common_utils::{
use diesel_models::process_tracker::business_status;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
- router_data::ErrorResponse,
- router_request_types::{SplitRefundsRequest, StripeSplitRefund},
+ router_data::ErrorResponse, router_request_types::SplitRefundsRequest,
};
use hyperswitch_interfaces::integrity::{CheckIntegrity, FlowIntegrity, GetIntegrityObject};
use router_env::{instrument, tracing};
@@ -514,18 +513,12 @@ pub async fn refund_retrieve_core(
.await
.transpose()?;
- let split_refunds_req: Option<SplitRefundsRequest> = payment_intent
- .split_payments
- .clone()
- .zip(refund.split_refunds.clone())
- .map(|(split_payments, split_refunds)| {
- SplitRefundsRequest::try_from(SplitRefundInput {
- refund_request: split_refunds,
- payment_charges: split_payments,
- charge_id: payment_attempt.charge_id.clone(),
- })
- })
- .transpose()?;
+ let split_refunds_req = core_utils::get_split_refunds(SplitRefundInput {
+ split_payment_request: payment_intent.split_payments.clone(),
+ payment_charges: payment_attempt.charges.clone(),
+ charge_id: payment_attempt.charge_id.clone(),
+ refund_request: refund.split_refunds.clone(),
+ })?;
let unified_translated_message = if let (Some(unified_code), Some(unified_message)) =
(refund.unified_code.clone(), refund.unified_message.clone())
@@ -814,32 +807,12 @@ pub async fn validate_and_create_refund(
creds_identifier: Option<String>,
) -> RouterResult<refunds::RefundResponse> {
let db = &*state.store;
-
- let split_refunds = match payment_intent.split_payments.as_ref() {
- Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(stripe_payment)) => {
- if let Some(charge_id) = payment_attempt.charge_id.clone() {
- let refund_request = req
- .split_refunds
- .clone()
- .get_required_value("split_refunds")?;
-
- let options = validator::validate_charge_refund(
- &refund_request,
- &stripe_payment.charge_type,
- )?;
-
- Some(SplitRefundsRequest::StripeSplitRefund(StripeSplitRefund {
- charge_id,
- charge_type: stripe_payment.charge_type.clone(),
- transfer_account_id: stripe_payment.transfer_account_id.clone(),
- options,
- }))
- } else {
- None
- }
- }
- _ => None,
- };
+ let split_refunds = core_utils::get_split_refunds(SplitRefundInput {
+ split_payment_request: payment_intent.split_payments.clone(),
+ payment_charges: payment_attempt.charges.clone(),
+ charge_id: payment_attempt.charge_id.clone(),
+ refund_request: req.split_refunds.clone(),
+ })?;
// Only for initial dev and testing
let refund_type = req.refund_type.unwrap_or_default();
@@ -1554,36 +1527,12 @@ pub async fn trigger_refund_execute_workflow(
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
-
- let split_refunds = match payment_intent.split_payments.as_ref() {
- Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_payment,
- )) => {
- let refund_request = refund
- .split_refunds
- .clone()
- .get_required_value("split_refunds")?;
-
- let options = validator::validate_charge_refund(
- &refund_request,
- &stripe_payment.charge_type,
- )?;
-
- let charge_id = payment_attempt.charge_id.clone().ok_or_else(|| {
- report!(errors::ApiErrorResponse::InternalServerError).attach_printable(
- "Transaction is invalid. Missing field \"charge_id\" in payment_attempt.",
- )
- })?;
-
- Some(SplitRefundsRequest::StripeSplitRefund(StripeSplitRefund {
- charge_id,
- charge_type: stripe_payment.charge_type.clone(),
- transfer_account_id: stripe_payment.transfer_account_id.clone(),
- options,
- }))
- }
- _ => None,
- };
+ let split_refunds = core_utils::get_split_refunds(SplitRefundInput {
+ split_payment_request: payment_intent.split_payments.clone(),
+ payment_charges: payment_attempt.charges.clone(),
+ charge_id: payment_attempt.charge_id.clone(),
+ refund_request: refund.split_refunds.clone(),
+ })?;
//trigger refund request to gateway
let updated_refund = Box::pin(trigger_refund_to_gateway(
diff --git a/crates/router/src/core/refunds/transformers.rs b/crates/router/src/core/refunds/transformers.rs
index 256e4c34522..151c6d20234 100644
--- a/crates/router/src/core/refunds/transformers.rs
+++ b/crates/router/src/core/refunds/transformers.rs
@@ -1,54 +1,6 @@
-use error_stack::{report, Report};
-use hyperswitch_domain_models::router_request_types;
-
-use super::validator;
-use crate::core::errors;
-
pub struct SplitRefundInput {
- pub refund_request: common_types::refunds::SplitRefund,
- pub payment_charges: common_types::payments::SplitPaymentsRequest,
+ pub refund_request: Option<common_types::refunds::SplitRefund>,
+ pub payment_charges: Option<common_types::payments::ConnectorChargeResponseData>,
+ pub split_payment_request: Option<common_types::payments::SplitPaymentsRequest>,
pub charge_id: Option<String>,
}
-
-impl TryFrom<SplitRefundInput> for router_request_types::SplitRefundsRequest {
- type Error = Report<errors::ApiErrorResponse>;
-
- fn try_from(value: SplitRefundInput) -> Result<Self, Self::Error> {
- let SplitRefundInput {
- refund_request,
- payment_charges,
- charge_id,
- } = value;
-
- match refund_request {
- common_types::refunds::SplitRefund::StripeSplitRefund(stripe_refund) => {
- match payment_charges {
- common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
- stripe_payment,
- ) => {
- let charge_id = charge_id.ok_or_else(|| {
- report!(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Missing `charge_id` in PaymentAttempt.")
- })?;
-
- let options = validator::validate_charge_refund(
- &common_types::refunds::SplitRefund::StripeSplitRefund(
- stripe_refund.clone(),
- ),
- &stripe_payment.charge_type,
- )?;
-
- Ok(Self::StripeSplitRefund(
- router_request_types::StripeSplitRefund {
- charge_id, // Use `charge_id` from `PaymentAttempt`
- transfer_account_id: stripe_payment.transfer_account_id,
- charge_type: stripe_payment.charge_type,
- options,
- },
- ))
- }
- }
- }
- }
- }
-}
diff --git a/crates/router/src/core/refunds/validator.rs b/crates/router/src/core/refunds/validator.rs
index 2387f9a3b5f..90c4a7c4434 100644
--- a/crates/router/src/core/refunds/validator.rs
+++ b/crates/router/src/core/refunds/validator.rs
@@ -146,35 +146,109 @@ pub fn validate_for_valid_refunds(
}
}
-pub fn validate_charge_refund(
- charges: &common_types::refunds::SplitRefund,
- charge_type: &api_enums::PaymentChargeType,
+pub fn validate_stripe_charge_refund(
+ charge_type_option: Option<api_enums::PaymentChargeType>,
+ split_refund_request: &Option<common_types::refunds::SplitRefund>,
) -> RouterResult<types::ChargeRefundsOptions> {
- match charge_type {
- api_enums::PaymentChargeType::Stripe(api_enums::StripeChargeType::Direct) => {
- let common_types::refunds::SplitRefund::StripeSplitRefund(stripe_charge) = charges;
+ let charge_type = charge_type_option.ok_or_else(|| {
+ report!(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Missing `charge_type` in PaymentAttempt.")
+ })?;
+
+ let refund_request = match split_refund_request {
+ Some(common_types::refunds::SplitRefund::StripeSplitRefund(stripe_split_refund)) => {
+ stripe_split_refund
+ }
+ _ => Err(errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "stripe_split_refund",
+ })?,
+ };
- Ok(types::ChargeRefundsOptions::Direct(
- types::DirectChargeRefund {
- revert_platform_fee: stripe_charge
- .revert_platform_fee
- .get_required_value("revert_platform_fee")?,
- },
- ))
+ let options = match charge_type {
+ api_enums::PaymentChargeType::Stripe(api_enums::StripeChargeType::Direct) => {
+ types::ChargeRefundsOptions::Direct(types::DirectChargeRefund {
+ revert_platform_fee: refund_request
+ .revert_platform_fee
+ .get_required_value("revert_platform_fee")?,
+ })
}
api_enums::PaymentChargeType::Stripe(api_enums::StripeChargeType::Destination) => {
- let common_types::refunds::SplitRefund::StripeSplitRefund(stripe_charge) = charges;
-
- Ok(types::ChargeRefundsOptions::Destination(
- types::DestinationChargeRefund {
- revert_platform_fee: stripe_charge
- .revert_platform_fee
- .get_required_value("revert_platform_fee")?,
- revert_transfer: stripe_charge
- .revert_transfer
- .get_required_value("revert_transfer")?,
- },
- ))
+ types::ChargeRefundsOptions::Destination(types::DestinationChargeRefund {
+ revert_platform_fee: refund_request
+ .revert_platform_fee
+ .get_required_value("revert_platform_fee")?,
+ revert_transfer: refund_request
+ .revert_transfer
+ .get_required_value("revert_transfer")?,
+ })
+ }
+ };
+
+ Ok(options)
+}
+
+pub fn validate_adyen_charge_refund(
+ adyen_split_payment_response: &common_types::domain::AdyenSplitData,
+ adyen_split_refund_request: &common_types::domain::AdyenSplitData,
+) -> RouterResult<()> {
+ if adyen_split_refund_request.store != adyen_split_payment_response.store {
+ return Err(report!(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "split_payments.adyen_split_payment.store",
+ }));
+ };
+
+ for refund_split_item in adyen_split_refund_request.split_items.iter() {
+ let refund_split_reference = refund_split_item.reference.clone();
+ let matching_payment_split_item = adyen_split_payment_response
+ .split_items
+ .iter()
+ .find(|payment_split_item| refund_split_reference == payment_split_item.reference);
+
+ if let Some(payment_split_item) = matching_payment_split_item {
+ if let Some((refund_amount, payment_amount)) =
+ refund_split_item.amount.zip(payment_split_item.amount)
+ {
+ if refund_amount > payment_amount {
+ return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
+ message: format!(
+ "Invalid refund amount for split item, reference: {}",
+ refund_split_reference
+ ),
+ }));
+ }
+ }
+
+ if let Some((refund_account, payment_account)) = refund_split_item
+ .account
+ .as_ref()
+ .zip(payment_split_item.account.as_ref())
+ {
+ if !refund_account.eq(payment_account) {
+ return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
+ message: format!(
+ "Invalid refund account for split item, reference: {}",
+ refund_split_reference
+ ),
+ }));
+ }
+ }
+
+ if refund_split_item.split_type != payment_split_item.split_type {
+ return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
+ message: format!(
+ "Invalid refund split_type for split item, reference: {}",
+ refund_split_reference
+ ),
+ }));
+ }
+ } else {
+ return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
+ message: format!(
+ "No matching payment split item found for reference: {}",
+ refund_split_reference
+ ),
+ }));
}
}
+ Ok(())
}
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 71cc3dceebb..cd2a9ed220b 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -461,6 +461,86 @@ pub fn validate_uuid(uuid: String, key: &str) -> Result<String, errors::ApiError
}
}
+#[cfg(feature = "v1")]
+pub fn get_split_refunds(
+ split_refund_input: super::refunds::transformers::SplitRefundInput,
+) -> RouterResult<Option<router_request_types::SplitRefundsRequest>> {
+ match split_refund_input.split_payment_request.as_ref() {
+ Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(stripe_payment)) => {
+ let (charge_id_option, charge_type_option) = match (
+ &split_refund_input.payment_charges,
+ &split_refund_input.split_payment_request,
+ ) {
+ (
+ Some(common_types::payments::ConnectorChargeResponseData::StripeSplitPayment(
+ stripe_split_payment_response,
+ )),
+ _,
+ ) => (
+ stripe_split_payment_response.charge_id.clone(),
+ Some(stripe_split_payment_response.charge_type.clone()),
+ ),
+ (
+ _,
+ Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(
+ stripe_split_payment_request,
+ )),
+ ) => (
+ split_refund_input.charge_id,
+ Some(stripe_split_payment_request.charge_type.clone()),
+ ),
+ (_, _) => (None, None),
+ };
+
+ if let Some(charge_id) = charge_id_option {
+ let options = super::refunds::validator::validate_stripe_charge_refund(
+ charge_type_option,
+ &split_refund_input.refund_request,
+ )?;
+
+ Ok(Some(
+ router_request_types::SplitRefundsRequest::StripeSplitRefund(
+ router_request_types::StripeSplitRefund {
+ charge_id,
+ charge_type: stripe_payment.charge_type.clone(),
+ transfer_account_id: stripe_payment.transfer_account_id.clone(),
+ options,
+ },
+ ),
+ ))
+ } else {
+ Ok(None)
+ }
+ }
+ Some(common_types::payments::SplitPaymentsRequest::AdyenSplitPayment(_)) => {
+ match &split_refund_input.payment_charges {
+ Some(common_types::payments::ConnectorChargeResponseData::AdyenSplitPayment(
+ adyen_split_payment_response,
+ )) => {
+ if let Some(common_types::refunds::SplitRefund::AdyenSplitRefund(
+ split_refund_request,
+ )) = split_refund_input.refund_request.clone()
+ {
+ super::refunds::validator::validate_adyen_charge_refund(
+ adyen_split_payment_response,
+ &split_refund_request,
+ )?;
+
+ Ok(Some(
+ router_request_types::SplitRefundsRequest::AdyenSplitRefund(
+ split_refund_request,
+ ),
+ ))
+ } else {
+ Ok(None)
+ }
+ }
+ _ => Ok(None),
+ }
+ }
+ _ => Ok(None),
+ }
+}
#[cfg(test)]
mod tests {
#![allow(clippy::expect_used)]
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 5958435abc7..1773d7f3a17 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -210,7 +210,6 @@ mod tests {
mandate_data: Default::default(),
payment_method_billing_address_id: Default::default(),
fingerprint_id: Default::default(),
- charge_id: Default::default(),
client_source: Default::default(),
client_version: Default::default(),
customer_acceptance: Default::default(),
@@ -295,7 +294,6 @@ mod tests {
mandate_data: Default::default(),
payment_method_billing_address_id: Default::default(),
fingerprint_id: Default::default(),
- charge_id: Default::default(),
client_source: Default::default(),
client_version: Default::default(),
customer_acceptance: Default::default(),
@@ -393,7 +391,6 @@ mod tests {
mandate_data: Default::default(),
payment_method_billing_address_id: Default::default(),
fingerprint_id: Default::default(),
- charge_id: Default::default(),
client_source: Default::default(),
client_version: Default::default(),
customer_acceptance: Default::default(),
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index fd84f5767de..427cba5eb97 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -1134,7 +1134,7 @@ pub fn get_connector_metadata(
network_txn_id: _,
connector_response_reference_id: _,
incremental_authorization_allowed: _,
- charge_id: _,
+ charges: _,
}) => connector_metadata,
_ => None,
}
diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs
index 3a45cfad9a2..db210dbdbe5 100644
--- a/crates/storage_impl/src/mock_db/payment_attempt.rs
+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs
@@ -164,6 +164,7 @@ impl PaymentAttemptInterface for MockDb {
payment_token: None,
error_code: payment_attempt.error_code,
connector_metadata: None,
+ charge_id: None,
payment_experience: payment_attempt.payment_experience,
payment_method_type: payment_attempt.payment_method_type,
payment_method_data: payment_attempt.payment_method_data,
@@ -188,7 +189,6 @@ impl PaymentAttemptInterface for MockDb {
mandate_data: payment_attempt.mandate_data,
payment_method_billing_address_id: payment_attempt.payment_method_billing_address_id,
fingerprint_id: payment_attempt.fingerprint_id,
- charge_id: payment_attempt.charge_id,
client_source: payment_attempt.client_source,
client_version: payment_attempt.client_version,
customer_acceptance: payment_attempt.customer_acceptance,
@@ -196,6 +196,7 @@ impl PaymentAttemptInterface for MockDb {
profile_id: payment_attempt.profile_id,
connector_mandate_detail: payment_attempt.connector_mandate_detail,
card_discovery: payment_attempt.card_discovery,
+ charges: None,
};
payment_attempts.push(payment_attempt.clone());
Ok(payment_attempt)
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index 3480f8f4ba4..8a8e8d4e4a8 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -541,6 +541,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
error_reason: payment_attempt.error_reason.clone(),
multiple_capture_count: payment_attempt.multiple_capture_count,
connector_response_reference_id: None,
+ charge_id: None,
amount_capturable: payment_attempt.amount_capturable,
updated_by: storage_scheme.to_string(),
authentication_data: payment_attempt.authentication_data.clone(),
@@ -557,7 +558,6 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
.payment_method_billing_address_id
.clone(),
fingerprint_id: payment_attempt.fingerprint_id.clone(),
- charge_id: payment_attempt.charge_id.clone(),
client_source: payment_attempt.client_source.clone(),
client_version: payment_attempt.client_version.clone(),
customer_acceptance: payment_attempt.customer_acceptance.clone(),
@@ -565,6 +565,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {
profile_id: payment_attempt.profile_id.clone(),
connector_mandate_detail: payment_attempt.connector_mandate_detail.clone(),
card_discovery: payment_attempt.card_discovery,
+ charges: None,
};
let field = format!("pa_{}", created_attempt.attempt_id);
@@ -1513,6 +1514,7 @@ impl DataModelExt for PaymentAttempt {
order_tax_amount: self.net_amount.get_order_tax_amount(),
connector_mandate_detail: self.connector_mandate_detail,
card_discovery: self.card_discovery,
+ charges: self.charges,
}
}
@@ -1590,6 +1592,7 @@ impl DataModelExt for PaymentAttempt {
profile_id: storage_model.profile_id,
connector_mandate_detail: storage_model.connector_mandate_detail,
card_discovery: storage_model.card_discovery,
+ charges: storage_model.charges,
}
}
}
@@ -1664,7 +1667,6 @@ impl DataModelExt for PaymentAttemptNew {
mandate_data: self.mandate_data.map(|d| d.to_storage_model()),
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
- charge_id: self.charge_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
@@ -1739,7 +1741,6 @@ impl DataModelExt for PaymentAttemptNew {
.map(MandateDetails::from_storage_model),
payment_method_billing_address_id: storage_model.payment_method_billing_address_id,
fingerprint_id: storage_model.fingerprint_id,
- charge_id: storage_model.charge_id,
client_source: storage_model.client_source,
client_version: storage_model.client_version,
customer_acceptance: storage_model.customer_acceptance,
diff --git a/migrations/2025-01-14-832737_add_charges_to_payment_attempt/down.sql b/migrations/2025-01-14-832737_add_charges_to_payment_attempt/down.sql
new file mode 100644
index 00000000000..cdd8328c8ee
--- /dev/null
+++ b/migrations/2025-01-14-832737_add_charges_to_payment_attempt/down.sql
@@ -0,0 +1,2 @@
+ALTER TABLE payment_attempt
+DROP COLUMN charges;
\ No newline at end of file
diff --git a/migrations/2025-01-14-832737_add_charges_to_payment_attempt/up.sql b/migrations/2025-01-14-832737_add_charges_to_payment_attempt/up.sql
new file mode 100644
index 00000000000..10fa978f9dc
--- /dev/null
+++ b/migrations/2025-01-14-832737_add_charges_to_payment_attempt/up.sql
@@ -0,0 +1,3 @@
+ALTER TABLE payment_attempt
+ADD COLUMN charges JSONB
+DEFAULT NULL;
\ No newline at end of file
diff --git a/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql b/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql
index 2dcd3a16a6c..f67b9b2e7ac 100644
--- a/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql
+++ b/v2_migrations/2024-11-08-081847_drop_v1_columns/down.sql
@@ -89,7 +89,8 @@ ADD COLUMN IF NOT EXISTS attempt_id VARCHAR(64) NOT NULL,
ADD COLUMN confirm BOOLEAN,
ADD COLUMN authentication_data JSONB,
ADD COLUMN payment_method_billing_address_id VARCHAR(64),
- ADD COLUMN connector_mandate_detail JSONB;
+ ADD COLUMN connector_mandate_detail JSONB,
+ ADD COLUMN charge_id VARCHAR(64);
-- Create the index which was dropped because of dropping the column
CREATE INDEX payment_attempt_connector_transaction_id_merchant_id_index ON payment_attempt (connector_transaction_id, merchant_id);
diff --git a/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql b/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql
index 65eb29c474f..e19f8631f62 100644
--- a/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql
+++ b/v2_migrations/2024-11-08-081847_drop_v1_columns/up.sql
@@ -87,4 +87,5 @@ ALTER TABLE payment_attempt DROP COLUMN attempt_id,
DROP COLUMN confirm,
DROP COLUMN authentication_data,
DROP COLUMN payment_method_billing_address_id,
- DROP COLUMN connector_mandate_detail;
+ DROP COLUMN connector_mandate_detail,
+ DROP COLUMN charge_id;
|
feat
|
add adyen split payments support (#6952)
|
e40a29351c7aa7b86a5684959a84f0236104cafd
|
2023-11-03 12:31:06
|
Prasunna Soppa
|
fix(router): make customer_id optional when billing and shipping address is passed in payments create, update (#2762)
| false
|
diff --git a/crates/diesel_models/src/address.rs b/crates/diesel_models/src/address.rs
index e67f37c9046..03dedfd60d8 100644
--- a/crates/diesel_models/src/address.rs
+++ b/crates/diesel_models/src/address.rs
@@ -19,7 +19,7 @@ pub struct AddressNew {
pub last_name: Option<Encryption>,
pub phone_number: Option<Encryption>,
pub country_code: Option<String>,
- pub customer_id: String,
+ pub customer_id: Option<String>,
pub merchant_id: String,
pub payment_id: Option<String>,
pub created_at: PrimitiveDateTime,
@@ -45,7 +45,7 @@ pub struct Address {
pub country_code: Option<String>,
pub created_at: PrimitiveDateTime,
pub modified_at: PrimitiveDateTime,
- pub customer_id: String,
+ pub customer_id: Option<String>,
pub merchant_id: String,
pub payment_id: Option<String>,
pub updated_by: String,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 02abfb842b8..e214fa364dd 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -24,7 +24,7 @@ diesel::table! {
created_at -> Timestamp,
modified_at -> Timestamp,
#[max_length = 64]
- customer_id -> Varchar,
+ customer_id -> Nullable<Varchar>,
#[max_length = 64]
merchant_id -> Varchar,
#[max_length = 64]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index af67d30ec6c..f42e4985380 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -221,8 +221,6 @@ pub async fn create_or_update_address_for_payment_by_request(
None => match req_address {
Some(address) => {
// generate a new address here
- let customer_id = customer_id.get_required_value("customer_id")?;
-
let address_details = address.address.clone().unwrap_or_default();
Some(
db.insert_address_for_payments(
@@ -282,7 +280,6 @@ pub async fn create_or_find_address_for_payment_by_request(
None => match req_address {
Some(address) => {
// generate a new address here
- let customer_id = customer_id.get_required_value("customer_id")?;
let address_details = address.address.clone().unwrap_or_default();
Some(
@@ -317,7 +314,7 @@ pub async fn get_domain_address_for_payments(
address_details: api_models::payments::AddressDetails,
address: &api_models::payments::Address,
merchant_id: &str,
- customer_id: &str,
+ customer_id: Option<&String>,
payment_id: &str,
key: &[u8],
storage_scheme: enums::MerchantStorageScheme,
@@ -332,7 +329,7 @@ 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.to_string(),
+ customer_id: customer_id.cloned(),
merchant_id: merchant_id.to_string(),
address_id: generate_id(consts::ID_LENGTH, "add"),
city: address_details.city,
@@ -763,25 +760,14 @@ fn validate_new_mandate_request(
}
pub fn validate_customer_id_mandatory_cases(
- has_shipping: bool,
- has_billing: bool,
has_setup_future_usage: bool,
customer_id: &Option<String>,
) -> RouterResult<()> {
- match (
- has_shipping,
- has_billing,
- has_setup_future_usage,
- customer_id,
- ) {
- (true, _, _, None) | (_, true, _, None) | (_, _, true, None) => {
- Err(errors::ApiErrorResponse::PreconditionFailed {
- message: "customer_id is mandatory when shipping or billing \
- address is given or when setup_future_usage is given"
- .to_string(),
- })
- .into_report()
- }
+ match (has_setup_future_usage, customer_id) {
+ (true, None) => Err(errors::ApiErrorResponse::PreconditionFailed {
+ message: "customer_id is mandatory when setup_future_usage is given".to_string(),
+ })
+ .into_report(),
_ => Ok(()),
}
}
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index a1d50a9049a..16bb84f69dd 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -130,8 +130,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
amount = payment_attempt.amount.into();
helpers::validate_customer_id_mandatory_cases(
- request.shipping.is_some(),
- request.billing.is_some(),
request.setup_future_usage.is_some(),
&payment_intent
.customer_id
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 0e357f08734..a2f5292a37f 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -139,8 +139,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
amount = payment_attempt.amount.into();
helpers::validate_customer_id_mandatory_cases(
- request.shipping.is_some(),
- request.billing.is_some(),
request.setup_future_usage.is_some(),
&payment_intent
.customer_id
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 9e1f12b6bca..8842963990b 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -284,8 +284,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
amount = payment_attempt.amount.into();
helpers::validate_customer_id_mandatory_cases(
- request.shipping.is_some(),
- request.billing.is_some(),
request.setup_future_usage.is_some(),
&payment_intent
.customer_id
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 2d31f82aeb0..f3b777534bf 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -538,8 +538,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve> ValidateRequest<F, api::Paymen
)?;
helpers::validate_customer_id_mandatory_cases(
- request.shipping.is_some(),
- request.billing.is_some(),
request.setup_future_usage.is_some(),
&request
.customer
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index a77ede0e6f6..d0b17b5d460 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -146,8 +146,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
if request.confirm.unwrap_or(false) {
helpers::validate_customer_id_mandatory_cases(
- request.shipping.is_some(),
- request.billing.is_some(),
request.setup_future_usage.is_some(),
&payment_intent
.customer_id
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 20f7bdb9120..9244fc022d9 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -763,7 +763,8 @@ impl AddressInterface for MockDb {
.await
.iter_mut()
.find(|address| {
- address.customer_id == customer_id && address.merchant_id == merchant_id
+ address.customer_id == Some(customer_id.to_string())
+ && address.merchant_id == merchant_id
})
.map(|a| {
let address_updated =
diff --git a/crates/router/src/types/domain/address.rs b/crates/router/src/types/domain/address.rs
index 008cead1ebe..ddf9c2152e9 100644
--- a/crates/router/src/types/domain/address.rs
+++ b/crates/router/src/types/domain/address.rs
@@ -35,7 +35,7 @@ pub struct Address {
#[serde(skip_serializing)]
#[serde(with = "custom_serde::iso8601")]
pub modified_at: PrimitiveDateTime,
- pub customer_id: String,
+ pub customer_id: Option<String>,
pub merchant_id: String,
pub payment_id: Option<String>,
pub updated_by: String,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index 84a75d397e3..386bd02ae94 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -566,7 +566,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
.async_lift(|inner| encrypt_optional(inner, key))
.await?,
country_code: self.phone_country_code.clone(),
- customer_id: customer_id.to_string(),
+ customer_id: Some(customer_id.to_string()),
merchant_id: merchant_id.to_string(),
address_id: generate_id(consts::ID_LENGTH, "add"),
payment_id: None,
diff --git a/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/down.sql b/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/down.sql
new file mode 100644
index 00000000000..b148e66d875
--- /dev/null
+++ b/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE address ALTER COLUMN customer_id SET NOT NULL;
\ No newline at end of file
diff --git a/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/up.sql b/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/up.sql
new file mode 100644
index 00000000000..98826c41e79
--- /dev/null
+++ b/migrations/2023-11-02-074243_make_customer_id_nullable_in_address_table/up.sql
@@ -0,0 +1,2 @@
+-- Your SQL goes here
+ALTER TABLE address ALTER COLUMN customer_id DROP NOT NULL;
\ No newline at end of file
|
fix
|
make customer_id optional when billing and shipping address is passed in payments create, update (#2762)
|
7473182b309c344d486aa5e363f49b71ca17e05a
|
2025-03-06 21:49:44
|
Sandeep Kumar
|
feat(analytics): add new filters, dimensions and metrics for authentication analytics (#7451)
| false
|
diff --git a/crates/analytics/src/auth_events.rs b/crates/analytics/src/auth_events.rs
index e708c3c8830..3aa23d0793d 100644
--- a/crates/analytics/src/auth_events.rs
+++ b/crates/analytics/src/auth_events.rs
@@ -1,6 +1,8 @@
pub mod accumulator;
mod core;
+pub mod filters;
pub mod metrics;
+pub mod types;
pub use accumulator::{AuthEventMetricAccumulator, AuthEventMetricsAccumulator};
-pub use self::core::get_metrics;
+pub use self::core::{get_filters, get_metrics};
diff --git a/crates/analytics/src/auth_events/accumulator.rs b/crates/analytics/src/auth_events/accumulator.rs
index 446ac6ac8c2..13818d2bd43 100644
--- a/crates/analytics/src/auth_events/accumulator.rs
+++ b/crates/analytics/src/auth_events/accumulator.rs
@@ -6,12 +6,14 @@ use super::metrics::AuthEventMetricRow;
pub struct AuthEventMetricsAccumulator {
pub authentication_count: CountAccumulator,
pub authentication_attempt_count: CountAccumulator,
+ pub authentication_error_message: AuthenticationErrorMessageAccumulator,
pub authentication_success_count: CountAccumulator,
pub challenge_flow_count: CountAccumulator,
pub challenge_attempt_count: CountAccumulator,
pub challenge_success_count: CountAccumulator,
pub frictionless_flow_count: CountAccumulator,
pub frictionless_success_count: CountAccumulator,
+ pub authentication_funnel: CountAccumulator,
}
#[derive(Debug, Default)]
@@ -20,6 +22,11 @@ pub struct CountAccumulator {
pub count: Option<i64>,
}
+#[derive(Debug, Default)]
+pub struct AuthenticationErrorMessageAccumulator {
+ pub count: Option<i64>,
+}
+
pub trait AuthEventMetricAccumulator {
type MetricOutput;
@@ -44,6 +51,22 @@ impl AuthEventMetricAccumulator for CountAccumulator {
}
}
+impl AuthEventMetricAccumulator for AuthenticationErrorMessageAccumulator {
+ type MetricOutput = Option<u64>;
+ #[inline]
+ fn add_metrics_bucket(&mut self, metrics: &AuthEventMetricRow) {
+ self.count = match (self.count, metrics.count) {
+ (None, None) => None,
+ (None, i @ Some(_)) | (i @ Some(_), None) => i,
+ (Some(a), Some(b)) => Some(a + b),
+ }
+ }
+ #[inline]
+ fn collect(self) -> Self::MetricOutput {
+ self.count.and_then(|i| u64::try_from(i).ok())
+ }
+}
+
impl AuthEventMetricsAccumulator {
pub fn collect(self) -> AuthEventMetricsBucketValue {
AuthEventMetricsBucketValue {
@@ -55,6 +78,8 @@ impl AuthEventMetricsAccumulator {
challenge_success_count: self.challenge_success_count.collect(),
frictionless_flow_count: self.frictionless_flow_count.collect(),
frictionless_success_count: self.frictionless_success_count.collect(),
+ error_message_count: self.authentication_error_message.collect(),
+ authentication_funnel: self.authentication_funnel.collect(),
}
}
}
diff --git a/crates/analytics/src/auth_events/core.rs b/crates/analytics/src/auth_events/core.rs
index 75bdf4de149..a2640be6ead 100644
--- a/crates/analytics/src/auth_events/core.rs
+++ b/crates/analytics/src/auth_events/core.rs
@@ -1,13 +1,20 @@
use std::collections::HashMap;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier, MetricsBucketResponse},
- AnalyticsMetadata, GetAuthEventMetricRequest, MetricsResponse,
+ auth_events::{
+ AuthEventDimensions, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ MetricsBucketResponse,
+ },
+ AuthEventFilterValue, AuthEventFiltersResponse, AuthEventMetricsResponse,
+ AuthEventsAnalyticsMetadata, GetAuthEventFilterRequest, GetAuthEventMetricRequest,
};
-use error_stack::ResultExt;
+use error_stack::{report, ResultExt};
use router_env::{instrument, tracing};
-use super::AuthEventMetricsAccumulator;
+use super::{
+ filters::{get_auth_events_filter_for_dimension, AuthEventFilterRow},
+ AuthEventMetricsAccumulator,
+};
use crate::{
auth_events::AuthEventMetricAccumulator,
errors::{AnalyticsError, AnalyticsResult},
@@ -19,7 +26,7 @@ pub async fn get_metrics(
pool: &AnalyticsProvider,
merchant_id: &common_utils::id_type::MerchantId,
req: GetAuthEventMetricRequest,
-) -> AnalyticsResult<MetricsResponse<MetricsBucketResponse>> {
+) -> AnalyticsResult<AuthEventMetricsResponse<MetricsBucketResponse>> {
let mut metrics_accumulator: HashMap<
AuthEventMetricsBucketIdentifier,
AuthEventMetricsAccumulator,
@@ -34,7 +41,9 @@ pub async fn get_metrics(
let data = pool
.get_auth_event_metrics(
&metric_type,
+ &req.group_by_names.clone(),
&merchant_id_scoped,
+ &req.filters,
req.time_series.map(|t| t.granularity),
&req.time_range,
)
@@ -77,22 +86,94 @@ pub async fn get_metrics(
AuthEventMetrics::FrictionlessSuccessCount => metrics_builder
.frictionless_success_count
.add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationErrorMessage => metrics_builder
+ .authentication_error_message
+ .add_metrics_bucket(&value),
+ AuthEventMetrics::AuthenticationFunnel => metrics_builder
+ .authentication_funnel
+ .add_metrics_bucket(&value),
}
}
}
+ let mut total_error_message_count = 0;
let query_data: Vec<MetricsBucketResponse> = metrics_accumulator
.into_iter()
- .map(|(id, val)| MetricsBucketResponse {
- values: val.collect(),
- dimensions: id,
+ .map(|(id, val)| {
+ let collected_values = val.collect();
+ if let Some(count) = collected_values.error_message_count {
+ total_error_message_count += count;
+ }
+ MetricsBucketResponse {
+ values: collected_values,
+ dimensions: id,
+ }
})
.collect();
-
- Ok(MetricsResponse {
+ Ok(AuthEventMetricsResponse {
query_data,
- meta_data: [AnalyticsMetadata {
- current_time_range: req.time_range,
+ meta_data: [AuthEventsAnalyticsMetadata {
+ total_error_message_count: Some(total_error_message_count),
}],
})
}
+
+pub async fn get_filters(
+ pool: &AnalyticsProvider,
+ req: GetAuthEventFilterRequest,
+ merchant_id: &common_utils::id_type::MerchantId,
+) -> AnalyticsResult<AuthEventFiltersResponse> {
+ let mut res = AuthEventFiltersResponse::default();
+ for dim in req.group_by_names {
+ let values = match pool {
+ AnalyticsProvider::Sqlx(_pool) => {
+ Err(report!(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::Clickhouse(pool) => {
+ get_auth_events_filter_for_dimension(dim, merchant_id, &req.time_range, pool)
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError))
+ }
+ AnalyticsProvider::CombinedCkh(sqlx_pool, ckh_pool) | AnalyticsProvider::CombinedSqlx(sqlx_pool, ckh_pool) => {
+ let ckh_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ ckh_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ let sqlx_result = get_auth_events_filter_for_dimension(
+ dim,
+ merchant_id,
+ &req.time_range,
+ sqlx_pool,
+ )
+ .await
+ .map_err(|e| e.change_context(AnalyticsError::UnknownError));
+ match (&sqlx_result, &ckh_result) {
+ (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => {
+ router_env::logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres refunds analytics filters")
+ },
+ _ => {}
+ };
+ ckh_result
+ }
+ }
+ .change_context(AnalyticsError::UnknownError)?
+ .into_iter()
+ .filter_map(|fil: AuthEventFilterRow| match dim {
+ AuthEventDimensions::AuthenticationStatus => fil.authentication_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::TransactionStatus => fil.trans_status.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::ErrorMessage => fil.error_message,
+ AuthEventDimensions::AuthenticationConnector => fil.authentication_connector.map(|i| i.as_ref().to_string()),
+ AuthEventDimensions::MessageVersion => fil.message_version,
+ })
+ .collect::<Vec<String>>();
+ res.query_data.push(AuthEventFilterValue {
+ dimension: dim,
+ values,
+ })
+ }
+ Ok(res)
+}
diff --git a/crates/analytics/src/auth_events/filters.rs b/crates/analytics/src/auth_events/filters.rs
new file mode 100644
index 00000000000..da8e0b7cfa3
--- /dev/null
+++ b/crates/analytics/src/auth_events/filters.rs
@@ -0,0 +1,60 @@
+use api_models::analytics::{auth_events::AuthEventDimensions, Granularity, TimeRange};
+use common_utils::errors::ReportSwitchExt;
+use diesel_models::enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use crate::{
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ types::{
+ AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, FiltersError, FiltersResult,
+ LoadRow,
+ },
+};
+
+pub trait AuthEventFilterAnalytics: LoadRow<AuthEventFilterRow> {}
+
+pub async fn get_auth_events_filter_for_dimension<T>(
+ dimension: AuthEventDimensions,
+ merchant_id: &common_utils::id_type::MerchantId,
+ time_range: &TimeRange,
+ pool: &T,
+) -> FiltersResult<Vec<AuthEventFilterRow>>
+where
+ T: AnalyticsDataSource + AuthEventFilterAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+
+ query_builder.add_select_column(dimension).switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder.set_distinct();
+
+ query_builder
+ .execute_query::<AuthEventFilterRow, _>(pool)
+ .await
+ .change_context(FiltersError::QueryBuildingError)?
+ .change_context(FiltersError::QueryExecutionFailure)
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq, serde::Deserialize)]
+pub struct AuthEventFilterRow {
+ pub authentication_status: Option<DBEnumWrapper<AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+}
diff --git a/crates/analytics/src/auth_events/metrics.rs b/crates/analytics/src/auth_events/metrics.rs
index f3f0354818c..fd94aac614c 100644
--- a/crates/analytics/src/auth_events/metrics.rs
+++ b/crates/analytics/src/auth_events/metrics.rs
@@ -1,18 +1,23 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
Granularity, TimeRange,
};
+use diesel_models::enums as storage_enums;
use time::PrimitiveDateTime;
use crate::{
query::{Aggregate, GroupByClause, ToSql, Window},
- types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult},
+ types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
};
mod authentication_attempt_count;
mod authentication_count;
+mod authentication_error_message;
+mod authentication_funnel;
mod authentication_success_count;
mod challenge_attempt_count;
mod challenge_flow_count;
@@ -22,6 +27,8 @@ mod frictionless_success_count;
use authentication_attempt_count::AuthenticationAttemptCount;
use authentication_count::AuthenticationCount;
+use authentication_error_message::AuthenticationErrorMessage;
+use authentication_funnel::AuthenticationFunnel;
use authentication_success_count::AuthenticationSuccessCount;
use challenge_attempt_count::ChallengeAttemptCount;
use challenge_flow_count::ChallengeFlowCount;
@@ -32,7 +39,15 @@ use frictionless_success_count::FrictionlessSuccessCount;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct AuthEventMetricRow {
pub count: Option<i64>,
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<DBEnumWrapper<storage_enums::AuthenticationStatus>>,
+ pub trans_status: Option<DBEnumWrapper<storage_enums::TransactionStatus>>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<DBEnumWrapper<storage_enums::AuthenticationConnectors>>,
+ pub message_version: Option<String>,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
+ pub start_bucket: Option<PrimitiveDateTime>,
+ #[serde(with = "common_utils::custom_serde::iso8601::option")]
+ pub end_bucket: Option<PrimitiveDateTime>,
}
pub trait AuthEventMetricAnalytics: LoadRow<AuthEventMetricRow> {}
@@ -45,6 +60,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -64,6 +81,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -71,42 +90,122 @@ where
match self {
Self::AuthenticationCount => {
AuthenticationCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationAttemptCount => {
AuthenticationAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::AuthenticationSuccessCount => {
AuthenticationSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeFlowCount => {
ChallengeFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeAttemptCount => {
ChallengeAttemptCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::ChallengeSuccessCount => {
ChallengeSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessFlowCount => {
FrictionlessFlowCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::FrictionlessSuccessCount => {
FrictionlessSuccessCount
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationErrorMessage => {
+ AuthenticationErrorMessage
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
+ .await
+ }
+ Self::AuthenticationFunnel => {
+ AuthenticationFunnel
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
index 2d34344905e..32c76385409 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,6 +31,8 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
@@ -37,6 +40,10 @@ where
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +72,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", AuthenticationStatus::Pending)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +100,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_count.rs b/crates/analytics/src/auth_events/metrics/authentication_count.rs
index 9f2311f5638..39df41f53aa 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -60,12 +65,19 @@ where
query_builder
.add_filter_clause("merchant_id", merchant_id)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -81,7 +93,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/authentication_error_message.rs b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
new file mode 100644
index 00000000000..cdb89b796dd
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_error_message.rs
@@ -0,0 +1,138 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_enums::AuthenticationStatus;
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationErrorMessage;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationErrorMessage
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+ query_builder
+ .add_select_column(Aggregate::Count {
+ field: None,
+ alias: Some("count"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("authentication_status", AuthenticationStatus::Failed)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::ErrorMessage,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_funnel.rs b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
new file mode 100644
index 00000000000..37f9dfd1c1f
--- /dev/null
+++ b/crates/analytics/src/auth_events/metrics/authentication_funnel.rs
@@ -0,0 +1,133 @@
+use std::collections::HashSet;
+
+use api_models::analytics::{
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
+};
+use common_utils::errors::ReportSwitchExt;
+use error_stack::ResultExt;
+use time::PrimitiveDateTime;
+
+use super::AuthEventMetricRow;
+use crate::{
+ query::{
+ Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
+ Window,
+ },
+ types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
+};
+
+#[derive(Default)]
+pub(super) struct AuthenticationFunnel;
+
+#[async_trait::async_trait]
+impl<T> super::AuthEventMetric<T> for AuthenticationFunnel
+where
+ T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
+ PrimitiveDateTime: ToSql<T>,
+ AnalyticsCollection: ToSql<T>,
+ Granularity: GroupByClause<T>,
+ Aggregate<&'static str>: ToSql<T>,
+ Window<&'static str>: ToSql<T>,
+{
+ async fn load_metrics(
+ &self,
+ merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
+ granularity: Option<Granularity>,
+ time_range: &TimeRange,
+ pool: &T,
+ ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
+ let mut query_builder: QueryBuilder<T> =
+ QueryBuilder::new(AnalyticsCollection::Authentications);
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
+ query_builder
+ .add_select_column(Aggregate::Count {
+ field: None,
+ alias: Some("count"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_select_column(Aggregate::Min {
+ field: "created_at",
+ alias: Some("start_bucket"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_select_column(Aggregate::Max {
+ field: "created_at",
+ alias: Some("end_bucket"),
+ })
+ .switch()?;
+
+ query_builder
+ .add_filter_clause("merchant_id", merchant_id)
+ .switch()?;
+
+ query_builder
+ .add_custom_filter_clause(
+ AuthEventDimensions::TransactionStatus,
+ "NULL",
+ FilterTypes::IsNotNull,
+ )
+ .switch()?;
+ filters.set_filter_clause(&mut query_builder).switch()?;
+ time_range
+ .set_filter_clause(&mut query_builder)
+ .attach_printable("Error filtering time range")
+ .switch()?;
+
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
+ if let Some(granularity) = granularity {
+ granularity
+ .set_group_by_clause(&mut query_builder)
+ .attach_printable("Error adding granularity")
+ .switch()?;
+ }
+
+ query_builder
+ .execute_query::<AuthEventMetricRow, _>(pool)
+ .await
+ .change_context(MetricsError::QueryBuildingError)?
+ .change_context(MetricsError::QueryExecutionFailure)?
+ .into_iter()
+ .map(|i| {
+ Ok((
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
+ i,
+ ))
+ })
+ .collect::<error_stack::Result<
+ HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
+ crate::query::PostProcessingError,
+ >>()
+ .change_context(MetricsError::PostProcessingFailure)
+ }
+}
diff --git a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
index e887807f41c..039ef00dd6e 100644
--- a/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/authentication_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -65,12 +70,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -86,7 +98,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
index f1f6a397994..beccc093b19 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -68,12 +73,19 @@ where
query_builder
.add_negative_filter_clause("authentication_status", "pending")
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -89,7 +101,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
index c08618cc0d0..4d07cffba94 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,18 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +96,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
index 3fb75efd562..310a45f0530 100644
--- a/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/challenge_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("trans_status", "C".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
index 8859c60fc37..24857bfb840 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_flow_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
@@ -9,7 +10,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -29,13 +30,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -64,12 +69,19 @@ where
query_builder
.add_filter_clause("trans_status", "Y".to_string())
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -85,7 +97,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
index 3d5d894e7dd..79fef8a16d0 100644
--- a/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
+++ b/crates/analytics/src/auth_events/metrics/frictionless_success_count.rs
@@ -1,7 +1,8 @@
use std::collections::HashSet;
use api_models::analytics::{
- auth_events::AuthEventMetricsBucketIdentifier, Granularity, TimeRange,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
+ Granularity, TimeRange,
};
use common_enums::AuthenticationStatus;
use common_utils::errors::ReportSwitchExt;
@@ -10,7 +11,7 @@ use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
- query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window},
+ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
@@ -30,13 +31,17 @@ where
async fn load_metrics(
&self,
merchant_id: &common_utils::id_type::MerchantId,
+ dimensions: &[AuthEventDimensions],
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
-
+ for dim in dimensions.iter() {
+ query_builder.add_select_column(dim).switch()?;
+ }
query_builder
.add_select_column(Aggregate::Count {
field: None,
@@ -69,12 +74,19 @@ where
query_builder
.add_filter_clause("authentication_status", AuthenticationStatus::Success)
.switch()?;
-
+ filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
+ for dim in dimensions.iter() {
+ query_builder
+ .add_group_by_clause(dim)
+ .attach_printable("Error grouping by dimensions")
+ .switch()?;
+ }
+
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
@@ -90,7 +102,23 @@ where
.into_iter()
.map(|i| {
Ok((
- AuthEventMetricsBucketIdentifier::new(i.time_bucket.clone()),
+ AuthEventMetricsBucketIdentifier::new(
+ i.authentication_status.as_ref().map(|i| i.0),
+ i.trans_status.as_ref().map(|i| i.0.clone()),
+ i.error_message.clone(),
+ i.authentication_connector.as_ref().map(|i| i.0),
+ i.message_version.clone(),
+ TimeRange {
+ start_time: match (granularity, i.start_bucket) {
+ (Some(g), Some(st)) => g.clip_to_start(st)?,
+ _ => time_range.start_time,
+ },
+ end_time: granularity.as_ref().map_or_else(
+ || Ok(time_range.end_time),
+ |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
+ )?,
+ },
+ ),
i,
))
})
diff --git a/crates/analytics/src/auth_events/types.rs b/crates/analytics/src/auth_events/types.rs
new file mode 100644
index 00000000000..ac7ee2462ee
--- /dev/null
+++ b/crates/analytics/src/auth_events/types.rs
@@ -0,0 +1,58 @@
+use api_models::analytics::auth_events::{AuthEventDimensions, AuthEventFilters};
+use error_stack::ResultExt;
+
+use crate::{
+ query::{QueryBuilder, QueryFilter, QueryResult, ToSql},
+ types::{AnalyticsCollection, AnalyticsDataSource},
+};
+
+impl<T> QueryFilter<T> for AuthEventFilters
+where
+ T: AnalyticsDataSource,
+ AnalyticsCollection: ToSql<T>,
+{
+ fn set_filter_clause(&self, builder: &mut QueryBuilder<T>) -> QueryResult<()> {
+ if !self.authentication_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationStatus,
+ &self.authentication_status,
+ )
+ .attach_printable("Error adding authentication status filter")?;
+ }
+
+ if !self.trans_status.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::TransactionStatus,
+ &self.trans_status,
+ )
+ .attach_printable("Error adding transaction status filter")?;
+ }
+
+ if !self.error_message.is_empty() {
+ builder
+ .add_filter_in_range_clause(AuthEventDimensions::ErrorMessage, &self.error_message)
+ .attach_printable("Error adding error message filter")?;
+ }
+
+ if !self.authentication_connector.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::AuthenticationConnector,
+ &self.authentication_connector,
+ )
+ .attach_printable("Error adding authentication connector filter")?;
+ }
+
+ if !self.message_version.is_empty() {
+ builder
+ .add_filter_in_range_clause(
+ AuthEventDimensions::MessageVersion,
+ &self.message_version,
+ )
+ .attach_printable("Error adding message version filter")?;
+ }
+ Ok(())
+ }
+}
diff --git a/crates/analytics/src/clickhouse.rs b/crates/analytics/src/clickhouse.rs
index 1c86e7cbcf6..1d52cc9e761 100644
--- a/crates/analytics/src/clickhouse.rs
+++ b/crates/analytics/src/clickhouse.rs
@@ -28,6 +28,7 @@ use crate::{
filters::ApiEventFilter,
metrics::{latency::LatencyAvg, ApiEventMetricRow},
},
+ auth_events::filters::AuthEventFilterRow,
connector_events::events::ConnectorEventsResult,
disputes::{filters::DisputeFilterRow, metrics::DisputeMetricRow},
outgoing_webhook_event::events::OutgoingWebhookLogsResult,
@@ -181,6 +182,7 @@ impl super::sdk_events::metrics::SdkEventMetricAnalytics for ClickhouseClient {}
impl super::sdk_events::events::SdkEventsFilterAnalytics for ClickhouseClient {}
impl super::active_payments::metrics::ActivePaymentsMetricAnalytics for ClickhouseClient {}
impl super::auth_events::metrics::AuthEventMetricAnalytics for ClickhouseClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::events::ApiLogsFilterAnalytics for ClickhouseClient {}
impl super::api_event::filters::ApiEventFilterAnalytics for ClickhouseClient {}
impl super::api_event::metrics::ApiEventMetricAnalytics for ClickhouseClient {}
@@ -403,6 +405,16 @@ impl TryInto<AuthEventMetricRow> for serde_json::Value {
}
}
+impl TryInto<AuthEventFilterRow> for serde_json::Value {
+ type Error = Report<ParsingError>;
+
+ fn try_into(self) -> Result<AuthEventFilterRow, Self::Error> {
+ serde_json::from_value(self).change_context(ParsingError::StructParseFailure(
+ "Failed to parse AuthEventFilterRow in clickhouse results",
+ ))
+ }
+}
+
impl TryInto<ApiEventFilter> for serde_json::Value {
type Error = Report<ParsingError>;
diff --git a/crates/analytics/src/core.rs b/crates/analytics/src/core.rs
index 0e3ced7993d..980e17bc90a 100644
--- a/crates/analytics/src/core.rs
+++ b/crates/analytics/src/core.rs
@@ -34,7 +34,7 @@ pub async fn get_domain_info(
AnalyticsDomain::AuthEvents => GetInfoResponse {
metrics: utils::get_auth_event_metrics_info(),
download_dimensions: None,
- dimensions: Vec::new(),
+ dimensions: utils::get_auth_event_dimensions(),
},
AnalyticsDomain::ApiEvents => GetInfoResponse {
metrics: utils::get_api_event_metrics_info(),
diff --git a/crates/analytics/src/lib.rs b/crates/analytics/src/lib.rs
index ef7108e8ef7..f698b1161a0 100644
--- a/crates/analytics/src/lib.rs
+++ b/crates/analytics/src/lib.rs
@@ -41,7 +41,9 @@ use api_models::analytics::{
api_event::{
ApiEventDimensions, ApiEventFilters, ApiEventMetrics, ApiEventMetricsBucketIdentifier,
},
- auth_events::{AuthEventMetrics, AuthEventMetricsBucketIdentifier},
+ auth_events::{
+ AuthEventDimensions, AuthEventFilters, AuthEventMetrics, AuthEventMetricsBucketIdentifier,
+ },
disputes::{DisputeDimensions, DisputeFilters, DisputeMetrics, DisputeMetricsBucketIdentifier},
frm::{FrmDimensions, FrmFilters, FrmMetrics, FrmMetricsBucketIdentifier},
payment_intents::{
@@ -908,7 +910,9 @@ impl AnalyticsProvider {
pub async fn get_auth_event_metrics(
&self,
metric: &AuthEventMetrics,
+ dimensions: &[AuthEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
+ filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
) -> types::MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
@@ -916,13 +920,22 @@ impl AnalyticsProvider {
Self::Sqlx(_pool) => Err(report!(MetricsError::NotImplemented)),
Self::Clickhouse(pool) => {
metric
- .load_metrics(merchant_id, granularity, time_range, pool)
+ .load_metrics(
+ merchant_id,
+ dimensions,
+ filters,
+ granularity,
+ time_range,
+ pool,
+ )
.await
}
Self::CombinedCkh(_sqlx_pool, ckh_pool) | Self::CombinedSqlx(_sqlx_pool, ckh_pool) => {
metric
.load_metrics(
merchant_id,
+ dimensions,
+ filters,
granularity,
// Since API events are ckh only use ckh here
time_range,
@@ -1126,6 +1139,7 @@ pub enum AnalyticsFlow {
GetFrmMetrics,
GetSdkMetrics,
GetAuthMetrics,
+ GetAuthEventFilters,
GetActivePaymentsMetrics,
GetPaymentFilters,
GetPaymentIntentFilters,
diff --git a/crates/analytics/src/query.rs b/crates/analytics/src/query.rs
index 59cb8743448..d483ce43605 100644
--- a/crates/analytics/src/query.rs
+++ b/crates/analytics/src/query.rs
@@ -4,7 +4,7 @@ use api_models::{
analytics::{
self as analytics_api,
api_event::ApiEventDimensions,
- auth_events::AuthEventFlows,
+ auth_events::{AuthEventDimensions, AuthEventFlows},
disputes::DisputeDimensions,
frm::{FrmDimensions, FrmTransactionType},
payment_intents::PaymentIntentDimensions,
@@ -19,7 +19,7 @@ use api_models::{
},
refunds::RefundStatus,
};
-use common_enums::{AuthenticationStatus, TransactionStatus};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
id_type::{MerchantId, OrganizationId, ProfileId},
@@ -505,6 +505,7 @@ impl_to_sql_for_to_string!(
FrmTransactionType,
TransactionStatus,
AuthenticationStatus,
+ AuthenticationConnectors,
Flow,
&String,
&bool,
@@ -522,7 +523,9 @@ impl_to_sql_for_to_string!(
ApiEventDimensions,
&DisputeDimensions,
DisputeDimensions,
- DisputeStage
+ DisputeStage,
+ AuthEventDimensions,
+ &AuthEventDimensions
);
#[derive(Debug, Clone, Copy)]
diff --git a/crates/analytics/src/sqlx.rs b/crates/analytics/src/sqlx.rs
index f3143840f34..a6db92e753f 100644
--- a/crates/analytics/src/sqlx.rs
+++ b/crates/analytics/src/sqlx.rs
@@ -4,6 +4,7 @@ use api_models::{
analytics::{frm::FrmTransactionType, refunds::RefundType},
enums::{DisputeStage, DisputeStatus},
};
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
use common_utils::{
errors::{CustomResult, ParsingError},
DbConnectionParams,
@@ -96,6 +97,9 @@ db_type!(FraudCheckStatus);
db_type!(FrmTransactionType);
db_type!(DisputeStage);
db_type!(DisputeStatus);
+db_type!(AuthenticationStatus);
+db_type!(TransactionStatus);
+db_type!(AuthenticationConnectors);
impl<'q, Type> Encode<'q, Postgres> for DBEnumWrapper<Type>
where
@@ -159,6 +163,8 @@ impl super::disputes::filters::DisputeFilterAnalytics for SqlxClient {}
impl super::disputes::metrics::DisputeMetricAnalytics for SqlxClient {}
impl super::frm::metrics::FrmMetricAnalytics for SqlxClient {}
impl super::frm::filters::FrmFilterAnalytics for SqlxClient {}
+impl super::auth_events::metrics::AuthEventMetricAnalytics for SqlxClient {}
+impl super::auth_events::filters::AuthEventFilterAnalytics for SqlxClient {}
#[async_trait::async_trait]
impl AnalyticsDataSource for SqlxClient {
@@ -190,6 +196,94 @@ impl HealthCheck for SqlxClient {
}
}
+impl<'a> FromRow<'a, PgRow> for super::auth_events::metrics::AuthEventMetricRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let count: Option<i64> = row.try_get("count").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ // Removing millisecond precision to get accurate diffs against clickhouse
+ let start_bucket: Option<PrimitiveDateTime> = row
+ .try_get::<Option<PrimitiveDateTime>, _>("start_bucket")?
+ .and_then(|dt| dt.replace_millisecond(0).ok());
+ let end_bucket: Option<PrimitiveDateTime> = row
+ .try_get::<Option<PrimitiveDateTime>, _>("end_bucket")?
+ .and_then(|dt| dt.replace_millisecond(0).ok());
+ Ok(Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ count,
+ start_bucket,
+ end_bucket,
+ })
+ }
+}
+
+impl<'a> FromRow<'a, PgRow> for super::auth_events::filters::AuthEventFilterRow {
+ fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
+ let authentication_status: Option<DBEnumWrapper<AuthenticationStatus>> =
+ row.try_get("authentication_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let trans_status: Option<DBEnumWrapper<TransactionStatus>> =
+ row.try_get("trans_status").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let error_message: Option<String> = row.try_get("error_message").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>> = row
+ .try_get("authentication_connector")
+ .or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ let message_version: Option<String> =
+ row.try_get("message_version").or_else(|e| match e {
+ ColumnNotFound(_) => Ok(Default::default()),
+ e => Err(e),
+ })?;
+ Ok(Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ })
+ }
+}
+
impl<'a> FromRow<'a, PgRow> for super::refunds::metrics::RefundMetricRow {
fn from_row(row: &'a PgRow) -> sqlx::Result<Self> {
let currency: Option<DBEnumWrapper<Currency>> =
diff --git a/crates/analytics/src/utils.rs b/crates/analytics/src/utils.rs
index fc21bf09819..a0ddead1363 100644
--- a/crates/analytics/src/utils.rs
+++ b/crates/analytics/src/utils.rs
@@ -1,6 +1,6 @@
use api_models::analytics::{
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -47,6 +47,16 @@ pub fn get_payment_intent_dimensions() -> Vec<NameDescription> {
.collect()
}
+pub fn get_auth_event_dimensions() -> Vec<NameDescription> {
+ vec![
+ AuthEventDimensions::AuthenticationConnector,
+ AuthEventDimensions::MessageVersion,
+ ]
+ .into_iter()
+ .map(Into::into)
+ .collect()
+}
+
pub fn get_refund_dimensions() -> Vec<NameDescription> {
RefundDimensions::iter().map(Into::into).collect()
}
diff --git a/crates/api_models/src/analytics.rs b/crates/api_models/src/analytics.rs
index 132272f0e49..71d7f80eb7c 100644
--- a/crates/api_models/src/analytics.rs
+++ b/crates/api_models/src/analytics.rs
@@ -7,7 +7,7 @@ use masking::Secret;
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
- auth_events::AuthEventMetrics,
+ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMetrics},
frm::{FrmDimensions, FrmMetrics},
payment_intents::{PaymentIntentDimensions, PaymentIntentMetrics},
@@ -226,6 +226,10 @@ pub struct GetAuthEventMetricRequest {
pub time_series: Option<TimeSeries>,
pub time_range: TimeRange,
#[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+ #[serde(default)]
+ pub filters: AuthEventFilters,
+ #[serde(default)]
pub metrics: HashSet<AuthEventMetrics>,
#[serde(default)]
pub delta: bool,
@@ -509,3 +513,36 @@ pub struct SankeyResponse {
pub dispute_status: Option<String>,
pub first_attempt: i64,
}
+
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct GetAuthEventFilterRequest {
+ pub time_range: TimeRange,
+ #[serde(default)]
+ pub group_by_names: Vec<AuthEventDimensions>,
+}
+
+#[derive(Debug, Default, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFiltersResponse {
+ pub query_data: Vec<AuthEventFilterValue>,
+}
+
+#[derive(Debug, serde::Serialize, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventFilterValue {
+ pub dimension: AuthEventDimensions,
+ pub values: Vec<String>,
+}
+
+#[derive(Debug, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AuthEventMetricsResponse<T> {
+ pub query_data: Vec<T>,
+ pub meta_data: [AuthEventsAnalyticsMetadata; 1],
+}
+
+#[derive(Debug, serde::Serialize)]
+pub struct AuthEventsAnalyticsMetadata {
+ pub total_error_message_count: Option<u64>,
+}
diff --git a/crates/api_models/src/analytics/auth_events.rs b/crates/api_models/src/analytics/auth_events.rs
index 6f527551348..5c2d4ed2064 100644
--- a/crates/api_models/src/analytics/auth_events.rs
+++ b/crates/api_models/src/analytics/auth_events.rs
@@ -3,7 +3,23 @@ use std::{
hash::{Hash, Hasher},
};
-use super::NameDescription;
+use common_enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus};
+
+use super::{NameDescription, TimeRange};
+
+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
+pub struct AuthEventFilters {
+ #[serde(default)]
+ pub authentication_status: Vec<AuthenticationStatus>,
+ #[serde(default)]
+ pub trans_status: Vec<TransactionStatus>,
+ #[serde(default)]
+ pub error_message: Vec<String>,
+ #[serde(default)]
+ pub authentication_connector: Vec<AuthenticationConnectors>,
+ #[serde(default)]
+ pub message_version: Vec<String>,
+}
#[derive(
Debug,
@@ -22,10 +38,13 @@ use super::NameDescription;
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum AuthEventDimensions {
- #[serde(rename = "authentication_status")]
AuthenticationStatus,
+ #[strum(serialize = "trans_status")]
#[serde(rename = "trans_status")]
TransactionStatus,
+ ErrorMessage,
+ AuthenticationConnector,
+ MessageVersion,
}
#[derive(
@@ -51,6 +70,8 @@ pub enum AuthEventMetrics {
FrictionlessSuccessCount,
ChallengeAttemptCount,
ChallengeSuccessCount,
+ AuthenticationErrorMessage,
+ AuthenticationFunnel,
}
#[derive(
@@ -79,6 +100,7 @@ pub mod metric_behaviour {
pub struct FrictionlessSuccessCount;
pub struct ChallengeAttemptCount;
pub struct ChallengeSuccessCount;
+ pub struct AuthenticationErrorMessage;
}
impl From<AuthEventMetrics> for NameDescription {
@@ -90,19 +112,58 @@ impl From<AuthEventMetrics> for NameDescription {
}
}
+impl From<AuthEventDimensions> for NameDescription {
+ fn from(value: AuthEventDimensions) -> Self {
+ Self {
+ name: value.to_string(),
+ desc: String::new(),
+ }
+ }
+}
+
#[derive(Debug, serde::Serialize, Eq)]
pub struct AuthEventMetricsBucketIdentifier {
- pub time_bucket: Option<String>,
+ pub authentication_status: Option<AuthenticationStatus>,
+ pub trans_status: Option<TransactionStatus>,
+ pub error_message: Option<String>,
+ pub authentication_connector: Option<AuthenticationConnectors>,
+ pub message_version: Option<String>,
+ #[serde(rename = "time_range")]
+ pub time_bucket: TimeRange,
+ #[serde(rename = "time_bucket")]
+ #[serde(with = "common_utils::custom_serde::iso8601custom")]
+ pub start_time: time::PrimitiveDateTime,
}
impl AuthEventMetricsBucketIdentifier {
- pub fn new(time_bucket: Option<String>) -> Self {
- Self { time_bucket }
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ authentication_status: Option<AuthenticationStatus>,
+ trans_status: Option<TransactionStatus>,
+ error_message: Option<String>,
+ authentication_connector: Option<AuthenticationConnectors>,
+ message_version: Option<String>,
+ normalized_time_range: TimeRange,
+ ) -> Self {
+ Self {
+ authentication_status,
+ trans_status,
+ error_message,
+ authentication_connector,
+ message_version,
+ time_bucket: normalized_time_range,
+ start_time: normalized_time_range.start_time,
+ }
}
}
impl Hash for AuthEventMetricsBucketIdentifier {
fn hash<H: Hasher>(&self, state: &mut H) {
+ self.authentication_status.hash(state);
+ self.trans_status.hash(state);
+ self.authentication_connector.hash(state);
+ self.message_version.hash(state);
+ self.error_message.hash(state);
self.time_bucket.hash(state);
}
}
@@ -127,6 +188,8 @@ pub struct AuthEventMetricsBucketValue {
pub challenge_success_count: Option<u64>,
pub frictionless_flow_count: Option<u64>,
pub frictionless_success_count: Option<u64>,
+ pub error_message_count: Option<u64>,
+ pub authentication_funnel: Option<u64>,
}
#[derive(Debug, serde::Serialize)]
diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs
index bf7544f7c01..31b0c1d8dce 100644
--- a/crates/api_models/src/events.rs
+++ b/crates/api_models/src/events.rs
@@ -113,10 +113,12 @@ impl_api_event_type!(
GetActivePaymentsMetricRequest,
GetSdkEventMetricRequest,
GetAuthEventMetricRequest,
+ GetAuthEventFilterRequest,
GetPaymentFiltersRequest,
PaymentFiltersResponse,
GetRefundFilterRequest,
RefundFiltersResponse,
+ AuthEventFiltersResponse,
GetSdkEventFiltersRequest,
SdkEventFiltersResponse,
ApiLogsRequest,
@@ -180,6 +182,13 @@ impl<T> ApiEventMetric for DisputesMetricsResponse<T> {
Some(ApiEventsType::Miscellaneous)
}
}
+
+impl<T> ApiEventMetric for AuthEventMetricsResponse<T> {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::Miscellaneous)
+ }
+}
+
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
impl ApiEventMetric for PaymentMethodIntentConfirmInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index dbbee9764f2..296bdbd9ddc 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -6686,6 +6686,7 @@ impl From<RoleScope> for EntityType {
serde::Serialize,
serde::Deserialize,
Eq,
+ Hash,
PartialEq,
ToSchema,
strum::Display,
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index deaf84bb009..858c16d052f 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -19,11 +19,11 @@ pub mod routes {
GetGlobalSearchRequest, GetSearchRequest, GetSearchRequestWithIndex, SearchIndex,
},
AnalyticsRequest, GenerateReportRequest, GetActivePaymentsMetricRequest,
- GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventMetricRequest,
- GetDisputeMetricRequest, GetFrmFilterRequest, GetFrmMetricRequest,
- GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest, GetPaymentIntentMetricRequest,
- GetPaymentMetricRequest, GetRefundFilterRequest, GetRefundMetricRequest,
- GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
+ GetApiEventFiltersRequest, GetApiEventMetricRequest, GetAuthEventFilterRequest,
+ GetAuthEventMetricRequest, GetDisputeMetricRequest, GetFrmFilterRequest,
+ GetFrmMetricRequest, GetPaymentFiltersRequest, GetPaymentIntentFiltersRequest,
+ GetPaymentIntentMetricRequest, GetPaymentMetricRequest, GetRefundFilterRequest,
+ GetRefundMetricRequest, GetSdkEventFiltersRequest, GetSdkEventMetricRequest, ReportRequest,
};
use common_enums::EntityType;
use common_utils::types::TimeRange;
@@ -106,6 +106,10 @@ pub mod routes {
web::resource("metrics/auth_events")
.route(web::post().to(get_auth_event_metrics)),
)
+ .service(
+ web::resource("filters/auth_events")
+ .route(web::post().to(get_merchant_auth_events_filters)),
+ )
.service(
web::resource("metrics/frm").route(web::post().to(get_frm_metrics)),
)
@@ -1018,6 +1022,34 @@ pub mod routes {
.await
}
+ pub async fn get_merchant_auth_events_filters(
+ state: web::Data<AppState>,
+ req: actix_web::HttpRequest,
+ json_payload: web::Json<GetAuthEventFilterRequest>,
+ ) -> impl Responder {
+ let flow = AnalyticsFlow::GetAuthEventFilters;
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ json_payload.into_inner(),
+ |state, auth: AuthenticationData, req, _| async move {
+ analytics::auth_events::get_filters(
+ &state.pool,
+ req,
+ auth.merchant_account.get_id(),
+ )
+ .await
+ .map(ApplicationResponse::Json)
+ },
+ &auth::JWTAuth {
+ permission: Permission::MerchantAnalyticsRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+ }
+
pub async fn get_org_payment_filters(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
|
feat
|
add new filters, dimensions and metrics for authentication analytics (#7451)
|
1deb37ebd1128041ded64a4966a2d47a61e8c499
|
2024-02-02 05:46:28
|
github-actions
|
chore(postman): update Postman collection files
| false
|
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 847a1323a2c..fa7650af9e4 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -6409,7 +6409,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"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\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -10121,7 +10121,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000009995\",\"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\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000009995\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -20388,7 +20388,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"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\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
|
chore
|
update Postman collection files
|
963cb528f54c69d98f598e69b510edf8f497f907
|
2023-02-10 13:16:41
|
Kartikeya Hegde
|
feat: Impelement redis cache for MCA fetch and update (#515)
| false
|
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 60a6ee09fb2..e3920fc0999 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -154,15 +154,26 @@ impl MerchantConnectorAccountInterface for Store {
merchant_id: &str,
merchant_connector_id: &str,
) -> CustomResult<storage::MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- storage::MerchantConnectorAccount::find_by_merchant_id_merchant_connector_id(
- &conn,
- merchant_id,
- merchant_connector_id,
- )
- .await
- .map_err(Into::into)
- .into_report()
+ let find_call = || async {
+ let conn = pg_connection(&self.master_pool).await;
+ storage::MerchantConnectorAccount::find_by_merchant_id_merchant_connector_id(
+ &conn,
+ merchant_id,
+ merchant_connector_id,
+ )
+ .await
+ .map_err(Into::into)
+ .into_report()
+ };
+ #[cfg(not(feature = "accounts_cache"))]
+ {
+ find_call().await
+ }
+
+ #[cfg(feature = "accounts_cache")]
+ {
+ super::cache::get_or_populate_cache(self, merchant_connector_id, find_call).await
+ }
}
async fn insert_merchant_connector_account(
@@ -189,11 +200,24 @@ impl MerchantConnectorAccountInterface for Store {
this: storage::MerchantConnectorAccount,
merchant_connector_account: storage::MerchantConnectorAccountUpdate,
) -> CustomResult<storage::MerchantConnectorAccount, errors::StorageError> {
- let conn = pg_connection(&self.master_pool).await;
- this.update(&conn, merchant_connector_account)
- .await
- .map_err(Into::into)
- .into_report()
+ let _merchant_connector_id = this.merchant_connector_id.clone();
+ let update_call = || async {
+ let conn = pg_connection(&self.master_pool).await;
+ this.update(&conn, merchant_connector_account)
+ .await
+ .map_err(Into::into)
+ .into_report()
+ };
+
+ #[cfg(feature = "accounts_cache")]
+ {
+ super::cache::redact_cache(self, &_merchant_connector_id, update_call).await
+ }
+
+ #[cfg(not(feature = "accounts_cache"))]
+ {
+ update_call().await
+ }
}
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
diff --git a/crates/storage_models/src/merchant_connector_account.rs b/crates/storage_models/src/merchant_connector_account.rs
index 83526031c1d..6b76859cc8c 100644
--- a/crates/storage_models/src/merchant_connector_account.rs
+++ b/crates/storage_models/src/merchant_connector_account.rs
@@ -3,7 +3,17 @@ use masking::Secret;
use crate::{enums as storage_enums, schema::merchant_connector_account};
-#[derive(Clone, Debug, Eq, PartialEq, Identifiable, Queryable, router_derive::DebugAsDisplay)]
+#[derive(
+ Clone,
+ Debug,
+ Eq,
+ serde::Serialize,
+ serde::Deserialize,
+ PartialEq,
+ Identifiable,
+ Queryable,
+ router_derive::DebugAsDisplay,
+)]
#[diesel(table_name = merchant_connector_account)]
pub struct MerchantConnectorAccount {
pub id: i32,
|
feat
|
Impelement redis cache for MCA fetch and update (#515)
|
c980f016918144290ea98df2860644249c7b2e03
|
2024-04-12 12:41:03
|
akshay-97
|
feat(customer): Customer kv impl (#4267)
| false
|
diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs
index bda7af157de..fcabc8879b3 100644
--- a/crates/diesel_models/src/customers.rs
+++ b/crates/diesel_models/src/customers.rs
@@ -4,7 +4,9 @@ use time::PrimitiveDateTime;
use crate::{encryption::Encryption, schema::customers};
-#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
+#[derive(
+ Clone, Debug, Insertable, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize,
+)]
#[diesel(table_name = customers)]
pub struct CustomerNew {
pub customer_id: String,
@@ -21,7 +23,28 @@ pub struct CustomerNew {
pub address_id: Option<String>,
}
-#[derive(Clone, Debug, Identifiable, Queryable)]
+impl From<CustomerNew> for Customer {
+ fn from(customer_new: CustomerNew) -> Self {
+ Self {
+ id: 0i32,
+ customer_id: customer_new.customer_id,
+ merchant_id: customer_new.merchant_id,
+ name: customer_new.name,
+ email: customer_new.email,
+ phone: customer_new.phone,
+ phone_country_code: customer_new.phone_country_code,
+ description: customer_new.description,
+ created_at: customer_new.created_at,
+ metadata: customer_new.metadata,
+ connector_customer: customer_new.connector_customer,
+ modified_at: customer_new.modified_at,
+ address_id: customer_new.address_id,
+ default_payment_method_id: None,
+ }
+ }
+}
+
+#[derive(Clone, Debug, Identifiable, Queryable, serde::Deserialize, serde::Serialize)]
#[diesel(table_name = customers)]
pub struct Customer {
pub id: i32,
@@ -40,7 +63,15 @@ pub struct Customer {
pub default_payment_method_id: Option<String>,
}
-#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
+#[derive(
+ Clone,
+ Debug,
+ Default,
+ AsChangeset,
+ router_derive::DebugAsDisplay,
+ serde::Deserialize,
+ serde::Serialize,
+)]
#[diesel(table_name = customers)]
pub struct CustomerUpdateInternal {
pub name: Option<Encryption>,
@@ -54,3 +85,36 @@ pub struct CustomerUpdateInternal {
pub address_id: Option<String>,
pub default_payment_method_id: Option<Option<String>>,
}
+
+impl CustomerUpdateInternal {
+ pub fn apply_changeset(self, source: Customer) -> Customer {
+ let Self {
+ name,
+ email,
+ phone,
+ description,
+ phone_country_code,
+ metadata,
+ connector_customer,
+ address_id,
+ default_payment_method_id,
+ ..
+ } = self;
+
+ Customer {
+ name: name.map_or(source.name, Some),
+ email: email.map_or(source.email, Some),
+ phone: phone.map_or(source.phone, Some),
+ description: description.map_or(source.description, Some),
+ phone_country_code: phone_country_code.map_or(source.phone_country_code, Some),
+ metadata: metadata.map_or(source.metadata, Some),
+ modified_at: common_utils::date_time::now(),
+ connector_customer: connector_customer.map_or(source.connector_customer, Some),
+ address_id: address_id.map_or(source.address_id, Some),
+ default_payment_method_id: default_payment_method_id
+ .flatten()
+ .map_or(source.default_payment_method_id, Some),
+ ..source
+ }
+ }
+}
diff --git a/crates/diesel_models/src/kv.rs b/crates/diesel_models/src/kv.rs
index 4d0eb482593..e70216c6f34 100644
--- a/crates/diesel_models/src/kv.rs
+++ b/crates/diesel_models/src/kv.rs
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::{
address::{Address, AddressNew, AddressUpdateInternal},
+ customers::{Customer, CustomerNew, CustomerUpdateInternal},
errors,
payment_attempt::{PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate},
payment_intent::{PaymentIntentNew, PaymentIntentUpdate},
@@ -36,6 +37,7 @@ impl DBOperation {
Insertable::Address(_) => "address",
Insertable::Payouts(_) => "payouts",
Insertable::PayoutAttempt(_) => "payout_attempt",
+ Insertable::Customer(_) => "customer",
Insertable::ReverseLookUp(_) => "reverse_lookup",
Insertable::PaymentMethod(_) => "payment_method",
},
@@ -43,6 +45,7 @@ impl DBOperation {
Updateable::PaymentIntentUpdate(_) => "payment_intent",
Updateable::PaymentAttemptUpdate(_) => "payment_attempt",
Updateable::RefundUpdate(_) => "refund",
+ Updateable::CustomerUpdate(_) => "customer",
Updateable::AddressUpdate(_) => "address",
Updateable::PayoutsUpdate(_) => "payouts",
Updateable::PayoutAttemptUpdate(_) => "payout_attempt",
@@ -58,6 +61,7 @@ pub enum DBResult {
PaymentAttempt(Box<PaymentAttempt>),
Refund(Box<Refund>),
Address(Box<Address>),
+ Customer(Box<Customer>),
ReverseLookUp(Box<ReverseLookup>),
Payouts(Box<Payouts>),
PayoutAttempt(Box<PayoutAttempt>),
@@ -82,6 +86,9 @@ impl DBOperation {
}
Insertable::Refund(a) => DBResult::Refund(Box::new(a.insert(conn).await?)),
Insertable::Address(addr) => DBResult::Address(Box::new(addr.insert(conn).await?)),
+ Insertable::Customer(cust) => {
+ DBResult::Customer(Box::new(cust.insert(conn).await?))
+ }
Insertable::ReverseLookUp(rev) => {
DBResult::ReverseLookUp(Box::new(rev.insert(conn).await?))
}
@@ -117,6 +124,15 @@ impl DBOperation {
.update_with_payment_method_id(conn, v.update_data)
.await?,
)),
+ Updateable::CustomerUpdate(cust) => DBResult::Customer(Box::new(
+ Customer::update_by_customer_id_merchant_id(
+ conn,
+ cust.orig.customer_id.clone(),
+ cust.orig.merchant_id.clone(),
+ cust.update_data,
+ )
+ .await?,
+ )),
},
})
}
@@ -150,6 +166,7 @@ pub enum Insertable {
PaymentAttempt(PaymentAttemptNew),
Refund(RefundNew),
Address(Box<AddressNew>),
+ Customer(CustomerNew),
ReverseLookUp(ReverseLookupNew),
Payouts(PayoutsNew),
PayoutAttempt(PayoutAttemptNew),
@@ -162,12 +179,19 @@ pub enum Updateable {
PaymentIntentUpdate(PaymentIntentUpdateMems),
PaymentAttemptUpdate(PaymentAttemptUpdateMems),
RefundUpdate(RefundUpdateMems),
+ CustomerUpdate(CustomerUpdateMems),
AddressUpdate(Box<AddressUpdateMems>),
PayoutsUpdate(PayoutsUpdateMems),
PayoutAttemptUpdate(PayoutAttemptUpdateMems),
PaymentMethodUpdate(PaymentMethodUpdateMems),
}
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CustomerUpdateMems {
+ pub orig: Customer,
+ pub update_data: CustomerUpdateInternal,
+}
+
#[derive(Debug, Serialize, Deserialize)]
pub struct AddressUpdateMems {
pub orig: Address,
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 4ad62c5a078..c38167f07c4 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -45,7 +45,12 @@ pub async fn create_customer(
// Consider a scenario where the address is inserted and then when inserting the customer,
// it errors out, now the address that was inserted is not deleted
match db
- .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, &key_store)
+ .find_customer_by_customer_id_merchant_id(
+ customer_id,
+ merchant_id,
+ &key_store,
+ merchant_account.storage_scheme,
+ )
.await
{
Err(err) => {
@@ -118,7 +123,7 @@ pub async fn create_customer(
.attach_printable("Failed while encrypting Customer")?;
let customer = db
- .insert_customer(new_customer, &key_store)
+ .insert_customer(new_customer, &key_store, merchant_account.storage_scheme)
.await
.to_duplicate_response(errors::CustomersErrorResponse::CustomerAlreadyExists)?;
@@ -142,6 +147,7 @@ pub async fn retrieve_customer(
&req.customer_id,
&merchant_account.merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.switch()?;
@@ -188,13 +194,15 @@ pub async fn delete_customer(
) -> errors::CustomerResponse<customers::CustomerDeleteResponse> {
let db = &state.store;
- db.find_customer_by_customer_id_merchant_id(
- &req.customer_id,
- &merchant_account.merchant_id,
- &key_store,
- )
- .await
- .switch()?;
+ let customer_orig = db
+ .find_customer_by_customer_id_merchant_id(
+ &req.customer_id,
+ &merchant_account.merchant_id,
+ &key_store,
+ merchant_account.storage_scheme,
+ )
+ .await
+ .switch()?;
let customer_mandates = db
.find_mandate_by_merchant_id_customer_id(&merchant_account.merchant_id, &req.customer_id)
@@ -313,8 +321,10 @@ pub async fn delete_customer(
db.update_customer_by_customer_id_merchant_id(
req.customer_id.clone(),
merchant_account.merchant_id,
+ customer_orig,
updated_customer,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.switch()?;
@@ -343,6 +353,7 @@ pub async fn update_customer(
&update_customer.customer_id,
&merchant_account.merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.switch()?;
@@ -350,7 +361,7 @@ pub async fn update_customer(
let key = key_store.key.get_inner().peek();
let address = if let Some(addr) = &update_customer.address {
- match customer.address_id {
+ match customer.address_id.clone() {
Some(address_id) => {
let customer_address: api_models::payments::AddressDetails = addr.clone();
let update_address = update_customer
@@ -359,7 +370,7 @@ pub async fn update_customer(
.switch()
.attach_printable("Failed while encrypting Address while Update")?;
Some(
- db.update_address(address_id.clone(), update_address, &key_store)
+ db.update_address(address_id, update_address, &key_store)
.await
.switch()
.attach_printable(format!(
@@ -405,6 +416,7 @@ pub async fn update_customer(
.update_customer_by_customer_id_merchant_id(
update_customer.customer_id.to_owned(),
merchant_account.merchant_id.to_owned(),
+ customer,
async {
Ok(storage::CustomerUpdate::Update {
name: update_customer
@@ -434,6 +446,7 @@ pub async fn update_customer(
.switch()
.attach_printable("Failed while encrypting while updating customer")?,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.switch()?;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 1495b2ba24c..c885a3bf227 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -92,7 +92,12 @@ pub async fn create_payment_method(
storage_scheme: MerchantStorageScheme,
) -> errors::CustomResult<storage::PaymentMethod, errors::ApiErrorResponse> {
let customer = db
- .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, key_store)
+ .find_customer_by_customer_id_merchant_id(
+ customer_id,
+ merchant_id,
+ key_store,
+ storage_scheme,
+ )
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
@@ -1288,6 +1293,7 @@ pub async fn list_payment_methods(
cust.as_str(),
&pi.merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
@@ -2802,6 +2808,7 @@ pub async fn list_customer_payment_method(
customer_id,
&merchant_account.merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
@@ -3258,7 +3265,12 @@ pub async fn set_default_payment_method(
) -> errors::RouterResponse<CustomerDefaultPaymentMethodResponse> {
//check for the customer
let customer = db
- .find_customer_by_customer_id_merchant_id(customer_id, &merchant_id, &key_store)
+ .find_customer_by_customer_id_merchant_id(
+ customer_id,
+ &merchant_id,
+ &key_store,
+ storage_scheme,
+ )
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?;
// check for the presence of payment_method
@@ -3289,20 +3301,24 @@ pub async fn set_default_payment_method(
default_payment_method_id: Some(Some(payment_method_id.to_owned())),
};
+ let customer_id = customer.customer_id.clone();
+
// update the db with the default payment method id
let updated_customer_details = db
.update_customer_by_customer_id_merchant_id(
customer_id.to_owned(),
merchant_id.to_owned(),
+ customer,
customer_update,
&key_store,
+ storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to update the default payment method id for the customer")?;
let resp = CustomerDefaultPaymentMethodResponse {
default_payment_method_id: updated_customer_details.default_payment_method_id,
- customer_id: customer.customer_id,
+ customer_id,
payment_method_type: payment_method.payment_method_type,
payment_method: payment_method.payment_method,
};
@@ -3556,6 +3572,7 @@ pub async fn delete_payment_method(
&key.customer_id,
&merchant_account.merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
@@ -3599,8 +3616,10 @@ pub async fn delete_payment_method(
db.update_customer_by_customer_id_merchant_id(
key.customer_id,
key.merchant_id,
+ customer,
customer_update,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index e74a8c1d1ec..b9eed02f74c 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -150,6 +150,7 @@ where
&mut payment_data,
customer_details,
&key_store,
+ merchant_account.storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
@@ -3490,6 +3491,7 @@ pub async fn payment_external_authentication(
customer_id,
&merchant_account.merchant_id,
&key_store,
+ storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 647854cca6f..bde7e489836 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1284,6 +1284,7 @@ pub async fn get_customer_from_details<F: Clone>(
merchant_id: &str,
payment_data: &mut PaymentData<F>,
merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
match customer_id {
None => Ok(None),
@@ -1293,6 +1294,7 @@ pub async fn get_customer_from_details<F: Clone>(
&c_id,
merchant_id,
merchant_key_store,
+ storage_scheme,
)
.await?;
payment_data.email = payment_data.email.clone().or_else(|| {
@@ -1431,6 +1433,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
req: Option<CustomerDetails>,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option<domain::Customer>), errors::StorageError> {
let request_customer_details = req
.get_required_value("customer")
@@ -1447,6 +1450,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
&customer_id,
merchant_id,
key_store,
+ storage_scheme,
)
.await?;
@@ -1498,8 +1502,10 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
db.update_customer_by_customer_id_merchant_id(
customer_id,
merchant_id.to_string(),
+ c,
customer_update,
key_store,
+ storage_scheme,
)
.await
} else {
@@ -1550,7 +1556,8 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
.change_context(errors::StorageError::SerializationFailed)
.attach_printable("Failed while encrypting Customer while insert")?;
metrics::CUSTOMER_CREATED.add(&metrics::CONTEXT, 1, &[]);
- db.insert_customer(new_customer, key_store).await
+ db.insert_customer(new_customer, key_store, storage_scheme)
+ .await
}
})
}
@@ -1561,6 +1568,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, Ctx>(
customer_id,
merchant_id,
key_store,
+ storage_scheme,
)
.await?
.map(Ok),
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index cad02fc7210..261cbf06271 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -125,6 +125,7 @@ pub trait Domain<F: Clone, R, Ctx: PaymentMethodRetrieve>: Send + Sync {
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<(BoxedOperation<'a, F, R, Ctx>, Option<domain::Customer>), errors::StorageError>;
#[allow(clippy::too_many_arguments)]
@@ -240,6 +241,7 @@ where
payment_data: &mut PaymentData<F>,
_request: Option<CustomerDetails>,
merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRetrieveRequest, Ctx>,
@@ -255,6 +257,7 @@ where
&merchant_key_store.merchant_id,
payment_data,
merchant_key_store,
+ storage_scheme,
)
.await?,
))
@@ -322,6 +325,7 @@ where
payment_data: &mut PaymentData<F>,
_request: Option<CustomerDetails>,
merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsCaptureRequest, Ctx>,
@@ -337,6 +341,7 @@ where
&merchant_key_store.merchant_id,
payment_data,
merchant_key_store,
+ storage_scheme,
)
.await?,
))
@@ -395,6 +400,7 @@ where
payment_data: &mut PaymentData<F>,
_request: Option<CustomerDetails>,
merchant_key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsCancelRequest, Ctx>,
@@ -410,6 +416,7 @@ where
&merchant_key_store.merchant_id,
payment_data,
merchant_key_store,
+ storage_scheme,
)
.await?,
))
@@ -469,6 +476,7 @@ where
_payment_data: &mut PaymentData<F>,
_request: Option<CustomerDetails>,
_merchant_key_store: &domain::MerchantKeyStore,
+ _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRejectRequest, Ctx>,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index e1a16b6f4a2..03aa3685a42 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -326,6 +326,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
@@ -340,6 +341,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 8e66f436817..21513930066 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -652,6 +652,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
@@ -666,6 +667,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
@@ -1158,8 +1160,10 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
m_db.update_customer_by_customer_id_merchant_id(
m_customer_customer_id,
m_customer_merchant_id,
+ customer,
m_updated_customer,
&m_key_store,
+ storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index c6e95b176c1..2e8b7eb9df1 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -459,6 +459,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
@@ -473,6 +474,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 25b419e3222..e15c413de2c 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -300,6 +300,7 @@ where
payment_data: &mut PaymentData<F>,
request: Option<payments::CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> errors::CustomResult<
(
BoxedOperation<'a, F, api::PaymentsSessionRequest, Ctx>,
@@ -314,6 +315,7 @@ where
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 560d2014bae..cfa245ccc3a 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -276,6 +276,7 @@ where
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsStartRequest, Ctx>,
@@ -290,6 +291,7 @@ where
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 6739c2c3ba7..39cd8328715 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -71,6 +71,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
@@ -85,6 +86,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 934c0edfddd..fcf70212f30 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -464,6 +464,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
payment_data: &mut PaymentData<F>,
request: Option<CustomerDetails>,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: common_enums::enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, api::PaymentsRequest, Ctx>,
@@ -478,6 +479,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve> Domain<F, api::PaymentsRequest
request,
&key_store.merchant_id,
key_store,
+ storage_scheme,
)
.await
}
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index be2b127ff67..e73a829d04d 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -294,6 +294,7 @@ impl<F: Clone + Send, Ctx: PaymentMethodRetrieve>
_payment_data: &mut payments::PaymentData<F>,
_request: Option<CustomerDetails>,
_merchant_key_store: &domain::MerchantKeyStore,
+ _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<
(
BoxedOperation<'a, F, PaymentsIncrementalAuthorizationRequest, Ctx>,
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index be4376d4f03..d333453eede 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -710,6 +710,7 @@ pub async fn payouts_list_core(
&payouts.customer_id,
merchant_id,
&key_store,
+ merchant_account.storage_scheme,
)
.await
{
@@ -1063,8 +1064,10 @@ pub async fn create_recipient(
db.update_customer_by_customer_id_merchant_id(
customer_id,
merchant_id,
+ customer,
updated_customer,
key_store,
+ merchant_account.storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
@@ -1838,6 +1841,7 @@ pub async fn make_payout_data(
&payouts.customer_id.to_owned(),
merchant_id,
key_store,
+ merchant_account.storage_scheme,
)
.await
.map_or(None, |c| c);
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index ef54cedcb8d..089342b1a94 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -583,7 +583,12 @@ pub async fn get_or_create_customer_details(
let key = key_store.key.get_inner().peek();
match db
- .find_customer_optional_by_customer_id_merchant_id(&customer_id, merchant_id, key_store)
+ .find_customer_optional_by_customer_id_merchant_id(
+ &customer_id,
+ merchant_id,
+ key_store,
+ merchant_account.storage_scheme,
+ )
.await
.change_context(errors::ApiErrorResponse::InternalServerError)?
{
@@ -616,7 +621,7 @@ pub async fn get_or_create_customer_details(
};
Ok(Some(
- db.insert_customer(customer, key_store)
+ db.insert_customer(customer, key_store, merchant_account.storage_scheme)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)?,
))
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index 081a41e0073..00fb7e4a08f 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -1,29 +1,25 @@
use common_utils::ext_traits::AsyncExt;
-use error_stack::{report, ResultExt};
+use error_stack::ResultExt;
use futures::future::try_join_all;
-use masking::PeekInterface;
use router_env::{instrument, tracing};
-use super::{MockDb, Store};
+use super::MockDb;
use crate::{
- connection,
- core::{
- customers::REDACTED,
- errors::{self, CustomResult},
- },
+ core::errors::{self, CustomResult},
types::{
domain::{
self,
behaviour::{Conversion, ReverseConversion},
},
- storage,
+ storage::{self as storage_types, enums::MerchantStorageScheme},
},
};
#[async_trait::async_trait]
pub trait CustomerInterface
where
- domain::Customer: Conversion<DstType = storage::Customer, NewDstType = storage::CustomerNew>,
+ domain::Customer:
+ Conversion<DstType = storage_types::Customer, NewDstType = storage_types::CustomerNew>,
{
async fn delete_customer_by_customer_id_merchant_id(
&self,
@@ -36,14 +32,17 @@ where
customer_id: &str,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<domain::Customer>, errors::StorageError>;
async fn update_customer_by_customer_id_merchant_id(
&self,
customer_id: String,
merchant_id: String,
- customer: storage::CustomerUpdate,
+ customer: domain::Customer,
+ customer_update: storage_types::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError>;
async fn find_customer_by_customer_id_merchant_id(
@@ -51,6 +50,7 @@ where
customer_id: &str,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError>;
async fn list_customers_by_merchant_id(
@@ -63,134 +63,423 @@ where
&self,
customer_data: domain::Customer,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError>;
}
-#[async_trait::async_trait]
-impl CustomerInterface for Store {
- #[instrument(skip_all)]
- async fn find_customer_optional_by_customer_id_merchant_id(
- &self,
- customer_id: &str,
- merchant_id: &str,
- key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
- let conn = connection::pg_connection_read(self).await?;
- let maybe_customer: Option<domain::Customer> =
- storage::Customer::find_optional_by_customer_id_merchant_id(
- &conn,
- customer_id,
- merchant_id,
- )
- .await
- .map_err(|error| report!(errors::StorageError::from(error)))?
- .async_map(|c| async {
- c.convert(key_store.key.get_inner())
+#[cfg(feature = "kv_store")]
+mod storage {
+ use common_utils::ext_traits::AsyncExt;
+ use diesel_models::kv;
+ use error_stack::{report, ResultExt};
+ use futures::future::try_join_all;
+ use masking::PeekInterface;
+ use router_env::{instrument, tracing};
+ use storage_impl::redis::kv_store::{kv_wrapper, KvOperation, PartitionKey};
+
+ use super::CustomerInterface;
+ use crate::{
+ connection,
+ core::{
+ customers::REDACTED,
+ errors::{self, CustomResult},
+ },
+ services::Store,
+ types::{
+ domain::{
+ self,
+ behaviour::{Conversion, ReverseConversion},
+ },
+ storage::{self as storage_types, enums::MerchantStorageScheme},
+ },
+ utils::db_utils,
+ };
+
+ #[async_trait::async_trait]
+ impl CustomerInterface for Store {
+ #[instrument(skip_all)]
+ // check customer not found in kv and fallback to db
+ async fn find_customer_optional_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ let database_call = || async {
+ storage_types::Customer::find_optional_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
+ .await
+ .map_err(|err| report!(errors::StorageError::from(err)))
+ };
+
+ let maybe_customer = match storage_scheme {
+ MerchantStorageScheme::PostgresOnly => database_call().await,
+ MerchantStorageScheme::RedisKv => {
+ let key = PartitionKey::MerchantIdCustomerId {
+ merchant_id,
+ customer_id,
+ };
+ let field = format!("cust_{}", customer_id);
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
+ // check for ValueNotFound
+ async {
+ kv_wrapper(
+ self,
+ KvOperation::<diesel_models::Customer>::HGet(&field),
+ key,
+ )
+ .await?
+ .try_into_hget()
+ .map(Some)
+ },
+ database_call,
+ ))
.await
- .change_context(errors::StorageError::DecryptionError)
- })
- .await
- .transpose()?;
- maybe_customer.map_or(Ok(None), |customer| {
- // in the future, once #![feature(is_some_and)] is stable, we can make this more concise:
- // `if customer.name.is_some_and(|ref name| name == REDACTED) ...`
- match customer.name {
+ }
+ }?;
+
+ let maybe_result = maybe_customer
+ .async_map(|c| async {
+ c.convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await
+ .transpose()?;
+
+ maybe_result.map_or(Ok(None), |customer: domain::Customer| match customer.name {
Some(ref name) if name.peek() == REDACTED => {
Err(errors::StorageError::CustomerRedacted)?
}
_ => Ok(Some(customer)),
- }
- })
- }
+ })
+ }
- #[instrument(skip_all)]
- async fn update_customer_by_customer_id_merchant_id(
- &self,
- customer_id: String,
- merchant_id: String,
- customer: storage::CustomerUpdate,
- key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<domain::Customer, errors::StorageError> {
- let conn = connection::pg_connection_write(self).await?;
- storage::Customer::update_by_customer_id_merchant_id(
- &conn,
- customer_id,
- merchant_id,
- customer.into(),
- )
- .await
- .map_err(|error| report!(errors::StorageError::from(error)))
- .async_and_then(|c| async {
- c.convert(key_store.key.get_inner())
+ #[instrument(skip_all)]
+ async fn update_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: String,
+ merchant_id: String,
+ customer: domain::Customer,
+ customer_update: storage_types::CustomerUpdate,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ let customer = Conversion::convert(customer)
+ .await
+ .change_context(errors::StorageError::EncryptionError)?;
+ let database_call = || async {
+ storage_types::Customer::update_by_customer_id_merchant_id(
+ &conn,
+ customer_id.clone(),
+ merchant_id.clone(),
+ customer_update.clone().into(),
+ )
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ };
+
+ let updated_object = match storage_scheme {
+ MerchantStorageScheme::PostgresOnly => database_call().await,
+ MerchantStorageScheme::RedisKv => {
+ let key = PartitionKey::MerchantIdCustomerId {
+ merchant_id: merchant_id.as_str(),
+ customer_id: customer_id.as_str(),
+ };
+ let field = format!("cust_{}", customer_id);
+ let updated_customer =
+ diesel_models::CustomerUpdateInternal::from(customer_update.clone())
+ .apply_changeset(customer.clone());
+
+ let redis_value = serde_json::to_string(&updated_customer)
+ .change_context(errors::StorageError::KVError)?;
+
+ let redis_entry = kv::TypedSql {
+ op: kv::DBOperation::Update {
+ updatable: kv::Updateable::CustomerUpdate(kv::CustomerUpdateMems {
+ orig: customer,
+ update_data: customer_update.into(),
+ }),
+ },
+ };
+
+ kv_wrapper::<(), _, _>(
+ self,
+ KvOperation::Hset::<diesel_models::Customer>(
+ (&field, redis_value),
+ redis_entry,
+ ),
+ key,
+ )
+ .await
+ .change_context(errors::StorageError::KVError)?
+ .try_into_hset()
+ .change_context(errors::StorageError::KVError)?;
+
+ Ok(updated_customer)
+ }
+ };
+
+ updated_object?
+ .convert(key_store.key.get_inner())
.await
.change_context(errors::StorageError::DecryptionError)
- })
- .await
- }
+ }
- #[instrument(skip_all)]
- async fn find_customer_by_customer_id_merchant_id(
- &self,
- customer_id: &str,
- merchant_id: &str,
- key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<domain::Customer, errors::StorageError> {
- let conn = connection::pg_connection_read(self).await?;
- let customer: domain::Customer =
- storage::Customer::find_by_customer_id_merchant_id(&conn, customer_id, merchant_id)
+ #[instrument(skip_all)]
+ async fn find_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ let database_call = || async {
+ storage_types::Customer::find_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
.await
.map_err(|error| report!(errors::StorageError::from(error)))
- .async_and_then(|c| async {
- c.convert(key_store.key.get_inner())
+ };
+
+ let customer = match storage_scheme {
+ MerchantStorageScheme::PostgresOnly => database_call().await,
+ MerchantStorageScheme::RedisKv => {
+ let key = PartitionKey::MerchantIdCustomerId {
+ merchant_id,
+ customer_id,
+ };
+ let field = format!("cust_{}", customer_id);
+ Box::pin(db_utils::try_redis_get_else_try_database_get(
+ async {
+ kv_wrapper(
+ self,
+ KvOperation::<diesel_models::Customer>::HGet(&field),
+ key,
+ )
+ .await?
+ .try_into_hget()
+ },
+ database_call,
+ ))
+ .await
+ }
+ }?;
+
+ let result: domain::Customer = customer
+ .convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)?;
+ //.await
+
+ match result.name {
+ Some(ref name) if name.peek() == REDACTED => {
+ Err(errors::StorageError::CustomerRedacted)?
+ }
+ _ => Ok(result),
+ }
+ }
+
+ #[instrument(skip_all)]
+ async fn list_customers_by_merchant_id(
+ &self,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<Vec<domain::Customer>, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+
+ let encrypted_customers =
+ storage_types::Customer::list_by_merchant_id(&conn, merchant_id)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))?;
+
+ let customers = try_join_all(encrypted_customers.into_iter().map(
+ |encrypted_customer| async {
+ encrypted_customer
+ .convert(key_store.key.get_inner())
.await
.change_context(errors::StorageError::DecryptionError)
- })
- .await?;
- match customer.name {
- Some(ref name) if name.peek() == REDACTED => {
- Err(errors::StorageError::CustomerRedacted)?
- }
- _ => Ok(customer),
+ },
+ ))
+ .await?;
+
+ Ok(customers)
}
- }
- #[instrument(skip_all)]
- async fn list_customers_by_merchant_id(
- &self,
- merchant_id: &str,
- key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<Vec<domain::Customer>, errors::StorageError> {
- let conn = connection::pg_connection_read(self).await?;
+ #[instrument(skip_all)]
+ async fn insert_customer(
+ &self,
+ customer_data: domain::Customer,
+ key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let customer_id = customer_data.customer_id.clone();
+ let merchant_id = customer_data.merchant_id.clone();
+ let new_customer = customer_data
+ .construct_new()
+ .await
+ .change_context(errors::StorageError::EncryptionError)?;
- let encrypted_customers = storage::Customer::list_by_merchant_id(&conn, merchant_id)
- .await
- .map_err(|error| report!(errors::StorageError::from(error)))?;
+ let create_customer = match storage_scheme {
+ MerchantStorageScheme::PostgresOnly => {
+ let conn = connection::pg_connection_write(self).await?;
+ new_customer
+ .insert(&conn)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ }
+ MerchantStorageScheme::RedisKv => {
+ let key = PartitionKey::MerchantIdCustomerId {
+ merchant_id: merchant_id.as_str(),
+ customer_id: customer_id.as_str(),
+ };
+ let field = format!("cust_{}", customer_id.clone());
+
+ let redis_entry = kv::TypedSql {
+ op: kv::DBOperation::Insert {
+ insertable: kv::Insertable::Customer(new_customer.clone()),
+ },
+ };
+ let storage_customer = new_customer.into();
- let customers = try_join_all(encrypted_customers.into_iter().map(
- |encrypted_customer| async {
- encrypted_customer
- .convert(key_store.key.get_inner())
+ match kv_wrapper::<diesel_models::Customer, _, _>(
+ self,
+ KvOperation::HSetNx::<diesel_models::Customer>(
+ &field,
+ &storage_customer,
+ redis_entry,
+ ),
+ key,
+ )
.await
- .change_context(errors::StorageError::DecryptionError)
- },
- ))
- .await?;
+ .change_context(errors::StorageError::KVError)?
+ .try_into_hsetnx()
+ {
+ Ok(redis_interface::HsetnxReply::KeyNotSet) => {
+ Err(report!(errors::StorageError::DuplicateValue {
+ entity: "customer",
+ key: Some(customer_id),
+ }))
+ }
+ Ok(redis_interface::HsetnxReply::KeySet) => Ok(storage_customer),
+ Err(er) => Err(er).change_context(errors::StorageError::KVError),
+ }
+ }
+ }?;
- Ok(customers)
- }
+ create_customer
+ .convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ }
- #[instrument(skip_all)]
- async fn insert_customer(
- &self,
- customer_data: domain::Customer,
- key_store: &domain::MerchantKeyStore,
- ) -> CustomResult<domain::Customer, errors::StorageError> {
- let conn = connection::pg_connection_write(self).await?;
- customer_data
- .construct_new()
+ #[instrument(skip_all)]
+ async fn delete_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ ) -> CustomResult<bool, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage_types::Customer::delete_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
.await
- .change_context(errors::StorageError::EncryptionError)?
- .insert(&conn)
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ }
+ }
+}
+
+#[cfg(not(feature = "kv_store"))]
+mod storage {
+ use common_utils::ext_traits::AsyncExt;
+ use error_stack::{report, ResultExt};
+ use futures::future::try_join_all;
+ use masking::PeekInterface;
+ use router_env::{instrument, tracing};
+
+ use super::CustomerInterface;
+ use crate::{
+ connection,
+ core::{
+ customers::REDACTED,
+ errors::{self, CustomResult},
+ },
+ services::Store,
+ types::{
+ domain::{
+ self,
+ behaviour::{Conversion, ReverseConversion},
+ },
+ storage::{self as storage_types, enums::MerchantStorageScheme},
+ },
+ };
+
+ #[async_trait::async_trait]
+ impl CustomerInterface for Store {
+ #[instrument(skip_all)]
+ async fn find_customer_optional_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ let maybe_customer: Option<domain::Customer> =
+ storage_types::Customer::find_optional_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))?
+ .async_map(|c| async {
+ c.convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await
+ .transpose()?;
+ maybe_customer.map_or(Ok(None), |customer| {
+ // in the future, once #![feature(is_some_and)] is stable, we can make this more concise:
+ // `if customer.name.is_some_and(|ref name| name == REDACTED) ...`
+ match customer.name {
+ Some(ref name) if name.peek() == REDACTED => {
+ Err(errors::StorageError::CustomerRedacted)?
+ }
+ _ => Ok(Some(customer)),
+ }
+ })
+ }
+
+ #[instrument(skip_all)]
+ async fn update_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: String,
+ merchant_id: String,
+ _customer: domain::Customer,
+ customer_update: storage_types::CustomerUpdate,
+ key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage_types::Customer::update_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ customer_update.into(),
+ )
.await
.map_err(|error| report!(errors::StorageError::from(error)))
.async_and_then(|c| async {
@@ -199,18 +488,103 @@ impl CustomerInterface for Store {
.change_context(errors::StorageError::DecryptionError)
})
.await
- }
+ }
- #[instrument(skip_all)]
- async fn delete_customer_by_customer_id_merchant_id(
- &self,
- customer_id: &str,
- merchant_id: &str,
- ) -> CustomResult<bool, errors::StorageError> {
- let conn = connection::pg_connection_write(self).await?;
- storage::Customer::delete_by_customer_id_merchant_id(&conn, customer_id, merchant_id)
+ #[instrument(skip_all)]
+ async fn find_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+ let customer: domain::Customer =
+ storage_types::Customer::find_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ .async_and_then(|c| async {
+ c.convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await?;
+ match customer.name {
+ Some(ref name) if name.peek() == REDACTED => {
+ Err(errors::StorageError::CustomerRedacted)?
+ }
+ _ => Ok(customer),
+ }
+ }
+
+ #[instrument(skip_all)]
+ async fn list_customers_by_merchant_id(
+ &self,
+ merchant_id: &str,
+ key_store: &domain::MerchantKeyStore,
+ ) -> CustomResult<Vec<domain::Customer>, errors::StorageError> {
+ let conn = connection::pg_connection_read(self).await?;
+
+ let encrypted_customers =
+ storage_types::Customer::list_by_merchant_id(&conn, merchant_id)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))?;
+
+ let customers = try_join_all(encrypted_customers.into_iter().map(
+ |encrypted_customer| async {
+ encrypted_customer
+ .convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ },
+ ))
+ .await?;
+
+ Ok(customers)
+ }
+
+ #[instrument(skip_all)]
+ async fn insert_customer(
+ &self,
+ customer_data: domain::Customer,
+ key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
+ ) -> CustomResult<domain::Customer, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ customer_data
+ .construct_new()
+ .await
+ .change_context(errors::StorageError::EncryptionError)?
+ .insert(&conn)
+ .await
+ .map_err(|error| report!(errors::StorageError::from(error)))
+ .async_and_then(|c| async {
+ c.convert(key_store.key.get_inner())
+ .await
+ .change_context(errors::StorageError::DecryptionError)
+ })
+ .await
+ }
+
+ #[instrument(skip_all)]
+ async fn delete_customer_by_customer_id_merchant_id(
+ &self,
+ customer_id: &str,
+ merchant_id: &str,
+ ) -> CustomResult<bool, errors::StorageError> {
+ let conn = connection::pg_connection_write(self).await?;
+ storage_types::Customer::delete_by_customer_id_merchant_id(
+ &conn,
+ customer_id,
+ merchant_id,
+ )
.await
.map_err(|error| report!(errors::StorageError::from(error)))
+ }
}
}
@@ -222,6 +596,7 @@ impl CustomerInterface for MockDb {
customer_id: &str,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
let customers = self.customers.lock().await;
let customer = customers
@@ -269,8 +644,10 @@ impl CustomerInterface for MockDb {
&self,
_customer_id: String,
_merchant_id: String,
- _customer: storage::CustomerUpdate,
+ _customer: domain::Customer,
+ _customer_update: storage_types::CustomerUpdate,
_key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
// [#172]: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
@@ -281,6 +658,7 @@ impl CustomerInterface for MockDb {
_customer_id: &str,
_merchant_id: &str,
_key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
// [#172]: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
@@ -291,6 +669,7 @@ impl CustomerInterface for MockDb {
&self,
customer_data: domain::Customer,
key_store: &domain::MerchantKeyStore,
+ _storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
let mut customers = self.customers.lock().await;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 0a56f4c27de..095c26e05ad 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -324,9 +324,15 @@ impl CustomerInterface for KafkaStore {
customer_id: &str,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<Option<domain::Customer>, errors::StorageError> {
self.diesel_store
- .find_customer_optional_by_customer_id_merchant_id(customer_id, merchant_id, key_store)
+ .find_customer_optional_by_customer_id_merchant_id(
+ customer_id,
+ merchant_id,
+ key_store,
+ storage_scheme,
+ )
.await
}
@@ -334,15 +340,19 @@ impl CustomerInterface for KafkaStore {
&self,
customer_id: String,
merchant_id: String,
- customer: storage::CustomerUpdate,
+ customer: domain::Customer,
+ customer_update: storage::CustomerUpdate,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
self.diesel_store
.update_customer_by_customer_id_merchant_id(
customer_id,
merchant_id,
customer,
+ customer_update,
key_store,
+ storage_scheme,
)
.await
}
@@ -362,9 +372,15 @@ impl CustomerInterface for KafkaStore {
customer_id: &str,
merchant_id: &str,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
self.diesel_store
- .find_customer_by_customer_id_merchant_id(customer_id, merchant_id, key_store)
+ .find_customer_by_customer_id_merchant_id(
+ customer_id,
+ merchant_id,
+ key_store,
+ storage_scheme,
+ )
.await
}
@@ -372,9 +388,10 @@ impl CustomerInterface for KafkaStore {
&self,
customer_data: domain::Customer,
key_store: &domain::MerchantKeyStore,
+ storage_scheme: MerchantStorageScheme,
) -> CustomResult<domain::Customer, errors::StorageError> {
self.diesel_store
- .insert_customer(customer_data, key_store)
+ .insert_customer(customer_data, key_store, storage_scheme)
.await
}
}
diff --git a/crates/router_env/src/logger/setup.rs b/crates/router_env/src/logger/setup.rs
index af77991e804..4f82c29f5a2 100644
--- a/crates/router_env/src/logger/setup.rs
+++ b/crates/router_env/src/logger/setup.rs
@@ -348,18 +348,14 @@ fn get_envfilter(
workspace_members
.drain()
- .zip(std::iter::repeat(filter_log_level.into_level()))
+ .zip(std::iter::repeat(filter_log_level.into_level().into()))
.fold(
EnvFilter::default().add_directive(default_log_level.into_level().into()),
- |env_filter, (target, level)| {
+ |env_filter, (_target, directive)| {
// Safety: This is a hardcoded basic filtering directive. If even the basic
// filter is wrong, it's better to panic.
#[allow(clippy::expect_used)]
- env_filter.add_directive(
- format!("{target}={level}")
- .parse()
- .expect("Invalid EnvFilter directive format"),
- )
+ env_filter.add_directive(directive)
},
)
})
diff --git a/crates/storage_impl/src/customers.rs b/crates/storage_impl/src/customers.rs
new file mode 100644
index 00000000000..0d89e1c454b
--- /dev/null
+++ b/crates/storage_impl/src/customers.rs
@@ -0,0 +1,5 @@
+use diesel_models::customers::Customer;
+
+use crate::redis::kv_store::KvStorePartition;
+
+impl KvStorePartition for Customer {}
diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs
index 20d018a6b75..91e308888be 100644
--- a/crates/storage_impl/src/lib.rs
+++ b/crates/storage_impl/src/lib.rs
@@ -8,6 +8,7 @@ use redis::{kv_store::RedisConnInterface, RedisStore};
mod address;
pub mod config;
pub mod connection;
+pub mod customers;
pub mod database;
pub mod errors;
mod lookup;
@@ -371,6 +372,18 @@ impl UniqueConstraints for diesel_models::PaymentMethod {
}
}
+impl UniqueConstraints for diesel_models::Customer {
+ fn unique_constraints(&self) -> Vec<String> {
+ vec![format!(
+ "customer_{}_{}",
+ self.customer_id, self.merchant_id
+ )]
+ }
+ fn table_name(&self) -> &str {
+ "Customer"
+ }
+}
+
#[cfg(not(feature = "payouts"))]
impl<T: DatabaseStore> PayoutAttemptInterface for KVRouterStore<T> {}
#[cfg(not(feature = "payouts"))]
|
feat
|
Customer kv impl (#4267)
|
3292960996834f93095f96f05b18ce28adceb374
|
2023-02-07 20:20:51
|
Nishant Joshi
|
feat: add tick interval to drainer (#517)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 121d07617e3..3ddbab98768 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -188,4 +188,5 @@ batch_size = 200 # Specifies the batch size the producer will push under a singl
stream_name = "DRAINER_STREAM" # Specifies the stream name to be used by the drainer
num_partitions = 64 # Specifies the number of partitions the stream will be divided into
max_read_count = 100 # Specifies the maximum number of entries that would be read from redis stream in one call
-shutdown_interval = 1000 # Specifies how much time to wait, while waiting for threads to complete execution
+shutdown_interval = 1000 # Specifies how much time to wait, while waiting for threads to complete execution (in milliseconds)
+loop_interval = 500 # Specifies how much time to wait after checking all the possible streams in completed (in milliseconds)
diff --git a/crates/drainer/src/lib.rs b/crates/drainer/src/lib.rs
index bb7e5d1e2b9..6ab12874950 100644
--- a/crates/drainer/src/lib.rs
+++ b/crates/drainer/src/lib.rs
@@ -19,12 +19,15 @@ pub async fn start_drainer(
number_of_streams: u8,
max_read_count: u64,
shutdown_interval: u32,
+ loop_interval: u32,
) -> errors::DrainerResult<()> {
let mut stream_index: u8 = 0;
let mut jobs_picked: u8 = 0;
let mut shutdown_interval =
tokio::time::interval(std::time::Duration::from_millis(shutdown_interval.into()));
+ let mut loop_interval =
+ tokio::time::interval(std::time::Duration::from_millis(loop_interval.into()));
let signal =
get_allowed_signals()
@@ -49,8 +52,12 @@ pub async fn start_drainer(
));
jobs_picked += 1;
}
- (stream_index, jobs_picked) =
- utils::increment_stream_index((stream_index, jobs_picked), number_of_streams);
+ (stream_index, jobs_picked) = utils::increment_stream_index(
+ (stream_index, jobs_picked),
+ number_of_streams,
+ &mut loop_interval,
+ )
+ .await;
}
Ok(()) | Err(oneshot::error::TryRecvError::Closed) => {
logger::info!("Awaiting shutdown!");
diff --git a/crates/drainer/src/main.rs b/crates/drainer/src/main.rs
index 18238c7684e..59fa5fb375c 100644
--- a/crates/drainer/src/main.rs
+++ b/crates/drainer/src/main.rs
@@ -19,6 +19,7 @@ async fn main() -> DrainerResult<()> {
let number_of_streams = store.config.drainer_num_partitions;
let max_read_count = conf.drainer.max_read_count;
let shutdown_intervals = conf.drainer.shutdown_interval;
+ let loop_interval = conf.drainer.loop_interval;
let _guard = logger::setup(&conf.log).change_context(errors::DrainerError::MetricsError)?;
@@ -29,6 +30,7 @@ async fn main() -> DrainerResult<()> {
number_of_streams,
max_read_count,
shutdown_intervals,
+ loop_interval,
)
.await?;
diff --git a/crates/drainer/src/settings.rs b/crates/drainer/src/settings.rs
index 2f616b43d0f..f77853f1b80 100644
--- a/crates/drainer/src/settings.rs
+++ b/crates/drainer/src/settings.rs
@@ -45,6 +45,7 @@ pub struct DrainerSettings {
pub num_partitions: u8,
pub max_read_count: u64,
pub shutdown_interval: u32, // in milliseconds
+ pub loop_interval: u32, // in milliseconds
}
impl Default for Database {
@@ -67,6 +68,7 @@ impl Default for DrainerSettings {
num_partitions: 64,
max_read_count: 100,
shutdown_interval: 1000, // in milliseconds
+ loop_interval: 500, // in milliseconds
}
}
}
diff --git a/crates/drainer/src/utils.rs b/crates/drainer/src/utils.rs
index 1965d26068d..c06615759f1 100644
--- a/crates/drainer/src/utils.rs
+++ b/crates/drainer/src/utils.rs
@@ -124,8 +124,13 @@ pub fn parse_stream_entries<'a>(
// Here the output is in the format (stream_index, jobs_picked),
// similar to the first argument of the function
-pub fn increment_stream_index((index, jobs_picked): (u8, u8), total_streams: u8) -> (u8, u8) {
+pub async fn increment_stream_index(
+ (index, jobs_picked): (u8, u8),
+ total_streams: u8,
+ interval: &mut tokio::time::Interval,
+) -> (u8, u8) {
if index == total_streams - 1 {
+ interval.tick().await;
match jobs_picked {
0 => metrics::CYCLES_COMPLETED_UNSUCCESSFULLY.add(&metrics::CONTEXT, 1, &[]),
_ => metrics::CYCLES_COMPLETED_SUCCESSFULLY.add(&metrics::CONTEXT, 1, &[]),
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index a8410e40e7d..00f2e660812 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -116,6 +116,8 @@ impl Default for super::settings::DrainerSettings {
stream_name: "DRAINER_STREAM".into(),
num_partitions: 64,
max_read_count: 100,
+ shutdown_interval: 1000,
+ loop_interval: 500,
}
}
}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index b4c3bcc6edc..71453cabaa0 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -194,6 +194,8 @@ pub struct DrainerSettings {
pub stream_name: String,
pub num_partitions: u8,
pub max_read_count: u64,
+ pub shutdown_interval: u32, // in milliseconds
+ pub loop_interval: u32, // in milliseconds
}
#[derive(Debug, Clone, Default, Deserialize)]
|
feat
|
add tick interval to drainer (#517)
|
6a5b49397adc402f7ce50543c817df3f11ca46ea
|
2024-08-12 13:14:10
|
awasthi21
|
feat(connector): [WELLSFARGO_PAYOUT] PR template code (#5567)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index d01d67cc684..b9ac37705a3 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -252,6 +252,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 16b715b7e73..32af0a86b12 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -90,6 +90,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 6bf81d32424..48414e7618a 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -94,6 +94,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://gateway.transit-pass.com/"
volt.base_url = "https://api.volt.io/"
wellsfargo.base_url = "https://api.cybersource.com/"
+wellsfargopayout.base_url = "https://api.wellsfargo.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index e1e346a8253..9450548bcfa 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -94,6 +94,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
diff --git a/config/development.toml b/config/development.toml
index 1b82a36dc0f..45c5b1a2a25 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -154,6 +154,7 @@ cards = [
"tsys",
"volt",
"wellsfargo",
+ "wellsfargopayout",
"wise",
"worldline",
"worldpay",
@@ -255,6 +256,7 @@ trustpay.base_url = "https://test-tpgw.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
zen.base_url = "https://api.zen-test.com/"
zen.secondary_base_url = "https://secure.zen-test.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index a523715919c..fb8de667290 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -181,6 +181,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
@@ -254,6 +255,7 @@ cards = [
"tsys",
"volt",
"wellsfargo",
+ "wellsfargopayout",
"wise",
"worldline",
"worldpay",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index eed29b1aa0d..cf5585b4dc2 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -132,10 +132,10 @@ pub enum Connector {
Stripe,
Threedsecureio,
Trustpay,
- // Tsys,
Tsys,
Volt,
Wellsfargo,
+ // Wellsfargopayout,
Wise,
Worldline,
Worldpay,
@@ -256,6 +256,7 @@ impl Connector {
| Self::Tsys
| Self::Volt
| Self::Wellsfargo
+ // | Self::Wellsfargopayout
| Self::Wise
| Self::Worldline
| Self::Worldpay
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 7f8f878dc91..a76a0203c1e 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -249,6 +249,7 @@ pub enum RoutableConnectors {
Tsys,
Volt,
Wellsfargo,
+ // Wellsfargopayout,
Wise,
Worldline,
Worldpay,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index cb3fa0313c1..60dc93d0576 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -79,6 +79,7 @@ pub struct Connectors {
pub tsys: ConnectorParams,
pub volt: ConnectorParams,
pub wellsfargo: ConnectorParams,
+ pub wellsfargopayout: ConnectorParams,
pub wise: ConnectorParams,
pub worldline: ConnectorParams,
pub worldpay: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index f97d428c178..5ceb8845b70 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -60,6 +60,7 @@ pub mod tsys;
pub mod utils;
pub mod volt;
pub mod wellsfargo;
+pub mod wellsfargopayout;
pub mod wise;
pub mod worldline;
pub mod worldpay;
@@ -87,6 +88,6 @@ pub use self::{
powertranz::Powertranz, prophetpay::Prophetpay, rapyd::Rapyd, razorpay::Razorpay,
riskified::Riskified, shift4::Shift4, signifyd::Signifyd, square::Square, stripe::Stripe,
threedsecureio::Threedsecureio, trustpay::Trustpay, tsys::Tsys, volt::Volt,
- wellsfargo::Wellsfargo, wise::Wise, worldline::Worldline, worldpay::Worldpay, zen::Zen,
- zsl::Zsl,
+ wellsfargo::Wellsfargo, wellsfargopayout::Wellsfargopayout, wise::Wise, worldline::Worldline,
+ worldpay::Worldpay, zen::Zen, zsl::Zsl,
};
diff --git a/crates/router/src/connector/wellsfargopayout.rs b/crates/router/src/connector/wellsfargopayout.rs
new file mode 100644
index 00000000000..51b303494bb
--- /dev/null
+++ b/crates/router/src/connector/wellsfargopayout.rs
@@ -0,0 +1,583 @@
+pub mod transformers;
+
+use common_utils::types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector};
+use error_stack::{report, ResultExt};
+use masking::ExposeInterface;
+use transformers as wellsfargopayout;
+
+use super::utils::{self as connector_utils};
+use crate::{
+ configs::settings,
+ core::errors::{self, CustomResult},
+ events::connector_api_logs::ConnectorEvent,
+ headers,
+ services::{
+ self,
+ request::{self, Mask},
+ ConnectorIntegration, ConnectorValidation,
+ },
+ types::{
+ self,
+ api::{self, ConnectorCommon, ConnectorCommonExt},
+ ErrorResponse, RequestContent, Response,
+ },
+ utils::BytesExt,
+};
+
+#[derive(Clone)]
+pub struct Wellsfargopayout {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Wellsfargopayout {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Wellsfargopayout {}
+impl api::PaymentSession for Wellsfargopayout {}
+impl api::ConnectorAccessToken for Wellsfargopayout {}
+impl api::MandateSetup for Wellsfargopayout {}
+impl api::PaymentAuthorize for Wellsfargopayout {}
+impl api::PaymentSync for Wellsfargopayout {}
+impl api::PaymentCapture for Wellsfargopayout {}
+impl api::PaymentVoid for Wellsfargopayout {}
+impl api::Refund for Wellsfargopayout {}
+impl api::RefundExecute for Wellsfargopayout {}
+impl api::RefundSync for Wellsfargopayout {}
+impl api::PaymentToken for Wellsfargopayout {}
+
+impl
+ ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Wellsfargopayout
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Wellsfargopayout
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &types::RouterData<Flow, Request, Response>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Wellsfargopayout {
+ fn id(&self) -> &'static str {
+ "wellsfargopayout"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Minor
+ // todo!()
+ // TODO! Check connector documentation, on which unit they are processing the currency.
+ // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
+ // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
+ connectors.wellsfargopayout.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &types::ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let auth = wellsfargopayout::WellsfargopayoutAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: wellsfargopayout::WellsfargopayoutErrorResponse = res
+ .response
+ .parse_struct("WellsfargopayoutErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Wellsfargopayout {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Wellsfargopayout
+{
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Wellsfargopayout
+{
+}
+
+impl
+ ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Wellsfargopayout
+{
+}
+
+impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+ for Wellsfargopayout
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsAuthorizeRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data =
+ wellsfargopayout::WellsfargopayoutRouterData::from((amount, req));
+ let connector_req =
+ wellsfargopayout::WellsfargopayoutPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: wellsfargopayout::WellsfargopayoutPaymentsResponse = res
+ .response
+ .parse_struct("Wellsfargopayout PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ 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<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
+ for Wellsfargopayout
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsSyncRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: wellsfargopayout::WellsfargopayoutPaymentsResponse = res
+ .response
+ .parse_struct("wellsfargopayout PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ 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<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
+ for Wellsfargopayout
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsCaptureRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &types::PaymentsCaptureRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: wellsfargopayout::WellsfargopayoutPaymentsResponse = res
+ .response
+ .parse_struct("Wellsfargopayout PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ 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<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
+ for Wellsfargopayout
+{
+}
+
+impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData>
+ for Wellsfargopayout
+{
+ fn get_headers(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::RefundsRouterData<api::Execute>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = connector_utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data =
+ wellsfargopayout::WellsfargopayoutRouterData::from((refund_amount, req));
+ let connector_req =
+ wellsfargopayout::WellsfargopayoutRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ 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)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundsRouterData<api::Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
+ let response: wellsfargopayout::RefundResponse = res
+ .response
+ .parse_struct("wellsfargopayout RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ 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<api::RSync, types::RefundsData, types::RefundsResponseData>
+ for Wellsfargopayout
+{
+ fn get_headers(
+ &self,
+ req: &types::RefundSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::RefundSyncRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &types::RefundSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::RefundSyncRouterData, errors::ConnectorError> {
+ let response: wellsfargopayout::RefundResponse = res
+ .response
+ .parse_struct("wellsfargopayout RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl api::IncomingWebhook for Wellsfargopayout {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
diff --git a/crates/router/src/connector/wellsfargopayout/transformers.rs b/crates/router/src/connector/wellsfargopayout/transformers.rs
new file mode 100644
index 00000000000..e335c3cf59a
--- /dev/null
+++ b/crates/router/src/connector/wellsfargopayout/transformers.rs
@@ -0,0 +1,241 @@
+use common_utils::types::StringMinorUnit;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ connector::utils::PaymentsAuthorizeRequestData,
+ core::errors,
+ types::{self, api, domain, storage::enums},
+};
+
+//TODO: Fill the struct with respective fields
+pub struct WellsfargopayoutRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for WellsfargopayoutRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct WellsfargopayoutPaymentsRequest {
+ amount: StringMinorUnit,
+ card: WellsfargopayoutCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct WellsfargopayoutCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&WellsfargopayoutRouterData<&types::PaymentsAuthorizeRouterData>>
+ for WellsfargopayoutPaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &WellsfargopayoutRouterData<&types::PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ domain::PaymentMethodData::Card(req_card) => {
+ let card = WellsfargopayoutCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct WellsfargopayoutAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&types::ConnectorAuthType> for WellsfargopayoutAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum WellsfargopayoutPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<WellsfargopayoutPaymentStatus> for enums::AttemptStatus {
+ fn from(item: WellsfargopayoutPaymentStatus) -> Self {
+ match item {
+ WellsfargopayoutPaymentStatus::Succeeded => Self::Charged,
+ WellsfargopayoutPaymentStatus::Failed => Self::Failure,
+ WellsfargopayoutPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct WellsfargopayoutPaymentsResponse {
+ status: WellsfargopayoutPaymentStatus,
+ id: String,
+}
+
+impl<F, T>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ WellsfargopayoutPaymentsResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, T, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ WellsfargopayoutPaymentsResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: enums::AttemptStatus::from(item.response.status),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct WellsfargopayoutRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&WellsfargopayoutRouterData<&types::RefundsRouterData<F>>>
+ for WellsfargopayoutRefundRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &WellsfargopayoutRouterData<&types::RefundsRouterData<F>>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
+ for types::RefundsRouterData<api::Execute>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::RSync, RefundResponse>>
+ for types::RefundsRouterData<api::RSync>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::RefundsResponseRouterData<api::RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct WellsfargopayoutErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
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 92ec7c0094d..fc530d192e6 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -692,6 +692,7 @@ default_imp_for_new_connector_integration_payment!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 893cc957bb2..5a346d2368b 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -232,6 +232,7 @@ default_imp_for_complete_authorize!(
connector::Volt,
connector::Wise,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -322,6 +323,7 @@ default_imp_for_webhook_source_verification!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -414,6 +416,7 @@ default_imp_for_create_customer!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -496,6 +499,7 @@ default_imp_for_connector_redirect_response!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -577,6 +581,7 @@ default_imp_for_connector_request_id!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -672,6 +677,7 @@ default_imp_for_accept_dispute!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -786,6 +792,7 @@ default_imp_for_file_upload!(
connector::Volt,
connector::Opennode,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -878,6 +885,7 @@ default_imp_for_submit_evidence!(
connector::Volt,
connector::Opennode,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -971,6 +979,7 @@ default_imp_for_defend_dispute!(
connector::Volt,
connector::Opennode,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -1069,6 +1078,7 @@ default_imp_for_pre_processing_steps!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -1146,6 +1156,7 @@ default_imp_for_post_processing_steps!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -1223,6 +1234,7 @@ default_imp_for_payouts!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1313,6 +1325,7 @@ default_imp_for_payouts_create!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1406,6 +1419,7 @@ default_imp_for_payouts_retrieve!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -1502,6 +1516,7 @@ default_imp_for_payouts_eligibility!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1589,6 +1604,7 @@ default_imp_for_payouts_fulfill!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1680,6 +1696,7 @@ default_imp_for_payouts_cancel!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1773,6 +1790,7 @@ default_imp_for_payouts_quote!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1865,6 +1883,7 @@ default_imp_for_payouts_recipient!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Worldline,
connector::Worldpay,
connector::Zen,
@@ -1961,6 +1980,7 @@ default_imp_for_payouts_recipient_account!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2055,6 +2075,7 @@ default_imp_for_approve!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2149,6 +2170,7 @@ default_imp_for_reject!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2230,6 +2252,7 @@ default_imp_for_fraud_check!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2324,6 +2347,7 @@ default_imp_for_frm_sale!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2418,6 +2442,7 @@ default_imp_for_frm_checkout!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2512,6 +2537,7 @@ default_imp_for_frm_transaction!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2606,6 +2632,7 @@ default_imp_for_frm_fulfillment!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2700,6 +2727,7 @@ default_imp_for_frm_record_return!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -2792,6 +2820,7 @@ default_imp_for_incremental_authorization!(
connector::Trustpay,
connector::Tsys,
connector::Volt,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -3036,6 +3065,7 @@ default_imp_for_connector_authentication!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
@@ -3125,6 +3155,7 @@ default_imp_for_authorize_session_token!(
connector::Tsys,
connector::Volt,
connector::Wellsfargo,
+ connector::Wellsfargopayout,
connector::Wise,
connector::Worldline,
connector::Worldpay,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index fa04ae2ec14..7384b67367f 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -471,6 +471,9 @@ impl ConnectorData {
enums::Connector::Wellsfargo => {
Ok(ConnectorEnum::Old(Box::new(&connector::Wellsfargo)))
}
+ // enums::Connector::Wellsfargopayout => {
+ // Ok(Box::new(connector::Wellsfargopayout::new()))
+ // }
enums::Connector::Zen => Ok(ConnectorEnum::Old(Box::new(&connector::Zen))),
enums::Connector::Zsl => Ok(ConnectorEnum::Old(Box::new(&connector::Zsl))),
enums::Connector::Plaid => {
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index fe65e848857..a6bc5175b46 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -299,6 +299,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
api_enums::Connector::Tsys => Self::Tsys,
api_enums::Connector::Volt => Self::Volt,
api_enums::Connector::Wellsfargo => Self::Wellsfargo,
+ // api_enums::Connector::Wellsfargopayout => Self::Wellsfargopayout,
api_enums::Connector::Wise => Self::Wise,
api_enums::Connector::Worldline => Self::Worldline,
api_enums::Connector::Worldpay => Self::Worldpay,
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index a701f11748e..4c220a0a34d 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -73,6 +73,7 @@ mod tsys;
mod utils;
mod volt;
mod wellsfargo;
+// mod wellsfargopayout;
#[cfg(feature = "payouts")]
mod wise;
mod worldline;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 278bffa6aed..d3accafdbcf 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -257,3 +257,8 @@ api_secret = "Secret key"
[paybox]
api_key="API Key"
+
+[wellsfargopayout]
+api_key = "Consumer Key"
+key1 = "Gateway Entity Id"
+api_secret = "Consumer Secret"
\ No newline at end of file
diff --git a/crates/router/tests/connectors/wellsfargopayout.rs b/crates/router/tests/connectors/wellsfargopayout.rs
new file mode 100644
index 00000000000..7612abb6501
--- /dev/null
+++ b/crates/router/tests/connectors/wellsfargopayout.rs
@@ -0,0 +1,420 @@
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct WellsfargopayoutTest;
+impl ConnectorActions for WellsfargopayoutTest {}
+impl utils::Connector for WellsfargopayoutTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Wellsfargopayout;
+ api::ConnectorData {
+ connector: Box::new(Wellsfargopayout::new()),
+ connector_name: types::Connector::Wellsfargopayout,
+ get_token: types::api::GetToken::Connector,
+ merchant_connector_id: None,
+ }
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .wellsfargopayout
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "wellsfargopayout".to_string()
+ }
+}
+
+static CONNECTOR: WellsfargopayoutTest = WellsfargopayoutTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: api::PaymentMethodData::Card(api::Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 154e4e28fd0..671f9dae5ca 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -77,6 +77,7 @@ pub struct ConnectorAuthentication {
pub tsys: Option<SignatureKey>,
pub volt: Option<HeaderKey>,
pub wellsfargo: Option<HeaderKey>,
+ // pub wellsfargopayout: Option<HeaderKey>,
pub wise: Option<BodyKey>,
pub worldpay: Option<BodyKey>,
pub worldline: Option<SignatureKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 3fa9bb01c4b..237c773e851 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -146,6 +146,7 @@ trustpay.base_url_bank_redirects = "https://aapi.trustpay.eu/"
tsys.base_url = "https://stagegw.transnox.com/"
volt.base_url = "https://api.sandbox.volt.io/"
wellsfargo.base_url = "https://apitest.cybersource.com/"
+wellsfargopayout.base_url = "https://api-sandbox.wellsfargo.com/"
worldline.base_url = "https://eu.sandbox.api-ingenico.com/"
worldpay.base_url = "https://try.access.worldpay.com/"
wise.base_url = "https://api.sandbox.transferwise.tech/"
@@ -219,6 +220,7 @@ cards = [
"tsys",
"volt",
"wellsfargo",
+ "wellsfargopayout",
"wise",
"worldline",
"worldpay",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 21740df39fa..5fec357f157 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe threedsecureio trustpay tsys volt wellsfargo wise worldline worldpay zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless gpayments helcim iatapay itaubank klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe threedsecureio trustpay tsys volt wellsfargo wellsfargopayout wise worldline worldpay zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res=`echo ${sorted[@]}`
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
[WELLSFARGO_PAYOUT] PR template code (#5567)
|
5bc7592af3c8587a402809c050e58b257b7af8bf
|
2023-08-10 19:38:15
|
DEEPANSHU BANSAL
|
fix(connector): [STAX] Add currency filter for payments through Stax (#1911)
| false
|
diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs
index 7cb3e8dda27..c4b8dd326aa 100644
--- a/crates/router/src/connector/stax/transformers.rs
+++ b/crates/router/src/connector/stax/transformers.rs
@@ -26,6 +26,13 @@ pub struct StaxPaymentsRequest {
impl TryFrom<&types::PaymentsAuthorizeRouterData> for StaxPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
+ if item.request.currency != enums::Currency::USD {
+ Err(errors::ConnectorError::NotSupported {
+ message: item.request.currency.to_string(),
+ connector: "Stax",
+ payment_experience: api::enums::PaymentExperience::RedirectToUrl.to_string(),
+ })?
+ }
match item.request.payment_method_data.clone() {
api::PaymentMethodData::Card(_) => {
let pre_auth = !item.request.is_auto_capture()?;
|
fix
|
[STAX] Add currency filter for payments through Stax (#1911)
|
2c1987b77562fc83579d276dadc57452aa26f94c
|
2024-09-04 05:53:59
|
github-actions
|
chore(version): 2024.09.04.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11db392aba7..6f21f9782bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,26 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.09.04.0
+
+### Features
+
+- **analytics:** Refactor and introduce analytics APIs to accommodate OrgLevel, MerchantLevel and ProfileLevel authentication ([#5729](https://github.com/juspay/hyperswitch/pull/5729)) ([`8ed942c`](https://github.com/juspay/hyperswitch/commit/8ed942c6cd06b5699fc9379ba52a881b891044dc))
+- **connector:** [DEUTSCHE] Add template code ([#5774](https://github.com/juspay/hyperswitch/pull/5774)) ([`42f945f`](https://github.com/juspay/hyperswitch/commit/42f945fd5eda89d550c52741ca109d53f72260c0))
+
+### Bug Fixes
+
+- **connector:** Skip 3DS in `network_transaction_id` flow for cybersource ([#5781](https://github.com/juspay/hyperswitch/pull/5781)) ([`84f079c`](https://github.com/juspay/hyperswitch/commit/84f079ccd0e90f8a1e42c9a2744e9f9d336933eb))
+- **router:** Make customer details None in the `Psync` flow if the customer is deleted ([#5732](https://github.com/juspay/hyperswitch/pull/5732)) ([`98cfc13`](https://github.com/juspay/hyperswitch/commit/98cfc13f537780a473594533792f5ebc0e81d899))
+
+### Refactors
+
+- **euclid:** Check the authenticity of profile_id being used ([#5647](https://github.com/juspay/hyperswitch/pull/5647)) ([`0fb8e85`](https://github.com/juspay/hyperswitch/commit/0fb8e85ee88c92aba2f5dc8144e3b2569eb33b1a))
+
+**Full Changelog:** [`2024.09.03.1...2024.09.04.0`](https://github.com/juspay/hyperswitch/compare/2024.09.03.1...2024.09.04.0)
+
+- - -
+
## 2024.09.03.1
### Features
|
chore
|
2024.09.04.0
|
75648262e7f741351c1149cd01083065d17bde7f
|
2024-10-04 15:06:14
|
Sakil Mostak
|
fix(router): Persist card_network if present for non co-badged cards (#6212)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index d90c577152d..cdab5a05c4b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1846,6 +1846,7 @@ dependencies = [
"common_utils",
"error-stack",
"masking",
+ "regex",
"router_env",
"serde",
"serde_json",
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 9d606dacb9f..99e2a169752 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -8,6 +8,7 @@ use cards::CardNumber;
use common_utils::{
consts::default_payments_list_limit,
crypto,
+ errors::ValidationError,
ext_traits::{ConfigExt, Encode, ValueExt},
hashing::HashedString,
id_type,
@@ -1396,8 +1397,11 @@ impl GetAddressFromPaymentMethodData for Card {
}
impl Card {
- fn apply_additional_card_info(&self, additional_card_info: AdditionalCardInfo) -> Self {
- Self {
+ fn apply_additional_card_info(
+ &self,
+ additional_card_info: AdditionalCardInfo,
+ ) -> Result<Self, error_stack::Report<ValidationError>> {
+ Ok(Self {
card_number: self.card_number.clone(),
card_exp_month: self.card_exp_month.clone(),
card_exp_year: self.card_exp_year.clone(),
@@ -1410,7 +1414,7 @@ impl Card {
card_network: self
.card_network
.clone()
- .or(additional_card_info.card_network),
+ .or(additional_card_info.card_network.clone()),
card_type: self.card_type.clone().or(additional_card_info.card_type),
card_issuing_country: self
.card_issuing_country
@@ -1418,7 +1422,7 @@ impl Card {
.or(additional_card_info.card_issuing_country),
bank_code: self.bank_code.clone().or(additional_card_info.bank_code),
nick_name: self.nick_name.clone(),
- }
+ })
}
}
@@ -1858,16 +1862,16 @@ impl PaymentMethodData {
pub fn apply_additional_payment_data(
&self,
additional_payment_data: AdditionalPaymentData,
- ) -> Self {
+ ) -> Result<Self, error_stack::Report<ValidationError>> {
if let AdditionalPaymentData::Card(additional_card_info) = additional_payment_data {
match self {
- Self::Card(card) => {
- Self::Card(card.apply_additional_card_info(*additional_card_info))
- }
- _ => self.to_owned(),
+ Self::Card(card) => Ok(Self::Card(
+ card.apply_additional_card_info(*additional_card_info)?,
+ )),
+ _ => Ok(self.to_owned()),
}
} else {
- self.to_owned()
+ Ok(self.to_owned())
}
}
diff --git a/crates/cards/Cargo.toml b/crates/cards/Cargo.toml
index 1178568d72e..b6b9f2b886f 100644
--- a/crates/cards/Cargo.toml
+++ b/crates/cards/Cargo.toml
@@ -14,6 +14,7 @@ error-stack = "0.4.1"
serde = { version = "1.0.197", features = ["derive"] }
thiserror = "1.0.58"
time = "0.3.35"
+regex = "1.10.4"
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils" }
diff --git a/crates/cards/src/validate.rs b/crates/cards/src/validate.rs
index 1af9bf582b0..de450269890 100644
--- a/crates/cards/src/validate.rs
+++ b/crates/cards/src/validate.rs
@@ -1,6 +1,10 @@
-use std::{fmt, ops::Deref, str::FromStr};
+use std::{collections::HashMap, fmt, ops::Deref, str::FromStr};
+use common_utils::errors::ValidationError;
+use error_stack::report;
use masking::{PeekInterface, Strategy, StrongSecret, WithType};
+use regex::Regex;
+use router_env::once_cell::sync::Lazy;
#[cfg(not(target_arch = "wasm32"))]
use router_env::{logger, which as router_env_which, Env};
use serde::{Deserialize, Deserializer, Serialize};
@@ -46,6 +50,54 @@ impl CardNumber {
.rev()
.collect::<String>()
}
+ pub fn is_cobadged_card(&self) -> Result<bool, error_stack::Report<ValidationError>> {
+ /// Regex to identify card networks
+ static CARD_NETWORK_REGEX: Lazy<HashMap<&str, Result<Regex, regex::Error>>> = Lazy::new(
+ || {
+ let mut map = HashMap::new();
+ map.insert("Mastercard", Regex::new(r"^(5[1-5][0-9]{14}|2(2(2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7([0-1][0-9]|20))[0-9]{12})$"));
+ map.insert("American Express", Regex::new(r"^3[47][0-9]{13}$"));
+ map.insert("Visa", Regex::new(r"^4[0-9]{12}(?:[0-9]{3})?$"));
+ map.insert("Discover", Regex::new(r"^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$"));
+ map.insert(
+ "Maestro",
+ Regex::new(r"^(5018|5081|5044|504681|504993|5020|502260|5038|603845|603123|6304|6759|676[1-3]|6220|504834|504817|504645|504775|600206|627741)"),
+ );
+ map.insert(
+ "RuPay",
+ Regex::new(r"^(508227|508[5-9]|603741|60698[5-9]|60699|607[0-8]|6079[0-7]|60798[0-4]|60800[1-9]|6080[1-9]|608[1-4]|608500|6521[5-9]|652[2-9]|6530|6531[0-4]|817290|817368|817378|353800)"),
+ );
+ map.insert("Diners Club", Regex::new(r"^(36|38|30[0-5])"));
+ map.insert(
+ "JCB",
+ Regex::new(r"^(3(?:088|096|112|158|337|5(?:2[89]|[3-8][0-9]))\d{12})$"),
+ );
+ map.insert("CarteBlanche", Regex::new(r"^389[0-9]{11}$"));
+ map.insert("Sodex", Regex::new(r"^(637513)"));
+ map.insert("BAJAJ", Regex::new(r"^(203040)"));
+ map
+ },
+ );
+ let mut no_of_supported_card_networks = 0;
+
+ let card_number_str = self.get_card_no();
+ for (_, regex) in CARD_NETWORK_REGEX.iter() {
+ let card_regex = match regex.as_ref() {
+ Ok(regex) => Ok(regex),
+ Err(_) => Err(report!(ValidationError::InvalidValue {
+ message: "Invalid regex expression".into(),
+ })),
+ }?;
+
+ if card_regex.is_match(&card_number_str) {
+ no_of_supported_card_networks += 1;
+ if no_of_supported_card_networks > 1 {
+ break;
+ }
+ }
+ }
+ Ok(no_of_supported_card_networks > 1)
+ }
}
impl FromStr for CardNumber {
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index dfb0963c70a..50ce6aea0f4 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1112,6 +1112,38 @@ pub enum CardBrand {
Visa,
MC,
Amex,
+ Argencard,
+ Bcmc,
+ Bijcard,
+ Cabal,
+ Cartebancaire,
+ Codensa,
+ Cup,
+ Dankort,
+ Diners,
+ Discover,
+ Electron,
+ Elo,
+ Forbrugsforeningen,
+ Hiper,
+ Hipercard,
+ Jcb,
+ Karenmillen,
+ Laser,
+ Maestro,
+ Maestrouk,
+ Mcalphabankbonus,
+ Mir,
+ Naranja,
+ Oasis,
+ Rupay,
+ Shopping,
+ Solo,
+ Troy,
+ Uatp,
+ Visaalphabankbonus,
+ Visadankort,
+ Warehouse,
}
#[derive(Default, Debug, Serialize, Deserialize)]
@@ -1931,6 +1963,22 @@ impl<'a> TryFrom<&domain::GiftCardData> for AdyenPaymentMethod<'a> {
}
}
+fn get_adyen_card_network(card_network: common_enums::CardNetwork) -> Option<CardBrand> {
+ match card_network {
+ common_enums::CardNetwork::Visa => Some(CardBrand::Visa),
+ common_enums::CardNetwork::Mastercard => Some(CardBrand::MC),
+ common_enums::CardNetwork::CartesBancaires => Some(CardBrand::Cartebancaire),
+ common_enums::CardNetwork::AmericanExpress => Some(CardBrand::Amex),
+ common_enums::CardNetwork::JCB => Some(CardBrand::Jcb),
+ common_enums::CardNetwork::DinersClub => Some(CardBrand::Diners),
+ common_enums::CardNetwork::Discover => Some(CardBrand::Discover),
+ common_enums::CardNetwork::UnionPay => Some(CardBrand::Cup),
+ common_enums::CardNetwork::RuPay => Some(CardBrand::Rupay),
+ common_enums::CardNetwork::Maestro => Some(CardBrand::Maestro),
+ common_enums::CardNetwork::Interac => None,
+ }
+}
+
impl<'a> TryFrom<(&domain::Card, Option<Secret<String>>)> for AdyenPaymentMethod<'a> {
type Error = Error;
fn try_from(
@@ -1943,7 +1991,7 @@ impl<'a> TryFrom<(&domain::Card, Option<Secret<String>>)> for AdyenPaymentMethod
expiry_year: card.get_expiry_year_4_digit(),
cvc: Some(card.card_cvc.clone()),
holder_name: card_holder_name,
- brand: None,
+ brand: card.card_network.clone().and_then(get_adyen_card_network),
network_payment_reference: None,
};
Ok(AdyenPaymentMethod::AdyenCard(Box::new(adyen_card)))
@@ -1998,7 +2046,11 @@ impl TryFrom<&utils::CardIssuer> for CardBrand {
utils::CardIssuer::AmericanExpress => Ok(Self::Amex),
utils::CardIssuer::Master => Ok(Self::MC),
utils::CardIssuer::Visa => Ok(Self::Visa),
- _ => Err(errors::ConnectorError::NotImplemented("CardBrand".to_string()).into()),
+ utils::CardIssuer::Maestro => Ok(Self::Maestro),
+ utils::CardIssuer::Discover => Ok(Self::Discover),
+ utils::CardIssuer::DinersClub => Ok(Self::Diners),
+ utils::CardIssuer::JCB => Ok(Self::Jcb),
+ utils::CardIssuer::CarteBlanche => Ok(Self::Cartebancaire),
}
}
}
@@ -2529,8 +2581,12 @@ impl<'a>
payments::MandateReferenceId::NetworkMandateId(network_mandate_id) => {
match item.router_data.request.payment_method_data {
domain::PaymentMethodData::Card(ref card) => {
- let card_issuer = card.get_card_issuer()?;
- let brand = CardBrand::try_from(&card_issuer)?;
+ let brand = match card.card_network.clone().and_then(get_adyen_card_network)
+ {
+ Some(card_network) => card_network,
+ None => CardBrand::try_from(&card.get_card_issuer()?)?,
+ };
+
let card_holder_name = item.router_data.get_optional_billing_full_name();
let adyen_card = AdyenCard {
payment_type: PaymentType::Scheme,
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index f47ab4139e8..b987a6717a1 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -535,6 +535,22 @@ impl From<CardIssuer> for String {
}
}
+fn get_boa_card_type(card_network: common_enums::CardNetwork) -> Option<&'static str> {
+ match card_network {
+ common_enums::CardNetwork::Visa => Some("001"),
+ common_enums::CardNetwork::Mastercard => Some("002"),
+ common_enums::CardNetwork::AmericanExpress => Some("003"),
+ common_enums::CardNetwork::JCB => Some("007"),
+ common_enums::CardNetwork::DinersClub => Some("005"),
+ common_enums::CardNetwork::Discover => Some("004"),
+ common_enums::CardNetwork::CartesBancaires => Some("006"),
+ common_enums::CardNetwork::UnionPay => Some("062"),
+ //"042" is the type code for Masetro Cards(International). For Maestro Cards(UK-Domestic) the mapping should be "024"
+ common_enums::CardNetwork::Maestro => Some("042"),
+ common_enums::CardNetwork::Interac | common_enums::CardNetwork::RuPay => None,
+ }
+}
+
#[derive(Debug, Serialize)]
pub enum PaymentSolution {
ApplePay,
@@ -2418,10 +2434,9 @@ impl TryFrom<&domain::Card> for PaymentInformation {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(ccard: &domain::Card) -> Result<Self, Self::Error> {
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard.card_network.clone().and_then(get_boa_card_type) {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
Ok(Self::Cards(Box::new(CardPaymentInformation {
card: Card {
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 864f77b55dd..38bb016ff25 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -126,10 +126,13 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
let (payment_information, solution) = match item.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(ccard) => {
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard
+ .card_network
+ .clone()
+ .and_then(get_cybersource_card_type)
+ {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
(
PaymentInformation::Cards(Box::new(CardPaymentInformation {
@@ -1161,10 +1164,13 @@ impl
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
let order_information = OrderInformationWithBill::from((item, Some(bill_to)));
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard
+ .card_network
+ .clone()
+ .and_then(get_cybersource_card_type)
+ {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
let security_code = if item
@@ -1336,10 +1342,13 @@ impl
let bill_to = build_bill_to(item.router_data.get_optional_billing(), email)?;
let order_information = OrderInformationWithBill::from((item, bill_to));
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard
+ .card_network
+ .clone()
+ .and_then(get_cybersource_card_type)
+ {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
let payment_information = PaymentInformation::Cards(Box::new(CardPaymentInformation {
@@ -1841,10 +1850,13 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(ccard) => {
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard
+ .card_network
+ .clone()
+ .and_then(get_cybersource_card_type)
+ {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
let payment_information =
PaymentInformation::Cards(Box::new(CardPaymentInformation {
@@ -2565,10 +2577,13 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsPreProcessingRouterData>>
)?;
let payment_information = match payment_method_data {
domain::PaymentMethodData::Card(ccard) => {
- let card_issuer = ccard.get_card_issuer();
- let card_type = match card_issuer {
- Ok(issuer) => Some(String::from(issuer)),
- Err(_) => None,
+ let card_type = match ccard
+ .card_network
+ .clone()
+ .and_then(get_cybersource_card_type)
+ {
+ Some(card_network) => Some(card_network.to_string()),
+ None => ccard.get_card_issuer().ok().map(String::from),
};
Ok(PaymentInformation::Cards(Box::new(
CardPaymentInformation {
@@ -3823,3 +3838,19 @@ pub fn get_error_reason(
(None, None, None) => None,
}
}
+
+fn get_cybersource_card_type(card_network: common_enums::CardNetwork) -> Option<&'static str> {
+ match card_network {
+ common_enums::CardNetwork::Visa => Some("001"),
+ common_enums::CardNetwork::Mastercard => Some("002"),
+ common_enums::CardNetwork::AmericanExpress => Some("003"),
+ common_enums::CardNetwork::JCB => Some("007"),
+ common_enums::CardNetwork::DinersClub => Some("005"),
+ common_enums::CardNetwork::Discover => Some("004"),
+ common_enums::CardNetwork::CartesBancaires => Some("006"),
+ common_enums::CardNetwork::UnionPay => Some("062"),
+ //"042" is the type code for Masetro Cards(International). For Maestro Cards(UK-Domestic) the mapping should be "024"
+ common_enums::CardNetwork::Maestro => Some("042"),
+ common_enums::CardNetwork::Interac | common_enums::CardNetwork::RuPay => None,
+ }
+}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index a81fecba9cf..4f76acc0028 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -88,6 +88,14 @@ pub enum Auth3ds {
Any,
}
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub enum StripeCardNetwork {
+ CartesBancaires,
+ Mastercard,
+ Visa,
+}
+
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(
rename_all = "snake_case",
@@ -220,6 +228,8 @@ pub struct StripeCardData {
pub payment_method_data_card_cvc: Option<Secret<String>>,
#[serde(rename = "payment_method_options[card][request_three_d_secure]")]
pub payment_method_auth_type: Option<Auth3ds>,
+ #[serde(rename = "payment_method_options[card][network]")]
+ pub payment_method_data_card_preferred_network: Option<StripeCardNetwork>,
}
#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripePayLaterData {
@@ -1344,6 +1354,22 @@ fn create_stripe_payment_method(
}
}
+fn get_stripe_card_network(card_network: common_enums::CardNetwork) -> Option<StripeCardNetwork> {
+ match card_network {
+ common_enums::CardNetwork::Visa => Some(StripeCardNetwork::Visa),
+ common_enums::CardNetwork::Mastercard => Some(StripeCardNetwork::Mastercard),
+ common_enums::CardNetwork::CartesBancaires => Some(StripeCardNetwork::CartesBancaires),
+ common_enums::CardNetwork::AmericanExpress
+ | common_enums::CardNetwork::JCB
+ | common_enums::CardNetwork::DinersClub
+ | common_enums::CardNetwork::Discover
+ | common_enums::CardNetwork::UnionPay
+ | common_enums::CardNetwork::Interac
+ | common_enums::CardNetwork::RuPay
+ | common_enums::CardNetwork::Maestro => None,
+ }
+}
+
impl TryFrom<(&domain::Card, Auth3ds)> for StripePaymentMethodData {
type Error = errors::ConnectorError;
fn try_from(
@@ -1356,6 +1382,10 @@ impl TryFrom<(&domain::Card, Auth3ds)> for StripePaymentMethodData {
payment_method_data_card_exp_year: card.card_exp_year.clone(),
payment_method_data_card_cvc: Some(card.card_cvc.clone()),
payment_method_auth_type: Some(payment_method_auth_type),
+ payment_method_data_card_preferred_network: card
+ .card_network
+ .clone()
+ .and_then(get_stripe_card_network),
}))
}
}
@@ -1699,6 +1729,10 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, MinorUnit)> for PaymentIntent
payment_method_data_card_exp_year: card.card_exp_year.clone(),
payment_method_data_card_cvc: None,
payment_method_auth_type: None,
+ payment_method_data_card_preferred_network: card
+ .card_network
+ .clone()
+ .and_then(get_stripe_card_network),
})
}
domain::payments::PaymentMethodData::CardRedirect(_)
diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs
index 9e70cb2b96b..1b93f05d823 100644
--- a/crates/router/src/consts.rs
+++ b/crates/router/src/consts.rs
@@ -2,6 +2,7 @@ pub mod opensearch;
#[cfg(feature = "olap")]
pub mod user;
pub mod user_role;
+
use common_utils::consts;
pub use hyperswitch_interfaces::consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE};
// ID generation
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 3782026835b..aac6f961cb2 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4151,7 +4151,10 @@ pub async fn get_additional_payment_data(
pm_data: &domain::PaymentMethodData,
db: &dyn StorageInterface,
profile_id: &id_type::ProfileId,
-) -> Option<api_models::payments::AdditionalPaymentData> {
+) -> Result<
+ Option<api_models::payments::AdditionalPaymentData>,
+ error_stack::Report<errors::ApiErrorResponse>,
+> {
match pm_data {
domain::PaymentMethodData::Card(card_data) => {
//todo!
@@ -4168,17 +4171,29 @@ pub async fn get_additional_payment_data(
}
_ => None,
};
+
+ let card_network = match card_data
+ .card_number
+ .is_cobadged_card()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable(
+ "Card cobadge check failed due to an invalid card network regex",
+ )? {
+ true => card_data.card_network.clone(),
+ false => None,
+ };
+
let last4 = Some(card_data.card_number.get_last4());
if card_data.card_issuer.is_some()
- && card_data.card_network.is_some()
+ && card_network.is_some()
&& card_data.card_type.is_some()
&& card_data.card_issuing_country.is_some()
&& card_data.bank_code.is_some()
{
- Some(api_models::payments::AdditionalPaymentData::Card(Box::new(
- api_models::payments::AdditionalCardInfo {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Card(
+ Box::new(api_models::payments::AdditionalCardInfo {
card_issuer: card_data.card_issuer.to_owned(),
- card_network: card_data.card_network.clone(),
+ card_network,
card_type: card_data.card_type.to_owned(),
card_issuing_country: card_data.card_issuing_country.to_owned(),
bank_code: card_data.bank_code.to_owned(),
@@ -4191,7 +4206,7 @@ pub async fn get_additional_payment_data(
// These are filled after calling the processor / connector
payment_checks: None,
authentication_data: None,
- },
+ }),
)))
} else {
let card_info = card_isin
@@ -4208,7 +4223,7 @@ pub async fn get_additional_payment_data(
api_models::payments::AdditionalPaymentData::Card(Box::new(
api_models::payments::AdditionalCardInfo {
card_issuer: card_info.card_issuer,
- card_network: card_info.card_network.clone(),
+ card_network,
bank_code: card_info.bank_code,
card_type: card_info.card_type,
card_issuing_country: card_info.card_issuing_country,
@@ -4224,7 +4239,7 @@ pub async fn get_additional_payment_data(
},
))
});
- Some(card_info.unwrap_or_else(|| {
+ Ok(Some(card_info.unwrap_or_else(|| {
api_models::payments::AdditionalPaymentData::Card(Box::new(
api_models::payments::AdditionalCardInfo {
card_issuer: None,
@@ -4243,42 +4258,44 @@ pub async fn get_additional_payment_data(
authentication_data: None,
},
))
- }))
+ })))
}
}
domain::PaymentMethodData::BankRedirect(bank_redirect_data) => match bank_redirect_data {
- domain::BankRedirectData::Eps { bank_name, .. } => {
- Some(api_models::payments::AdditionalPaymentData::BankRedirect {
+ domain::BankRedirectData::Eps { bank_name, .. } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
bank_name: bank_name.to_owned(),
details: None,
- })
- }
- domain::BankRedirectData::Ideal { bank_name, .. } => {
- Some(api_models::payments::AdditionalPaymentData::BankRedirect {
+ },
+ )),
+ domain::BankRedirectData::Ideal { bank_name, .. } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
bank_name: bank_name.to_owned(),
details: None,
- })
- }
+ },
+ )),
domain::BankRedirectData::BancontactCard {
card_number,
card_exp_month,
card_exp_year,
card_holder_name,
- } => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
- bank_name: None,
- details: Some(
- payment_additional_types::BankRedirectDetails::BancontactCard(Box::new(
- payment_additional_types::BancontactBankRedirectAdditionalData {
- last4: card_number.as_ref().map(|c| c.get_last4()),
- card_exp_month: card_exp_month.clone(),
- card_exp_year: card_exp_year.clone(),
- card_holder_name: card_holder_name.clone(),
- },
- )),
- ),
- }),
- domain::BankRedirectData::Blik { blik_code } => {
- Some(api_models::payments::AdditionalPaymentData::BankRedirect {
+ } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
+ bank_name: None,
+ details: Some(
+ payment_additional_types::BankRedirectDetails::BancontactCard(Box::new(
+ payment_additional_types::BancontactBankRedirectAdditionalData {
+ last4: card_number.as_ref().map(|c| c.get_last4()),
+ card_exp_month: card_exp_month.clone(),
+ card_exp_year: card_exp_year.clone(),
+ card_holder_name: card_holder_name.clone(),
+ },
+ )),
+ ),
+ },
+ )),
+ domain::BankRedirectData::Blik { blik_code } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
bank_name: None,
details: blik_code.as_ref().map(|blik_code| {
payment_additional_types::BankRedirectDetails::Blik(Box::new(
@@ -4287,119 +4304,123 @@ pub async fn get_additional_payment_data(
},
))
}),
- })
- }
+ },
+ )),
domain::BankRedirectData::Giropay {
bank_account_bic,
bank_account_iban,
country,
- } => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
- bank_name: None,
- details: Some(payment_additional_types::BankRedirectDetails::Giropay(
- Box::new(
- payment_additional_types::GiropayBankRedirectAdditionalData {
- bic: bank_account_bic
- .as_ref()
- .map(|bic| MaskedSortCode::from(bic.to_owned())),
- iban: bank_account_iban
- .as_ref()
- .map(|iban| MaskedIban::from(iban.to_owned())),
- country: *country,
- },
- ),
- )),
- }),
- _ => Some(api_models::payments::AdditionalPaymentData::BankRedirect {
- bank_name: None,
- details: None,
- }),
+ } => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
+ bank_name: None,
+ details: Some(payment_additional_types::BankRedirectDetails::Giropay(
+ Box::new(
+ payment_additional_types::GiropayBankRedirectAdditionalData {
+ bic: bank_account_bic
+ .as_ref()
+ .map(|bic| MaskedSortCode::from(bic.to_owned())),
+ iban: bank_account_iban
+ .as_ref()
+ .map(|iban| MaskedIban::from(iban.to_owned())),
+ country: *country,
+ },
+ ),
+ )),
+ },
+ )),
+ _ => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankRedirect {
+ bank_name: None,
+ details: None,
+ },
+ )),
},
domain::PaymentMethodData::Wallet(wallet) => match wallet {
domain::WalletData::ApplePay(apple_pay_wallet_data) => {
- Some(api_models::payments::AdditionalPaymentData::Wallet {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: Some(api_models::payments::ApplepayPaymentMethod {
display_name: apple_pay_wallet_data.payment_method.display_name.clone(),
network: apple_pay_wallet_data.payment_method.network.clone(),
pm_type: apple_pay_wallet_data.payment_method.pm_type.clone(),
}),
google_pay: None,
- })
+ }))
}
domain::WalletData::GooglePay(google_pay_pm_data) => {
- Some(api_models::payments::AdditionalPaymentData::Wallet {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
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(),
}),
- })
+ }))
}
- _ => Some(api_models::payments::AdditionalPaymentData::Wallet {
+ _ => Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: None,
- }),
+ })),
},
- domain::PaymentMethodData::PayLater(_) => {
- Some(api_models::payments::AdditionalPaymentData::PayLater { klarna_sdk: None })
- }
- domain::PaymentMethodData::BankTransfer(bank_transfer) => {
- Some(api_models::payments::AdditionalPaymentData::BankTransfer {
+ domain::PaymentMethodData::PayLater(_) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::PayLater { klarna_sdk: None },
+ )),
+ domain::PaymentMethodData::BankTransfer(bank_transfer) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankTransfer {
details: Some((*(bank_transfer.to_owned())).into()),
- })
- }
+ },
+ )),
domain::PaymentMethodData::Crypto(crypto) => {
- Some(api_models::payments::AdditionalPaymentData::Crypto {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Crypto {
details: Some(crypto.to_owned().into()),
- })
+ }))
}
- domain::PaymentMethodData::BankDebit(bank_debit) => {
- Some(api_models::payments::AdditionalPaymentData::BankDebit {
+ domain::PaymentMethodData::BankDebit(bank_debit) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::BankDebit {
details: Some(bank_debit.to_owned().into()),
- })
- }
- domain::PaymentMethodData::MandatePayment => {
- Some(api_models::payments::AdditionalPaymentData::MandatePayment {})
- }
+ },
+ )),
+ domain::PaymentMethodData::MandatePayment => Ok(Some(
+ api_models::payments::AdditionalPaymentData::MandatePayment {},
+ )),
domain::PaymentMethodData::Reward => {
- Some(api_models::payments::AdditionalPaymentData::Reward {})
+ Ok(Some(api_models::payments::AdditionalPaymentData::Reward {}))
}
- domain::PaymentMethodData::RealTimePayment(realtime_payment) => Some(
+ domain::PaymentMethodData::RealTimePayment(realtime_payment) => Ok(Some(
api_models::payments::AdditionalPaymentData::RealTimePayment {
details: Some((*(realtime_payment.to_owned())).into()),
},
- ),
+ )),
domain::PaymentMethodData::Upi(upi) => {
- Some(api_models::payments::AdditionalPaymentData::Upi {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Upi {
details: Some(upi.to_owned().into()),
- })
+ }))
}
- domain::PaymentMethodData::CardRedirect(card_redirect) => {
- Some(api_models::payments::AdditionalPaymentData::CardRedirect {
+ domain::PaymentMethodData::CardRedirect(card_redirect) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::CardRedirect {
details: Some(card_redirect.to_owned().into()),
- })
- }
+ },
+ )),
domain::PaymentMethodData::Voucher(voucher) => {
- Some(api_models::payments::AdditionalPaymentData::Voucher {
+ Ok(Some(api_models::payments::AdditionalPaymentData::Voucher {
details: Some(voucher.to_owned().into()),
- })
+ }))
}
- domain::PaymentMethodData::GiftCard(gift_card) => {
- Some(api_models::payments::AdditionalPaymentData::GiftCard {
+ domain::PaymentMethodData::GiftCard(gift_card) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::GiftCard {
details: Some((*(gift_card.to_owned())).into()),
- })
- }
- domain::PaymentMethodData::CardToken(card_token) => {
- Some(api_models::payments::AdditionalPaymentData::CardToken {
+ },
+ )),
+ domain::PaymentMethodData::CardToken(card_token) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::CardToken {
details: Some(card_token.to_owned().into()),
- })
- }
- domain::PaymentMethodData::OpenBanking(open_banking) => {
- Some(api_models::payments::AdditionalPaymentData::OpenBanking {
+ },
+ )),
+ domain::PaymentMethodData::OpenBanking(open_banking) => Ok(Some(
+ api_models::payments::AdditionalPaymentData::OpenBanking {
details: Some(open_banking.to_owned().into()),
- })
- }
- domain::PaymentMethodData::NetworkToken(_) => None,
+ },
+ )),
+ domain::PaymentMethodData::NetworkToken(_) => Ok(None),
}
}
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 658a02f7d08..fb8f94405ee 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -473,7 +473,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
let additional_pm_data_fut = tokio::spawn(
async move {
Ok(n_request_payment_method_data
- .async_and_then(|payment_method_data| async move {
+ .async_map(|payment_method_data| async move {
helpers::get_additional_payment_data(
&payment_method_data.into(),
store.as_ref(),
@@ -555,12 +555,14 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
);
// Parallel calls - level 2
- let (mandate_details, additional_pm_data, payment_method_billing) = tokio::try_join!(
+ let (mandate_details, additional_pm_info, payment_method_billing) = tokio::try_join!(
utils::flatten_join_error(mandate_details_fut),
utils::flatten_join_error(additional_pm_data_fut),
utils::flatten_join_error(payment_method_billing_future),
)?;
+ let additional_pm_data = additional_pm_info.transpose()?.flatten();
+
let m_helpers::MandateGenericData {
token,
payment_method,
@@ -640,7 +642,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.zip(additional_pm_data)
.map(|(payment_method_data, additional_payment_data)| {
payment_method_data.apply_additional_payment_data(additional_payment_data)
- });
+ })
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Card cobadge check failed due to an invalid card network regex")?;
payment_attempt.payment_method_billing_address_id = payment_method_billing
.as_ref()
@@ -1163,6 +1168,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
.await
})
.await
+ .transpose()?
+ .flatten();
+
+ let encoded_additional_pm_data = additional_pm_data
.as_ref()
.map(Encode::encode_to_value)
.transpose()
@@ -1251,7 +1260,9 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
let m_connector = connector.clone();
let m_capture_method = capture_method;
let m_payment_token = payment_token.clone();
- let m_additional_pm_data = additional_pm_data.clone().or(encode_additional_pm_to_value);
+ let m_additional_pm_data = encoded_additional_pm_data
+ .clone()
+ .or(encode_additional_pm_to_value);
let m_business_sub_label = business_sub_label.clone();
let m_straight_through_algorithm = straight_through_algorithm.clone();
let m_error_code = error_code.clone();
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 0921e38317a..f23405e3551 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -498,7 +498,10 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.zip(additional_payment_data)
.map(|(payment_method_data, additional_payment_data)| {
payment_method_data.apply_additional_payment_data(additional_payment_data)
- });
+ })
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Card cobadge check failed due to an invalid card network regex")?;
let amount = payment_attempt.get_total_amount().into();
@@ -1058,7 +1061,7 @@ impl PaymentCreate {
.and_then(|payment_method_data_request| {
payment_method_data_request.payment_method_data.clone()
})
- .async_and_then(|payment_method_data| async {
+ .async_map(|payment_method_data| async {
helpers::get_additional_payment_data(
&payment_method_data.into(),
&*state.store,
@@ -1066,7 +1069,9 @@ impl PaymentCreate {
)
.await
})
- .await;
+ .await
+ .transpose()?
+ .flatten();
if additional_pm_data.is_none() {
// If recurring payment is made using payment_method_id, then fetch payment_method_data from retrieved payment_method object
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index c69595d1893..3fa44868f0d 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -749,6 +749,10 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
.await
})
.await
+ .transpose()?
+ .flatten();
+
+ let encoded_pm_data = additional_pm_data
.as_ref()
.map(Encode::encode_to_value)
.transpose()
@@ -785,7 +789,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
authentication_type: None,
payment_method,
payment_token: payment_data.token.clone(),
- payment_method_data: additional_pm_data,
+ payment_method_data: encoded_pm_data,
payment_experience,
payment_method_type,
business_sub_label,
|
fix
|
Persist card_network if present for non co-badged cards (#6212)
|
13185999d5c03dfa9c1f9d72bff6b798c4b80be5
|
2023-04-24 13:08:00
|
Prajjwal Kumar
|
feat(Core): gracefully shutdown router/scheduler if Redis is unavailable (#891)
| false
|
diff --git a/crates/common_utils/src/pii.rs b/crates/common_utils/src/pii.rs
index 0b2d47b395b..14f8a260b48 100644
--- a/crates/common_utils/src/pii.rs
+++ b/crates/common_utils/src/pii.rs
@@ -152,7 +152,7 @@ mod pii_masking_strategy_tests {
#[test]
fn test_invalid_card_number_masking() {
let secret: Secret<String, CardNumber> = Secret::new("1234567890".to_string());
- assert_eq!("123456****", format!("{secret:?}"));
+ assert_eq!("*** alloc::string::String ***", format!("{secret:?}",));
}
/*
diff --git a/crates/common_utils/src/signals.rs b/crates/common_utils/src/signals.rs
index c354f51dd37..44118f39e30 100644
--- a/crates/common_utils/src/signals.rs
+++ b/crates/common_utils/src/signals.rs
@@ -2,20 +2,21 @@
use futures::StreamExt;
use router_env::logger;
-pub use tokio::sync::oneshot;
+use tokio::sync::mpsc;
///
/// This functions is meant to run in parallel to the application.
/// It will send a signal to the receiver when a SIGTERM or SIGINT is received
///
-pub async fn signal_handler(mut sig: signal_hook_tokio::Signals, sender: oneshot::Sender<()>) {
+pub async fn signal_handler(mut sig: signal_hook_tokio::Signals, sender: mpsc::Sender<()>) {
if let Some(signal) = sig.next().await {
logger::info!(
"Received signal: {:?}",
signal_hook::low_level::signal_name(signal)
);
match signal {
- signal_hook::consts::SIGTERM | signal_hook::consts::SIGINT => match sender.send(()) {
+ signal_hook::consts::SIGTERM | signal_hook::consts::SIGINT => match sender.try_send(())
+ {
Ok(_) => {
logger::info!("Request for force shutdown received")
}
diff --git a/crates/drainer/src/lib.rs b/crates/drainer/src/lib.rs
index 87baf90bd90..89d1901322d 100644
--- a/crates/drainer/src/lib.rs
+++ b/crates/drainer/src/lib.rs
@@ -7,10 +7,11 @@ pub mod settings;
mod utils;
use std::sync::{atomic, Arc};
-use common_utils::signals::{get_allowed_signals, oneshot};
+use common_utils::signals::get_allowed_signals;
pub use env as logger;
use error_stack::{IntoReport, ResultExt};
use storage_models::kv;
+use tokio::sync::mpsc;
use crate::{connection::pg_connection, services::Store};
@@ -35,14 +36,15 @@ pub async fn start_drainer(
.change_context(errors::DrainerError::SignalError(
"Failed while getting allowed signals".to_string(),
))?;
- let (tx, mut rx) = oneshot::channel();
+
+ let (tx, mut rx) = mpsc::channel(1);
let handle = signal.handle();
let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx));
let active_tasks = Arc::new(atomic::AtomicU64::new(0));
'event: loop {
match rx.try_recv() {
- Err(oneshot::error::TryRecvError::Empty) => {
+ Err(mpsc::error::TryRecvError::Empty) => {
if utils::is_stream_available(stream_index, store.clone()).await {
tokio::spawn(drainer_handler(
store.clone(),
@@ -59,17 +61,17 @@ pub async fn start_drainer(
)
.await;
}
- Ok(()) | Err(oneshot::error::TryRecvError::Closed) => {
+ Ok(()) | Err(mpsc::error::TryRecvError::Disconnected) => {
logger::info!("Awaiting shutdown!");
metrics::SHUTDOWN_SIGNAL_RECEIVED.add(&metrics::CONTEXT, 1, &[]);
let shutdown_started = tokio::time::Instant::now();
+ rx.close();
loop {
if active_tasks.load(atomic::Ordering::Acquire) == 0 {
logger::info!("Terminating drainer");
metrics::SUCCESSFUL_SHUTDOWN.add(&metrics::CONTEXT, 1, &[]);
let shutdown_ended = shutdown_started.elapsed().as_secs_f64() * 1000f64;
metrics::CLEANUP_TIME.record(&metrics::CONTEXT, shutdown_ended, &[]);
-
break 'event;
}
shutdown_interval.tick().await;
diff --git a/crates/redis_interface/Cargo.toml b/crates/redis_interface/Cargo.toml
index 6755f24502b..39a5b4ab1fb 100644
--- a/crates/redis_interface/Cargo.toml
+++ b/crates/redis_interface/Cargo.toml
@@ -14,6 +14,7 @@ fred = { version = "6.0.0", features = ["metrics", "partial-tracing"] }
futures = "0.3"
serde = { version = "1.0.160", features = ["derive"] }
thiserror = "1.0.40"
+tokio = "1.26.0"
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils", features = ["async_ext"] }
diff --git a/crates/redis_interface/src/lib.rs b/crates/redis_interface/src/lib.rs
index dce353c8f5b..bcf9ee1d808 100644
--- a/crates/redis_interface/src/lib.rs
+++ b/crates/redis_interface/src/lib.rs
@@ -138,12 +138,18 @@ impl RedisConnectionPool {
};
}
}
- pub async fn on_error(&self) {
+
+ pub async fn on_error(&self, tx: tokio::sync::oneshot::Sender<()>) {
while let Ok(redis_error) = self.pool.on_error().recv().await {
logger::error!(?redis_error, "Redis protocol or connection error");
+ logger::error!("current state: {:#?}", self.pool.state());
if self.pool.state() == fred::types::ClientState::Disconnected {
+ if tx.send(()).is_err() {
+ logger::error!("The redis shutdown signal sender failed to signal");
+ }
self.is_redis_available
.store(false, atomic::Ordering::SeqCst);
+ break;
}
}
}
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index ef1be47c45c..428fe587a3c 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -42,7 +42,6 @@ async fn main() -> ApplicationResult<()> {
let (server, mut state) = router::start_server(conf)
.await
.expect("Failed to create the server");
-
let _ = server.await;
state.store.close().await;
diff --git a/crates/router/src/bin/scheduler.rs b/crates/router/src/bin/scheduler.rs
index 7745221f46e..1ac73ddad08 100644
--- a/crates/router/src/bin/scheduler.rs
+++ b/crates/router/src/bin/scheduler.rs
@@ -6,6 +6,7 @@ use router::{
core::errors::{self, CustomResult},
logger, routes, scheduler,
};
+use tokio::sync::{mpsc, oneshot};
const SCHEDULER_FLOW: &str = "SCHEDULER_FLOW";
@@ -18,14 +19,21 @@ async fn main() -> CustomResult<(), errors::ProcessTrackerError> {
#[allow(clippy::expect_used)]
let conf = Settings::with_config_path(cmd_line.config_path)
.expect("Unable to construct application configuration");
-
- let mut state = routes::AppState::new(conf).await;
+ // 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;
+ // channel to shutdown scheduler gracefully
+ let (tx, rx) = mpsc::channel(1);
+ tokio::spawn(router::receiver_for_error(
+ redis_shutdown_signal_rx,
+ tx.clone(),
+ ));
let _guard =
logger::setup(&state.conf.log).map_err(|_| errors::ProcessTrackerError::UnexpectedFlow)?;
logger::debug!(startup_config=?state.conf);
- start_scheduler(&state).await?;
+ start_scheduler(&state, (tx, rx)).await?;
state.store.close().await;
@@ -35,6 +43,7 @@ async fn main() -> CustomResult<(), errors::ProcessTrackerError> {
async fn start_scheduler(
state: &routes::AppState,
+ channel: (mpsc::Sender<()>, mpsc::Receiver<()>),
) -> CustomResult<(), errors::ProcessTrackerError> {
use std::str::FromStr;
@@ -49,5 +58,5 @@ async fn start_scheduler(
.scheduler
.clone()
.ok_or(errors::ProcessTrackerError::ConfigurationError)?;
- scheduler::start_process_tracker(state, flow, Arc::new(scheduler_settings)).await
+ scheduler::start_process_tracker(state, flow, Arc::new(scheduler_settings), channel).await
}
diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs
index f39c25cd75d..f2d6cab64c7 100644
--- a/crates/router/src/lib.rs
+++ b/crates/router/src/lib.rs
@@ -25,11 +25,12 @@ pub mod utils;
use actix_web::{
body::MessageBody,
- dev::{Server, ServiceFactory, ServiceRequest},
+ dev::{Server, ServerHandle, ServiceFactory, ServiceRequest},
middleware::ErrorHandlers,
};
use http::StatusCode;
use routes::AppState;
+use tokio::sync::{mpsc, oneshot};
pub use self::env::logger;
use crate::{
@@ -140,7 +141,8 @@ pub fn mk_app(
pub async fn start_server(conf: settings::Settings) -> ApplicationResult<(Server, AppState)> {
logger::debug!(startup_config=?conf);
let server = conf.server.clone();
- let state = routes::AppState::new(conf).await;
+ 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;
@@ -149,10 +151,40 @@ pub async fn start_server(conf: settings::Settings) -> ApplicationResult<(Server
.workers(server.workers)
.shutdown_timeout(server.shutdown_timeout)
.run();
-
+ tokio::spawn(receiver_for_error(rx, server.handle()));
Ok((server, app_state))
}
+pub async fn receiver_for_error(rx: oneshot::Receiver<()>, mut server: impl Stop) {
+ match rx.await {
+ Ok(_) => {
+ logger::error!("The redis server failed ");
+ server.stop_server().await;
+ }
+ Err(err) => {
+ logger::error!("Channel receiver error{err}");
+ }
+ }
+}
+
+#[async_trait::async_trait]
+pub trait Stop {
+ async fn stop_server(&mut self);
+}
+
+#[async_trait::async_trait]
+impl Stop for ServerHandle {
+ async fn stop_server(&mut self) {
+ let _ = self.stop(true).await;
+ }
+}
+#[async_trait::async_trait]
+impl Stop for mpsc::Sender<()> {
+ async fn stop_server(&mut self) {
+ let _ = self.send(()).await.map_err(|err| logger::error!("{err}"));
+ }
+}
+
pub fn get_application_builder(
request_body_limit: usize,
) -> actix_web::App<
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 10314245b62..3559403da3d 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1,4 +1,5 @@
use actix_web::{web, Scope};
+use tokio::sync::oneshot;
use super::health::*;
#[cfg(feature = "olap")]
@@ -40,11 +41,15 @@ impl AppStateInfo for AppState {
}
impl AppState {
- pub async fn with_storage(conf: Settings, storage_impl: StorageImpl) -> Self {
+ pub async fn with_storage(
+ conf: Settings,
+ storage_impl: StorageImpl,
+ shut_down_signal: oneshot::Sender<()>,
+ ) -> Self {
let testable = storage_impl == StorageImpl::PostgresqlTest;
let store: Box<dyn StorageInterface> = match storage_impl {
StorageImpl::Postgresql | StorageImpl::PostgresqlTest => {
- Box::new(Store::new(&conf, testable).await)
+ Box::new(Store::new(&conf, testable, shut_down_signal).await)
}
StorageImpl::Mock => Box::new(MockDb::new(&conf).await),
};
@@ -56,8 +61,8 @@ impl AppState {
}
}
- pub async fn new(conf: Settings) -> Self {
- Self::with_storage(conf, StorageImpl::Postgresql).await
+ pub async fn new(conf: Settings, shut_down_signal: oneshot::Sender<()>) -> Self {
+ Self::with_storage(conf, StorageImpl::Postgresql, shut_down_signal).await
}
}
diff --git a/crates/router/src/scheduler.rs b/crates/router/src/scheduler.rs
index a08cfc2908b..59024897183 100644
--- a/crates/router/src/scheduler.rs
+++ b/crates/router/src/scheduler.rs
@@ -9,6 +9,8 @@ pub mod workflows;
use std::sync::Arc;
+use tokio::sync::mpsc;
+
pub use self::types::*;
use crate::{
configs::settings::SchedulerSettings,
@@ -21,11 +23,20 @@ pub async fn start_process_tracker(
state: &AppState,
scheduler_flow: SchedulerFlow,
scheduler_settings: Arc<SchedulerSettings>,
+ channel: (mpsc::Sender<()>, mpsc::Receiver<()>),
) -> CustomResult<(), errors::ProcessTrackerError> {
match scheduler_flow {
- SchedulerFlow::Producer => producer::start_producer(state, scheduler_settings).await?,
+ SchedulerFlow::Producer => {
+ producer::start_producer(state, scheduler_settings, channel).await?
+ }
SchedulerFlow::Consumer => {
- consumer::start_consumer(state, scheduler_settings, workflows::runner_from_task).await?
+ consumer::start_consumer(
+ state,
+ scheduler_settings,
+ workflows::runner_from_task,
+ channel,
+ )
+ .await?
}
SchedulerFlow::Cleaner => {
error!("This flow has not been implemented yet!");
diff --git a/crates/router/src/scheduler/consumer.rs b/crates/router/src/scheduler/consumer.rs
index b41744c892d..525f1a6492d 100644
--- a/crates/router/src/scheduler/consumer.rs
+++ b/crates/router/src/scheduler/consumer.rs
@@ -5,12 +5,13 @@ use std::{
sync::{self, atomic},
};
-use common_utils::signals::{get_allowed_signals, oneshot};
+use common_utils::signals::get_allowed_signals;
use error_stack::{IntoReport, ResultExt};
use futures::future;
use redis_interface::{RedisConnectionPool, RedisEntryId};
use router_env::{instrument, tracing};
use time::PrimitiveDateTime;
+use tokio::sync::mpsc;
use uuid::Uuid;
use super::{
@@ -37,6 +38,7 @@ pub async fn start_consumer(
state: &AppState,
settings: sync::Arc<settings::SchedulerSettings>,
workflow_selector: workflows::WorkflowSelectorFn,
+ (tx, mut rx): (mpsc::Sender<()>, mpsc::Receiver<()>),
) -> CustomResult<(), errors::ProcessTrackerError> {
use std::time::Duration;
@@ -58,13 +60,12 @@ pub async fn start_consumer(
})
.into_report()
.attach_printable("Failed while creating a signals handler")?;
- let (sx, mut rx) = oneshot::channel();
let handle = signal.handle();
- let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, sx));
+ let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx));
loop {
match rx.try_recv() {
- Err(oneshot::error::TryRecvError::Empty) => {
+ Err(mpsc::error::TryRecvError::Empty) => {
interval.tick().await;
// A guard from env to disable the consumer
@@ -82,11 +83,11 @@ pub async fn start_consumer(
workflow_selector,
));
}
- Ok(()) | Err(oneshot::error::TryRecvError::Closed) => {
+ Ok(()) | Err(mpsc::error::TryRecvError::Disconnected) => {
logger::debug!("Awaiting shutdown!");
+ rx.close();
shutdown_interval.tick().await;
let active_tasks = consumer_operation_counter.load(atomic::Ordering::Acquire);
-
match active_tasks {
0 => {
logger::info!("Terminating consumer");
diff --git a/crates/router/src/scheduler/producer.rs b/crates/router/src/scheduler/producer.rs
index 4bb61b34bd6..811156607d1 100644
--- a/crates/router/src/scheduler/producer.rs
+++ b/crates/router/src/scheduler/producer.rs
@@ -1,9 +1,9 @@
use std::sync::Arc;
-use common_utils::signals::oneshot;
use error_stack::{report, IntoReport, ResultExt};
use router_env::{instrument, tracing};
use time::Duration;
+use tokio::sync::mpsc;
use super::metrics;
use crate::{
@@ -20,9 +20,9 @@ use crate::{
pub async fn start_producer(
state: &AppState,
scheduler_settings: Arc<SchedulerSettings>,
+ (tx, mut rx): (mpsc::Sender<()>, mpsc::Receiver<()>),
) -> CustomResult<(), errors::ProcessTrackerError> {
use rand::Rng;
-
let timeout = rand::thread_rng().gen_range(0..=scheduler_settings.loop_interval);
tokio::time::sleep(std::time::Duration::from_millis(timeout)).await;
@@ -41,15 +41,13 @@ pub async fn start_producer(
})
.into_report()
.attach_printable("Failed while creating a signals handler")?;
- let (sx, mut rx) = oneshot::channel();
let handle = signal.handle();
- let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, sx));
+ let task_handle = tokio::spawn(common_utils::signals::signal_handler(signal, tx));
loop {
match rx.try_recv() {
- Err(oneshot::error::TryRecvError::Empty) => {
+ Err(mpsc::error::TryRecvError::Empty) => {
interval.tick().await;
-
match run_producer_flow(state, &scheduler_settings).await {
Ok(_) => (),
Err(error) => {
@@ -60,10 +58,10 @@ pub async fn start_producer(
}
}
}
- Ok(()) | Err(oneshot::error::TryRecvError::Closed) => {
+ Ok(()) | Err(mpsc::error::TryRecvError::Disconnected) => {
logger::debug!("Awaiting shutdown!");
+ rx.close();
shutdown_interval.tick().await;
-
logger::info!("Terminating consumer");
break;
}
diff --git a/crates/router/src/services.rs b/crates/router/src/services.rs
index eba3269394a..55401156591 100644
--- a/crates/router/src/services.rs
+++ b/crates/router/src/services.rs
@@ -7,11 +7,13 @@ use std::sync::{atomic, Arc};
use error_stack::{IntoReport, ResultExt};
use redis_interface::{errors as redis_errors, PubsubInterface};
+use tokio::sync::oneshot;
pub use self::{api::*, encryption::*};
use crate::{
async_spawn,
cache::CONFIG_CACHE,
+ configs::settings,
connection::{diesel_make_pg_pool, PgPool},
consts,
core::errors,
@@ -94,22 +96,24 @@ pub(crate) struct StoreConfig {
}
impl Store {
- pub async fn new(config: &crate::configs::settings::Settings, test_transaction: bool) -> Self {
+ pub async fn new(
+ config: &settings::Settings,
+ test_transaction: bool,
+ shut_down_signal: oneshot::Sender<()>,
+ ) -> Self {
let redis_conn = Arc::new(crate::connection::redis_connection(config).await);
let redis_clone = redis_conn.clone();
let subscriber_conn = redis_conn.clone();
redis_conn.subscribe(consts::PUB_SUB_CHANNEL).await.ok();
-
async_spawn!({
if let Err(e) = subscriber_conn.on_message().await {
logger::error!(pubsub_err=?e);
}
});
-
async_spawn!({
- redis_clone.on_error().await;
+ redis_clone.on_error(shut_down_signal).await;
});
Self {
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 31e2126d2cb..6171bf6dded 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -14,7 +14,7 @@ impl crate::utils::storage_partitioning::KvStorePartition for PaymentAttempt {}
#[cfg(test)]
mod tests {
#![allow(clippy::expect_used, clippy::unwrap_used)]
-
+ use tokio::sync::oneshot;
use uuid::Uuid;
use super::*;
@@ -29,8 +29,8 @@ mod tests {
#[ignore]
async fn test_payment_attempt_insert() {
let conf = Settings::new().expect("invalid settings");
-
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let payment_id = Uuid::new_v4().to_string();
let current_time = common_utils::date_time::now();
@@ -59,7 +59,8 @@ mod tests {
async fn test_find_payment_attempt() {
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let current_time = common_utils::date_time::now();
let payment_id = Uuid::new_v4().to_string();
@@ -105,7 +106,8 @@ mod tests {
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
let uuid = uuid::Uuid::new_v4().to_string();
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let current_time = common_utils::date_time::now();
let connector = types::Connector::Dummy.to_string();
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 30017897043..4a944c2b7cc 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -9,6 +9,7 @@ use router::{
routes, services,
types::{self, storage::enums, PaymentAddress},
};
+use tokio::sync::oneshot;
use crate::connector_auth::ConnectorAuthentication;
@@ -117,7 +118,8 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
async fn payments_create_success() {
let conf = Settings::new().unwrap();
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
static CV: aci::Aci = aci::Aci;
let connector = types::api::ConnectorData {
@@ -152,7 +154,8 @@ async fn payments_create_failure() {
{
let conf = Settings::new().unwrap();
static CV: aci::Aci = aci::Aci;
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector = types::api::ConnectorData {
connector: Box::new(&CV),
connector_name: types::Connector::Aci,
@@ -199,7 +202,8 @@ async fn refund_for_successful_payments() {
connector_name: types::Connector::Aci,
get_token: types::api::GetToken::Connector,
};
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector_integration: services::BoxedConnectorIntegration<
'_,
types::api::Authorize,
@@ -257,7 +261,8 @@ async fn refunds_create_failure() {
connector_name: types::Connector::Aci,
get_token: types::api::GetToken::Connector,
};
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector_integration: services::BoxedConnectorIntegration<
'_,
types::api::Execute,
diff --git a/crates/router/tests/connectors/authorizedotnet.rs b/crates/router/tests/connectors/authorizedotnet.rs
index 6311ff1ebd1..eec99afd2ac 100644
--- a/crates/router/tests/connectors/authorizedotnet.rs
+++ b/crates/router/tests/connectors/authorizedotnet.rs
@@ -9,6 +9,7 @@ use router::{
routes, services,
types::{self, storage::enums, PaymentAddress},
};
+use tokio::sync::oneshot;
use crate::connector_auth::ConnectorAuthentication;
@@ -116,7 +117,8 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
#[ignore]
async fn payments_create_success() {
let conf = Settings::new().unwrap();
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
static CV: Authorizedotnet = Authorizedotnet;
let connector = types::api::ConnectorData {
connector: Box::new(&CV),
@@ -159,7 +161,8 @@ async fn payments_create_failure() {
connector_name: types::Connector::Authorizedotnet,
get_token: types::api::GetToken::Connector,
};
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector_integration: services::BoxedConnectorIntegration<
'_,
types::api::Authorize,
@@ -207,7 +210,8 @@ async fn refunds_create_success() {
connector_name: types::Connector::Authorizedotnet,
get_token: types::api::GetToken::Connector,
};
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector_integration: services::BoxedConnectorIntegration<
'_,
types::api::Execute,
@@ -244,7 +248,8 @@ async fn refunds_create_failure() {
connector_name: types::Connector::Authorizedotnet,
get_token: types::api::GetToken::Connector,
};
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let connector_integration: services::BoxedConnectorIntegration<
'_,
types::api::Execute,
diff --git a/crates/router/tests/connectors/checkout.rs b/crates/router/tests/connectors/checkout.rs
index 70e537fc7d5..084295b8adf 100644
--- a/crates/router/tests/connectors/checkout.rs
+++ b/crates/router/tests/connectors/checkout.rs
@@ -5,7 +5,6 @@ use crate::{
connector_auth,
utils::{self, ConnectorActions},
};
-
#[derive(Clone, Copy)]
struct CheckoutTest;
impl ConnectorActions for CheckoutTest {}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 6aa9742dee8..d7019ba4096 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -10,6 +10,7 @@ use router::{
routes, services,
types::{self, api, storage::enums, AccessToken, PaymentAddress, RouterData},
};
+use tokio::sync::oneshot;
use wiremock::{Mock, MockServer};
pub trait Connector {
@@ -49,9 +50,13 @@ pub trait ConnectorActions: Connector {
},
payment_info,
);
- let state =
- routes::AppState::with_storage(Settings::new().unwrap(), StorageImpl::PostgresqlTest)
- .await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(
+ Settings::new().unwrap(),
+ StorageImpl::PostgresqlTest,
+ tx,
+ )
+ .await;
integration.execute_pretasks(&mut request, &state).await?;
call_connector(request, integration).await
}
@@ -70,9 +75,13 @@ pub trait ConnectorActions: Connector {
},
payment_info,
);
- let state =
- routes::AppState::with_storage(Settings::new().unwrap(), StorageImpl::PostgresqlTest)
- .await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(
+ Settings::new().unwrap(),
+ StorageImpl::PostgresqlTest,
+ tx,
+ )
+ .await;
integration.execute_pretasks(&mut request, &state).await?;
call_connector(request, integration).await
}
@@ -415,7 +424,8 @@ async fn call_connector<
integration: services::BoxedConnectorIntegration<'_, T, Req, Resp>,
) -> Result<RouterData<T, Req, Resp>, Report<ConnectorError>> {
let conf = Settings::new().unwrap();
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
services::api::execute_connector_processing_step(
&state,
integration,
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index b4e6703ab5c..31d3712a6cc 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -13,6 +13,7 @@ use router::{
},
};
use time::macros::datetime;
+use tokio::sync::oneshot;
use uuid::Uuid;
// setting the connector in environment variables doesn't work when run in parallel. Neither does passing the paymentid
@@ -273,8 +274,8 @@ fn connector_list() {
async fn payments_create_core() {
use configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
-
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let merchant_account = state
.store
@@ -420,8 +421,8 @@ async fn payments_create_core() {
async fn payments_create_core_adyen_no_redirect() {
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
-
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let customer_id = format!("cust_{}", Uuid::new_v4());
let merchant_id = "arunraj".to_string();
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index b6e498ef51b..bb4119871df 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -9,6 +9,7 @@ use router::{
*,
};
use time::macros::datetime;
+use tokio::sync::oneshot;
use uuid::Uuid;
#[test]
@@ -33,8 +34,8 @@ fn connector_list() {
async fn payments_create_core() {
use router::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
-
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let merchant_account = state
.store
@@ -186,8 +187,8 @@ async fn payments_create_core() {
async fn payments_create_core_adyen_no_redirect() {
use router::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
-
- let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let state = routes::AppState::with_storage(conf, StorageImpl::PostgresqlTest, tx).await;
let customer_id = format!("cust_{}", Uuid::new_v4());
let merchant_id = "arunraj".to_string();
diff --git a/crates/router/tests/utils.rs b/crates/router/tests/utils.rs
index c420662d35b..e7c34afc31a 100644
--- a/crates/router/tests/utils.rs
+++ b/crates/router/tests/utils.rs
@@ -14,7 +14,7 @@ use derive_deref::Deref;
use router::{configs::settings::Settings, routes::AppState};
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::{json, Value};
-use tokio::sync::OnceCell;
+use tokio::sync::{oneshot, OnceCell};
static SERVER: OnceCell<bool> = OnceCell::const_new();
@@ -47,8 +47,8 @@ pub async fn mk_service(
if let Some(url) = stripemock().await {
conf.connectors.stripe.base_url = url;
}
-
- let app_state = AppState::with_storage(conf, router::db::StorageImpl::Mock).await;
+ let tx: oneshot::Sender<()> = oneshot::channel().0;
+ let app_state = AppState::with_storage(conf, router::db::StorageImpl::Mock, tx).await;
actix_web::test::init_service(router::mk_app(app_state, request_body_limit)).await
}
|
feat
|
gracefully shutdown router/scheduler if Redis is unavailable (#891)
|
5f53d84a8b92f8aab67d09666b45362b287809ff
|
2023-12-17 14:10:50
|
DEEPANSHU BANSAL
|
feat(connector): [CYBERSOURCE] Implement Apple Pay (#3149)
| false
|
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 80e98a68f5d..83a34b87dd0 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -4707,6 +4707,93 @@ impl Default for super::settings::RequiredFields {
),
common: HashMap::new(),
}
+ ),
+ (
+ enums::Connector::Cybersource,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::from(
+ [
+ (
+ "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.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,
+ }
+ ),
+ (
+ "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,
+ }
+ ),
+ ]
+ ),
+ common: HashMap::new(),
+ }
)
]),
},
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index ef31b977075..21dbed5e5e4 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use crate::{
connector::utils::{
- self, AddressDetailsData, CardData, PaymentsAuthorizeRequestData,
+ self, AddressDetailsData, ApplePayDecrypt, CardData, PaymentsAuthorizeRequestData,
PaymentsSetupMandateRequestData, PaymentsSyncRequestData, RouterData,
},
consts,
@@ -16,6 +16,7 @@ use crate::{
api::{self, enums as api_enums},
storage::enums,
transformers::ForeignFrom,
+ ApplePayPredecryptData,
},
};
@@ -207,6 +208,22 @@ pub struct CardPaymentInformation {
instrument_identifier: Option<CybersoucreInstrumentIdentifier>,
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TokenizedCard {
+ number: Secret<String>,
+ expiration_month: Secret<String>,
+ expiration_year: Secret<String>,
+ cryptogram: Secret<String>,
+ transaction_type: TransactionType,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ApplePayPaymentInformation {
+ tokenized_card: TokenizedCard,
+}
+
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FluidData {
@@ -224,6 +241,7 @@ pub struct GooglePayPaymentInformation {
pub enum PaymentInformation {
Cards(CardPaymentInformation),
GooglePay(GooglePayPaymentInformation),
+ ApplePay(ApplePayPaymentInformation),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -295,6 +313,12 @@ pub enum PaymentSolution {
GooglePay,
}
+#[derive(Debug, Serialize)]
+pub enum TransactionType {
+ #[serde(rename = "1")]
+ ApplePay,
+}
+
impl From<PaymentSolution> for String {
fn from(solution: PaymentSolution) -> Self {
let payment_solution = match solution {
@@ -478,6 +502,47 @@ impl
}
}
+impl
+ TryFrom<(
+ &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
+ Box<ApplePayPredecryptData>,
+ )> for CybersourcePaymentsRequest
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ (item, apple_pay_data): (
+ &CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
+ Box<ApplePayPredecryptData>,
+ ),
+ ) -> Result<Self, Self::Error> {
+ let email = item.router_data.request.get_email()?;
+ let bill_to = build_bill_to(item.router_data.get_billing()?, email)?;
+ let order_information = OrderInformationWithBill::from((item, bill_to));
+ let processing_information =
+ ProcessingInformation::from((item, Some(PaymentSolution::ApplePay)));
+ let client_reference_information = ClientReferenceInformation::from(item);
+ let expiration_month = apple_pay_data.get_expiry_month()?;
+ let expiration_year = apple_pay_data.get_four_digit_expiry_year()?;
+
+ let payment_information = PaymentInformation::ApplePay(ApplePayPaymentInformation {
+ tokenized_card: TokenizedCard {
+ number: apple_pay_data.application_primary_account_number,
+ cryptogram: apple_pay_data.payment_data.online_payment_cryptogram,
+ transaction_type: TransactionType::ApplePay,
+ expiration_year,
+ expiration_month,
+ },
+ });
+
+ Ok(Self {
+ processing_information,
+ payment_information,
+ order_information,
+ client_reference_information,
+ })
+ }
+}
+
impl
TryFrom<(
&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
@@ -526,11 +591,21 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
match item.router_data.request.payment_method_data.clone() {
payments::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
payments::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
+ payments::WalletData::ApplePay(_) => {
+ let payment_method_token = item.router_data.get_payment_method_token()?;
+ match payment_method_token {
+ types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
+ Self::try_from((item, decrypt_data))
+ }
+ types::PaymentMethodToken::Token(_) => {
+ Err(errors::ConnectorError::InvalidWalletToken)?
+ }
+ }
+ }
payments::WalletData::GooglePay(google_pay_data) => {
Self::try_from((item, google_pay_data))
}
- payments::WalletData::ApplePay(_)
- | payments::WalletData::AliPayQr(_)
+ payments::WalletData::AliPayQr(_)
| payments::WalletData::AliPayRedirect(_)
| payments::WalletData::AliPayHkRedirect(_)
| payments::WalletData::MomoRedirect(_)
|
feat
|
[CYBERSOURCE] Implement Apple Pay (#3149)
|
68df9d617c825e9a4fec88695c3c22588cf3673b
|
2023-08-14 16:52:31
|
chikke srujan
|
fix(connector): [Braintree] add merchant_account_id field in authorize request (#1916)
| false
|
diff --git a/crates/router/src/connector/braintree.rs b/crates/router/src/connector/braintree.rs
index 41844086196..2b2dd3814e6 100644
--- a/crates/router/src/connector/braintree.rs
+++ b/crates/router/src/connector/braintree.rs
@@ -18,6 +18,7 @@ use crate::{
types::{
self,
api::{self, ConnectorCommon},
+ ErrorResponse,
},
utils::{self, BytesExt},
};
@@ -50,16 +51,41 @@ impl ConnectorCommon for Braintree {
fn build_error_response(
&self,
res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: Result<braintree::ErrorResponse, Report<common_utils::errors::ParsingError>> =
res.response.parse_struct("Braintree Error Response");
match response {
- Ok(response_data) => Ok(types::ErrorResponse {
+ Ok(braintree::ErrorResponse::BraintreeApiErrorResponse(response)) => {
+ let error_object = response.api_error_response.errors;
+ let error = error_object.errors.first().or(error_object
+ .transaction
+ .as_ref()
+ .and_then(|transaction_error| {
+ transaction_error.errors.first().or(transaction_error
+ .credit_card
+ .as_ref()
+ .and_then(|credit_card_error| credit_card_error.errors.first()))
+ }));
+ let (code, message) = error.map_or(
+ (
+ consts::NO_ERROR_CODE.to_string(),
+ consts::NO_ERROR_MESSAGE.to_string(),
+ ),
+ |error| (error.code.clone(), error.message.clone()),
+ );
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code,
+ message,
+ reason: Some(response.api_error_response.message),
+ })
+ }
+ Ok(braintree::ErrorResponse::BraintreeErrorResponse(response)) => Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
- message: response_data.api_error_response.message,
- reason: None,
+ message: consts::NO_ERROR_MESSAGE.to_string(),
+ reason: Some(response.errors),
}),
Err(error_msg) => {
logger::error!(deserialization_error =? error_msg);
@@ -160,7 +186,7 @@ impl
fn get_error_response(
&self,
res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
@@ -301,7 +327,7 @@ impl
fn get_error_response(
&self,
res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
@@ -429,7 +455,7 @@ impl
fn get_error_response(
&self,
res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
}
@@ -502,7 +528,7 @@ impl
fn get_error_response(
&self,
res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
@@ -632,7 +658,7 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
fn get_error_response(
&self,
_res: types::Response,
- ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("braintree".to_string()).into())
}
}
diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs
index 4f37bcc1714..4ad6317c00d 100644
--- a/crates/router/src/connector/braintree/transformers.rs
+++ b/crates/router/src/connector/braintree/transformers.rs
@@ -18,6 +18,11 @@ pub struct PaymentOptions {
submit_for_settlement: bool,
}
+#[derive(Debug, Deserialize)]
+pub struct BraintreeMeta {
+ merchant_account_id: Option<Secret<String>>,
+}
+
#[derive(Debug, Serialize, Eq, PartialEq)]
pub struct BraintreePaymentsRequest {
transaction: TransactionBody,
@@ -48,6 +53,7 @@ impl TryFrom<&types::PaymentsSessionRouterData> for BraintreeSessionRequest {
#[serde(rename_all = "camelCase")]
pub struct TransactionBody {
amount: String,
+ merchant_account_id: Option<Secret<String>>,
device_data: DeviceData,
options: PaymentOptions,
#[serde(flatten)]
@@ -91,7 +97,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
item.request.capture_method,
Some(enums::CaptureMethod::Automatic) | None
);
-
+ let metadata: BraintreeMeta =
+ utils::to_connector_meta_from_secret(item.connector_meta_data.clone())?;
+ let merchant_account_id = metadata.merchant_account_id;
let amount = utils::to_currency_base_unit(item.request.amount, item.request.currency)?;
let device_data = DeviceData {};
let options = PaymentOptions {
@@ -125,6 +133,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
}?;
let braintree_transaction_body = TransactionBody {
amount,
+ merchant_account_id,
device_data,
options,
payment_method_data_type,
@@ -281,15 +290,54 @@ pub struct TransactionResponse {
status: BraintreePaymentStatus,
}
-#[derive(Debug, Default, Deserialize)]
+#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
-pub struct ErrorResponse {
+pub struct BraintreeApiErrorResponse {
pub api_error_response: ApiErrorResponse,
}
-#[derive(Default, Debug, Clone, Deserialize, Eq, PartialEq)]
+#[derive(Debug, Deserialize)]
+pub struct ErrorsObject {
+ pub errors: Vec<ErrorObject>,
+ pub transaction: Option<TransactionError>,
+}
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct TransactionError {
+ pub errors: Vec<ErrorObject>,
+ pub credit_card: Option<CreditCardError>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct CreditCardError {
+ pub errors: Vec<ErrorObject>,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct ErrorObject {
+ pub code: String,
+ pub message: String,
+}
+
+#[derive(Debug, Default, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct BraintreeErrorResponse {
+ pub errors: String,
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
+#[serde(untagged)]
+
+pub enum ErrorResponse {
+ BraintreeApiErrorResponse(Box<BraintreeApiErrorResponse>),
+ BraintreeErrorResponse(Box<BraintreeErrorResponse>),
+}
+
+#[derive(Debug, Deserialize)]
pub struct ApiErrorResponse {
pub message: String,
+ pub errors: ErrorsObject,
}
#[derive(Default, Debug, Clone, Serialize)]
|
fix
|
[Braintree] add merchant_account_id field in authorize request (#1916)
|
6494e8a6e4a195ecc9ca5b2f6ac0a636f06b03f7
|
2023-10-19 12:48:50
|
HeetVekariya
|
refactor(connector): [Iatapay] remove default case handling (#2587)
| false
|
diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs
index 9d4ecdff197..f98798fe5be 100644
--- a/crates/router/src/connector/iatapay/transformers.rs
+++ b/crates/router/src/connector/iatapay/transformers.rs
@@ -86,7 +86,18 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for IatapayPaymentsRequest {
let payment_method = item.payment_method;
let country = match payment_method {
PaymentMethod::Upi => "IN".to_string(),
- _ => item.get_billing_country()?.to_string(),
+
+ PaymentMethod::Card
+ | PaymentMethod::CardRedirect
+ | PaymentMethod::PayLater
+ | PaymentMethod::Wallet
+ | PaymentMethod::BankRedirect
+ | PaymentMethod::BankTransfer
+ | PaymentMethod::Crypto
+ | PaymentMethod::BankDebit
+ | PaymentMethod::Reward
+ | PaymentMethod::Voucher
+ | PaymentMethod::GiftCard => item.get_billing_country()?.to_string(),
};
let return_url = item.get_return_url()?;
let payer_info = match item.request.payment_method_data.clone() {
|
refactor
|
[Iatapay] remove default case handling (#2587)
|
236124d1993c2a7d52e30441761a3558ad02c973
|
2023-05-16 23:50:21
|
Kartikeya Hegde
|
docs: add changelog for v0.5.14 (#1177)
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88839fd3315..9e0f3a7fb4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,31 @@
All notable changes to HyperSwitch will be documented here.
+## 0.5.14 (2023-05-16)
+
+### Features
+
+- **connector:**
+ - [Stripe] implement Bancontact Bank Redirect for stripe ([#1169](https://github.com/juspay/hyperswitch/pull/1169)) ([`5b22e96`](https://github.com/juspay/hyperswitch/commit/5b22e967981b604be6070f5b373555756a5c62f7))
+ - [Noon] Add script generated template code ([#1164](https://github.com/juspay/hyperswitch/pull/1164)) ([`bfaf75f`](https://github.com/juspay/hyperswitch/commit/bfaf75fca38e535ceb3ea4327e252d807fb61892))
+ - [Adyen] implement BACS Direct Debits for Adyen ([#1159](https://github.com/juspay/hyperswitch/pull/1159)) ([`9f47f20`](https://github.com/juspay/hyperswitch/commit/9f47f2070216eb8c64db14eae555073a507cc634))
+- **router:** Add retrieve dispute evidence API ([#1114](https://github.com/juspay/hyperswitch/pull/1114)) ([`354ee01`](https://github.com/juspay/hyperswitch/commit/354ee0137a968862e545d9b437ade27aa0b0f8f3))
+- Add accounts in-memory cache ([#1086](https://github.com/juspay/hyperswitch/pull/1086)) ([`da4d721`](https://github.com/juspay/hyperswitch/commit/da4d721424d329af618a63034aabe2d9248eb041))
+
+### Bug Fixes
+
+- **connector:**
+ - [Checkout] Change error handling condition for empty response ([#1168](https://github.com/juspay/hyperswitch/pull/1168)) ([`e3fcfdd`](https://github.com/juspay/hyperswitch/commit/e3fcfdd3377df298058b5e1f69f0e553c09ac603))
+ - Change payment method handling in dummy connector ([#1175](https://github.com/juspay/hyperswitch/pull/1175)) ([`32a3722`](https://github.com/juspay/hyperswitch/commit/32a3722f073c3ea22220abfa62034e476ee8acef))
+
+### Refactors
+
+- **connector:** Update error handling for Paypal, Checkout, Mollie to include detailed messages ([#1150](https://github.com/juspay/hyperswitch/pull/1150)) ([`e044c2f`](https://github.com/juspay/hyperswitch/commit/e044c2fd9a4464e59ffc372b9333af6acbc9809a))
+
+### Documentation
+
+- **CHANGELOG:** Add changelog for 0.5.13 ([#1166](https://github.com/juspay/hyperswitch/pull/1166)) ([`94fe1af`](https://github.com/juspay/hyperswitch/commit/94fe1af1b0bce3b4ecaef8665909fc8f5cd4bbbb))
+
## 0.5.13 (2023-05-15)
### Features
|
docs
|
add changelog for v0.5.14 (#1177)
|
625b53182e20b50fde5def338e122a43457da0f2
|
2024-05-08 11:45:47
|
Swangi Kumari
|
refactor(bank-debit): remove billingdetails from bankdebit pmd (#4371)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 69b4700acbc..2dc578ef75e 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1148,7 +1148,7 @@ pub enum BankDebitData {
/// Payment Method data for Ach bank debit
AchBankDebit {
/// Billing details for bank debit
- billing_details: BankDebitBilling,
+ billing_details: Option<BankDebitBilling>,
/// Account number for ach bank debit payment
#[schema(value_type = String, example = "000123456789")]
account_number: Secret<String>,
@@ -1173,7 +1173,7 @@ pub enum BankDebitData {
},
SepaBankDebit {
/// Billing details for bank debit
- billing_details: BankDebitBilling,
+ billing_details: Option<BankDebitBilling>,
/// International bank account number (iban) for SEPA
#[schema(value_type = String, example = "DE89370400440532013000")]
iban: Secret<String>,
@@ -1183,7 +1183,7 @@ pub enum BankDebitData {
},
BecsBankDebit {
/// Billing details for bank debit
- billing_details: BankDebitBilling,
+ billing_details: Option<BankDebitBilling>,
/// Account number for Becs payment method
#[schema(value_type = String, example = "000123456")]
account_number: Secret<String>,
@@ -1196,7 +1196,7 @@ pub enum BankDebitData {
},
BacsBankDebit {
/// Billing details for bank debit
- billing_details: BankDebitBilling,
+ billing_details: Option<BankDebitBilling>,
/// Account number for Bacs payment method
#[schema(value_type = String, example = "00012345")]
account_number: Secret<String>,
@@ -1212,11 +1212,12 @@ pub enum BankDebitData {
impl GetAddressFromPaymentMethodData for BankDebitData {
fn get_billing_address(&self) -> Option<Address> {
fn get_billing_address_inner(
- bank_debit_billing: &BankDebitBilling,
+ bank_debit_billing: Option<&BankDebitBilling>,
bank_account_holder_name: Option<&Secret<String>>,
) -> Option<Address> {
// We will always have address here
- let mut address = bank_debit_billing.get_billing_address()?;
+ let mut address = bank_debit_billing
+ .and_then(GetAddressFromPaymentMethodData::get_billing_address)?;
// Prefer `account_holder_name` over `name`
address.address.as_mut().map(|address| {
@@ -1248,7 +1249,10 @@ impl GetAddressFromPaymentMethodData for BankDebitData {
billing_details,
bank_account_holder_name,
..
- } => get_billing_address_inner(billing_details, bank_account_holder_name.as_ref()),
+ } => get_billing_address_inner(
+ billing_details.as_ref(),
+ bank_account_holder_name.as_ref(),
+ ),
}
}
}
@@ -1447,7 +1451,7 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData {
Self::Wallet(wallet_data) => wallet_data.get_billing_address(),
Self::PayLater(pay_later) => pay_later.get_billing_address(),
Self::BankRedirect(_) => None,
- Self::BankDebit(_) => None,
+ Self::BankDebit(bank_debit_data) => bank_debit_data.get_billing_address(),
Self::BankTransfer(_) => None,
Self::Voucher(voucher_data) => voucher_data.get_billing_address(),
Self::Crypto(_)
@@ -2241,11 +2245,11 @@ impl GetAddressFromPaymentMethodData for BankTransferData {
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
pub struct BankDebitBilling {
/// The billing name for bank debits
- #[schema(value_type = String, example = "John Doe")]
- pub name: Secret<String>,
+ #[schema(value_type = Option<String>, example = "John Doe")]
+ pub name: Option<Secret<String>>,
/// The billing email for bank debits
- #[schema(value_type = String, example = "[email protected]")]
- pub email: Email,
+ #[schema(value_type = Option<String>, example = "[email protected]")]
+ pub email: Option<Email>,
/// The billing address for bank debits
pub address: Option<AddressDetails>,
}
@@ -2253,19 +2257,19 @@ pub struct BankDebitBilling {
impl GetAddressFromPaymentMethodData for BankDebitBilling {
fn get_billing_address(&self) -> Option<Address> {
let address = if let Some(mut address) = self.address.clone() {
- address.first_name = Some(self.name.clone());
+ address.first_name = self.name.clone().or(address.first_name);
Address {
address: Some(address),
- email: Some(self.email.clone()),
+ email: self.email.clone(),
phone: None,
}
} else {
Address {
address: Some(AddressDetails {
- first_name: Some(self.name.clone()),
+ first_name: self.name.clone(),
..AddressDetails::default()
}),
- email: Some(self.email.clone()),
+ email: self.email.clone(),
phone: None,
}
};
@@ -4898,14 +4902,14 @@ mod billing_from_payment_method_data {
let test_first_name = Secret::new(String::from("Chaser"));
let bank_redirect_billing = BankDebitBilling {
- name: test_first_name.clone(),
+ name: Some(test_first_name.clone()),
address: None,
- email: test_email.clone(),
+ email: Some(test_email.clone()),
};
let ach_bank_debit_payment_method_data =
PaymentMethodData::BankDebit(BankDebitData::AchBankDebit {
- billing_details: bank_redirect_billing,
+ billing_details: Some(bank_redirect_billing),
account_number: Secret::new("1234".to_string()),
routing_number: Secret::new("1235".to_string()),
card_holder_name: None,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 77abaacf40b..c911af50e5c 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1820,56 +1820,42 @@ fn build_shopper_reference(customer_id: &Option<String>, merchant_id: String) ->
.map(|c_id| format!("{}_{}", merchant_id, c_id))
}
-impl<'a> TryFrom<&domain::BankDebitData> for AdyenPaymentMethod<'a> {
+impl<'a> TryFrom<(&domain::BankDebitData, &types::PaymentsAuthorizeRouterData)>
+ for AdyenPaymentMethod<'a>
+{
type Error = Error;
- fn try_from(bank_debit_data: &domain::BankDebitData) -> Result<Self, Self::Error> {
+ fn try_from(
+ (bank_debit_data, item): (&domain::BankDebitData, &types::PaymentsAuthorizeRouterData),
+ ) -> Result<Self, Self::Error> {
match bank_debit_data {
domain::BankDebitData::AchBankDebit {
account_number,
routing_number,
- card_holder_name,
..
} => Ok(AdyenPaymentMethod::AchDirectDebit(Box::new(
AchDirectDebitData {
payment_type: PaymentType::AchDirectDebit,
bank_account_number: account_number.clone(),
bank_location_id: routing_number.clone(),
- owner_name: card_holder_name.clone().ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "card_holder_name",
- },
- )?,
+ owner_name: item.get_billing_full_name()?,
},
))),
- domain::BankDebitData::SepaBankDebit {
- iban,
- bank_account_holder_name,
- ..
- } => Ok(AdyenPaymentMethod::SepaDirectDebit(Box::new(
- SepaDirectDebitData {
- owner_name: bank_account_holder_name.clone().ok_or(
- errors::ConnectorError::MissingRequiredField {
- field_name: "bank_account_holder_name",
- },
- )?,
+ domain::BankDebitData::SepaBankDebit { iban, .. } => Ok(
+ AdyenPaymentMethod::SepaDirectDebit(Box::new(SepaDirectDebitData {
+ owner_name: item.get_billing_full_name()?,
iban_number: iban.clone(),
- },
- ))),
+ })),
+ ),
domain::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",
- },
- )?,
+ holder_name: item.get_billing_full_name()?,
},
))),
domain::BankDebitData::BecsBankDebit { .. } => {
@@ -2713,7 +2699,7 @@ impl<'a>
let browser_info = get_browser_info(item.router_data)?;
let additional_data = get_additional_data(item.router_data);
let return_url = item.router_data.request.get_return_url()?;
- let payment_method = AdyenPaymentMethod::try_from(bank_debit_data)?;
+ let payment_method = AdyenPaymentMethod::try_from((bank_debit_data, item.router_data))?;
let country_code = get_country_code(item.router_data.get_optional_billing());
let request = AdyenPaymentRequest {
amount,
diff --git a/crates/router/src/connector/gocardless/transformers.rs b/crates/router/src/connector/gocardless/transformers.rs
index e05f1b469ac..97f1146b506 100644
--- a/crates/router/src/connector/gocardless/transformers.rs
+++ b/crates/router/src/connector/gocardless/transformers.rs
@@ -8,9 +8,8 @@ use serde::{Deserialize, Serialize};
use crate::{
connector::utils::{
- self, AddressDetailsData, BankDirectDebitBillingData, BrowserInformationData,
- ConnectorCustomerData, PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData,
- RouterData,
+ self, AddressDetailsData, BrowserInformationData, ConnectorCustomerData,
+ PaymentsAuthorizeRequestData, PaymentsSetupMandateRequestData, RouterData,
},
core::errors,
types::{
@@ -67,64 +66,19 @@ impl TryFrom<&types::ConnectorCustomerRouterData> for GocardlessCustomerRequest
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::ConnectorCustomerRouterData) -> Result<Self, Self::Error> {
let email = item.request.get_email()?;
- let billing_details = match &item.request.payment_method_data {
- domain::PaymentMethodData::BankDebit(bank_debit_data) => {
- match bank_debit_data.clone() {
- domain::BankDebitData::AchBankDebit {
- billing_details, ..
- } => Ok(billing_details),
- domain::BankDebitData::SepaBankDebit {
- billing_details, ..
- } => Ok(billing_details),
- domain::BankDebitData::BecsBankDebit {
- billing_details, ..
- } => Ok(billing_details),
- domain::BankDebitData::BacsBankDebit { .. } => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Gocardless"),
- ))
- }
- }
- }
- domain::PaymentMethodData::Card(_)
- | domain::PaymentMethodData::CardRedirect(_)
- | domain::PaymentMethodData::Wallet(_)
- | domain::PaymentMethodData::PayLater(_)
- | domain::PaymentMethodData::BankRedirect(_)
- | domain::PaymentMethodData::BankTransfer(_)
- | domain::PaymentMethodData::Crypto(_)
- | domain::PaymentMethodData::MandatePayment
- | domain::PaymentMethodData::Reward
- | domain::PaymentMethodData::Upi(_)
- | domain::PaymentMethodData::Voucher(_)
- | domain::PaymentMethodData::GiftCard(_)
- | domain::PaymentMethodData::CardToken(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Gocardless"),
- ))
- }
- }?;
-
- let billing_details_name = billing_details.name.expose();
+ let billing_details_name = item.get_billing_full_name()?.expose();
- if billing_details_name.is_empty() {
- Err(errors::ConnectorError::MissingRequiredField {
- field_name: "billing_details.name",
- })?
- }
let (given_name, family_name) = billing_details_name
.trim()
.rsplit_once(' ')
.unwrap_or((&billing_details_name, &billing_details_name));
- let billing_address = billing_details
- .address
- .ok_or_else(utils::missing_field_err("billing_details.address"))?;
+ let billing_address = item.get_billing_address()?;
let metadata = CustomerMetaData {
crm_id: item.customer_id.clone().map(Secret::new),
};
- let region = get_region(&billing_address)?;
+ let region = get_region(billing_address)?;
Ok(Self {
customers: GocardlessCustomer {
email,
@@ -141,7 +95,7 @@ impl TryFrom<&types::ConnectorCustomerRouterData> for GocardlessCustomerRequest
postal_code: billing_address.zip.to_owned(),
// Should be populated based on the billing country
swedish_identity_number: None,
- city: billing_address.city.map(Secret::new),
+ city: billing_address.city.clone().map(Secret::new),
},
})
}
@@ -274,7 +228,7 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount {
fn try_from(item: &types::TokenizationRouterData) -> Result<Self, Self::Error> {
match &item.request.payment_method_data {
domain::PaymentMethodData::BankDebit(bank_debit_data) => {
- Self::try_from(bank_debit_data)
+ Self::try_from((bank_debit_data, item))
}
domain::PaymentMethodData::Card(_)
| domain::PaymentMethodData::CardRedirect(_)
@@ -298,26 +252,21 @@ impl TryFrom<&types::TokenizationRouterData> for CustomerBankAccount {
}
}
-impl TryFrom<&domain::BankDebitData> for CustomerBankAccount {
+impl TryFrom<(&domain::BankDebitData, &types::TokenizationRouterData)> for CustomerBankAccount {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(item: &domain::BankDebitData) -> Result<Self, Self::Error> {
- match item {
+ fn try_from(
+ (bank_debit_data, item): (&domain::BankDebitData, &types::TokenizationRouterData),
+ ) -> Result<Self, Self::Error> {
+ match bank_debit_data {
domain::BankDebitData::AchBankDebit {
- billing_details,
account_number,
routing_number,
bank_type,
- bank_account_holder_name,
..
} => {
let bank_type = bank_type.ok_or_else(utils::missing_field_err("bank_type"))?;
- let country_code = billing_details.get_billing_country()?;
- let account_holder_name =
- bank_account_holder_name
- .clone()
- .ok_or_else(utils::missing_field_err(
- "payment_method_data.bank_debit.ach_bank_debit.bank_account_holder_name",
- ))?;
+ let country_code = item.get_billing_country()?;
+ let account_holder_name = item.get_billing_full_name()?;
let us_bank_account = USBankAccount {
country_code,
account_number: account_number.clone(),
@@ -328,18 +277,11 @@ impl TryFrom<&domain::BankDebitData> for CustomerBankAccount {
Ok(Self::USBankAccount(us_bank_account))
}
domain::BankDebitData::BecsBankDebit {
- billing_details,
account_number,
bsb_number,
- bank_account_holder_name,
} => {
- let country_code = billing_details.get_billing_country()?;
- let account_holder_name =
- bank_account_holder_name
- .clone()
- .ok_or_else(utils::missing_field_err(
- "payment_method_data.bank_debit.becs_bank_debit.bank_account_holder_name",
- ))?;
+ let country_code = item.get_billing_country()?;
+ let account_holder_name = item.get_billing_full_name()?;
let au_bank_account = AUBankAccount {
country_code,
account_number: account_number.clone(),
@@ -348,17 +290,8 @@ impl TryFrom<&domain::BankDebitData> for CustomerBankAccount {
};
Ok(Self::AUBankAccount(au_bank_account))
}
- domain::BankDebitData::SepaBankDebit {
- iban,
- bank_account_holder_name,
- ..
- } => {
- let account_holder_name =
- bank_account_holder_name
- .clone()
- .ok_or_else(utils::missing_field_err(
- "payment_method_data.bank_debit.sepa_bank_debit.bank_account_holder_name",
- ))?;
+ domain::BankDebitData::SepaBankDebit { iban, .. } => {
+ let account_holder_name = item.get_billing_full_name()?;
let international_bank_account = InternationalBankAccount {
iban: iban.clone(),
account_holder_name,
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index b61122fbfa2..e2c3fc66992 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -195,7 +195,7 @@ impl TryFrom<&MollieRouterData<&types::PaymentsAuthorizeRouterData>> for MollieP
get_payment_method_for_wallet(item.router_data, wallet_data)
}
domain::PaymentMethodData::BankDebit(ref directdebit_data) => {
- PaymentMethodData::try_from(directdebit_data)
+ PaymentMethodData::try_from((directdebit_data, item.router_data))
}
_ => Err(
errors::ConnectorError::NotImplemented("Payment Method".to_string()).into(),
@@ -254,18 +254,18 @@ impl TryFrom<&domain::BankRedirectData> for PaymentMethodData {
}
}
-impl TryFrom<&domain::BankDebitData> for PaymentMethodData {
+impl TryFrom<(&domain::BankDebitData, &types::PaymentsAuthorizeRouterData)> for PaymentMethodData {
type Error = Error;
- fn try_from(value: &domain::BankDebitData) -> Result<Self, Self::Error> {
- match value {
- domain::BankDebitData::SepaBankDebit {
- bank_account_holder_name,
- iban,
- ..
- } => Ok(Self::DirectDebit(Box::new(DirectDebitMethodData {
- consumer_name: bank_account_holder_name.clone(),
- consumer_account: iban.clone(),
- }))),
+ fn try_from(
+ (bank_debit_data, item): (&domain::BankDebitData, &types::PaymentsAuthorizeRouterData),
+ ) -> Result<Self, Self::Error> {
+ match bank_debit_data {
+ domain::BankDebitData::SepaBankDebit { iban, .. } => {
+ Ok(Self::DirectDebit(Box::new(DirectDebitMethodData {
+ consumer_name: item.get_optional_billing_full_name(),
+ consumer_account: iban.clone(),
+ })))
+ }
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
diff --git a/crates/router/src/connector/stax/transformers.rs b/crates/router/src/connector/stax/transformers.rs
index d48a2b1e82b..95e5dbe4f4f 100644
--- a/crates/router/src/connector/stax/transformers.rs
+++ b/crates/router/src/connector/stax/transformers.rs
@@ -227,7 +227,6 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
Ok(Self::Card(stax_card_data))
}
domain::PaymentMethodData::BankDebit(domain::BankDebitData::AchBankDebit {
- billing_details,
account_number,
routing_number,
bank_name,
@@ -236,7 +235,7 @@ impl TryFrom<&types::TokenizationRouterData> for StaxTokenRequest {
..
}) => {
let stax_bank_data = StaxBankTokenizeData {
- person_name: billing_details.name,
+ person_name: item.get_billing_full_name()?,
bank_account: account_number,
bank_routing: routing_number,
bank_name: bank_name.ok_or_else(missing_field_err("bank_name"))?,
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 6b82c87b5d1..6c8277288cc 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -1057,37 +1057,6 @@ impl From<&domain::BankDebitData> for StripePaymentMethodType {
}
}
-impl From<&domain::BankDebitBilling> for StripeBillingAddress {
- fn from(item: &domain::BankDebitBilling) -> Self {
- Self {
- email: Some(item.email.to_owned()),
- country: item
- .address
- .as_ref()
- .and_then(|address| address.country.to_owned()),
- name: Some(item.name.to_owned()),
- city: item
- .address
- .as_ref()
- .and_then(|address| address.city.to_owned()),
- address_line1: item
- .address
- .as_ref()
- .and_then(|address| address.line1.to_owned()),
- address_line2: item
- .address
- .as_ref()
- .and_then(|address| address.line2.to_owned()),
- zip_code: item
- .address
- .as_ref()
- .and_then(|address| address.zip.to_owned()),
- state: None,
- phone: None,
- }
- }
-}
-
impl TryFrom<(&domain::BankRedirectData, Option<bool>)> for StripeBillingAddress {
type Error = error_stack::Report<errors::ConnectorError>;
@@ -1190,10 +1159,9 @@ impl TryFrom<(&domain::BankRedirectData, Option<bool>)> for StripeBillingAddress
fn get_bank_debit_data(
bank_debit_data: &domain::BankDebitData,
-) -> (StripePaymentMethodType, BankDebitData, StripeBillingAddress) {
+) -> (StripePaymentMethodType, BankDebitData) {
match bank_debit_data {
domain::BankDebitData::AchBankDebit {
- billing_details,
account_number,
routing_number,
..
@@ -1203,24 +1171,15 @@ fn get_bank_debit_data(
account_number: account_number.to_owned(),
routing_number: routing_number.to_owned(),
};
-
- let billing_data = StripeBillingAddress::from(billing_details);
- (StripePaymentMethodType::Ach, ach_data, billing_data)
+ (StripePaymentMethodType::Ach, ach_data)
}
- domain::BankDebitData::SepaBankDebit {
- billing_details,
- iban,
- ..
- } => {
+ domain::BankDebitData::SepaBankDebit { iban, .. } => {
let sepa_data = BankDebitData::Sepa {
iban: iban.to_owned(),
};
-
- let billing_data = StripeBillingAddress::from(billing_details);
- (StripePaymentMethodType::Sepa, sepa_data, billing_data)
+ (StripePaymentMethodType::Sepa, sepa_data)
}
domain::BankDebitData::BecsBankDebit {
- billing_details,
account_number,
bsb_number,
..
@@ -1229,12 +1188,9 @@ fn get_bank_debit_data(
account_number: account_number.to_owned(),
bsb_number: bsb_number.to_owned(),
};
-
- let billing_data = StripeBillingAddress::from(billing_details);
- (StripePaymentMethodType::Becs, becs_data, billing_data)
+ (StripePaymentMethodType::Becs, becs_data)
}
domain::BankDebitData::BacsBankDebit {
- billing_details,
account_number,
sort_code,
..
@@ -1243,9 +1199,7 @@ fn get_bank_debit_data(
account_number: account_number.to_owned(),
sort_code: Secret::new(sort_code.clone().expose().replace('-', "")),
};
-
- let billing_data = StripeBillingAddress::from(billing_details);
- (StripePaymentMethodType::Bacs, bacs_data, billing_data)
+ (StripePaymentMethodType::Bacs, bacs_data)
}
}
}
@@ -1308,7 +1262,7 @@ fn create_stripe_payment_method(
))
}
domain::PaymentMethodData::BankDebit(bank_debit_data) => {
- let (pm_type, bank_debit_data, billing_address) = get_bank_debit_data(bank_debit_data);
+ let (pm_type, bank_debit_data) = get_bank_debit_data(bank_debit_data);
let pm_data = StripePaymentMethodData::BankDebit(StripeBankDebitData {
bank_specific_data: bank_debit_data,
@@ -3680,7 +3634,7 @@ impl
Ok(Self::try_from((wallet_data, None))?)
}
domain::PaymentMethodData::BankDebit(bank_debit_data) => {
- let (_pm_type, bank_data, _) = get_bank_debit_data(&bank_debit_data);
+ let (_pm_type, bank_data) = get_bank_debit_data(&bank_debit_data);
Ok(Self::BankDebit(StripeBankDebitData {
bank_specific_data: bank_data,
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 5a5b1242611..872d287e874 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -75,6 +75,7 @@ pub trait RouterData {
fn get_connector_meta(&self) -> Result<pii::SecretSerdeValue, Error>;
fn get_session_token(&self) -> Result<String, Error>;
fn get_billing_first_name(&self) -> Result<Secret<String>, Error>;
+ fn get_billing_full_name(&self) -> Result<Secret<String>, Error>;
fn get_billing_email(&self) -> Result<Email, Error>;
fn get_billing_phone_number(&self) -> Result<Secret<String>, Error>;
fn to_connector_meta<T>(&self) -> Result<T, Error>
@@ -171,7 +172,9 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
.get_payment_method_billing()
.and_then(|a| a.address.as_ref())
.and_then(|ad| ad.country)
- .ok_or_else(missing_field_err("billing.address.country"))
+ .ok_or_else(missing_field_err(
+ "payment_method_data.billing.address.country",
+ ))
}
fn get_billing_phone(&self) -> Result<&api::PhoneDetails, Error> {
@@ -233,6 +236,15 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
))
}
+ fn get_billing_full_name(&self) -> Result<Secret<String>, Error> {
+ self.get_optional_billing()
+ .and_then(|billing_details| billing_details.address.as_ref())
+ .and_then(|billing_address| billing_address.get_optional_full_name())
+ .ok_or_else(missing_field_err(
+ "payment_method_data.billing.address.first_name",
+ ))
+ }
+
fn get_billing_email(&self) -> Result<Email, Error> {
self.address
.get_payment_method_billing()
@@ -1502,19 +1514,6 @@ impl BankRedirectBillingData for domain::BankRedirectBilling {
}
}
-pub trait BankDirectDebitBillingData {
- fn get_billing_country(&self) -> Result<api_models::enums::CountryAlpha2, Error>;
-}
-
-impl BankDirectDebitBillingData for domain::BankDebitBilling {
- fn get_billing_country(&self) -> Result<api_models::enums::CountryAlpha2, Error> {
- self.address
- .as_ref()
- .and_then(|address| address.country)
- .ok_or_else(missing_field_err("billing_details.country"))
- }
-}
-
pub trait MandateData {
fn get_end_date(&self, format: date_time::DateFormat) -> Result<String, Error>;
fn get_metadata(&self) -> Result<pii::SecretSerdeValue, Error>;
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 88138d7909f..1de52e940e2 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -751,15 +751,15 @@ pub async fn retrieve_payment_method_from_auth_service(
.get_required_value("email")?;
let billing_details = BankDebitBilling {
- name,
- email,
+ name: Some(name),
+ email: Some(email),
address: address_details,
};
let payment_method_data = match &bank_account.account_details {
pm_auth_types::PaymentMethodTypeDetails::Ach(ach) => {
PaymentMethodData::BankDebit(BankDebitData::AchBankDebit {
- billing_details,
+ billing_details: Some(billing_details),
account_number: ach.account_number.clone(),
routing_number: ach.routing_number.clone(),
card_holder_name: None,
@@ -771,7 +771,7 @@ pub async fn retrieve_payment_method_from_auth_service(
}
pm_auth_types::PaymentMethodTypeDetails::Bacs(bacs) => {
PaymentMethodData::BankDebit(BankDebitData::BacsBankDebit {
- billing_details,
+ billing_details: Some(billing_details),
account_number: bacs.account_number.clone(),
sort_code: bacs.sort_code.clone(),
bank_account_holder_name: None,
@@ -779,7 +779,7 @@ pub async fn retrieve_payment_method_from_auth_service(
}
pm_auth_types::PaymentMethodTypeDetails::Sepa(sepa) => {
PaymentMethodData::BankDebit(BankDebitData::SepaBankDebit {
- billing_details,
+ billing_details: Some(billing_details),
iban: sepa.iban.clone(),
bank_account_holder_name: None,
})
diff --git a/crates/router/src/types/domain/payments.rs b/crates/router/src/types/domain/payments.rs
index 58f2fa98eef..195681ff91a 100644
--- a/crates/router/src/types/domain/payments.rs
+++ b/crates/router/src/types/domain/payments.rs
@@ -382,41 +382,25 @@ pub struct CardToken {
#[serde(rename_all = "snake_case")]
pub enum BankDebitData {
AchBankDebit {
- billing_details: BankDebitBilling,
account_number: Secret<String>,
routing_number: Secret<String>,
- card_holder_name: Option<Secret<String>>,
- bank_account_holder_name: Option<Secret<String>>,
bank_name: Option<common_enums::BankNames>,
bank_type: Option<common_enums::BankType>,
bank_holder_type: Option<common_enums::BankHolderType>,
},
SepaBankDebit {
- billing_details: BankDebitBilling,
iban: Secret<String>,
- bank_account_holder_name: Option<Secret<String>>,
},
BecsBankDebit {
- billing_details: BankDebitBilling,
account_number: Secret<String>,
bsb_number: Secret<String>,
- bank_account_holder_name: Option<Secret<String>>,
},
BacsBankDebit {
- billing_details: BankDebitBilling,
account_number: Secret<String>,
sort_code: Secret<String>,
- bank_account_holder_name: Option<Secret<String>>,
},
}
-#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, Eq, PartialEq)]
-pub struct BankDebitBilling {
- pub name: Secret<String>,
- pub email: Email,
- pub address: Option<api_models::payments::AddressDetails>,
-}
-
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferData {
@@ -899,70 +883,37 @@ impl From<api_models::payments::BankDebitData> for BankDebitData {
fn from(value: api_models::payments::BankDebitData) -> Self {
match value {
api_models::payments::BankDebitData::AchBankDebit {
- billing_details,
account_number,
routing_number,
- card_holder_name,
- bank_account_holder_name,
bank_name,
bank_type,
bank_holder_type,
+ ..
} => Self::AchBankDebit {
- billing_details: BankDebitBilling {
- name: billing_details.name,
- email: billing_details.email,
- address: billing_details.address,
- },
account_number,
routing_number,
- card_holder_name,
- bank_account_holder_name,
bank_name,
bank_type,
bank_holder_type,
},
- api_models::payments::BankDebitData::SepaBankDebit {
- billing_details,
- iban,
- bank_account_holder_name,
- } => Self::SepaBankDebit {
- billing_details: BankDebitBilling {
- name: billing_details.name,
- email: billing_details.email,
- address: billing_details.address,
- },
- iban,
- bank_account_holder_name,
- },
+ api_models::payments::BankDebitData::SepaBankDebit { iban, .. } => {
+ Self::SepaBankDebit { iban }
+ }
api_models::payments::BankDebitData::BecsBankDebit {
- billing_details,
account_number,
bsb_number,
- bank_account_holder_name,
+ ..
} => Self::BecsBankDebit {
- billing_details: BankDebitBilling {
- name: billing_details.name,
- email: billing_details.email,
- address: billing_details.address,
- },
account_number,
bsb_number,
- bank_account_holder_name,
},
api_models::payments::BankDebitData::BacsBankDebit {
- billing_details,
account_number,
sort_code,
- bank_account_holder_name,
+ ..
} => Self::BacsBankDebit {
- billing_details: BankDebitBilling {
- name: billing_details.name,
- email: billing_details.email,
- address: billing_details.address,
- },
account_number,
sort_code,
- bank_account_holder_name,
},
}
}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index c330816cea8..391a9176698 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -5272,20 +5272,18 @@
},
"BankDebitBilling": {
"type": "object",
- "required": [
- "name",
- "email"
- ],
"properties": {
"name": {
"type": "string",
"description": "The billing name for bank debits",
- "example": "John Doe"
+ "example": "John Doe",
+ "nullable": true
},
"email": {
"type": "string",
"description": "The billing email for bank debits",
- "example": "[email protected]"
+ "example": "[email protected]",
+ "nullable": true
},
"address": {
"allOf": [
@@ -5309,7 +5307,6 @@
"type": "object",
"description": "Payment Method data for Ach bank debit",
"required": [
- "billing_details",
"account_number",
"routing_number",
"card_holder_name",
@@ -5320,7 +5317,12 @@
],
"properties": {
"billing_details": {
- "$ref": "#/components/schemas/BankDebitBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankDebitBilling"
+ }
+ ],
+ "nullable": true
},
"account_number": {
"type": "string",
@@ -5365,13 +5367,17 @@
"sepa_bank_debit": {
"type": "object",
"required": [
- "billing_details",
"iban",
"bank_account_holder_name"
],
"properties": {
"billing_details": {
- "$ref": "#/components/schemas/BankDebitBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankDebitBilling"
+ }
+ ],
+ "nullable": true
},
"iban": {
"type": "string",
@@ -5396,13 +5402,17 @@
"becs_bank_debit": {
"type": "object",
"required": [
- "billing_details",
"account_number",
"bsb_number"
],
"properties": {
"billing_details": {
- "$ref": "#/components/schemas/BankDebitBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankDebitBilling"
+ }
+ ],
+ "nullable": true
},
"account_number": {
"type": "string",
@@ -5433,14 +5443,18 @@
"bacs_bank_debit": {
"type": "object",
"required": [
- "billing_details",
"account_number",
"sort_code",
"bank_account_holder_name"
],
"properties": {
"billing_details": {
- "$ref": "#/components/schemas/BankDebitBilling"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankDebitBilling"
+ }
+ ],
+ "nullable": true
},
"account_number": {
"type": "string",
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
index 78d949505f4..53fe9371e49 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario20-Bank Debit-ach/Payments - Create/request.json
@@ -75,6 +75,19 @@
}
}
},
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "HarrisonStreet",
+ "line3": "HarrisonStreet",
+ "city": "SanFransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "Swangi",
+ "last_name": "Kumari"
+ }
+ },
"metadata": {
"order_details": {
"product_name": "Apple iphone 15",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index d4ed3bd3ae0..09fec42b0ba 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -16707,7 +16707,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":1800,\"currency\":\"USD\",\"confirm\":true,\"business_label\":\"default\",\"capture_method\":\"automatic\",\"connector\":[\"stripe\"],\"customer_id\":\"klarna\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"business_country\":\"US\",\"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\"}}},\"customer_acceptance\":{\"acceptance_type\":\"online\",\"accepted_at\":\"2022-09-10T10:11:12Z\",\"online\":{\"ip_address\":\"123.32.25.123\",\"user_agent\":\"Mozilla/5.0 (Linux; Android 12; SM-S906N Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.119 Mobile Safari/537.36\"}},\"payment_method\":\"bank_debit\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_debit\":{\"ach_bank_debit\":{\"billing_details\":{\"name\":\"John Doe\",\"email\":\"[email protected]\"},\"account_number\":\"000123456789\",\"routing_number\":\"110000000\"}}},\"metadata\":{\"order_details\":{\"product_name\":\"Apple iphone 15\",\"quantity\":1,\"amount\":1800,\"account_name\":\"transaction_processing\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"amount\":1800,\"currency\":\"USD\",\"confirm\":true,\"business_label\":\"default\",\"capture_method\":\"automatic\",\"connector\":[\"stripe\"],\"customer_id\":\"klarna\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"authentication_type\":\"three_ds\",\"email\":\"[email protected]\",\"name\":\"JohnDoe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Itsmyfirstpaymentrequest\",\"return_url\":\"https://google.com\",\"statement_descriptor_name\":\"Juspay\",\"statement_descriptor_suffix\":\"Router\",\"setup_future_usage\":\"off_session\",\"business_country\":\"US\",\"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;Android12;SM-S906NBuild/QP1A.190711.020;wv)AppleWebKit/537.36(KHTML,likeGecko)Version/4.0Chrome/80.0.3987.119MobileSafari/537.36\"}},\"mandate_type\":{\"single_use\":{\"amount\":6540,\"currency\":\"USD\"}}},\"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;Android12;SM-S906NBuild/QP1A.190711.020;wv)AppleWebKit/537.36(KHTML,likeGecko)Version/4.0Chrome/80.0.3987.119MobileSafari/537.36\"}},\"payment_method\":\"bank_debit\",\"payment_method_type\":\"ach\",\"payment_method_data\":{\"bank_debit\":{\"ach_bank_debit\":{\"billing_details\":{\"name\":\"JohnDoe\",\"email\":\"[email protected]\"},\"account_number\":\"000123456789\",\"routing_number\":\"110000000\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"HarrisonStreet\",\"line3\":\"HarrisonStreet\",\"city\":\"SanFransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Swangi\",\"last_name\":\"Kumari\"}},\"metadata\":{\"order_details\":{\"product_name\":\"Appleiphone15\",\"quantity\":1,\"amount\":1800,\"account_name\":\"transaction_processing\"}},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
|
refactor
|
remove billingdetails from bankdebit pmd (#4371)
|
cb5761be47fa5a9f6a1e0abb135369de96a116fa
|
2024-03-04 05:47:07
|
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 14a9a13f055..08cf0761e4e 100644
--- a/postman/collection-json/adyen_uk.postman_collection.json
+++ b/postman/collection-json/adyen_uk.postman_collection.json
@@ -472,7 +472,7 @@
"language": "json"
}
},
- "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"adyen\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\",\"api_secret\":\"{{connector_api_secret}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"debit\",\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"pay_later\",\"payment_method_types\":[{\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"affirm\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"afterpay_clearpay\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"pay_bright\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"walley\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"paypal\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"mobile_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"ali_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"we_chat_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"mb_way\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"gift_card\",\"payment_method_types\":[{\"payment_method_type\":\"givex\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"bank_redirect\",\"payment_method_types\":[{\"payment_method_type\":\"giropay\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"eps\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"sofort\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"blik\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"trustly\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_czech_republic\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_finland\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_poland\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_slovakia\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"bancontact_card\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"bank_debit\",\"payment_method_types\":[{\"payment_method_type\":\"ach\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"bacs\",\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"google_pay\":{\"allowed_payment_methods\":[{\"type\":\"CARD\",\"parameters\":{\"allowed_auth_methods\":[\"PAN_ONLY\",\"CRYPTOGRAM_3DS\"],\"allowed_card_networks\":[\"AMEX\",\"DISCOVER\",\"INTERAC\",\"JCB\",\"MASTERCARD\",\"VISA\"]},\"tokenization_specification\":{\"type\":\"PAYMENT_GATEWAY\"}}],\"merchant_info\":{\"merchant_name\":\"Narayan Bhat\"}}}}"
+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"adyen\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\",\"api_secret\":\"{{connector_api_secret}}\"},\"test_mode\":true,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"debit\",\"card_networks\":[\"AmericanExpress\",\"Discover\",\"Interac\",\"JCB\",\"Mastercard\",\"Visa\",\"DinersClub\",\"UnionPay\",\"RuPay\"],\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"pay_later\",\"payment_method_types\":[{\"payment_method_type\":\"klarna\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"affirm\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"afterpay_clearpay\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"pay_bright\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"walley\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"paypal\",\"payment_experience\":\"redirect_to_url\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"card_networks\":null,\"accepted_currencies\":null,\"accepted_countries\":null,\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"mobile_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"ali_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"we_chat_pay\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"mb_way\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"gift_card\",\"payment_method_types\":[{\"payment_method_type\":\"givex\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"bank_redirect\",\"payment_method_types\":[{\"payment_method_type\":\"giropay\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"eps\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"sofort\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"blik\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"trustly\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_czech_republic\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_finland\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_poland\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"online_banking_slovakia\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"bancontact_card\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"bank_debit\",\"payment_method_types\":[{\"payment_method_type\":\"ach\",\"recurring_enabled\":true,\"installment_payment_enabled\":true},{\"payment_method_type\":\"bacs\",\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}],\"metadata\":{\"google_pay\":{\"allowed_payment_methods\":[{\"type\":\"CARD\",\"parameters\":{\"allowed_auth_methods\":[\"PAN_ONLY\",\"CRYPTOGRAM_3DS\"],\"allowed_card_networks\":[\"AMEX\",\"DISCOVER\",\"INTERAC\",\"JCB\",\"MASTERCARD\",\"VISA\"]},\"tokenization_specification\":{\"type\":\"PAYMENT_GATEWAY\"}}],\"merchant_info\":{\"merchant_name\":\"Narayan Bhat\"}}}}"
},
"url": {
"raw": "{{baseUrl}}/account/:account_id/connectors",
@@ -3020,7 +3020,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -3051,9 +3051,9 @@
"// Response body should have value \"cancelled\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'cancelled'\",",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -3134,7 +3134,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -3178,9 +3178,9 @@
"// Response body should have value \"cancelled\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 7df7ba5158d..78a1777864a 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -6312,10 +6312,10 @@
"name": "Happy Cases",
"item": [
{
- "name": "Scenario28-Confirm a payment with requires_customer_action status",
+ "name": "Scenario2-Create a payment and Confirm",
"item": [
{
- "name": "Payments - Create with confirm true",
+ "name": "Payments - Create",
"event": [
{
"listen": "test",
@@ -6383,104 +6383,24 @@
" );",
"}",
"",
- "// Response body should have value \"requires_customer_action\" for \"status\"",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
""
],
"type": "text/javascript"
}
- }
- ],
- "request": {
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
},
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
- },
- "response": []
- },
- {
- "name": "Payments - Confirm",
- "event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 400\", function () {",
- " pm.response.to.be.error;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// 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) { }",
- "",
- "",
- "// Response body should have appropriatae error message",
- "if (jsonData?.message) {",
- " pm.test(",
- " \"Content check if appropriate error message is present\",",
- " function () {",
- " pm.expect(jsonData.message).to.eql(\"You cannot confirm this payment because it has status requires_customer_action\");",
- " },",
- " );",
- "}",
""
],
"type": "text/javascript"
@@ -6488,26 +6408,6 @@
}
],
"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": [
{
@@ -6526,56 +6426,45 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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"
+ "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-Create payment with confirm true",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "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 - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -6627,21 +6516,21 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
""
],
"type": "text/javascript"
@@ -6649,6 +6538,26 @@
}
],
"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": [
{
@@ -6667,18 +6576,27 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "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": []
},
@@ -6751,24 +6669,15 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"connector_transaction_id\"",
- "pm.test(",
- " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
- " .true;",
- " },",
- ");",
""
],
"type": "text/javascript"
@@ -6813,10 +6722,10 @@
]
},
{
- "name": "Scenario2-Create payment with confirm false",
+ "name": "Scenario28-Confirm a payment with requires_customer_action status",
"item": [
{
- "name": "Payments - Create",
+ "name": "Payments - Create with confirm true",
"event": [
{
"listen": "test",
@@ -6884,24 +6793,24 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "// Response body should have value \"requires_customer_action\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_customer_action'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_customer_action\");",
" },",
" );",
"}",
- ""
- ],
- "type": "text/javascript"
- }
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
+ "",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'next_action.redirect_to_url' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.next_action.redirect_to_url !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -6927,7 +6836,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"business_country\":\"US\",\"business_label\":\"default\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"three_ds\",\"return_url\":\"https://duck.com\",\"setup_future_usage\":\"on_session\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4000000000003063\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -6950,22 +6859,1030 @@
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
+ "pm.test(\"[GET]::/payments/:id - Status code is 400\", function () {",
+ " pm.response.to.be.error;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// 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) { }",
+ "",
+ "",
+ "// Response body should have appropriatae error message",
+ "if (jsonData?.message) {",
+ " pm.test(",
+ " \"Content check if appropriate error message is present\",",
+ " function () {",
+ " pm.expect(jsonData.message).to.eql(\"You cannot confirm this payment because it has status requires_customer_action\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "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": "Scenario29-Create payment with payment method billing",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) { }",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) { }",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "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": "Scenario30-Update payment with payment method billing",
+ "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 client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Update",
+ "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) { }",
+ "",
+ "// Response body should have value \"requires_confirmation\" 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_confirmation\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "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": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "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_confirmation\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "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": "Scenario31-Pass payment method billing in Confirm",
+ "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\":6540,\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "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 \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrisoff Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"Narayan\",\"last_name\":\"Doe\"},\"email\":\"[email protected]\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "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(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "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(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -6973,7 +7890,7 @@
"let jsonData = {};",
"try {",
" jsonData = pm.response.json();",
- "} catch (e) {}",
+ "} catch (e) { }",
"",
"// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
"if (jsonData?.payment_id) {",
@@ -7017,21 +7934,154 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"payment_method_data.billing\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data.billing' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data.billing !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
}
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
},
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario1-Create payment with confirm true",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
{
- "listen": "prerequest",
+ "listen": "test",
"script": {
"exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -7039,26 +8089,6 @@
}
],
"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": [
{
@@ -7077,27 +8107,18 @@
"language": "json"
}
},
- "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"Joseph Doe\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"sundari\",\"last_name\":\"sundari\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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"
+ "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": []
},
@@ -7170,15 +8191,24 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
|
chore
|
update Postman collection files
|
f7f5ba7c0bbf694dbeecec73f8383ac678dd4425
|
2024-08-30 22:32:01
|
Swangi Kumari
|
chore(config): add support for some more country and currencies for Mifinity Wallet (#5639)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 608a956e109..b54cd0df0d1 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -544,7 +544,7 @@ debit = { currency = "USD" }
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[connector_customer]
connector_list = "gocardless,stax,stripe"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 9d8e038d659..ed2981fb79c 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -275,7 +275,7 @@ we_chat_pay.currency = "GBP,CNY"
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.prophetpay]
card_redirect.currency = "USD"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 0c7ccdcd74b..78c6f3ea66d 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -294,7 +294,7 @@ we_chat_pay.currency = "GBP,CNY"
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.prophetpay]
card_redirect.currency = "USD"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 7c26739c6e0..cf5f360cedf 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -297,7 +297,7 @@ we_chat_pay.currency = "GBP,CNY"
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.prophetpay]
card_redirect.currency = "USD"
diff --git a/config/development.toml b/config/development.toml
index 8a7d2b18c2e..b920923f8c6 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -454,7 +454,7 @@ debit = { currency = "USD" }
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "AUD,EUR,EUR,CAD,CZK,DKK,EUR,EUR,EUR,EUR,EUR,EUR,EUR,NZD,NOK,PLN,EUR,EUR,SEK,CHF,GBP,USD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 4461ece36d3..bac365eedae 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -418,7 +418,7 @@ debit = { currency = "USD" }
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }
[pm_filters.mifinity]
-mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD" }
+mifinity = { country = "BR,CN,SG,MY,DE,CH,DK,GB,ES,AD,GI,FI,FR,GR,HR,IT,JP,MX,AR,CO,CL,PE,VE,UY,PY,BO,EC,GT,HN,SV,NI,CR,PA,DO,CU,PR,NL,NO,PL,PT,SE,RU,TR,TW,HK,MO,AX,AL,DZ,AS,AO,AI,AG,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BE,BZ,BJ,BM,BT,BQ,BA,BW,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CX,CC,KM,CG,CK,CI,CW,CY,CZ,DJ,DM,EG,GQ,ER,EE,ET,FK,FO,FJ,GF,PF,TF,GA,GM,GE,GH,GL,GD,GP,GU,GG,GN,GW,GY,HT,HM,VA,IS,IN,ID,IE,IM,IL,JE,JO,KZ,KE,KI,KW,KG,LA,LV,LB,LS,LI,LT,LU,MK,MG,MW,MV,ML,MT,MH,MQ,MR,MU,YT,FM,MD,MC,MN,ME,MS,MA,MZ,NA,NR,NP,NC,NZ,NE,NG,NU,NF,MP,OM,PK,PW,PS,PG,PH,PN,QA,RE,RO,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SX,SK,SI,SB,SO,ZA,GS,KR,LK,SR,SJ,SZ,TH,TL,TG,TK,TO,TT,TN,TM,TC,TV,UG,UA,AE,UZ,VU,VN,VG,VI,WF,EH,ZM", currency = "AUD,CAD,CHF,CNY,CZK,DKK,EUR,GBP,INR,JPY,NOK,NZD,PLN,RUB,SEK,ZAR,USD,EGP,UYU,UZS" }
[pm_filters.stax]
credit = { currency = "USD" }
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 9a2af153ee6..8bcceb4a4b8 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -8728,7 +8728,188 @@ impl Default for super::settings::RequiredFields {
"TR".to_string(),
"TW".to_string(),
"HK".to_string(),
- "MO".to_string(),
+ "MO".to_string(),
+ "AX".to_string(),
+ "AL".to_string(),
+ "DZ".to_string(),
+ "AS".to_string(),
+ "AO".to_string(),
+ "AI".to_string(),
+ "AG".to_string(),
+ "AM".to_string(),
+ "AW".to_string(),
+ "AU".to_string(),
+ "AT".to_string(),
+ "AZ".to_string(),
+ "BS".to_string(),
+ "BH".to_string(),
+ "BD".to_string(),
+ "BB".to_string(),
+ "BE".to_string(),
+ "BZ".to_string(),
+ "BJ".to_string(),
+ "BM".to_string(),
+ "BT".to_string(),
+ "BQ".to_string(),
+ "BA".to_string(),
+ "BW".to_string(),
+ "IO".to_string(),
+ "BN".to_string(),
+ "BG".to_string(),
+ "BF".to_string(),
+ "BI".to_string(),
+ "KH".to_string(),
+ "CM".to_string(),
+ "CA".to_string(),
+ "CV".to_string(),
+ "KY".to_string(),
+ "CF".to_string(),
+ "TD".to_string(),
+ "CX".to_string(),
+ "CC".to_string(),
+ "KM".to_string(),
+ "CG".to_string(),
+ "CK".to_string(),
+ "CI".to_string(),
+ "CW".to_string(),
+ "CY".to_string(),
+ "CZ".to_string(),
+ "DJ".to_string(),
+ "DM".to_string(),
+ "EG".to_string(),
+ "GQ".to_string(),
+ "ER".to_string(),
+ "EE".to_string(),
+ "ET".to_string(),
+ "FK".to_string(),
+ "FO".to_string(),
+ "FJ".to_string(),
+ "GF".to_string(),
+ "PF".to_string(),
+ "TF".to_string(),
+ "GA".to_string(),
+ "GM".to_string(),
+ "GE".to_string(),
+ "GH".to_string(),
+ "GL".to_string(),
+ "GD".to_string(),
+ "GP".to_string(),
+ "GU".to_string(),
+ "GG".to_string(),
+ "GN".to_string(),
+ "GW".to_string(),
+ "GY".to_string(),
+ "HT".to_string(),
+ "HM".to_string(),
+ "VA".to_string(),
+ "IS".to_string(),
+ "IN".to_string(),
+ "ID".to_string(),
+ "IE".to_string(),
+ "IM".to_string(),
+ "IL".to_string(),
+ "JE".to_string(),
+ "JO".to_string(),
+ "KZ".to_string(),
+ "KE".to_string(),
+ "KI".to_string(),
+ "KW".to_string(),
+ "KG".to_string(),
+ "LA".to_string(),
+ "LV".to_string(),
+ "LB".to_string(),
+ "LS".to_string(),
+ "LI".to_string(),
+ "LT".to_string(),
+ "LU".to_string(),
+ "MK".to_string(),
+ "MG".to_string(),
+ "MW".to_string(),
+ "MV".to_string(),
+ "ML".to_string(),
+ "MT".to_string(),
+ "MH".to_string(),
+ "MQ".to_string(),
+ "MR".to_string(),
+ "MU".to_string(),
+ "YT".to_string(),
+ "FM".to_string(),
+ "MD".to_string(),
+ "MC".to_string(),
+ "MN".to_string(),
+ "ME".to_string(),
+ "MS".to_string(),
+ "MA".to_string(),
+ "MZ".to_string(),
+ "NA".to_string(),
+ "NR".to_string(),
+ "NP".to_string(),
+ "NC".to_string(),
+ "NZ".to_string(),
+ "NE".to_string(),
+ "NG".to_string(),
+ "NU".to_string(),
+ "NF".to_string(),
+ "MP".to_string(),
+ "OM".to_string(),
+ "PK".to_string(),
+ "PW".to_string(),
+ "PS".to_string(),
+ "PG".to_string(),
+ "PH".to_string(),
+ "PN".to_string(),
+ "QA".to_string(),
+ "RE".to_string(),
+ "RO".to_string(),
+ "RW".to_string(),
+ "BL".to_string(),
+ "SH".to_string(),
+ "KN".to_string(),
+ "LC".to_string(),
+ "MF".to_string(),
+ "PM".to_string(),
+ "VC".to_string(),
+ "WS".to_string(),
+ "SM".to_string(),
+ "ST".to_string(),
+ "SA".to_string(),
+ "SN".to_string(),
+ "RS".to_string(),
+ "SC".to_string(),
+ "SL".to_string(),
+ "SX".to_string(),
+ "SK".to_string(),
+ "SI".to_string(),
+ "SB".to_string(),
+ "SO".to_string(),
+ "ZA".to_string(),
+ "GS".to_string(),
+ "KR".to_string(),
+ "LK".to_string(),
+ "SR".to_string(),
+ "SJ".to_string(),
+ "SZ".to_string(),
+ "TH".to_string(),
+ "TL".to_string(),
+ "TG".to_string(),
+ "TK".to_string(),
+ "TO".to_string(),
+ "TT".to_string(),
+ "TN".to_string(),
+ "TM".to_string(),
+ "TC".to_string(),
+ "TV".to_string(),
+ "UG".to_string(),
+ "UA".to_string(),
+ "AE".to_string(),
+ "UZ".to_string(),
+ "VU".to_string(),
+ "VN".to_string(),
+ "VG".to_string(),
+ "VI".to_string(),
+ "WF".to_string(),
+ "EH".to_string(),
+ "ZM".to_string(),
]
},
value: None,
|
chore
|
add support for some more country and currencies for Mifinity Wallet (#5639)
|
c17eb01e35749343b3bf4fdda51782ea962ee57a
|
2025-02-14 18:21:57
|
Aniket Burman
|
feat(router): add v2 endpoint retrieve payment aggregate based on merchant profile (#7196)
| false
|
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index e20b0860161..b2335550cf5 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -102,7 +102,7 @@ pub trait PaymentIntentInterface {
storage_scheme: common_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, errors::StorageError>;
- #[cfg(all(feature = "v1", feature = "olap"))]
+ #[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
merchant_id: &id_type::MerchantId,
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 57e72a42941..e681c76afb5 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -5408,7 +5408,7 @@ pub async fn get_payment_filters(
))
}
-#[cfg(all(feature = "olap", feature = "v1"))]
+#[cfg(feature = "olap")]
pub async fn get_aggregates_for_payments(
state: SessionState,
merchant: domain::MerchantAccount,
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index d4a1fee0929..d21c345b5fe 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1876,8 +1876,7 @@ impl PaymentIntentInterface for KafkaStore {
)
.await
}
-
- #[cfg(all(feature = "olap", feature = "v1"))]
+ #[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
merchant_id: &id_type::MerchantId,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index ee1e06af939..3da65e968b6 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -571,6 +571,13 @@ impl Payments {
.service(
web::resource("/create-intent")
.route(web::post().to(payments::payments_create_intent)),
+ )
+ .service(
+ web::resource("/aggregate").route(web::get().to(payments::get_payments_aggregates)),
+ )
+ .service(
+ web::resource("/profile/aggregate")
+ .route(web::get().to(payments::get_payments_aggregates_profile)),
);
route =
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index b55ab207f40..dd15079efed 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -1407,7 +1407,7 @@ pub async fn get_payment_filters_profile(
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))]
-#[cfg(all(feature = "olap", feature = "v1"))]
+#[cfg(feature = "olap")]
pub async fn get_payments_aggregates(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
@@ -2228,6 +2228,35 @@ pub async fn get_payments_aggregates_profile(
))
.await
}
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))]
+#[cfg(all(feature = "olap", feature = "v2"))]
+pub async fn get_payments_aggregates_profile(
+ state: web::Data<app::AppState>,
+ req: actix_web::HttpRequest,
+ payload: web::Query<common_utils::types::TimeRange>,
+) -> impl Responder {
+ let flow = Flow::PaymentsAggregate;
+ let payload = payload.into_inner();
+ Box::pin(api::server_wrap(
+ flow,
+ state,
+ &req,
+ payload,
+ |state, auth: auth::AuthenticationData, req, _| {
+ payments::get_aggregates_for_payments(
+ state,
+ auth.merchant_account,
+ Some(vec![auth.profile.get_id().clone()]),
+ req,
+ )
+ },
+ &auth::JWTAuth {
+ permission: Permission::ProfilePaymentRead,
+ },
+ api_locking::LockAction::NotApplicable,
+ ))
+ .await
+}
#[cfg(feature = "v2")]
/// A private module to hold internal types to be used in route handlers.
diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs
index 0766d397bb7..6a46702e525 100644
--- a/crates/storage_impl/src/mock_db/payment_intent.rs
+++ b/crates/storage_impl/src/mock_db/payment_intent.rs
@@ -41,7 +41,7 @@ impl PaymentIntentInterface for MockDb {
Err(StorageError::MockDbError)?
}
- #[cfg(all(feature = "v1", feature = "olap"))]
+ #[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs
index a515898006b..b64d1aee364 100644
--- a/crates/storage_impl/src/payments/payment_intent.rs
+++ b/crates/storage_impl/src/payments/payment_intent.rs
@@ -412,7 +412,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
.await
}
- #[cfg(all(feature = "v1", feature = "olap"))]
+ #[cfg(feature = "olap")]
async fn get_intent_status_with_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
@@ -829,7 +829,7 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
.await
}
- #[cfg(all(feature = "v1", feature = "olap"))]
+ #[cfg(feature = "olap")]
#[instrument(skip_all)]
async fn get_intent_status_with_count(
&self,
|
feat
|
add v2 endpoint retrieve payment aggregate based on merchant profile (#7196)
|
baf5fd91cf7fbb9f787e1ba137d1a3c597fe44ef
|
2023-05-11 16:47:00
|
Pa1NarK
|
feat(connector): add connector nmi with card, applepay and googlepay support (#771)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 3ef85ac8f6a..100e28daaf4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1318,6 +1318,7 @@ dependencies = [
"nanoid",
"once_cell",
"proptest",
+ "quick-xml",
"rand 0.8.5",
"regex",
"ring",
@@ -3368,6 +3369,16 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
+[[package]]
+name = "quick-xml"
+version = "0.28.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
+dependencies = [
+ "memchr",
+ "serde",
+]
+
[[package]]
name = "quote"
version = "1.0.26"
diff --git a/config/config.example.toml b/config/config.example.toml
index c0cf57015f4..3138ae9dcf6 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -166,6 +166,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
mollie.base_url = "https://api.mollie.com/v2/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
nexinets.base_url = "https://apitest.payengine.de/v1"
+nmi.base_url = "https://secure.nmi.com/"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opennode.base_url = "https://dev-api.opennode.com"
payeezy.base_url = "https://api-cert.payeezy.com/"
diff --git a/config/development.toml b/config/development.toml
index 2aa9dc58d1d..6929bdc0450 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -72,6 +72,7 @@ cards = [
"mollie",
"multisafepay",
"nexinets",
+ "nmi",
"nuvei",
"opennode",
"payeezy",
@@ -121,6 +122,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
mollie.base_url = "https://api.mollie.com/v2/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
nexinets.base_url = "https://apitest.payengine.de/v1"
+nmi.base_url = "https://secure.nmi.com/"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opennode.base_url = "https://dev-api.opennode.com"
payeezy.base_url = "https://api-cert.payeezy.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 072dd4108a2..b7e8a5261a2 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -90,6 +90,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
mollie.base_url = "https://api.mollie.com/v2/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
nexinets.base_url = "https://apitest.payengine.de/v1"
+nmi.base_url = "https://secure.nmi.com/"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opennode.base_url = "https://dev-api.opennode.com"
payeezy.base_url = "https://api-cert.payeezy.com/"
@@ -129,6 +130,7 @@ cards = [
"mollie",
"multisafepay",
"nexinets",
+ "nmi",
"nuvei",
"opennode",
"payeezy",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index 0f5b109da57..e75693c95e8 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -609,6 +609,7 @@ pub enum Connector {
Mollie,
Multisafepay,
Nexinets,
+ Nmi,
Nuvei,
// Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage
Paypal,
@@ -681,6 +682,7 @@ pub enum RoutableConnectors {
Mollie,
Multisafepay,
Nexinets,
+ Nmi,
Nuvei,
Opennode,
// Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage
diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml
index ae31147d5b7..aa5ffab69e0 100644
--- a/crates/common_utils/Cargo.toml
+++ b/crates/common_utils/Cargo.toml
@@ -20,6 +20,7 @@ futures = { version = "0.3.28", optional = true }
hex = "0.4.3"
nanoid = "0.4.0"
once_cell = "1.17.1"
+quick-xml = { version = "0.28.2", features = ["serialize"] }
rand = "0.8.5"
regex = "1.7.3"
ring = "0.16.20"
diff --git a/crates/common_utils/src/ext_traits.rs b/crates/common_utils/src/ext_traits.rs
index ac626ff703e..912d859c019 100644
--- a/crates/common_utils/src/ext_traits.rs
+++ b/crates/common_utils/src/ext_traits.rs
@@ -5,6 +5,7 @@
use error_stack::{IntoReport, ResultExt};
use masking::{ExposeInterface, Secret, Strategy};
+use quick_xml::de;
use serde::{Deserialize, Serialize};
use crate::errors::{self, CustomResult};
@@ -392,3 +393,22 @@ impl ConfigExt for String {
self.trim().is_empty()
}
}
+
+/// Extension trait for deserializing XML strings using `quick-xml` crate
+pub trait XmlExt {
+ ///
+ /// Deserialize an XML string into the specified type `<T>`.
+ ///
+ fn parse_xml<T>(self) -> Result<T, quick_xml::de::DeError>
+ where
+ T: serde::de::DeserializeOwned;
+}
+
+impl XmlExt for &str {
+ fn parse_xml<T>(self) -> Result<T, quick_xml::de::DeError>
+ where
+ T: serde::de::DeserializeOwned,
+ {
+ de::from_str(self)
+ }
+}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 4e731193484..9f2bc3debac 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -376,6 +376,7 @@ pub struct Connectors {
pub mollie: ConnectorParams,
pub multisafepay: ConnectorParams,
pub nexinets: ConnectorParams,
+ pub nmi: ConnectorParams,
pub nuvei: ConnectorParams,
pub opennode: ConnectorParams,
pub payeezy: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index 1b0298214e2..c4143dddcab 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -17,8 +17,10 @@ pub mod forte;
pub mod globalpay;
pub mod iatapay;
pub mod klarna;
+pub mod mollie;
pub mod multisafepay;
pub mod nexinets;
+pub mod nmi;
pub mod nuvei;
pub mod opennode;
pub mod payeezy;
@@ -33,8 +35,6 @@ pub mod worldline;
pub mod worldpay;
pub mod zen;
-pub mod mollie;
-
#[cfg(feature = "dummy_connector")]
pub use self::dummyconnector::DummyConnector;
pub use self::{
@@ -42,7 +42,7 @@ pub use self::{
bambora::Bambora, bitpay::Bitpay, bluesnap::Bluesnap, braintree::Braintree, checkout::Checkout,
coinbase::Coinbase, cybersource::Cybersource, dlocal::Dlocal, fiserv::Fiserv, forte::Forte,
globalpay::Globalpay, iatapay::Iatapay, klarna::Klarna, mollie::Mollie,
- multisafepay::Multisafepay, nexinets::Nexinets, nuvei::Nuvei, opennode::Opennode,
+ multisafepay::Multisafepay, nexinets::Nexinets, nmi::Nmi, nuvei::Nuvei, opennode::Opennode,
payeezy::Payeezy, paypal::Paypal, payu::Payu, rapyd::Rapyd, shift4::Shift4, stripe::Stripe,
trustpay::Trustpay, worldline::Worldline, worldpay::Worldpay, zen::Zen,
};
diff --git a/crates/router/src/connector/nmi.rs b/crates/router/src/connector/nmi.rs
new file mode 100644
index 00000000000..be7be395008
--- /dev/null
+++ b/crates/router/src/connector/nmi.rs
@@ -0,0 +1,590 @@
+mod transformers;
+
+use std::fmt::Debug;
+
+use common_utils::ext_traits::ByteSliceExt;
+use error_stack::{IntoReport, ResultExt};
+use transformers as nmi;
+
+use self::transformers::NmiCaptureRequest;
+use crate::{
+ configs::settings,
+ core::errors::{self, CustomResult},
+ services::{self, ConnectorIntegration},
+ types::{
+ self,
+ api::{self, ConnectorCommon, ConnectorCommonExt},
+ ErrorResponse,
+ },
+ utils,
+};
+
+#[derive(Clone, Debug)]
+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::PaymentAuthorize for Nmi {}
+impl api::PaymentSync for Nmi {}
+impl api::PaymentCapture for Nmi {}
+impl api::PaymentVoid for Nmi {}
+impl api::Refund for Nmi {}
+impl api::RefundExecute for Nmi {}
+impl api::RefundSync for Nmi {}
+impl api::PaymentToken for Nmi {}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Nmi
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ _req: &types::RouterData<Flow, Request, Response>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ Ok(vec![(
+ "Content-Type".to_string(),
+ "application/x-www-form-urlencoded".to_string(),
+ )])
+ }
+}
+
+impl ConnectorCommon for Nmi {
+ fn id(&self) -> &'static str {
+ "nmi"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
+ connectors.nmi.base_url.as_ref()
+ }
+
+ fn build_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: nmi::StandardResponse = res
+ .response
+ .parse_struct("StandardResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ Ok(ErrorResponse {
+ message: response.responsetext,
+ status_code: res.status_code,
+ reason: None,
+ ..Default::default()
+ })
+ }
+}
+
+impl
+ ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Nmi
+{
+}
+
+impl ConnectorIntegration<api::Session, types::PaymentsSessionData, types::PaymentsResponseData>
+ for Nmi
+{
+}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for Nmi
+{
+}
+
+impl ConnectorIntegration<api::Verify, types::VerifyRequestData, types::PaymentsResponseData>
+ for Nmi
+{
+ fn get_headers(
+ &self,
+ req: &types::VerifyRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::VerifyRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/transact.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::VerifyRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiPaymentsRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiPaymentsRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_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)?)
+ .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::VerifyRouterData, errors::ConnectorError> {
+ let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+ for Nmi
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/transact.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiPaymentsRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiPaymentsRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::PaymentsAuthorizeType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsAuthorizeRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
+ for Nmi
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/query.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiSyncRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiSyncRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .body(types::PaymentsSyncType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsSyncRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
+ types::RouterData::try_from(types::ResponseRouterData {
+ response: res.clone(),
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
+ for Nmi
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/transact.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsCaptureRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiCaptureRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<NmiCaptureRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::PaymentsCaptureType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCaptureRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
+ for Nmi
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCancelRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::PaymentsCancelRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/transact.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsCancelRouterData,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiCancelRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiCancelRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PaymentsCancelRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
+ .headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
+ .body(types::PaymentsVoidType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCancelRouterData,
+ res: types::Response,
+ ) -> CustomResult<types::PaymentsCancelRouterData, errors::ConnectorError> {
+ let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Nmi {
+ fn get_headers(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/transact.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiRefundRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiRefundRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::RefundsRouterData<api::Execute>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .body(types::RefundExecuteType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundsRouterData<api::Execute>,
+ res: types::Response,
+ ) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
+ let response: nmi::StandardResponse = serde_urlencoded::from_bytes(&res.response)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData> for Nmi {
+ fn get_headers(
+ &self,
+ req: &types::RefundsRouterData<api::RSync>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, String)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_url(
+ &self,
+ _req: &types::RefundsRouterData<api::RSync>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}api/query.php", self.base_url(connectors)))
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::RefundsRouterData<api::RSync>,
+ ) -> CustomResult<Option<String>, errors::ConnectorError> {
+ let connector_req = nmi::NmiSyncRequest::try_from(req)?;
+ let nmi_req = utils::Encode::<nmi::NmiSyncRequest>::url_encode(&connector_req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(nmi_req))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::RefundsRouterData<api::RSync>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .body(types::RefundSyncType::get_request_body(self, req)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::RefundsRouterData<api::RSync>,
+ res: types::Response,
+ ) -> CustomResult<types::RefundsRouterData<api::RSync>, errors::ConnectorError> {
+ types::RouterData::try_from(types::ResponseRouterData {
+ response: res.clone(),
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
+#[async_trait::async_trait]
+impl api::IncomingWebhook for Nmi {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<serde_json::Value, errors::ConnectorError> {
+ Err(errors::ConnectorError::WebhooksNotImplemented).into_report()
+ }
+}
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
new file mode 100644
index 00000000000..eb09497cede
--- /dev/null
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -0,0 +1,672 @@
+use cards::CardNumber;
+use common_utils::ext_traits::XmlExt;
+use error_stack::{IntoReport, Report, ResultExt};
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ connector::utils::{self, PaymentsAuthorizeRequestData},
+ core::errors,
+ types::{self, api, storage::enums, transformers::ForeignFrom, ConnectorAuthType},
+};
+
+type Error = Report<errors::ConnectorError>;
+
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "lowercase")]
+pub enum TransactionType {
+ Auth,
+ Capture,
+ Refund,
+ Sale,
+ Validate,
+ Void,
+}
+
+pub struct NmiAuthType {
+ pub(super) api_key: String,
+}
+
+impl TryFrom<&ConnectorAuthType> for NmiAuthType {
+ type Error = Error;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ if let types::ConnectorAuthType::HeaderKey { api_key } = auth_type {
+ Ok(Self {
+ api_key: api_key.to_string(),
+ })
+ } else {
+ Err(errors::ConnectorError::FailedToObtainAuthType.into())
+ }
+ }
+}
+
+#[derive(Debug, Serialize)]
+pub struct NmiPaymentsRequest {
+ #[serde(rename = "type")]
+ transaction_type: TransactionType,
+ amount: f64,
+ security_key: Secret<String>,
+ currency: enums::Currency,
+ #[serde(flatten)]
+ payment_method: PaymentMethod,
+}
+
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum PaymentMethod {
+ Card(Box<CardData>),
+ GPay(Box<GooglePayData>),
+ ApplePay(Box<ApplePayData>),
+}
+
+#[derive(Debug, Serialize)]
+pub struct CardData {
+ ccnumber: CardNumber,
+ ccexp: Secret<String>,
+ cvv: Secret<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct GooglePayData {
+ googlepay_payment_data: String,
+}
+
+#[derive(Debug, Serialize)]
+pub struct ApplePayData {
+ applepay_payment_data: String,
+}
+
+impl TryFrom<&types::PaymentsAuthorizeRouterData> for NmiPaymentsRequest {
+ type Error = Error;
+ fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
+ let transaction_type = match item.request.is_auto_capture()? {
+ true => TransactionType::Sale,
+ false => TransactionType::Auth,
+ };
+ let auth_type: NmiAuthType = (&item.connector_auth_type).try_into()?;
+ let amount =
+ utils::to_currency_base_unit_asf64(item.request.amount, item.request.currency)?;
+ let payment_method = PaymentMethod::try_from(&item.request.payment_method_data)?;
+
+ Ok(Self {
+ transaction_type,
+ security_key: auth_type.api_key.into(),
+ amount,
+ currency: item.request.currency,
+ payment_method,
+ })
+ }
+}
+
+impl TryFrom<&api_models::payments::PaymentMethodData> for PaymentMethod {
+ type Error = Error;
+ fn try_from(
+ payment_method_data: &api_models::payments::PaymentMethodData,
+ ) -> Result<Self, Self::Error> {
+ match &payment_method_data {
+ api::PaymentMethodData::Card(ref card) => Ok(Self::from(card)),
+ api::PaymentMethodData::Wallet(ref wallet_type) => match wallet_type {
+ api_models::payments::WalletData::GooglePay(ref googlepay_data) => {
+ Ok(Self::from(googlepay_data))
+ }
+ api_models::payments::WalletData::ApplePay(ref applepay_data) => {
+ Ok(Self::from(applepay_data))
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment Method".to_string(),
+ ))
+ .into_report(),
+ },
+ _ => Err(errors::ConnectorError::NotImplemented(
+ "Payment Method".to_string(),
+ ))
+ .into_report(),
+ }
+ }
+}
+
+impl From<&api_models::payments::Card> for PaymentMethod {
+ fn from(card: &api_models::payments::Card) -> Self {
+ let ccexp = utils::CardData::get_card_expiry_month_year_2_digit_with_delimiter(
+ card,
+ "".to_string(),
+ );
+ let card = CardData {
+ ccnumber: card.card_number.clone(),
+ ccexp,
+ cvv: card.card_cvc.clone(),
+ };
+ Self::Card(Box::new(card))
+ }
+}
+
+impl From<&api_models::payments::GooglePayWalletData> for PaymentMethod {
+ fn from(wallet_data: &api_models::payments::GooglePayWalletData) -> Self {
+ let gpay_data = GooglePayData {
+ googlepay_payment_data: wallet_data.tokenization_data.token.clone(),
+ };
+ Self::GPay(Box::new(gpay_data))
+ }
+}
+
+impl From<&api_models::payments::ApplePayWalletData> for PaymentMethod {
+ fn from(wallet_data: &api_models::payments::ApplePayWalletData) -> Self {
+ let apple_pay_data = ApplePayData {
+ applepay_payment_data: wallet_data.payment_data.clone(),
+ };
+ Self::ApplePay(Box::new(apple_pay_data))
+ }
+}
+
+impl TryFrom<&types::VerifyRouterData> for NmiPaymentsRequest {
+ type Error = Error;
+ fn try_from(item: &types::VerifyRouterData) -> 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 {
+ transaction_type: TransactionType::Validate,
+ security_key: auth_type.api_key.into(),
+ amount: 0.0,
+ currency: item.request.currency,
+ payment_method,
+ })
+ }
+}
+
+#[derive(Debug, Serialize)]
+pub struct NmiSyncRequest {
+ pub transaction_id: String,
+ pub security_key: String,
+}
+
+impl TryFrom<&types::PaymentsSyncRouterData> for NmiSyncRequest {
+ type Error = Error;
+ fn try_from(item: &types::PaymentsSyncRouterData) -> Result<Self, Self::Error> {
+ let auth = NmiAuthType::try_from(&item.connector_auth_type)?;
+ Ok(Self {
+ security_key: auth.api_key,
+ transaction_id: item
+ .request
+ .connector_transaction_id
+ .get_connector_transaction_id()
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
+ })
+ }
+}
+
+#[derive(Debug, Serialize)]
+pub struct NmiCaptureRequest {
+ #[serde(rename = "type")]
+ pub transaction_type: TransactionType,
+ pub security_key: Secret<String>,
+ pub transactionid: String,
+ pub amount: Option<f64>,
+}
+
+impl TryFrom<&types::PaymentsCaptureRouterData> for NmiCaptureRequest {
+ type Error = Error;
+ fn try_from(item: &types::PaymentsCaptureRouterData) -> Result<Self, Self::Error> {
+ let auth = NmiAuthType::try_from(&item.connector_auth_type)?;
+ Ok(Self {
+ transaction_type: TransactionType::Capture,
+ security_key: auth.api_key.into(),
+ transactionid: item.request.connector_transaction_id.clone(),
+ amount: Some(utils::to_currency_base_unit_asf64(
+ item.request.amount_to_capture,
+ item.request.currency,
+ )?),
+ })
+ }
+}
+
+impl
+ TryFrom<
+ types::ResponseRouterData<
+ api::Capture,
+ StandardResponse,
+ types::PaymentsCaptureData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<api::Capture, types::PaymentsCaptureData, types::PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::ResponseRouterData<
+ api::Capture,
+ StandardResponse,
+ types::PaymentsCaptureData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let (response, status) = match item.response.response {
+ Response::Approved => (
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.transactionid,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ }),
+ enums::AttemptStatus::CaptureInitiated,
+ ),
+ Response::Declined | Response::Error => (
+ Err(types::ErrorResponse::foreign_from((
+ item.response,
+ item.http_code,
+ ))),
+ enums::AttemptStatus::CaptureFailed,
+ ),
+ };
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Serialize)]
+pub struct NmiCancelRequest {
+ #[serde(rename = "type")]
+ pub transaction_type: TransactionType,
+ pub security_key: Secret<String>,
+ pub transactionid: String,
+ pub void_reason: Option<String>,
+}
+
+impl TryFrom<&types::PaymentsCancelRouterData> for NmiCancelRequest {
+ type Error = Error;
+ fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
+ let auth = NmiAuthType::try_from(&item.connector_auth_type)?;
+ Ok(Self {
+ transaction_type: TransactionType::Void,
+ security_key: auth.api_key.into(),
+ transactionid: item.request.connector_transaction_id.clone(),
+ void_reason: item.request.cancellation_reason.clone(),
+ })
+ }
+}
+
+#[derive(Debug, Deserialize)]
+pub enum Response {
+ #[serde(alias = "1")]
+ Approved,
+ #[serde(alias = "2")]
+ Declined,
+ #[serde(alias = "3")]
+ Error,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct StandardResponse {
+ pub response: Response,
+ pub responsetext: String,
+ pub authcode: Option<String>,
+ pub transactionid: String,
+ pub avsresponse: Option<String>,
+ pub cvvresponse: Option<String>,
+ pub orderid: String,
+ pub response_code: String,
+}
+
+impl<T>
+ TryFrom<
+ types::ResponseRouterData<api::Verify, StandardResponse, T, types::PaymentsResponseData>,
+ > for types::RouterData<api::Verify, T, types::PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::ResponseRouterData<
+ api::Verify,
+ StandardResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let (response, status) = match item.response.response {
+ Response::Approved => (
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.transactionid,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ }),
+ enums::AttemptStatus::Charged,
+ ),
+ Response::Declined | Response::Error => (
+ Err(types::ErrorResponse::foreign_from((
+ item.response,
+ item.http_code,
+ ))),
+ enums::AttemptStatus::Failure,
+ ),
+ };
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ }
+}
+
+impl ForeignFrom<(StandardResponse, u16)> for types::ErrorResponse {
+ fn foreign_from((response, http_code): (StandardResponse, u16)) -> Self {
+ Self {
+ code: response.response_code,
+ message: response.responsetext,
+ reason: None,
+ status_code: http_code,
+ }
+ }
+}
+
+impl TryFrom<types::PaymentsResponseRouterData<StandardResponse>>
+ for types::RouterData<api::Authorize, types::PaymentsAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::ResponseRouterData<
+ api::Authorize,
+ StandardResponse,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let (response, status) = match item.response.response {
+ Response::Approved => (
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.transactionid,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ }),
+ if let Some(storage_models::enums::CaptureMethod::Automatic) =
+ item.data.request.capture_method
+ {
+ enums::AttemptStatus::CaptureInitiated
+ } else {
+ enums::AttemptStatus::Authorizing
+ },
+ ),
+ Response::Declined | Response::Error => (
+ Err(types::ErrorResponse::foreign_from((
+ item.response,
+ item.http_code,
+ ))),
+ enums::AttemptStatus::Failure,
+ ),
+ };
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ }
+}
+
+impl<T>
+ TryFrom<types::ResponseRouterData<api::Void, StandardResponse, T, types::PaymentsResponseData>>
+ for types::RouterData<api::Void, T, types::PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::ResponseRouterData<
+ api::Void,
+ StandardResponse,
+ T,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let (response, status) = match item.response.response {
+ Response::Approved => (
+ Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ item.response.transactionid,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ }),
+ enums::AttemptStatus::VoidInitiated,
+ ),
+ Response::Declined | Response::Error => (
+ Err(types::ErrorResponse::foreign_from((
+ item.response,
+ item.http_code,
+ ))),
+ enums::AttemptStatus::VoidFailed,
+ ),
+ };
+ Ok(Self {
+ status,
+ response,
+ ..item.data
+ })
+ }
+}
+
+#[derive(Debug, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum NmiStatus {
+ Abandoned,
+ Cancelled,
+ Pendingsettlement,
+ Pending,
+ Failed,
+ Complete,
+ InProgress,
+ Unknown,
+}
+
+impl TryFrom<types::PaymentsSyncResponseRouterData<types::Response>>
+ for types::PaymentsSyncRouterData
+{
+ type Error = Error;
+ fn try_from(
+ item: types::PaymentsSyncResponseRouterData<types::Response>,
+ ) -> Result<Self, Self::Error> {
+ let response = SyncResponse::try_from(item.response.response.to_vec())?;
+ Ok(Self {
+ status: enums::AttemptStatus::from(NmiStatus::from(response.transaction.condition)),
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ response.transaction.transaction_id,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: None,
+ network_txn_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<Vec<u8>> for SyncResponse {
+ type Error = Error;
+ fn try_from(bytes: Vec<u8>) -> Result<Self, Self::Error> {
+ let query_response = String::from_utf8(bytes)
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ query_response
+ .parse_xml::<Self>()
+ .into_report()
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)
+ }
+}
+
+impl From<NmiStatus> for enums::AttemptStatus {
+ fn from(item: NmiStatus) -> Self {
+ match item {
+ NmiStatus::Abandoned => Self::AuthenticationFailed,
+ NmiStatus::Cancelled => Self::Voided,
+ NmiStatus::Pending => Self::Authorized,
+ NmiStatus::Pendingsettlement => Self::Pending,
+ NmiStatus::Complete => Self::Charged,
+ NmiStatus::InProgress => Self::AuthenticationPending,
+ NmiStatus::Failed | NmiStatus::Unknown => Self::Failure,
+ }
+ }
+}
+
+// REFUND :
+#[derive(Debug, Serialize)]
+pub struct NmiRefundRequest {
+ #[serde(rename = "type")]
+ transaction_type: TransactionType,
+ security_key: String,
+ transactionid: String,
+ amount: f64,
+}
+
+impl<F> TryFrom<&types::RefundsRouterData<F>> for NmiRefundRequest {
+ type Error = Error;
+ fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
+ let auth_type: NmiAuthType = (&item.connector_auth_type).try_into()?;
+ Ok(Self {
+ transaction_type: TransactionType::Refund,
+ security_key: auth_type.api_key,
+ transactionid: item.request.connector_transaction_id.clone(),
+ amount: utils::to_currency_base_unit_asf64(
+ item.request.refund_amount,
+ item.request.currency,
+ )?,
+ })
+ }
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::Execute, StandardResponse>>
+ for types::RefundsRouterData<api::Execute>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::RefundsResponseRouterData<api::Execute, StandardResponse>,
+ ) -> Result<Self, Self::Error> {
+ let refund_status = enums::RefundStatus::from(item.response.response);
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: item.response.transactionid,
+ refund_status,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::Capture, StandardResponse>>
+ for types::RefundsRouterData<api::Capture>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::RefundsResponseRouterData<api::Capture, StandardResponse>,
+ ) -> Result<Self, Self::Error> {
+ let refund_status = enums::RefundStatus::from(item.response.response);
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: item.response.transactionid,
+ refund_status,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl From<Response> for enums::RefundStatus {
+ fn from(item: Response) -> Self {
+ match item {
+ Response::Approved => Self::Pending,
+ Response::Declined | Response::Error => Self::Failure,
+ }
+ }
+}
+
+impl TryFrom<&types::RefundSyncRouterData> for NmiSyncRequest {
+ type Error = Error;
+ fn try_from(item: &types::RefundSyncRouterData) -> Result<Self, Self::Error> {
+ let auth = NmiAuthType::try_from(&item.connector_auth_type)?;
+ let transaction_id = item
+ .request
+ .connector_refund_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorRefundID)?;
+
+ Ok(Self {
+ security_key: auth.api_key,
+ transaction_id,
+ })
+ }
+}
+
+impl TryFrom<types::RefundsResponseRouterData<api::RSync, types::Response>>
+ for types::RefundsRouterData<api::RSync>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::RefundsResponseRouterData<api::RSync, types::Response>,
+ ) -> Result<Self, Self::Error> {
+ let response = SyncResponse::try_from(item.response.response.to_vec())?;
+ let refund_status =
+ enums::RefundStatus::from(NmiStatus::from(response.transaction.condition));
+ Ok(Self {
+ response: Ok(types::RefundsResponseData {
+ connector_refund_id: response.transaction.transaction_id,
+ refund_status,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl From<NmiStatus> for enums::RefundStatus {
+ fn from(item: NmiStatus) -> Self {
+ match item {
+ NmiStatus::Abandoned
+ | NmiStatus::Cancelled
+ | NmiStatus::Failed
+ | NmiStatus::Unknown => Self::Failure,
+ NmiStatus::Pendingsettlement | NmiStatus::Pending | NmiStatus::InProgress => {
+ Self::Pending
+ }
+ NmiStatus::Complete => Self::Success,
+ }
+ }
+}
+
+impl From<String> for NmiStatus {
+ fn from(value: String) -> Self {
+ match value.as_str() {
+ "abandoned" => Self::Abandoned,
+ "canceled" => Self::Cancelled,
+ "in_progress" => Self::InProgress,
+ "pendingsettlement" => Self::Pendingsettlement,
+ "complete" => Self::Complete,
+ "failed" => Self::Failed,
+ "unknown" => Self::Unknown,
+ // Other than above values only pending is possible, since value is a string handling this as default
+ _ => Self::Pending,
+ }
+ }
+}
+
+#[derive(Debug, Deserialize)]
+pub struct SyncTransactionResponse {
+ #[serde(rename = "transaction_id")]
+ transaction_id: String,
+ #[serde(rename = "condition")]
+ condition: String,
+}
+
+#[derive(Debug, Deserialize)]
+struct SyncResponse {
+ #[serde(rename = "transaction")]
+ transaction: SyncTransactionResponse,
+}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 6e8fe22685d..0a1be35c6c1 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -119,6 +119,7 @@ default_imp_for_complete_authorize!(
connector::Klarna,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Opennode,
connector::Payeezy,
connector::Payu,
@@ -168,6 +169,7 @@ default_imp_for_create_customer!(
connector::Mollie,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Nuvei,
connector::Opennode,
connector::Payeezy,
@@ -216,6 +218,7 @@ default_imp_for_connector_redirect_response!(
connector::Klarna,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Opennode,
connector::Payeezy,
connector::Payu,
@@ -256,6 +259,7 @@ default_imp_for_connector_request_id!(
connector::Klarna,
connector::Mollie,
connector::Multisafepay,
+ connector::Nmi,
connector::Nuvei,
connector::Opennode,
connector::Payeezy,
@@ -308,6 +312,7 @@ default_imp_for_accept_dispute!(
connector::Mollie,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Nuvei,
connector::Payeezy,
connector::Paypal,
@@ -369,6 +374,7 @@ default_imp_for_file_upload!(
connector::Mollie,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Nuvei,
connector::Payeezy,
connector::Paypal,
@@ -420,6 +426,7 @@ default_imp_for_submit_evidence!(
connector::Mollie,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Nuvei,
connector::Payeezy,
connector::Paypal,
@@ -471,6 +478,7 @@ default_imp_for_defend_dispute!(
connector::Mollie,
connector::Multisafepay,
connector::Nexinets,
+ connector::Nmi,
connector::Nuvei,
connector::Payeezy,
connector::Paypal,
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index 93843f326f2..c462b55912c 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -100,7 +100,6 @@ pub type PaymentsSessionType =
dyn services::ConnectorIntegration<api::Session, PaymentsSessionData, PaymentsResponseData>;
pub type PaymentsVoidType =
dyn services::ConnectorIntegration<api::Void, PaymentsCancelData, PaymentsResponseData>;
-
pub type TokenizationType = dyn services::ConnectorIntegration<
api::PaymentMethodToken,
PaymentMethodTokenizationData,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index d4d7807273c..4b4b2f803ed 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -218,6 +218,7 @@ impl ConnectorData {
"iatapay" => Ok(Box::new(&connector::Iatapay)),
"klarna" => Ok(Box::new(&connector::Klarna)),
"mollie" => Ok(Box::new(&connector::Mollie)),
+ "nmi" => Ok(Box::new(&connector::Nmi)),
"nuvei" => Ok(Box::new(&connector::Nuvei)),
"opennode" => Ok(Box::new(&connector::Opennode)),
// "payeezy" => Ok(Box::new(&connector::Payeezy)), As psync and rsync are not supported by this connector, it is added as template code for future usage
diff --git a/crates/router/tests/connectors/connector_auth.rs b/crates/router/tests/connectors/connector_auth.rs
index e42b579b542..7cc2c538416 100644
--- a/crates/router/tests/connectors/connector_auth.rs
+++ b/crates/router/tests/connectors/connector_auth.rs
@@ -24,7 +24,8 @@ pub(crate) struct ConnectorAuthentication {
pub iatapay: Option<SignatureKey>,
pub mollie: Option<HeaderKey>,
pub multisafepay: Option<HeaderKey>,
- pub nexinets: Option<BodyKey>,
+ pub nexinets: Option<HeaderKey>,
+ pub nmi: Option<HeaderKey>,
pub nuvei: Option<SignatureKey>,
pub opennode: Option<HeaderKey>,
pub payeezy: Option<SignatureKey>,
@@ -42,6 +43,8 @@ pub(crate) struct ConnectorAuthentication {
impl ConnectorAuthentication {
#[allow(clippy::expect_used)]
pub(crate) fn new() -> Self {
+ // Do `export CONNECTOR_AUTH_FILE_PATH="/hyperswitch/crates/router/tests/connectors/sample_auth.toml"`
+ // before running tests
let path = env::var("CONNECTOR_AUTH_FILE_PATH")
.expect("connector authentication file path not set");
toml::from_str(
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index ba31db4cb10..563a872a8f6 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -27,6 +27,7 @@ mod iatapay;
mod mollie;
mod multisafepay;
mod nexinets;
+mod nmi;
mod nuvei;
mod nuvei_ui;
mod opennode;
diff --git a/crates/router/tests/connectors/nmi.rs b/crates/router/tests/connectors/nmi.rs
new file mode 100644
index 00000000000..0727ef8da3e
--- /dev/null
+++ b/crates/router/tests/connectors/nmi.rs
@@ -0,0 +1,692 @@
+use std::{str::FromStr, time::Duration};
+
+use router::types::{self, api, storage::enums};
+
+use crate::{
+ connector_auth,
+ utils::{self, ConnectorActions},
+};
+
+struct NmiTest;
+impl ConnectorActions for NmiTest {}
+impl utils::Connector for NmiTest {
+ fn get_data(&self) -> types::api::ConnectorData {
+ use router::connector::Nmi;
+ types::api::ConnectorData {
+ connector: Box::new(&Nmi),
+ connector_name: types::Connector::Nmi,
+ get_token: types::api::GetToken::Connector,
+ }
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ types::ConnectorAuthType::from(
+ connector_auth::ConnectorAuthentication::new()
+ .nmi
+ .expect("Missing connector authentication configuration"),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "nmi".to_string()
+ }
+}
+
+static CONNECTOR: NmiTest = NmiTest {};
+
+fn get_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethodData::Card(api::Card {
+ card_number: cards::CardNumber::from_str("4111111111111111").unwrap(),
+ ..utils::CCardType::default().0
+ }),
+ amount: 2023,
+ ..utils::PaymentAuthorizeType::default().0
+ })
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .expect("Authorize payment response");
+ let transaction_id = utils::get_connector_transaction_id(response.response).unwrap();
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ // Assert the sync response, it will be authorized in case of manual capture, for automatic it will be Completed Success
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+ let capture_response = CONNECTOR
+ .capture_payment(transaction_id.clone(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.status,
+ enums::AttemptStatus::CaptureInitiated
+ );
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+ let capture_response = CONNECTOR
+ .capture_payment(
+ transaction_id.clone(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 1000,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.status,
+ enums::AttemptStatus::CaptureInitiated
+ );
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+
+ let void_response = CONNECTOR
+ .void_payment(
+ transaction_id.clone(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("user_cancel".to_string()),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(void_response.status, enums::AttemptStatus::VoidInitiated);
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Voided,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+ let capture_response = CONNECTOR
+ .capture_payment(transaction_id.clone(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.status,
+ enums::AttemptStatus::CaptureInitiated
+ );
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ let refund_response = CONNECTOR
+ .refund_payment(transaction_id.clone(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(refund_response.status, enums::AttemptStatus::Pending);
+ let sync_response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Pending,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sync_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+ let capture_response = CONNECTOR
+ .capture_payment(
+ transaction_id.clone(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 2023,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.status,
+ enums::AttemptStatus::CaptureInitiated
+ );
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ let refund_response = CONNECTOR
+ .refund_payment(
+ transaction_id.clone(),
+ Some(types::RefundsData {
+ refund_amount: 1023,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(refund_response.status, enums::AttemptStatus::Pending);
+ let sync_response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Pending,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sync_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ let refund_response = CONNECTOR
+ .refund_payment(transaction_id.clone(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(refund_response.status, enums::AttemptStatus::Pending);
+ let sync_response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Pending,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sync_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ let refund_response = CONNECTOR
+ .refund_payment(
+ transaction_id.clone(),
+ Some(types::RefundsData {
+ refund_amount: 1000,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(refund_response.status, enums::AttemptStatus::Pending);
+ let sync_response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Pending,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sync_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ //try refund for previous payment
+ let transaction_id = utils::get_connector_transaction_id(response.response).unwrap();
+ for _x in 0..2 {
+ tokio::time::sleep(Duration::from_secs(5)).await; // to avoid 404 error
+ let refund_response = CONNECTOR
+ .refund_payment(
+ transaction_id.clone(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ let sync_response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Pending,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sync_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending,
+ );
+ }
+}
+
+// Creates a payment with incorrect CVC.
+#[ignore = "Connector returns SUCCESS status in case of invalid CVC"]
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {}
+
+// Creates a payment with incorrect expiry month.
+#[ignore = "Connector returns SUCCESS status in case of expired month."]
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {}
+
+// Creates a payment with incorrect expiry year.
+#[ignore = "Connector returns SUCCESS status in case of expired year."]
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+
+ let void_response = CONNECTOR
+ .void_payment(transaction_id.clone(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(void_response.status, enums::AttemptStatus::VoidFailed);
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let response = CONNECTOR
+ .authorize_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorizing);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Manual),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Authorized);
+ let capture_response = CONNECTOR
+ .capture_payment("7899353591".to_string(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(capture_response.status, enums::AttemptStatus::CaptureFailed);
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
+ let transaction_id = utils::get_connector_transaction_id(response.response.to_owned()).unwrap();
+
+ let sync_response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Pending,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ transaction_id.clone(),
+ ),
+ capture_method: Some(types::storage::enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+ let refund_response = CONNECTOR
+ .refund_payment(
+ transaction_id,
+ Some(types::RefundsData {
+ refund_amount: 3024,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Failure
+ );
+}
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index 0448e782eb1..146cfeed625 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -63,6 +63,9 @@ api_secret = "secret"
api_key = "api_key"
key1= "key1"
+[nmi]
+api_key = "NMI API Key"
+
[nuvei]
api_key = "api_key"
key1 = "key1"
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index fe9c7163ad4..a45038047bf 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -37,6 +37,8 @@ pub struct PaymentInfo {
#[async_trait]
pub trait ConnectorActions: Connector {
+ /// For initiating payments when `CaptureMethod` is set to `Manual`
+ /// This doesn't complete the transaction, `PaymentsCapture` needs to be done manually
async fn authorize_payment(
&self,
payment_data: Option<types::PaymentsAuthorizeData>,
@@ -62,6 +64,8 @@ pub trait ConnectorActions: Connector {
call_connector(request, integration).await
}
+ /// For initiating payments when `CaptureMethod` is set to `Automatic`
+ /// This does complete the transaction without user intervention to Capture the payment
async fn make_payment(
&self,
payment_data: Option<types::PaymentsAuthorizeData>,
@@ -197,14 +201,14 @@ pub trait ConnectorActions: Connector {
async fn refund_payment(
&self,
transaction_id: String,
- payment_data: Option<types::RefundsData>,
+ refund_data: Option<types::RefundsData>,
payment_info: Option<PaymentInfo>,
) -> Result<types::RefundExecuteRouterData, Report<ConnectorError>> {
let integration = self.get_data().connector.get_connector_integration();
let request = self.generate_data(
types::RefundsData {
connector_transaction_id: transaction_id,
- ..payment_data.unwrap_or(PaymentRefundType::default().0)
+ ..refund_data.unwrap_or(PaymentRefundType::default().0)
},
payment_info,
);
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 5c5653fdc70..70b88c322df 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -79,6 +79,7 @@ klarna.base_url = "https://api-na.playground.klarna.com/"
mollie.base_url = "https://api.mollie.com/v2/"
multisafepay.base_url = "https://testapi.multisafepay.com/"
nexinets.base_url = "https://apitest.payengine.de/v1"
+nmi.base_url = "https://secure.nmi.com/"
nuvei.base_url = "https://ppp-test.nuvei.com/"
opennode.base_url = "https://dev-api.opennode.com"
payeezy.base_url = "https://api-cert.payeezy.com/"
@@ -117,6 +118,7 @@ cards = [
"mollie",
"multisafepay",
"nexinets",
+ "nmi",
"nuvei",
"opennode",
"payeezy",
|
feat
|
add connector nmi with card, applepay and googlepay support (#771)
|
573fc2ce0ff306d15ec97e7c8d5b8a03528165f4
|
2024-12-12 15:04:37
|
Debarati Ghatak
|
feat(connector): [DEUTSCHEBANK, FIUU ] Handle 2xx errors given by Connector (#6727)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
index 328940d83ae..85c5fc8dc81 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
@@ -5,7 +5,7 @@ use common_utils::{ext_traits::ValueExt, pii::Email, types::MinorUnit};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::{BankDebitData, PaymentMethodData},
- router_data::{AccessToken, ConnectorAuthType, RouterData},
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
payments::{Authorize, Capture, CompleteAuthorize, PSync},
refunds::{Execute, RSync},
@@ -263,6 +263,21 @@ pub struct DeutschebankMandatePostResponse {
state: Option<DeutschebankSEPAMandateStatus>,
}
+fn get_error_response(error_code: String, error_reason: String, status_code: u16) -> ErrorResponse {
+ ErrorResponse {
+ code: error_code.to_string(),
+ message: error_reason.clone(),
+ reason: Some(error_reason),
+ status_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ }
+}
+
+fn is_response_success(rc: &String) -> bool {
+ rc == "0"
+}
+
impl
TryFrom<
ResponseRouterData<
@@ -286,16 +301,16 @@ impl
Some(date) => date.chars().take(10).collect(),
None => time::OffsetDateTime::now_utc().date().to_string(),
};
- match item.response.reference.clone() {
- Some(reference) => Ok(Self {
- status: if item.response.rc == "0" {
- match item.response.state.clone() {
- Some(state) => common_enums::AttemptStatus::from(state),
- None => common_enums::AttemptStatus::Failure,
- }
- } else {
- common_enums::AttemptStatus::Failure
- },
+ let response_code = item.response.rc.clone();
+ let is_response_success = is_response_success(&response_code);
+
+ match (
+ item.response.reference.clone(),
+ item.response.state.clone(),
+ is_response_success,
+ ) {
+ (Some(reference), Some(state), true) => Ok(Self {
+ status: common_enums::AttemptStatus::from(state),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::NoResponseId,
redirection_data: Box::new(Some(RedirectForm::Form {
@@ -340,8 +355,13 @@ impl
}),
..item.data
}),
- None => Ok(Self {
+ _ => Ok(Self {
status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
..item.data
}),
}
@@ -367,27 +387,36 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: if item.response.rc == "0" {
- match item.data.request.is_auto_capture()? {
+ let response_code = item.response.rc.clone();
+ if is_response_success(&response_code) {
+ Ok(Self {
+ status: match item.data.request.is_auto_capture()? {
true => common_enums::AttemptStatus::Charged,
false => common_enums::AttemptStatus::Authorized,
- }
- } else {
- common_enums::AttemptStatus::Failure
- },
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charge_id: None,
- }),
- ..item.data
- })
+ },
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
@@ -570,27 +599,36 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: if item.response.rc == "0" {
- match item.data.request.is_auto_capture()? {
+ let response_code = item.response.rc.clone();
+ if is_response_success(&response_code) {
+ Ok(Self {
+ status: match item.data.request.is_auto_capture()? {
true => common_enums::AttemptStatus::Charged,
false => common_enums::AttemptStatus::Authorized,
- }
- } else {
- common_enums::AttemptStatus::Failure
- },
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charge_id: None,
- }),
- ..item.data
- })
+ },
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
@@ -637,24 +675,33 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(PaymentsResponseData::TransactionResponse {
- resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
- redirection_data: Box::new(None),
- mandate_reference: Box::new(None),
- connector_metadata: None,
- network_txn_id: None,
- connector_response_reference_id: None,
- incremental_authorization_allowed: None,
- charge_id: None,
- }),
- status: if item.response.rc == "0" {
- common_enums::AttemptStatus::Charged
- } else {
- common_enums::AttemptStatus::Failure
- },
- ..item.data
- })
+ let response_code = item.response.rc.clone();
+ if is_response_success(&response_code) {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Charged,
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.tx_id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
@@ -677,7 +724,8 @@ impl
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let status = if item.response.rc == "0" {
+ let response_code = item.response.rc.clone();
+ let status = if is_response_success(&response_code) {
item.response
.tx_action
.and_then(|tx_action| match tx_action {
@@ -699,6 +747,15 @@ impl
Some(common_enums::AttemptStatus::Failure)
};
match status {
+ Some(common_enums::AttemptStatus::Failure) => Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ }),
Some(status) => Ok(Self {
status,
..item.data
@@ -729,14 +786,23 @@ impl TryFrom<PaymentsCancelResponseRouterData<DeutschebankPaymentsResponse>>
fn try_from(
item: PaymentsCancelResponseRouterData<DeutschebankPaymentsResponse>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- status: if item.response.rc == "0" {
- common_enums::AttemptStatus::Voided
- } else {
- common_enums::AttemptStatus::VoidFailed
- },
- ..item.data
- })
+ let response_code = item.response.rc.clone();
+ if is_response_success(&response_code) {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Voided,
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status: common_enums::AttemptStatus::VoidFailed,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
@@ -763,17 +829,26 @@ impl TryFrom<RefundsResponseRouterData<Execute, DeutschebankPaymentsResponse>>
fn try_from(
item: RefundsResponseRouterData<Execute, DeutschebankPaymentsResponse>,
) -> Result<Self, Self::Error> {
- Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: item.response.tx_id,
- refund_status: if item.response.rc == "0" {
- enums::RefundStatus::Success
- } else {
- enums::RefundStatus::Failure
- },
- }),
- ..item.data
- })
+ let response_code = item.response.rc.clone();
+ if is_response_success(&response_code) {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.tx_id,
+ refund_status: enums::RefundStatus::Success,
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ })
+ }
}
}
@@ -784,7 +859,8 @@ impl TryFrom<RefundsResponseRouterData<RSync, DeutschebankPaymentsResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, DeutschebankPaymentsResponse>,
) -> Result<Self, Self::Error> {
- let status = if item.response.rc == "0" {
+ let response_code = item.response.rc.clone();
+ let status = if is_response_success(&response_code) {
item.response
.tx_action
.and_then(|tx_action| match tx_action {
@@ -803,7 +879,17 @@ impl TryFrom<RefundsResponseRouterData<RSync, DeutschebankPaymentsResponse>>
} else {
Some(enums::RefundStatus::Failure)
};
+
match status {
+ Some(enums::RefundStatus::Failure) => Ok(Self {
+ status: common_enums::AttemptStatus::Failure,
+ response: Err(get_error_response(
+ response_code.clone(),
+ item.response.message.clone(),
+ item.http_code,
+ )),
+ ..item.data
+ }),
Some(refund_status) => Ok(Self {
response: Ok(RefundsResponseData {
refund_status,
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
index f8f57887c28..143cd1aa047 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
@@ -993,6 +993,8 @@ pub struct FiuuRefundSuccessResponse {
#[serde(rename = "RefundID")]
refund_id: i64,
status: String,
+ #[serde(rename = "reason")]
+ reason: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
@@ -1019,20 +1021,40 @@ impl TryFrom<RefundsResponseRouterData<Execute, FiuuRefundResponse>>
}),
..item.data
}),
- FiuuRefundResponse::Success(refund_data) => Ok(Self {
- response: Ok(RefundsResponseData {
- connector_refund_id: refund_data.refund_id.to_string(),
- refund_status: match refund_data.status.as_str() {
- "00" => Ok(enums::RefundStatus::Success),
- "11" => Ok(enums::RefundStatus::Failure),
- "22" => Ok(enums::RefundStatus::Pending),
- other => Err(errors::ConnectorError::UnexpectedResponseError(
- bytes::Bytes::from(other.to_owned()),
- )),
- }?,
- }),
- ..item.data
- }),
+ FiuuRefundResponse::Success(refund_data) => {
+ let refund_status = match refund_data.status.as_str() {
+ "00" => Ok(enums::RefundStatus::Success),
+ "11" => Ok(enums::RefundStatus::Failure),
+ "22" => Ok(enums::RefundStatus::Pending),
+ other => Err(errors::ConnectorError::UnexpectedResponseError(
+ bytes::Bytes::from(other.to_owned()),
+ )),
+ }?;
+ if refund_status == enums::RefundStatus::Failure {
+ Ok(Self {
+ response: Err(ErrorResponse {
+ code: refund_data.status.clone(),
+ message: refund_data
+ .reason
+ .clone()
+ .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
+ reason: refund_data.reason.clone(),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: None,
+ }),
+ ..item.data
+ })
+ } else {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: refund_data.refund_id.to_string(),
+ refund_status,
+ }),
+ ..item.data
+ })
+ }
+ }
}
}
}
|
feat
|
[DEUTSCHEBANK, FIUU ] Handle 2xx errors given by Connector (#6727)
|
199d1764488f234accab3bfecef9645ee9486057
|
2025-01-22 11:59:54
|
Debarati Ghatak
|
feat(connector): [ADYEN ] Consume transaction id for PaymentsPreProcessing error (#7061)
| false
|
diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs
index b9ab7ea87e0..d6f6fdc8f0f 100644
--- a/crates/router/src/connector/adyen.rs
+++ b/crates/router/src/connector/adyen.rs
@@ -1001,7 +1001,7 @@ impl
reason: Some(consts::LOW_BALANCE_ERROR_MESSAGE.to_string()),
status_code: res.status_code,
attempt_status: Some(enums::AttemptStatus::Failure),
- connector_transaction_id: None,
+ connector_transaction_id: Some(response.psp_reference),
}),
..data.clone()
})
|
feat
|
[ADYEN ] Consume transaction id for PaymentsPreProcessing error (#7061)
|
d091549576676c87f855e06678544704339d82e4
|
2023-06-13 20:13:26
|
Abhishek Marrivagu
|
refactor(compatibility, connector): add holder name and change trust pay merchant_ref id to payment_id
| false
|
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index 5860cc72301..10906a59c93 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -45,6 +45,7 @@ pub struct StripeCard {
pub exp_month: pii::Secret<String>,
pub exp_year: pii::Secret<String>,
pub cvc: pii::Secret<String>,
+ pub holder_name: Option<pii::Secret<String>>,
}
#[derive(Default, Serialize, PartialEq, Eq, Deserialize, Clone)]
@@ -84,7 +85,7 @@ impl From<StripeCard> for payments::Card {
card_number: card.number,
card_exp_month: card.exp_month,
card_exp_year: card.exp_year,
- card_holder_name: masking::Secret::new("stripe_cust".to_owned()),
+ card_holder_name: card.holder_name.unwrap_or("name".to_string().into()),
card_cvc: card.cvc,
card_issuer: None,
card_network: None,
diff --git a/crates/router/src/connector/trustpay/transformers.rs b/crates/router/src/connector/trustpay/transformers.rs
index c27524c5594..155527b4169 100644
--- a/crates/router/src/connector/trustpay/transformers.rs
+++ b/crates/router/src/connector/trustpay/transformers.rs
@@ -328,7 +328,7 @@ fn get_bank_redirection_request_data(
currency: item.request.currency.to_string(),
},
references: References {
- merchant_reference: item.attempt_id.clone(),
+ merchant_reference: item.payment_id.clone(),
},
},
callback_urls: CallbackURLs {
|
refactor
|
add holder name and change trust pay merchant_ref id to payment_id
|
d15cb31814390bc631f9eb4195ca114e43ab4cd2
|
2024-05-28 12:31:04
|
Sampras Lopes
|
docs(analytics): Add documentation for setting up data services and enabling data features in control center (#4741)
| false
|
diff --git a/README.md b/README.md
index 5bfcfdfd62b..62e016d3620 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ The single API to access payment ecosystems across 130+ countries</div>
<p align="center">
<a href="#%EF%B8%8F-quick-start-guide">Quick Start Guide</a> •
- <a href="https://github.com/juspay/hyperswitch/blob/main/docs/try_local_system.md">Local Setup Guide</a> •
+ <a href="/docs/try_local_system.md">Local Setup Guide</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> •
<a href="#-supported-features">Supported Features</a> •
diff --git a/config/dashboard.toml b/config/dashboard.toml
new file mode 100644
index 00000000000..9bb2b6bf336
--- /dev/null
+++ b/config/dashboard.toml
@@ -0,0 +1,38 @@
+[default.theme]
+primary_color="#006DF9"
+primary_hover_color="#005ED6"
+sidebar_color="#242F48"
+
+[default.endpoints]
+api_url="http://localhost:8080" # The backend hyperswitch API server for making payments
+sdk_url="http://localhost:9050/HyperLoader.js" # SDK distribution url used for loading the SDK in control center
+logo_url=""
+favicon_url=""
+mixpanel_token=""
+
+[default.features]
+test_live_toggle=false
+is_live_mode=false
+email=false
+quick_start=false
+audit_trail=true
+system_metrics=false
+sample_data=false
+frm=false
+payout=true
+recon=false
+test_processors=true
+feedback=false
+mixpanel=false
+generate_report=false
+user_journey_analytics=false
+authentication_analytics=false
+surcharge=false
+dispute_evidence_upload=false
+paypal_automatic_flow=false
+threeds_authenticator=false
+global_search=false
+dispute_analytics=true
+configure_pmts=false
+branding=false
+totp=false
\ No newline at end of file
diff --git a/crates/analytics/docs/README.md b/crates/analytics/docs/README.md
new file mode 100644
index 00000000000..b822edd810e
--- /dev/null
+++ b/crates/analytics/docs/README.md
@@ -0,0 +1,104 @@
+# Running Kafka & Clickhouse with Analytics and Events Source Configuration
+
+This document provides instructions on how to run Kafka and Clickhouse using Docker Compose, and how to configure the analytics and events source.
+
+## Architecture
+ +------------------------+
+ | Hyperswitch |
+ +------------------------+
+ |
+ |
+ v
+ +------------------------+
+ | Kafka |
+ | (Event Stream Broker) |
+ +------------------------+
+ |
+ |
+ v
+ +------------------------+
+ | ClickHouse |
+ | +------------------+ |
+ | | Kafka Engine | |
+ | | Table | |
+ | +------------------+ |
+ | | |
+ | v |
+ | +------------------+ |
+ | | Materialized | |
+ | | View (MV) | |
+ | +------------------+ |
+ | | |
+ | v |
+ | +------------------+ |
+ | | Storage Table | |
+ | +------------------+ |
+ +------------------------+
+
+
+## Starting the Containers
+
+Docker Compose can be used to start all the components.
+
+Run the following command:
+
+```bash
+docker compose --profile olap up -d
+```
+This will spawn up the following services
+1. kafka
+2. clickhouse
+3. opensearch
+
+## Setting up Kafka
+
+Kafka-UI is a visual tool for inspecting Kafka and it can be accessed at `localhost:8090` to view topics, partitions, consumers & generated events.
+
+## Setting up Clickhouse
+
+Once Clickhouse is up and running, you can interact with it via web.
+
+You can either visit the URL (`http://localhost:8123/play`) where the Clickhouse server is running to get a playground, or you can bash into the Clickhouse container and execute commands manually.
+
+Run the following commands:
+
+```bash
+# On your local terminal
+docker compose exec clickhouse-server bash
+
+# Inside the clickhouse-server container shell
+clickhouse-client --user default
+
+# Inside the clickhouse-client shell
+SHOW TABLES;
+```
+
+## Configuring Analytics and Events Source
+
+To use Clickhouse and Kafka, you need to enable the `analytics.source` and update the `events.source` in the configuration file.
+
+You can do this in either the `config/development.toml` or `config/docker_compose.toml` file.
+
+Here's an example of how to do this:
+
+```toml
+[analytics]
+source = "clickhouse"
+
+[events]
+source = "kafka"
+```
+
+After making this change, save the file and restart your application for the changes to take effect.
+
+## Enabling Data Features in Dashboard
+
+To check the data features in the dashboard, you need to enable them in the `config/dashboard.toml` configuration file.
+
+Here's an example of how to do this:
+
+```toml
+[default.features]
+audit_trail=true
+system_metrics=true
+```
\ No newline at end of file
diff --git a/crates/analytics/docs/clickhouse/README.md b/crates/analytics/docs/clickhouse/README.md
deleted file mode 100644
index 2fd48a30c29..00000000000
--- a/crates/analytics/docs/clickhouse/README.md
+++ /dev/null
@@ -1,45 +0,0 @@
-#### Starting the containers
-
-In our use case we rely on kafka for ingesting events.
-hence we can use docker compose to start all the components
-
-```
-docker compose up -d clickhouse-server kafka-ui
-```
-
-> kafka-ui is a visual tool for inspecting kafka on localhost:8090
-
-#### Setting up Clickhouse
-
-Once clickhouse is up & running you need to create the required tables for it
-
-you can either visit the url (http://localhost:8123/play) in which the clickhouse-server is running to get a playground
-Alternatively you can bash into the clickhouse container & execute commands manually
-```
-# On your local terminal
-docker compose exec clickhouse-server bash
-
-# Inside the clickhouse-server container shell
-clickhouse-client --user default
-
-# Inside the clickhouse-client shell
-SHOW TABLES;
-CREATE TABLE ......
-```
-
-The table creation scripts are provided [here](./scripts)
-
-#### Running/Debugging your application
-Once setup you can run your application either via docker compose or normally via cargo run
-
-Remember to enable the kafka_events via development.toml/docker_compose.toml files
-
-Inspect the [kafka-ui](http://localhost:8090) to check the messages being inserted in queue
-
-If the messages/topic are available then you can run select queries on your clickhouse table to ensure data is being populated...
-
-If the data is not being populated in clickhouse, you can check the error logs in clickhouse server via
-```
-# Inside the clickhouse-server container shell
-tail -f /var/log/clickhouse-server/clickhouse-server.err.log
-```
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 64d36caf248..a1e9e1dee92 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,5 +1,3 @@
-version: "3.8"
-
volumes:
pg_data:
redisinsight_store:
@@ -137,8 +135,8 @@ services:
context: ./docker
dockerfile: web.Dockerfile
environment:
- - HYPERSWITCH_PUBLISHABLE_KEY=$HYPERSWITCH_PUBLISHABLE_KEY
- - HYPERSWITCH_SECRET_KEY=$HYPERSWITCH_SECRET_KEY
+ - HYPERSWITCH_PUBLISHABLE_KEY=${HYPERSWITCH_PUBLISHABLE_KEY:PUBLISHABLE_KEY}
+ - HYPERSWITCH_SECRET_KEY=${HYPERSWITCH_SECRET_KEY:SECRET_KEY}
- HYPERSWITCH_SERVER_URL=${HYPERSWITCH_SERVER_URL:-http://hyperswitch-server:8080}
- HYPERSWITCH_CLIENT_URL=${HYPERSWITCH_CLIENT_URL:-http://localhost:9050}
- SELF_SERVER_URL=${SELF_SERVER_URL:-http://localhost:5252}
@@ -156,8 +154,11 @@ services:
ports:
- "9000:9000"
environment:
- - apiBaseUrl=http://localhost:8080
- - sdkBaseUrl=http://localhost:9050/HyperLoader.js
+ - configPath=/tmp/dashboard-config.toml
+ volumes:
+ - ./config/dashboard.toml:/tmp/dashboard-config.toml
+ depends_on:
+ - hyperswitch-web
labels:
logs: "promtail"
@@ -185,38 +186,23 @@ services:
- redis-cluster
networks:
- router_net
- command: "bash -c 'export COUNT=${REDIS_CLUSTER_COUNT:-3}
-
- \ if [ $$COUNT -lt 3 ]
-
- \ then
-
- \ echo \"Minimum 3 nodes are needed for redis cluster\"
-
- \ exit 1
-
- \ fi
-
- \ HOSTS=\"\"
-
- \ for ((c=1; c<=$$COUNT;c++))
-
- \ do
-
- \ NODE=$COMPOSE_PROJECT_NAME-redis-cluster-$$c:6379
-
- \ echo $$NODE
-
- \ HOSTS=\"$$HOSTS $$NODE\"
-
- \ done
-
- \ echo Creating a cluster with $$HOSTS
-
- \ redis-cli --cluster create $$HOSTS --cluster-yes
-
- \ '"
-
+ command: |-
+ bash -c 'export COUNT=${REDIS_CLUSTER_COUNT:-3}
+ if [ $$COUNT -lt 3 ]
+ then
+ echo \"Minimum 3 nodes are needed for redis cluster\"
+ exit 1
+ fi
+ HOSTS=\"\"
+ for ((c=1; c<=$$COUNT;c++))
+ do
+ NODE=$COMPOSE_PROJECT_NAME-redis-cluster-$$c:6379
+ echo $$NODE
+ HOSTS=\"$$HOSTS $$NODE\"
+ done
+ echo Creating a cluster with $$HOSTS
+ redis-cli --cluster create $$HOSTS --cluster-yes
+ '
### Monitoring
grafana:
image: grafana/grafana:latest
@@ -304,7 +290,7 @@ services:
networks:
- router_net
profiles:
- - full_kv
+ - monitoring
ports:
- "8001:8001"
volumes:
@@ -390,24 +376,20 @@ services:
hostname: opensearch
environment:
- "discovery.type=single-node"
- expose:
- - "9200"
+ profiles:
+ - olap
ports:
- "9200:9200"
networks:
- router_net
- profiles:
- - olap
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:1.3.14
ports:
- 5601:5601
- expose:
- - "5601"
+ profiles:
+ - olap
environment:
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
networks:
- router_net
- profiles:
- - olap
diff --git a/docs/imgs/hyperswitch-architecture.png b/docs/imgs/hyperswitch-architecture.png
index f73f60f3e35..1e8a63d57fb 100644
Binary files a/docs/imgs/hyperswitch-architecture.png and b/docs/imgs/hyperswitch-architecture.png differ
diff --git a/docs/try_local_system.md b/docs/try_local_system.md
index a05e9b9f44e..d45049dfd60 100644
--- a/docs/try_local_system.md
+++ b/docs/try_local_system.md
@@ -13,7 +13,7 @@ Check the Table Of Contents to jump to the relevant section.
**Table Of Contents:**
- [Run hyperswitch using Docker Compose](#run-hyperswitch-using-docker-compose)
- - [Run the scheduler and monitoring services](#run-the-scheduler-and-monitoring-services)
+ - [Running additional services](#running-additional-services)
- [Set up a development environment using Docker Compose](#set-up-a-development-environment-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)
@@ -68,9 +68,16 @@ Check the Table Of Contents to jump to the relevant section.
If the command returned a `200 OK` status code, proceed with
[trying out our APIs](#try-out-our-apis).
-### Run the scheduler and monitoring services
+### Running additional services
-You can run the scheduler and monitoring services by specifying suitable profile
+The default behaviour for docker compose only runs the following services:
+1. postgres
+2. redis (standalone)
+3. hyperswitch server
+4. hyperswitch control center
+5. hyperswitch web sdk
+
+You can run the scheduler, data and monitoring services by specifying suitable profile
names to the above Docker Compose command.
To understand more about the hyperswitch architecture and the components
involved, check out the [architecture document][architecture].
@@ -93,6 +100,13 @@ involved, check out the [architecture document][architecture].
logs using the "Explore" tab, select Loki as the data source, and select the
container to query logs from.
+- To run the data services (Clickhouse, Kafka and Opensearch) you can specify the `olap` profile
+
+ ```shell
+ docker compose --profile olap up -d
+ ```
+ You can read more about using the data services [here][data-docs]
+
- You can also specify multiple profile names by specifying the `--profile` flag
multiple times.
To run both the scheduler components and monitoring services, the Docker
@@ -109,6 +123,7 @@ Once the services have been confirmed to be up and running, you can proceed with
[docker-compose-config]: /config/docker_compose.toml
[docker-compose-yml]: /docker-compose.yml
[architecture]: /docs/architecture.md
+[data-docs]: /crates/analytics/docs/README.md
## Set up a development environment using Docker Compose
|
docs
|
Add documentation for setting up data services and enabling data features in control center (#4741)
|
710186f035c92a919e8f5a49565c6f8908f1803f
|
2024-11-26 12:44:44
|
sweta-kumari-sharma
|
feat(connector): [INESPAY] add Connector Template Code (#6614)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index e55665ffc70..191f2ba7f8b 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -220,6 +220,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 5f4de111ac8..00a544dc565 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -62,6 +62,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 61738f04cdb..0fe9095d280 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -66,6 +66,7 @@ gocardless.base_url = "https://api.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://secure.api.itau/"
jpmorgan.base_url = "https://api-ms.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.klarna.com/"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 24c7642200c..82c347ae389 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -66,6 +66,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
diff --git a/config/development.toml b/config/development.toml
index 630cc4a2303..ee6ea5dab0b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -130,6 +130,7 @@ cards = [
"gpayments",
"helcim",
"iatapay",
+ "inespay",
"itaubank",
"jpmorgan",
"mollie",
@@ -235,6 +236,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 354af98dbad..ed0ede98d94 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -150,6 +150,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
@@ -249,6 +250,7 @@ cards = [
"gpayments",
"helcim",
"iatapay",
+ "inespay",
"itaubank",
"jpmorgan",
"mollie",
diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs
index fe2c4f037bf..783ecb12b48 100644
--- a/crates/api_models/src/connector_enums.rs
+++ b/crates/api_models/src/connector_enums.rs
@@ -84,6 +84,7 @@ pub enum Connector {
Gocardless,
Gpayments,
Helcim,
+ // Inespay,
Iatapay,
Itaubank,
//Jpmorgan,
@@ -228,6 +229,7 @@ impl Connector {
| Self::Gpayments
| Self::Helcim
| Self::Iatapay
+ // | Self::Inespay
| Self::Itaubank
//| Self::Jpmorgan
| Self::Klarna
diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs
index 9d17cdb61d4..c3bbf6e078f 100644
--- a/crates/common_enums/src/connector_enums.rs
+++ b/crates/common_enums/src/connector_enums.rs
@@ -81,6 +81,7 @@ pub enum RoutableConnectors {
Gocardless,
Helcim,
Iatapay,
+ // Inespay,
Itaubank,
//Jpmorgan,
Klarna,
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 65b286f8423..0e68b04d27b 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -192,6 +192,7 @@ pub struct ConnectorConfig {
pub gocardless: Option<ConnectorTomlConfig>,
pub gpayments: Option<ConnectorTomlConfig>,
pub helcim: Option<ConnectorTomlConfig>,
+ // pub inespay: Option<ConnectorTomlConfig>,
pub klarna: Option<ConnectorTomlConfig>,
pub mifinity: Option<ConnectorTomlConfig>,
pub mollie: Option<ConnectorTomlConfig>,
@@ -357,6 +358,7 @@ impl ConnectorConfig {
Connector::Gocardless => Ok(connector_data.gocardless),
Connector::Gpayments => Ok(connector_data.gpayments),
Connector::Helcim => Ok(connector_data.helcim),
+ // Connector::Inespay => Ok(connector_data.inespay),
Connector::Klarna => Ok(connector_data.klarna),
Connector::Mifinity => Ok(connector_data.mifinity),
Connector::Mollie => Ok(connector_data.mollie),
diff --git a/crates/hyperswitch_connectors/src/connectors.rs b/crates/hyperswitch_connectors/src/connectors.rs
index b764ab5b441..d1cdb85e57f 100644
--- a/crates/hyperswitch_connectors/src/connectors.rs
+++ b/crates/hyperswitch_connectors/src/connectors.rs
@@ -16,6 +16,7 @@ pub mod fiuu;
pub mod forte;
pub mod globepay;
pub mod helcim;
+pub mod inespay;
pub mod jpmorgan;
pub mod mollie;
pub mod multisafepay;
@@ -45,9 +46,9 @@ pub use self::{
bitpay::Bitpay, cashtocode::Cashtocode, coinbase::Coinbase, cryptopay::Cryptopay,
deutschebank::Deutschebank, digitalvirgo::Digitalvirgo, dlocal::Dlocal, elavon::Elavon,
fiserv::Fiserv, fiservemea::Fiservemea, fiuu::Fiuu, forte::Forte, globepay::Globepay,
- helcim::Helcim, jpmorgan::Jpmorgan, mollie::Mollie, multisafepay::Multisafepay,
- nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay, novalnet::Novalnet, payeezy::Payeezy,
- payu::Payu, powertranz::Powertranz, razorpay::Razorpay, shift4::Shift4, square::Square,
- stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys, volt::Volt, worldline::Worldline,
- worldpay::Worldpay, xendit::Xendit, zen::Zen, zsl::Zsl,
+ helcim::Helcim, inespay::Inespay, jpmorgan::Jpmorgan, mollie::Mollie,
+ multisafepay::Multisafepay, nexinets::Nexinets, nexixpay::Nexixpay, nomupay::Nomupay,
+ novalnet::Novalnet, payeezy::Payeezy, payu::Payu, powertranz::Powertranz, razorpay::Razorpay,
+ shift4::Shift4, square::Square, stax::Stax, taxjar::Taxjar, thunes::Thunes, tsys::Tsys,
+ volt::Volt, worldline::Worldline, worldpay::Worldpay, xendit::Xendit, zen::Zen, zsl::Zsl,
};
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs
new file mode 100644
index 00000000000..89bf50c60ca
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs
@@ -0,0 +1,563 @@
+pub mod transformers;
+
+use common_utils::{
+ errors::CustomResult,
+ ext_traits::BytesExt,
+ request::{Method, Request, RequestBuilder, RequestContent},
+ types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
+};
+use error_stack::{report, ResultExt};
+use hyperswitch_domain_models::{
+ router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
+ router_flow_types::{
+ access_token_auth::AccessTokenAuth,
+ payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
+ refunds::{Execute, RSync},
+ },
+ router_request_types::{
+ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
+ PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
+ RefundsData, SetupMandateRequestData,
+ },
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{
+ PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
+ RefundSyncRouterData, RefundsRouterData,
+ },
+};
+use hyperswitch_interfaces::{
+ api::{self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorValidation},
+ configs::Connectors,
+ errors,
+ events::connector_api_logs::ConnectorEvent,
+ types::{self, Response},
+ webhooks,
+};
+use masking::{ExposeInterface, Mask};
+use transformers as inespay;
+
+use crate::{constants::headers, types::ResponseRouterData, utils};
+
+#[derive(Clone)]
+pub struct Inespay {
+ amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
+}
+
+impl Inespay {
+ pub fn new() -> &'static Self {
+ &Self {
+ amount_converter: &StringMinorUnitForConnector,
+ }
+ }
+}
+
+impl api::Payment for Inespay {}
+impl api::PaymentSession for Inespay {}
+impl api::ConnectorAccessToken for Inespay {}
+impl api::MandateSetup for Inespay {}
+impl api::PaymentAuthorize for Inespay {}
+impl api::PaymentSync for Inespay {}
+impl api::PaymentCapture for Inespay {}
+impl api::PaymentVoid for Inespay {}
+impl api::Refund for Inespay {}
+impl api::RefundExecute for Inespay {}
+impl api::RefundSync for Inespay {}
+impl api::PaymentToken for Inespay {}
+
+impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
+ for Inespay
+{
+ // Not Implemented (R)
+}
+
+impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Inespay
+where
+ Self: ConnectorIntegration<Flow, Request, Response>,
+{
+ fn build_headers(
+ &self,
+ req: &RouterData<Flow, Request, Response>,
+ _connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ self.get_content_type().to_string().into(),
+ )];
+ let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
+ header.append(&mut api_key);
+ Ok(header)
+ }
+}
+
+impl ConnectorCommon for Inespay {
+ fn id(&self) -> &'static str {
+ "inespay"
+ }
+
+ fn get_currency_unit(&self) -> api::CurrencyUnit {
+ api::CurrencyUnit::Base
+ // TODO! Check connector documentation, on which unit they are processing the currency.
+ // If the connector accepts amount in lower unit ( i.e cents for USD) then return api::CurrencyUnit::Minor,
+ // if connector accepts amount in base unit (i.e dollars for USD) then return api::CurrencyUnit::Base
+ }
+
+ fn common_get_content_type(&self) -> &'static str {
+ "application/json"
+ }
+
+ fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
+ connectors.inespay.base_url.as_ref()
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ let auth = inespay::InespayAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.expose().into_masked(),
+ )])
+ }
+
+ fn build_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ let response: inespay::InespayErrorResponse = res
+ .response
+ .parse_struct("InespayErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(ErrorResponse {
+ status_code: res.status_code,
+ code: response.code,
+ message: response.message,
+ reason: response.reason,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl ConnectorValidation for Inespay {
+ //TODO: implement functions when support enabled
+}
+
+impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Inespay {
+ //TODO: implement sessions flow
+}
+
+impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Inespay {}
+
+impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Inespay {}
+
+impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Inespay {
+ fn get_headers(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = inespay::InespayRouterData::from((amount, req));
+ let connector_req = inespay::InespayPaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsAuthorizeRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .attach_default_headers()
+ .headers(types::PaymentsAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
+ let response: inespay::InespayPaymentsResponse = res
+ .response
+ .parse_struct("Inespay PaymentsAuthorizeResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Inespay {
+ fn get_headers(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
+ let response: inespay::InespayPaymentsResponse = res
+ .response
+ .parse_struct("inespay PaymentsSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Inespay {
+ fn get_headers(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ _req: &PaymentsCaptureRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &PaymentsCaptureRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PaymentsCaptureType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCaptureType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &PaymentsCaptureRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
+ let response: inespay::InespayPaymentsResponse = res
+ .response
+ .parse_struct("Inespay PaymentsCaptureResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Inespay {}
+
+impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Inespay {
+ fn get_headers(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn get_request_body(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ _connectors: &Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let refund_amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_refund_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = inespay::InespayRouterData::from((refund_amount, req));
+ let connector_req = inespay::InespayRefundRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundsRouterData<Execute>,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ let request = RequestBuilder::new()
+ .method(Method::Post)
+ .url(&types::RefundExecuteType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundExecuteType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::RefundExecuteType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+ Ok(Some(request))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundsRouterData<Execute>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
+ let response: inespay::RefundResponse = res
+ .response
+ .parse_struct("inespay RefundResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Inespay {
+ fn get_headers(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+
+ fn get_url(
+ &self,
+ _req: &RefundSyncRouterData,
+ _connectors: &Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into())
+ }
+
+ fn build_request(
+ &self,
+ req: &RefundSyncRouterData,
+ connectors: &Connectors,
+ ) -> CustomResult<Option<Request>, errors::ConnectorError> {
+ Ok(Some(
+ RequestBuilder::new()
+ .method(Method::Get)
+ .url(&types::RefundSyncType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::RefundSyncType::get_headers(self, req, connectors)?)
+ .set_body(types::RefundSyncType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+
+ fn handle_response(
+ &self,
+ data: &RefundSyncRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
+ let response: inespay::RefundResponse = res
+ .response
+ .parse_struct("inespay RefundSyncResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+#[async_trait::async_trait]
+impl webhooks::IncomingWebhook for Inespay {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_event_type(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
new file mode 100644
index 00000000000..296d76546c8
--- /dev/null
+++ b/crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
@@ -0,0 +1,228 @@
+use common_enums::enums;
+use common_utils::types::StringMinorUnit;
+use hyperswitch_domain_models::{
+ payment_method_data::PaymentMethodData,
+ router_data::{ConnectorAuthType, RouterData},
+ router_flow_types::refunds::{Execute, RSync},
+ router_request_types::ResponseId,
+ router_response_types::{PaymentsResponseData, RefundsResponseData},
+ types::{PaymentsAuthorizeRouterData, RefundsRouterData},
+};
+use hyperswitch_interfaces::errors;
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use crate::{
+ types::{RefundsResponseRouterData, ResponseRouterData},
+ utils::PaymentsAuthorizeRequestData,
+};
+
+//TODO: Fill the struct with respective fields
+pub struct InespayRouterData<T> {
+ pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub router_data: T,
+}
+
+impl<T> From<(StringMinorUnit, T)> for InespayRouterData<T> {
+ fn from((amount, item): (StringMinorUnit, T)) -> Self {
+ //Todo : use utils to convert the amount to the type of amount that a connector accepts
+ Self {
+ amount,
+ router_data: item,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, PartialEq)]
+pub struct InespayPaymentsRequest {
+ amount: StringMinorUnit,
+ card: InespayCard,
+}
+
+#[derive(Default, Debug, Serialize, Eq, PartialEq)]
+pub struct InespayCard {
+ number: cards::CardNumber,
+ expiry_month: Secret<String>,
+ expiry_year: Secret<String>,
+ cvc: Secret<String>,
+ complete: bool,
+}
+
+impl TryFrom<&InespayRouterData<&PaymentsAuthorizeRouterData>> for InespayPaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &InespayRouterData<&PaymentsAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ match item.router_data.request.payment_method_data.clone() {
+ PaymentMethodData::Card(req_card) => {
+ let card = InespayCard {
+ number: req_card.card_number,
+ expiry_month: req_card.card_exp_month,
+ expiry_year: req_card.card_exp_year,
+ cvc: req_card.card_cvc,
+ complete: item.router_data.request.is_auto_capture()?,
+ };
+ Ok(Self {
+ amount: item.amount.clone(),
+ card,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// Auth Struct
+pub struct InespayAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&ConnectorAuthType> for InespayAuthType {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
+// PaymentsResponse
+//TODO: Append the remaining status flags
+#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "lowercase")]
+pub enum InespayPaymentStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<InespayPaymentStatus> for common_enums::AttemptStatus {
+ fn from(item: InespayPaymentStatus) -> Self {
+ match item {
+ InespayPaymentStatus::Succeeded => Self::Charged,
+ InespayPaymentStatus::Failed => Self::Failure,
+ InespayPaymentStatus::Processing => Self::Authorizing,
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
+pub struct InespayPaymentsResponse {
+ status: InespayPaymentStatus,
+ id: String,
+}
+
+impl<F, T> TryFrom<ResponseRouterData<F, InespayPaymentsResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: ResponseRouterData<F, InespayPaymentsResponse, T, PaymentsResponseData>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ status: common_enums::AttemptStatus::from(item.response.status),
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(item.response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(None),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+// REFUND :
+// Type definition for RefundRequest
+#[derive(Default, Debug, Serialize)]
+pub struct InespayRefundRequest {
+ pub amount: StringMinorUnit,
+}
+
+impl<F> TryFrom<&InespayRouterData<&RefundsRouterData<F>>> for InespayRefundRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &InespayRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
+ Ok(Self {
+ amount: item.amount.to_owned(),
+ })
+ }
+}
+
+// Type definition for Refund Response
+
+#[allow(dead_code)]
+#[derive(Debug, Serialize, Default, Deserialize, Clone)]
+pub enum RefundStatus {
+ Succeeded,
+ Failed,
+ #[default]
+ Processing,
+}
+
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
+ match item {
+ RefundStatus::Succeeded => Self::Success,
+ RefundStatus::Failed => Self::Failure,
+ RefundStatus::Processing => Self::Pending,
+ //TODO: Review mapping
+ }
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct RefundResponse {
+ id: String,
+ status: RefundStatus,
+}
+
+impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<Execute, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: RefundsResponseRouterData<RSync, RefundResponse>,
+ ) -> Result<Self, Self::Error> {
+ Ok(Self {
+ response: Ok(RefundsResponseData {
+ connector_refund_id: item.response.id.to_string(),
+ refund_status: enums::RefundStatus::from(item.response.status),
+ }),
+ ..item.data
+ })
+ }
+}
+
+//TODO: Fill the struct with respective fields
+#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
+pub struct InespayErrorResponse {
+ pub status_code: u16,
+ pub code: String,
+ pub message: String,
+ pub reason: Option<String>,
+}
diff --git a/crates/hyperswitch_connectors/src/default_implementations.rs b/crates/hyperswitch_connectors/src/default_implementations.rs
index bc86e713501..50b28be2b0b 100644
--- a/crates/hyperswitch_connectors/src/default_implementations.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations.rs
@@ -107,6 +107,7 @@ default_imp_for_authorize_session_token!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -164,6 +165,7 @@ default_imp_for_calculate_tax!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Mollie,
connectors::Multisafepay,
@@ -218,6 +220,7 @@ default_imp_for_session_update!(
connectors::Fiservemea,
connectors::Forte,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Razorpay,
connectors::Shift4,
@@ -277,6 +280,7 @@ default_imp_for_post_session_tokens!(
connectors::Fiservemea,
connectors::Forte,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Razorpay,
connectors::Shift4,
@@ -335,6 +339,7 @@ default_imp_for_complete_authorize!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Multisafepay,
connectors::Nomupay,
@@ -389,6 +394,7 @@ default_imp_for_incremental_authorization!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -448,6 +454,7 @@ default_imp_for_create_customer!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Mollie,
connectors::Multisafepay,
@@ -505,6 +512,7 @@ default_imp_for_connector_redirect_response!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Multisafepay,
connectors::Nexinets,
@@ -559,6 +567,7 @@ default_imp_for_pre_processing_steps!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -616,6 +625,7 @@ default_imp_for_post_processing_steps!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -675,6 +685,7 @@ default_imp_for_approve!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -734,6 +745,7 @@ default_imp_for_reject!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -793,6 +805,7 @@ default_imp_for_webhook_source_verification!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -853,6 +866,7 @@ default_imp_for_accept_dispute!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -912,6 +926,7 @@ default_imp_for_submit_evidence!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -970,6 +985,7 @@ default_imp_for_defend_dispute!(
connectors::Fiuu,
connectors::Forte,
connectors::Globepay,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Helcim,
connectors::Nomupay,
@@ -1039,6 +1055,7 @@ default_imp_for_file_upload!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1091,6 +1108,7 @@ default_imp_for_payouts!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Mollie,
connectors::Multisafepay,
@@ -1151,6 +1169,7 @@ default_imp_for_payouts_create!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1212,6 +1231,7 @@ default_imp_for_payouts_retrieve!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1273,6 +1293,7 @@ default_imp_for_payouts_eligibility!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1334,6 +1355,7 @@ default_imp_for_payouts_fulfill!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1395,6 +1417,7 @@ default_imp_for_payouts_cancel!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1456,6 +1479,7 @@ default_imp_for_payouts_quote!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1517,6 +1541,7 @@ default_imp_for_payouts_recipient!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1578,6 +1603,7 @@ default_imp_for_payouts_recipient_account!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1639,6 +1665,7 @@ default_imp_for_frm_sale!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1700,6 +1727,7 @@ default_imp_for_frm_checkout!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1761,6 +1789,7 @@ default_imp_for_frm_transaction!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1822,6 +1851,7 @@ default_imp_for_frm_fulfillment!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1883,6 +1913,7 @@ default_imp_for_frm_record_return!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1941,6 +1972,7 @@ default_imp_for_revoking_mandates!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
diff --git a/crates/hyperswitch_connectors/src/default_implementations_v2.rs b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
index 75cbf192e55..7b19ca68365 100644
--- a/crates/hyperswitch_connectors/src/default_implementations_v2.rs
+++ b/crates/hyperswitch_connectors/src/default_implementations_v2.rs
@@ -223,6 +223,7 @@ default_imp_for_new_connector_integration_payment!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -283,6 +284,7 @@ default_imp_for_new_connector_integration_refund!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -338,6 +340,7 @@ default_imp_for_new_connector_integration_connector_access_token!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -399,6 +402,7 @@ default_imp_for_new_connector_integration_accept_dispute!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -459,6 +463,7 @@ default_imp_for_new_connector_integration_submit_evidence!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -519,6 +524,7 @@ default_imp_for_new_connector_integration_defend_dispute!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -589,6 +595,7 @@ default_imp_for_new_connector_integration_file_upload!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -651,6 +658,7 @@ default_imp_for_new_connector_integration_payouts_create!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -713,6 +721,7 @@ default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -775,6 +784,7 @@ default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -837,6 +847,7 @@ default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -899,6 +910,7 @@ default_imp_for_new_connector_integration_payouts_quote!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -961,6 +973,7 @@ default_imp_for_new_connector_integration_payouts_recipient!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1023,6 +1036,7 @@ default_imp_for_new_connector_integration_payouts_sync!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1085,6 +1099,7 @@ default_imp_for_new_connector_integration_payouts_recipient_account!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1145,6 +1160,7 @@ default_imp_for_new_connector_integration_webhook_source_verification!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1207,6 +1223,7 @@ default_imp_for_new_connector_integration_frm_sale!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1269,6 +1286,7 @@ default_imp_for_new_connector_integration_frm_checkout!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1331,6 +1349,7 @@ default_imp_for_new_connector_integration_frm_transaction!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1393,6 +1412,7 @@ default_imp_for_new_connector_integration_frm_fulfillment!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1455,6 +1475,7 @@ default_imp_for_new_connector_integration_frm_record_return!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
@@ -1514,6 +1535,7 @@ default_imp_for_new_connector_integration_revoking_mandates!(
connectors::Forte,
connectors::Globepay,
connectors::Helcim,
+ connectors::Inespay,
connectors::Jpmorgan,
connectors::Nomupay,
connectors::Novalnet,
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 5e5eeea31b3..539b87c4808 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -47,6 +47,7 @@ pub struct Connectors {
pub gpayments: ConnectorParams,
pub helcim: ConnectorParams,
pub iatapay: ConnectorParams,
+ pub inespay: ConnectorParams,
pub itaubank: ConnectorParams,
pub jpmorgan: ConnectorParams,
pub klarna: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index e98730d006d..b6668323ba9 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -50,14 +50,14 @@ pub use hyperswitch_connectors::connectors::{
coinbase, coinbase::Coinbase, cryptopay, cryptopay::Cryptopay, deutschebank,
deutschebank::Deutschebank, digitalvirgo, digitalvirgo::Digitalvirgo, dlocal, dlocal::Dlocal,
elavon, elavon::Elavon, fiserv, fiserv::Fiserv, fiservemea, fiservemea::Fiservemea, fiuu,
- fiuu::Fiuu, forte, forte::Forte, globepay, globepay::Globepay, helcim, helcim::Helcim,
- jpmorgan, jpmorgan::Jpmorgan, mollie, mollie::Mollie, multisafepay, multisafepay::Multisafepay,
- nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay, nomupay, nomupay::Nomupay,
- novalnet, novalnet::Novalnet, payeezy, payeezy::Payeezy, payu, payu::Payu, powertranz,
- powertranz::Powertranz, razorpay, razorpay::Razorpay, shift4, shift4::Shift4, square,
- square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes, thunes::Thunes, tsys,
- tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, worldpay, worldpay::Worldpay,
- xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
+ fiuu::Fiuu, forte, forte::Forte, globepay, globepay::Globepay, helcim, helcim::Helcim, inespay,
+ inespay::Inespay, jpmorgan, jpmorgan::Jpmorgan, mollie, mollie::Mollie, multisafepay,
+ multisafepay::Multisafepay, nexinets, nexinets::Nexinets, nexixpay, nexixpay::Nexixpay,
+ nomupay, nomupay::Nomupay, novalnet, novalnet::Novalnet, payeezy, payeezy::Payeezy, payu,
+ payu::Payu, powertranz, powertranz::Powertranz, razorpay, razorpay::Razorpay, shift4,
+ shift4::Shift4, square, square::Square, stax, stax::Stax, taxjar, taxjar::Taxjar, thunes,
+ thunes::Thunes, tsys, tsys::Tsys, volt, volt::Volt, worldline, worldline::Worldline, worldpay,
+ worldpay::Worldpay, xendit, xendit::Xendit, zen, zen::Zen, zsl, zsl::Zsl,
};
#[cfg(feature = "dummy_connector")]
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index a8d14187dc1..6d4dde53082 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1393,6 +1393,10 @@ impl<'a> ConnectorAuthTypeAndMetadataValidation<'a> {
iatapay::transformers::IatapayAuthType::try_from(self.auth_type)?;
Ok(())
}
+ // api_enums::Connector::Inespay => {
+ // inespay::transformers::InespayAuthType::try_from(self.auth_type)?;
+ // Ok(())
+ // }
api_enums::Connector::Itaubank => {
itaubank::transformers::ItaubankAuthType::try_from(self.auth_type)?;
Ok(())
diff --git a/crates/router/src/core/payments/connector_integration_v2_impls.rs b/crates/router/src/core/payments/connector_integration_v2_impls.rs
index 94c531a0963..44e8c25d67b 100644
--- a/crates/router/src/core/payments/connector_integration_v2_impls.rs
+++ b/crates/router/src/core/payments/connector_integration_v2_impls.rs
@@ -1142,6 +1142,7 @@ default_imp_for_new_connector_integration_payouts!(
connector::Gpayments,
connector::Helcim,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
@@ -1789,6 +1790,7 @@ default_imp_for_new_connector_integration_frm!(
connector::Gpayments,
connector::Helcim,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
@@ -2284,6 +2286,7 @@ default_imp_for_new_connector_integration_connector_authentication!(
connector::Gpayments,
connector::Helcim,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 1358bcedba1..9ba260f554f 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -483,6 +483,7 @@ default_imp_for_connector_request_id!(
connector::Gocardless,
connector::Gpayments,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
@@ -1769,6 +1770,7 @@ default_imp_for_fraud_check!(
connector::Gpayments,
connector::Helcim,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
@@ -2432,6 +2434,7 @@ default_imp_for_connector_authentication!(
connector::Gocardless,
connector::Helcim,
connector::Iatapay,
+ connector::Inespay,
connector::Itaubank,
connector::Jpmorgan,
connector::Klarna,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index ad40f83a554..d550c1978b2 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -434,6 +434,9 @@ impl ConnectorData {
enums::Connector::Iatapay => {
Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new())))
}
+ // enums::Connector::Inespay => {
+ // Ok(ConnectorEnum::Old(Box::new(connector::Inespay::new())))
+ // }
enums::Connector::Itaubank => {
//enums::Connector::Jpmorgan => Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan))),
Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new())))
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index c8a9cbea1dd..78138757493 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -249,6 +249,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
}
api_enums::Connector::Helcim => Self::Helcim,
api_enums::Connector::Iatapay => Self::Iatapay,
+ // api_enums::Connector::Inespay => Self::Inespay,
api_enums::Connector::Itaubank => Self::Itaubank,
//api_enums::Connector::Jpmorgan => Self::Jpmorgan,
api_enums::Connector::Klarna => Self::Klarna,
diff --git a/crates/router/tests/connectors/inespay.rs b/crates/router/tests/connectors/inespay.rs
new file mode 100644
index 00000000000..6fb8914aec7
--- /dev/null
+++ b/crates/router/tests/connectors/inespay.rs
@@ -0,0 +1,421 @@
+use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
+use masking::Secret;
+use router::types::{self, api, storage::enums};
+use test_utils::connector_auth;
+
+use crate::utils::{self, ConnectorActions};
+
+#[derive(Clone, Copy)]
+struct InespayTest;
+impl ConnectorActions for InespayTest {}
+impl utils::Connector for InespayTest {
+ fn get_data(&self) -> api::ConnectorData {
+ use router::connector::Inespay;
+ utils::construct_connector_data_old(
+ Box::new(Inespay::new()),
+ types::Connector::Plaid,
+ api::GetToken::Connector,
+ None,
+ )
+ }
+
+ fn get_auth_token(&self) -> types::ConnectorAuthType {
+ utils::to_connector_auth_type(
+ connector_auth::ConnectorAuthentication::new()
+ .inespay
+ .expect("Missing connector authentication configuration")
+ .into(),
+ )
+ }
+
+ fn get_name(&self) -> String {
+ "inespay".to_string()
+ }
+}
+
+static CONNECTOR: InespayTest = InespayTest {};
+
+fn get_default_payment_info() -> Option<utils::PaymentInfo> {
+ None
+}
+
+fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
+ None
+}
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_only_authorize_payment() {
+ let response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_capture_payment(
+ payment_method_details(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: 50,
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Capture payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_authorized_payment() {
+ let authorize_response = CONNECTOR
+ .authorize_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .expect("Authorize payment response");
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("PSync response");
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let response = CONNECTOR
+ .authorize_and_void_payment(
+ payment_method_details(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: String::from(""),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .expect("Void payment response");
+ assert_eq!(response.status, enums::AttemptStatus::Voided);
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let refund_response = CONNECTOR
+ .capture_payment_and_refund(
+ payment_method_details(),
+ None,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ capture_method: Some(enums::CaptureMethod::Automatic),
+ ..Default::default()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ CONNECTOR
+ .make_payment_and_multiple_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let refund_response = CONNECTOR
+ .make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let response = CONNECTOR
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Cards Negative scenarios
+// Creates a payment with incorrect CVC.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_cvc: Secret::new("12345".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's security code is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: PaymentMethodData::Card(Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your card's expiration year is invalid.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ let authorize_response = CONNECTOR
+ .make_payment(payment_method_details(), get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded."
+ );
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("No such payment_intent: '123456789'")
+ );
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let response = CONNECTOR
+ .make_payment_and_refund(
+ payment_method_details(),
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Refund amount (₹1.50) is greater than charge amount (₹1.00)",
+ );
+}
+
+// Connector dependent test cases goes here
+
+// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index 9bb079b7a16..ef3ae2d14db 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -43,6 +43,7 @@ mod gocardless;
mod gpayments;
mod helcim;
mod iatapay;
+mod inespay;
mod itaubank;
mod jpmorgan;
mod mifinity;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index d2eec724597..120ce5e9d26 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -287,6 +287,9 @@ api_secret = "Client Key"
[thunes]
api_key="API Key"
+[inespay]
+api_key="API Key"
+
[jpmorgan]
api_key="API Key"
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 2b2dc143113..4bb348d6679 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -49,6 +49,7 @@ pub struct ConnectorAuthentication {
pub gpayments: Option<HeaderKey>,
pub helcim: Option<HeaderKey>,
pub iatapay: Option<SignatureKey>,
+ pub inespay: Option<HeaderKey>,
pub itaubank: Option<MultiAuthKey>,
pub jpmorgan: Option<HeaderKey>,
pub mifinity: Option<HeaderKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 8aeacaeca1f..dab85eb3cdd 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -116,6 +116,7 @@ gocardless.base_url = "https://api-sandbox.gocardless.com"
gpayments.base_url = "https://{{merchant_endpoint_prefix}}-test.api.as1.gpayments.net"
helcim.base_url = "https://api.helcim.com/"
iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1"
+inespay.base_url = "https://apiflow.inespay.com/san/v21"
itaubank.base_url = "https://sandbox.devportal.itau.com.br/"
jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2"
klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/"
@@ -215,6 +216,7 @@ cards = [
"gpayments",
"helcim",
"iatapay",
+ "inespay",
"itaubank",
"jpmorgan",
"mollie",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 9f1992bfa44..e5a65128319 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte globalpay globepay gocardless gpayments helcim iatapay itaubank jpmorgan klarna mifinity mollie multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex amazonpay applepay authorizedotnet bambora bamboraapac bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource datatrans deutschebank digitalvirgo dlocal dummyconnector ebanx elavon fiserv fiservemea fiuu forte globalpay globepay gocardless gpayments helcim iatapay inespay itaubank jpmorgan klarna mifinity mollie multisafepay netcetera nexinets nexixpay nomupay noon novalnet nuvei opayo opennode paybox payeezy payme payone paypal payu placetopay plaid powertranz prophetpay rapyd razorpay shift4 square stax stripe taxjar threedsecureio thunes trustpay tsys volt wellsfargo wellsfargopayout wise worldline worldpay xendit zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res="$(echo ${sorted[@]})"
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
[INESPAY] add Connector Template Code (#6614)
|
27ca8be0da0fe6a67f8894d16e468cfa93ab5adc
|
2024-06-13 05:45:06
|
github-actions
|
chore(version): 2024.06.13.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a3d485672f..32bff5be635 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,33 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.06.13.0
+
+### Features
+
+- **connector:** [BOA/CYB] Make billTo fields optional ([#4951](https://github.com/juspay/hyperswitch/pull/4951)) ([`4651584`](https://github.com/juspay/hyperswitch/commit/4651584ecc25e40a285b3544315901145d8c6b4b))
+- **events:** Add audit events payment capture ([#4913](https://github.com/juspay/hyperswitch/pull/4913)) ([`40a996e`](https://github.com/juspay/hyperswitch/commit/40a996e84c1d9ccc55b62c561cee443508e9e60f))
+- **payouts:** Make payout_type optional in payouts table ([#4954](https://github.com/juspay/hyperswitch/pull/4954)) ([`b847606`](https://github.com/juspay/hyperswitch/commit/b847606d665388fba898425b31dd5f207f60a56e))
+
+### Bug Fixes
+
+- **core:** Fix the multitenancy prefix in routing cache ([#4963](https://github.com/juspay/hyperswitch/pull/4963)) ([`b420522`](https://github.com/juspay/hyperswitch/commit/b42052269455051fe15163217ee83d80a1470f84))
+
+### Refactors
+
+- **connector:**
+ - Add amount conversion framework to bluesnap ([#4825](https://github.com/juspay/hyperswitch/pull/4825)) ([`fb0a7aa`](https://github.com/juspay/hyperswitch/commit/fb0a7aa556212af08f47ddc3c62bfbc918e3bf01))
+ - [Mifinity]Move destination_account_number from pmd to Mifinity Metadata ([#4962](https://github.com/juspay/hyperswitch/pull/4962)) ([`5b21951`](https://github.com/juspay/hyperswitch/commit/5b21951102c54cee4b6d1d74ed6a7e7e9f3e192d))
+- **payment_methods:** Enable deletion of default Payment Methods ([#4942](https://github.com/juspay/hyperswitch/pull/4942)) ([`cf3d039`](https://github.com/juspay/hyperswitch/commit/cf3d039efdbaa95ae9e75de60b3cea67e21d11db))
+
+### Miscellaneous Tasks
+
+- **env:** Revert typo in integ env ([#4958](https://github.com/juspay/hyperswitch/pull/4958)) ([`271b977`](https://github.com/juspay/hyperswitch/commit/271b977aa286e80cb09c6692c4cd470e3c6c741c))
+
+**Full Changelog:** [`2024.06.12.0...2024.06.13.0`](https://github.com/juspay/hyperswitch/compare/2024.06.12.0...2024.06.13.0)
+
+- - -
+
## 2024.06.12.0
### Features
|
chore
|
2024.06.13.0
|
12ef8ee0fc63829429697c42b98f4c773f12cade
|
2025-02-14 14:48:12
|
Mani Chandra
|
refactor(payments): Add platform merchant account checks for payment intent (#7204)
| false
|
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index c830b7618d0..bdb0548d6a4 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -45,7 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsCaptureRequest, PaymentData<F>>,
> {
@@ -70,6 +71,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCaptureR
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[IntentStatus::Failed, IntentStatus::Succeeded],
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index c6679e481f1..b41247003bd 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -12,6 +12,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -46,7 +47,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsCancelRequest, PaymentData<F>>,
> {
@@ -70,6 +71,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsCancelRe
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index ebe49f59f64..2bb8dd279e5 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{self, helpers, operations, types::MultipleCaptureData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -45,7 +46,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<
'a,
@@ -76,6 +77,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentData<F>, api::Paymen
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
payment_attempt = db
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id,
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index 81ffa8e992f..93b7ffa6c19 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -8,7 +8,11 @@ use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payments::operations::{self, ValidateStatusForOperation},
+ payments::{
+ helpers,
+ operations::{self, ValidateStatusForOperation},
+ },
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
types::{
@@ -142,7 +146,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentCaptureData<F>, PaymentsCaptureReques
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<PaymentCaptureData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -154,6 +158,9 @@ impl<F: Send + Clone> GetTracker<F, PaymentCaptureData<F>, PaymentsCaptureReques
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
self.validate_status_for_operation(payment_intent.status)?;
let active_attempt_id = payment_intent
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index 72c04c6a549..f1279f394b2 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -72,6 +72,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
+
payment_intent.setup_future_usage = request
.setup_future_usage
.or(payment_intent.setup_future_usage);
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 64191f77c6d..84ff9933875 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -106,6 +106,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
+
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index 043ee3378b3..2e4c0190adb 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -171,6 +171,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentConfirmData<F>, PaymentsConfir
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
self.validate_status_for_operation(payment_intent.status)?;
let client_secret = header_payload
.client_secret
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index 189439ec967..fdf5350bed8 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -9,7 +9,11 @@ use super::{Domain, GetTracker, Operation, UpdateTracker, ValidateRequest};
use crate::{
core::{
errors::{self, CustomResult, RouterResult, StorageErrorExt},
- payments::operations::{self, ValidateStatusForOperation},
+ payments::{
+ helpers,
+ operations::{self, ValidateStatusForOperation},
+ },
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
types::{
@@ -119,7 +123,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetriev
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<PaymentStatusData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -131,6 +135,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentStatusData<F>, PaymentsRetriev
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
let payment_attempt = payment_intent
.active_attempt_id
.as_ref()
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index 3cc26e7b67f..0041209eb0f 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -10,6 +10,7 @@ use crate::{
core::{
errors::{self, RouterResult},
payments::{self, helpers, operations},
+ utils::ValidatePlatformMerchant,
},
db::errors::StorageErrorExt,
routes::{app::ReqState, SessionState},
@@ -89,7 +90,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -99,6 +100,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
let payment_data = payments::PaymentIntentData {
flow: PhantomData,
payment_intent,
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 0e189583d0a..9f21dbc9981 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -73,6 +73,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsPostSess
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::authenticate_client_secret(Some(request.client_secret.peek()), &payment_intent)?;
let mut payment_attempt = db
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index e5321b1f984..1591b1d6a47 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -11,6 +11,7 @@ use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
payments::{helpers, operations, PaymentAddress, PaymentData},
+ utils::ValidatePlatformMerchant,
},
events::audit_events::{AuditEvent, AuditEventType},
routes::{app::ReqState, SessionState},
@@ -43,7 +44,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<'a, F, PaymentsCancelRequest, PaymentData<F>>>
{
let db = &*state.store;
@@ -66,6 +67,9 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, PaymentsCancelRequest
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 0e94fbe09c6..be4f804a8a7 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -68,6 +68,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index ec59ba3473e..9bca88c6d04 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -10,7 +10,7 @@ use super::{BoxedOperation, Domain, GetTracker, Operation, ValidateRequest};
use crate::{
core::{
errors::{self, RouterResult, StorageErrorExt},
- payments::{self, operations, operations::ValidateStatusForOperation},
+ payments::{self, helpers, operations, operations::ValidateStatusForOperation},
},
routes::SessionState,
types::{api, domain, storage::enums},
@@ -112,6 +112,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, payments::PaymentIntentData<F>, Payme
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
self.validate_status_for_operation(payment_intent.status)?;
let client_secret = header_payload
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 1da9a1a2264..299d7237807 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -68,6 +68,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsStartReq
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once Merchant ID auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 44f0c9172f9..c458f95ad97 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -213,7 +213,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>,
> {
@@ -225,6 +225,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRetrieve
request,
self,
merchant_account.storage_scheme,
+ platform_merchant_account,
)
.await
}
@@ -252,6 +253,7 @@ async fn get_tracker_for_sync<
any(feature = "v2", feature = "v1"),
not(feature = "payment_methods_v2")
))]
+#[allow(clippy::too_many_arguments)]
async fn get_tracker_for_sync<
'a,
F: Send + Clone,
@@ -264,6 +266,7 @@ async fn get_tracker_for_sync<
request: &api::PaymentsRetrieveRequest,
operation: Op,
storage_scheme: enums::MerchantStorageScheme,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRetrieveRequest, PaymentData<F>>>
{
let (payment_intent, mut payment_attempt, currency, amount);
@@ -274,6 +277,7 @@ async fn get_tracker_for_sync<
merchant_account.get_id(),
key_store,
storage_scheme,
+ platform_merchant_account,
)
.await?;
@@ -579,6 +583,7 @@ pub async fn get_payment_intent_payment_attempt(
merchant_id: &common_utils::id_type::MerchantId,
key_store: &domain::MerchantKeyStore,
storage_scheme: enums::MerchantStorageScheme,
+ _platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<(storage::PaymentIntent, storage::PaymentAttempt)> {
let key_manager_state: KeyManagerState = state.into();
let db = &*state.store;
@@ -662,4 +667,6 @@ pub async fn get_payment_intent_payment_attempt(
get_pi_pa()
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
+
+ // TODO (#7195): Add platform merchant account validation once client_secret auth is solved
}
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 0e60407aa7c..ac37513f2b9 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -81,6 +81,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
if let Some(order_details) = &request.order_details {
helpers::validate_order_details_amount(
order_details.to_owned(),
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index 2931c11b070..af6b7d57838 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -21,9 +21,10 @@ use crate::{
core::{
errors::{self, RouterResult},
payments::{
- self,
+ self, helpers,
operations::{self, ValidateStatusForOperation},
},
+ utils::ValidatePlatformMerchant,
},
db::errors::StorageErrorExt,
routes::{app::ReqState, SessionState},
@@ -135,7 +136,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<operations::GetTrackerResponse<payments::PaymentIntentData<F>>> {
let db = &*state.store;
let key_manager_state = &state.into();
@@ -145,6 +146,9 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
self.validate_status_for_operation(payment_intent.status)?;
let PaymentsUpdateIntentRequest {
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index 2c816ad39d1..95c50f2f17e 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -15,6 +15,7 @@ use crate::{
self, helpers, operations, CustomerDetails, IncrementalAuthorizationDetails,
PaymentAddress,
},
+ utils::ValidatePlatformMerchant,
},
routes::{app::ReqState, SessionState},
services,
@@ -48,7 +49,7 @@ impl<F: Send + Clone + Sync>
key_store: &domain::MerchantKeyStore,
_auth_flow: services::AuthFlow,
_header_payload: &hyperswitch_domain_models::payments::HeaderPayload,
- _platform_merchant_account: Option<&domain::MerchantAccount>,
+ platform_merchant_account: Option<&domain::MerchantAccount>,
) -> RouterResult<
operations::GetTrackerResponse<
'a,
@@ -77,6 +78,9 @@ impl<F: Send + Clone + Sync>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ payment_intent
+ .validate_platform_merchant(platform_merchant_account.map(|ma| ma.get_id()))?;
+
helpers::validate_payment_status_against_allowed_statuses(
payment_intent.status,
&[enums::IntentStatus::RequiresCapture],
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index 5b9c90f3add..bcda2af8768 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -79,6 +79,8 @@ impl<F: Send + Clone + Sync>
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
+ // TODO (#7195): Add platform merchant account validation once publishable key auth is solved
+
helpers::validate_payment_status_against_not_allowed_statuses(
payment_intent.status,
&[
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index cd2a9ed220b..49075e7f548 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1760,3 +1760,36 @@ pub(crate) fn validate_profile_id_from_auth_layer<T: GetProfileId + std::fmt::De
(None, None) | (None, Some(_)) => Ok(()),
}
}
+
+pub(crate) trait ValidatePlatformMerchant {
+ fn get_platform_merchant_id(&self) -> Option<&common_utils::id_type::MerchantId>;
+
+ fn validate_platform_merchant(
+ &self,
+ auth_platform_merchant_id: Option<&common_utils::id_type::MerchantId>,
+ ) -> CustomResult<(), errors::ApiErrorResponse> {
+ let data_platform_merchant_id = self.get_platform_merchant_id();
+ match (data_platform_merchant_id, auth_platform_merchant_id) {
+ (Some(data_platform_merchant_id), Some(auth_platform_merchant_id)) => {
+ common_utils::fp_utils::when(
+ data_platform_merchant_id != auth_platform_merchant_id,
+ || {
+ Err(report!(errors::ApiErrorResponse::PaymentNotFound)).attach_printable(format!(
+ "Data platform merchant id: {data_platform_merchant_id:?} does not match with auth platform merchant id: {auth_platform_merchant_id:?}"))
+ },
+ )
+ }
+ (Some(_), None) | (None, Some(_)) => {
+ Err(report!(errors::ApiErrorResponse::InvalidPlatformOperation))
+ .attach_printable("Platform merchant id is missing in either data or auth")
+ }
+ (None, None) => Ok(()),
+ }
+ }
+}
+
+impl ValidatePlatformMerchant for storage::PaymentIntent {
+ fn get_platform_merchant_id(&self) -> Option<&common_utils::id_type::MerchantId> {
+ self.platform_merchant_id.as_ref()
+ }
+}
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index 86f1874ab09..0b6246d4483 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -415,6 +415,7 @@ pub async fn list_payment_method_api(
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
+ // TODO (#7195): Fill platform_merchant_account in the client secret auth and pass it here.
cards::list_payment_methods(state, auth.merchant_account, auth.key_store, req)
},
&*auth,
|
refactor
|
Add platform merchant account checks for payment intent (#7204)
|
4f9c04b856761b9c0486abad4c36de191da2c460
|
2024-01-11 13:39:46
|
Shankar Singh C
|
fix(router): add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index 7e32b2f5d3b..94f71fa3f70 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -339,7 +339,7 @@ sts_role_session_name = "" # An identifier for the assumed role session, used to
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
mollie = { long_lived_token = false, payment_method = "card" }
stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = { long_lived_token = false, payment_method = "card" }
diff --git a/config/development.toml b/config/development.toml
index ebd4cb1c93e..272b3641713 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -415,7 +415,7 @@ debit = { currency = "USD" }
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
stax = { long_lived_token = true, payment_method = "card,bank_debit" }
mollie = {long_lived_token = false, payment_method = "card"}
square = {long_lived_token = false, payment_method = "card"}
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index a8cf5bfb051..e55353f8903 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -229,7 +229,7 @@ consumer_group = "SCHEDULER_GROUP"
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
mollie = {long_lived_token = false, payment_method = "card"}
stax = { long_lived_token = true, payment_method = "card,bank_debit" }
square = {long_lived_token = false, payment_method = "card"}
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index b7aa3d3ea5d..3d93c2f188b 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -287,6 +287,15 @@ pub struct PaymentMethodTokenFilter {
pub payment_method: HashSet<diesel_models::enums::PaymentMethod>,
pub payment_method_type: Option<PaymentMethodTypeTokenFilter>,
pub long_lived_token: bool,
+ pub apple_pay_pre_decrypt_flow: Option<ApplePayPreDecryptFlow>,
+}
+
+#[derive(Debug, Deserialize, Clone, Default)]
+#[serde(deny_unknown_fields, rename_all = "snake_case")]
+pub enum ApplePayPreDecryptFlow {
+ #[default]
+ ConnectorTokenization,
+ NetworkTokenization,
}
#[derive(Debug, Deserialize, Clone, Default)]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index a07c88ea667..ff4934e1efc 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -44,7 +44,7 @@ use super::{errors::StorageErrorExt, payment_methods::surcharge_decision_configs
#[cfg(feature = "frm")]
use crate::core::fraud_check as frm_core;
use crate::{
- configs::settings::PaymentMethodTypeTokenFilter,
+ configs::settings::{ApplePayPreDecryptFlow, PaymentMethodTypeTokenFilter},
core::{
errors::{self, CustomResult, RouterResponse, RouterResult},
payment_methods::PaymentMethodRetrieve,
@@ -1582,6 +1582,7 @@ fn is_payment_method_tokenization_enabled_for_connector(
connector_name: &str,
payment_method: &storage::enums::PaymentMethod,
payment_method_type: &Option<storage::enums::PaymentMethodType>,
+ apple_pay_flow: &Option<enums::ApplePayFlow>,
) -> RouterResult<bool> {
let connector_tokenization_filter = state.conf.tokenization.0.get(connector_name);
@@ -1595,13 +1596,35 @@ fn is_payment_method_tokenization_enabled_for_connector(
payment_method_type,
connector_filter.payment_method_type.clone(),
)
+ && is_apple_pay_pre_decrypt_type_connector_tokenization(
+ payment_method_type,
+ apple_pay_flow,
+ connector_filter.apple_pay_pre_decrypt_flow.clone(),
+ )
})
.unwrap_or(false))
}
+fn is_apple_pay_pre_decrypt_type_connector_tokenization(
+ payment_method_type: &Option<storage::enums::PaymentMethodType>,
+ apple_pay_flow: &Option<enums::ApplePayFlow>,
+ apple_pay_pre_decrypt_flow_filter: Option<ApplePayPreDecryptFlow>,
+) -> bool {
+ match (payment_method_type, apple_pay_flow) {
+ (
+ Some(storage::enums::PaymentMethodType::ApplePay),
+ Some(enums::ApplePayFlow::Simplified),
+ ) => !matches!(
+ apple_pay_pre_decrypt_flow_filter,
+ Some(ApplePayPreDecryptFlow::NetworkTokenization)
+ ),
+ _ => true,
+ }
+}
+
fn decide_apple_pay_flow(
payment_method_type: &Option<api_models::enums::PaymentMethodType>,
- merchant_connector_account: &Option<helpers::MerchantConnectorAccountType>,
+ merchant_connector_account: Option<&helpers::MerchantConnectorAccountType>,
) -> Option<enums::ApplePayFlow> {
payment_method_type.and_then(|pmt| match pmt {
api_models::enums::PaymentMethodType::ApplePay => {
@@ -1612,9 +1635,9 @@ fn decide_apple_pay_flow(
}
fn check_apple_pay_metadata(
- merchant_connector_account: &Option<helpers::MerchantConnectorAccountType>,
+ merchant_connector_account: Option<&helpers::MerchantConnectorAccountType>,
) -> Option<enums::ApplePayFlow> {
- merchant_connector_account.clone().and_then(|mca| {
+ merchant_connector_account.and_then(|mca| {
let metadata = mca.get_metadata();
metadata.and_then(|apple_pay_metadata| {
let parsed_metadata = apple_pay_metadata
@@ -1785,19 +1808,18 @@ where
.get_required_value("payment_method")?;
let payment_method_type = &payment_data.payment_attempt.payment_method_type;
+ let apple_pay_flow =
+ decide_apple_pay_flow(payment_method_type, Some(merchant_connector_account));
+
let is_connector_tokenization_enabled =
is_payment_method_tokenization_enabled_for_connector(
state,
&connector,
payment_method,
payment_method_type,
+ &apple_pay_flow,
)?;
- let apple_pay_flow = decide_apple_pay_flow(
- payment_method_type,
- &Some(merchant_connector_account.clone()),
- );
-
add_apple_pay_flow_metrics(
&apple_pay_flow,
payment_data.payment_attempt.connector.clone(),
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 7b7d64a5f81..551f8cd5da4 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -118,7 +118,7 @@ where
let apple_pay_flow = payments::decide_apple_pay_flow(
&payment_data.payment_attempt.payment_method_type,
- &Some(merchant_connector_account.clone()),
+ Some(merchant_connector_account),
);
router_data = types::RouterData {
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 066933317b0..358a591a667 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -200,7 +200,7 @@ red_pagos = { country = "UY", currency = "UYU" }
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } }
-checkout = { long_lived_token = false, payment_method = "wallet" }
+checkout = { long_lived_token = false, payment_method = "wallet", apple_pay_pre_decrypt_flow = "network_tokenization" }
mollie = {long_lived_token = false, payment_method = "card"}
braintree = { long_lived_token = false, payment_method = "card" }
gocardless = {long_lived_token = true, payment_method = "bank_debit"}
|
fix
|
add config to avoid connector tokenization for `apple pay` `simplified flow` (#3234)
|
32cf06c73611554d263d9bb44d7dbe940d56dd59
|
2024-06-05 17:12:50
|
Kashif
|
feat(connector): add payouts integration for AdyenPlatform (#4874)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index ac428298e73..206ba392b78 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -166,6 +166,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
@@ -267,6 +268,7 @@ wallets = ["klarna", "mifinity", "braintree", "applepay"]
rewards = ["cashtocode", "zen"]
cards = [
"adyen",
+ "adyenplatform",
"authorizedotnet",
"coinbase",
"cryptopay",
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 32480215788..1ea7d4f4481 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -20,6 +20,7 @@ przelewy24.stripe.banks = "alior_bank,bank_millennium,bank_nowy_bfg_sa,bank_peka
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index 0e3ebd1c1fc..9b9b6aac223 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -24,6 +24,7 @@ payout_connector_list = "stripe,wise"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://{{merchant_endpoint_prefix}}-checkout-live.adyenpayments.com/checkout/"
adyen.secondary_base_url = "https://{{merchant_endpoint_prefix}}-pal-live.adyenpayments.com/"
+adyenplatform.base_url = "https://balanceplatform-api-live.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://api.authorize.net/xml/v1/request.api"
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 28ac1dca027..891e4b1f175 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -24,6 +24,7 @@ payout_connector_list = "stripe,wise"
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
authorizedotnet.base_url = "https://apitest.authorize.net/xml/v1/request.api"
diff --git a/config/development.toml b/config/development.toml
index e9d84395e6f..a3f9eb54bbf 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -94,6 +94,7 @@ rewards = ["cashtocode", "zen"]
cards = [
"aci",
"adyen",
+ "adyenplatform",
"airwallex",
"authorizedotnet",
"bambora",
@@ -166,6 +167,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
[connectors]
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index f43ceca893d..e6e2fd3815f 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -104,6 +104,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
[connectors]
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
@@ -186,6 +187,7 @@ rewards = ["cashtocode", "zen"]
cards = [
"aci",
"adyen",
+ "adyenplatform",
"airwallex",
"authorizedotnet",
"bambora",
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index c2969a16612..ce039c1156e 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -44,6 +44,7 @@ pub enum RoutingAlgorithm {
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum Connector {
+ Adyenplatform,
#[cfg(feature = "dummy_connector")]
#[serde(rename = "phonypay")]
#[strum(serialize = "phonypay")]
@@ -142,7 +143,7 @@ impl Connector {
pub fn supports_instant_payout(&self, payout_method: PayoutType) -> bool {
matches!(
(self, payout_method),
- (Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card)
+ (Self::Paypal, PayoutType::Wallet) | (_, PayoutType::Card) | (Self::Adyenplatform, _)
)
}
#[cfg(feature = "payouts")]
@@ -191,6 +192,7 @@ impl Connector {
| Self::DummyConnector7 => false,
Self::Aci
| Self::Adyen
+ | Self::Adyenplatform
| Self::Airwallex
| Self::Authorizedotnet
| Self::Bambora
@@ -302,11 +304,12 @@ impl AuthenticationConnectors {
#[strum(serialize_all = "snake_case")]
pub enum PayoutConnectors {
Adyen,
- Stripe,
+ Adyenplatform,
+ Cybersource,
+ Ebanx,
Payone,
Paypal,
- Ebanx,
- Cybersource,
+ Stripe,
Wise,
}
@@ -315,11 +318,12 @@ impl From<PayoutConnectors> for RoutableConnectors {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
- PayoutConnectors::Stripe => Self::Stripe,
+ PayoutConnectors::Adyenplatform => Self::Adyenplatform,
+ PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
- PayoutConnectors::Ebanx => Self::Ebanx,
- PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
}
}
@@ -330,11 +334,12 @@ impl From<PayoutConnectors> for Connector {
fn from(value: PayoutConnectors) -> Self {
match value {
PayoutConnectors::Adyen => Self::Adyen,
- PayoutConnectors::Stripe => Self::Stripe,
+ PayoutConnectors::Adyenplatform => Self::Adyenplatform,
+ PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Ebanx => Self::Ebanx,
PayoutConnectors::Payone => Self::Payone,
PayoutConnectors::Paypal => Self::Paypal,
- PayoutConnectors::Ebanx => Self::Ebanx,
- PayoutConnectors::Cybersource => Self::Cybersource,
+ PayoutConnectors::Stripe => Self::Stripe,
PayoutConnectors::Wise => Self::Wise,
}
}
@@ -346,12 +351,13 @@ impl TryFrom<Connector> for PayoutConnectors {
fn try_from(value: Connector) -> Result<Self, Self::Error> {
match value {
Connector::Adyen => Ok(Self::Adyen),
- Connector::Stripe => Ok(Self::Stripe),
- Connector::Wise => Ok(Self::Wise),
- Connector::Paypal => Ok(Self::Paypal),
- Connector::Ebanx => Ok(Self::Ebanx),
+ Connector::Adyenplatform => Ok(Self::Adyenplatform),
Connector::Cybersource => Ok(Self::Cybersource),
+ Connector::Ebanx => Ok(Self::Ebanx),
Connector::Payone => Ok(Self::Payone),
+ Connector::Paypal => Ok(Self::Paypal),
+ Connector::Stripe => Ok(Self::Stripe),
+ Connector::Wise => Ok(Self::Wise),
_ => Err(format!("Invalid payout connector {}", value)),
}
}
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 2df40bd6757..a0685180075 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -148,6 +148,10 @@ pub struct PayoutCreateRequest {
/// The business profile to use for this payment, if not passed the default business profile
/// associated with the merchant account will be used.
pub profile_id: Option<String>,
+
+ /// The send method for processing payouts
+ #[schema(value_type = PayoutSendPriority, example = "instant")]
+ pub priority: Option<api_enums::PayoutSendPriority>,
}
#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
@@ -441,6 +445,14 @@ pub struct PayoutCreateResponse {
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub created: Option<PrimitiveDateTime>,
+ /// Underlying processor's payout resource ID
+ #[schema(value_type = Option<String>, example = "S3FC9G9M2MVFDXT5")]
+ pub connector_transaction_id: Option<String>,
+
+ /// Payout's send priority (if applicable)
+ #[schema(value_type = Option<PayoutSendPriority>, example = "instant")]
+ pub priority: Option<api_enums::PayoutSendPriority>,
+
/// List of attempts
#[schema(value_type = Option<Vec<PayoutAttemptResponse>>)]
#[serde(skip_serializing_if = "Option::is_none")]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index e0ed251b7aa..edb088032cf 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -83,6 +83,7 @@ pub enum AttemptStatus {
#[strum(serialize_all = "snake_case")]
/// Connectors eligible for payments routing
pub enum RoutableConnectors {
+ Adyenplatform,
#[cfg(feature = "dummy_connector")]
#[serde(rename = "phonypay")]
#[strum(serialize = "phonypay")]
@@ -2196,6 +2197,31 @@ pub enum PayoutEntityType {
Personal,
}
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ strum::Display,
+ strum::EnumString,
+ ToSchema,
+)]
+#[router_derive::diesel_enum(storage_type = "text")]
+#[serde(rename_all = "camelCase")]
+#[strum(serialize_all = "camelCase")]
+pub enum PayoutSendPriority {
+ Instant,
+ Fast,
+ Regular,
+ Wire,
+ CrossBorder,
+ Internal,
+}
+
#[derive(
Clone,
Copy,
diff --git a/crates/connector_configs/src/common_config.rs b/crates/connector_configs/src/common_config.rs
index 950af06752c..cd1d82f4418 100644
--- a/crates/connector_configs/src/common_config.rs
+++ b/crates/connector_configs/src/common_config.rs
@@ -98,6 +98,7 @@ pub struct ApiModelMetaData {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<KlarnaEndpoint>,
+ pub source_balance_account: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -211,4 +212,5 @@ pub struct DashboardMetaData {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<KlarnaEndpoint>,
+ pub source_balance_account: Option<String>,
}
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index d7c505f7942..b386d525172 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -101,6 +101,7 @@ pub struct ConfigMetadata {
pub three_ds_requestor_id: Option<String>,
pub pull_mechanism_for_external_3ds_enabled: Option<bool>,
pub klarna_region: Option<Vec<KlarnaEndpoint>>,
+ pub source_balance_account: Option<String>,
}
#[serde_with::skip_serializing_none]
@@ -131,6 +132,8 @@ pub struct ConnectorConfig {
pub adyen: Option<ConnectorTomlConfig>,
#[cfg(feature = "payouts")]
pub adyen_payout: Option<ConnectorTomlConfig>,
+ #[cfg(feature = "payouts")]
+ pub adyenplatform_payout: Option<ConnectorTomlConfig>,
pub airwallex: Option<ConnectorTomlConfig>,
pub authorizedotnet: Option<ConnectorTomlConfig>,
pub bankofamerica: Option<ConnectorTomlConfig>,
@@ -235,12 +238,13 @@ impl ConnectorConfig {
let connector_data = Self::new()?;
match connector {
PayoutConnectors::Adyen => Ok(connector_data.adyen_payout),
- PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
- PayoutConnectors::Wise => Ok(connector_data.wise_payout),
- PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
- PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
+ PayoutConnectors::Adyenplatform => Ok(connector_data.adyenplatform_payout),
PayoutConnectors::Cybersource => Ok(connector_data.cybersource_payout),
+ PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
PayoutConnectors::Payone => Ok(connector_data.payone_payout),
+ PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
+ PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
+ PayoutConnectors::Wise => Ok(connector_data.wise_payout),
}
}
@@ -262,6 +266,7 @@ impl ConnectorConfig {
match connector {
Connector::Aci => Ok(connector_data.aci),
Connector::Adyen => Ok(connector_data.adyen),
+ Connector::Adyenplatform => Err("Use get_payout_connector_config".to_string()),
Connector::Airwallex => Ok(connector_data.airwallex),
Connector::Authorizedotnet => Ok(connector_data.authorizedotnet),
Connector::Bankofamerica => Ok(connector_data.bankofamerica),
diff --git a/crates/connector_configs/src/response_modifier.rs b/crates/connector_configs/src/response_modifier.rs
index 16a50c3dcd9..51da723d710 100644
--- a/crates/connector_configs/src/response_modifier.rs
+++ b/crates/connector_configs/src/response_modifier.rs
@@ -334,6 +334,7 @@ impl From<ApiModelMetaData> for DashboardMetaData {
pull_mechanism_for_external_3ds_enabled: api_model
.pull_mechanism_for_external_3ds_enabled,
klarna_region: api_model.klarna_region,
+ source_balance_account: api_model.source_balance_account,
}
}
}
diff --git a/crates/connector_configs/src/transformer.rs b/crates/connector_configs/src/transformer.rs
index be7f31416fe..06730f54f75 100644
--- a/crates/connector_configs/src/transformer.rs
+++ b/crates/connector_configs/src/transformer.rs
@@ -200,6 +200,7 @@ impl DashboardRequestPayload {
pull_mechanism_for_external_3ds_enabled: None,
paypal_sdk: None,
klarna_region: None,
+ source_balance_account: None,
};
let meta_data = match request.metadata {
Some(data) => data,
@@ -225,6 +226,7 @@ impl DashboardRequestPayload {
let pull_mechanism_for_external_3ds_enabled =
meta_data.pull_mechanism_for_external_3ds_enabled;
let klarna_region = meta_data.klarna_region;
+ let source_balance_account = meta_data.source_balance_account;
Some(ApiModelMetaData {
google_pay,
@@ -246,6 +248,7 @@ impl DashboardRequestPayload {
three_ds_requestor_id,
pull_mechanism_for_external_3ds_enabled,
klarna_region,
+ source_balance_account,
})
}
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index e614ce45dcd..9b4d7b921a3 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -249,6 +249,14 @@ supported_networks=["visa","masterCard","amex","discover"]
merchant_capabilities=["supports3DS"]
label="apple"
+[adyenplatform_payout]
+[[adyenplatform_payout.bank_transfer]]
+ payment_method_type = "sepa"
+[adyenplatform_payout.metadata]
+source_balance_account="Source balance account ID"
+[adyenplatform_payout.connector_auth.HeaderKey]
+api_key="Adyen platform's API Key"
+
[airwallex]
[[airwallex.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index e337dba4e71..348c463f56e 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -249,6 +249,14 @@ supported_networks=["visa","masterCard","amex","discover"]
merchant_capabilities=["supports3DS"]
label="apple"
+[adyenplatform_payout]
+[[adyenplatform_payout.bank_transfer]]
+ payment_method_type = "sepa"
+[adyenplatform_payout.metadata]
+ source_balance_account = "Source balance account ID"
+[adyenplatform_payout.connector_auth.HeaderKey]
+api_key = "Adyen platform's API Key"
+
[airwallex]
[[airwallex.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/diesel_models/src/payouts.rs b/crates/diesel_models/src/payouts.rs
index 1549610d4e4..11b2cf366e7 100644
--- a/crates/diesel_models/src/payouts.rs
+++ b/crates/diesel_models/src/payouts.rs
@@ -33,6 +33,7 @@ pub struct Payouts {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
}
#[derive(
@@ -71,6 +72,7 @@ pub struct PayoutsNew {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 2c57feb4cd0..ff5f6aef0e4 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1023,6 +1023,8 @@ diesel::table! {
profile_id -> Varchar,
status -> PayoutStatus,
confirm -> Nullable<Bool>,
+ #[max_length = 32]
+ priority -> Nullable<Varchar>,
}
}
diff --git a/crates/hyperswitch_domain_models/src/payouts/payouts.rs b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
index c9017fff5b9..c86fb7d5f52 100644
--- a/crates/hyperswitch_domain_models/src/payouts/payouts.rs
+++ b/crates/hyperswitch_domain_models/src/payouts/payouts.rs
@@ -90,6 +90,7 @@ pub struct Payouts {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -115,6 +116,7 @@ pub struct PayoutsNew {
pub profile_id: String,
pub status: storage_enums::PayoutStatus,
pub confirm: Option<bool>,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
}
impl Default for PayoutsNew {
@@ -143,6 +145,7 @@ impl Default for PayoutsNew {
profile_id: String::default(),
status: storage_enums::PayoutStatus::default(),
confirm: None,
+ priority: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index f06f336b844..f6e7e891ad8 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -636,6 +636,7 @@ pub struct PayoutsData {
pub entity_type: storage_enums::PayoutEntityType,
pub customer_details: Option<CustomerDetails>,
pub vendor_details: Option<api_models::payouts::PayoutVendorAccountDetails>,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
}
#[derive(Debug, Default, Clone)]
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index c15704afa3b..8016e1411a1 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -461,6 +461,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payouts::PayoutMethodData,
api_models::payouts::Bank,
api_models::enums::PayoutEntityType,
+ api_models::enums::PayoutSendPriority,
api_models::enums::PayoutStatus,
api_models::enums::PayoutType,
api_models::enums::TransactionType,
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 9aa879a4387..fb892f79ecf 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -535,6 +535,7 @@ pub struct Connectors {
pub aci: ConnectorParams,
#[cfg(feature = "payouts")]
pub adyen: ConnectorParamsWithSecondaryBaseUrl,
+ pub adyenplatform: ConnectorParams,
#[cfg(not(feature = "payouts"))]
pub adyen: ConnectorParams,
pub airwallex: ConnectorParams,
diff --git a/crates/router/src/connector.rs b/crates/router/src/connector.rs
index c3fb730b124..a423decdb9b 100644
--- a/crates/router/src/connector.rs
+++ b/crates/router/src/connector.rs
@@ -1,5 +1,6 @@
pub mod aci;
pub mod adyen;
+pub mod adyenplatform;
pub mod airwallex;
pub mod authorizedotnet;
pub mod bambora;
@@ -66,13 +67,13 @@ pub mod zsl;
#[cfg(feature = "dummy_connector")]
pub use self::dummyconnector::DummyConnector;
pub use self::{
- aci::Aci, adyen::Adyen, airwallex::Airwallex, authorizedotnet::Authorizedotnet,
- bambora::Bambora, bankofamerica::Bankofamerica, billwerk::Billwerk, bitpay::Bitpay,
- bluesnap::Bluesnap, boku::Boku, braintree::Braintree, cashtocode::Cashtocode,
- checkout::Checkout, coinbase::Coinbase, cryptopay::Cryptopay, cybersource::Cybersource,
- dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte, globalpay::Globalpay,
- globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments, helcim::Helcim,
- iatapay::Iatapay, klarna::Klarna, mifinity::Mifinity, mollie::Mollie,
+ aci::Aci, adyen::Adyen, adyenplatform::Adyenplatform, airwallex::Airwallex,
+ authorizedotnet::Authorizedotnet, bambora::Bambora, bankofamerica::Bankofamerica,
+ billwerk::Billwerk, bitpay::Bitpay, bluesnap::Bluesnap, boku::Boku, braintree::Braintree,
+ cashtocode::Cashtocode, checkout::Checkout, coinbase::Coinbase, cryptopay::Cryptopay,
+ cybersource::Cybersource, dlocal::Dlocal, ebanx::Ebanx, fiserv::Fiserv, forte::Forte,
+ globalpay::Globalpay, globepay::Globepay, gocardless::Gocardless, gpayments::Gpayments,
+ helcim::Helcim, iatapay::Iatapay, 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, powertranz::Powertranz,
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index c8b8ced7bd1..91969b00c9b 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -1726,7 +1726,7 @@ fn get_amount_data(item: &AdyenRouterData<&types::PaymentsAuthorizeRouterData>)
}
}
-fn get_address_info(
+pub fn get_address_info(
address: Option<&payments::Address>,
) -> Option<Result<Address, error_stack::Report<errors::ConnectorError>>> {
address.and_then(|add| {
diff --git a/crates/router/src/connector/adyenplatform.rs b/crates/router/src/connector/adyenplatform.rs
new file mode 100644
index 00000000000..e085b0bbc93
--- /dev/null
+++ b/crates/router/src/connector/adyenplatform.rs
@@ -0,0 +1,294 @@
+pub mod transformers;
+use std::fmt::Debug;
+
+#[cfg(feature = "payouts")]
+use common_utils::request::RequestContent;
+use error_stack::{report, ResultExt};
+#[cfg(feature = "payouts")]
+use router_env::{instrument, tracing};
+
+use self::transformers as adyenplatform;
+use crate::{
+ configs::settings,
+ core::errors::{self, CustomResult},
+ headers,
+ services::{
+ self,
+ request::{self, Mask},
+ ConnectorValidation,
+ },
+ types::{
+ self,
+ api::{self, ConnectorCommon},
+ },
+};
+#[cfg(feature = "payouts")]
+use crate::{events::connector_api_logs::ConnectorEvent, utils::BytesExt};
+
+#[derive(Debug, Clone)]
+pub struct Adyenplatform;
+
+impl ConnectorCommon for Adyenplatform {
+ fn id(&self) -> &'static str {
+ "adyenplatform"
+ }
+
+ fn get_auth_header(
+ &self,
+ auth_type: &types::ConnectorAuthType,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let auth = adyenplatform::AdyenplatformAuthType::try_from(auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ Ok(vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.into_masked(),
+ )])
+ }
+
+ fn base_url<'a>(&self, connectors: &'a settings::Connectors) -> &'a str {
+ connectors.adyenplatform.base_url.as_ref()
+ }
+
+ #[cfg(feature = "payouts")]
+ fn build_error_response(
+ &self,
+ res: types::Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ let response: adyenplatform::AdyenTransferErrorResponse = res
+ .response
+ .parse_struct("AdyenTransferErrorResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ Ok(types::ErrorResponse {
+ status_code: res.status_code,
+ code: response.error_code,
+ message: response.title,
+ reason: response.detail,
+ attempt_status: None,
+ connector_transaction_id: None,
+ })
+ }
+}
+
+impl api::Payment for Adyenplatform {}
+impl api::PaymentAuthorize for Adyenplatform {}
+impl api::PaymentSync for Adyenplatform {}
+impl api::PaymentVoid for Adyenplatform {}
+impl api::PaymentCapture for Adyenplatform {}
+impl api::MandateSetup for Adyenplatform {}
+impl api::ConnectorAccessToken for Adyenplatform {}
+impl api::PaymentToken for Adyenplatform {}
+impl ConnectorValidation for Adyenplatform {}
+
+impl
+ services::ConnectorIntegration<
+ api::PaymentMethodToken,
+ types::PaymentMethodTokenizationData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<
+ api::AccessTokenAuth,
+ types::AccessTokenRequestData,
+ types::AccessToken,
+ > for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<
+ api::SetupMandate,
+ types::SetupMandateRequestData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl api::PaymentSession for Adyenplatform {}
+
+impl
+ services::ConnectorIntegration<
+ api::Session,
+ types::PaymentsSessionData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<
+ api::Capture,
+ types::PaymentsCaptureData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
+ for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<
+ api::Authorize,
+ types::PaymentsAuthorizeData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl
+ services::ConnectorIntegration<
+ api::Void,
+ types::PaymentsCancelData,
+ types::PaymentsResponseData,
+ > for Adyenplatform
+{
+}
+
+impl api::Payouts for Adyenplatform {}
+#[cfg(feature = "payouts")]
+impl api::PayoutFulfill for Adyenplatform {}
+
+#[cfg(feature = "payouts")]
+impl services::ConnectorIntegration<api::PoFulfill, types::PayoutsData, types::PayoutsResponseData>
+ for Adyenplatform
+{
+ fn get_url(
+ &self,
+ _req: &types::PayoutsRouterData<api::PoFulfill>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!(
+ "{}btl/v4/transfers",
+ connectors.adyenplatform.base_url,
+ ))
+ }
+
+ fn get_headers(
+ &self,
+ req: &types::PayoutsRouterData<api::PoFulfill>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ let mut header = vec![(
+ headers::CONTENT_TYPE.to_string(),
+ types::PayoutFulfillType::get_content_type(self)
+ .to_string()
+ .into(),
+ )];
+ let auth = adyenplatform::AdyenplatformAuthType::try_from(&req.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let mut api_key = vec![(
+ headers::AUTHORIZATION.to_string(),
+ auth.api_key.into_masked(),
+ )];
+ header.append(&mut api_key);
+ Ok(header)
+ }
+
+ fn get_request_body(
+ &self,
+ req: &types::PayoutsRouterData<api::PoFulfill>,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = adyenplatform::AdyenTransferRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn build_request(
+ &self,
+ req: &types::PayoutsRouterData<api::PoFulfill>,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ let request = services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PayoutFulfillType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::PayoutFulfillType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PayoutFulfillType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build();
+
+ Ok(Some(request))
+ }
+
+ #[instrument(skip_all)]
+ fn handle_response(
+ &self,
+ data: &types::PayoutsRouterData<api::PoFulfill>,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: types::Response,
+ ) -> CustomResult<types::PayoutsRouterData<api::PoFulfill>, errors::ConnectorError> {
+ let response: adyenplatform::AdyenTransferResponse = res
+ .response
+ .parse_struct("AdyenTransferResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: types::Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<types::ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+
+impl api::Refund for Adyenplatform {}
+impl api::RefundExecute for Adyenplatform {}
+impl api::RefundSync for Adyenplatform {}
+
+impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData>
+ for Adyenplatform
+{
+}
+
+impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponseData>
+ for Adyenplatform
+{
+}
+
+#[async_trait::async_trait]
+impl api::IncomingWebhook for Adyenplatform {
+ fn get_webhook_object_reference_id(
+ &self,
+ _request: &api::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> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+
+ fn get_webhook_resource_object(
+ &self,
+ _request: &api::IncomingWebhookRequestDetails<'_>,
+ ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
+ Err(report!(errors::ConnectorError::WebhooksNotImplemented))
+ }
+}
diff --git a/crates/router/src/connector/adyenplatform/transformers.rs b/crates/router/src/connector/adyenplatform/transformers.rs
new file mode 100644
index 00000000000..4b74de3f7ff
--- /dev/null
+++ b/crates/router/src/connector/adyenplatform/transformers.rs
@@ -0,0 +1,29 @@
+use error_stack::Report;
+use masking::Secret;
+
+#[cfg(feature = "payouts")]
+pub mod payouts;
+#[cfg(feature = "payouts")]
+pub use payouts::*;
+
+use crate::{core::errors, types};
+
+// Error signature
+type Error = Report<errors::ConnectorError>;
+
+// Auth Struct
+pub struct AdyenplatformAuthType {
+ pub(super) api_key: Secret<String>,
+}
+
+impl TryFrom<&types::ConnectorAuthType> for AdyenplatformAuthType {
+ type Error = Error;
+ fn try_from(auth_type: &types::ConnectorAuthType) -> Result<Self, Self::Error> {
+ match auth_type {
+ types::ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
+ api_key: api_key.to_owned(),
+ }),
+ _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
+ }
+ }
+}
diff --git a/crates/router/src/connector/adyenplatform/transformers/payouts.rs b/crates/router/src/connector/adyenplatform/transformers/payouts.rs
new file mode 100644
index 00000000000..e927b0d96b6
--- /dev/null
+++ b/crates/router/src/connector/adyenplatform/transformers/payouts.rs
@@ -0,0 +1,338 @@
+use common_utils::pii;
+use error_stack::{report, ResultExt};
+use masking::Secret;
+use serde::{Deserialize, Serialize};
+
+use super::Error;
+use crate::{
+ connector::{
+ adyen::transformers as adyen,
+ utils::{self, RouterData},
+ },
+ core::errors,
+ types::{self, api::payouts, storage::enums},
+};
+
+#[derive(Debug, Default, Serialize, Deserialize)]
+pub struct AdyenPlatformConnectorMetadataObject {
+ source_balance_account: Option<Secret<String>>,
+}
+
+impl TryFrom<&Option<pii::SecretSerdeValue>> for AdyenPlatformConnectorMetadataObject {
+ type Error = Error;
+ fn try_from(meta_data: &Option<pii::SecretSerdeValue>) -> Result<Self, Self::Error> {
+ let metadata: Self = utils::to_connector_meta_from_secret::<Self>(meta_data.clone())
+ .change_context(errors::ConnectorError::InvalidConnectorConfig {
+ config: "metadata",
+ })?;
+ Ok(metadata)
+ }
+}
+
+#[serde_with::skip_serializing_none]
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenTransferRequest {
+ amount: adyen::Amount,
+ balance_account_id: Secret<String>,
+ category: AdyenPayoutMethod,
+ counterparty: AdyenPayoutMethodDetails,
+ priority: AdyenPayoutPriority,
+ reference: String,
+ reference_for_beneficiary: String,
+ description: Option<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum AdyenPayoutMethod {
+ Bank,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenPayoutMethodDetails {
+ bank_account: AdyenBankAccountDetails,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenBankAccountDetails {
+ account_holder: AdyenBankAccountHolder,
+ account_identification: AdyenBankAccountIdentification,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenBankAccountHolder {
+ address: Option<adyen::Address>,
+ full_name: Secret<String>,
+ #[serde(rename = "reference")]
+ customer_id: Option<String>,
+ #[serde(rename = "type")]
+ entity_type: Option<EntityType>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AdyenBankAccountIdentification {
+ #[serde(rename = "type")]
+ bank_type: String,
+ #[serde(flatten)]
+ account_details: AdyenBankAccountIdentificationDetails,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum AdyenBankAccountIdentificationDetails {
+ Sepa(SepaDetails),
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct SepaDetails {
+ iban: Secret<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum AdyenPayoutPriority {
+ Instant,
+ Fast,
+ Regular,
+ Wire,
+ CrossBorder,
+ Internal,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum EntityType {
+ Individual,
+ Organization,
+ Unknown,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenTransferResponse {
+ id: String,
+ account_holder: AdyenPlatformAccountHolder,
+ amount: adyen::Amount,
+ balance_account: AdyenBalanceAccount,
+ category: AdyenPayoutMethod,
+ category_data: AdyenCategoryData,
+ direction: AdyenTransactionDirection,
+ reference: String,
+ reference_for_beneficiary: String,
+ status: AdyenTransferStatus,
+ #[serde(rename = "type")]
+ transaction_type: AdyenTransactionType,
+ reason: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AdyenPlatformAccountHolder {
+ description: String,
+ id: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AdyenCategoryData {
+ priority: AdyenPayoutPriority,
+ #[serde(rename = "type")]
+ category: AdyenPayoutMethod,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct AdyenBalanceAccount {
+ description: String,
+ id: String,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum AdyenTransactionDirection {
+ Incoming,
+ Outgoing,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum AdyenTransferStatus {
+ Authorised,
+ Refused,
+ Error,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum AdyenTransactionType {
+ BankTransfer,
+ InternalTransfer,
+ Payment,
+ Refund,
+}
+
+impl<F> TryFrom<&types::PayoutsRouterData<F>> for AdyenTransferRequest {
+ type Error = Error;
+ fn try_from(item: &types::PayoutsRouterData<F>) -> Result<Self, Self::Error> {
+ let request = item.request.to_owned();
+ match item.get_payout_method_data()? {
+ payouts::PayoutMethodData::Card(_) | payouts::PayoutMethodData::Wallet(_) => {
+ Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Adyenplatform"),
+ ))?
+ }
+
+ payouts::PayoutMethodData::Bank(bd) => {
+ let bank_details = match bd {
+ payouts::BankPayout::Sepa(b) => AdyenBankAccountIdentification {
+ bank_type: "iban".to_string(),
+ account_details: AdyenBankAccountIdentificationDetails::Sepa(SepaDetails {
+ iban: b.iban,
+ }),
+ },
+ payouts::BankPayout::Ach(..) => Err(errors::ConnectorError::NotSupported {
+ message: "Bank transfer via ACH is not supported".to_string(),
+ connector: "Adyenplatform",
+ })?,
+ payouts::BankPayout::Bacs(..) => Err(errors::ConnectorError::NotSupported {
+ message: "Bank transfer via Bacs is not supported".to_string(),
+ connector: "Adyenplatform",
+ })?,
+ payouts::BankPayout::Pix(..) => Err(errors::ConnectorError::NotSupported {
+ message: "Bank transfer via Pix is not supported".to_string(),
+ connector: "Adyenplatform",
+ })?,
+ };
+ let billing_address = item.get_optional_billing();
+ let address = adyen::get_address_info(billing_address).transpose()?;
+ let account_holder = AdyenBankAccountHolder {
+ address,
+ full_name: item.get_billing_full_name()?,
+ customer_id: Some(item.get_customer_id()?.get_string_repr().to_owned()),
+ entity_type: Some(EntityType::from(request.entity_type)),
+ };
+ let counterparty = AdyenPayoutMethodDetails {
+ bank_account: AdyenBankAccountDetails {
+ account_holder,
+ account_identification: bank_details,
+ },
+ };
+
+ let adyen_connector_metadata_object =
+ AdyenPlatformConnectorMetadataObject::try_from(&item.connector_meta_data)?;
+ let balance_account_id = adyen_connector_metadata_object
+ .source_balance_account
+ .ok_or(errors::ConnectorError::InvalidConnectorConfig {
+ config: "metadata.source_balance_account",
+ })?;
+ let priority =
+ request
+ .priority
+ .ok_or(errors::ConnectorError::MissingRequiredField {
+ field_name: "priority",
+ })?;
+
+ Ok(Self {
+ amount: adyen::Amount {
+ value: request.amount,
+ currency: request.destination_currency,
+ },
+ balance_account_id,
+ category: AdyenPayoutMethod::try_from(request.payout_type)?,
+ counterparty,
+ priority: AdyenPayoutPriority::from(priority),
+ reference: request.payout_id.clone(),
+ reference_for_beneficiary: request.payout_id,
+ description: item.description.clone(),
+ })
+ }
+ }
+ }
+}
+
+impl<F> TryFrom<types::PayoutsResponseRouterData<F, AdyenTransferResponse>>
+ for types::PayoutsRouterData<F>
+{
+ type Error = Error;
+ fn try_from(
+ item: types::PayoutsResponseRouterData<F, AdyenTransferResponse>,
+ ) -> Result<Self, Self::Error> {
+ let response: AdyenTransferResponse = item.response;
+
+ Ok(Self {
+ response: Ok(types::PayoutsResponseData {
+ status: Some(enums::PayoutStatus::from(response.status)),
+ connector_payout_id: Some(response.id),
+ payout_eligible: None,
+ should_add_next_step_to_process_tracker: false,
+ }),
+ ..item.data
+ })
+ }
+}
+
+impl From<AdyenTransferStatus> for enums::PayoutStatus {
+ fn from(adyen_status: AdyenTransferStatus) -> Self {
+ match adyen_status {
+ AdyenTransferStatus::Authorised => Self::Success,
+ AdyenTransferStatus::Refused => Self::Ineligible,
+ AdyenTransferStatus::Error => Self::Failed,
+ }
+ }
+}
+
+impl From<enums::PayoutEntityType> for EntityType {
+ fn from(entity: enums::PayoutEntityType) -> Self {
+ match entity {
+ enums::PayoutEntityType::Individual
+ | enums::PayoutEntityType::Personal
+ | enums::PayoutEntityType::NaturalPerson => Self::Individual,
+
+ enums::PayoutEntityType::Company | enums::PayoutEntityType::Business => {
+ Self::Organization
+ }
+ _ => Self::Unknown,
+ }
+ }
+}
+
+impl From<enums::PayoutSendPriority> for AdyenPayoutPriority {
+ fn from(entity: enums::PayoutSendPriority) -> Self {
+ match entity {
+ enums::PayoutSendPriority::Instant => Self::Instant,
+ enums::PayoutSendPriority::Fast => Self::Fast,
+ enums::PayoutSendPriority::Regular => Self::Regular,
+ enums::PayoutSendPriority::Wire => Self::Wire,
+ enums::PayoutSendPriority::CrossBorder => Self::CrossBorder,
+ enums::PayoutSendPriority::Internal => Self::Internal,
+ }
+ }
+}
+
+impl TryFrom<enums::PayoutType> for AdyenPayoutMethod {
+ type Error = Error;
+ fn try_from(payout_type: enums::PayoutType) -> Result<Self, Self::Error> {
+ match payout_type {
+ enums::PayoutType::Bank => Ok(Self::Bank),
+ enums::PayoutType::Card | enums::PayoutType::Wallet => {
+ Err(report!(errors::ConnectorError::NotSupported {
+ message: "Card or wallet payouts".to_string(),
+ connector: "Adyenplatform",
+ }))
+ }
+ }
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AdyenTransferErrorResponse {
+ pub error_code: String,
+ #[serde(rename = "type")]
+ pub error_type: String,
+ pub status: u16,
+ pub title: String,
+ pub detail: Option<String>,
+ pub request_id: Option<String>,
+}
diff --git a/crates/router/src/connector/stripe/transformers/connect.rs b/crates/router/src/connector/stripe/transformers/connect.rs
index 5145421675f..7126404b6f4 100644
--- a/crates/router/src/connector/stripe/transformers/connect.rs
+++ b/crates/router/src/connector/stripe/transformers/connect.rs
@@ -295,12 +295,10 @@ impl<F> TryFrom<types::PayoutsResponseRouterData<F, StripeConnectReversalRespons
fn try_from(
item: types::PayoutsResponseRouterData<F, StripeConnectReversalResponse>,
) -> Result<Self, Self::Error> {
- let response: StripeConnectReversalResponse = item.response;
-
Ok(Self {
response: Ok(types::PayoutsResponseData {
status: Some(enums::PayoutStatus::Cancelled),
- connector_payout_id: Some(response.id),
+ connector_payout_id: item.data.request.connector_payout_id.clone(),
payout_eligible: None,
should_add_next_step_to_process_tracker: false,
}),
@@ -370,7 +368,6 @@ impl<F> TryFrom<types::PayoutsResponseRouterData<F, StripeConnectRecipientCreate
item: types::PayoutsResponseRouterData<F, StripeConnectRecipientCreateResponse>,
) -> Result<Self, Self::Error> {
let response: StripeConnectRecipientCreateResponse = item.response;
-
Ok(Self {
response: Ok(types::PayoutsResponseData {
status: Some(enums::PayoutStatus::RequiresVendorAccountCreation),
@@ -452,12 +449,10 @@ impl<F> TryFrom<types::PayoutsResponseRouterData<F, StripeConnectRecipientAccoun
fn try_from(
item: types::PayoutsResponseRouterData<F, StripeConnectRecipientAccountCreateResponse>,
) -> Result<Self, Self::Error> {
- let response: StripeConnectRecipientAccountCreateResponse = item.response;
-
Ok(Self {
response: Ok(types::PayoutsResponseData {
status: Some(enums::PayoutStatus::RequiresCreation),
- connector_payout_id: Some(response.id),
+ connector_payout_id: item.data.request.connector_payout_id.clone(),
payout_eligible: None,
should_add_next_step_to_process_tracker: false,
}),
diff --git a/crates/router/src/connector/wise/transformers.rs b/crates/router/src/connector/wise/transformers.rs
index c480a0bc84c..589647c6bf9 100644
--- a/crates/router/src/connector/wise/transformers.rs
+++ b/crates/router/src/connector/wise/transformers.rs
@@ -557,7 +557,13 @@ impl<F> TryFrom<types::PayoutsResponseRouterData<F, WiseFulfillResponse>>
Ok(Self {
response: Ok(types::PayoutsResponseData {
status: Some(storage_enums::PayoutStatus::from(response.status)),
- connector_payout_id: None,
+ connector_payout_id: Some(
+ item.data
+ .request
+ .connector_payout_id
+ .clone()
+ .ok_or(errors::ConnectorError::MissingConnectorTransactionID)?,
+ ),
payout_eligible: None,
should_add_next_step_to_process_tracker: false,
}),
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 6b582c2c957..0ba807fd68f 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1819,6 +1819,10 @@ pub(crate) fn validate_auth_and_metadata_type(
use crate::connector::*;
match connector_name {
+ api_enums::Connector::Adyenplatform => {
+ adyenplatform::transformers::AdyenplatformAuthType::try_from(val)?;
+ Ok(())
+ }
// api_enums::Connector::Mifinity => {
// mifinity::transformers::MifinityAuthType::try_from(val)?;
// Ok(())
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index 4ca15b7a1fe..64254ae14b1 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -156,6 +156,7 @@ impl<const T: u8>
}
default_imp_for_complete_authorize!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Billwerk,
@@ -229,6 +230,7 @@ impl<const T: u8>
{
}
default_imp_for_webhook_source_verification!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -319,6 +321,7 @@ impl<const T: u8>
}
default_imp_for_create_customer!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -409,6 +412,7 @@ impl<const T: u8> services::ConnectorRedirectResponse for connector::DummyConnec
}
default_imp_for_connector_redirect_response!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Bitpay,
@@ -468,6 +472,7 @@ macro_rules! default_imp_for_connector_request_id {
impl<const T: u8> api::ConnectorTransactionId for connector::DummyConnector<T> {}
default_imp_for_connector_request_id!(
+ connector::Adyenplatform,
connector::Zsl,
connector::Aci,
connector::Adyen,
@@ -560,6 +565,7 @@ impl<const T: u8>
}
default_imp_for_accept_dispute!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -672,6 +678,7 @@ impl<const T: u8>
}
default_imp_for_file_upload!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -761,6 +768,7 @@ impl<const T: u8>
}
default_imp_for_submit_evidence!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -850,6 +858,7 @@ impl<const T: u8>
}
default_imp_for_defend_dispute!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -940,6 +949,7 @@ impl<const T: u8>
}
default_imp_for_pre_processing_steps!(
+ connector::Adyenplatform,
connector::Aci,
connector::Authorizedotnet,
connector::Bambora,
@@ -1090,6 +1100,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_create!(
+ connector::Adyenplatform,
connector::Aci,
connector::Airwallex,
connector::Authorizedotnet,
@@ -1180,6 +1191,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_eligibility!(
+ connector::Adyenplatform,
connector::Aci,
connector::Airwallex,
connector::Authorizedotnet,
@@ -1354,6 +1366,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_cancel!(
+ connector::Adyenplatform,
connector::Aci,
connector::Airwallex,
connector::Authorizedotnet,
@@ -1442,6 +1455,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_quote!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1532,6 +1546,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_recipient!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1624,6 +1639,7 @@ impl<const T: u8>
#[cfg(feature = "payouts")]
default_imp_for_payouts_recipient_account!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1714,6 +1730,7 @@ impl<const T: u8>
}
default_imp_for_approve!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1805,6 +1822,7 @@ impl<const T: u8>
}
default_imp_for_reject!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1880,6 +1898,7 @@ macro_rules! default_imp_for_fraud_check {
impl<const T: u8> api::FraudCheck for connector::DummyConnector<T> {}
default_imp_for_fraud_check!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -1971,6 +1990,7 @@ impl<const T: u8>
#[cfg(feature = "frm")]
default_imp_for_frm_sale!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2062,6 +2082,7 @@ impl<const T: u8>
#[cfg(feature = "frm")]
default_imp_for_frm_checkout!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2153,6 +2174,7 @@ impl<const T: u8>
#[cfg(feature = "frm")]
default_imp_for_frm_transaction!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2244,6 +2266,7 @@ impl<const T: u8>
#[cfg(feature = "frm")]
default_imp_for_frm_fulfillment!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2335,6 +2358,7 @@ impl<const T: u8>
#[cfg(feature = "frm")]
default_imp_for_frm_record_return!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2424,6 +2448,7 @@ impl<const T: u8>
}
default_imp_for_incremental_authorization!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2512,6 +2537,7 @@ impl<const T: u8>
{
}
default_imp_for_revoking_mandates!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2660,6 +2686,7 @@ impl<const T: u8>
{
}
default_imp_for_connector_authentication!(
+ connector::Adyenplatform,
connector::Aci,
connector::Adyen,
connector::Airwallex,
@@ -2747,6 +2774,7 @@ impl<const T: u8>
default_imp_for_authorize_session_token!(
connector::Aci,
connector::Adyen,
+ connector::Adyenplatform,
connector::Airwallex,
connector::Authorizedotnet,
connector::Bambora,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 733002fe7cf..fa1d68ca235 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -990,7 +990,6 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>
unified_code: None,
unified_message: None,
};
- let attempts = vec![attempt];
Self {
payout_id: payout.payout_id,
merchant_id: payout.merchant_id,
@@ -1016,7 +1015,9 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>
error_code: payout_attempt.error_code,
profile_id: payout.profile_id,
created: Some(payout.created_at),
- attempts: Some(attempts),
+ connector_transaction_id: attempt.connector_transaction_id.clone(),
+ priority: payout.priority,
+ attempts: Some(vec![attempt]),
billing: None,
client_secret: None,
}
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index eb1f54ab6cc..4b60db6c79b 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -502,7 +502,6 @@ pub async fn payouts_cancel_core(
.await?;
let payout_attempt = payout_data.payout_attempt.to_owned();
- let connector_payout_id = payout_attempt.connector_payout_id.to_owned();
let status = payout_attempt.status;
// Verify if cancellation can be triggered
@@ -518,7 +517,7 @@ pub async fn payouts_cancel_core(
} else if helpers::is_eligible_for_local_payout_cancellation(status) {
let status = storage_enums::PayoutStatus::Cancelled;
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: connector_payout_id.to_owned(),
+ connector_payout_id: payout_attempt.connector_payout_id.to_owned(),
status,
error_message: Some("Cancelled by user".to_string()),
error_code: None,
@@ -1084,7 +1083,10 @@ pub async fn create_recipient(
.status
.unwrap_or(api_enums::PayoutStatus::RequiresVendorAccountCreation);
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: recipient_create_data.connector_payout_id,
+ connector_payout_id: payout_data
+ .payout_attempt
+ .connector_payout_id
+ .to_owned(),
status,
error_code: None,
error_message: None,
@@ -1248,7 +1250,7 @@ pub async fn check_payout_eligibility(
Err(err) => {
let status = storage_enums::PayoutStatus::Failed;
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.clone(),
+ connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
status,
error_code: Some(err.code),
error_message: Some(err.message),
@@ -1440,7 +1442,7 @@ pub async fn create_payout(
Err(err) => {
let status = storage_enums::PayoutStatus::Failed;
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.clone(),
+ connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
status,
error_code: Some(err.code),
error_message: Some(err.message),
@@ -1563,7 +1565,7 @@ pub async fn create_recipient_disburse_account(
}
Err(err) => {
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.clone(),
+ connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
status: storage_enums::PayoutStatus::Failed,
error_code: Some(err.code),
error_message: Some(err.message),
@@ -1659,7 +1661,7 @@ pub async fn cancel_payout(
Err(err) => {
let status = storage_enums::PayoutStatus::Failed;
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.clone(),
+ connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
status,
error_code: Some(err.code),
error_message: Some(err.message),
@@ -1762,7 +1764,7 @@ pub async fn fulfill_payout(
.await?;
}
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
+ connector_payout_id: payout_response_data.connector_payout_id,
status,
error_code: None,
error_message: None,
@@ -1799,7 +1801,7 @@ pub async fn fulfill_payout(
Err(err) => {
let status = storage_enums::PayoutStatus::Failed;
let updated_payout_attempt = storage::PayoutAttemptUpdate::StatusUpdate {
- connector_payout_id: payout_data.payout_attempt.connector_payout_id.clone(),
+ connector_payout_id: payout_data.payout_attempt.connector_payout_id.to_owned(),
status,
error_code: Some(err.code),
error_message: Some(err.message),
@@ -1896,6 +1898,8 @@ pub async fn response_handler(
error_code: payout_attempt.error_code,
profile_id: payout_attempt.profile_id,
created: Some(payouts.created_at),
+ connector_transaction_id: payout_attempt.connector_payout_id,
+ priority: payouts.priority,
attempts: None,
};
Ok(services::ApplicationResponse::Json(response))
@@ -1992,6 +1996,7 @@ pub async fn payout_create_db_entries(
attempt_count: 1,
metadata: req.metadata.clone(),
confirm: req.confirm,
+ priority: req.priority,
..Default::default()
};
let payouts = db
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 4791ea823da..1071e5c98d4 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -151,7 +151,7 @@ pub async fn construct_payout_router_data<'a, F>(
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_account.merchant_id.to_owned(),
- customer_id: None,
+ customer_id: customer_details.to_owned().map(|c| c.customer_id),
connector_customer: connector_customer_id,
connector: connector_name.to_string(),
payment_id: "".to_string(),
@@ -175,6 +175,7 @@ pub async fn construct_payout_router_data<'a, F>(
entity_type: payouts.entity_type.to_owned(),
payout_type: payouts.payout_type,
vendor_details,
+ priority: payouts.priority,
customer_details: customer_details
.to_owned()
.map(|c| payments::CustomerDetails {
diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rs
index 517ae3de0ea..9f2d388729a 100644
--- a/crates/router/src/services/kafka/payout.rs
+++ b/crates/router/src/services/kafka/payout.rs
@@ -28,6 +28,7 @@ pub struct KafkaPayout<'a> {
pub last_modified_at: OffsetDateTime,
pub attempt_count: i16,
pub status: storage_enums::PayoutStatus,
+ pub priority: Option<storage_enums::PayoutSendPriority>,
pub connector: Option<&'a String>,
pub connector_payout_id: Option<&'a String>,
@@ -63,6 +64,7 @@ impl<'a> KafkaPayout<'a> {
last_modified_at: payouts.last_modified_at.assume_utc(),
attempt_count: payouts.attempt_count,
status: payouts.status,
+ priority: payouts.priority,
connector: payout_attempt.connector.as_ref(),
connector_payout_id: payout_attempt.connector_payout_id.as_ref(),
is_eligible: payout_attempt.is_eligible,
diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs
index c427f60cd1f..5129ca57304 100644
--- a/crates/router/src/types/api.rs
+++ b/crates/router/src/types/api.rs
@@ -316,6 +316,7 @@ impl ConnectorData {
Ok(name) => match name {
enums::Connector::Aci => Ok(Box::new(&connector::Aci)),
enums::Connector::Adyen => Ok(Box::new(&connector::Adyen)),
+ enums::Connector::Adyenplatform => Ok(Box::new(&connector::Adyenplatform)),
enums::Connector::Airwallex => Ok(Box::new(&connector::Airwallex)),
enums::Connector::Authorizedotnet => Ok(Box::new(&connector::Authorizedotnet)),
enums::Connector::Bambora => Ok(Box::new(&connector::Bambora)),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index a073d523754..6646684a2d1 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -209,6 +209,7 @@ impl ForeignTryFrom<api_enums::Connector> for common_enums::RoutableConnectors {
Ok(match from {
api_enums::Connector::Aci => Self::Aci,
api_enums::Connector::Adyen => Self::Adyen,
+ api_enums::Connector::Adyenplatform => Self::Adyenplatform,
api_enums::Connector::Airwallex => Self::Airwallex,
api_enums::Connector::Authorizedotnet => Self::Authorizedotnet,
api_enums::Connector::Bambora => Self::Bambora,
diff --git a/crates/router/tests/connectors/adyenplatform.rs b/crates/router/tests/connectors/adyenplatform.rs
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/crates/router/tests/connectors/adyenplatform.rs
@@ -0,0 +1 @@
+
diff --git a/crates/router/tests/connectors/main.rs b/crates/router/tests/connectors/main.rs
index a84f3f76c71..892e1370ccc 100644
--- a/crates/router/tests/connectors/main.rs
+++ b/crates/router/tests/connectors/main.rs
@@ -8,6 +8,7 @@ use test_utils::connector_auth;
mod aci;
mod adyen;
+mod adyenplatform;
mod airwallex;
mod authorizedotnet;
mod bambora;
diff --git a/crates/router/tests/connectors/sample_auth.toml b/crates/router/tests/connectors/sample_auth.toml
index fdb4c208635..2d7b1974996 100644
--- a/crates/router/tests/connectors/sample_auth.toml
+++ b/crates/router/tests/connectors/sample_auth.toml
@@ -230,3 +230,6 @@ api_key="API Key"
[gpayments]
api_key="API Key"
+
+[adyenplatform]
+api_key="API Key"
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 134777dc093..a1f353f4bc1 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -501,6 +501,7 @@ pub trait ConnectorActions: Connector {
phone_country_code: Some("+31".to_string()),
}),
vendor_details: None,
+ priority: None,
},
payment_info,
)
diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs
index 92835dee59c..c63254d72fd 100644
--- a/crates/storage_impl/src/payouts/payouts.rs
+++ b/crates/storage_impl/src/payouts/payouts.rs
@@ -89,6 +89,7 @@ impl<T: DatabaseStore> PayoutsInterface for KVRouterStore<T> {
status: new.status,
attempt_count: new.attempt_count,
confirm: new.confirm,
+ priority: new.priority,
};
let redis_entry = kv::TypedSql {
@@ -688,6 +689,7 @@ impl DataModelExt for Payouts {
status: self.status,
attempt_count: self.attempt_count,
confirm: self.confirm,
+ priority: self.priority,
}
}
@@ -714,6 +716,7 @@ impl DataModelExt for Payouts {
status: storage_model.status,
attempt_count: storage_model.attempt_count,
confirm: storage_model.confirm,
+ priority: storage_model.priority,
}
}
}
@@ -743,6 +746,7 @@ impl DataModelExt for PayoutsNew {
status: self.status,
attempt_count: self.attempt_count,
confirm: self.confirm,
+ priority: self.priority,
}
}
@@ -769,6 +773,7 @@ impl DataModelExt for PayoutsNew {
status: storage_model.status,
attempt_count: storage_model.attempt_count,
confirm: storage_model.confirm,
+ priority: storage_model.priority,
}
}
}
diff --git a/crates/test_utils/src/connector_auth.rs b/crates/test_utils/src/connector_auth.rs
index 7f536916d3a..3ba321c174e 100644
--- a/crates/test_utils/src/connector_auth.rs
+++ b/crates/test_utils/src/connector_auth.rs
@@ -9,6 +9,8 @@ pub struct ConnectorAuthentication {
#[cfg(not(feature = "payouts"))]
pub adyen: Option<BodyKey>,
#[cfg(feature = "payouts")]
+ pub adyenplatform: Option<HeaderKey>,
+ #[cfg(feature = "payouts")]
pub adyen: Option<SignatureKey>,
#[cfg(not(feature = "payouts"))]
pub adyen_uk: Option<BodyKey>,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index e46a710054e..d008ff3231c 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -71,6 +71,7 @@ hash_key = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
[connectors]
aci.base_url = "https://eu-test.oppwa.com/"
adyen.base_url = "https://checkout-test.adyen.com/"
+adyenplatform.base_url = "https://balanceplatform-api-test.adyen.com/"
adyen.secondary_base_url = "https://pal-test.adyen.com/"
airwallex.base_url = "https://api-demo.airwallex.com/"
applepay.base_url = "https://apple-pay-gateway.apple.com/"
@@ -153,6 +154,7 @@ rewards = ["cashtocode", "zen"]
cards = [
"aci",
"adyen",
+ "adyenplatform",
"airwallex",
"authorizedotnet",
"bambora",
diff --git a/migrations/2024-06-04-095858_add_priority_to_payouts/down.sql b/migrations/2024-06-04-095858_add_priority_to_payouts/down.sql
new file mode 100644
index 00000000000..534969683bc
--- /dev/null
+++ b/migrations/2024-06-04-095858_add_priority_to_payouts/down.sql
@@ -0,0 +1 @@
+ALTER TABLE payouts DROP COLUMN IF EXISTS priority;
\ No newline at end of file
diff --git a/migrations/2024-06-04-095858_add_priority_to_payouts/up.sql b/migrations/2024-06-04-095858_add_priority_to_payouts/up.sql
new file mode 100644
index 00000000000..4b2a8843ff8
--- /dev/null
+++ b/migrations/2024-06-04-095858_add_priority_to_payouts/up.sql
@@ -0,0 +1 @@
+ALTER TABLE payouts ADD COLUMN IF NOT EXISTS priority VARCHAR(32);
\ No newline at end of file
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index cffea67133b..76cbda10a18 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -7463,6 +7463,7 @@
"type": "string",
"description": "A connector is an integration to fulfill payments",
"enum": [
+ "adyenplatform",
"phonypay",
"fauxpay",
"pretendpay",
@@ -16325,11 +16326,12 @@
"type": "string",
"enum": [
"adyen",
- "stripe",
+ "adyenplatform",
+ "cybersource",
+ "ebanx",
"payone",
"paypal",
- "ebanx",
- "cybersource",
+ "stripe",
"wise"
]
},
@@ -16345,7 +16347,8 @@
"return_url",
"business_country",
"description",
- "entity_type"
+ "entity_type",
+ "priority"
],
"properties": {
"payout_id": {
@@ -16502,6 +16505,9 @@
"type": "string",
"description": "The business profile to use for this payment, if not passed the default business profile\nassociated with the merchant account will be used.",
"nullable": true
+ },
+ "priority": {
+ "$ref": "#/components/schemas/PayoutSendPriority"
}
},
"additionalProperties": false
@@ -16665,6 +16671,20 @@
"example": "2022-09-10T10:11:12Z",
"nullable": true
},
+ "connector_transaction_id": {
+ "type": "string",
+ "description": "Underlying processor's payout resource ID",
+ "example": "S3FC9G9M2MVFDXT5",
+ "nullable": true
+ },
+ "priority": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PayoutSendPriority"
+ }
+ ],
+ "nullable": true
+ },
"attempts": {
"type": "array",
"items": {
@@ -16967,6 +16987,17 @@
}
}
},
+ "PayoutSendPriority": {
+ "type": "string",
+ "enum": [
+ "instant",
+ "fast",
+ "regular",
+ "wire",
+ "crossBorder",
+ "internal"
+ ]
+ },
"PayoutStatus": {
"type": "string",
"enum": [
@@ -17926,6 +17957,7 @@
"type": "string",
"description": "Connectors eligible for payments routing",
"enum": [
+ "adyenplatform",
"phonypay",
"fauxpay",
"pretendpay",
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index dcd9c29fb65..f35d080bfe6 100755
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -6,7 +6,7 @@ function find_prev_connector() {
git checkout $self
cp $self $self.tmp
# Add new connector to existing list and sort it
- connectors=(aci adyen airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless gpayments helcim iatapay klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode payeezy payme payone paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay zsl "$1")
+ connectors=(aci adyen adyenplatform airwallex applepay authorizedotnet bambora bankofamerica billwerk bitpay bluesnap boku braintree cashtocode checkout coinbase cryptopay cybersource dlocal dummyconnector ebanx fiserv forte globalpay globepay gocardless gpayments helcim iatapay klarna mifinity mollie multisafepay netcetera nexinets noon nuvei opayo opennode payeezy payme payone paypal payu placetopay powertranz prophetpay rapyd shift4 square stax stripe threedsecureio trustpay tsys volt wise worldline worldpay zsl "$1")
IFS=$'\n' sorted=($(sort <<<"${connectors[*]}")); unset IFS
res=`echo ${sorted[@]}`
sed -i'' -e "s/^ connectors=.*/ connectors=($res \"\$1\")/" $self.tmp
|
feat
|
add payouts integration for AdyenPlatform (#4874)
|
858866f9f361c16b76ed79b42814b648f2050f08
|
2025-01-28 23:27:23
|
Prajjwal Kumar
|
refactor(currency_conversion): re frame the currency_conversion crate to make api calls on background thread (#6906)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index c860420da38..ecc2d2127ce 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -74,13 +74,10 @@ max_feed_count = 200 # The maximum number of frames that will be fe
# This section provides configs for currency conversion api
[forex_api]
-call_delay = 21600 # Api calls are made after every 6 hrs
-local_fetch_retry_count = 5 # Fetch from Local cache has retry count as 5
-local_fetch_retry_delay = 1000 # Retry delay for checking write condition
-api_timeout = 20000 # Api timeouts once it crosses 20000 ms
-api_key = "YOUR API KEY HERE" # Api key for making request to foreign exchange Api
-fallback_api_key = "YOUR API KEY" # Api key for the fallback service
-redis_lock_timeout = 26000 # Redis remains write locked for 26000 ms once the acquire_redis_lock is called
+call_delay = 21600 # Expiration time for data in cache as well as redis in seconds
+api_key = "" # Api key for making request to foreign exchange Api
+fallback_api_key = "" # Api key for the fallback service
+redis_lock_timeout = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
# Logging configuration. Logging can be either to file or console or both.
diff --git a/config/deployments/env_specific.toml b/config/deployments/env_specific.toml
index 84550922d4a..8c846ff422e 100644
--- a/config/deployments/env_specific.toml
+++ b/config/deployments/env_specific.toml
@@ -101,13 +101,10 @@ bucket_name = "bucket" # The AWS S3 bucket name for file storage
# This section provides configs for currency conversion api
[forex_api]
-call_delay = 21600 # Api calls are made after every 6 hrs
-local_fetch_retry_count = 5 # Fetch from Local cache has retry count as 5
-local_fetch_retry_delay = 1000 # Retry delay for checking write condition
-api_timeout = 20000 # Api timeouts once it crosses 20000 ms
-api_key = "YOUR API KEY HERE" # Api key for making request to foreign exchange Api
-fallback_api_key = "YOUR API KEY" # Api key for the fallback service
-redis_lock_timeout = 26000 # Redis remains write locked for 26000 ms once the acquire_redis_lock is called
+call_delay = 21600 # Expiration time for data in cache as well as redis in seconds
+api_key = "" # Api key for making request to foreign exchange Api
+fallback_api_key = "" # Api key for the fallback service
+redis_lock_timeout = 100 # Redis remains write locked for 100 s once the acquire_redis_lock is called
[jwekey] # 3 priv/pub key pair
vault_encryption_key = "" # public key in pem format, corresponding private key in rust locker
diff --git a/config/development.toml b/config/development.toml
index a32102aeebf..6bce5cb89d7 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -78,12 +78,9 @@ ttl_for_storage_in_secs = 220752000
[forex_api]
call_delay = 21600
-local_fetch_retry_count = 5
-local_fetch_retry_delay = 1000
-api_timeout = 20000
-api_key = "YOUR API KEY HERE"
-fallback_api_key = "YOUR API KEY HERE"
-redis_lock_timeout = 26000
+api_key = ""
+fallback_api_key = ""
+redis_lock_timeout = 100
[jwekey]
vault_encryption_key = ""
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 4296a5931dc..293e9a313e9 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -31,12 +31,9 @@ pool_size = 5
[forex_api]
call_delay = 21600
-local_fetch_retry_count = 5
-local_fetch_retry_delay = 1000
-api_timeout = 20000
-api_key = "YOUR API KEY HERE"
-fallback_api_key = "YOUR API KEY HERE"
-redis_lock_timeout = 26000
+api_key = ""
+fallback_api_key = ""
+redis_lock_timeout = 100
[replica_database]
username = "db_user"
diff --git a/crates/analytics/docs/README.md b/crates/analytics/docs/README.md
index e24dc6c5af7..71190613a10 100644
--- a/crates/analytics/docs/README.md
+++ b/crates/analytics/docs/README.md
@@ -115,8 +115,8 @@ To configure the Forex APIs, update the `config/development.toml` or `config/doc
```toml
[forex_api]
-api_key = "YOUR API KEY HERE" # Replace the placeholder with your Primary API Key
-fallback_api_key = "YOUR API KEY HERE" # Replace the placeholder with your Fallback API Key
+api_key = ""
+fallback_api_key = ""
```
### Important Note
```bash
@@ -159,4 +159,4 @@ To view the data on the OpenSearch dashboard perform the following steps:
- Select a time field that will be used for time-based queries
- Save the index pattern
-Now, head on to `Discover` under the `OpenSearch Dashboards` tab, to select the newly created index pattern and query the data
\ No newline at end of file
+Now, head on to `Discover` under the `OpenSearch Dashboards` tab, to select the newly created index pattern and query the data
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 577b29b0534..fa3d004aada 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -303,16 +303,11 @@ pub struct PaymentLink {
#[derive(Debug, Deserialize, Clone, Default)]
#[serde(default)]
pub struct ForexApi {
- pub local_fetch_retry_count: u64,
pub api_key: Secret<String>,
pub fallback_api_key: Secret<String>,
- /// in ms
+ /// in s
pub call_delay: i64,
- /// in ms
- pub local_fetch_retry_delay: u64,
- /// in ms
- pub api_timeout: u64,
- /// in ms
+ /// in s
pub redis_lock_timeout: u64,
}
diff --git a/crates/router/src/core/currency.rs b/crates/router/src/core/currency.rs
index 912484b014a..8c1a8512892 100644
--- a/crates/router/src/core/currency.rs
+++ b/crates/router/src/core/currency.rs
@@ -15,16 +15,11 @@ pub async fn retrieve_forex(
) -> CustomResult<ApplicationResponse<currency::FxExchangeRatesCacheEntry>, ApiErrorResponse> {
let forex_api = state.conf.forex_api.get_inner();
Ok(ApplicationResponse::Json(
- get_forex_rates(
- &state,
- forex_api.call_delay,
- forex_api.local_fetch_retry_delay,
- forex_api.local_fetch_retry_count,
- )
- .await
- .change_context(ApiErrorResponse::GenericNotFoundError {
- message: "Unable to fetch forex rates".to_string(),
- })?,
+ get_forex_rates(&state, forex_api.call_delay)
+ .await
+ .change_context(ApiErrorResponse::GenericNotFoundError {
+ message: "Unable to fetch forex rates".to_string(),
+ })?,
))
}
@@ -53,14 +48,9 @@ pub async fn get_forex_exchange_rates(
state: SessionState,
) -> CustomResult<ExchangeRates, AnalyticsError> {
let forex_api = state.conf.forex_api.get_inner();
- let rates = get_forex_rates(
- &state,
- forex_api.call_delay,
- forex_api.local_fetch_retry_delay,
- forex_api.local_fetch_retry_count,
- )
- .await
- .change_context(AnalyticsError::ForexFetchFailed)?;
+ let rates = get_forex_rates(&state, forex_api.call_delay)
+ .await
+ .change_context(AnalyticsError::ForexFetchFailed)?;
Ok((*rates.data).clone())
}
diff --git a/crates/router/src/utils/currency.rs b/crates/router/src/utils/currency.rs
index 9ab2780da73..c10ebf3dac1 100644
--- a/crates/router/src/utils/currency.rs
+++ b/crates/router/src/utils/currency.rs
@@ -1,4 +1,4 @@
-use std::{collections::HashMap, ops::Deref, str::FromStr, sync::Arc, time::Duration};
+use std::{collections::HashMap, ops::Deref, str::FromStr, sync::Arc};
use api_models::enums;
use common_utils::{date_time, errors::CustomResult, events::ApiEventMetric, ext_traits::AsyncExt};
@@ -10,7 +10,8 @@ use redis_interface::DelReply;
use router_env::{instrument, tracing};
use rust_decimal::Decimal;
use strum::IntoEnumIterator;
-use tokio::{sync::RwLock, time::sleep};
+use tokio::sync::RwLock;
+use tracing_futures::Instrument;
use crate::{
logger,
@@ -50,10 +51,14 @@ pub enum ForexCacheError {
CouldNotAcquireLock,
#[error("Provided currency not acceptable")]
CurrencyNotAcceptable,
+ #[error("Forex configuration error: {0}")]
+ ConfigurationError(String),
#[error("Incorrect entries in default Currency response")]
DefaultCurrencyParsingError,
#[error("Entry not found in cache")]
EntryNotFound,
+ #[error("Forex data unavailable")]
+ ForexDataUnavailable,
#[error("Expiration time invalid")]
InvalidLogExpiry,
#[error("Error reading local")]
@@ -107,44 +112,19 @@ impl FxExchangeRatesCacheEntry {
}
}
-async fn retrieve_forex_from_local() -> Option<FxExchangeRatesCacheEntry> {
+async fn retrieve_forex_from_local_cache() -> Option<FxExchangeRatesCacheEntry> {
FX_EXCHANGE_RATES_CACHE.read().await.clone()
}
-async fn save_forex_to_local(
+async fn save_forex_data_to_local_cache(
exchange_rates_cache_entry: FxExchangeRatesCacheEntry,
) -> CustomResult<(), ForexCacheError> {
let mut local = FX_EXCHANGE_RATES_CACHE.write().await;
*local = Some(exchange_rates_cache_entry);
+ logger::debug!("forex_log: forex saved in cache");
Ok(())
}
-// Alternative handler for handling the case, When no data in local as well as redis
-#[allow(dead_code)]
-async fn waited_fetch_and_update_caches(
- state: &SessionState,
- local_fetch_retry_delay: u64,
- local_fetch_retry_count: u64,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- for _n in 1..local_fetch_retry_count {
- sleep(Duration::from_millis(local_fetch_retry_delay)).await;
- //read from redis and update local plus break the loop and return
- match retrieve_forex_from_redis(state).await {
- Ok(Some(rates)) => {
- save_forex_to_local(rates.clone()).await?;
- return Ok(rates.clone());
- }
- Ok(None) => continue,
- Err(error) => {
- logger::error!(?error);
- continue;
- }
- }
- }
- //acquire lock one last time and try to fetch and update local & redis
- successive_fetch_and_save_forex(state, None).await
-}
-
impl TryFrom<DefaultExchangeRates> for ExchangeRates {
type Error = error_stack::Report<ForexCacheError>;
fn try_from(value: DefaultExchangeRates) -> Result<Self, Self::Error> {
@@ -178,102 +158,108 @@ impl From<Conversion> for CurrencyFactors {
pub async fn get_forex_rates(
state: &SessionState,
call_delay: i64,
- local_fetch_retry_delay: u64,
- local_fetch_retry_count: u64,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- if let Some(local_rates) = retrieve_forex_from_local().await {
+ if let Some(local_rates) = retrieve_forex_from_local_cache().await {
if local_rates.is_expired(call_delay) {
// expired local data
- handler_local_expired(state, call_delay, local_rates).await
+ logger::debug!("forex_log: Forex stored in cache is expired");
+ call_forex_api_and_save_data_to_cache_and_redis(state, Some(local_rates)).await
} else {
// Valid data present in local
+ logger::debug!("forex_log: forex found in cache");
Ok(local_rates)
}
} else {
// No data in local
- handler_local_no_data(
- state,
- call_delay,
- local_fetch_retry_delay,
- local_fetch_retry_count,
- )
- .await
+ call_api_if_redis_forex_data_expired(state, call_delay).await
}
}
-async fn handler_local_no_data(
+async fn call_api_if_redis_forex_data_expired(
state: &SessionState,
call_delay: i64,
- _local_fetch_retry_delay: u64,
- _local_fetch_retry_count: u64,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- match retrieve_forex_from_redis(state).await {
- Ok(Some(data)) => fallback_forex_redis_check(state, data, call_delay).await,
+ match retrieve_forex_data_from_redis(state).await {
+ Ok(Some(data)) => call_forex_api_if_redis_data_expired(state, data, call_delay).await,
Ok(None) => {
// No data in local as well as redis
- Ok(successive_fetch_and_save_forex(state, None).await?)
+ call_forex_api_and_save_data_to_cache_and_redis(state, None).await?;
+ Err(ForexCacheError::ForexDataUnavailable.into())
}
Err(error) => {
- logger::error!(?error);
- Ok(successive_fetch_and_save_forex(state, None).await?)
+ // Error in deriving forex rates from redis
+ logger::error!("forex_error: {:?}", error);
+ call_forex_api_and_save_data_to_cache_and_redis(state, None).await?;
+ Err(ForexCacheError::ForexDataUnavailable.into())
}
}
}
-async fn successive_fetch_and_save_forex(
+async fn call_forex_api_and_save_data_to_cache_and_redis(
state: &SessionState,
stale_redis_data: Option<FxExchangeRatesCacheEntry>,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- match acquire_redis_lock(state).await {
- Ok(lock_acquired) => {
- if !lock_acquired {
- return stale_redis_data.ok_or(ForexCacheError::CouldNotAcquireLock.into());
+ // spawn a new thread and do the api fetch and write operations on redis.
+ let forex_api_key = state.conf.forex_api.get_inner().api_key.peek();
+ if forex_api_key.is_empty() {
+ Err(ForexCacheError::ConfigurationError("api_keys not provided".into()).into())
+ } else {
+ let state = state.clone();
+ tokio::spawn(
+ async move {
+ acquire_redis_lock_and_call_forex_api(&state)
+ .await
+ .map_err(|err| {
+ logger::error!(forex_error=?err);
+ })
+ .ok();
}
- let api_rates = fetch_forex_rates(state).await;
- match api_rates {
- Ok(rates) => successive_save_data_to_redis_local(state, rates).await,
- Err(error) => {
- // API not able to fetch data call secondary service
- logger::error!(?error);
- let secondary_api_rates = fallback_fetch_forex_rates(state).await;
- match secondary_api_rates {
- Ok(rates) => Ok(successive_save_data_to_redis_local(state, rates).await?),
- Err(error) => stale_redis_data.ok_or({
- logger::error!(?error);
- release_redis_lock(state).await?;
- ForexCacheError::ApiUnresponsive.into()
- }),
+ .in_current_span(),
+ );
+ stale_redis_data.ok_or(ForexCacheError::EntryNotFound.into())
+ }
+}
+
+async fn acquire_redis_lock_and_call_forex_api(
+ state: &SessionState,
+) -> CustomResult<(), ForexCacheError> {
+ let lock_acquired = acquire_redis_lock(state).await?;
+ if !lock_acquired {
+ Err(ForexCacheError::CouldNotAcquireLock.into())
+ } else {
+ logger::debug!("forex_log: redis lock acquired");
+ let api_rates = fetch_forex_rates_from_primary_api(state).await;
+ match api_rates {
+ Ok(rates) => save_forex_data_to_cache_and_redis(state, rates).await,
+ Err(error) => {
+ logger::error!(forex_error=?error,"primary_forex_error");
+ // API not able to fetch data call secondary service
+ let secondary_api_rates = fetch_forex_rates_from_fallback_api(state).await;
+ match secondary_api_rates {
+ Ok(rates) => save_forex_data_to_cache_and_redis(state, rates).await,
+ Err(error) => {
+ release_redis_lock(state).await?;
+ Err(error)
}
}
}
}
- Err(error) => stale_redis_data.ok_or({
- logger::error!(?error);
- ForexCacheError::ApiUnresponsive.into()
- }),
}
}
-async fn successive_save_data_to_redis_local(
+async fn save_forex_data_to_cache_and_redis(
state: &SessionState,
forex: FxExchangeRatesCacheEntry,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- Ok(save_forex_to_redis(state, &forex)
+) -> CustomResult<(), ForexCacheError> {
+ save_forex_data_to_redis(state, &forex)
.await
.async_and_then(|_rates| release_redis_lock(state))
.await
- .async_and_then(|_val| save_forex_to_local(forex.clone()))
+ .async_and_then(|_val| save_forex_data_to_local_cache(forex.clone()))
.await
- .map_or_else(
- |error| {
- logger::error!(?error);
- forex.clone()
- },
- |_| forex.clone(),
- ))
}
-async fn fallback_forex_redis_check(
+async fn call_forex_api_if_redis_data_expired(
state: &SessionState,
redis_data: FxExchangeRatesCacheEntry,
call_delay: i64,
@@ -282,57 +268,30 @@ async fn fallback_forex_redis_check(
Some(redis_forex) => {
// Valid data present in redis
let exchange_rates = FxExchangeRatesCacheEntry::new(redis_forex.as_ref().clone());
- save_forex_to_local(exchange_rates.clone()).await?;
+ logger::debug!("forex_log: forex response found in redis");
+ save_forex_data_to_local_cache(exchange_rates.clone()).await?;
Ok(exchange_rates)
}
None => {
// redis expired
- successive_fetch_and_save_forex(state, Some(redis_data)).await
- }
- }
-}
-
-async fn handler_local_expired(
- state: &SessionState,
- call_delay: i64,
- local_rates: FxExchangeRatesCacheEntry,
-) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
- match retrieve_forex_from_redis(state).await {
- Ok(redis_data) => {
- match is_redis_expired(redis_data.as_ref(), call_delay).await {
- Some(redis_forex) => {
- // Valid data present in redis
- let exchange_rates =
- FxExchangeRatesCacheEntry::new(redis_forex.as_ref().clone());
- save_forex_to_local(exchange_rates.clone()).await?;
- Ok(exchange_rates)
- }
- None => {
- // Redis is expired going for API request
- successive_fetch_and_save_forex(state, Some(local_rates)).await
- }
- }
- }
- Err(error) => {
- // data not present in redis waited fetch
- logger::error!(?error);
- successive_fetch_and_save_forex(state, Some(local_rates)).await
+ call_forex_api_and_save_data_to_cache_and_redis(state, Some(redis_data)).await
}
}
}
-async fn fetch_forex_rates(
+async fn fetch_forex_rates_from_primary_api(
state: &SessionState,
) -> Result<FxExchangeRatesCacheEntry, error_stack::Report<ForexCacheError>> {
let forex_api_key = state.conf.forex_api.get_inner().api_key.peek();
+ logger::debug!("forex_log: Primary api call for forex fetch");
let forex_url: String = format!("{}{}{}", FOREX_BASE_URL, forex_api_key, FOREX_BASE_CURRENCY);
let forex_request = services::RequestBuilder::new()
.method(services::Method::Get)
.url(&forex_url)
.build();
- logger::info!(?forex_request);
+ logger::info!(primary_forex_request=?forex_request,"forex_log: Primary api call for forex fetch");
let response = state
.api_client
.send_request(
@@ -352,7 +311,7 @@ async fn fetch_forex_rates(
"Unable to parse response received from primary api into ForexResponse",
)?;
- logger::info!("{:?}", forex_response);
+ logger::info!(primary_forex_response=?forex_response,"forex_log");
let mut conversions: HashMap<enums::Currency, CurrencyFactors> = HashMap::new();
for enum_curr in enums::Currency::iter() {
@@ -361,7 +320,10 @@ async fn fetch_forex_rates(
let from_factor = match Decimal::new(1, 0).checked_div(**rate) {
Some(rate) => rate,
None => {
- logger::error!("Rates for {} not received from API", &enum_curr);
+ logger::error!(
+ "forex_error: Rates for {} not received from API",
+ &enum_curr
+ );
continue;
}
};
@@ -369,7 +331,10 @@ async fn fetch_forex_rates(
conversions.insert(enum_curr, currency_factors);
}
None => {
- logger::error!("Rates for {} not received from API", &enum_curr);
+ logger::error!(
+ "forex_error: Rates for {} not received from API",
+ &enum_curr
+ );
}
};
}
@@ -380,7 +345,7 @@ async fn fetch_forex_rates(
)))
}
-pub async fn fallback_fetch_forex_rates(
+pub async fn fetch_forex_rates_from_fallback_api(
state: &SessionState,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexCacheError> {
let fallback_forex_api_key = state.conf.forex_api.get_inner().fallback_api_key.peek();
@@ -392,7 +357,7 @@ pub async fn fallback_fetch_forex_rates(
.url(&fallback_forex_url)
.build();
- logger::info!(?fallback_forex_request);
+ logger::info!(fallback_forex_request=?fallback_forex_request,"forex_log: Fallback api call for forex fetch");
let response = state
.api_client
.send_request(
@@ -413,7 +378,8 @@ pub async fn fallback_fetch_forex_rates(
"Unable to parse response received from falback api into ForexResponse",
)?;
- logger::info!("{:?}", fallback_forex_response);
+ logger::info!(fallback_forex_response=?fallback_forex_response,"forex_log");
+
let mut conversions: HashMap<enums::Currency, CurrencyFactors> = HashMap::new();
for enum_curr in enums::Currency::iter() {
match fallback_forex_response.quotes.get(
@@ -428,7 +394,10 @@ pub async fn fallback_fetch_forex_rates(
let from_factor = match Decimal::new(1, 0).checked_div(**rate) {
Some(rate) => rate,
None => {
- logger::error!("Rates for {} not received from API", &enum_curr);
+ logger::error!(
+ "forex_error: Rates for {} not received from API",
+ &enum_curr
+ );
continue;
}
};
@@ -441,7 +410,10 @@ pub async fn fallback_fetch_forex_rates(
CurrencyFactors::new(Decimal::new(1, 0), Decimal::new(1, 0));
conversions.insert(enum_curr, currency_factors);
} else {
- logger::error!("Rates for {} not received from API", &enum_curr);
+ logger::error!(
+ "forex_error: Rates for {} not received from API",
+ &enum_curr
+ );
}
}
};
@@ -450,17 +422,18 @@ pub async fn fallback_fetch_forex_rates(
let rates =
FxExchangeRatesCacheEntry::new(ExchangeRates::new(enums::Currency::USD, conversions));
match acquire_redis_lock(state).await {
- Ok(_) => Ok(successive_save_data_to_redis_local(state, rates).await?),
- Err(e) => {
- logger::error!(?e);
+ Ok(_) => {
+ save_forex_data_to_cache_and_redis(state, rates.clone()).await?;
Ok(rates)
}
+ Err(e) => Err(e),
}
}
async fn release_redis_lock(
state: &SessionState,
) -> Result<DelReply, error_stack::Report<ForexCacheError>> {
+ logger::debug!("forex_log: Releasing redis lock");
state
.store
.get_redis_conn()
@@ -473,6 +446,7 @@ async fn release_redis_lock(
async fn acquire_redis_lock(state: &SessionState) -> CustomResult<bool, ForexCacheError> {
let forex_api = state.conf.forex_api.get_inner();
+ logger::debug!("forex_log: Acquiring redis lock");
state
.store
.get_redis_conn()
@@ -481,11 +455,8 @@ async fn acquire_redis_lock(state: &SessionState) -> CustomResult<bool, ForexCac
REDIX_FOREX_CACHE_KEY,
"",
Some(
- i64::try_from(
- forex_api.local_fetch_retry_count * forex_api.local_fetch_retry_delay
- + forex_api.api_timeout,
- )
- .change_context(ForexCacheError::ConversionError)?,
+ i64::try_from(forex_api.redis_lock_timeout)
+ .change_context(ForexCacheError::ConversionError)?,
),
)
.await
@@ -494,10 +465,11 @@ async fn acquire_redis_lock(state: &SessionState) -> CustomResult<bool, ForexCac
.attach_printable("Unable to acquire redis lock")
}
-async fn save_forex_to_redis(
+async fn save_forex_data_to_redis(
app_state: &SessionState,
forex_exchange_cache_entry: &FxExchangeRatesCacheEntry,
) -> CustomResult<(), ForexCacheError> {
+ logger::debug!("forex_log: Saving forex to redis");
app_state
.store
.get_redis_conn()
@@ -508,9 +480,10 @@ async fn save_forex_to_redis(
.attach_printable("Unable to save forex data to redis")
}
-async fn retrieve_forex_from_redis(
+async fn retrieve_forex_data_from_redis(
app_state: &SessionState,
) -> CustomResult<Option<FxExchangeRatesCacheEntry>, ForexCacheError> {
+ logger::debug!("forex_log: Retrieving forex from redis");
app_state
.store
.get_redis_conn()
@@ -529,6 +502,7 @@ async fn is_redis_expired(
if cache.timestamp + call_delay > date_time::now_unix_timestamp() {
Some(cache.data.clone())
} else {
+ logger::debug!("forex_log: Forex stored in redis is expired");
None
}
})
@@ -542,14 +516,9 @@ pub async fn convert_currency(
from_currency: String,
) -> CustomResult<api_models::currency::CurrencyConversionResponse, ForexCacheError> {
let forex_api = state.conf.forex_api.get_inner();
- let rates = get_forex_rates(
- &state,
- forex_api.call_delay,
- forex_api.local_fetch_retry_delay,
- forex_api.local_fetch_retry_count,
- )
- .await
- .change_context(ForexCacheError::ApiError)?;
+ let rates = get_forex_rates(&state, forex_api.call_delay)
+ .await
+ .change_context(ForexCacheError::ApiError)?;
let to_currency = enums::Currency::from_str(to_currency.as_str())
.change_context(ForexCacheError::CurrencyNotAcceptable)
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index e90eb16ab61..61f5debb4d0 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -48,12 +48,9 @@ ttl_for_storage_in_secs = 220752000
[forex_api]
call_delay = 21600
-local_fetch_retry_count = 5
-local_fetch_retry_delay = 1000
-api_timeout = 20000
-api_key = "YOUR API KEY HERE"
-fallback_api_key = "YOUR API KEY HERE"
-redis_lock_timeout = 26000
+api_key = ""
+fallback_api_key = ""
+redis_lock_timeout = 100
[eph_key]
validity = 1
|
refactor
|
re frame the currency_conversion crate to make api calls on background thread (#6906)
|
44653850f0128314e2580c8001937ca4a45e4b02
|
2024-12-23 19:43:36
|
Swangi Kumari
|
fix(wasm): remove extra space from wasm for payment_method_type of JPMorgan (#6923)
| false
|
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index f49f6b311f6..058fa09ed46 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1733,11 +1733,11 @@ key2="Certificate Key"
[jpmorgan]
[[jpmorgan.credit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.credit]]
payment_method_type = "ChaseNet"
[[jpmorgan.credit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.credit]]
payment_method_type = "Discover"
[[jpmorgan.credit]]
@@ -1751,11 +1751,11 @@ key2="Certificate Key"
[[jpmorgan.credit]]
payment_method_type = "Visa"
[[jpmorgan.debit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.debit]]
payment_method_type = "ChaseNet"
[[jpmorgan.debit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.debit]]
payment_method_type = "Discover"
[[jpmorgan.debit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index b67f1a20ba2..4932970a128 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1445,11 +1445,11 @@ key2="Certificate Key"
[jpmorgan]
[[jpmorgan.credit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.credit]]
payment_method_type = "ChaseNet"
[[jpmorgan.credit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.credit]]
payment_method_type = "Discover"
[[jpmorgan.credit]]
@@ -1463,11 +1463,11 @@ key2="Certificate Key"
[[jpmorgan.credit]]
payment_method_type = "Visa"
[[jpmorgan.debit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.debit]]
payment_method_type = "ChaseNet"
[[jpmorgan.debit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.debit]]
payment_method_type = "Discover"
[[jpmorgan.debit]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 43380e7ab0c..3d391aef6f6 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1681,11 +1681,11 @@ key2="Certificate Key"
[jpmorgan]
[[jpmorgan.credit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.credit]]
payment_method_type = "ChaseNet"
[[jpmorgan.credit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.credit]]
payment_method_type = "Discover"
[[jpmorgan.credit]]
@@ -1699,11 +1699,11 @@ key2="Certificate Key"
[[jpmorgan.credit]]
payment_method_type = "Visa"
[[jpmorgan.debit]]
- payment_method_type = "American Express"
+ payment_method_type = "AmericanExpress"
[[jpmorgan.debit]]
payment_method_type = "ChaseNet"
[[jpmorgan.debit]]
- payment_method_type = "Diners Club"
+ payment_method_type = "DinersClub"
[[jpmorgan.debit]]
payment_method_type = "Discover"
[[jpmorgan.debit]]
|
fix
|
remove extra space from wasm for payment_method_type of JPMorgan (#6923)
|
33c6d71a8a71619f811accbc21f3c22c3c279c47
|
2023-08-09 14:05:50
|
Kashif
|
chore: add connector functionality validation based on connector_type (#1849)
| false
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index b3a76df3d01..d13789be0d9 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -174,6 +174,8 @@ pub enum ConnectorType {
BankingEntities,
/// All types of non-banking financial institutions including Insurance, Credit / Lending etc
NonBankingFinance,
+ /// Acquirers, Gateways etc
+ PayoutProcessor,
}
#[allow(clippy::upper_case_acronyms)]
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index d637dc61612..23d2d440312 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -3817,7 +3817,8 @@
"fiz_operations",
"networks",
"banking_entities",
- "non_banking_finance"
+ "non_banking_finance",
+ "payout_processor"
]
},
"CountryAlpha2": {
|
chore
|
add connector functionality validation based on connector_type (#1849)
|
2f9a3557f63150bcd27e27c6510a799669706718
|
2023-10-18 15:42:32
|
Hrithikesh
|
feat: update surcharge_amount and tax_amount in update_trackers of payment_confirm (#2603)
| false
|
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index e763a3e2677..f61f6f9a44a 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -311,7 +311,9 @@ pub struct PaymentsRequest {
pub payment_type: Option<api_enums::PaymentType>,
}
-#[derive(Default, Debug, Clone, serde::Serialize, serde::Deserialize, Copy, ToSchema)]
+#[derive(
+ Default, Debug, Clone, serde::Serialize, serde::Deserialize, Copy, ToSchema, PartialEq,
+)]
pub struct RequestSurchargeDetails {
pub surcharge_amount: i64,
pub tax_amount: Option<i64>,
@@ -2096,6 +2098,9 @@ pub struct PaymentsResponse {
/// The business profile that is associated with this payment
pub profile_id: Option<String>,
+ /// details of surcharge applied on this payment
+ pub surcharge_details: Option<RequestSurchargeDetails>,
+
/// total number of attempts associated with this payment
pub attempt_count: i16,
diff --git a/crates/data_models/src/payments/payment_attempt.rs b/crates/data_models/src/payments/payment_attempt.rs
index cf65c3f5de2..c31230229de 100644
--- a/crates/data_models/src/payments/payment_attempt.rs
+++ b/crates/data_models/src/payments/payment_attempt.rs
@@ -250,6 +250,8 @@ pub enum PaymentAttemptUpdate {
error_code: Option<Option<String>>,
error_message: Option<Option<String>>,
amount_capturable: Option<i64>,
+ surcharge_amount: Option<i64>,
+ tax_amount: Option<i64>,
updated_by: String,
},
RejectUpdate {
@@ -307,11 +309,6 @@ pub enum PaymentAttemptUpdate {
multiple_capture_count: i16,
updated_by: String,
},
- SurchargeAmountUpdate {
- surcharge_amount: Option<i64>,
- tax_amount: Option<i64>,
- updated_by: String,
- },
AmountToCaptureUpdate {
status: storage_enums::AttemptStatus,
amount_capturable: i64,
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index ca73540437e..930a9cf959a 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -166,6 +166,8 @@ pub enum PaymentAttemptUpdate {
error_code: Option<Option<String>>,
error_message: Option<Option<String>>,
amount_capturable: Option<i64>,
+ surcharge_amount: Option<i64>,
+ tax_amount: Option<i64>,
updated_by: String,
},
VoidUpdate {
@@ -228,11 +230,6 @@ pub enum PaymentAttemptUpdate {
amount_capturable: i64,
updated_by: String,
},
- SurchargeAmountUpdate {
- surcharge_amount: Option<i64>,
- tax_amount: Option<i64>,
- updated_by: String,
- },
PreprocessingUpdate {
status: storage_enums::AttemptStatus,
payment_method_id: Option<Option<String>>,
@@ -378,6 +375,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
} => Self {
amount: Some(amount),
@@ -397,6 +396,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
..Default::default()
},
@@ -561,16 +562,6 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
updated_by,
..Default::default()
},
- PaymentAttemptUpdate::SurchargeAmountUpdate {
- surcharge_amount,
- tax_amount,
- updated_by,
- } => Self {
- surcharge_amount,
- tax_amount,
- updated_by,
- ..Default::default()
- },
}
}
}
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index 4a1689338fd..df5bfc44d85 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -216,6 +216,10 @@ impl ConnectorValidation for Paypal {
),
}
}
+
+ fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
+ Ok(())
+ }
}
impl
diff --git a/crates/router/src/connector/trustpay.rs b/crates/router/src/connector/trustpay.rs
index fd2d369a7c5..912f1575e1e 100644
--- a/crates/router/src/connector/trustpay.rs
+++ b/crates/router/src/connector/trustpay.rs
@@ -148,7 +148,11 @@ impl ConnectorCommon for Trustpay {
}
}
-impl ConnectorValidation for Trustpay {}
+impl ConnectorValidation for Trustpay {
+ fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
+ Ok(())
+ }
+}
impl api::Payment for Trustpay {}
diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs
index a7279147586..3164e74dcdd 100644
--- a/crates/router/src/core/payments/flows/authorize_flow.rs
+++ b/crates/router/src/core/payments/flows/authorize_flow.rs
@@ -73,6 +73,12 @@ impl Feature<api::Authorize, types::PaymentsAuthorizeData> for types::PaymentsAu
.connector
.validate_capture_method(self.request.capture_method)
.to_payment_failed_response()?;
+ if self.request.surcharge_details.is_some() {
+ connector
+ .connector
+ .validate_if_surcharge_implemented()
+ .to_payment_failed_response()?;
+ }
if self.should_proceed_with_authorize() {
self.decide_authentication_type();
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index eeb94f45582..1cfcbce5532 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -82,7 +82,10 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
helpers::validate_status_with_capture_method(payment_intent.status, capture_method)?;
- helpers::validate_amount_to_capture(payment_intent.amount, request.amount_to_capture)?;
+ helpers::validate_amount_to_capture(
+ payment_attempt.amount_capturable,
+ request.amount_to_capture,
+ )?;
helpers::validate_capture_method(capture_method)?;
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index a045cee3548..0e0d6c21479 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -1,6 +1,6 @@
use std::marker::PhantomData;
-use api_models::enums::FrmSuggestion;
+use api_models::{enums::FrmSuggestion, payment_methods};
use async_trait::async_trait;
use common_utils::ext_traits::{AsyncExt, Encode};
use error_stack::ResultExt;
@@ -335,6 +335,19 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
sm
});
+ // populate payment_data.surcharge_details from request
+ let surcharge_details = request.surcharge_details.map(|surcharge_details| {
+ payment_methods::SurchargeDetailsResponse {
+ surcharge: payment_methods::Surcharge::Fixed(surcharge_details.surcharge_amount),
+ tax_on_surcharge: None,
+ surcharge_amount: surcharge_details.surcharge_amount,
+ tax_on_surcharge_amount: surcharge_details.tax_amount.unwrap_or(0),
+ final_amount: payment_attempt.amount
+ + surcharge_details.surcharge_amount
+ + surcharge_details.tax_amount.unwrap_or(0),
+ }
+ });
+
Ok((
Box::new(self),
PaymentData {
@@ -368,7 +381,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
ephemeral_key: None,
multiple_capture_data: None,
redirect_response: None,
- surcharge_details: None,
+ surcharge_details,
frm_message: None,
payment_link_data: None,
},
@@ -543,7 +556,19 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
.take();
let order_details = payment_data.payment_intent.order_details.clone();
let metadata = payment_data.payment_intent.metadata.clone();
- let authorized_amount = payment_data.payment_attempt.amount;
+ let surcharge_amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.surcharge_amount);
+ let tax_amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.tax_on_surcharge_amount);
+ let authorized_amount = payment_data
+ .surcharge_details
+ .as_ref()
+ .map(|surcharge_details| surcharge_details.final_amount)
+ .unwrap_or(payment_data.payment_attempt.amount);
let payment_attempt_fut = db
.update_payment_attempt_with_attempt_id(
payment_data.payment_attempt,
@@ -564,6 +589,8 @@ impl<F: Clone, Ctx: PaymentMethodRetrieve>
error_code,
error_message,
amount_capturable: Some(authorized_amount),
+ surcharge_amount,
+ tax_amount,
updated_by: storage_scheme.to_string(),
},
storage_scheme,
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index af84152120a..1467da7f816 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -559,7 +559,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
payment_attempt_update = Some(storage::PaymentAttemptUpdate::AmountToCaptureUpdate {
status: multiple_capture_data.get_attempt_status(authorized_amount),
- amount_capturable: payment_data.payment_attempt.amount
+ amount_capturable: authorized_amount
- multiple_capture_data.get_total_blocked_amount(),
updated_by: storage_scheme.to_string(),
});
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 66453315d44..d2ced5af346 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -1,6 +1,6 @@
use std::{fmt::Debug, marker::PhantomData, str::FromStr};
-use api_models::payments::FrmMessage;
+use api_models::payments::{FrmMessage, RequestSurchargeDetails};
use common_utils::{consts::X_HS_LATENCY, fp_utils};
use diesel_models::ephemeral_key;
use error_stack::{IntoReport, ResultExt};
@@ -424,7 +424,13 @@ where
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "payment_method_data",
})?;
-
+ let surcharge_details =
+ payment_attempt
+ .surcharge_amount
+ .map(|surcharge_amount| RequestSurchargeDetails {
+ surcharge_amount,
+ tax_amount: payment_attempt.tax_amount,
+ });
let merchant_decision = payment_intent.merchant_decision.to_owned();
let frm_message = payment_data.frm_message.map(FrmMessage::foreign_from);
@@ -557,6 +563,7 @@ where
.set_amount(payment_attempt.amount)
.set_amount_capturable(Some(payment_attempt.amount_capturable))
.set_amount_received(payment_intent.amount_captured)
+ .set_surcharge_details(surcharge_details)
.set_connector(routed_through)
.set_client_secret(payment_intent.client_secret.map(masking::Secret::new))
.set_created(Some(payment_intent.created_at))
@@ -743,6 +750,7 @@ where
reference_id: payment_attempt.connector_response_reference_id,
attempt_count: payment_intent.attempt_count,
payment_link: payment_link_data,
+ surcharge_details,
..Default::default()
},
headers,
diff --git a/crates/router/src/services/api.rs b/crates/router/src/services/api.rs
index 492a7a51f48..964a70c0b51 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -96,6 +96,14 @@ pub trait ConnectorValidation: ConnectorCommon {
fn is_webhook_source_verification_mandatory(&self) -> bool {
false
}
+
+ fn validate_if_surcharge_implemented(&self) -> CustomResult<(), errors::ConnectorError> {
+ Err(errors::ConnectorError::NotImplemented(format!(
+ "Surcharge not implemented for {}",
+ self.id()
+ ))
+ .into())
+ }
}
#[async_trait::async_trait]
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index e1311bda67b..518aaa2e3d9 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -1181,6 +1181,8 @@ impl DataModelExt for PaymentAttemptUpdate {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
} => DieselPaymentAttemptUpdate::ConfirmUpdate {
amount,
@@ -1199,6 +1201,8 @@ impl DataModelExt for PaymentAttemptUpdate {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
},
Self::VoidUpdate {
@@ -1333,15 +1337,6 @@ impl DataModelExt for PaymentAttemptUpdate {
surcharge_metadata,
updated_by,
},
- Self::SurchargeAmountUpdate {
- surcharge_amount,
- tax_amount,
- updated_by,
- } => DieselPaymentAttemptUpdate::SurchargeAmountUpdate {
- surcharge_amount,
- tax_amount,
- updated_by,
- },
}
}
@@ -1413,6 +1408,8 @@ impl DataModelExt for PaymentAttemptUpdate {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
} => Self::ConfirmUpdate {
amount,
@@ -1431,6 +1428,8 @@ impl DataModelExt for PaymentAttemptUpdate {
error_code,
error_message,
amount_capturable,
+ surcharge_amount,
+ tax_amount,
updated_by,
},
DieselPaymentAttemptUpdate::VoidUpdate {
@@ -1565,15 +1564,6 @@ impl DataModelExt for PaymentAttemptUpdate {
surcharge_metadata,
updated_by,
},
- DieselPaymentAttemptUpdate::SurchargeAmountUpdate {
- surcharge_amount,
- tax_amount,
- updated_by,
- } => Self::SurchargeAmountUpdate {
- surcharge_amount,
- tax_amount,
- updated_by,
- },
}
}
}
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index bacefa4b278..507c1000b32 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -9738,6 +9738,14 @@
"description": "The business profile that is associated with this payment",
"nullable": true
},
+ "surcharge_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RequestSurchargeDetails"
+ }
+ ],
+ "nullable": true
+ },
"attempt_count": {
"type": "integer",
"format": "int32",
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/.meta.json
new file mode 100644
index 00000000000..e6b348a60be
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/.meta.json
@@ -0,0 +1,8 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Confirm",
+ "Payments - Capture",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js
new file mode 100644
index 00000000000..432edf05d37
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/event.test.js
@@ -0,0 +1,116 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "processing" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'",
+ function () {
+ pm.expect(jsonData.status).to.eql("processing");
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("paypal");
+});
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6000);
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount_capturable"
+if (jsonData?.amount_capturable) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 0",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(0);
+ },
+ );
+}
+
+// Response body should have a valid surcharge_details field"
+pm.test("Check if valid 'surcharge_details' is present in the response", function () {
+ pm.response.to.have.jsonBody('surcharge_details');
+ pm.expect(jsonData.surcharge_details.surcharge_amount).to.eql(5);
+ pm.expect(jsonData.surcharge_details.tax_amount).to.eql(5);
+});
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/request.json
new file mode 100644
index 00000000000..9fe257ed85e
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/request.json
@@ -0,0 +1,39 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount_to_capture": 6000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id", "capture"],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/event.test.js
new file mode 100644
index 00000000000..ba5d852e9bd
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/event.test.js
@@ -0,0 +1,116 @@
+// 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.",
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("paypal");
+});
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "null" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 'null'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(null);
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount_capturable"
+if (jsonData?.amount_capturable) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(6550);
+ },
+ );
+}
+
+// Response body should have a valid surcharge_details field"
+pm.test("Check if valid 'surcharge_details' is present in the response", function () {
+ pm.response.to.have.jsonBody('surcharge_details');
+ pm.expect(jsonData.surcharge_details.surcharge_amount).to.eql(5);
+ pm.expect(jsonData.surcharge_details.tax_amount).to.eql(5);
+});
\ No newline at end of file
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/request.json
new file mode 100644
index 00000000000..c6098943978
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/request.json
@@ -0,0 +1,60 @@
+{
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "client_secret": "{{client_secret}}",
+ "surcharge_details": {
+ "surcharge_amount": 5,
+ "tax_amount": 5
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id", "confirm"],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "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/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Confirm/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/event.test.js
new file mode 100644
index 00000000000..fe83ca7852a
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/event.test.js
@@ -0,0 +1,101 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_confirmation" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_confirmation");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "null" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 'null'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(null);
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount_capturable"
+if (jsonData?.amount_capturable) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 6540'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(6540);
+ },
+ );
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json
new file mode 100644
index 00000000000..b080ff1a6b9
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/request.json
@@ -0,0 +1,87 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": false,
+ "capture_method": "manual",
+ "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://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4005519200000004",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "PiX"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "routing": {
+ "type": "single",
+ "data": "paypal"
+ }
+ }
+ },
+ "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/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/.event.meta.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/.event.meta.json
new file mode 100644
index 00000000000..0731450e6b2
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js
new file mode 100644
index 00000000000..5097d1cf94a
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/event.test.js
@@ -0,0 +1,113 @@
+// 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 "processing" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'processing'",
+ function () {
+ pm.expect(jsonData.status).to.eql("processing");
+ },
+ );
+}
+
+// Validate the connector
+pm.test("[POST]::/payments - connector", function () {
+ pm.expect(jsonData.connector).to.eql("paypal");
+});
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6000);
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount_capturable"
+if (jsonData?.amount_capturable) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'",
+ function () {
+ pm.expect(jsonData.amount_capturable).to.eql(540);
+ },
+ );
+}
+
+// Response body should have a valid surcharge_details field"
+pm.test("Check if valid 'surcharge_details' is present in the response", function () {
+ pm.response.to.have.jsonBody('surcharge_details');
+ pm.expect(jsonData.surcharge_details.surcharge_amount).to.eql(5);
+ pm.expect(jsonData.surcharge_details.tax_amount).to.eql(5);
+});
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/request.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/request.json
new file mode 100644
index 00000000000..6cd4b7d96c5
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id"],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/response.json b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/response.json
new file mode 100644
index 00000000000..fe51488c706
--- /dev/null
+++ b/postman/collection-dir/paypal/Flow Testcases/Happy Cases/Scenario8-Create payment with Manual capture with confirm false and surcharge_data/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/paypal/Flow Testcases/QuickStart/Merchant Account - Create/request.json b/postman/collection-dir/paypal/Flow Testcases/QuickStart/Merchant Account - Create/request.json
index 7df5315150c..5aa155f64c3 100644
--- a/postman/collection-dir/paypal/Flow Testcases/QuickStart/Merchant Account - Create/request.json
+++ b/postman/collection-dir/paypal/Flow Testcases/QuickStart/Merchant Account - Create/request.json
@@ -79,6 +79,10 @@
"metadata": {
"city": "NY",
"unit": "245"
+ },
+ "routing_algorithm": {
+ "type": "single",
+ "data": "paypal"
}
}
},
|
feat
|
update surcharge_amount and tax_amount in update_trackers of payment_confirm (#2603)
|
c3333894ce64b1bc694f8c1eb09a8744aa850443
|
2025-01-30 05:59:54
|
github-actions
|
chore(version): 2025.01.30.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2bcd929bcbf..e571e3eac1d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,25 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2025.01.30.0
+
+### Features
+
+- **connector:** Add template code for chargebee ([#7036](https://github.com/juspay/hyperswitch/pull/7036)) ([`ad5491f`](https://github.com/juspay/hyperswitch/commit/ad5491f15bd8f61b2a918f584fe85132986176ad))
+- **router:** Add accept-language from request headers into browser-info ([#7074](https://github.com/juspay/hyperswitch/pull/7074)) ([`5381eb9`](https://github.com/juspay/hyperswitch/commit/5381eb992228164b552260c7ebb8a4cdbc1b3cb3))
+
+### Refactors
+
+- **euclid:** Update proto file for elimination routing ([#7032](https://github.com/juspay/hyperswitch/pull/7032)) ([`275958a`](https://github.com/juspay/hyperswitch/commit/275958af14d0eb4385c995308fbf958c6b620e4f))
+
+### Miscellaneous Tasks
+
+- Run clippy with default number of jobs in github workflows ([#7088](https://github.com/juspay/hyperswitch/pull/7088)) ([`337095b`](https://github.com/juspay/hyperswitch/commit/337095bce8c57be9a9a2ff8356ca9b70917b9851))
+
+**Full Changelog:** [`2025.01.29.0...2025.01.30.0`](https://github.com/juspay/hyperswitch/compare/2025.01.29.0...2025.01.30.0)
+
+- - -
+
## 2025.01.29.0
### Bug Fixes
|
chore
|
2025.01.30.0
|
cf145a321c4c797f0efa44f846f19048ea69e7ec
|
2023-07-20 01:56:07
|
Nishant Joshi
|
feat(metrics): add pod information in metrics pipeline (#1710)
| false
|
diff --git a/crates/router_env/src/logger/setup.rs b/crates/router_env/src/logger/setup.rs
index 7fafca3bc61..02f92573044 100644
--- a/crates/router_env/src/logger/setup.rs
+++ b/crates/router_env/src/logger/setup.rs
@@ -196,6 +196,13 @@ fn setup_metrics_pipeline(config: &config::LogTelemetry) -> Option<BasicControll
.with_exporter(get_opentelemetry_exporter(config))
.with_period(Duration::from_secs(3))
.with_timeout(Duration::from_secs(10))
+ .with_resource(Resource::new(vec![KeyValue::new(
+ "pod",
+ std::env::var("POD_NAME").map_or(
+ "hyperswitch-server-default".into(),
+ Into::<opentelemetry::Value>::into,
+ ),
+ )]))
.build();
if config.ignore_errors {
|
feat
|
add pod information in metrics pipeline (#1710)
|
a1788b8da942f0e32a80b37eac4eecece2bef77d
|
2024-06-03 16:37:37
|
DEEPANSHU BANSAL
|
feat(connector): [AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment (#4841)
| false
|
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index b281d0a0a77..15aedad7599 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1,16 +1,15 @@
use common_utils::{
errors::CustomResult,
ext_traits::{Encode, ValueExt},
- id_type, pii,
};
use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret, StrongSecret};
+use rand::distributions::{Alphanumeric, DistString};
use serde::{Deserialize, Serialize};
use crate::{
connector::utils::{
- self, missing_field_err, CardData, PaymentsSyncRequestData, RefundsRequestData, RouterData,
- WalletData,
+ self, CardData, PaymentsSyncRequestData, RefundsRequestData, RouterData, WalletData,
},
core::errors,
services,
@@ -179,7 +178,7 @@ struct PaymentProfileDetails {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CustomerDetails {
- id: id_type::CustomerId,
+ id: String,
}
#[derive(Debug, Serialize)]
@@ -273,10 +272,7 @@ pub struct AuthorizedotnetZeroMandateRequest {
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct Profile {
- merchant_customer_id: id_type::CustomerId,
- #[serde(skip_serializing_if = "Option::is_none")]
- description: Option<String>,
- email: Option<pii::Email>,
+ description: String,
payment_profiles: PaymentProfiles,
}
@@ -318,12 +314,8 @@ impl TryFrom<&types::SetupMandateRouterData> for CreateCustomerProfileRequest {
create_customer_profile_request: AuthorizedotnetZeroMandateRequest {
merchant_authentication,
profile: Profile {
- merchant_customer_id: item
- .customer_id
- .clone()
- .ok_or_else(missing_field_err("customer_id"))?,
- description: item.description.clone(),
- email: item.request.email.clone(),
+ //The payment ID is included in the description because the connector requires unique description when creating a mandate.
+ description: item.payment_id.clone(),
payment_profiles: PaymentProfiles {
customer_type: CustomerType::Individual,
payment: PaymentDetails::CreditCard(CreditCardDetails {
@@ -393,16 +385,18 @@ impl<F, T>
response: Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::NoResponseId,
redirection_data: None,
- mandate_reference: item.response.customer_profile_id.map(|mandate_id| {
- types::MandateReference {
- connector_mandate_id: Some(mandate_id),
- payment_method_id: item
+ mandate_reference: item.response.customer_profile_id.map(
+ |customer_profile_id| types::MandateReference {
+ connector_mandate_id: item
.response
.customer_payment_profile_id_list
.first()
- .cloned(),
- }
- }),
+ .map(|payment_profile_id| {
+ format!("{customer_profile_id}-{payment_profile_id}")
+ }),
+ payment_method_id: None,
+ },
+ ),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
@@ -635,27 +629,24 @@ impl
api_models::payments::ConnectorMandateReferenceId,
),
) -> Result<Self, Self::Error> {
+ let mandate_id = connector_mandate_id
+ .connector_mandate_id
+ .ok_or(errors::ConnectorError::MissingConnectorMandateID)?;
Ok(Self {
transaction_type: TransactionType::try_from(item.router_data.request.capture_method)?,
amount: item.amount,
currency_code: item.router_data.request.currency,
payment: None,
- profile: Some(ProfileDetails::CustomerProfileDetails(
- CustomerProfileDetails {
- customer_profile_id: Secret::from(
- connector_mandate_id
- .connector_mandate_id
- .ok_or(errors::ConnectorError::MissingConnectorMandateID)?,
- ),
- payment_profile: PaymentProfileDetails {
- payment_profile_id: Secret::from(
- connector_mandate_id
- .payment_method_id
- .ok_or(errors::ConnectorError::MissingConnectorMandateID)?,
- ),
- },
- },
- )),
+ profile: mandate_id
+ .split_once('-')
+ .map(|(customer_profile_id, payment_profile_id)| {
+ ProfileDetails::CustomerProfileDetails(CustomerProfileDetails {
+ customer_profile_id: Secret::from(customer_profile_id.to_string()),
+ payment_profile: PaymentProfileDetails {
+ payment_profile_id: Secret::from(payment_profile_id.to_string()),
+ },
+ })
+ }),
order: Order {
description: item.router_data.connector_request_reference_id.clone(),
},
@@ -709,11 +700,13 @@ impl
create_profile: true,
})),
Some(CustomerDetails {
- id: item
- .router_data
- .customer_id
- .clone()
- .ok_or_else(missing_field_err("customer_id"))?,
+ //The payment ID is included in the customer details because the connector requires unique customer information with a length of fewer than 20 characters when creating a mandate.
+ //If the length exceeds 20 characters, a random alphanumeric string is used instead.
+ id: if item.router_data.payment_id.len() <= 20 {
+ item.router_data.payment_id.clone()
+ } else {
+ Alphanumeric.sample_string(&mut rand::thread_rng(), 20)
+ },
}),
)
} else {
@@ -1087,6 +1080,24 @@ impl<F, T>
.and_then(|x| x.secure_acceptance_url.to_owned());
let redirection_data =
url.map(|url| services::RedirectForm::from((url, services::Method::Get)));
+ let mandate_reference = item.response.profile_response.map(|profile_response| {
+ let payment_profile_id = profile_response
+ .customer_payment_profile_id_list
+ .and_then(|customer_payment_profile_id_list| {
+ customer_payment_profile_id_list.first().cloned()
+ });
+ types::MandateReference {
+ connector_mandate_id: profile_response.customer_profile_id.and_then(
+ |customer_profile_id| {
+ payment_profile_id.map(|payment_profile_id| {
+ format!("{customer_profile_id}-{payment_profile_id}")
+ })
+ },
+ ),
+ payment_method_id: None,
+ }
+ });
+
Ok(Self {
status,
response: match error {
@@ -1096,16 +1107,7 @@ impl<F, T>
transaction_response.transaction_id.clone(),
),
redirection_data,
- mandate_reference: item.response.profile_response.map(
- |profile_response| types::MandateReference {
- connector_mandate_id: profile_response.customer_profile_id,
- payment_method_id: profile_response
- .customer_payment_profile_id_list
- .and_then(|customer_payment_profile_id_list| {
- customer_payment_profile_id_list.first().cloned()
- }),
- },
- ),
+ mandate_reference,
connector_metadata: metadata,
network_txn_id: transaction_response
.network_trans_id
|
feat
|
[AUTHORIZEDOTNET] Support payment_method_id in recurring mandate payment (#4841)
|
e721b06c7077e00458450a4fb98f4497e8227dc6
|
2023-11-23 00:59:56
|
Kaustubh Sharma
|
refactor(connector): [Worldline] change error message from NotSupported to NotImplemented (#2893)
| false
|
diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs
index 6cb8862f69b..049453e325a 100644
--- a/crates/router/src/connector/worldline/transformers.rs
+++ b/crates/router/src/connector/worldline/transformers.rs
@@ -306,10 +306,9 @@ impl TryFrom<utils::CardIssuer> for Gateway {
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: "worldline",
- }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("worldline"),
+ )
.into()),
}
}
|
refactor
|
[Worldline] change error message from NotSupported to NotImplemented (#2893)
|
c3361ef5ebed09b24df73221faaa6d6178fda070
|
2024-04-16 15:31:28
|
Apoorv Dixit
|
feat(payments): get new filters for payments list (#4174)
| false
|
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 10a68ef1a44..623abca8143 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -518,6 +518,12 @@ pub struct MerchantConnectorWebhookDetails {
pub additional_secret: Option<Secret<String>>,
}
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+pub struct MerchantConnectorInfo {
+ pub connector_label: String,
+ pub merchant_connector_id: String,
+}
+
/// Response of creating a new Merchant Connector for the merchant account."
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs
index b26ee0ae68e..b27ca142c94 100644
--- a/crates/api_models/src/events/payment.rs
+++ b/crates/api_models/src/events/payment.rs
@@ -9,8 +9,8 @@ use crate::{
},
payments::{
PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints, PaymentListFilters,
- PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelRequest,
- PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
+ PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2, PaymentsApproveRequest,
+ PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, PaymentsRetrieveRequest,
PaymentsStartRequest, RedirectionResponse,
@@ -158,6 +158,11 @@ impl ApiEventMetric for PaymentListFilters {
Some(ApiEventsType::ResourceListAPI)
}
}
+impl ApiEventMetric for PaymentListFiltersV2 {
+ fn get_api_event_type(&self) -> Option<ApiEventsType> {
+ Some(ApiEventsType::ResourceListAPI)
+ }
+}
impl ApiEventMetric for PaymentListConstraints {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 7e53e214075..a632933ea02 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1,4 +1,8 @@
-use std::{collections::HashMap, fmt, num::NonZeroI64};
+use std::{
+ collections::{HashMap, HashSet},
+ fmt,
+ num::NonZeroI64,
+};
use cards::CardNumber;
use common_utils::{
@@ -19,8 +23,11 @@ use url::Url;
use utoipa::ToSchema;
use crate::{
- admin, disputes, enums as api_enums, ephemeral_key::EphemeralKeyCreateResponse,
- mandates::RecurringDetails, refunds,
+ admin::{self, MerchantConnectorInfo},
+ disputes, enums as api_enums,
+ ephemeral_key::EphemeralKeyCreateResponse,
+ mandates::RecurringDetails,
+ refunds,
};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@@ -3419,6 +3426,20 @@ pub struct PaymentListFilters {
pub authentication_type: Vec<enums::AuthenticationType>,
}
+#[derive(Clone, Debug, serde::Serialize)]
+pub struct PaymentListFiltersV2 {
+ /// The list of available connector filters
+ pub connector: HashMap<String, Vec<MerchantConnectorInfo>>,
+ /// The list of available currency filters
+ pub currency: Vec<enums::Currency>,
+ /// The list of available payment status filters
+ pub status: Vec<enums::IntentStatus>,
+ /// The list payment method and their corresponding types
+ pub payment_method: HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,
+ /// The list of available authentication types
+ pub authentication_type: Vec<enums::AuthenticationType>,
+}
+
#[derive(
Debug, Clone, Copy, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash, ToSchema,
)]
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index ae8f49c759d..9dbe5f4f4bc 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -1153,6 +1153,7 @@ pub enum MerchantStorageScheme {
serde::Deserialize,
serde::Serialize,
strum::Display,
+ strum::EnumIter,
strum::EnumString,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 4c087671a29..f0a30fbe662 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -11,8 +11,12 @@ pub mod tokenization;
pub mod transformers;
pub mod types;
+#[cfg(feature = "olap")]
+use std::collections::{HashMap, HashSet};
use std::{fmt::Debug, marker::PhantomData, ops::Deref, time::Instant, vec::IntoIter};
+#[cfg(feature = "olap")]
+use api_models::admin::MerchantConnectorInfo;
use api_models::{
self, enums,
mandates::RecurringDetails,
@@ -33,6 +37,8 @@ use router_env::{instrument, tracing};
#[cfg(feature = "olap")]
use router_types::transformers::ForeignFrom;
use scheduler::utils as pt_utils;
+#[cfg(feature = "olap")]
+use strum::IntoEnumIterator;
use time;
pub use self::operations::{
@@ -2619,6 +2625,89 @@ pub async fn get_filters_for_payments(
))
}
+#[cfg(feature = "olap")]
+pub async fn get_payment_filters(
+ state: AppState,
+ merchant: domain::MerchantAccount,
+) -> RouterResponse<api::PaymentListFiltersV2> {
+ let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
+ super::admin::list_payment_connectors(state, merchant.merchant_id).await?
+ {
+ data
+ } else {
+ return Err(errors::ApiErrorResponse::InternalServerError.into());
+ };
+
+ let mut connector_map: HashMap<String, Vec<MerchantConnectorInfo>> = HashMap::new();
+ let mut payment_method_types_map: HashMap<
+ enums::PaymentMethod,
+ HashSet<enums::PaymentMethodType>,
+ > = HashMap::new();
+
+ // populate connector map
+ merchant_connector_accounts
+ .iter()
+ .filter_map(|merchant_connector_account| {
+ merchant_connector_account
+ .connector_label
+ .as_ref()
+ .map(|label| {
+ let info = MerchantConnectorInfo {
+ connector_label: label.clone(),
+ merchant_connector_id: merchant_connector_account
+ .merchant_connector_id
+ .clone(),
+ };
+ (merchant_connector_account.connector_name.clone(), info)
+ })
+ })
+ .for_each(|(connector_name, info)| {
+ connector_map
+ .entry(connector_name.clone())
+ .or_default()
+ .push(info);
+ });
+
+ // populate payment method type map
+ merchant_connector_accounts
+ .iter()
+ .flat_map(|merchant_connector_account| {
+ merchant_connector_account.payment_methods_enabled.as_ref()
+ })
+ .map(|payment_methods_enabled| {
+ payment_methods_enabled
+ .iter()
+ .filter_map(|payment_method_enabled| {
+ payment_method_enabled
+ .payment_method_types
+ .as_ref()
+ .map(|types_vec| (payment_method_enabled.payment_method, types_vec.clone()))
+ })
+ })
+ .for_each(|payment_methods_enabled| {
+ payment_methods_enabled.for_each(|(payment_method, payment_method_types_vec)| {
+ payment_method_types_map
+ .entry(payment_method)
+ .or_default()
+ .extend(
+ payment_method_types_vec
+ .iter()
+ .map(|p| p.payment_method_type),
+ );
+ });
+ });
+
+ Ok(services::ApplicationResponse::Json(
+ api::PaymentListFiltersV2 {
+ connector: connector_map,
+ currency: enums::Currency::iter().collect(),
+ status: enums::IntentStatus::iter().collect(),
+ payment_method: payment_method_types_map,
+ authentication_type: enums::AuthenticationType::iter().collect(),
+ },
+ ))
+}
+
pub async fn add_process_sync_task(
db: &dyn StorageInterface,
payment_attempt: &storage::PaymentAttempt,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 74bb8bbc242..3bc68ff79b5 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -318,6 +318,7 @@ impl Payments {
.route(web::post().to(payments_list_by_filter)),
)
.service(web::resource("/filter").route(web::post().to(get_filters_for_payments)))
+ .service(web::resource("/filter_v2").route(web::get().to(get_payment_filters)))
}
#[cfg(feature = "oltp")]
{
diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs
index 56df8b171c4..d9887ac0342 100644
--- a/crates/router/src/routes/lock_utils.rs
+++ b/crates/router/src/routes/lock_utils.rs
@@ -114,6 +114,7 @@ impl From<Flow> for ApiIdentifier {
| Flow::PaymentsSessionToken
| Flow::PaymentsStart
| Flow::PaymentsList
+ | Flow::PaymentsFilters
| Flow::PaymentsRedirect
| Flow::PaymentsIncrementalAuthorization
| Flow::PaymentsExternalAuthentication
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index ac45228f90d..c3331817784 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -959,6 +959,29 @@ pub async fn get_filters_for_payments(
.await
}
+#[instrument(skip_all, fields(flow = ?Flow::PaymentsFilters))]
+#[cfg(feature = "olap")]
+pub async fn get_payment_filters(
+ state: web::Data<app::AppState>,
+ req: actix_web::HttpRequest,
+) -> impl Responder {
+ let flow = Flow::PaymentsFilters;
+ api::server_wrap(
+ flow,
+ state,
+ &req,
+ (),
+ |state, auth, _, _| payments::get_payment_filters(state, auth.merchant_account),
+ auth::auth_type(
+ &auth::ApiKeyAuth,
+ &auth::JWTAuth(Permission::PaymentRead),
+ req.headers(),
+ ),
+ api_locking::LockAction::NotApplicable,
+ )
+ .await
+}
+
#[cfg(feature = "oltp")]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsApprove, payment_id))]
// #[post("/{payment_id}/approve")]
diff --git a/crates/router/src/types/api/payments.rs b/crates/router/src/types/api/payments.rs
index 370e0ca3509..4fc3fb44521 100644
--- a/crates/router/src/types/api/payments.rs
+++ b/crates/router/src/types/api/payments.rs
@@ -3,10 +3,10 @@ pub use api_models::payments::{
CryptoData, CustomerAcceptance, HeaderPayload, MandateAmountData, MandateData,
MandateTransactionType, MandateType, MandateValidationFields, NextActionType, OnlineMandate,
PayLaterData, PaymentIdType, PaymentListConstraints, PaymentListFilterConstraints,
- PaymentListFilters, PaymentListResponse, PaymentListResponseV2, PaymentMethodData,
- PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp, PaymentRetrieveBody,
- PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest, PaymentsCancelRequest,
- PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
+ PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, PaymentListResponseV2,
+ PaymentMethodData, PaymentMethodDataRequest, PaymentMethodDataResponse, PaymentOp,
+ PaymentRetrieveBody, PaymentRetrieveBodyWithCredentials, PaymentsApproveRequest,
+ PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsExternalAuthenticationRequest,
PaymentsIncrementalAuthorizationRequest, PaymentsRedirectRequest, PaymentsRedirectionResponse,
PaymentsRejectRequest, PaymentsRequest, PaymentsResponse, PaymentsResponseForm,
PaymentsRetrieveRequest, PaymentsSessionRequest, PaymentsSessionResponse, PaymentsStartRequest,
diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs
index 06667f96bb3..240bf379f6c 100644
--- a/crates/router_env/src/logger/types.rs
+++ b/crates/router_env/src/logger/types.rs
@@ -151,6 +151,8 @@ pub enum Flow {
PaymentsStart,
/// Payments list flow.
PaymentsList,
+ // Payments filters flow
+ PaymentsFilters,
#[cfg(feature = "payouts")]
/// Payouts create flow
PayoutsCreate,
|
feat
|
get new filters for payments list (#4174)
|
87ceb2d208ed1d799d77bfd999b1297f2789627e
|
2023-09-12 14:17:10
|
Pa1NarK
|
ci(postman): Update trustpay cards for postman and bluesnap creds (#2117)
| false
|
diff --git a/.github/secrets/connector_auth.toml.gpg b/.github/secrets/connector_auth.toml.gpg
index 85a17bcb931..3ea1fd8cadb 100644
Binary files a/.github/secrets/connector_auth.toml.gpg and b/.github/secrets/connector_auth.toml.gpg differ
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
index 96725cc3586..4968685339c 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario1-Create payment with confirm true/Payments - Create/request.json
@@ -36,7 +36,7 @@
"payment_method_type": "credit",
"payment_method_data": {
"card": {
- "card_number": "4200000000000000",
+ "card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
index d1098a46b1f..7186bddbe07 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario2-Create payment with confirm false/Payments - Create/request.json
@@ -35,7 +35,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "4200000000000000",
+ "card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
index 0f8d2784587..128505cc7b2 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario3-Create payment without PMD/Payments - Confirm/request.json
@@ -33,7 +33,7 @@
"payment_method": "card",
"payment_method_data": {
"card": {
- "card_number": "4200000000000000",
+ "card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
diff --git a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
index 6818c6c37ef..ccfdf513db5 100644
--- a/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
+++ b/postman/collection-dir/trustpay/Flow Testcases/Happy Cases/Scenario5-Create 3DS payment with confrm false/Payments - Confirm/request.json
@@ -22,7 +22,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": "",
|
ci
|
Update trustpay cards for postman and bluesnap creds (#2117)
|
e6d626d334467df8cbf36266554b89adde12daea
|
2025-03-03 20:05:56
|
Sanchith Hegde
|
chore(docker): prefix Hyperswitch Docker image URIs with `docker.juspay.io` (#7368)
| false
|
diff --git a/aws/hyperswitch_aws_setup.sh b/aws/hyperswitch_aws_setup.sh
index e3af286a58d..d6204b44f4d 100644
--- a/aws/hyperswitch_aws_setup.sh
+++ b/aws/hyperswitch_aws_setup.sh
@@ -215,7 +215,7 @@ sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
-docker pull juspaydotin/hyperswitch-router:beta
+docker pull docker.juspay.io/juspaydotin/hyperswitch-router:beta
curl https://raw.githubusercontent.com/juspay/hyperswitch/v1.55.0/config/development.toml > production.toml
@@ -265,7 +265,7 @@ echo "ROUTER__SERVER__BASE_URL=\$(curl ifconfig.me)" >> user_data.sh
echo "ROUTER__SECRETS__ADMIN_API_KEY=$ADMIN_API_KEY" >> user_data.sh
echo "EOF" >> user_data.sh
-echo "docker run --env-file .env -p 80:8080 -v \`pwd\`/:/local/config juspaydotin/hyperswitch-router:beta ./router -f /local/config/production.toml
+echo "docker run --env-file .env -p 80:8080 -v \`pwd\`/:/local/config docker.juspay.io/juspaydotin/hyperswitch-router:beta ./router -f /local/config/production.toml
" >> user_data.sh
echo "Retrieving AWS AMI ID..."
diff --git a/config/deployments/README.md b/config/deployments/README.md
index c807892f1e0..e062dfe19a9 100644
--- a/config/deployments/README.md
+++ b/config/deployments/README.md
@@ -103,7 +103,7 @@ To run the router, you can use the following snippet in the `docker-compose.yml`
```yaml
### Application services
hyperswitch-server:
- image: juspaydotin/hyperswitch-router:latest # This pulls the latest image from Docker Hub. If you wish to use a version without added features (like KMS), you can replace `latest` with `standalone`. However, please note that the standalone version is not recommended for production use.
+ image: docker.juspay.io/juspaydotin/hyperswitch-router:latest # This pulls the latest image from Docker Hub. If you wish to use a version without added features (like KMS), you can replace `latest` with `standalone`. However, please note that the standalone version is not recommended for production use.
command: /local/bin/router --config-path /local/config/deployments/sandbox_release.toml # <--- Change this to the config file that is generated for the environment.
ports:
- "8080:8080"
@@ -115,7 +115,7 @@ To run the producer, you can use the following snippet in the `docker-compose.ym
```yaml
hyperswitch-producer:
- image: juspaydotin/hyperswitch-producer:latest
+ image: docker.juspay.io/juspaydotin/hyperswitch-producer:latest
command: /local/bin/scheduler --config-path /local/config/deployments/producer_sandbox_release.toml # <--- Change this to the config file that is generated for the environment.
volumes:
- ./config:/local/config
@@ -127,7 +127,7 @@ To run the consumer, you can use the following snippet in the `docker-compose.ym
```yaml
hyperswitch-consumer:
- image: juspaydotin/hyperswitch-consumer:latest
+ image: docker.juspay.io/juspaydotin/hyperswitch-consumer:latest
command: /local/bin/scheduler --config-path /local/config/deployments/consumer_sandbox_release.toml # <--- Change this to the config file that is generated for the environment
volumes:
- ./config:/local/config
@@ -139,7 +139,7 @@ To run the drainer, you can use the following snippet in the `docker-compose.yml
```yaml
hyperswitch-drainer:
- image: juspaydotin/hyperswitch-drainer:latest
+ image: docker.juspay.io/juspaydotin/hyperswitch-drainer:latest
command: /local/bin/drainer --config-path /local/config/deployments/drainer.toml
volumes:
- ./config:/local/config
diff --git a/docker-compose-development.yml b/docker-compose-development.yml
index d7a0e365c36..10b67da2ad1 100644
--- a/docker-compose-development.yml
+++ b/docker-compose-development.yml
@@ -316,7 +316,7 @@ services:
- redisinsight_store:/db
hyperswitch-control-center:
- image: juspaydotin/hyperswitch-control-center:latest
+ image: docker.juspay.io/juspaydotin/hyperswitch-control-center:latest
pull_policy: always
networks:
- router_net
diff --git a/docker-compose.yml b/docker-compose.yml
index 4bc08b09f63..ea1ebb3dd12 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -62,7 +62,7 @@ services:
### Application services
hyperswitch-server:
- image: juspaydotin/hyperswitch-router:standalone
+ image: docker.juspay.io/juspaydotin/hyperswitch-router:standalone
pull_policy: always
command: /local/bin/router -f /local/config/docker_compose.toml
ports:
@@ -87,7 +87,7 @@ services:
timeout: 5s
hyperswitch-producer:
- image: juspaydotin/hyperswitch-producer:standalone
+ image: docker.juspay.io/juspaydotin/hyperswitch-producer:standalone
pull_policy: always
command: /local/bin/scheduler -f /local/config/docker_compose.toml
networks:
@@ -105,7 +105,7 @@ services:
logs: "promtail"
hyperswitch-consumer:
- image: juspaydotin/hyperswitch-consumer:standalone
+ image: docker.juspay.io/juspaydotin/hyperswitch-consumer:standalone
pull_policy: always
command: /local/bin/scheduler -f /local/config/docker_compose.toml
networks:
@@ -129,7 +129,7 @@ services:
timeout: 10s
hyperswitch-drainer:
- image: juspaydotin/hyperswitch-drainer:standalone
+ image: docker.juspay.io/juspaydotin/hyperswitch-drainer:standalone
pull_policy: always
command: /local/bin/drainer -f /local/config/docker_compose.toml
deploy:
@@ -176,7 +176,7 @@ services:
### Control Center
hyperswitch-control-center:
- image: juspaydotin/hyperswitch-control-center:latest
+ image: docker.juspay.io/juspaydotin/hyperswitch-control-center:latest
pull_policy: always
ports:
- "9000:9000"
|
chore
|
prefix Hyperswitch Docker image URIs with `docker.juspay.io` (#7368)
|
53cc9db9314a1205c90d59a83d42eb9c64ccfe90
|
2024-02-22 05:48:49
|
github-actions
|
chore(version): 2024.02.22.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 68013d44278..c3fd59e533f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,32 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.02.22.0
+
+### Features
+
+- **authz:** Add custom role checks in authorization ([#3719](https://github.com/juspay/hyperswitch/pull/3719)) ([`ada6a32`](https://github.com/juspay/hyperswitch/commit/ada6a3227616b556a0fb710302434027ff2276f4))
+- **connector:**
+ - [adyen] Use connector_response_reference_id as reference to merchant ([#3688](https://github.com/juspay/hyperswitch/pull/3688)) ([`f3b90ee`](https://github.com/juspay/hyperswitch/commit/f3b90ee17f35253dd39d3e2723f8b56d416fd6e3))
+ - [Adyen] populate connector_transaction_id for Adyen Payment Response ([#3727](https://github.com/juspay/hyperswitch/pull/3727)) ([`deec8b4`](https://github.com/juspay/hyperswitch/commit/deec8b4eb5493b072eaef0352a735748979cd95d))
+- **invite_multiple:** Set status of user as `InvitationSent` if `email` feature flag is enabled ([#3757](https://github.com/juspay/hyperswitch/pull/3757)) ([`ef5e886`](https://github.com/juspay/hyperswitch/commit/ef5e886ab1abdf50254343be8c6c48100ec2ec2d))
+- **users:** Send email to user if the user already exists ([#3705](https://github.com/juspay/hyperswitch/pull/3705)) ([`9725223`](https://github.com/juspay/hyperswitch/commit/97252237a9c7aa1cb5e7fa15f7ccb5c365b70b85))
+
+### Bug Fixes
+
+- **core:** Validate capture method before update trackers ([#3715](https://github.com/juspay/hyperswitch/pull/3715)) ([`5952017`](https://github.com/juspay/hyperswitch/commit/5952017260180f0b52f989b60ff678868267a634))
+- **users:** Fix wrong email content in invite users ([#3625](https://github.com/juspay/hyperswitch/pull/3625)) ([`e139731`](https://github.com/juspay/hyperswitch/commit/e139731761387e9f00546815e260287ed600cc6e))
+
+### Refactors
+
+- **core:** Inclusion of locker to store fingerprints ([#3630](https://github.com/juspay/hyperswitch/pull/3630)) ([`7b0bce5`](https://github.com/juspay/hyperswitch/commit/7b0bce555845c6d1187c97a921342fe129b6acba))
+- **permissions:** Remove permissions for utility APIs ([#3730](https://github.com/juspay/hyperswitch/pull/3730)) ([`4ae28e4`](https://github.com/juspay/hyperswitch/commit/4ae28e48cd73a9f96b6ae24babf167824fd182a0))
+- **scheduler:** Improve code reusability and consumer logs ([#3712](https://github.com/juspay/hyperswitch/pull/3712)) ([`7c63c76`](https://github.com/juspay/hyperswitch/commit/7c63c76011cec5fb398cff90b6237578c132b87d))
+
+**Full Changelog:** [`2024.02.21.0...2024.02.22.0`](https://github.com/juspay/hyperswitch/compare/2024.02.21.0...2024.02.22.0)
+
+- - -
+
## 2024.02.21.0
### Features
|
chore
|
2024.02.22.0
|
6eabc824d6ffb65562499943676820157efabb84
|
2024-12-23 19:42:00
|
chikke srujan
|
fix(wasm): fix feature dependencies in `connector_configs` crate for WASM builds (#6832)
| false
|
diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml
index f8728968098..84be33529db 100644
--- a/crates/connector_configs/Cargo.toml
+++ b/crates/connector_configs/Cargo.toml
@@ -9,9 +9,8 @@ license.workspace = true
[features]
default = ["payouts", "dummy_connector"]
production = []
-development = []
sandbox = []
-dummy_connector = ["api_models/dummy_connector", "development"]
+dummy_connector = ["api_models/dummy_connector"]
payouts = ["api_models/payouts"]
v1 = ["api_models/v1", "common_utils/v1"]
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 985a6d7b547..69ecc358c83 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -7,7 +7,6 @@ use api_models::{
payments,
};
use serde::Deserialize;
-#[cfg(any(feature = "sandbox", feature = "development", feature = "production"))]
use toml;
use crate::common_config::{CardProvider, InputData, Provider, ZenApplePay};
@@ -254,25 +253,14 @@ pub struct ConnectorConfig {
impl ConnectorConfig {
fn new() -> Result<Self, String> {
- #[cfg(all(
- feature = "production",
- not(any(feature = "sandbox", feature = "development"))
- ))]
- let config = toml::from_str::<Self>(include_str!("../toml/production.toml"));
- #[cfg(all(
- feature = "sandbox",
- not(any(feature = "production", feature = "development"))
- ))]
- let config = toml::from_str::<Self>(include_str!("../toml/sandbox.toml"));
- #[cfg(feature = "development")]
- let config = toml::from_str::<Self>(include_str!("../toml/development.toml"));
-
- #[cfg(not(any(feature = "sandbox", feature = "development", feature = "production")))]
- return Err(String::from(
- "Atleast one features has to be enabled for connectorconfig",
- ));
-
- #[cfg(any(feature = "sandbox", feature = "development", feature = "production"))]
+ let config_str = if cfg!(feature = "production") {
+ include_str!("../toml/production.toml")
+ } else if cfg!(feature = "sandbox") {
+ include_str!("../toml/sandbox.toml")
+ } else {
+ include_str!("../toml/development.toml")
+ };
+ let config = toml::from_str::<Self>(config_str);
match config {
Ok(data) => Ok(data),
Err(err) => Err(err.to_string()),
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 7216d4f7890..b67f1a20ba2 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -2935,9 +2935,6 @@ merchant_secret="Source verification key"
api_key="API Key"
[zen.connector_webhook_details]
merchant_secret="Source verification key"
-[zen.metadata.apple_pay]
-terminal_uuid="Terminal UUID"
-pay_wall_secret="Pay Wall Secret"
[[zen.metadata.apple_pay]]
name="terminal_uuid"
@@ -2976,11 +2973,6 @@ key1 = "Merchant ID"
[netcetera.connector_auth.CertificateAuth]
certificate="Base64 encoded PEM formatted certificate chain"
private_key="Base64 encoded PEM formatted private key"
-[netcetera.metadata]
-merchant_country_code="3 digit numeric country code"
-merchant_name="Name of the merchant"
-three_ds_requestor_name="ThreeDS requestor name"
-three_ds_requestor_id="ThreeDS request id"
[netcetera.metadata.endpoint_prefix]
name="endpoint_prefix"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 4c6ee7566f3..43380e7ab0c 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -365,8 +365,6 @@ merchant_secret="Source verification key"
[airwallex.connector_auth.BodyKey]
api_key="API Key"
key1="Client ID"
-[airwallex.connector_webhook_details]
-merchant_secret="Source verification key"
[airwallex.connector_webhook_details]
merchant_secret="Source verification key"
@@ -3981,11 +3979,6 @@ type="Toggle"
[netcetera.connector_auth.CertificateAuth]
certificate="Base64 encoded PEM formatted certificate chain"
private_key="Base64 encoded PEM formatted private key"
-[netcetera.metadata]
-merchant_country_code="3 digit numeric country code"
-merchant_name="Name of the merchant"
-three_ds_requestor_name="ThreeDS requestor name"
-three_ds_requestor_id="ThreeDS request id"
[netcetera.metadata.endpoint_prefix]
name="endpoint_prefix"
diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml
index 5df76d08d5e..19c425e4c01 100644
--- a/crates/euclid_wasm/Cargo.toml
+++ b/crates/euclid_wasm/Cargo.toml
@@ -14,7 +14,6 @@ default = ["payouts"]
release = ["payouts"]
dummy_connector = ["kgraph_utils/dummy_connector", "connector_configs/dummy_connector"]
production = ["connector_configs/production"]
-development = ["connector_configs/development"]
sandbox = ["connector_configs/sandbox"]
payouts = ["api_models/payouts", "euclid/payouts"]
v1 = ["api_models/v1", "kgraph_utils/v1"]
|
fix
|
fix feature dependencies in `connector_configs` crate for WASM builds (#6832)
|
ecc97bc8684d57834f62652265316df29cf2cf5d
|
2024-05-03 10:59:13
|
likhinbopanna
|
ci(postman): Remove update_mandate_id test in Cybersource collection (#4526)
| false
|
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json
index 9339372cc71..c5e687f68c9 100644
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json
+++ b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/.meta.json
@@ -22,9 +22,8 @@
"Scenario15-Incremental auth with partial capture",
"Scenario16-Verify PML for mandate",
"Scenario17-Revoke mandates",
- "Scenario18-Update mandate card details",
- "Scenario19-Create 3ds payment",
- "Scenario20-Create 3ds mandate",
- "Scenario21-Create a mandate without customer acceptance"
+ "Scenario18-Create 3ds payment",
+ "Scenario19-Create 3ds mandate",
+ "Scenario20-Create a mandate without customer acceptance"
]
}
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/Scenario18-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/Scenario18-Create 3ds payment/.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-Create 3ds payment/Payments - Create/.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-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/Scenario18-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/Scenario18-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/Scenario18-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/Scenario18-Create 3ds payment/Payments - Create/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-Create 3ds payment/Payments - Create/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-Create 3ds payment/Payments - Create/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-Create 3ds payment/Payments - Retrieve/.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-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/Scenario18-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/Scenario18-Create 3ds payment/Payments - Retrieve/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-Create 3ds payment/Payments - Retrieve/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-Create 3ds payment/Payments - Retrieve/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-Create 3ds payment/Payments - Retrieve/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-Create 3ds payment/Payments - Retrieve/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
deleted file mode 100644
index 20ac234bf99..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/.meta.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "childrenOrder": [
- "Payments - Create",
- "Payments - Retrieve",
- "List - Mandates",
- "Mandate - Update",
- "List - Mandates-copy",
- "Recurring Payments - Create",
- "Payments - Retrieve-copy"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js
deleted file mode 100644
index 0d07a384aed..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/event.test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-
-// Response body should have value "active" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'active'",
- function () {
- pm.expect(jsonData.status).to.eql("active");
- },
- );
-}
-
-pm.test("[POST]::/payments - Verify last 4 digits of the card", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.last4_digits).to.eql("1111");
-});
-
-pm.test("[POST]::/payments - Verify card expiration month", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.card_exp_month).to.eql("12");
-});
-
-pm.test("[POST]::/payments - Verify card expiration year", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.card_exp_year).to.eql("30");
-});
-
-
-
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json
deleted file mode 100644
index 349b5117443..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates-copy/request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/mandates/:id",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "mandates",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{mandate_id}}",
- "description": "(Required) Unique mandate id"
- }
- ]
- },
- "description": "To list the details of a mandate"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js
deleted file mode 100644
index 3a7c6c4468b..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/event.test.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-
-// Response body should have value "active" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'active'",
- function () {
- pm.expect(jsonData.status).to.eql("active");
- },
- );
-}
-
-pm.test("[POST]::/payments - Verify last 4 digits of the card", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.last4_digits).to.eql("4242");
-});
-
-pm.test("[POST]::/payments - Verify card expiration month", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.card_exp_month).to.eql("10");
-});
-
-pm.test("[POST]::/payments - Verify card expiration year", function () {
- var jsonData = pm.response.json();
- pm.expect(jsonData.card.card_exp_year).to.eql("25");
-});
-
-
-
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json
deleted file mode 100644
index 349b5117443..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/List - Mandates/request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/mandates/:id",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "mandates",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{mandate_id}}",
- "description": "(Required) Unique mandate id"
- }
- ]
- },
- "description": "To list the details of a mandate"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js
deleted file mode 100644
index 13d57327d21..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/event.test.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/payments - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
-if (jsonData?.mandate_id) {
- pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
- console.log(
- "- use {{mandate_id}} as collection variable for value",
- jsonData.mandate_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have "mandate_id"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_id' exists",
- function () {
- pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
- },
-);
-
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json
deleted file mode 100644
index b8a76d3412a..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Mandate - Update/request.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 0,
- "currency": "USD",
- "confirm": true,
- "capture_method": "automatic",
- "capture_on": "2022-09-10T10:11:12Z",
- "customer_id": "{{customer_id}}",
- "email": "[email protected]",
- "name": "John Doe",
- "phone": "999999999",
- "phone_country_code": "+65",
- "description": "Its my first payment request",
- "authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
- "payment_method": "card",
- "payment_method_type": "debit",
- "payment_method_data": {
- "card": {
- "card_number": "4111111111111111",
- "card_exp_month": "12",
- "card_exp_year": "30",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
- "payment_type": "setup_mandate",
- "setup_future_usage": "off_session",
- "mandate_data": {
- "update_mandate_id": "{{mandate_id}}",
- "customer_acceptance": {
- "acceptance_type": "offline",
- "accepted_at": "1963-05-03T04:07:52.723Z",
- "online": {
- "ip_address": "127.0.0.1",
- "user_agent": "amet irure esse"
- }
- }
- },
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS",
- "metadata": {
- "count_tickets": 1,
- "transaction_number": "5590045"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js
deleted file mode 100644
index 29cba989186..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/event.test.js
+++ /dev/null
@@ -1,109 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/payments - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
-if (jsonData?.mandate_id) {
- pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
- console.log(
- "- use {{mandate_id}} as collection variable for value",
- jsonData.mandate_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have "mandate_id"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_id' exists",
- function () {
- pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
- },
-);
-
-// Response body should have "mandate_data"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_data' exists",
- function () {
- pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
- },
-);
-
-if (jsonData?.customer_id) {
- pm.collectionVariables.set("customer_id", jsonData.customer_id);
- console.log(
- "- use {{customer_id}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.",
- );
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json
deleted file mode 100644
index 4a698997169..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Create/request.json
+++ /dev/null
@@ -1,106 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 0,
- "currency": "USD",
- "confirm": true,
- "capture_method": "automatic",
- "capture_on": "2022-09-10T10:11:12Z",
- "customer_id": "customer_{{$randomAbbreviation}}",
- "email": "[email protected]",
- "name": "John Doe",
- "phone": "999999999",
- "phone_country_code": "+65",
- "description": "Its my first payment request",
- "authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
- "payment_method": "card",
- "payment_method_data": {
- "card": {
- "card_number": "4242424242424242",
- "card_exp_month": "10",
- "card_exp_year": "25",
- "card_holder_name": "joseph Doe",
- "card_cvc": "123"
- }
- },
- "payment_type": "setup_mandate",
- "setup_future_usage": "off_session",
- "mandate_data": {
- "customer_acceptance": {
- "acceptance_type": "offline",
- "accepted_at": "1963-05-03T04:07:52.723Z",
- "online": {
- "ip_address": "127.0.0.1",
- "user_agent": "amet irure esse"
- }
- },
- "mandate_type": {
- "single_use": {
- "amount": 7000,
- "currency": "USD"
- }
- }
- },
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS",
- "metadata": {
- "count_tickets": 1,
- "transaction_number": "5590045"
- }
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js
deleted file mode 100644
index 4d0a9b9ca2c..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/event.test.js
+++ /dev/null
@@ -1,87 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Validate if response has JSON Body
-pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
-if (jsonData?.mandate_id) {
- pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
- console.log(
- "- use {{mandate_id}} as collection variable for value",
- jsonData.mandate_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
- );
-}
-
-// Response body should have value "Succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have "mandate_id"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_id' exists",
- function () {
- pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
- },
-);
-
-// Response body should have "mandate_data"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_data' exists",
- function () {
- pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
- },
-);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-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/Scenario19-Create 3ds mandate/.meta.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/Scenario19-Create 3ds mandate/Payments - Create/.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/Scenario19-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/Scenario19-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/Scenario19-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/Scenario19-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/Scenario19-Create 3ds mandate/Payments - Create/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/Scenario19-Create 3ds mandate/Payments - Create/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/Scenario19-Create 3ds mandate/Payments - Create/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/Scenario19-Create 3ds mandate/Payments - Retrieve/.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/Scenario19-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/Scenario19-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/Scenario19-Create 3ds mandate/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/Scenario19-Create 3ds mandate/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/Scenario19-Create 3ds mandate/Payments - Retrieve/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/Scenario19-Create 3ds mandate/Payments - Retrieve/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/Scenario19-Create 3ds mandate/Payments - Retrieve/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
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/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
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
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
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
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
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
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
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create 3ds mandate/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.prerequest.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/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/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/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/Scenario20-Create a mandate without customer acceptance/Payments - Confirm/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/Scenario20-Create a mandate without customer acceptance/Payments - Create/.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/Scenario20-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/event.test.js
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/request.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/request.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Create/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/Scenario20-Create a mandate without customer acceptance/Payments - Create/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/Scenario20-Create a mandate without customer acceptance/Payments - Create/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Payments - Retrieve-copy/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve-copy/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/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 a mandate without customer acceptance/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 a mandate without customer acceptance/Payments - Retrieve/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/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/Scenario20-Create a mandate without customer acceptance/Payments - Retrieve/response.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/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario19-Create 3ds payment/Payments - Create/.event.meta.json
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/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/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
similarity index 100%
rename from postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario18-Update mandate card details/Recurring Payments - Create/event.test.js
rename to postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario20-Create a mandate without customer acceptance/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/Scenario20-Create a mandate without customer acceptance/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/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/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/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/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/Scenario20-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Confirm/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
deleted file mode 100644
index fe8fa706b96..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/event.test.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// Validate status 2xx
-pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Validate if response has JSON Body
-pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "Succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have "mandate_id"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_id' exists",
- function () {
- pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
- },
-);
-
-// Response body should have "mandate_data"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_data' exists",
- function () {
- pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
- },
-);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
deleted file mode 100644
index b9ebc1be4aa..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/request.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve-copy/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json
deleted file mode 100644
index b9ebc1be4aa..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/request.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
- ]
- },
- "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Payments - Retrieve/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
deleted file mode 100644
index 688c85746ef..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/.event.meta.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "eventOrder": [
- "event.test.js"
- ]
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
deleted file mode 100644
index e2ddde7136f..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/event.test.js
+++ /dev/null
@@ -1,95 +0,0 @@
-// Validate status 2xx
-pm.test("[POST]::/payments - Status code is 2xx", function () {
- pm.response.to.be.success;
-});
-
-// Validate if response header has matching content-type
-pm.test("[POST]::/payments - Content-Type is application/json", function () {
- pm.expect(pm.response.headers.get("Content-Type")).to.include(
- "application/json",
- );
-});
-
-// Validate if response has JSON Body
-pm.test("[POST]::/payments - Response has JSON Body", function () {
- pm.response.to.have.jsonBody();
-});
-
-// Set response object as internal variable
-let jsonData = {};
-try {
- jsonData = pm.response.json();
-} catch (e) {}
-
-// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
-if (jsonData?.payment_id) {
- pm.collectionVariables.set("payment_id", jsonData.payment_id);
- console.log(
- "- use {{payment_id}} as collection variable for value",
- jsonData.payment_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
-if (jsonData?.mandate_id) {
- pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
- console.log(
- "- use {{mandate_id}} as collection variable for value",
- jsonData.mandate_id,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
- );
-}
-
-// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
-if (jsonData?.client_secret) {
- pm.collectionVariables.set("client_secret", jsonData.client_secret);
- console.log(
- "- use {{client_secret}} as collection variable for value",
- jsonData.client_secret,
- );
-} else {
- console.log(
- "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
- );
-}
-
-// Response body should have value "succeeded" for "status"
-if (jsonData?.status) {
- pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
- function () {
- pm.expect(jsonData.status).to.eql("succeeded");
- },
- );
-}
-
-// Response body should have "mandate_id"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_id' exists",
- function () {
- pm.expect(typeof jsonData.mandate_id !== "undefined").to.be.true;
- },
-);
-
-// Response body should have "mandate_data"
-pm.test(
- "[POST]::/payments - Content check if 'mandate_data' exists",
- function () {
- pm.expect(typeof jsonData.mandate_data !== "undefined").to.be.true;
- },
-);
-
-// Response body should have "payment_method_data"
-pm.test(
- "[POST]::/payments - Content check if 'payment_method_data' exists",
- function () {
- pm.expect(typeof jsonData.payment_method_data !== "undefined").to.be.true;
- },
-);
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
deleted file mode 100644
index 0ae243421f6..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/request.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "method": "POST",
- "header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw_json_formatted": {
- "amount": 6540,
- "currency": "USD",
- "confirm": true,
- "capture_method": "automatic",
- "capture_on": "2022-09-10T10:11:12Z",
- "amount_to_capture": 6540,
- "customer_id": "{{customer_id}}",
- "email": "[email protected]",
- "name": "John Doe",
- "phone": "999999999",
- "phone_country_code": "+65",
- "description": "Its my first payment request",
- "authentication_type": "no_three_ds",
- "return_url": "https://duck.com",
- "mandate_id": "{{mandate_id}}",
- "off_session": true,
- "shipping": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "billing": {
- "address": {
- "line1": "1467",
- "line2": "Harrison Street",
- "line3": "Harrison Street",
- "city": "San Fransico",
- "state": "California",
- "zip": "94122",
- "country": "US",
- "first_name": "likhin",
- "last_name": "bopanna"
- }
- },
- "statement_descriptor_name": "joseph",
- "statement_descriptor_suffix": "JS"
- }
- },
- "url": {
- "raw": "{{baseUrl}}/payments",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments"
- ]
- },
- "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
-}
diff --git a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json b/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
deleted file mode 100644
index fe51488c706..00000000000
--- a/postman/collection-dir/cybersource/Flow Testcases/Happy Cases/Scenario21-Create a mandate without customer acceptance/Recurring Payments - Create/response.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
|
ci
|
Remove update_mandate_id test in Cybersource collection (#4526)
|
ddc64faf7744cd4254f6ef1d4333b89e659d7a68
|
2025-02-07 06:00:45
|
github-actions
|
chore(version): 2025.02.07.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57524ca4ddd..865d2b7e020 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,36 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2025.02.07.0
+
+### Features
+
+- **connector:** [COINGATE] Add Template PR ([#7052](https://github.com/juspay/hyperswitch/pull/7052)) ([`dddb1b0`](https://github.com/juspay/hyperswitch/commit/dddb1b06bea4ac89d838641508728d2da4326ba1))
+- **core:** Add support for v2 payments get intent using merchant reference id ([#7123](https://github.com/juspay/hyperswitch/pull/7123)) ([`e17ffd1`](https://github.com/juspay/hyperswitch/commit/e17ffd1257adc1618ed60dee81ea1e7df84cb3d5))
+- **router:** Add `organization_id` in authentication table and add it in authentication events ([#7168](https://github.com/juspay/hyperswitch/pull/7168)) ([`f211754`](https://github.com/juspay/hyperswitch/commit/f2117542a7dda4dbfa768fdb24229c113e25c93e))
+- **routing:** Contract based routing integration ([#6761](https://github.com/juspay/hyperswitch/pull/6761)) ([`60ddddf`](https://github.com/juspay/hyperswitch/commit/60ddddf24a1625b8044c095c5d01754022102813))
+
+### Bug Fixes
+
+- **connector:** Handle unexpected error response from bluesnap connector ([#7120](https://github.com/juspay/hyperswitch/pull/7120)) ([`8ae5267`](https://github.com/juspay/hyperswitch/commit/8ae5267b91cfb37b14df1acf5fd7dfc2570b58ce))
+- **dashboard_metadata:** Mask `poc_email` and `data_value` for DashboardMetadata ([#7130](https://github.com/juspay/hyperswitch/pull/7130)) ([`9b1b245`](https://github.com/juspay/hyperswitch/commit/9b1b2455643d7a5744a4084fc1916c84634cb48d))
+
+### Refactors
+
+- **customer:** Return redacted customer instead of error ([#7122](https://github.com/juspay/hyperswitch/pull/7122)) ([`97e9270`](https://github.com/juspay/hyperswitch/commit/97e9270ed4458a24207ea5434d65c54fb4b6237d))
+- **dynamic_fields:** Dynamic fields for Adyen and Stripe, renaming klarnaCheckout, WASM for KlarnaCheckout ([#7015](https://github.com/juspay/hyperswitch/pull/7015)) ([`a6367d9`](https://github.com/juspay/hyperswitch/commit/a6367d92f629ef01cdb73aded8a81d2ba198f38c))
+- **router:** Store `network_transaction_id` for `off_session` payments irrespective of the `is_connector_agnostic_mit_enabled` config ([#7083](https://github.com/juspay/hyperswitch/pull/7083)) ([`f9a4713`](https://github.com/juspay/hyperswitch/commit/f9a4713a60028e26b98143c6296d9969cd090163))
+
+### Miscellaneous Tasks
+
+- **connector:** [Fiuu] log keys in the PSync response ([#7189](https://github.com/juspay/hyperswitch/pull/7189)) ([`c044fff`](https://github.com/juspay/hyperswitch/commit/c044ffff0c47ee5d3ef5f905c3f590fae4ac9a24))
+- **connectors:** [fiuu] update pm_filters for apple pay and google pay ([#7182](https://github.com/juspay/hyperswitch/pull/7182)) ([`2d0ac8d`](https://github.com/juspay/hyperswitch/commit/2d0ac8d46d2ecfd7287b67b646bc0b284ed838a9))
+- **roles:** Remove redundant variant from PermissionGroup ([#6985](https://github.com/juspay/hyperswitch/pull/6985)) ([`775dcc5`](https://github.com/juspay/hyperswitch/commit/775dcc5a4e3b41dd1e4d0e4c47eccca15a8a4b3a))
+
+**Full Changelog:** [`2025.02.06.0...2025.02.07.0`](https://github.com/juspay/hyperswitch/compare/2025.02.06.0...2025.02.07.0)
+
+- - -
+
## 2025.02.06.0
### Features
|
chore
|
2025.02.07.0
|
54ff02d9ddb4cbe2f085f894c833b9800ce8d597
|
2023-05-15 14:52:53
|
AkshayaFoiger
|
feat(connector): [Stripe] Implement Przelewy24 bank redirect (#1111)
| false
|
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index f391f3a3a60..20468627388 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -837,6 +837,24 @@ pub enum BankNames {
VeloBank,
#[serde(rename = "e-transfer Pocztowy24")]
ETransferPocztowy24,
+ PlusBank,
+ EtransferPocztowy24,
+ BankiSpbdzielcze,
+ BankNowyBfgSa,
+ GetinBank,
+ Blik,
+ NoblePay,
+ IdeaBank,
+ EnveloBank,
+ NestPrzelew,
+ MbankMtransfer,
+ Inteligo,
+ PbacZIpko,
+ BnpParibas,
+ BankPekaoSa,
+ VolkswagenBank,
+ AliorBank,
+ Boz,
}
#[derive(
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index a2c6a975d38..fa9f3f108a4 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -654,8 +654,11 @@ pub enum BankRedirectData {
issuer: api_enums::BankNames,
},
Przelewy24 {
- // Shopper Email
- email: Email,
+ //Issuer banks
+ bank_name: Option<api_enums::BankNames>,
+
+ // The billing details for bank redirect
+ billing_details: BankRedirectBilling,
},
Sofort {
/// The billing details for bank redirection
@@ -692,7 +695,10 @@ pub struct SofortBilling {
pub struct BankRedirectBilling {
/// The name for which billing is issued
#[schema(value_type = String, example = "John Doe")]
- pub billing_name: Secret<String>,
+ pub billing_name: Option<Secret<String>>,
+ /// The billing email for bank redirect
+ #[schema(value_type = String, example = "[email protected]")]
+ pub email: Email,
}
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index e09010e88e0..1b0757b86ac 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -236,21 +236,22 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
shopper_result_url: item.request.router_return_url.clone(),
}))
}
- api_models::payments::BankRedirectData::Przelewy24 { email } => {
- PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
- payment_brand: PaymentBrand::Przelewy,
- bank_account_country: None,
- bank_account_bank_name: None,
- bank_account_bic: None,
- bank_account_iban: None,
- billing_country: None,
- merchant_customer_id: None,
- merchant_transaction_id: None,
- customer_email: Some(email.to_owned()),
- shopper_result_url: item.request.router_return_url.clone(),
- }))
- }
+ api_models::payments::BankRedirectData::Przelewy24 {
+ billing_details, ..
+ } => PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
+ payment_brand: PaymentBrand::Przelewy,
+ bank_account_country: None,
+ bank_account_bank_name: None,
+ bank_account_bic: None,
+ bank_account_iban: None,
+ billing_country: None,
+ merchant_customer_id: None,
+ merchant_transaction_id: None,
+ customer_email: Some(billing_details.email.clone()),
+ shopper_result_url: item.request.router_return_url.clone(),
+ })),
+
api_models::payments::BankRedirectData::Interac { email, country } => {
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
payment_brand: PaymentBrand::InteracOnline,
@@ -265,6 +266,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
shopper_result_url: item.request.router_return_url.clone(),
}))
}
+
api_models::payments::BankRedirectData::Trustly { country } => {
PaymentDetails::BankRedirect(Box::new(BankRedirectionPMData {
payment_brand: PaymentBrand::Trustly,
@@ -285,11 +287,13 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AciPaymentsRequest {
shopper_result_url: item.request.router_return_url.clone(),
}))
}
+
_ => Err(errors::ConnectorError::NotImplemented(
"Payment method".to_string(),
))?,
}
}
+
api::PaymentMethodData::Crypto(_)
| api::PaymentMethodData::BankDebit(_)
| api::PaymentMethodData::MandatePayment => {
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index aaae96cab9c..b105a217307 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -194,6 +194,10 @@ pub enum StripeBankName {
#[serde(rename = "payment_method_data[ideal][bank]")]
ideal_bank_name: StripeBankNames,
},
+ Przelewy24 {
+ #[serde(rename = "payment_method_data[p24][bank]")]
+ bank_name: StripeBankNames,
+ },
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -224,6 +228,16 @@ fn get_bank_name(
) => Ok(Some(StripeBankName::Ideal {
ideal_bank_name: StripeBankNames::try_from(bank_name)?,
})),
+ (
+ StripePaymentMethodType::Przelewy24,
+ api_models::payments::BankRedirectData::Przelewy24 { bank_name, .. },
+ ) => Ok(Some(StripeBankName::Przelewy24 {
+ bank_name: StripeBankNames::try_from(&bank_name.ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "bank_name",
+ },
+ )?)?,
+ })),
(StripePaymentMethodType::Sofort | StripePaymentMethodType::Giropay, _) => Ok(None),
_ => Err(errors::ConnectorError::MismatchedPaymentData),
}
@@ -381,6 +395,8 @@ pub enum StripePaymentMethodType {
#[serde(rename = "wechat_pay")]
Wechatpay,
Alipay,
+ #[serde(rename = "p24")]
+ Przelewy24,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
@@ -399,6 +415,7 @@ pub enum StripeBankNames {
BtvVierLanderBank,
Bunq,
CapitalBankGraweGruppeAg,
+ CitiHandlowy,
Dolomitenbank,
EasybankAg,
ErsteBankUndSparkassen,
@@ -426,6 +443,26 @@ pub enum StripeBankNames {
SnsBank,
TriodosBank,
VanLanschot,
+ PlusBank,
+ EtransferPocztowy24,
+ BankiSpbdzielcze,
+ BankNowyBfgSa,
+ GetinBank,
+ Blik,
+ NoblePay,
+ #[serde(rename = "ideabank")]
+ IdeaBank,
+ #[serde(rename = "envelobank")]
+ EnveloBank,
+ NestPrzelew,
+ MbankMtransfer,
+ Inteligo,
+ PbacZIpko,
+ BnpParibas,
+ BankPekaoSa,
+ VolkswagenBank,
+ AliorBank,
+ Boz,
}
impl TryFrom<WebhookEventStatus> for api_models::webhooks::IncomingWebhookEvent {
@@ -463,6 +500,7 @@ impl TryFrom<&api_models::enums::BankNames> for StripeBankNames {
api_models::enums::BankNames::CapitalBankGraweGruppeAg => {
Self::CapitalBankGraweGruppeAg
}
+ api_models::enums::BankNames::Citi => Self::CitiHandlowy,
api_models::enums::BankNames::Dolomitenbank => Self::Dolomitenbank,
api_models::enums::BankNames::EasybankAg => Self::EasybankAg,
api_models::enums::BankNames::ErsteBankUndSparkassen => Self::ErsteBankUndSparkassen,
@@ -470,6 +508,7 @@ impl TryFrom<&api_models::enums::BankNames> for StripeBankNames {
api_models::enums::BankNames::HypoAlpeadriabankInternationalAg => {
Self::HypoAlpeadriabankInternationalAg
}
+
api_models::enums::BankNames::HypoNoeLbFurNiederosterreichUWien => {
Self::HypoNoeLbFurNiederosterreichUWien
}
@@ -500,6 +539,25 @@ impl TryFrom<&api_models::enums::BankNames> for StripeBankNames {
api_models::enums::BankNames::VolksbankGruppe => Self::VolksbankGruppe,
api_models::enums::BankNames::VolkskreditbankAg => Self::VolkskreditbankAg,
api_models::enums::BankNames::VrBankBraunau => Self::VrBankBraunau,
+ api_models::enums::BankNames::PlusBank => Self::PlusBank,
+ api_models::enums::BankNames::EtransferPocztowy24 => Self::EtransferPocztowy24,
+ api_models::enums::BankNames::BankiSpbdzielcze => Self::BankiSpbdzielcze,
+ api_models::enums::BankNames::BankNowyBfgSa => Self::BankNowyBfgSa,
+ api_models::enums::BankNames::GetinBank => Self::GetinBank,
+ api_models::enums::BankNames::Blik => Self::Blik,
+ api_models::enums::BankNames::NoblePay => Self::NoblePay,
+ api_models::enums::BankNames::IdeaBank => Self::IdeaBank,
+ api_models::enums::BankNames::EnveloBank => Self::EnveloBank,
+ api_models::enums::BankNames::NestPrzelew => Self::NestPrzelew,
+ api_models::enums::BankNames::MbankMtransfer => Self::MbankMtransfer,
+ api_models::enums::BankNames::Inteligo => Self::Inteligo,
+ api_models::enums::BankNames::PbacZIpko => Self::PbacZIpko,
+ api_models::enums::BankNames::BnpParibas => Self::BnpParibas,
+ api_models::enums::BankNames::BankPekaoSa => Self::BankPekaoSa,
+ api_models::enums::BankNames::VolkswagenBank => Self::VolkswagenBank,
+ api_models::enums::BankNames::AliorBank => Self::AliorBank,
+ api_models::enums::BankNames::Boz => Self::Boz,
+
_ => Err(errors::ConnectorError::NotSupported {
message: api_enums::PaymentMethod::BankRedirect.to_string(),
connector: "Stripe",
@@ -569,6 +627,9 @@ fn infer_stripe_bank_redirect_issuer(
Some(storage_models::enums::PaymentMethodType::Sofort) => {
Ok(StripePaymentMethodType::Sofort)
}
+ Some(storage_models::enums::PaymentMethodType::Przelewy24) => {
+ Ok(StripePaymentMethodType::Przelewy24)
+ }
Some(storage_models::enums::PaymentMethodType::Eps) => Ok(StripePaymentMethodType::Eps),
None => Err(errors::ConnectorError::MissingRequiredField {
field_name: "payment_method_type",
@@ -653,19 +714,25 @@ impl TryFrom<&payments::BankRedirectData> for StripeBillingAddress {
payments::BankRedirectData::Eps {
billing_details, ..
} => Ok(Self {
- name: Some(billing_details.billing_name.clone()),
+ name: billing_details.billing_name.clone(),
..Self::default()
}),
payments::BankRedirectData::Giropay {
billing_details, ..
} => Ok(Self {
- name: Some(billing_details.billing_name.clone()),
+ name: billing_details.billing_name.clone(),
..Self::default()
}),
payments::BankRedirectData::Ideal {
billing_details, ..
} => Ok(Self {
- name: Some(billing_details.billing_name.clone()),
+ name: billing_details.billing_name.clone(),
+ ..Self::default()
+ }),
+ payments::BankRedirectData::Przelewy24 {
+ billing_details, ..
+ } => Ok(Self {
+ email: Some(billing_details.email.clone()),
..Self::default()
}),
_ => Ok(Self::default()),
@@ -1278,7 +1345,8 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat
| StripePaymentMethodOptions::Becs {}
| StripePaymentMethodOptions::WechatPay {}
| StripePaymentMethodOptions::Alipay {}
- | StripePaymentMethodOptions::Sepa {} => None,
+ | StripePaymentMethodOptions::Sepa {}
+ | StripePaymentMethodOptions::Przelewy24 {} => None,
}),
payment_method_id: Some(payment_method_id),
}
@@ -1692,6 +1760,8 @@ pub enum StripePaymentMethodOptions {
Bacs {},
WechatPay {},
Alipay {},
+ #[serde(rename = "p24")]
+ Przelewy24 {},
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
diff --git a/crates/router/src/connector/worldline/transformers.rs b/crates/router/src/connector/worldline/transformers.rs
index 9869f52ea6f..271e523ff84 100644
--- a/crates/router/src/connector/worldline/transformers.rs
+++ b/crates/router/src/connector/worldline/transformers.rs
@@ -308,7 +308,11 @@ fn make_bank_redirect_request(
{
PaymentMethodSpecificData::PaymentProduct816SpecificInput(Box::new(Giropay {
bank_account_iban: BankAccountIban {
- account_holder_name: billing_details.billing_name.clone(),
+ account_holder_name: billing_details.billing_name.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "billing_details.billing_name",
+ },
+ )?,
iban: bank_account_iban.clone(),
},
}))
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index 1214227fa85..1820ce79c9b 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -720,6 +720,24 @@ pub enum BankNames {
VolksbankGruppe,
VolkskreditbankAg,
VrBankBraunau,
+ PlusBank,
+ EtransferPocztowy24,
+ BankiSpbdzielcze,
+ BankNowyBfgSa,
+ GetinBank,
+ Blik,
+ NoblePay,
+ IdeaBank,
+ EnveloBank,
+ NestPrzelew,
+ MbankMtransfer,
+ Inteligo,
+ PbacZIpko,
+ BnpParibas,
+ BankPekaoSa,
+ VolkswagenBank,
+ AliorBank,
+ Boz,
}
#[derive(
|
feat
|
[Stripe] Implement Przelewy24 bank redirect (#1111)
|
d4813b99500d2607985a8a21c888f040fff843dc
|
2024-07-08 14:55:48
|
AkshayaFoiger
|
fix(router): [Iatapay] add CLEARED refund status (#5231)
| false
|
diff --git a/crates/router/src/connector/iatapay/transformers.rs b/crates/router/src/connector/iatapay/transformers.rs
index 1d597a3dc8d..71aeed0f7dd 100644
--- a/crates/router/src/connector/iatapay/transformers.rs
+++ b/crates/router/src/connector/iatapay/transformers.rs
@@ -462,6 +462,7 @@ pub enum RefundStatus {
Initiated,
Authorized,
Settled,
+ Cleared,
Failed,
}
@@ -474,6 +475,7 @@ impl From<RefundStatus> for enums::RefundStatus {
RefundStatus::Initiated => Self::Pending,
RefundStatus::Authorized => Self::Pending,
RefundStatus::Settled => Self::Success,
+ RefundStatus::Cleared => Self::Success,
}
}
}
@@ -640,9 +642,9 @@ impl TryFrom<IatapayWebhookResponse> for api::IncomingWebhookEvent {
| IatapayWebhookStatus::Unknown => Ok(Self::EventNotSupported),
},
IatapayWebhookResponse::IatapayRefundWebhookBody(wh_body) => match wh_body.status {
- IatapayRefundWebhookStatus::Authorized | IatapayRefundWebhookStatus::Settled => {
- Ok(Self::RefundSuccess)
- }
+ IatapayRefundWebhookStatus::Cleared
+ | IatapayRefundWebhookStatus::Authorized
+ | IatapayRefundWebhookStatus::Settled => Ok(Self::RefundSuccess),
IatapayRefundWebhookStatus::Failed => Ok(Self::RefundFailure),
IatapayRefundWebhookStatus::Created
| IatapayRefundWebhookStatus::Locked
@@ -678,6 +680,7 @@ pub enum IatapayRefundWebhookStatus {
Authorized,
Settled,
Failed,
+ Cleared,
Locked,
#[serde(other)]
Unknown,
|
fix
|
[Iatapay] add CLEARED refund status (#5231)
|
30e2c906724a610ec5072e3a103eb3ce21a5ef0e
|
2023-09-21 19:12:38
|
Kritik Modi
|
fix: add flow_name setter (#2234)
| false
|
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index ab213ed0923..045c5480092 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -75,7 +75,7 @@ impl AppStateInfo for AppState {
self.api_client.add_merchant_id(merchant_id);
}
fn add_flow_name(&mut self, flow_name: String) {
- self.flow_name = flow_name;
+ self.api_client.add_flow_name(flow_name);
}
}
|
fix
|
add flow_name setter (#2234)
|
b5bc8c4e7cfdde8251ed0e2e3835ed5e3f1435c4
|
2024-01-30 17:15:04
|
SamraatBansal
|
feat(connector): [noon] add revoke mandate (#3487)
| false
|
diff --git a/crates/router/src/connector/noon.rs b/crates/router/src/connector/noon.rs
index 180b4b1485f..6c98a307637 100644
--- a/crates/router/src/connector/noon.rs
+++ b/crates/router/src/connector/noon.rs
@@ -46,6 +46,7 @@ impl api::Refund for Noon {}
impl api::RefundExecute for Noon {}
impl api::RefundSync for Noon {}
impl api::PaymentToken for Noon {}
+impl api::ConnectorMandateRevoke for Noon {}
impl
ConnectorIntegration<
@@ -492,6 +493,81 @@ impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsR
}
}
+impl
+ ConnectorIntegration<
+ api::MandateRevoke,
+ types::MandateRevokeRequestData,
+ types::MandateRevokeResponseData,
+ > for Noon
+{
+ fn get_headers(
+ &self,
+ req: &types::MandateRevokeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+ fn get_url(
+ &self,
+ _req: &types::MandateRevokeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(format!("{}payment/v1/order", self.base_url(connectors)))
+ }
+ fn build_request(
+ &self,
+ req: &types::MandateRevokeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::MandateRevokeType::get_url(self, req, connectors)?)
+ .attach_default_headers()
+ .headers(types::MandateRevokeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::MandateRevokeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+ fn get_request_body(
+ &self,
+ req: &types::MandateRevokeRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let connector_req = noon::NoonRevokeMandateRequest::try_from(req)?;
+ Ok(RequestContent::Json(Box::new(connector_req)))
+ }
+
+ fn handle_response(
+ &self,
+ data: &types::MandateRevokeRouterData,
+ res: Response,
+ ) -> CustomResult<types::MandateRevokeRouterData, errors::ConnectorError> {
+ let response: noon::NoonRevokeMandateResponse = res
+ .response
+ .parse_struct("Noon NoonRevokeMandateResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ fn get_error_response(
+ &self,
+ res: Response,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res)
+ }
+}
+
impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsResponseData> for Noon {
fn get_headers(
&self,
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index bbf284848b5..ee06cd064be 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -5,7 +5,8 @@ use serde::{Deserialize, Serialize};
use crate::{
connector::utils::{
- self as conn_utils, CardData, PaymentsAuthorizeRequestData, RouterData, WalletData,
+ self as conn_utils, CardData, PaymentsAuthorizeRequestData, RevokeMandateRequestData,
+ RouterData, WalletData,
},
core::errors,
services,
@@ -30,11 +31,13 @@ pub enum NoonSubscriptionType {
}
#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
pub struct NoonSubscriptionData {
#[serde(rename = "type")]
subscription_type: NoonSubscriptionType,
//Short description about the subscription.
name: String,
+ max_amount: Option<String>,
}
#[derive(Debug, Serialize)]
@@ -168,12 +171,13 @@ pub enum NoonPaymentData {
}
#[derive(Debug, Serialize)]
-#[serde(rename_all = "UPPERCASE")]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum NoonApiOperations {
Initiate,
Capture,
Reverse,
Refund,
+ CancelSubscription,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
@@ -335,6 +339,21 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
NoonSubscriptionData {
subscription_type: NoonSubscriptionType::Unscheduled,
name: name.clone(),
+ max_amount: item
+ .request
+ .setup_mandate_details
+ .clone()
+ .and_then(|mandate_details| match mandate_details.mandate_type {
+ Some(data_models::mandates::MandateDataType::SingleUse(mandate))
+ | Some(data_models::mandates::MandateDataType::MultiUse(Some(
+ mandate,
+ ))) => Some(
+ conn_utils::to_currency_base_unit(mandate.amount, mandate.currency)
+ .ok(),
+ ),
+ _ => None,
+ })
+ .flatten(),
},
true,
)) {
@@ -450,7 +469,7 @@ impl ForeignFrom<(NoonPaymentStatus, Self)> for enums::AttemptStatus {
}
#[derive(Debug, Serialize, Deserialize)]
-pub struct NoonSubscriptionResponse {
+pub struct NoonSubscriptionObject {
identifier: String,
}
@@ -475,7 +494,7 @@ pub struct NoonCheckoutData {
pub struct NoonPaymentsResponseResult {
order: NoonPaymentsOrderResponse,
checkout_data: Option<NoonCheckoutData>,
- subscription: Option<NoonSubscriptionResponse>,
+ subscription: Option<NoonSubscriptionObject>,
}
#[derive(Debug, Serialize, Deserialize)]
@@ -603,6 +622,25 @@ impl TryFrom<&types::PaymentsCancelRouterData> for NoonPaymentsCancelRequest {
}
}
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct NoonRevokeMandateRequest {
+ api_operation: NoonApiOperations,
+ subscription: NoonSubscriptionObject,
+}
+
+impl TryFrom<&types::MandateRevokeRouterData> for NoonRevokeMandateRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(item: &types::MandateRevokeRouterData) -> Result<Self, Self::Error> {
+ Ok(Self {
+ api_operation: NoonApiOperations::CancelSubscription,
+ subscription: NoonSubscriptionObject {
+ identifier: item.request.get_connector_mandate_id()?,
+ },
+ })
+ }
+}
+
impl<F> TryFrom<&types::RefundsRouterData<F>> for NoonPaymentsActionRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
@@ -624,6 +662,55 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for NoonPaymentsActionRequest {
})
}
}
+#[derive(Debug, Deserialize)]
+pub enum NoonRevokeStatus {
+ Cancelled,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct NoonCancelSubscriptionObject {
+ status: NoonRevokeStatus,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct NoonRevokeMandateResult {
+ subscription: NoonCancelSubscriptionObject,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct NoonRevokeMandateResponse {
+ result: NoonRevokeMandateResult,
+}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ NoonRevokeMandateResponse,
+ types::MandateRevokeRequestData,
+ types::MandateRevokeResponseData,
+ >,
+ > for types::RouterData<F, types::MandateRevokeRequestData, types::MandateRevokeResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ NoonRevokeMandateResponse,
+ types::MandateRevokeRequestData,
+ types::MandateRevokeResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ match item.response.result.subscription.status {
+ NoonRevokeStatus::Cancelled => Ok(Self {
+ response: Ok(types::MandateRevokeResponseData {
+ mandate_status: common_enums::MandateStatus::Revoked,
+ }),
+ ..item.data
+ }),
+ }
+ }
+}
#[derive(Debug, Default, Deserialize, Clone)]
#[serde(rename_all = "UPPERCASE")]
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index c9f9d6d87f5..ebc0cf3664a 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -2247,7 +2247,6 @@ default_imp_for_revoking_mandates!(
connector::Multisafepay,
connector::Nexinets,
connector::Nmi,
- connector::Noon,
connector::Nuvei,
connector::Opayo,
connector::Opennode,
|
feat
|
[noon] add revoke mandate (#3487)
|
3399328ae7f525fb72e0751182cf32d0b2470594
|
2023-10-18 16:05:05
|
Aaron Jackson
|
refactor(router): remove unnecessary function from Refunds Validate Flow (#2609)
| false
|
diff --git a/crates/router/src/core/refunds.rs b/crates/router/src/core/refunds.rs
index 4085b5b3bdb..44e2b84dbd7 100644
--- a/crates/router/src/core/refunds.rs
+++ b/crates/router/src/core/refunds.rs
@@ -541,106 +541,85 @@ pub async fn validate_and_create_refund(
.attach_printable("invalid merchant_id in request"))
})?;
- let refund = match validator::validate_uniqueness_of_refund_id_against_merchant_id(
- db,
- &payment_intent.payment_id,
- &merchant_account.merchant_id,
- &refund_id,
- merchant_account.storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable_lazy(|| {
- format!(
- "Unique violation while checking refund_id: {} against merchant_id: {}",
- refund_id, merchant_account.merchant_id
+ let connecter_transaction_id = payment_attempt.clone().connector_transaction_id.ok_or_else(|| {
+ report!(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Transaction in invalid. Missing field \"connector_transaction_id\" in payment_attempt.")
+ })?;
+
+ all_refunds = db
+ .find_refund_by_merchant_id_connector_transaction_id(
+ &merchant_account.merchant_id,
+ &connecter_transaction_id,
+ merchant_account.storage_scheme,
)
- })? {
- Some(refund) => refund,
- None => {
- let connecter_transaction_id = payment_attempt.clone().connector_transaction_id.ok_or_else(|| {
- report!(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Transaction in invalid. Missing field \"connector_transaction_id\" in payment_attempt.")
- })?;
- all_refunds = db
- .find_refund_by_merchant_id_connector_transaction_id(
- &merchant_account.merchant_id,
- &connecter_transaction_id,
- merchant_account.storage_scheme,
- )
- .await
- .to_not_found_response(errors::ApiErrorResponse::RefundNotFound)?;
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::RefundNotFound)?;
- currency = payment_attempt.currency.get_required_value("currency")?;
+ currency = payment_attempt.currency.get_required_value("currency")?;
- //[#249]: Add Connector Based Validation here.
- validator::validate_payment_order_age(
- &payment_intent.created_at,
+ //[#249]: Add Connector Based Validation here.
+ validator::validate_payment_order_age(&payment_intent.created_at, state.conf.refund.max_age)
+ .change_context(errors::ApiErrorResponse::InvalidDataFormat {
+ field_name: "created_at".to_string(),
+ expected_format: format!(
+ "created_at not older than {} days",
state.conf.refund.max_age,
- )
- .change_context(errors::ApiErrorResponse::InvalidDataFormat {
- field_name: "created_at".to_string(),
- expected_format: format!(
- "created_at not older than {} days",
- state.conf.refund.max_age,
- ),
- })?;
+ ),
+ })?;
- validator::validate_refund_amount(payment_attempt.amount, &all_refunds, refund_amount)
- .change_context(errors::ApiErrorResponse::RefundAmountExceedsPaymentAmount)?;
+ validator::validate_refund_amount(payment_attempt.amount, &all_refunds, refund_amount)
+ .change_context(errors::ApiErrorResponse::RefundAmountExceedsPaymentAmount)?;
- validator::validate_maximum_refund_against_payment_attempt(
- &all_refunds,
- state.conf.refund.max_attempts,
- )
- .change_context(errors::ApiErrorResponse::MaximumRefundCount)?;
+ validator::validate_maximum_refund_against_payment_attempt(
+ &all_refunds,
+ state.conf.refund.max_attempts,
+ )
+ .change_context(errors::ApiErrorResponse::MaximumRefundCount)?;
- let connector = payment_attempt
- .connector
- .clone()
- .ok_or(errors::ApiErrorResponse::InternalServerError)
- .into_report()
- .attach_printable("No connector populated in payment attempt")?;
-
- refund_create_req = storage::RefundNew::default()
- .set_refund_id(refund_id.to_string())
- .set_internal_reference_id(utils::generate_id(consts::ID_LENGTH, "refid"))
- .set_external_reference_id(Some(refund_id))
- .set_payment_id(req.payment_id)
- .set_merchant_id(merchant_account.merchant_id.clone())
- .set_connector_transaction_id(connecter_transaction_id.to_string())
- .set_connector(connector)
- .set_refund_type(req.refund_type.unwrap_or_default().foreign_into())
- .set_total_amount(payment_attempt.amount)
- .set_refund_amount(refund_amount)
- .set_currency(currency)
- .set_created_at(Some(common_utils::date_time::now()))
- .set_modified_at(Some(common_utils::date_time::now()))
- .set_refund_status(enums::RefundStatus::Pending)
- .set_metadata(req.metadata)
- .set_description(req.reason.clone())
- .set_attempt_id(payment_attempt.attempt_id.clone())
- .set_refund_reason(req.reason)
- .to_owned();
-
- refund = db
- .insert_refund(refund_create_req, merchant_account.storage_scheme)
- .await
- .to_duplicate_response(errors::ApiErrorResponse::DuplicateRefundRequest)?;
+ let connector = payment_attempt
+ .connector
+ .clone()
+ .ok_or(errors::ApiErrorResponse::InternalServerError)
+ .into_report()
+ .attach_printable("No connector populated in payment attempt")?;
+
+ refund_create_req = storage::RefundNew::default()
+ .set_refund_id(refund_id.to_string())
+ .set_internal_reference_id(utils::generate_id(consts::ID_LENGTH, "refid"))
+ .set_external_reference_id(Some(refund_id))
+ .set_payment_id(req.payment_id)
+ .set_merchant_id(merchant_account.merchant_id.clone())
+ .set_connector_transaction_id(connecter_transaction_id.to_string())
+ .set_connector(connector)
+ .set_refund_type(req.refund_type.unwrap_or_default().foreign_into())
+ .set_total_amount(payment_attempt.amount)
+ .set_refund_amount(refund_amount)
+ .set_currency(currency)
+ .set_created_at(Some(common_utils::date_time::now()))
+ .set_modified_at(Some(common_utils::date_time::now()))
+ .set_refund_status(enums::RefundStatus::Pending)
+ .set_metadata(req.metadata)
+ .set_description(req.reason.clone())
+ .set_attempt_id(payment_attempt.attempt_id.clone())
+ .set_refund_reason(req.reason)
+ .to_owned();
- schedule_refund_execution(
- state,
- refund,
- refund_type,
- merchant_account,
- key_store,
- payment_attempt,
- payment_intent,
- creds_identifier,
- )
- .await?
- }
- };
+ refund = db
+ .insert_refund(refund_create_req, merchant_account.storage_scheme)
+ .await
+ .to_duplicate_response(errors::ApiErrorResponse::DuplicateRefundRequest)?;
+
+ schedule_refund_execution(
+ state,
+ refund.clone(),
+ refund_type,
+ merchant_account,
+ key_store,
+ payment_attempt,
+ payment_intent,
+ creds_identifier,
+ )
+ .await?;
Ok(refund.foreign_into())
}
diff --git a/crates/router/src/core/refunds/validator.rs b/crates/router/src/core/refunds/validator.rs
index 88e8e59ed32..6198a6f79a6 100644
--- a/crates/router/src/core/refunds/validator.rs
+++ b/crates/router/src/core/refunds/validator.rs
@@ -4,8 +4,6 @@ use time::PrimitiveDateTime;
use crate::{
core::errors::{self, CustomResult, RouterResult},
- db::StorageInterface,
- logger,
types::storage::{self, enums},
utils::{self, OptionExt},
};
@@ -92,41 +90,6 @@ pub fn validate_maximum_refund_against_payment_attempt(
})
}
-#[instrument(skip(db))]
-pub async fn validate_uniqueness_of_refund_id_against_merchant_id(
- db: &dyn StorageInterface,
- payment_id: &str,
- merchant_id: &str,
- refund_id: &str,
- storage_scheme: enums::MerchantStorageScheme,
-) -> RouterResult<Option<storage::Refund>> {
- let refund = db
- .find_refund_by_merchant_id_refund_id(merchant_id, refund_id, storage_scheme)
- .await;
- logger::debug!(?refund);
- match refund {
- Err(err) => {
- if err.current_context().is_db_not_found() {
- // Empty vec should be returned by query in case of no results, this check exists just
- // to be on the safer side. Fixed this, now vector is not returned but should check the flow in detail later.
- Ok(None)
- } else {
- Err(err
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed while finding refund, database error"))
- }
- }
-
- Ok(refund) => {
- if refund.payment_id == payment_id {
- Ok(Some(refund))
- } else {
- Ok(None)
- }
- }
- }
-}
-
pub fn validate_refund_list(limit: Option<i64>) -> CustomResult<i64, errors::ApiErrorResponse> {
match limit {
Some(limit_val) => {
|
refactor
|
remove unnecessary function from Refunds Validate Flow (#2609)
|
b2da9202809089e6725405351f51d81837b08667
|
2023-06-08 12:03:52
|
Narayan Bhat
|
feat: add error type for empty connector list (#1363)
| false
|
diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs
index 17b33da0566..c68f56d70f1 100644
--- a/crates/router/src/compatibility/stripe/errors.rs
+++ b/crates/router/src/compatibility/stripe/errors.rs
@@ -198,6 +198,8 @@ pub enum StripeErrorCode {
FileNotAvailable,
#[error(error_type = StripeErrorType::HyperswitchError, code = "", message = "There was an issue with processing webhooks")]
WebhookProcessingError,
+ #[error(error_type = StripeErrorType::InvalidRequestError, code = "payment_method_unactivated", message = "The operation cannot be performed as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.")]
+ PaymentMethodUnactivated,
// [#216]: https://github.com/juspay/hyperswitch/issues/216
// Implement the remaining stripe error codes
@@ -298,7 +300,6 @@ pub enum StripeErrorCode {
PaymentMethodMicrodepositVerificationTimeout,
PaymentMethodProviderDecline,
PaymentMethodProviderTimeout,
- PaymentMethodUnactivated,
PaymentMethodUnexpectedState,
PaymentMethodUnsupportedType,
PayoutsNotAllowed,
@@ -509,6 +510,9 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
| errors::ApiErrorResponse::WebhookProcessingFailure
| errors::ApiErrorResponse::WebhookAuthenticationFailed
| errors::ApiErrorResponse::WebhookUnprocessableEntity => Self::WebhookProcessingError,
+ errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration => {
+ Self::PaymentMethodUnactivated
+ }
}
}
}
@@ -564,7 +568,8 @@ impl actix_web::ResponseError for StripeErrorCode {
| Self::MissingFilePurpose
| Self::MissingDisputeId
| Self::FileNotFound
- | Self::FileNotAvailable => StatusCode::BAD_REQUEST,
+ | Self::FileNotAvailable
+ | Self::PaymentMethodUnactivated => StatusCode::BAD_REQUEST,
Self::RefundFailed
| Self::InternalServerError
| Self::MandateActive
diff --git a/crates/router/src/core/errors/api_error_response.rs b/crates/router/src/core/errors/api_error_response.rs
index 6955082a079..4238a530920 100644
--- a/crates/router/src/core/errors/api_error_response.rs
+++ b/crates/router/src/core/errors/api_error_response.rs
@@ -194,6 +194,8 @@ pub enum ApiErrorResponse {
WebhookBadRequest,
#[error(error_type = ErrorType::RouterError, code = "WE_03", message = "There was some issue processing the webhook")]
WebhookProcessingFailure,
+ #[error(error_type = ErrorType::InvalidRequestError, code = "HE_04", message = "required payment method is not configured or configured incorrectly for all configured connectors")]
+ IncorrectPaymentMethodConfiguration,
#[error(error_type = ErrorType::InvalidRequestError, code = "WE_05", message = "Unable to process the webhook body")]
WebhookUnprocessableEntity,
}
@@ -249,9 +251,6 @@ impl actix_web::ResponseError for ApiErrorResponse {
Self::InvalidDataFormat { .. } | Self::InvalidRequestData { .. } => {
StatusCode::UNPROCESSABLE_ENTITY
} // 422
- Self::RefundAmountExceedsPaymentAmount => StatusCode::BAD_REQUEST, // 400
- Self::MaximumRefundCount => StatusCode::BAD_REQUEST, // 400
- Self::PreconditionFailed { .. } => StatusCode::BAD_REQUEST, // 400
Self::PaymentAuthorizationFailed { .. }
| Self::PaymentAuthenticationFailed { .. }
@@ -262,7 +261,11 @@ impl actix_web::ResponseError for ApiErrorResponse {
| Self::RefundNotPossible { .. }
| Self::VerificationFailed { .. }
| Self::PaymentUnexpectedState { .. }
- | Self::MandateValidationFailed { .. } => StatusCode::BAD_REQUEST, // 400
+ | Self::MandateValidationFailed { .. }
+ | Self::RefundAmountExceedsPaymentAmount
+ | Self::MaximumRefundCount
+ | Self::IncorrectPaymentMethodConfiguration
+ | Self::PreconditionFailed { .. } => StatusCode::BAD_REQUEST, // 400
Self::MandateUpdateFailed
| Self::InternalServerError
@@ -540,6 +543,9 @@ impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorRespon
}
Self::WebhookProcessingFailure => {
AER::InternalServerError(ApiError::new("WE", 3, "There was an issue processing the webhook", None))
+ },
+ Self::IncorrectPaymentMethodConfiguration => {
+ AER::BadRequest(ApiError::new("HE", 4, "No eligible connector was found for the current payment method configuration", None))
}
Self::WebhookUnprocessableEntity => {
AER::Unprocessable(ApiError::new("WE", 5, "There was an issue processing the webhook body", None))
|
feat
|
add error type for empty connector list (#1363)
|
512ae85c81fc92158e1b54c48b55993849e14a2a
|
2024-12-06 13:28:36
|
Noa
|
fix(connector): add config cleanup on payment connector deletion (#5998)
| false
|
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 1e05e7ec883..c3c876b22aa 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -3342,6 +3342,16 @@ pub enum PresenceOfCustomerDuringPayment {
Absent,
}
+impl From<ConnectorType> for TransactionType {
+ fn from(connector_type: ConnectorType) -> Self {
+ match connector_type {
+ #[cfg(feature = "payouts")]
+ ConnectorType::PayoutProcessor => Self::Payout,
+ _ => Self::Payment,
+ }
+ }
+}
+
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, Default, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum TaxCalculationOverride {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index b026b1e32fe..40ed4e75521 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1931,6 +1931,65 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {
}
Ok(())
}
+
+ async fn retrieve_and_delete_from_default_fallback_routing_algorithm_if_routable_connector_exists(
+ &self,
+ ) -> RouterResult<()> {
+ let mut default_routing_config = routing::helpers::get_merchant_default_config(
+ self.store,
+ self.merchant_id.get_string_repr(),
+ self.transaction_type,
+ )
+ .await?;
+
+ let mut default_routing_config_for_profile = routing::helpers::get_merchant_default_config(
+ self.store,
+ self.profile_id.get_string_repr(),
+ self.transaction_type,
+ )
+ .await?;
+
+ if let Some(routable_connector_val) = self.routable_connector {
+ let choice = routing_types::RoutableConnectorChoice {
+ choice_kind: routing_types::RoutableChoiceKind::FullStruct,
+ connector: *routable_connector_val,
+ merchant_connector_id: Some(self.merchant_connector_id.clone()),
+ };
+ if default_routing_config.contains(&choice) {
+ default_routing_config.retain(|mca| {
+ mca.merchant_connector_id
+ .as_ref()
+ .map_or(true, |merchant_connector_id| {
+ merchant_connector_id != self.merchant_connector_id
+ })
+ });
+ routing::helpers::update_merchant_default_config(
+ self.store,
+ self.merchant_id.get_string_repr(),
+ default_routing_config.clone(),
+ self.transaction_type,
+ )
+ .await?;
+ }
+ if default_routing_config_for_profile.contains(&choice.clone()) {
+ default_routing_config_for_profile.retain(|mca| {
+ mca.merchant_connector_id
+ .as_ref()
+ .map_or(true, |merchant_connector_id| {
+ merchant_connector_id != self.merchant_connector_id
+ })
+ });
+ routing::helpers::update_merchant_default_config(
+ self.store,
+ self.profile_id.get_string_repr(),
+ default_routing_config_for_profile.clone(),
+ self.transaction_type,
+ )
+ .await?;
+ }
+ }
+ Ok(())
+ }
}
#[cfg(feature = "v2")]
struct DefaultFallbackRoutingConfigUpdate<'a> {
@@ -1970,6 +2029,40 @@ impl<'a> DefaultFallbackRoutingConfigUpdate<'a> {
}
Ok(())
}
+
+ async fn retrieve_and_delete_from_default_fallback_routing_algorithm_if_routable_connector_exists(
+ &self,
+ ) -> RouterResult<()> {
+ let profile_wrapper = ProfileWrapper::new(self.business_profile.clone());
+ let default_routing_config_for_profile =
+ &mut profile_wrapper.get_default_fallback_list_of_connector_under_profile()?;
+ if let Some(routable_connector_val) = self.routable_connector {
+ let choice = routing_types::RoutableConnectorChoice {
+ choice_kind: routing_types::RoutableChoiceKind::FullStruct,
+ connector: *routable_connector_val,
+ merchant_connector_id: Some(self.merchant_connector_id.clone()),
+ };
+ if default_routing_config_for_profile.contains(&choice.clone()) {
+ default_routing_config_for_profile.retain(|mca| {
+ mca.merchant_connector_id
+ .as_ref()
+ .map_or(true, |merchant_connector_id| {
+ merchant_connector_id != self.merchant_connector_id
+ })
+ });
+
+ profile_wrapper
+ .update_default_fallback_routing_of_connectors_under_profile(
+ self.store,
+ default_routing_config_for_profile,
+ self.key_manager_state,
+ &self.key_store,
+ )
+ .await?
+ }
+ }
+ Ok(())
+ }
}
#[cfg(any(feature = "v1", feature = "v2", feature = "olap"))]
#[async_trait::async_trait]
@@ -3138,7 +3231,7 @@ pub async fn delete_connector(
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?;
- let _mca = db
+ let mca = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
&merchant_id,
@@ -3160,6 +3253,26 @@ pub async fn delete_connector(
id: merchant_connector_id.get_string_repr().to_string(),
})?;
+ // delete the mca from the config as well
+ let merchant_default_config_delete = MerchantDefaultConfigUpdate {
+ routable_connector: &Some(
+ common_enums::RoutableConnectors::from_str(&mca.connector_name).map_err(|_| {
+ errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "connector_name",
+ }
+ })?,
+ ),
+ merchant_connector_id: &mca.get_id(),
+ store: db,
+ merchant_id: &merchant_id,
+ profile_id: &mca.profile_id,
+ transaction_type: &mca.connector_type.into(),
+ };
+
+ merchant_default_config_delete
+ .retrieve_and_delete_from_default_fallback_routing_algorithm_if_routable_connector_exists()
+ .await?;
+
let response = api::MerchantConnectorDeleteResponse {
merchant_id,
merchant_connector_id,
@@ -3206,6 +3319,32 @@ pub async fn delete_connector(
id: id.clone().get_string_repr().to_string(),
})?;
+ let business_profile = db
+ .find_business_profile_by_profile_id(key_manager_state, &key_store, &mca.profile_id)
+ .await
+ .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound {
+ id: mca.profile_id.get_string_repr().to_owned(),
+ })?;
+
+ let merchant_default_config_delete = DefaultFallbackRoutingConfigUpdate {
+ routable_connector: &Some(
+ common_enums::RoutableConnectors::from_str(&mca.connector_name).map_err(|_| {
+ errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "connector_name",
+ }
+ })?,
+ ),
+ merchant_connector_id: &mca.get_id(),
+ store: db,
+ business_profile,
+ key_store,
+ key_manager_state,
+ };
+
+ merchant_default_config_delete
+ .retrieve_and_delete_from_default_fallback_routing_algorithm_if_routable_connector_exists()
+ .await?;
+
let response = api::MerchantConnectorDeleteResponse {
merchant_id: merchant_id.clone(),
id,
|
fix
|
add config cleanup on payment connector deletion (#5998)
|
cf902f19e5e08c6ee538ab4be7411f50a4079b55
|
2023-04-13 17:04:36
|
Narayan Bhat
|
feat(core): add backwards compatibility for multiple mca (#866)
| false
|
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index 386cb7d8c16..59f99cb7cac 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -9,6 +9,7 @@ errors = [
"dep:actix-web",
"dep:reqwest",
]
+multiple_mca = []
[dependencies]
actix-web = { version = "4.3.1", optional = true }
@@ -24,6 +25,7 @@ time = { version = "0.3.20", features = ["serde", "serde-well-known", "std"] }
url = { version = "2.3.1", features = ["serde"] }
utoipa = { version = "3.2.0", features = ["preserve_order"] }
+
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils" }
masking = { version = "0.1.0", path = "../masking" }
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 3494f5bda0b..1944403fbe0 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -68,8 +68,13 @@ pub struct MerchantAccountCreate {
pub locker_id: Option<String>,
///Default business details for connector routing
+ #[cfg(feature = "multiple_mca")]
#[schema(value_type = PrimaryBusinessDetails)]
- pub primary_business_details: pii::SecretSerdeValue,
+ pub primary_business_details: Vec<PrimaryBusinessDetails>,
+
+ #[cfg(not(feature = "multiple_mca"))]
+ #[schema(value_type = Option<PrimaryBusinessDetails>)]
+ pub primary_business_details: Option<Vec<PrimaryBusinessDetails>>,
}
#[derive(Clone, Debug, Deserialize, ToSchema)]
@@ -194,8 +199,8 @@ pub struct MerchantAccountResponse {
#[schema(example = "locker_abc123")]
pub locker_id: Option<String>,
///Default business details for connector routing
- #[schema(value_type = Option<PrimaryBusinessDetails>)]
- pub primary_business_details: pii::SecretSerdeValue,
+ #[schema(value_type = Vec<PrimaryBusinessDetails>)]
+ pub primary_business_details: Vec<PrimaryBusinessDetails>,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
@@ -249,8 +254,8 @@ pub enum RoutingAlgorithm {
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct PrimaryBusinessDetails {
- pub country: Vec<api_enums::CountryCode>,
- pub business: Vec<String>,
+ pub country: api_enums::CountryCode,
+ pub business: String,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
@@ -309,7 +314,7 @@ pub struct MerchantConnectorId {
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
-pub struct MerchantConnector {
+pub struct MerchantConnectorCreate {
/// Type of the Connector for the financial use case. Could range from Payments to Accounting to Banking.
#[schema(value_type = ConnectorType, example = "payment_processor")]
pub connector_type: api_enums::ConnectorType,
@@ -320,21 +325,94 @@ pub struct MerchantConnector {
#[serde(skip_deserializing)]
#[schema(example = "stripe_US_travel")]
pub connector_label: String,
- /// Country through which payment should be processed
+
+ /// Unique ID of the connector
+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
+ pub merchant_connector_id: Option<String>,
+ /// Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.
+ #[schema(value_type = Option<Object>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
+ pub connector_account_details: Option<pii::SecretSerdeValue>,
+ /// A boolean value to indicate if the connector is in Test mode. By default, its value is false.
+ #[schema(default = false, example = false)]
+ pub test_mode: Option<bool>,
+ /// A boolean value to indicate if the connector is disabled. By default, its value is false.
+ #[schema(default = false, example = false)]
+ pub disabled: Option<bool>,
+ /// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
+ #[schema(example = json!([
+ {
+ "payment_method": "wallet",
+ "payment_method_types": [
+ "upi_collect",
+ "upi_intent"
+ ],
+ "payment_method_issuers": [
+ "labore magna ipsum",
+ "aute"
+ ],
+ "payment_schemes": [
+ "Discover",
+ "Discover"
+ ],
+ "accepted_currencies": {
+ "type": "enable_only",
+ "list": ["USD", "EUR"]
+ },
+ "accepted_countries": {
+ "type": "disable_only",
+ "list": ["FR", "DE","IN"]
+ },
+ "minimum_amount": 1,
+ "maximum_amount": 68607706,
+ "recurring_enabled": true,
+ "installment_payment_enabled": true
+ }
+ ]))]
+ pub payment_methods_enabled: Option<Vec<PaymentMethodsEnabled>>,
+ /// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
+ #[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
+ pub metadata: Option<pii::SecretSerdeValue>,
+
+ /// Business Country of the connector
#[schema(example = "US")]
+ #[cfg(feature = "multiple_mca")]
pub business_country: api_enums::CountryCode,
+ #[cfg(not(feature = "multiple_mca"))]
+ pub business_country: Option<api_enums::CountryCode>,
+
///Business Type of the merchant
#[schema(example = "travel")]
+ #[cfg(feature = "multiple_mca")]
pub business_label: String,
+ #[cfg(not(feature = "multiple_mca"))]
+ pub business_label: Option<String>,
+
/// Business Sub label of the merchant
#[schema(example = "chase")]
pub business_sub_label: Option<String>,
+}
+
+/// Response of creating a new Merchant Connector for the merchant account."
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(deny_unknown_fields)]
+pub struct MerchantConnectorResponse {
+ /// Type of the Connector for the financial use case. Could range from Payments to Accounting to Banking.
+ #[schema(value_type = ConnectorType, example = "payment_processor")]
+ pub connector_type: api_enums::ConnectorType,
+ /// Name of the Connector
+ #[schema(example = "stripe")]
+ pub connector_name: String,
+ // /// Connector label for specific country and Business
+ #[serde(skip_deserializing)]
+ #[schema(example = "stripe_US_travel")]
+ pub connector_label: String,
+
/// Unique ID of the connector
#[schema(example = "mca_5apGeP94tMts6rg3U3kR")]
- pub merchant_connector_id: Option<String>,
+ pub merchant_connector_id: String,
/// Account details of the Connector. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Useful for storing additional, structured information on an object.
#[schema(value_type = Option<Object>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
- pub connector_account_details: Option<pii::SecretSerdeValue>,
+ pub connector_account_details: pii::SecretSerdeValue,
/// A boolean value to indicate if the connector is in Test mode. By default, its value is false.
#[schema(default = false, example = false)]
pub test_mode: Option<bool>,
@@ -375,6 +453,18 @@ pub struct MerchantConnector {
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
#[schema(value_type = Option<Object>,max_length = 255,example = json!({ "city": "NY", "unit": "245" }))]
pub metadata: Option<pii::SecretSerdeValue>,
+
+ /// Business Country of the connector
+ #[schema(example = "US")]
+ pub business_country: api_enums::CountryCode,
+
+ ///Business Type of the merchant
+ #[schema(example = "travel")]
+ pub business_label: String,
+
+ /// Business Sub label of the merchant
+ #[schema(example = "chase")]
+ pub business_sub_label: Option<String>,
}
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 6a2263e5393..08c15c53645 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -22,6 +22,7 @@ kv_store = []
accounts_cache = []
openapi = ["olap", "oltp"]
vergen = ["router_env/vergen"]
+multiple_mca = ["api_models/multiple_mca"]
[dependencies]
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 8a81ac03c0a..2395308874d 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1,7 +1,6 @@
use api_models::admin::PrimaryBusinessDetails;
use common_utils::ext_traits::ValueExt;
use error_stack::{report, FutureExt, IntoReport, ResultExt};
-use masking::ExposeInterface;
use storage_models::{enums, merchant_account};
use uuid::Uuid;
@@ -13,13 +12,12 @@ use crate::{
payments::helpers,
},
db::StorageInterface,
- pii::Secret,
routes::AppState,
services::api as service_api,
types::{
self, api,
storage::{self, MerchantAccount},
- transformers::{ForeignInto, ForeignTryInto},
+ transformers::{ForeignInto, ForeignTryFrom, ForeignTryInto},
},
utils::{self, OptionExt},
};
@@ -33,6 +31,31 @@ pub fn create_merchant_publishable_key() -> String {
)
}
+fn get_primary_business_details(
+ request: &api::MerchantAccountCreate,
+) -> Vec<PrimaryBusinessDetails> {
+ // In this case, business details is not optional, it will always be passed
+ #[cfg(feature = "multiple_mca")]
+ {
+ request.primary_business_details.to_owned()
+ }
+
+ // In this case, business details will be optional, if it is not passed, then create the
+ // default value
+ #[cfg(not(feature = "multiple_mca"))]
+ {
+ request
+ .primary_business_details
+ .to_owned()
+ .unwrap_or_else(|| {
+ vec![PrimaryBusinessDetails {
+ country: enums::CountryCode::US,
+ business: "default".to_string(),
+ }]
+ })
+ }
+}
+
pub async fn create_merchant_account(
state: &AppState,
req: api::MerchantAccountCreate,
@@ -66,36 +89,33 @@ pub async fn create_merchant_account(
.attach_printable("Unexpected create API key response"),
}?;
- let merchant_details = req
- .merchant_details
- .map(|md| {
- utils::Encode::<api::MerchantDetails>::encode_to_value(&md).change_context(
- errors::ApiErrorResponse::InvalidDataValue {
- field_name: "merchant_details",
- },
- )
- })
- .transpose()?;
-
- let webhook_details = req
- .webhook_details
- .map(|wd| {
- utils::Encode::<api::WebhookDetails>::encode_to_value(&wd).change_context(
- errors::ApiErrorResponse::InvalidDataValue {
- field_name: "webhook details",
- },
- )
- })
- .transpose()?;
+ let primary_business_details =
+ utils::Encode::<api::WebhookDetails>::encode_to_value(&get_primary_business_details(&req))
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "primary_business_details",
+ })?;
- let primary_business_details = req.primary_business_details.expose();
+ let merchant_details =
+ req.merchant_details
+ .as_ref()
+ .map(|merchant_details| {
+ utils::Encode::<api::MerchantDetails>::encode_to_value(merchant_details)
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "merchant_details",
+ })
+ })
+ .transpose()?;
- let _valid_business_details: PrimaryBusinessDetails = primary_business_details
- .clone()
- .parse_value("primary_business_details")
- .change_context(errors::ApiErrorResponse::InvalidDataValue {
- field_name: "primary_business_details",
- })?;
+ let webhook_details =
+ req.webhook_details
+ .as_ref()
+ .map(|webhook_details| {
+ utils::Encode::<api::WebhookDetails>::encode_to_value(webhook_details)
+ .change_context(errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "webhook details",
+ })
+ })
+ .transpose()?;
if let Some(ref routing_algorithm) = req.routing_algorithm {
let _: api::RoutingAlgorithm = routing_algorithm
@@ -139,7 +159,11 @@ pub async fn create_merchant_account(
})?;
Ok(service_api::ApplicationResponse::Json(
- merchant_account.foreign_into(),
+ ForeignTryFrom::foreign_try_from(merchant_account).change_context(
+ errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "merchant_account",
+ },
+ )?,
))
}
@@ -155,7 +179,11 @@ pub async fn get_merchant_account(
})?;
Ok(service_api::ApplicationResponse::Json(
- merchant_account.foreign_into(),
+ ForeignTryFrom::foreign_try_from(merchant_account).change_context(
+ errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "merchant_account",
+ },
+ )?,
))
}
@@ -236,7 +264,11 @@ pub async fn merchant_account_update(
})?;
Ok(service_api::ApplicationResponse::Json(
- response.foreign_into(),
+ ForeignTryFrom::foreign_try_from(response).change_context(
+ errors::ApiErrorResponse::InvalidDataValue {
+ field_name: "merchant_account",
+ },
+ )?,
))
}
@@ -295,27 +327,49 @@ async fn validate_merchant_id<S: Into<String>>(
})
}
+fn get_business_details_wrapper(
+ request: &api::MerchantConnectorCreate,
+ _merchant_account: &MerchantAccount,
+) -> RouterResult<(enums::CountryCode, String)> {
+ #[cfg(feature = "multiple_mca")]
+ {
+ // The fields are mandatory
+ Ok((request.business_country, request.business_label.to_owned()))
+ }
+
+ #[cfg(not(feature = "multiple_mca"))]
+ {
+ // If the value is not passed, then take it from Merchant account
+ helpers::get_business_details(
+ request.business_country,
+ request.business_label.as_ref(),
+ _merchant_account,
+ )
+ }
+}
+
pub async fn create_payment_connector(
store: &dyn StorageInterface,
- req: api::MerchantConnector,
+ req: api::MerchantConnectorCreate,
merchant_id: &String,
-) -> RouterResponse<api::MerchantConnector> {
- let _merchant_account = store
+) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
+ let merchant_account = store
.find_merchant_account_by_merchant_id(merchant_id)
.await
.map_err(|error| {
error.to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)
})?;
+ let (business_country, business_label) = get_business_details_wrapper(&req, &merchant_account)?;
+
let connector_label = helpers::get_connector_label(
- req.business_country,
- &req.business_label,
+ business_country,
+ &business_label,
req.business_sub_label.as_ref(),
&req.connector_name,
);
let mut vec = Vec::new();
- let mut response = req.clone();
let payment_methods_enabled = match req.payment_methods_enabled {
Some(val) => {
for pm in val.into_iter() {
@@ -352,8 +406,8 @@ pub async fn create_payment_connector(
disabled: req.disabled,
metadata: req.metadata,
connector_label: connector_label.clone(),
- business_country: req.business_country,
- business_label: req.business_label,
+ business_country,
+ business_label,
business_sub_label: req.business_sub_label,
};
@@ -364,19 +418,16 @@ pub async fn create_payment_connector(
error.to_duplicate_response(errors::ApiErrorResponse::DuplicateMerchantConnectorAccount)
})?;
- response.merchant_connector_id = Some(mca.merchant_connector_id);
- response.connector_label = connector_label;
- response.business_country = mca.business_country;
- response.business_label = mca.business_label;
+ let mca_response = ForeignTryFrom::foreign_try_from(mca)?;
- Ok(service_api::ApplicationResponse::Json(response))
+ Ok(service_api::ApplicationResponse::Json(mca_response))
}
pub async fn retrieve_payment_connector(
store: &dyn StorageInterface,
merchant_id: String,
merchant_connector_id: String,
-) -> RouterResponse<api::MerchantConnector> {
+) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let _merchant_account = store
.find_merchant_account_by_merchant_id(&merchant_id)
.await
@@ -395,14 +446,14 @@ pub async fn retrieve_payment_connector(
})?;
Ok(service_api::ApplicationResponse::Json(
- mca.foreign_try_into()?,
+ ForeignTryFrom::foreign_try_from(mca)?,
))
}
pub async fn list_payment_connectors(
store: &dyn StorageInterface,
merchant_id: String,
-) -> RouterResponse<Vec<api::MerchantConnector>> {
+) -> RouterResponse<Vec<api_models::admin::MerchantConnectorResponse>> {
// Validate merchant account
store
.find_merchant_account_by_merchant_id(&merchant_id)
@@ -432,7 +483,7 @@ pub async fn update_payment_connector(
merchant_id: &str,
merchant_connector_id: &str,
req: api_models::admin::MerchantConnectorUpdate,
-) -> RouterResponse<api::MerchantConnector> {
+) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {
let _merchant_account = db
.find_merchant_account_by_merchant_id(merchant_id)
.await
@@ -478,32 +529,9 @@ pub async fn update_payment_connector(
format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")
})?;
- let updated_pm_enabled = updated_mca.payment_methods_enabled.map(|pm| {
- pm.into_iter()
- .flat_map(|pm_value| {
- ValueExt::<api_models::admin::PaymentMethodsEnabled>::parse_value(
- pm_value,
- "PaymentMethods",
- )
- })
- .collect::<Vec<api_models::admin::PaymentMethodsEnabled>>()
- });
+ let mca_response = ForeignTryFrom::foreign_try_from(updated_mca)?;
- let response = api::MerchantConnector {
- connector_type: updated_mca.connector_type.foreign_into(),
- connector_name: updated_mca.connector_name,
- merchant_connector_id: Some(updated_mca.merchant_connector_id),
- connector_account_details: Some(Secret::new(updated_mca.connector_account_details)),
- test_mode: updated_mca.test_mode,
- disabled: updated_mca.disabled,
- payment_methods_enabled: updated_pm_enabled,
- metadata: updated_mca.metadata,
- connector_label: updated_mca.connector_label,
- business_country: updated_mca.business_country,
- business_label: updated_mca.business_label,
- business_sub_label: updated_mca.business_sub_label,
- };
- Ok(service_api::ApplicationResponse::Json(response))
+ Ok(service_api::ApplicationResponse::Json(mca_response))
}
pub async fn delete_payment_connector(
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 52ac3c6cd65..9f589f2d955 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1285,14 +1285,14 @@ pub fn get_business_details(
business_country: Option<api_enums::CountryCode>,
business_label: Option<&String>,
merchant_account: &storage_models::merchant_account::MerchantAccount,
-) -> Result<(api_enums::CountryCode, String), error_stack::Report<errors::ApiErrorResponse>> {
+) -> RouterResult<(api_enums::CountryCode, String)> {
let (business_country, business_label) = match business_country.zip(business_label) {
Some((business_country, business_label)) => {
(business_country.to_owned(), business_label.to_owned())
}
None => {
// Parse the primary business details from merchant account
- let primary_business_details: api_models::admin::PrimaryBusinessDetails =
+ let primary_business_details: Vec<api_models::admin::PrimaryBusinessDetails> =
merchant_account
.primary_business_details
.clone()
@@ -1300,28 +1300,20 @@ pub fn get_business_details(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("failed to parse primary business details")?;
- if primary_business_details.country.len() == 1
- && primary_business_details.business.len() == 1
- {
- let primary_business_country = primary_business_details
- .country
- .first()
- .get_required_value("business_country")?
- .to_owned();
-
- let primary_business_label = primary_business_details
- .business
- .first()
- .get_required_value("business_label")?
- .to_owned();
-
+ if primary_business_details.len() == 1 {
+ let primary_business_details = primary_business_details.first().ok_or(
+ errors::ApiErrorResponse::MissingRequiredField {
+ field_name: "primary_business_details",
+ },
+ )?;
(
- business_country.unwrap_or(primary_business_country),
+ business_country.unwrap_or(primary_business_details.country.to_owned()),
business_label
.map(ToString::to_string)
- .unwrap_or(primary_business_label),
+ .unwrap_or(primary_business_details.business.to_owned()),
)
} else {
+ // If primary business details are not present or more than one
Err(report!(errors::ApiErrorResponse::MissingRequiredField {
field_name: "business_country, business_label"
}))?
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 35e3cc9db6a..ec506f3f10f 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -149,7 +149,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::DisputeStage,
api_models::enums::DisputeStatus,
api_models::enums::CountryCode,
- api_models::admin::MerchantConnector,
+ api_models::admin::MerchantConnectorCreate,
api_models::admin::PaymentMethodsEnabled,
api_models::disputes::DisputeResponse,
api_models::payments::AddressDetails,
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 747de8b0bb8..18808013687 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -172,7 +172,7 @@ pub async fn payment_connector_create(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
- json_payload: web::Json<admin::MerchantConnector>,
+ json_payload: web::Json<admin::MerchantConnectorCreate>,
) -> HttpResponse {
let flow = Flow::MerchantConnectorsCreate;
let merchant_id = path.into_inner();
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 8ac575f6557..ade860b88fc 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -1,17 +1,25 @@
pub use api_models::admin::{
MerchantAccountCreate, MerchantAccountDeleteResponse, MerchantAccountResponse,
- MerchantAccountUpdate, MerchantConnector, MerchantConnectorDeleteResponse,
+ MerchantAccountUpdate, MerchantConnectorCreate, MerchantConnectorDeleteResponse,
MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId, MerchantDetails,
MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, ToggleKVRequest, ToggleKVResponse,
WebhookDetails,
};
+use common_utils::ext_traits::ValueExt;
-use crate::types::{storage, transformers::ForeignFrom};
+use crate::{
+ core::errors,
+ types::{storage, transformers::ForeignTryFrom},
+};
+
+impl ForeignTryFrom<storage::MerchantAccount> for MerchantAccountResponse {
+ type Error = error_stack::Report<errors::ParsingError>;
+ fn foreign_try_from(item: storage::MerchantAccount) -> Result<Self, Self::Error> {
+ let primary_business_details: Vec<api_models::admin::PrimaryBusinessDetails> = item
+ .primary_business_details
+ .parse_value("primary_business_details")?;
-impl ForeignFrom<storage::MerchantAccount> for MerchantAccountResponse {
- fn foreign_from(value: storage::MerchantAccount) -> Self {
- let item = value;
- Self {
+ Ok(Self {
merchant_id: item.merchant_id,
merchant_name: item.merchant_name,
api_key: item.api_key,
@@ -27,7 +35,7 @@ impl ForeignFrom<storage::MerchantAccount> for MerchantAccountResponse {
publishable_key: item.publishable_key,
metadata: item.metadata,
locker_id: item.locker_id,
- primary_business_details: item.primary_business_details.into(),
- }
+ primary_business_details,
+ })
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 80857ddfb89..92f0f8f2d8a 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1,6 +1,7 @@
use api_models::enums as api_enums;
use common_utils::ext_traits::ValueExt;
use error_stack::ResultExt;
+use masking::Secret;
use storage_models::enums as storage_enums;
use crate::{
@@ -336,37 +337,6 @@ impl<'a> ForeignFrom<&'a storage::Address> for api_types::Address {
}
}
-impl ForeignTryFrom<storage::MerchantConnectorAccount> for api_models::admin::MerchantConnector {
- type Error = error_stack::Report<errors::ApiErrorResponse>;
- fn foreign_try_from(item: storage::MerchantConnectorAccount) -> Result<Self, Self::Error> {
- let merchant_ca = item;
-
- let payment_methods_enabled = match merchant_ca.payment_methods_enabled {
- Some(val) => serde_json::Value::Array(val)
- .parse_value("PaymentMethods")
- .change_context(errors::ApiErrorResponse::InternalServerError)?,
- None => None,
- };
-
- Ok(Self {
- connector_type: merchant_ca.connector_type.foreign_into(),
- connector_name: merchant_ca.connector_name,
- merchant_connector_id: Some(merchant_ca.merchant_connector_id),
- connector_account_details: Some(masking::Secret::new(
- merchant_ca.connector_account_details,
- )),
- test_mode: merchant_ca.test_mode,
- disabled: merchant_ca.disabled,
- metadata: merchant_ca.metadata,
- payment_methods_enabled,
- connector_label: merchant_ca.connector_label,
- business_country: merchant_ca.business_country,
- business_label: merchant_ca.business_label,
- business_sub_label: merchant_ca.business_sub_label,
- })
- }
-}
-
impl ForeignFrom<api_models::enums::PaymentMethodType>
for storage_models::enums::PaymentMethodType
{
@@ -551,3 +521,34 @@ impl ForeignFrom<storage_models::cards_info::CardInfo>
}
}
}
+
+impl ForeignTryFrom<storage_models::merchant_connector_account::MerchantConnectorAccount>
+ for api_models::admin::MerchantConnectorResponse
+{
+ type Error = error_stack::Report<errors::ApiErrorResponse>;
+ fn foreign_try_from(
+ item: storage_models::merchant_connector_account::MerchantConnectorAccount,
+ ) -> Result<Self, Self::Error> {
+ let payment_methods_enabled = match item.payment_methods_enabled {
+ Some(val) => serde_json::Value::Array(val)
+ .parse_value("PaymentMethods")
+ .change_context(errors::ApiErrorResponse::InternalServerError)?,
+ None => None,
+ };
+
+ Ok(Self {
+ connector_type: item.connector_type.foreign_into(),
+ connector_name: item.connector_name,
+ connector_label: item.connector_label,
+ merchant_connector_id: item.merchant_connector_id,
+ connector_account_details: Secret::new(item.connector_account_details),
+ test_mode: item.test_mode,
+ disabled: item.disabled,
+ payment_methods_enabled,
+ metadata: item.metadata,
+ business_country: item.business_country,
+ business_label: item.business_label,
+ business_sub_label: item.business_sub_label,
+ })
+ }
+}
diff --git a/migrations/2023-04-13-094917_change_primary_business_type/down.sql b/migrations/2023-04-13-094917_change_primary_business_type/down.sql
new file mode 100644
index 00000000000..2e4a980a2c2
--- /dev/null
+++ b/migrations/2023-04-13-094917_change_primary_business_type/down.sql
@@ -0,0 +1,7 @@
+-- This file should undo anything in `up.sql`
+UPDATE merchant_account
+SET primary_business_details = '{"country": ["US"], "business": ["default"]}';
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN business_sub_label
+SET DEFAULT 'default';
diff --git a/migrations/2023-04-13-094917_change_primary_business_type/up.sql b/migrations/2023-04-13-094917_change_primary_business_type/up.sql
new file mode 100644
index 00000000000..e35ec879720
--- /dev/null
+++ b/migrations/2023-04-13-094917_change_primary_business_type/up.sql
@@ -0,0 +1,7 @@
+-- This change will allow older merchant accounts to be used with new changes
+UPDATE merchant_account
+SET primary_business_details = '[{"country": "US", "business": "default"}]';
+
+-- Since this field is optional, default is not required
+ALTER TABLE merchant_connector_account
+ALTER COLUMN business_sub_label DROP DEFAULT;
|
feat
|
add backwards compatibility for multiple mca (#866)
|
cf000599ddaca2646efce0493a013c06fcdf34b8
|
2023-05-19 18:05:10
|
Sangamesh Kulkarni
|
feat: SEPA and BACS bank transfers through stripe (#930)
| false
|
diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs
index 64d792f2c1f..e2b9decc795 100644
--- a/crates/api_models/src/payment_methods.rs
+++ b/crates/api_models/src/payment_methods.rs
@@ -205,6 +205,8 @@ pub struct ResponsePaymentMethodTypes {
/// The Bank debit payment method information, if applicable for a payment method type.
pub bank_debits: Option<BankDebitTypes>,
+ /// The Bank transfer payment method information, if applicable for a payment method type.
+ pub bank_transfers: Option<BankTransferTypes>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -217,6 +219,13 @@ pub struct ResponsePaymentMethodsEnabled {
pub payment_method_types: Vec<ResponsePaymentMethodTypes>,
}
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]
+pub struct BankTransferTypes {
+ /// The list of eligible connectors for a given payment experience
+ #[schema(example = json!(["stripe", "adyen"]))]
+ pub eligible_connectors: Vec<String>,
+}
+
#[derive(Clone, Debug)]
pub struct ResponsePaymentMethodIntermediate {
pub payment_method_type: api_enums::PaymentMethodType,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 3d5cd6414d8..d71c3ae4c7a 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -724,13 +724,14 @@ pub enum BankRedirectData {
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct AchBankTransferData {
- pub billing_details: AchBillingDetails,
+pub struct AchBillingDetails {
+ pub email: Email,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct AchBillingDetails {
+pub struct SepaAndBacsBillingDetails {
pub email: Email,
+ pub name: Secret<String>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
@@ -757,7 +758,16 @@ pub struct BankRedirectBilling {
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferData {
- AchBankTransfer(AchBankTransferData),
+ AchBankTransfer {
+ billing_details: AchBillingDetails,
+ },
+ SepaBankTransfer {
+ billing_details: SepaAndBacsBillingDetails,
+ country: api_enums::CountryAlpha2,
+ },
+ BacsBankTransfer {
+ billing_details: SepaAndBacsBillingDetails,
+ },
}
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, ToSchema, Eq, PartialEq)]
@@ -878,6 +888,7 @@ pub struct CardResponse {
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize)]
+#[serde(rename_all = "snake_case")]
pub enum PaymentMethodDataResponse {
#[serde(rename = "card")]
Card(CardResponse),
@@ -1071,10 +1082,34 @@ pub struct NextAction {
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NextStepsRequirements {
- pub ach_credit_transfer: AchTransfer,
+ #[serde(flatten)]
+ pub bank_transfer_instructions: BankTransferInstructions,
pub receiver: ReceiverDetails,
}
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum BankTransferInstructions {
+ AchCreditTransfer(Box<AchTransfer>),
+ SepaBankInstructions(Box<SepaBankTransferInstructions>),
+ BacsBankInstructions(Box<BacsBankTransferInstructions>),
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct SepaBankTransferInstructions {
+ pub account_holder_name: Secret<String>,
+ pub bic: Secret<String>,
+ pub country: String,
+ pub iban: Secret<String>,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+pub struct BacsBankTransferInstructions {
+ pub account_holder_name: Secret<String>,
+ pub account_number: Secret<String>,
+ pub sort_code: Secret<String>,
+}
+
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AchTransfer {
pub account_number: Secret<String>,
@@ -1085,8 +1120,9 @@ pub struct AchTransfer {
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReceiverDetails {
- pub amount_received: i64,
- pub amount_charged: i64,
+ amount_received: i64,
+ amount_charged: Option<i64>,
+ amount_remaining: Option<i64>,
}
#[derive(Setter, Clone, Default, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]
diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rs
index c966e12f33b..15df7da9ee9 100644
--- a/crates/api_models/src/webhooks.rs
+++ b/crates/api_models/src/webhooks.rs
@@ -10,6 +10,7 @@ pub enum IncomingWebhookEvent {
PaymentIntentFailure,
PaymentIntentSuccess,
PaymentIntentProcessing,
+ PaymentIntentPartiallyFunded,
PaymentActionRequired,
EventNotSupported,
SourceChargeable,
@@ -45,6 +46,7 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
IncomingWebhookEvent::PaymentIntentSuccess => Self::Payment,
IncomingWebhookEvent::PaymentIntentProcessing => Self::Payment,
IncomingWebhookEvent::PaymentActionRequired => Self::Payment,
+ IncomingWebhookEvent::PaymentIntentPartiallyFunded => Self::Payment,
IncomingWebhookEvent::EventNotSupported => Self::ReturnResponse,
IncomingWebhookEvent::RefundSuccess => Self::Refund,
IncomingWebhookEvent::RefundFailure => Self::Refund,
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index 06a68c049af..7190397ca78 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -686,9 +686,14 @@ impl
match &req.request.payment_method_data {
api_models::payments::PaymentMethodData::BankTransfer(bank_transfer_data) => {
match bank_transfer_data.deref() {
- api_models::payments::BankTransferData::AchBankTransfer(_) => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. } => {
Ok(format!("{}{}", self.base_url(connectors), "v1/charges"))
}
+ _ => Ok(format!(
+ "{}{}",
+ self.base_url(connectors),
+ "v1/payment_intents"
+ )),
}
}
_ => Ok(format!(
@@ -1682,9 +1687,6 @@ impl api::IncomingWebhook for Stripe {
stripe::WebhookEventType::SourceChargeable => {
api::IncomingWebhookEvent::SourceChargeable
}
- stripe::WebhookEventType::SourceTransactionCreated => {
- api::IncomingWebhookEvent::SourceTransactionCreated
- }
stripe::WebhookEventType::ChargeSucceeded => api::IncomingWebhookEvent::ChargeSucceeded,
stripe::WebhookEventType::DisputeCreated => api::IncomingWebhookEvent::DisputeOpened,
stripe::WebhookEventType::DisputeClosed => api::IncomingWebhookEvent::DisputeCancelled,
@@ -1695,6 +1697,12 @@ impl api::IncomingWebhook for Stripe {
.status
.ok_or(errors::ConnectorError::WebhookEventTypeNotFound)?,
)?,
+ stripe::WebhookEventType::PaymentIntentPartiallyFunded => {
+ api::IncomingWebhookEvent::PaymentIntentPartiallyFunded
+ }
+ stripe::WebhookEventType::PaymentIntentRequiresAction => {
+ api::IncomingWebhookEvent::PaymentActionRequired
+ }
_ => Err(errors::ConnectorError::WebhookEventTypeNotFound).into_report()?,
})
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index 8609a500538..228427c29a2 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -15,7 +15,7 @@ use url::Url;
use uuid::Uuid;
use crate::{
- collect_missing_value_keys, consts,
+ collect_missing_value_keys, connector, consts,
core::errors,
services,
types::{self, api, storage::enums, transformers::ForeignFrom},
@@ -286,6 +286,61 @@ pub struct StripeBankRedirectData {
pub bank_specific_data: Option<BankSpecificData>,
}
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct AchBankTransferData {
+ #[serde(rename = "owner[email]")]
+ pub email: Email,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct BacsBankTransferData {
+ #[serde(rename = "payment_method_data[type]")]
+ pub payment_method_data_type: StripePaymentMethodType,
+ #[serde(rename = "payment_method_options[customer_balance][bank_transfer][type]")]
+ pub bank_transfer_type: BankTransferType,
+ #[serde(rename = "payment_method_options[customer_balance][funding_type]")]
+ pub balance_funding_type: BankTransferType,
+ #[serde(rename = "payment_method_types[0]")]
+ pub payment_method_type: StripePaymentMethodType,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct SepaBankTransferData {
+ #[serde(rename = "payment_method_data[type]")]
+ pub payment_method_data_type: StripePaymentMethodType,
+ #[serde(rename = "payment_method_options[customer_balance][bank_transfer][type]")]
+ pub bank_transfer_type: BankTransferType,
+ #[serde(rename = "payment_method_options[customer_balance][funding_type]")]
+ pub balance_funding_type: BankTransferType,
+ #[serde(rename = "payment_method_types[0]")]
+ pub payment_method_type: StripePaymentMethodType,
+ #[serde(
+ rename = "payment_method_options[customer_balance][bank_transfer][eu_bank_transfer][country]"
+ )]
+ pub country: api_models::enums::CountryAlpha2,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+pub struct StripeAchSourceRequest {
+ #[serde(rename = "type")]
+ pub transfer_type: StripePaymentMethodType,
+ #[serde(flatten)]
+ pub payment_method_data: AchBankTransferData,
+ pub currency: String,
+}
+
+// Remove untagged when Deserialize is added
+#[derive(Debug, Eq, PartialEq, Serialize)]
+#[serde(untagged)]
+pub enum StripePaymentMethodData {
+ Card(StripeCardData),
+ PayLater(StripePayLaterData),
+ Wallet(StripeWallet),
+ BankRedirect(StripeBankRedirectData),
+ BankDebit(StripeBankDebitData),
+ BankTransfer(StripeBankTransferData),
+}
+
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(tag = "payment_method_data[type]")]
pub enum BankDebitData {
@@ -332,24 +387,12 @@ pub struct BankTransferData {
pub email: Email,
}
-#[derive(Debug, Eq, PartialEq, Serialize)]
-pub struct StripeAchSourceRequest {
- #[serde(rename = "type")]
- pub transfer_type: StripePaymentMethodType,
- #[serde(rename = "owner[email]")]
- pub email: Email,
- pub currency: String,
-}
-
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
-pub enum StripePaymentMethodData {
- Card(StripeCardData),
- PayLater(StripePayLaterData),
- Wallet(StripeWallet),
- BankRedirect(StripeBankRedirectData),
- BankDebit(StripeBankDebitData),
- AchBankTransfer(BankTransferData),
+pub enum StripeBankTransferData {
+ AchBankTransfer(Box<AchBankTransferData>),
+ SepaBankTransfer(Box<SepaBankTransferData>),
+ BacsBankTransfers(Box<BacsBankTransferData>),
}
#[derive(Debug, Eq, PartialEq, Serialize)]
@@ -445,6 +488,16 @@ pub enum StripePaymentMethodType {
Alipay,
#[serde(rename = "p24")]
Przelewy24,
+ CustomerBalance,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
+#[serde(rename_all = "snake_case")]
+pub enum BankTransferType {
+ GbBankTransfer,
+ EuBankTransfer,
+ #[serde(rename = "bank_transfer")]
+ BankTransfers,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
@@ -1011,13 +1064,63 @@ fn create_stripe_payment_method(
}
payments::PaymentMethodData::BankTransfer(bank_transfer_data) => {
match bank_transfer_data.deref() {
- payments::BankTransferData::AchBankTransfer(ach_bank_transfer_data) => Ok((
- StripePaymentMethodData::AchBankTransfer(BankTransferData {
- email: ach_bank_transfer_data.billing_details.email.to_owned(),
- }),
+ payments::BankTransferData::AchBankTransfer { billing_details } => Ok((
+ StripePaymentMethodData::BankTransfer(StripeBankTransferData::AchBankTransfer(
+ Box::new(AchBankTransferData {
+ email: billing_details.email.to_owned(),
+ }),
+ )),
StripePaymentMethodType::AchCreditTransfer,
StripeBillingAddress::default(),
)),
+ payments::BankTransferData::SepaBankTransfer {
+ billing_details,
+ country,
+ } => {
+ let billing_details = StripeBillingAddress {
+ email: Some(billing_details.email.clone()),
+ name: Some(billing_details.name.clone()),
+ ..Default::default()
+ };
+ Ok((
+ StripePaymentMethodData::BankTransfer(
+ StripeBankTransferData::SepaBankTransfer(Box::new(
+ SepaBankTransferData {
+ payment_method_data_type:
+ StripePaymentMethodType::CustomerBalance,
+ bank_transfer_type: BankTransferType::EuBankTransfer,
+ balance_funding_type: BankTransferType::BankTransfers,
+ payment_method_type: StripePaymentMethodType::CustomerBalance,
+ country: country.to_owned(),
+ },
+ )),
+ ),
+ StripePaymentMethodType::CustomerBalance,
+ billing_details,
+ ))
+ }
+ payments::BankTransferData::BacsBankTransfer { billing_details } => {
+ let billing_details = StripeBillingAddress {
+ email: Some(billing_details.email.clone()),
+ name: Some(billing_details.name.clone()),
+ ..Default::default()
+ };
+ Ok((
+ StripePaymentMethodData::BankTransfer(
+ StripeBankTransferData::BacsBankTransfers(Box::new(
+ BacsBankTransferData {
+ payment_method_data_type:
+ StripePaymentMethodType::CustomerBalance,
+ bank_transfer_type: BankTransferType::GbBankTransfer,
+ balance_funding_type: BankTransferType::BankTransfers,
+ payment_method_type: StripePaymentMethodType::CustomerBalance,
+ },
+ )),
+ ),
+ StripePaymentMethodType::CustomerBalance,
+ billing_details,
+ ))
+ }
}
}
_ => Err(errors::ConnectorError::NotImplemented(
@@ -1336,6 +1439,20 @@ pub struct AchReceiverDetails {
pub amount_charged: i64,
}
+#[serde_with::skip_serializing_none]
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
+pub struct SepaAndBacsBankTransferInstructions {
+ pub bacs_bank_instructions: Option<BacsFinancialDetails>,
+ pub sepa_bank_instructions: Option<SepaFinancialDetails>,
+ pub receiver: SepaAndBacsReceiver,
+}
+
+#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
+pub struct SepaAndBacsReceiver {
+ pub amount_received: i64,
+ pub amount_remaining: i64,
+}
+
#[derive(Debug, Default, Eq, PartialEq, Deserialize)]
pub struct PaymentSyncResponse {
#[serde(flatten)]
@@ -1455,7 +1572,8 @@ impl ForeignFrom<(Option<StripePaymentMethodOptions>, String)> for types::Mandat
| StripePaymentMethodOptions::Alipay {}
| StripePaymentMethodOptions::Sepa {}
| StripePaymentMethodOptions::Bancontact {}
- | StripePaymentMethodOptions::Przelewy24 {} => None,
+ | StripePaymentMethodOptions::Przelewy24 {}
+ | StripePaymentMethodOptions::CustomerBalance {} => None,
}),
payment_method_id: Some(payment_method_id),
}
@@ -1470,9 +1588,12 @@ impl<F, T>
fn try_from(
item: types::ResponseRouterData<F, PaymentIntentResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- let redirection_data = item.response.next_action.map(|next_action_response| {
- services::RedirectForm::from((next_action_response.get_url(), services::Method::Get))
- });
+ let redirect_data = item.response.next_action.clone();
+ let redirection_data = redirect_data
+ .and_then(|redirection_data| redirection_data.get_url())
+ .map(|redirection_url| {
+ services::RedirectForm::from((redirection_url, services::Method::Get))
+ });
let mandate_reference = item.response.payment_method.map(|pm| {
types::MandateReference::foreign_from((item.response.payment_method_options, pm))
@@ -1501,6 +1622,34 @@ impl<F, T>
}
}
+pub fn get_connector_metadata(
+ next_action: Option<&StripeNextActionResponse>,
+ amount: i64,
+) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> {
+ let next_action_response = next_action
+ .and_then(|next_action_response| match next_action_response {
+ StripeNextActionResponse::DisplayBankTransferInstructions(response) => {
+ Some(SepaAndBacsBankTransferInstructions {
+ sepa_bank_instructions: response.financial_addresses[0].iban.to_owned(),
+ bacs_bank_instructions: response.financial_addresses[0]
+ .sort_code
+ .to_owned(),
+ receiver: SepaAndBacsReceiver {
+ amount_received: amount - response.amount_remaining,
+ amount_remaining: response.amount_remaining,
+ },
+ })
+ }
+ _ => None,
+ }).map(|response| {
+ common_utils::ext_traits::Encode::<SepaAndBacsBankTransferInstructions>::encode_to_value(
+ &response,
+ )
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ }).transpose()?;
+ Ok(next_action_response)
+}
+
impl<F, T>
TryFrom<types::ResponseRouterData<F, PaymentIntentSyncResponse, T, types::PaymentsResponseData>>
for types::RouterData<F, T, types::PaymentsResponseData>
@@ -1514,15 +1663,11 @@ impl<F, T>
types::PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let redirection_data = item
- .response
- .next_action
- .as_ref()
- .map(|next_action_response| {
- services::RedirectForm::from((
- next_action_response.get_url(),
- services::Method::Get,
- ))
+ let redirect_data = item.response.next_action.clone();
+ let redirection_data = redirect_data
+ .and_then(|redirection_data| redirection_data.get_url())
+ .map(|redirection_url| {
+ services::RedirectForm::from((redirection_url, services::Method::Get))
});
let mandate_reference = item.response.payment_method.clone().map(|pm| {
@@ -1542,12 +1687,15 @@ impl<F, T>
status_code: item.http_code,
});
+ let connector_metadata =
+ get_connector_metadata(item.response.next_action.as_ref(), item.response.amount)?;
+
let response = error_res.map_or(
Ok(types::PaymentsResponseData::TransactionResponse {
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data,
mandate_reference,
- connector_metadata: None,
+ connector_metadata,
network_txn_id: None,
}),
Err,
@@ -1570,9 +1718,12 @@ impl<F, T>
fn try_from(
item: types::ResponseRouterData<F, SetupIntentResponse, T, types::PaymentsResponseData>,
) -> Result<Self, Self::Error> {
- let redirection_data = item.response.next_action.map(|next_action_response| {
- services::RedirectForm::from((next_action_response.get_url(), services::Method::Get))
- });
+ let redirect_data = item.response.next_action.clone();
+ let redirection_data = redirect_data
+ .and_then(|redirection_data| redirection_data.get_url())
+ .map(|redirection_url| {
+ services::RedirectForm::from((redirection_url, services::Method::Get))
+ });
let mandate_reference = item.response.payment_method.map(|pm| {
types::MandateReference::foreign_from((item.response.payment_method_options, pm))
@@ -1616,18 +1767,20 @@ pub enum StripeNextActionResponse {
AlipayHandleRedirect(StripeRedirectToUrlResponse),
VerifyWithMicrodeposits(StripeVerifyWithMicroDepositsResponse),
WechatPayDisplayQrCode(StripeRedirectToQr),
+ DisplayBankTransferInstructions(StripeBankTransferDetails),
}
impl StripeNextActionResponse {
- fn get_url(&self) -> Url {
+ fn get_url(&self) -> Option<Url> {
match self {
Self::RedirectToUrl(redirect_to_url) | Self::AlipayHandleRedirect(redirect_to_url) => {
- redirect_to_url.url.to_owned()
+ Some(redirect_to_url.url.to_owned())
}
- Self::WechatPayDisplayQrCode(redirect_to_url) => redirect_to_url.data.to_owned(),
+ Self::WechatPayDisplayQrCode(redirect_to_url) => Some(redirect_to_url.data.to_owned()),
Self::VerifyWithMicrodeposits(verify_with_microdeposits) => {
- verify_with_microdeposits.hosted_verification_url.to_owned()
+ Some(verify_with_microdeposits.hosted_verification_url.to_owned())
}
+ Self::DisplayBankTransferInstructions(_) => None,
}
}
}
@@ -1668,6 +1821,41 @@ pub struct StripeVerifyWithMicroDepositsResponse {
hosted_verification_url: Url,
}
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct StripeBankTransferDetails {
+ pub amount_remaining: i64,
+ pub currency: String,
+ pub financial_addresses: Vec<StripeFinanicalInformation>,
+ pub hosted_instructions_url: Option<String>,
+ pub reference: Option<String>,
+ #[serde(rename = "type")]
+ pub bank_transfer_type: Option<String>,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct StripeFinanicalInformation {
+ pub iban: Option<SepaFinancialDetails>,
+ pub sort_code: Option<BacsFinancialDetails>,
+ pub supported_networks: Vec<String>,
+ #[serde(rename = "type")]
+ pub financial_info_type: String,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct SepaFinancialDetails {
+ pub account_holder_name: String,
+ pub bic: String,
+ pub country: String,
+ pub iban: String,
+}
+
+#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
+pub struct BacsFinancialDetails {
+ pub account_holder_name: String,
+ pub account_number: String,
+ pub sort_code: String,
+}
+
// REFUND :
// Type definition for Stripe RefundRequest
@@ -1872,6 +2060,7 @@ pub enum StripePaymentMethodOptions {
Alipay {},
#[serde(rename = "p24")]
Przelewy24 {},
+ CustomerBalance {},
}
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
@@ -1916,14 +2105,9 @@ impl TryFrom<&types::PaymentsPreProcessingRouterData> for StripeAchSourceRequest
fn try_from(item: &types::PaymentsPreProcessingRouterData) -> Result<Self, Self::Error> {
Ok(Self {
transfer_type: StripePaymentMethodType::AchCreditTransfer,
- email: item
- .request
- .email
- .clone()
- .get_required_value("email")
- .change_context(errors::ConnectorError::MissingRequiredField {
- field_name: "email",
- })?,
+ payment_method_data: AchBankTransferData {
+ email: connector::utils::PaymentsPreProcessingData::get_email(&item.request)?,
+ },
currency: item
.request
.currency
@@ -2006,7 +2190,7 @@ impl<F, T> TryFrom<types::ResponseRouterData<F, ChargesResponse, T, types::Payme
common_utils::ext_traits::Encode::<StripeSourceResponse>::encode_to_value(
&connector_source_response.source,
)
- .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ .change_context(errors::ConnectorError::ResponseHandlingFailed)?;
Ok(Self {
status: enums::AttemptStatus::from(item.response.status),
response: Ok(types::PaymentsResponseData::TransactionResponse {
@@ -2185,6 +2369,8 @@ pub enum WebhookEventType {
SourceChargeable,
#[serde(rename = "source.transaction.created")]
SourceTransactionCreated,
+ #[serde(rename = "payment_intent.partially_funded")]
+ PaymentIntentPartiallyFunded,
}
#[derive(Debug, Serialize, strum::Display, Deserialize, PartialEq)]
@@ -2303,11 +2489,32 @@ impl
}
api::PaymentMethodData::BankTransfer(bank_transfer_data) => {
match bank_transfer_data.deref() {
- payments::BankTransferData::AchBankTransfer(ach_bank_transfer_data) => {
- Ok(Self::AchBankTransfer(BankTransferData {
- email: ach_bank_transfer_data.billing_details.email.to_owned(),
- }))
+ payments::BankTransferData::AchBankTransfer { billing_details } => {
+ Ok(Self::BankTransfer(StripeBankTransferData::AchBankTransfer(
+ Box::new(AchBankTransferData {
+ email: billing_details.email.to_owned(),
+ }),
+ )))
}
+ payments::BankTransferData::SepaBankTransfer { country, .. } => Ok(
+ Self::BankTransfer(StripeBankTransferData::SepaBankTransfer(Box::new(
+ SepaBankTransferData {
+ payment_method_data_type: StripePaymentMethodType::CustomerBalance,
+ bank_transfer_type: BankTransferType::EuBankTransfer,
+ balance_funding_type: BankTransferType::BankTransfers,
+ payment_method_type: StripePaymentMethodType::CustomerBalance,
+ country: country.to_owned(),
+ },
+ ))),
+ ),
+ payments::BankTransferData::BacsBankTransfer { .. } => Ok(Self::BankTransfer(
+ StripeBankTransferData::BacsBankTransfers(Box::new(BacsBankTransferData {
+ payment_method_data_type: StripePaymentMethodType::CustomerBalance,
+ bank_transfer_type: BankTransferType::GbBankTransfer,
+ balance_funding_type: BankTransferType::BankTransfers,
+ payment_method_type: StripePaymentMethodType::CustomerBalance,
+ })),
+ )),
}
}
api::PaymentMethodData::MandatePayment | api::PaymentMethodData::Crypto(_) => {
@@ -2326,35 +2533,58 @@ impl
pub struct StripeGpayToken {
pub id: String,
}
+
pub fn get_bank_transfer_request_data(
req: &types::PaymentsAuthorizeRouterData,
bank_transfer_data: &api_models::payments::BankTransferData,
) -> CustomResult<Option<String>, errors::ConnectorError> {
match bank_transfer_data {
- api_models::payments::BankTransferData::AchBankTransfer(_) => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. } => {
let req = ChargesRequest::try_from(req)?;
let request = utils::Encode::<ChargesRequest>::url_encode(&req)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
Ok(Some(request))
}
+ _ => {
+ let req = PaymentIntentRequest::try_from(req)?;
+ let request = utils::Encode::<PaymentIntentRequest>::url_encode(&req)
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Some(request))
+ }
}
}
+
pub fn get_bank_transfer_authorize_response(
data: &types::PaymentsAuthorizeRouterData,
res: types::Response,
- _bank_transfer_data: &api_models::payments::BankTransferData,
+ bank_transfer_data: &api_models::payments::BankTransferData,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: ChargesResponse = res
- .response
- .parse_struct("ChargesResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- types::RouterData::try_from(types::ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- })
- .change_context(errors::ConnectorError::ResponseHandlingFailed)
+ match bank_transfer_data {
+ api_models::payments::BankTransferData::AchBankTransfer { .. } => {
+ let response: ChargesResponse = res
+ .response
+ .parse_struct("ChargesResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ _ => {
+ let response: PaymentIntentResponse = res
+ .response
+ .parse_struct("PaymentIntentResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ }
}
pub fn construct_file_upload_request(
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index f68e54ef9f0..fa0488b65ee 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -159,6 +159,16 @@ impl<Flow, Request, Response> RouterData for types::RouterData<Flow, Request, Re
}
}
+pub trait PaymentsPreProcessingData {
+ fn get_email(&self) -> Result<Email, Error>;
+}
+
+impl PaymentsPreProcessingData for types::PaymentsPreProcessingData {
+ fn get_email(&self) -> Result<Email, Error> {
+ self.email.clone().ok_or_else(missing_field_err("email"))
+ }
+}
+
pub trait PaymentsAuthorizeRequestData {
fn is_auto_capture(&self) -> Result<bool, Error>;
fn get_email(&self) -> Result<Email, Error>;
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index a8682829b01..a2689928139 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -881,6 +881,9 @@ pub async fn list_payment_methods(
let mut bank_debits_consolidated_hm =
HashMap::<api_enums::PaymentMethodType, Vec<String>>::new();
+ let mut bank_transfer_consolidated_hm =
+ HashMap::<api_enums::PaymentMethodType, Vec<String>>::new();
+
for element in response.clone() {
let payment_method = element.payment_method;
let payment_method_type = element.payment_method_type;
@@ -982,6 +985,17 @@ pub async fn list_payment_methods(
bank_debits_consolidated_hm.insert(element.payment_method_type, vec![connector]);
}
}
+
+ if element.payment_method == api_enums::PaymentMethod::BankTransfer {
+ let connector = element.connector.clone();
+ if let Some(vector_of_connectors) =
+ bank_transfer_consolidated_hm.get_mut(&element.payment_method_type)
+ {
+ vector_of_connectors.push(connector);
+ } else {
+ bank_transfer_consolidated_hm.insert(element.payment_method_type, vec![connector]);
+ }
+ }
}
let mut payment_method_responses: Vec<ResponsePaymentMethodsEnabled> = vec![];
@@ -1002,6 +1016,7 @@ pub async fn list_payment_methods(
card_networks: None,
bank_names: None,
bank_debits: None,
+ bank_transfers: None,
})
}
@@ -1028,6 +1043,7 @@ pub async fn list_payment_methods(
payment_experience: None,
bank_names: None,
bank_debits: None,
+ bank_transfers: None,
})
}
@@ -1050,6 +1066,7 @@ pub async fn list_payment_methods(
payment_experience: None,
card_networks: None,
bank_debits: None,
+ bank_transfers: None,
}
})
}
@@ -1073,8 +1090,9 @@ pub async fn list_payment_methods(
payment_experience: None,
card_networks: None,
bank_debits: Some(api_models::payment_methods::BankDebitTypes {
- eligible_connectors: connectors,
+ eligible_connectors: connectors.clone(),
}),
+ bank_transfers: None,
}
})
}
@@ -1086,6 +1104,32 @@ pub async fn list_payment_methods(
});
}
+ let mut bank_transfer_payment_method_types = vec![];
+
+ for key in bank_transfer_consolidated_hm.iter() {
+ let payment_method_type = *key.0;
+ let connectors = key.1.clone();
+ bank_transfer_payment_method_types.push({
+ ResponsePaymentMethodTypes {
+ payment_method_type,
+ bank_names: None,
+ payment_experience: None,
+ card_networks: None,
+ bank_debits: None,
+ bank_transfers: Some(api_models::payment_methods::BankTransferTypes {
+ eligible_connectors: connectors,
+ }),
+ }
+ })
+ }
+
+ if !bank_transfer_payment_method_types.is_empty() {
+ payment_method_responses.push(ResponsePaymentMethodsEnabled {
+ payment_method: api_enums::PaymentMethod::BankTransfer,
+ payment_method_types: bank_transfer_payment_method_types,
+ });
+ }
+
response
.is_empty()
.then(|| Err(report!(errors::ApiErrorResponse::PaymentMethodNotFound)))
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 8b9e1c40e84..fb068f0b87b 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -691,7 +691,7 @@ where
//TODO: For ACH transfers, if preprocessing_step is not required for connectors encountered in future, add the check
let router_data_and_should_continue_payment = match payment_data.payment_method_data.clone() {
Some(api_models::payments::PaymentMethodData::BankTransfer(data)) => match data.deref() {
- api_models::payments::BankTransferData::AchBankTransfer(_) => {
+ api_models::payments::BankTransferData::AchBankTransfer { .. } => {
if payment_data.payment_attempt.preprocessing_step_id.is_none() {
(
router_data.preprocessing_steps(state, connector).await?,
@@ -701,6 +701,7 @@ where
(router_data, should_continue_payment)
}
}
+ _ => (router_data, should_continue_payment),
},
_ => (router_data, should_continue_payment),
};
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 777af030c57..b02d5d5003c 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -218,7 +218,8 @@ impl ForeignTryFrom<api_enums::IntentStatus> for storage_enums::EventType {
api_enums::IntentStatus::Succeeded => Ok(Self::PaymentSucceeded),
api_enums::IntentStatus::Failed => Ok(Self::PaymentFailed),
api_enums::IntentStatus::Processing => Ok(Self::PaymentProcessing),
- api_enums::IntentStatus::RequiresMerchantAction => Ok(Self::ActionRequired),
+ api_enums::IntentStatus::RequiresMerchantAction
+ | api_enums::IntentStatus::RequiresCustomerAction => Ok(Self::ActionRequired),
_ => Err(errors::ValidationError::IncorrectValueProvided {
field_name: "intent_status",
}),
|
feat
|
SEPA and BACS bank transfers through stripe (#930)
|
9010214c6e62a65f91e0eeca6d5f21468e5c63aa
|
2024-11-22 00:30:46
|
Debarati Ghatak
|
fix(connector): [Novalnet] Get email from customer email if billing.email is not present (#6619)
| false
|
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
index f9bbe8398cb..b2bf76944c0 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
@@ -4,11 +4,7 @@ use api_models::webhooks::IncomingWebhookEvent;
use cards::CardNumber;
use common_enums::{enums, enums as api_enums};
use common_utils::{
- consts,
- ext_traits::OptionExt,
- pii::{Email, IpAddress},
- request::Method,
- types::StringMinorUnit,
+ consts, ext_traits::OptionExt, pii::Email, request::Method, types::StringMinorUnit,
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
@@ -32,9 +28,8 @@ use strum::Display;
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{
- self, ApplePay, BrowserInformationData, PaymentsAuthorizeRequestData,
- PaymentsCancelRequestData, PaymentsCaptureRequestData, PaymentsSyncRequestData,
- RefundsRequestData, RouterData as _,
+ self, ApplePay, PaymentsAuthorizeRequestData, PaymentsCancelRequestData,
+ PaymentsCaptureRequestData, PaymentsSyncRequestData, RefundsRequestData, RouterData as _,
},
};
@@ -82,7 +77,6 @@ pub struct NovalnetPaymentsRequestCustomer {
email: Email,
mobile: Option<Secret<String>>,
billing: Option<NovalnetPaymentsRequestBilling>,
- customer_ip: Option<Secret<String, IpAddress>>,
no_nc: i64,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
@@ -194,20 +188,15 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
country_code: item.router_data.get_optional_billing_country(),
};
- let customer_ip = item
- .router_data
- .request
- .get_browser_info()?
- .get_ip_address()
- .ok();
-
let customer = NovalnetPaymentsRequestCustomer {
first_name: item.router_data.get_billing_first_name()?,
last_name: item.router_data.get_billing_last_name()?,
- email: item.router_data.get_billing_email()?,
+ email: item
+ .router_data
+ .get_billing_email()
+ .or(item.router_data.request.get_email())?,
mobile: item.router_data.get_optional_billing_phone_number(),
billing: Some(billing),
- customer_ip,
// no_nc is used to indicate if minimal customer data is passed or not
no_nc: 1,
};
|
fix
|
[Novalnet] Get email from customer email if billing.email is not present (#6619)
|
354f5306e7c2220ba5dd8046b899ad4ed1791ec0
|
2024-09-27 18:50:29
|
awasthi21
|
feat(connector): [Paybox] Add 3DS Flow (#6088)
| false
|
diff --git a/config/config.example.toml b/config/config.example.toml
index cf6703f43d4..a6aeba7427a 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -234,6 +234,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -414,6 +415,7 @@ cybersource = { payment_method = "card" }
nmi = { payment_method = "card" }
payme = { payment_method = "card" }
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
[dummy_connector]
enabled = true # Whether dummy connector is enabled or not
diff --git a/config/deployments/integration_test.toml b/config/deployments/integration_test.toml
index 3a54c5ef08f..35385af5974 100644
--- a/config/deployments/integration_test.toml
+++ b/config/deployments/integration_test.toml
@@ -75,6 +75,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -348,6 +349,7 @@ cybersource = { payment_method = "card" }
nmi.payment_method = "card"
payme.payment_method = "card"
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
diff --git a/config/deployments/production.toml b/config/deployments/production.toml
index ec3737a5c64..cab8317dfa4 100644
--- a/config/deployments/production.toml
+++ b/config/deployments/production.toml
@@ -79,6 +79,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-live.sagepay.com/"
opennode.base_url = "https://api.opennode.com"
paybox.base_url = "https://ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://tpeweb.paybox.com/"
payeezy.base_url = "https://api.payeezy.com/"
payme.base_url = "https://live.payme.io/"
payone.base_url = "https://payment.payone.com/"
@@ -361,6 +362,7 @@ cybersource = { payment_method = "card" }
nmi.payment_method = "card"
payme.payment_method = "card"
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
diff --git a/config/deployments/sandbox.toml b/config/deployments/sandbox.toml
index 1c605ef35ac..78972c0b290 100644
--- a/config/deployments/sandbox.toml
+++ b/config/deployments/sandbox.toml
@@ -79,6 +79,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -365,6 +366,7 @@ cybersource = { payment_method = "card" }
nmi.payment_method = "card"
payme.payment_method = "card"
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
#tokenization configuration which describe token lifetime and payment method for specific connector
[tokenization]
diff --git a/config/development.toml b/config/development.toml
index 3cdb4f31112..d723e09ec4b 100644
--- a/config/development.toml
+++ b/config/development.toml
@@ -243,6 +243,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -542,6 +543,7 @@ cybersource = { payment_method = "card" }
nmi = { payment_method = "card" }
payme = { payment_method = "card" }
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
[connector_customer]
connector_list = "gocardless,stax,stripe"
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index e196e123e84..fad5759648b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -163,6 +163,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -318,6 +319,7 @@ cybersource = { payment_method = "card" }
nmi = { payment_method = "card" }
payme = { payment_method = "card" }
deutschebank = { payment_method = "bank_debit" }
+paybox = { payment_method = "card" }
[dummy_connector]
enabled = true
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index 007715a92e5..3863f5364b5 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -3997,10 +3997,11 @@ key1 = "datatrans MerchantId"
payment_method_type = "Discover"
[[paybox.debit]]
payment_method_type = "CartesBancaires"
-[paybox.connector_auth.SignatureKey]
+[paybox.connector_auth.MultiAuthKey]
api_key="SITE Key"
key1="Rang Identifier"
api_secret="CLE Secret"
+key2 ="Merchant Id"
[wellsfargo]
[[wellsfargo.credit]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index 5d4e55a361e..0dc86b2f555 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -2939,10 +2939,11 @@ key1="Public Api Key"
payment_method_type = "Discover"
[[paybox.debit]]
payment_method_type = "CartesBancaires"
-[paybox.connector_auth.SignatureKey]
+[paybox.connector_auth.MultiAuthKey]
api_key="SITE Key"
key1="Rang Identifier"
api_secret="CLE Secret"
+key2 ="Merchant Id"
[datatrans]
[[datatrans.credit]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index d260970a57f..7861d53d127 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -3990,10 +3990,11 @@ key1 = "datatrans MerchantId"
payment_method_type = "Discover"
[[paybox.debit]]
payment_method_type = "CartesBancaires"
-[paybox.connector_auth.SignatureKey]
+[paybox.connector_auth.MultiAuthKey]
api_key="SITE Key"
key1="Rang Identifier"
api_secret="CLE Secret"
+key2 ="Merchant Id"
[wellsfargo]
[[wellsfargo.credit]]
diff --git a/crates/hyperswitch_interfaces/src/configs.rs b/crates/hyperswitch_interfaces/src/configs.rs
index 97223040ec6..793328f98a4 100644
--- a/crates/hyperswitch_interfaces/src/configs.rs
+++ b/crates/hyperswitch_interfaces/src/configs.rs
@@ -58,7 +58,7 @@ pub struct Connectors {
pub nuvei: ConnectorParams,
pub opayo: ConnectorParams,
pub opennode: ConnectorParams,
- pub paybox: ConnectorParams,
+ pub paybox: ConnectorParamsWithSecondaryBaseUrl,
pub payeezy: ConnectorParams,
pub payme: ConnectorParams,
pub payone: ConnectorParams,
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 88011529bbf..254a168eb33 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -2285,6 +2285,121 @@ impl Default for super::settings::RequiredFields {
),
}
),
+ (
+ enums::Connector::Paybox,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from(
+ [
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_number".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_number".to_string(),
+ display_name: "card_number".to_string(),
+ field_type: enums::FieldType::UserCardNumber,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_month".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_month".to_string(),
+ display_name: "card_exp_month".to_string(),
+ field_type: enums::FieldType::UserCardExpiryMonth,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_year".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_year".to_string(),
+ display_name: "card_exp_year".to_string(),
+ field_type: enums::FieldType::UserCardExpiryYear,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_cvc".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_cvc".to_string(),
+ display_name: "card_cvc".to_string(),
+ field_type: enums::FieldType::UserCardCvc,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.first_name".to_string(),
+ display_name: "card_holder_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: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ 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.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![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+
+ ]
+ ),
+ }
+ ),
(
enums::Connector::Payme,
RequiredFieldFinal {
@@ -5248,6 +5363,120 @@ impl Default for super::settings::RequiredFields {
]
),
}
+ ),(
+ enums::Connector::Paybox,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::from(
+ [
+ (
+ "email".to_string(),
+ RequiredFieldInfo {
+ required_field: "email".to_string(),
+ display_name: "email".to_string(),
+ field_type: enums::FieldType::UserEmailAddress,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_number".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_number".to_string(),
+ display_name: "card_number".to_string(),
+ field_type: enums::FieldType::UserCardNumber,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_month".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_month".to_string(),
+ display_name: "card_exp_month".to_string(),
+ field_type: enums::FieldType::UserCardExpiryMonth,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_exp_year".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_exp_year".to_string(),
+ display_name: "card_exp_year".to_string(),
+ field_type: enums::FieldType::UserCardExpiryYear,
+ value: None,
+ }
+ ),
+ (
+ "payment_method_data.card.card_cvc".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.card.card_cvc".to_string(),
+ display_name: "card_cvc".to_string(),
+ field_type: enums::FieldType::UserCardCvc,
+ value: None,
+ }
+ ),
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.first_name".to_string(),
+ display_name: "card_holder_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: "card_holder_name".to_string(),
+ field_type: enums::FieldType::UserFullName,
+ 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.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![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ )
+
+ ]
+ ),
+ }
),
(
enums::Connector::Payme,
diff --git a/crates/router/src/connector/paybox.rs b/crates/router/src/connector/paybox.rs
index 0a7f74a048f..a251679be85 100644
--- a/crates/router/src/connector/paybox.rs
+++ b/crates/router/src/connector/paybox.rs
@@ -6,11 +6,16 @@ use error_stack::{report, ResultExt};
use masking::ExposeInterface;
use transformers as paybox;
-use super::utils::{self as connector_utils};
+use super::utils::{
+ RouterData, {self as connector_utils},
+};
use crate::{
configs::settings,
connector::utils,
- core::errors::{self, CustomResult},
+ core::{
+ errors::{self, CustomResult},
+ payments,
+ },
events::connector_api_logs::ConnectorEvent,
headers,
services::{
@@ -51,6 +56,7 @@ impl api::Refund for Paybox {}
impl api::RefundExecute for Paybox {}
impl api::RefundSync for Paybox {}
impl api::PaymentToken for Paybox {}
+impl api::PaymentsCompleteAuthorize for Paybox {}
impl ConnectorIntegration<api::Void, types::PaymentsCancelData, types::PaymentsResponseData>
for Paybox
{
@@ -182,10 +188,17 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
fn get_url(
&self,
- _req: &types::PaymentsAuthorizeRouterData,
+ req: &types::PaymentsAuthorizeRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Ok(self.base_url(connectors).to_string())
+ if req.is_three_ds() {
+ Ok(format!(
+ "{}cgi/RemoteMPI.cgi",
+ connectors.paybox.secondary_base_url
+ ))
+ } else {
+ Ok(self.base_url(connectors).to_string())
+ }
}
fn get_request_body(
@@ -229,7 +242,8 @@ impl ConnectorIntegration<api::Authorize, types::PaymentsAuthorizeData, types::P
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
- let response: paybox::PayboxResponse = paybox::parse_url_encoded_to_struct(res.response)?;
+ let response: paybox::PayboxResponse =
+ paybox::parse_paybox_response(res.response, data.is_three_ds())?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
types::RouterData::try_from(types::ResponseRouterData {
@@ -463,7 +477,8 @@ impl ConnectorIntegration<api::Execute, types::RefundsData, types::RefundsRespon
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<types::RefundsRouterData<api::Execute>, errors::ConnectorError> {
- let response: paybox::PayboxResponse = paybox::parse_url_encoded_to_struct(res.response)?;
+ let response: paybox::TransactionResponse =
+ paybox::parse_url_encoded_to_struct(res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
types::RouterData::try_from(types::ResponseRouterData {
@@ -578,3 +593,104 @@ impl api::IncomingWebhook for Paybox {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
}
+
+impl
+ ConnectorIntegration<
+ api::CompleteAuthorize,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ > for Paybox
+{
+ fn get_headers(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
+ self.build_headers(req, connectors)
+ }
+ fn get_content_type(&self) -> &'static str {
+ self.common_get_content_type()
+ }
+ fn get_url(
+ &self,
+ _req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<String, errors::ConnectorError> {
+ Ok(self.base_url(connectors).to_string())
+ }
+ fn get_request_body(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ _connectors: &settings::Connectors,
+ ) -> CustomResult<RequestContent, errors::ConnectorError> {
+ let amount = utils::convert_amount(
+ self.amount_converter,
+ req.request.minor_amount,
+ req.request.currency,
+ )?;
+
+ let connector_router_data = paybox::PayboxRouterData::from((amount, req));
+ let connector_req = paybox::PaymentsRequest::try_from(&connector_router_data)?;
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+ }
+ fn build_request(
+ &self,
+ req: &types::PaymentsCompleteAuthorizeRouterData,
+ connectors: &settings::Connectors,
+ ) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
+ Ok(Some(
+ services::RequestBuilder::new()
+ .method(services::Method::Post)
+ .url(&types::PaymentsCompleteAuthorizeType::get_url(
+ self, req, connectors,
+ )?)
+ .headers(types::PaymentsCompleteAuthorizeType::get_headers(
+ self, req, connectors,
+ )?)
+ .set_body(types::PaymentsCompleteAuthorizeType::get_request_body(
+ self, req, connectors,
+ )?)
+ .build(),
+ ))
+ }
+ fn handle_response(
+ &self,
+ data: &types::PaymentsCompleteAuthorizeRouterData,
+ event_builder: Option<&mut ConnectorEvent>,
+ res: Response,
+ ) -> CustomResult<types::PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
+ let response: paybox::TransactionResponse =
+ paybox::parse_url_encoded_to_struct(res.response)?;
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+ types::RouterData::try_from(types::ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+
+ fn get_error_response(
+ &self,
+ res: Response,
+ event_builder: Option<&mut ConnectorEvent>,
+ ) -> CustomResult<ErrorResponse, errors::ConnectorError> {
+ self.build_error_response(res, event_builder)
+ }
+}
+impl services::ConnectorRedirectResponse for Paybox {
+ fn get_flow_type(
+ &self,
+ _query_params: &str,
+ _json_payload: Option<serde_json::Value>,
+ action: services::PaymentAction,
+ ) -> CustomResult<payments::CallConnectorAction, errors::ConnectorError> {
+ match action {
+ services::PaymentAction::PSync
+ | services::PaymentAction::CompleteAuthorize
+ | services::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
+ Ok(payments::CallConnectorAction::Trigger)
+ }
+ }
+ }
+}
diff --git a/crates/router/src/connector/paybox/transformers.rs b/crates/router/src/connector/paybox/transformers.rs
index 998461c6953..d02f75693c4 100644
--- a/crates/router/src/connector/paybox/transformers.rs
+++ b/crates/router/src/connector/paybox/transformers.rs
@@ -1,19 +1,26 @@
use bytes::Bytes;
-use common_utils::{date_time::DateFormat, errors::CustomResult, types::MinorUnit};
+use common_utils::{
+ date_time::DateFormat, errors::CustomResult, ext_traits::ValueExt, types::MinorUnit,
+};
use error_stack::ResultExt;
-use hyperswitch_connectors::utils::CardData;
-use hyperswitch_domain_models::router_data::ConnectorAuthType;
-use masking::Secret;
+use hyperswitch_connectors::utils::{AddressDetailsData, CardData};
+use hyperswitch_domain_models::{
+ router_data::ConnectorAuthType, router_response_types::RedirectForm,
+};
+use hyperswitch_interfaces::consts;
+use masking::{PeekInterface, Secret};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use crate::{
- connector::utils::{self, PaymentsAuthorizeRequestData},
+ connector::utils::{
+ self, PaymentsAuthorizeRequestData, PaymentsCompleteAuthorizeRequestData, RouterData,
+ },
core::errors,
types::{self, api, domain, storage::enums},
};
pub struct PayboxRouterData<T> {
- pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
+ pub amount: MinorUnit,
pub router_data: T,
}
@@ -31,17 +38,22 @@ const CAPTURE_REQUEST: &str = "00002";
const AUTH_AND_CAPTURE_REQUEST: &str = "00003";
const SYNC_REQUEST: &str = "00017";
const REFUND_REQUEST: &str = "00014";
-
const SUCCESS_CODE: &str = "00000";
-
const VERSION_PAYBOX: &str = "00104";
-
const PAY_ORIGIN_INTERNET: &str = "024";
+const THREE_DS_FAIL_CODE: &str = "00000000";
type Error = error_stack::Report<errors::ConnectorError>;
-#[derive(Debug, Serialize, Eq, PartialEq)]
-pub struct PayboxPaymentsRequest {
+#[derive(Debug, Serialize)]
+#[serde(untagged)]
+pub enum PayboxPaymentsRequest {
+ Card(PaymentsRequest),
+ CardThreeDs(ThreeDSPaymentsRequest),
+}
+
+#[derive(Debug, Serialize)]
+pub struct PaymentsRequest {
#[serde(rename = "DATEQ")]
pub date: String,
@@ -83,8 +95,37 @@ pub struct PayboxPaymentsRequest {
#[serde(rename = "CLE")]
pub key: Secret<String>,
-}
+ #[serde(rename = "ID3D")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub three_ds_data: Option<Secret<String>>,
+}
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "PascalCase")]
+pub struct ThreeDSPaymentsRequest {
+ id_merchant: Secret<String>,
+ id_session: String,
+ amount: MinorUnit,
+ currency: String,
+ #[serde(rename = "CCNumber")]
+ cc_number: cards::CardNumber,
+ #[serde(rename = "CCExpDate")]
+ cc_exp_date: Secret<String>,
+ #[serde(rename = "CVVCode")]
+ cvv_code: Secret<String>,
+ #[serde(rename = "URLRetour")]
+ url_retour: String,
+ #[serde(rename = "URLHttpDirect")]
+ url_http_direct: String,
+ email_porteur: common_utils::pii::Email,
+ first_name: Secret<String>,
+ last_name: Secret<String>,
+ address1: Secret<String>,
+ zip_code: Secret<String>,
+ city: String,
+ country_code: api_models::enums::CountryAlpha2,
+ total_quantity: i32,
+}
#[derive(Debug, Serialize, Eq, PartialEq)]
pub struct PayboxCaptureRequest {
#[serde(rename = "DATEQ")]
@@ -338,23 +379,49 @@ impl TryFrom<&PayboxRouterData<&types::PaymentsAuthorizeRouterData>> for PayboxP
DateFormat::DDMMYYYYHHmmss,
)
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
-
- Ok(Self {
- date: format_time.clone(),
- transaction_type,
- paybox_request_number: get_paybox_request_number()?,
- amount: item.amount,
- description_reference: item.router_data.connector_request_reference_id.clone(),
- version: VERSION_PAYBOX.to_string(),
- currency,
- card_number: req_card.card_number,
- expiration_date,
- cvv: req_card.card_cvc,
- activity: PAY_ORIGIN_INTERNET.to_string(),
- site: auth_data.site,
- rank: auth_data.rang,
- key: auth_data.cle,
- })
+ if item.router_data.is_three_ds() {
+ let address = item.router_data.get_billing_address()?;
+ Ok(Self::CardThreeDs(ThreeDSPaymentsRequest {
+ id_merchant: auth_data.merchant_id,
+ id_session: item.router_data.connector_request_reference_id.clone(),
+ amount: item.amount,
+ currency,
+ cc_number: req_card.card_number,
+ cc_exp_date: expiration_date,
+ cvv_code: req_card.card_cvc,
+ url_retour: item.router_data.request.get_complete_authorize_url()?,
+ url_http_direct: item.router_data.request.get_complete_authorize_url()?,
+ email_porteur: item.router_data.request.get_email()?,
+ first_name: address.get_first_name()?.clone(),
+ last_name: address.get_last_name()?.clone(),
+ address1: address.get_line1()?.clone(),
+ zip_code: address.get_zip()?.clone(),
+ city: address.get_city()?.clone(),
+ country_code: *address.get_country()?,
+ total_quantity: 1,
+ }))
+ } else {
+ Ok(Self::Card(PaymentsRequest {
+ date: format_time.clone(),
+ transaction_type,
+ paybox_request_number: get_paybox_request_number()?,
+ amount: item.amount,
+ description_reference: item
+ .router_data
+ .connector_request_reference_id
+ .clone(),
+ version: VERSION_PAYBOX.to_string(),
+ currency,
+ card_number: req_card.card_number,
+ expiration_date,
+ cvv: req_card.card_cvc,
+ activity: PAY_ORIGIN_INTERNET.to_string(),
+ site: auth_data.site,
+ rank: auth_data.rang,
+ key: auth_data.cle,
+ three_ds_data: None,
+ }))
+ }
}
_ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
}
@@ -387,21 +454,24 @@ pub struct PayboxAuthType {
pub(super) site: Secret<String>,
pub(super) rang: Secret<String>,
pub(super) cle: Secret<String>,
+ pub(super) merchant_id: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for PayboxAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
- if let ConnectorAuthType::SignatureKey {
+ if let ConnectorAuthType::MultiAuthKey {
api_key,
key1,
api_secret,
+ key2,
} = auth_type
{
Ok(Self {
site: api_key.to_owned(),
rang: key1.to_owned(),
cle: api_secret.to_owned(),
+ merchant_id: key2.to_owned(),
})
} else {
Err(errors::ConnectorError::FailedToObtainAuthType)?
@@ -409,8 +479,15 @@ impl TryFrom<&ConnectorAuthType> for PayboxAuthType {
}
}
-#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct PayboxResponse {
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum PayboxResponse {
+ NonThreeDs(TransactionResponse),
+ ThreeDs(Secret<String>),
+ Error(String),
+}
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct TransactionResponse {
#[serde(rename = "NUMTRANS")]
pub transaction_number: String,
@@ -431,6 +508,27 @@ pub fn parse_url_encoded_to_struct<T: DeserializeOwned>(
serde_qs::from_str::<T>(cow.as_ref()).change_context(errors::ConnectorError::ParsingFailed)
}
+pub fn parse_paybox_response(
+ query_bytes: Bytes,
+ is_three_ds: bool,
+) -> CustomResult<PayboxResponse, errors::ConnectorError> {
+ let (cow, _, _) = encoding_rs::ISO_8859_10.decode(&query_bytes);
+ let response_str = cow.as_ref();
+
+ if response_str.starts_with("<html>") && is_three_ds {
+ let response = response_str.to_string();
+ return Ok(if response.contains("Erreur") {
+ PayboxResponse::Error(response)
+ } else {
+ PayboxResponse::ThreeDs(response.into())
+ });
+ }
+
+ serde_qs::from_str::<TransactionResponse>(response_str)
+ .map(PayboxResponse::NonThreeDs)
+ .change_context(errors::ConnectorError::ParsingFailed)
+}
+
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum PayboxStatus {
#[serde(rename = "Remboursé")]
@@ -546,23 +644,53 @@ impl<F>
types::PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
- let response = item.response.clone();
- let status = get_status_of_request(response.response_code.clone());
- match status {
- true => Ok(Self {
- status: match item.data.request.is_auto_capture()? {
- true => enums::AttemptStatus::Charged,
- false => enums::AttemptStatus::Authorized,
- },
+ match item.response.clone() {
+ PayboxResponse::NonThreeDs(response) => {
+ let status = get_status_of_request(response.response_code.clone());
+ match status {
+ true => Ok(Self {
+ status: match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Charged,
+ false => enums::AttemptStatus::Authorized,
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ response.paybox_order_id,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: Some(serde_json::json!(PayboxMeta {
+ connector_request_id: response.transaction_number.clone()
+ })),
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ }),
+ false => Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: response.response_code.clone(),
+ message: response.response_message.clone(),
+ reason: Some(response.response_message),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(response.transaction_number),
+ }),
+ ..item.data
+ }),
+ }
+ }
+ PayboxResponse::ThreeDs(data) => Ok(Self {
+ status: enums::AttemptStatus::AuthenticationPending,
response: Ok(types::PaymentsResponseData::TransactionResponse {
- resource_id: types::ResponseId::ConnectorTransactionId(
- response.paybox_order_id,
- ),
- redirection_data: None,
+ resource_id: types::ResponseId::NoResponseId,
+ redirection_data: Some(RedirectForm::Html {
+ html_data: data.peek().to_string(),
+ }),
mandate_reference: None,
- connector_metadata: Some(serde_json::json!(PayboxMeta {
- connector_request_id: response.transaction_number.clone()
- })),
+ connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
@@ -570,14 +698,14 @@ impl<F>
}),
..item.data
}),
- false => Ok(Self {
+ PayboxResponse::Error(_) => Ok(Self {
response: Err(types::ErrorResponse {
- code: response.response_code.clone(),
- message: response.response_message.clone(),
- reason: Some(response.response_message),
+ code: consts::NO_ERROR_CODE.to_string(),
+ message: consts::NO_ERROR_MESSAGE.to_string(),
+ reason: Some(consts::NO_ERROR_MESSAGE.to_string()),
status_code: item.http_code,
attempt_status: None,
- connector_transaction_id: Some(item.response.transaction_number),
+ connector_transaction_id: None,
}),
..item.data
}),
@@ -719,12 +847,12 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, PayboxSyncResponse>>
}
}
-impl TryFrom<types::RefundsResponseRouterData<api::Execute, PayboxResponse>>
+impl TryFrom<types::RefundsResponseRouterData<api::Execute, TransactionResponse>>
for types::RefundsRouterData<api::Execute>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::Execute, PayboxResponse>,
+ item: types::RefundsResponseRouterData<api::Execute, TransactionResponse>,
) -> Result<Self, Self::Error> {
let status = get_status_of_request(item.response.response_code.clone());
match status {
@@ -756,3 +884,129 @@ pub struct PayboxErrorResponse {
pub message: String,
pub reason: Option<String>,
}
+
+impl<F>
+ TryFrom<
+ types::ResponseRouterData<
+ F,
+ TransactionResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ > for types::RouterData<F, types::CompleteAuthorizeData, types::PaymentsResponseData>
+{
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: types::ResponseRouterData<
+ F,
+ TransactionResponse,
+ types::CompleteAuthorizeData,
+ types::PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let response = item.response.clone();
+ let status = get_status_of_request(response.response_code.clone());
+ match status {
+ true => Ok(Self {
+ status: match item.data.request.is_auto_capture()? {
+ true => enums::AttemptStatus::Charged,
+ false => enums::AttemptStatus::Authorized,
+ },
+ response: Ok(types::PaymentsResponseData::TransactionResponse {
+ resource_id: types::ResponseId::ConnectorTransactionId(
+ response.paybox_order_id,
+ ),
+ redirection_data: None,
+ mandate_reference: None,
+ connector_metadata: Some(serde_json::json!(PayboxMeta {
+ connector_request_id: response.transaction_number.clone()
+ })),
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ charge_id: None,
+ }),
+ ..item.data
+ }),
+ false => Ok(Self {
+ response: Err(types::ErrorResponse {
+ code: response.response_code.clone(),
+ message: response.response_message.clone(),
+ reason: Some(response.response_message),
+ status_code: item.http_code,
+ attempt_status: None,
+ connector_transaction_id: Some(response.transaction_number),
+ }),
+ ..item.data
+ }),
+ }
+ }
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct RedirectionAuthResponse {
+ #[serde(rename = "ID3D")]
+ three_ds_data: Option<Secret<String>>,
+}
+
+impl TryFrom<&PayboxRouterData<&types::PaymentsCompleteAuthorizeRouterData>> for PaymentsRequest {
+ type Error = error_stack::Report<errors::ConnectorError>;
+ fn try_from(
+ item: &PayboxRouterData<&types::PaymentsCompleteAuthorizeRouterData>,
+ ) -> Result<Self, Self::Error> {
+ let redirect_response = item.router_data.request.redirect_response.clone().ok_or(
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "redirect_response",
+ },
+ )?;
+ let redirect_payload: RedirectionAuthResponse = redirect_response
+ .payload
+ .ok_or(errors::ConnectorError::MissingConnectorRedirectionPayload {
+ field_name: "request.redirect_response.payload",
+ })?
+ .peek()
+ .clone()
+ .parse_value("RedirectionAuthResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ match item.router_data.request.payment_method_data.clone() {
+ Some(domain::PaymentMethodData::Card(req_card)) => {
+ let auth_data: PayboxAuthType =
+ PayboxAuthType::try_from(&item.router_data.connector_auth_type)
+ .change_context(errors::ConnectorError::FailedToObtainAuthType)?;
+ let transaction_type =
+ get_transaction_type(item.router_data.request.capture_method)?;
+ let currency =
+ diesel_models::enums::Currency::iso_4217(&item.router_data.request.currency)
+ .to_string();
+ let expiration_date =
+ req_card.get_card_expiry_month_year_2_digit_with_delimiter("".to_owned())?;
+ let format_time = common_utils::date_time::format_date(
+ common_utils::date_time::now(),
+ DateFormat::DDMMYYYYHHmmss,
+ )
+ .change_context(errors::ConnectorError::RequestEncodingFailed)?;
+ Ok(Self {
+ date: format_time.clone(),
+ transaction_type,
+ paybox_request_number: get_paybox_request_number()?,
+ amount: item.router_data.request.minor_amount,
+ description_reference: item.router_data.connector_request_reference_id.clone(),
+ version: VERSION_PAYBOX.to_string(),
+ currency,
+ card_number: req_card.card_number,
+ expiration_date,
+ cvv: req_card.card_cvc,
+ activity: PAY_ORIGIN_INTERNET.to_string(),
+ site: auth_data.site,
+ rank: auth_data.rang,
+ key: auth_data.cle,
+ three_ds_data: redirect_payload.three_ds_data.map_or_else(
+ || Some(Secret::new(THREE_DS_FAIL_CODE.to_string())),
+ |data| Some(data.clone()),
+ ),
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented("Payment methods".to_string()).into()),
+ }
+ }
+}
diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs
index f9a6b461a13..79ed9e25259 100644
--- a/crates/router/src/core/payments/flows.rs
+++ b/crates/router/src/core/payments/flows.rs
@@ -226,7 +226,6 @@ default_imp_for_complete_authorize!(
connector::Noon,
connector::Opayo,
connector::Opennode,
- connector::Paybox,
connector::Payeezy,
connector::Payone,
connector::Payu,
@@ -468,7 +467,6 @@ default_imp_for_connector_redirect_response!(
connector::Nexinets,
connector::Opayo,
connector::Opennode,
- connector::Paybox,
connector::Payeezy,
connector::Payone,
connector::Payu,
diff --git a/loadtest/config/development.toml b/loadtest/config/development.toml
index 82a21f9fc9c..45b5fe13146 100644
--- a/loadtest/config/development.toml
+++ b/loadtest/config/development.toml
@@ -129,6 +129,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/"
opayo.base_url = "https://pi-test.sagepay.com/"
opennode.base_url = "https://dev-api.opennode.com"
paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php"
+paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/"
payeezy.base_url = "https://api-cert.payeezy.com/"
payme.base_url = "https://sandbox.payme.io/"
payone.base_url = "https://payment.preprod.payone.com/"
@@ -380,3 +381,5 @@ prod_intent_recipient_email = "[email protected]"
email_role_arn = ""
sts_role_session_name = ""
+[temp_locker_enable_config]
+paybox = { payment_method = "card" }
|
feat
|
[Paybox] Add 3DS Flow (#6088)
|
4dac86cebfc098dba84b4b1dfedb5712ce04e913
|
2024-09-25 16:20:26
|
Sridhar Ratnakumar
|
chore(nix): Unbreak `flake.nix` (#5867)
| false
|
diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml
new file mode 100644
index 00000000000..cc68a1b2b2c
--- /dev/null
+++ b/.github/workflows/nix.yaml
@@ -0,0 +1,17 @@
+name: "CI Nix"
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+jobs:
+ nix-ci:
+ runs-on: ${{ matrix.system }}
+ permissions:
+ contents: read
+ strategy:
+ matrix:
+ system: [x86_64-linux, aarch64-darwin]
+ steps:
+ - uses: actions/checkout@v4
+ - run: om ci --extra-access-tokens ${{ secrets.GITHUB_TOKEN }} run --systems "${{ matrix.system }}"
diff --git a/Cargo.nix b/Cargo.nix
deleted file mode 100644
index 1c3c3a086f5..00000000000
--- a/Cargo.nix
+++ /dev/null
@@ -1,5948 +0,0 @@
-# This file was @generated by cargo2nix 0.11.0.
-# It is not intended to be manually edited.
-
-args@{
- release ? true,
- rootFeatures ? [
- "api_models/default"
- "common_utils/default"
- "masking/default"
- "router_env/default"
- "router_derive/default"
- "drainer/default"
- "redis_interface/default"
- "diesel_models/default"
- "router/default"
- ],
- rustPackages,
- buildRustPackages,
- hostPlatform,
- hostPlatformCpu ? null,
- hostPlatformFeatures ? [],
- target ? null,
- codegenOpts ? null,
- profileOpts ? null,
- rustcLinkFlags ? null,
- rustcBuildFlags ? null,
- mkRustCrate,
- rustLib,
- lib,
- workspaceSrc,
-}:
-let
- workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc;
-in let
- inherit (rustLib) fetchCratesIo fetchCrateLocal fetchCrateGit fetchCrateAlternativeRegistry expandFeatures decideProfile genDrvsByProfile;
- profilesByName = {
- release = builtins.fromTOML "codegen-units = 1\nlto = true\nstrip = true\n";
- };
- rootFeatures' = expandFeatures rootFeatures;
- overridableMkRustCrate = f:
- let
- drvs = genDrvsByProfile profilesByName ({ profile, profileName }: mkRustCrate ({ inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts rustcLinkFlags rustcBuildFlags; } // (f profileName)));
- in { compileMode ? null, profileName ? decideProfile compileMode release }:
- let drv = drvs.${profileName}; in if compileMode == null then drv else drv.override { inherit compileMode; };
-in
-{
- cargo2nixVersion = "0.11.0";
- workspace = {
- api_models = rustPackages.unknown.api_models."0.1.0";
- common_utils = rustPackages.unknown.common_utils."0.1.0";
- masking = rustPackages.unknown.masking."0.1.0";
- router_env = rustPackages.unknown.router_env."0.1.0";
- router_derive = rustPackages.unknown.router_derive."0.1.0";
- drainer = rustPackages.unknown.drainer."0.1.0";
- redis_interface = rustPackages.unknown.redis_interface."0.1.0";
- diesel_models = rustPackages.unknown.diesel_models."0.1.0";
- router = rustPackages.unknown.router."0.2.0";
- };
- "registry+https://github.com/rust-lang/crates.io-index".actix."0.13.0" = overridableMkRustCrate (profileName: rec {
- name = "actix";
- version = "0.13.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f728064aca1c318585bf4bb04ffcfac9e75e508ab4e8b1bd9ba5dfe04e2cbed5"; };
- features = builtins.concatLists [
- [ "actix_derive" ]
- [ "default" ]
- [ "macros" ]
- ];
- dependencies = {
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".actix_derive."0.6.0" { profileName = "__noProfile"; };
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- crossbeam_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-channel."0.5.6" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- futures_task = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-codec."0.5.0" = overridableMkRustCrate (profileName: rec {
- name = "actix-codec";
- version = "0.5.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe"; };
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-cors."0.6.4" = overridableMkRustCrate (profileName: rec {
- name = "actix-cors";
- version = "0.6.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e"; };
- dependencies = {
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- actix_web = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" { inherit profileName; };
- derive_more = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".derive_more."0.99.17" { profileName = "__noProfile"; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-http."3.3.0" = overridableMkRustCrate (profileName: rec {
- name = "actix-http";
- version = "3.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0070905b2c4a98d184c4e81025253cb192aa8a73827553f38e9410801ceb35bb"; };
- features = builtins.concatLists [
- [ "__compress" ]
- [ "base64" ]
- [ "brotli" ]
- [ "compress-brotli" ]
- [ "compress-gzip" ]
- [ "compress-zstd" ]
- [ "default" ]
- [ "flate2" ]
- [ "h2" ]
- [ "http2" ]
- [ "local-channel" ]
- [ "rand" ]
- [ "sha1" ]
- [ "ws" ]
- [ "zstd" ]
- ];
- dependencies = {
- actix_codec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-codec."0.5.0" { inherit profileName; };
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" { inherit profileName; };
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- ahash = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ahash."0.7.6" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" { inherit profileName; };
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- brotli = rustPackages."registry+https://github.com/rust-lang/crates.io-index".brotli."3.3.4" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- bytestring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytestring."1.2.0" { inherit profileName; };
- derive_more = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".derive_more."0.99.17" { profileName = "__noProfile"; };
- encoding_rs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.31" { inherit profileName; };
- flate2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".flate2."1.0.25" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- h2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- httparse = rustPackages."registry+https://github.com/rust-lang/crates.io-index".httparse."1.8.0" { inherit profileName; };
- httpdate = rustPackages."registry+https://github.com/rust-lang/crates.io-index".httpdate."1.0.2" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- language_tags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".language-tags."0.3.2" { inherit profileName; };
- local_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".local-channel."0.1.3" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- sha1 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sha1."0.10.5" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- zstd = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zstd."0.12.2+zstd.1.5.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-macros."0.2.3" = overridableMkRustCrate (profileName: rec {
- name = "actix-macros";
- version = "0.2.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6"; };
- dependencies = {
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-router."0.5.1" = overridableMkRustCrate (profileName: rec {
- name = "actix-router";
- version = "0.5.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "http" ]
- ];
- dependencies = {
- bytestring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytestring."1.2.0" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" = overridableMkRustCrate (profileName: rec {
- name = "actix-rt";
- version = "2.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e"; };
- features = builtins.concatLists [
- [ "actix-macros" ]
- [ "default" ]
- [ "macros" ]
- ];
- dependencies = {
- actix_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-macros."0.2.3" { profileName = "__noProfile"; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-server."2.1.1" = overridableMkRustCrate (profileName: rec {
- name = "actix-server";
- version = "2.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" { inherit profileName; };
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- mio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mio."0.8.5" { inherit profileName; };
- num_cpus = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.15.0" { inherit profileName; };
- socket2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.7" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" = overridableMkRustCrate (profileName: rec {
- name = "actix-service";
- version = "2.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a"; };
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- paste = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".paste."1.0.11" { profileName = "__noProfile"; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-tls."3.0.3" = overridableMkRustCrate (profileName: rec {
- name = "actix-tls";
- version = "3.0.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9fde0cf292f7cdc7f070803cb9a0d45c018441321a78b1042ffbbb81ec333297"; };
- features = builtins.concatLists [
- [ "accept" ]
- [ "connect" ]
- [ "default" ]
- [ "http" ]
- [ "rustls" ]
- [ "tokio-rustls" ]
- [ "uri" ]
- [ "webpki-roots" ]
- ];
- dependencies = {
- actix_codec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-codec."0.5.0" { inherit profileName; };
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" { inherit profileName; };
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio_rustls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-rustls."0.23.4" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- webpki_roots = rustPackages."registry+https://github.com/rust-lang/crates.io-index".webpki-roots."0.22.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" = overridableMkRustCrate (profileName: rec {
- name = "actix-utils";
- version = "3.0.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8"; };
- dependencies = {
- local_waker = rustPackages."registry+https://github.com/rust-lang/crates.io-index".local-waker."0.1.3" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" = overridableMkRustCrate (profileName: rec {
- name = "actix-web";
- version = "4.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "464e0fddc668ede5f26ec1f9557a8d44eda948732f40c6b0ad79126930eb775f"; };
- features = builtins.concatLists [
- [ "__compress" ]
- [ "actix-macros" ]
- [ "actix-web-codegen" ]
- [ "compress-brotli" ]
- [ "compress-gzip" ]
- [ "compress-zstd" ]
- [ "cookie" ]
- [ "cookies" ]
- [ "default" ]
- [ "macros" ]
- ];
- dependencies = {
- actix_codec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-codec."0.5.0" { inherit profileName; };
- actix_http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-http."3.3.0" { inherit profileName; };
- actix_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-macros."0.2.3" { profileName = "__noProfile"; };
- actix_router = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-router."0.5.1" { inherit profileName; };
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_server = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-server."2.1.1" { inherit profileName; };
- actix_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" { inherit profileName; };
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- actix_web_codegen = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web-codegen."4.1.0" { profileName = "__noProfile"; };
- ahash = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ahash."0.7.6" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- bytestring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytestring."1.2.0" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- cookie = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cookie."0.16.2" { inherit profileName; };
- derive_more = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".derive_more."0.99.17" { profileName = "__noProfile"; };
- encoding_rs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.31" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- language_tags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".language-tags."0.3.2" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- socket2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.7" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix-web-codegen."4.1.0" = overridableMkRustCrate (profileName: rec {
- name = "actix-web-codegen";
- version = "4.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1fa9362663c8643d67b2d5eafba49e4cb2c8a053a29ed00a0bea121f17c76b13"; };
- dependencies = {
- actix_router = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-router."0.5.1" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".actix_derive."0.6.0" = overridableMkRustCrate (profileName: rec {
- name = "actix_derive";
- version = "0.6.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6d44b8fee1ced9671ba043476deddef739dd0959bf77030b26b738cc591737a7"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".adler."1.0.2" = overridableMkRustCrate (profileName: rec {
- name = "adler";
- version = "1.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ahash."0.7.6" = overridableMkRustCrate (profileName: rec {
- name = "ahash";
- version = "0.7.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- ${ if hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "windows" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" || hostPlatform.parsed.kernel.name == "freebsd" || hostPlatform.parsed.kernel.name == "openbsd" || hostPlatform.parsed.kernel.name == "netbsd" || hostPlatform.parsed.kernel.name == "dragonfly" || hostPlatform.parsed.kernel.name == "solaris" || hostPlatform.parsed.kernel.name == "illumos" || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "redox" || hostPlatform.parsed.kernel.name == "cloudabi" || hostPlatform.parsed.kernel.name == "haiku" || hostPlatform.parsed.kernel.name == "vxworks" || hostPlatform.parsed.kernel.name == "emscripten" || hostPlatform.parsed.kernel.name == "wasi" then "getrandom" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.8" { inherit profileName; };
- ${ if !((hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l") && hostPlatform.parsed.kernel.name == "none") then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- };
- buildDependencies = {
- version_check = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.7.20" = overridableMkRustCrate (profileName: rec {
- name = "aho-corasick";
- version = "0.7.20";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".alloc-no-stdlib."2.0.4" = overridableMkRustCrate (profileName: rec {
- name = "alloc-no-stdlib";
- version = "2.0.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".alloc-stdlib."0.2.2" = overridableMkRustCrate (profileName: rec {
- name = "alloc-stdlib";
- version = "0.2.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"; };
- dependencies = {
- alloc_no_stdlib = rustPackages."registry+https://github.com/rust-lang/crates.io-index".alloc-no-stdlib."2.0.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" = overridableMkRustCrate (profileName: rec {
- name = "anyhow";
- version = "1.0.68";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "unknown".api_models."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "api_models";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/api_models");
- dependencies = {
- actix_web = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" { inherit profileName; };
- common_utils = rustPackages."unknown".common_utils."0.1.0" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- frunk = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk."0.4.1" { inherit profileName; };
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- masking = rustPackages."unknown".masking."0.1.0" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- reqwest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".reqwest."0.11.14" { inherit profileName; };
- router_derive = buildRustPackages."unknown".router_derive."0.1.0" { profileName = "__noProfile"; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- strum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- utoipa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".utoipa."3.0.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".arc-swap."1.6.0" = overridableMkRustCrate (profileName: rec {
- name = "arc-swap";
- version = "1.6.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".arcstr."1.1.5" = overridableMkRustCrate (profileName: rec {
- name = "arcstr";
- version = "1.1.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3f907281554a3d0312bb7aab855a8e0ef6cbf1614d06de54105039ca8b34460e"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "substr" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".arrayref."0.3.6" = overridableMkRustCrate (profileName: rec {
- name = "arrayref";
- version = "0.3.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".arrayvec."0.7.2" = overridableMkRustCrate (profileName: rec {
- name = "arrayvec";
- version = "0.7.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".assert-json-diff."2.0.2" = overridableMkRustCrate (profileName: rec {
- name = "assert-json-diff";
- version = "2.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12"; };
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- };
- });
- "git+https://github.com/juspay/async-bb8-diesel".async-bb8-diesel."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "async-bb8-diesel";
- version = "0.1.0";
- registry = "git+https://github.com/juspay/async-bb8-diesel";
- src = fetchCrateGit {
- url = https://github.com/juspay/async-bb8-diesel;
- name = "async-bb8-diesel";
- version = "0.1.0";
- rev = "9a71d142726dbc33f41c1fd935ddaa79841c7be5";};
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- bb8 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bb8."0.8.0" { inherit profileName; };
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" = overridableMkRustCrate (profileName: rec {
- name = "async-channel";
- version = "1.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833"; };
- dependencies = {
- concurrent_queue = rustPackages."registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."2.1.0" { inherit profileName; };
- event_listener = rustPackages."registry+https://github.com/rust-lang/crates.io-index".event-listener."2.5.3" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".async-compression."0.3.15" = overridableMkRustCrate (profileName: rec {
- name = "async-compression";
- version = "0.3.15";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a"; };
- features = builtins.concatLists [
- [ "flate2" ]
- [ "gzip" ]
- [ "tokio" ]
- ];
- dependencies = {
- flate2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".flate2."1.0.25" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".async-stream."0.3.3" = overridableMkRustCrate (profileName: rec {
- name = "async-stream";
- version = "0.3.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e"; };
- dependencies = {
- async_stream_impl = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-stream-impl."0.3.3" { profileName = "__noProfile"; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".async-stream-impl."0.3.3" = overridableMkRustCrate (profileName: rec {
- name = "async-stream-impl";
- version = "0.3.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" = overridableMkRustCrate (profileName: rec {
- name = "async-trait";
- version = "0.1.63";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "eff18d764974428cf3a9328e23fc5c986f5fbed46e6cd4cdf42544df5d297ec1"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".atty."0.2.14" = overridableMkRustCrate (profileName: rec {
- name = "atty";
- version = "0.2.14";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"; };
- dependencies = {
- ${ if hostPlatform.parsed.kernel.name == "hermit" then "hermit_abi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.1.19" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "autocfg";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".awc."3.1.0" = overridableMkRustCrate (profileName: rec {
- name = "awc";
- version = "3.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0dff3fc64a176e0d4398c71b0f2c2679ff4a723c6ed8fcc68dfe5baa00665388"; };
- features = builtins.concatLists [
- [ "__compress" ]
- [ "compress-brotli" ]
- [ "compress-gzip" ]
- [ "compress-zstd" ]
- [ "cookie" ]
- [ "cookies" ]
- [ "default" ]
- [ "rustls" ]
- [ "tls-rustls" ]
- ];
- dependencies = {
- actix_codec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-codec."0.5.0" { inherit profileName; };
- actix_http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-http."3.3.0" { inherit profileName; };
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-service."2.0.2" { inherit profileName; };
- actix_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-tls."3.0.3" { inherit profileName; };
- actix_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-utils."3.0.1" { inherit profileName; };
- ahash = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ahash."0.7.6" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- cookie = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cookie."0.16.2" { inherit profileName; };
- derive_more = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".derive_more."0.99.17" { profileName = "__noProfile"; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- h2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- tls_rustls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustls."0.20.8" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-config."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-config";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3c3d1e2a1f1ab3ac6c4b884e37413eaa03eb9d901e4fc68ee8f5c1d49721680e"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "client-hyper")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rt-tokio")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rustls")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sdk_sso" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sdk-sso."0.24.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sdk_sts" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sdk-sts."0.24.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_client" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http_tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_json" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-json."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "ring" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "time" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "zeroize" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zeroize."1.5.7" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-credential-types";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bb0696a0523a39a19087747e4dafda0362dc867531e3d72a3f195564c84e5e08"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "zeroize" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zeroize."1.5.7" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-endpoint."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-endpoint";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "80a4f935ab6a1919fbfd6102a80c4fccd9ff5f47f94ba154074afe1051903261"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-http."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-http";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "82976ca4e426ee9ca3ffcf919d9b2c8d14d0cd80d43cc02173737a8f07f28d4d"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http_body" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "lazy_static" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "percent_encoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-sdk-kms."0.24.0" = overridableMkRustCrate (profileName: rec {
- name = "aws-sdk-kms";
- version = "0.24.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "434d7097fc824eee1d94cf6c5e3a30714da15b81a5b99618f8feb67f8eb2f70a"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rt-tokio")
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rustls")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_endpoint" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-endpoint."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sig_auth" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sig-auth."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_client" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http_tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_json" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-json."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio_stream" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-sdk-sso."0.24.0" = overridableMkRustCrate (profileName: rec {
- name = "aws-sdk-sso";
- version = "0.24.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ca0119bacf0c42f587506769390983223ba834e605f049babe514b2bd646dbb2"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_endpoint" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-endpoint."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sig_auth" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sig-auth."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_client" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http_tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_json" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-json."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio_stream" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-sdk-sts."0.24.0" = overridableMkRustCrate (profileName: rec {
- name = "aws-sdk-sts";
- version = "0.24.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "270b6a33969ebfcb193512fbd5e8ee5306888ad6c6d5d775cdbfb2d50d94de26"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_endpoint" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-endpoint."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sig_auth" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sig-auth."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_client" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http_tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_json" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-json."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_query" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-query."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_xml" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-xml."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-sig-auth."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-sig-auth";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "660a02a98ab1af83bd8d714afbab2d502ba9b18c49e7e4cddd6bf8837ff778cb"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sigv4" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sigv4."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-sigv4."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-sigv4";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cdaf11005b7444e6cd66f600d09861a3aeb6eb89a0f003c7c9820dbab2d15297"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "form_urlencoded")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "http")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "percent-encoding")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "sign-http")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "form_urlencoded" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".form_urlencoded."1.1.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hmac" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hmac."0.12.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "percent_encoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "sha2" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sha2."0.10.6" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "time" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-async";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "075d87b46420b28b64140f2ba88fa6b158c2877466a2acdbeaf396c25e4b9b33"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rt-tokio")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "futures_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio_stream" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-client";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "17d44078855a64d757e5c1727df29ffa6679022c38cfc4ba4e63ee9567133141"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "client-hyper")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "hyper")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "hyper-rustls")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "lazy_static")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rt-tokio")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rustls")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http_tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "fastrand" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.8.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http_body" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hyper_rustls" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper-rustls."0.23.2" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "lazy_static" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-http";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b5bd86f48d7e36fb24ee922d04d79c8353e01724b1c38757ed92593179223aa7"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rt-tokio")
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "tokio")
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "tokio-util")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes_utils" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes-utils."0.1.3" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "futures_core" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http_body" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "percent_encoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_utils" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http-tower."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-http-tower";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c8972d1b4ae3aba1a10e7106fed53a5a36bc8ef86170a84f6ddd33d36fac12ad"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http_body" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tower" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-json."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-json";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "18973f12721e27b54891386497a57e1ba09975df1c6cfeccafaf541198962aef"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-query."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-query";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2881effde104a2b0619badaad9f30ae67805e86fbbdb99e5fcc176e8bfbc1a85"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "urlencoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".urlencoding."2.1.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-types";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "da7e499c4b15bab8eb6b234df31833cc83a1bdaa691ba72d5d81efc109d9d705"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "base64_simd" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64-simd."0.7.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "itoa" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "num_integer" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-integer."0.1.45" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "ryu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ryu."1.0.12" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "time" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-smithy-xml."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-smithy-xml";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9a73082f023f4a361fe811954da0061076709198792a3d2ad3a7498e10b606a0"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "xmlparser" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".xmlparser."0.13.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".aws-types."0.54.1" = overridableMkRustCrate (profileName: rec {
- name = "aws-types";
- version = "0.54.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f8f15b34253b68cde08e39b0627cc6101bcca64351229484b4743392c035d057"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_credential_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-credential-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_async" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-async."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_client" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-client."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-http."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_smithy_types" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-smithy-types."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tracing" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- buildDependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "rustc_version" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".axum."0.6.2" = overridableMkRustCrate (profileName: rec {
- name = "axum";
- version = "0.6.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1304eab461cf02bd70b083ed8273388f9724c549b316ba3d1e213ce0e9e7fb7e"; };
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- axum_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".axum-core."0.3.1" { inherit profileName; };
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- http_body = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- hyper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- matchit = rustPackages."registry+https://github.com/rust-lang/crates.io-index".matchit."0.7.0" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- sync_wrapper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sync_wrapper."0.1.1" { inherit profileName; };
- tower = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- tower_http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-http."0.3.5" { inherit profileName; };
- tower_layer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- };
- buildDependencies = {
- rustversion = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustversion."1.0.11" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".axum-core."0.3.1" = overridableMkRustCrate (profileName: rec {
- name = "axum-core";
- version = "0.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f487e40dc9daee24d8a1779df88522f159a54a980f99cfbe43db0be0bd3444a8"; };
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- http_body = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- tower_layer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- };
- buildDependencies = {
- rustversion = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustversion."1.0.11" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" = overridableMkRustCrate (profileName: rec {
- name = "base64";
- version = "0.13.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" = overridableMkRustCrate (profileName: rec {
- name = "base64";
- version = "0.21.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".base64-simd."0.7.0" = overridableMkRustCrate (profileName: rec {
- name = "base64-simd";
- version = "0.7.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "alloc")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "detect")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "std")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "simd_abstraction" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".simd-abstraction."0.7.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".bb8."0.8.0" = overridableMkRustCrate (profileName: rec {
- name = "bb8";
- version = "0.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1627eccf3aa91405435ba240be23513eeca466b5dc33866422672264de061582"; };
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".bit-set."0.5.3" = overridableMkRustCrate (profileName: rec {
- name = "bit-set";
- version = "0.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- bit_vec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bit-vec."0.6.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".bit-vec."0.6.3" = overridableMkRustCrate (profileName: rec {
- name = "bit-vec";
- version = "0.6.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" = overridableMkRustCrate (profileName: rec {
- name = "bitflags";
- version = "1.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".blake3."1.3.3" = overridableMkRustCrate (profileName: rec {
- name = "blake3";
- version = "1.3.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "digest" ]
- [ "std" ]
- ];
- dependencies = {
- arrayref = rustPackages."registry+https://github.com/rust-lang/crates.io-index".arrayref."0.3.6" { inherit profileName; };
- arrayvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".arrayvec."0.7.2" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- constant_time_eq = rustPackages."registry+https://github.com/rust-lang/crates.io-index".constant_time_eq."0.2.4" { inherit profileName; };
- digest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.10.6" { inherit profileName; };
- };
- buildDependencies = {
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".block-buffer."0.9.0" = overridableMkRustCrate (profileName: rec {
- name = "block-buffer";
- version = "0.9.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"; };
- dependencies = {
- generic_array = rustPackages."registry+https://github.com/rust-lang/crates.io-index".generic-array."0.14.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".block-buffer."0.10.3" = overridableMkRustCrate (profileName: rec {
- name = "block-buffer";
- version = "0.10.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"; };
- dependencies = {
- generic_array = rustPackages."registry+https://github.com/rust-lang/crates.io-index".generic-array."0.14.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".brotli."3.3.4" = overridableMkRustCrate (profileName: rec {
- name = "brotli";
- version = "3.3.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68"; };
- features = builtins.concatLists [
- [ "alloc-stdlib" ]
- [ "default" ]
- [ "ffi-api" ]
- [ "std" ]
- ];
- dependencies = {
- alloc_no_stdlib = rustPackages."registry+https://github.com/rust-lang/crates.io-index".alloc-no-stdlib."2.0.4" { inherit profileName; };
- alloc_stdlib = rustPackages."registry+https://github.com/rust-lang/crates.io-index".alloc-stdlib."0.2.2" { inherit profileName; };
- brotli_decompressor = rustPackages."registry+https://github.com/rust-lang/crates.io-index".brotli-decompressor."2.3.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".brotli-decompressor."2.3.4" = overridableMkRustCrate (profileName: rec {
- name = "brotli-decompressor";
- version = "2.3.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744"; };
- features = builtins.concatLists [
- [ "alloc-stdlib" ]
- [ "std" ]
- ];
- dependencies = {
- alloc_no_stdlib = rustPackages."registry+https://github.com/rust-lang/crates.io-index".alloc-no-stdlib."2.0.4" { inherit profileName; };
- alloc_stdlib = rustPackages."registry+https://github.com/rust-lang/crates.io-index".alloc-stdlib."0.2.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".bumpalo."3.12.0" = overridableMkRustCrate (profileName: rec {
- name = "bumpalo";
- version = "3.12.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".byteorder."1.4.3" = overridableMkRustCrate (profileName: rec {
- name = "byteorder";
- version = "1.4.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" = overridableMkRustCrate (profileName: rec {
- name = "bytes";
- version = "1.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".bytes-utils."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "bytes-utils";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- either = rustPackages."registry+https://github.com/rust-lang/crates.io-index".either."1.8.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".bytestring."1.2.0" = overridableMkRustCrate (profileName: rec {
- name = "bytestring";
- version = "1.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f7f83e57d9154148e355404702e2694463241880b939570d7c97c014da7a69a1"; };
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" = overridableMkRustCrate (profileName: rec {
- name = "cc";
- version = "1.0.78";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"; };
- features = builtins.concatLists [
- [ "jobserver" ]
- [ "parallel" ]
- ];
- dependencies = {
- jobserver = rustPackages."registry+https://github.com/rust-lang/crates.io-index".jobserver."0.1.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" = overridableMkRustCrate (profileName: rec {
- name = "cfg-if";
- version = "1.0.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".clap."4.1.4" = overridableMkRustCrate (profileName: rec {
- name = "clap";
- version = "4.1.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"; };
- features = builtins.concatLists [
- [ "derive" ]
- [ "help" ]
- [ "std" ]
- [ "usage" ]
- ];
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- clap_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".clap_derive."4.1.0" { profileName = "__noProfile"; };
- clap_lex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".clap_lex."0.3.1" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".clap_derive."4.1.0" = overridableMkRustCrate (profileName: rec {
- name = "clap_derive";
- version = "4.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- heck = rustPackages."registry+https://github.com/rust-lang/crates.io-index".heck."0.4.0" { inherit profileName; };
- proc_macro_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-error."1.0.4" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".clap_lex."0.3.1" = overridableMkRustCrate (profileName: rec {
- name = "clap_lex";
- version = "0.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"; };
- dependencies = {
- os_str_bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".os_str_bytes."6.4.1" { inherit profileName; };
- };
- });
- "unknown".common_utils."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "common_utils";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/common_utils");
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- hex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
- masking = rustPackages."unknown".masking."0.1.0" { inherit profileName; };
- nanoid = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nanoid."0.4.0" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- router_env = rustPackages."unknown".router_env."0.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- signal_hook = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook."0.3.14" { inherit profileName; };
- signal_hook_tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook-tokio."0.3.1" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- devDependencies = {
- fake = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fake."2.5.0" { inherit profileName; };
- proptest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proptest."1.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".concurrent-queue."2.1.0" = overridableMkRustCrate (profileName: rec {
- name = "concurrent-queue";
- version = "2.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c278839b831783b70278b14df4d45e1beb1aad306c07bb796637de9a0e323e8e"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- crossbeam_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".config."0.13.3" = overridableMkRustCrate (profileName: rec {
- name = "config";
- version = "0.13.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "ini" ]
- [ "json" ]
- [ "json5" ]
- [ "json5_rs" ]
- [ "ron" ]
- [ "rust-ini" ]
- [ "serde_json" ]
- [ "toml" ]
- [ "yaml" ]
- [ "yaml-rust" ]
- ];
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- json5_rs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".json5."0.4.1" { inherit profileName; };
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- nom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nom."7.1.3" { inherit profileName; };
- pathdiff = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pathdiff."0.2.1" { inherit profileName; };
- ron = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ron."0.7.1" { inherit profileName; };
- ini = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rust-ini."0.18.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- toml = rustPackages."registry+https://github.com/rust-lang/crates.io-index".toml."0.5.11" { inherit profileName; };
- yaml_rust = rustPackages."registry+https://github.com/rust-lang/crates.io-index".yaml-rust."0.4.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".constant_time_eq."0.2.4" = overridableMkRustCrate (profileName: rec {
- name = "constant_time_eq";
- version = "0.2.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".convert_case."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "convert_case";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".cookie."0.16.2" = overridableMkRustCrate (profileName: rec {
- name = "cookie";
- version = "0.16.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb"; };
- features = builtins.concatLists [
- [ "percent-encode" ]
- [ "percent-encoding" ]
- ];
- dependencies = {
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- buildDependencies = {
- version_check = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".cookie-factory."0.3.2" = overridableMkRustCrate (profileName: rec {
- name = "cookie-factory";
- version = "0.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".core-foundation."0.9.3" = overridableMkRustCrate (profileName: rec {
- name = "core-foundation";
- version = "0.9.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"; };
- dependencies = {
- core_foundation_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".core-foundation-sys."0.8.3" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".core-foundation-sys."0.8.3" = overridableMkRustCrate (profileName: rec {
- name = "core-foundation-sys";
- version = "0.8.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".cpufeatures."0.2.5" = overridableMkRustCrate (profileName: rec {
- name = "cpufeatures";
- version = "0.2.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"; };
- dependencies = {
- ${ if hostPlatform.config == "aarch64-apple-darwin" || hostPlatform.config == "aarch64-linux-android" || hostPlatform.parsed.cpu.name == "aarch64" && hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".crc16."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "crc16";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".crc32fast."1.3.2" = overridableMkRustCrate (profileName: rec {
- name = "crc32fast";
- version = "1.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".crossbeam-channel."0.5.6" = overridableMkRustCrate (profileName: rec {
- name = "crossbeam-channel";
- version = "0.5.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"; };
- features = builtins.concatLists [
- [ "crossbeam-utils" ]
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- crossbeam_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" = overridableMkRustCrate (profileName: rec {
- name = "crossbeam-utils";
- version = "0.8.14";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".crypto-common."0.1.6" = overridableMkRustCrate (profileName: rec {
- name = "crypto-common";
- version = "0.1.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- generic_array = rustPackages."registry+https://github.com/rust-lang/crates.io-index".generic-array."0.14.6" { inherit profileName; };
- typenum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".typenum."1.16.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".dashmap."5.4.0" = overridableMkRustCrate (profileName: rec {
- name = "dashmap";
- version = "5.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- hashbrown = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hashbrown."0.12.3" { inherit profileName; };
- lock_api = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lock_api."0.4.9" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- parking_lot_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot_core."0.9.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".deadpool."0.9.5" = overridableMkRustCrate (profileName: rec {
- name = "deadpool";
- version = "0.9.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e"; };
- features = builtins.concatLists [
- [ "async-trait" ]
- [ "default" ]
- [ "managed" ]
- [ "unmanaged" ]
- ];
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- deadpool_runtime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".deadpool-runtime."0.1.2" { inherit profileName; };
- num_cpus = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.15.0" { inherit profileName; };
- retain_mut = rustPackages."registry+https://github.com/rust-lang/crates.io-index".retain_mut."0.1.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".deadpool-runtime."0.1.2" = overridableMkRustCrate (profileName: rec {
- name = "deadpool-runtime";
- version = "0.1.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "eaa37046cc0f6c3cc6090fbdbf73ef0b8ef4cfcc37f6befc0020f63e8cf121e1"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".derive_deref."1.1.1" = overridableMkRustCrate (profileName: rec {
- name = "derive_deref";
- version = "1.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dcdbcee2d9941369faba772587a565f4f534e42cb8d17e5295871de730163b2b"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".derive_more."0.99.17" = overridableMkRustCrate (profileName: rec {
- name = "derive_more";
- version = "0.99.17";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"; };
- features = builtins.concatLists [
- [ "add" ]
- [ "add_assign" ]
- [ "as_mut" ]
- [ "as_ref" ]
- [ "constructor" ]
- [ "convert_case" ]
- [ "default" ]
- [ "deref" ]
- [ "deref_mut" ]
- [ "display" ]
- [ "error" ]
- [ "from" ]
- [ "from_str" ]
- [ "index" ]
- [ "index_mut" ]
- [ "into" ]
- [ "into_iterator" ]
- [ "is_variant" ]
- [ "iterator" ]
- [ "mul" ]
- [ "mul_assign" ]
- [ "not" ]
- [ "rustc_version" ]
- [ "sum" ]
- [ "try_into" ]
- [ "unwrap" ]
- ];
- dependencies = {
- convert_case = rustPackages."registry+https://github.com/rust-lang/crates.io-index".convert_case."0.4.0" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- buildDependencies = {
- rustc_version = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" = overridableMkRustCrate (profileName: rec {
- name = "diesel";
- version = "2.0.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4391a22b19c916e50bec4d6140f29bdda3e3bb187223fe6e3ea0b6e4d1021c04"; };
- features = builtins.concatLists [
- [ "32-column-tables" ]
- [ "bitflags" ]
- [ "byteorder" ]
- [ "default" ]
- [ "itoa" ]
- [ "postgres" ]
- [ "postgres_backend" ]
- [ "pq-sys" ]
- [ "r2d2" ]
- [ "serde_json" ]
- [ "time" ]
- [ "with-deprecated" ]
- ];
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- byteorder = rustPackages."registry+https://github.com/rust-lang/crates.io-index".byteorder."1.4.3" { inherit profileName; };
- diesel_derives = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel_derives."2.0.1" { profileName = "__noProfile"; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- pq_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pq-sys."0.4.7" { inherit profileName; };
- r2d2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".r2d2."0.8.10" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".diesel_derives."2.0.1" = overridableMkRustCrate (profileName: rec {
- name = "diesel_derives";
- version = "2.0.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "143b758c91dbc3fe1fdcb0dba5bd13276c6a66422f2ef5795b58488248a310aa"; };
- features = builtins.concatLists [
- [ "32-column-tables" ]
- [ "default" ]
- [ "postgres" ]
- [ "with-deprecated" ]
- ];
- dependencies = {
- proc_macro_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-error."1.0.4" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".digest."0.9.0" = overridableMkRustCrate (profileName: rec {
- name = "digest";
- version = "0.9.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "std" ]
- ];
- dependencies = {
- generic_array = rustPackages."registry+https://github.com/rust-lang/crates.io-index".generic-array."0.14.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".digest."0.10.6" = overridableMkRustCrate (profileName: rec {
- name = "digest";
- version = "0.10.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "block-buffer" ]
- [ "core-api" ]
- [ "default" ]
- [ "mac" ]
- [ "std" ]
- [ "subtle" ]
- ];
- dependencies = {
- block_buffer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".block-buffer."0.10.3" { inherit profileName; };
- crypto_common = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crypto-common."0.1.6" { inherit profileName; };
- subtle = rustPackages."registry+https://github.com/rust-lang/crates.io-index".subtle."2.4.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".dlv-list."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "dlv-list";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"; };
- });
- "unknown".drainer."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "drainer";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/drainer");
- dependencies = {
- async_bb8_diesel = rustPackages."git+https://github.com/juspay/async-bb8-diesel".async-bb8-diesel."0.1.0" { inherit profileName; };
- bb8 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bb8."0.8.0" { inherit profileName; };
- clap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".clap."4.1.4" { inherit profileName; };
- common_utils = rustPackages."unknown".common_utils."0.1.0" { inherit profileName; };
- config = rustPackages."registry+https://github.com/rust-lang/crates.io-index".config."0.13.3" { inherit profileName; };
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- redis_interface = rustPackages."unknown".redis_interface."0.1.0" { inherit profileName; };
- router_env = rustPackages."unknown".router_env."0.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_path_to_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_path_to_error."0.1.9" { inherit profileName; };
- diesel_models = rustPackages."unknown".diesel_models."0.1.0" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- buildDependencies = {
- router_env = buildRustPackages."unknown".router_env."0.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".dyn-clone."1.0.10" = overridableMkRustCrate (profileName: rec {
- name = "dyn-clone";
- version = "1.0.10";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".either."1.8.0" = overridableMkRustCrate (profileName: rec {
- name = "either";
- version = "1.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "use_std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.31" = overridableMkRustCrate (profileName: rec {
- name = "encoding_rs";
- version = "0.8.31";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".env_logger."0.7.1" = overridableMkRustCrate (profileName: rec {
- name = "env_logger";
- version = "0.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"; };
- features = builtins.concatLists [
- [ "atty" ]
- [ "default" ]
- [ "humantime" ]
- [ "regex" ]
- [ "termcolor" ]
- ];
- dependencies = {
- atty = rustPackages."registry+https://github.com/rust-lang/crates.io-index".atty."0.2.14" { inherit profileName; };
- humantime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".humantime."1.3.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- termcolor = rustPackages."registry+https://github.com/rust-lang/crates.io-index".termcolor."1.2.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" = overridableMkRustCrate (profileName: rec {
- name = "error-stack";
- version = "0.2.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "859d224e04b2d93d974c08e375dac9b8d1a513846e44c6666450a57b1ed963f9"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "pretty-print" ]
- [ "std" ]
- ];
- dependencies = {
- anyhow = rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" { inherit profileName; };
- owo_colors = rustPackages."registry+https://github.com/rust-lang/crates.io-index".owo-colors."3.5.0" { inherit profileName; };
- };
- buildDependencies = {
- rustc_version = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".event-listener."2.5.3" = overridableMkRustCrate (profileName: rec {
- name = "event-listener";
- version = "2.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".fake."2.5.0" = overridableMkRustCrate (profileName: rec {
- name = "fake";
- version = "2.5.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4d68f517805463f3a896a9d29c1d6ff09d3579ded64a7201b4069f8f9c0d52fd"; };
- dependencies = {
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".fastrand."1.8.0" = overridableMkRustCrate (profileName: rec {
- name = "fastrand";
- version = "1.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"; };
- dependencies = {
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "instant" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".flate2."1.0.25" = overridableMkRustCrate (profileName: rec {
- name = "flate2";
- version = "1.0.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "miniz_oxide" ]
- [ "rust_backend" ]
- ];
- dependencies = {
- crc32fast = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crc32fast."1.3.2" { inherit profileName; };
- miniz_oxide = rustPackages."registry+https://github.com/rust-lang/crates.io-index".miniz_oxide."0.6.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".float-cmp."0.8.0" = overridableMkRustCrate (profileName: rec {
- name = "float-cmp";
- version = "0.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "num-traits" ]
- [ "ratio" ]
- ];
- dependencies = {
- num_traits = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" = overridableMkRustCrate (profileName: rec {
- name = "fnv";
- version = "1.0.7";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".foreign-types."0.3.2" = overridableMkRustCrate (profileName: rec {
- name = "foreign-types";
- version = "0.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"; };
- dependencies = {
- foreign_types_shared = rustPackages."registry+https://github.com/rust-lang/crates.io-index".foreign-types-shared."0.1.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".foreign-types-shared."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "foreign-types-shared";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".form_urlencoded."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "form_urlencoded";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"; };
- dependencies = {
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".fred."5.2.0" = overridableMkRustCrate (profileName: rec {
- name = "fred";
- version = "5.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6be0137d9045288f9c0a0659da3b74c196ad0263d2eafa0f5a73785a907bad14"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "enable-tls" ]
- [ "ignore-auth-error" ]
- [ "metrics" ]
- [ "native-tls" ]
- [ "partial-tracing" ]
- [ "pool-prefer-active" ]
- [ "tokio-native-tls" ]
- [ "tracing" ]
- [ "tracing-futures" ]
- ];
- dependencies = {
- arc_swap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".arc-swap."1.6.0" { inherit profileName; };
- arcstr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".arcstr."1.1.5" { inherit profileName; };
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- bytes_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes-utils."0.1.3" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- float_cmp = rustPackages."registry+https://github.com/rust-lang/crates.io-index".float-cmp."0.8.0" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- native_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".native-tls."0.2.11" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.11.2" { inherit profileName; };
- pretty_env_logger = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pretty_env_logger."0.4.0" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- redis_protocol = rustPackages."registry+https://github.com/rust-lang/crates.io-index".redis-protocol."4.1.0" { inherit profileName; };
- semver = rustPackages."registry+https://github.com/rust-lang/crates.io-index".semver."1.0.16" { inherit profileName; };
- sha1 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sha-1."0.9.8" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_native_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-native-tls."0.3.0" { inherit profileName; };
- tokio_stream = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.6.10" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-futures."0.2.5" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a89c703bf50009f383a0873845357cc400a95fc535f836feddfe015d7df6e1e0"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "frunk_proc_macros" ]
- [ "proc-macros" ]
- [ "std" ]
- [ "validated" ]
- ];
- dependencies = {
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- frunk_derives = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_derives."0.4.1" { profileName = "__noProfile"; };
- frunk_proc_macros = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macros."0.1.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk_core";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2a446d01a558301dca28ef43222864a9fa2bd9a2e71370f769d5d5d5ec9f3537"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk_derives."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk_derives";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b83164912bb4c97cfe0772913c7af7387ee2e00cb6d4636fb65a35b3d0c8f173"; };
- dependencies = {
- frunk_proc_macro_helpers = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macro_helpers."0.1.1" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macro_helpers."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk_proc_macro_helpers";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "015425591bbeb0f5b8a75593340f1789af428e9f887a4f1e36c0c471f067ef50"; };
- dependencies = {
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macros."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk_proc_macros";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ea01524f285deab48affffb342b97f186e657b119c3f1821ac531780e0fbfae0"; };
- dependencies = {
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- frunk_proc_macros_impl = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macros_impl."0.1.1" { profileName = "__noProfile"; };
- proc_macro_hack = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.20+deprecated" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macros_impl."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "frunk_proc_macros_impl";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0a802d974cc18ee7fe1a7868fc9ce31086294fd96ba62f8da64ecb44e92a2653"; };
- dependencies = {
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- frunk_proc_macro_helpers = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_proc_macro_helpers."0.1.1" { inherit profileName; };
- proc_macro_hack = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.20+deprecated" { profileName = "__noProfile"; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "async-await" ]
- [ "default" ]
- [ "executor" ]
- [ "futures-executor" ]
- [ "std" ]
- ];
- dependencies = {
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_executor = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.25" { inherit profileName; };
- futures_io = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- futures_task = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-channel";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "futures-sink" ]
- [ "sink" ]
- [ "std" ]
- ];
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-core";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-executor";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_task = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-io";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" = overridableMkRustCrate (profileName: rec {
- name = "futures-lite";
- version = "1.12.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "fastrand" ]
- [ "futures-io" ]
- [ "memchr" ]
- [ "parking" ]
- [ "std" ]
- [ "waker-fn" ]
- ];
- dependencies = {
- fastrand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.8.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_io = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.25" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- parking = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking."2.0.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- waker_fn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".waker-fn."1.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-macro";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-sink";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-task";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-timer."3.0.2" = overridableMkRustCrate (profileName: rec {
- name = "futures-timer";
- version = "3.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" = overridableMkRustCrate (profileName: rec {
- name = "futures-util";
- version = "0.3.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "async-await" ]
- [ "async-await-macro" ]
- [ "channel" ]
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- [ "futures-channel" ]
- [ "futures-io" ]
- [ "futures-macro" ]
- [ "futures-sink" ]
- [ "io" ]
- [ "memchr" ]
- [ "sink" ]
- [ "slab" ]
- [ "std" ]
- ];
- dependencies = {
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_io = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-io."0.3.25" { inherit profileName; };
- futures_macro = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-macro."0.3.25" { profileName = "__noProfile"; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- futures_task = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-task."0.3.25" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- pin_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" { inherit profileName; };
- slab = rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.7" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".generic-array."0.14.6" = overridableMkRustCrate (profileName: rec {
- name = "generic-array";
- version = "0.14.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"; };
- features = builtins.concatLists [
- [ "more_lengths" ]
- ];
- dependencies = {
- typenum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".typenum."1.16.0" { inherit profileName; };
- };
- buildDependencies = {
- version_check = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".gethostname."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "gethostname";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8a329e22866dd78b35d2c639a4a23d7b950aeae300dfd79f4fb19f74055c2404"; };
- dependencies = {
- ${ if !hostPlatform.isWindows then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.isWindows then "windows" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows."0.43.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".getrandom."0.1.16" = overridableMkRustCrate (profileName: rec {
- name = "getrandom";
- version = "0.1.16";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "wasi" then "wasi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasi."0.9.0+wasi-snapshot-preview1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.8" = overridableMkRustCrate (profileName: rec {
- name = "getrandom";
- version = "0.2.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "wasi" then "wasi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasi."0.11.0+wasi-snapshot-preview1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".git2."0.16.1" = overridableMkRustCrate (profileName: rec {
- name = "git2";
- version = "0.16.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"; };
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- libgit2_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libgit2-sys."0.14.2+1.5.1" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" = overridableMkRustCrate (profileName: rec {
- name = "h2";
- version = "0.3.15";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4"; };
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- fnv = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- indexmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- slab = rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.7" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hashbrown."0.12.3" = overridableMkRustCrate (profileName: rec {
- name = "hashbrown";
- version = "0.12.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"; };
- features = builtins.concatLists [
- [ "ahash" ]
- [ "default" ]
- [ "inline-more" ]
- [ "raw" ]
- ];
- dependencies = {
- ahash = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ahash."0.7.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".heck."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "heck";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.1.19" = overridableMkRustCrate (profileName: rec {
- name = "hermit-abi";
- version = "0.1.19";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.2.6" = overridableMkRustCrate (profileName: rec {
- name = "hermit-abi";
- version = "0.2.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" = overridableMkRustCrate (profileName: rec {
- name = "hex";
- version = "0.4.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".hmac."0.12.1" = overridableMkRustCrate (profileName: rec {
- name = "hmac";
- version = "0.12.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "digest" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.10.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" = overridableMkRustCrate (profileName: rec {
- name = "http";
- version = "0.2.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"; };
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- fnv = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" = overridableMkRustCrate (profileName: rec {
- name = "http-body";
- version = "0.4.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"; };
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".http-range-header."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "http-range-header";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".http-types."2.12.0" = overridableMkRustCrate (profileName: rec {
- name = "http-types";
- version = "2.12.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad"; };
- features = builtins.concatLists [
- [ "http" ]
- [ "hyperium_http" ]
- ];
- dependencies = {
- anyhow = rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" { inherit profileName; };
- async_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-channel."1.8.0" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- futures_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-lite."1.12.0" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- infer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".infer."0.2.3" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.7.3" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_qs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_qs."0.8.5" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".httparse."1.8.0" = overridableMkRustCrate (profileName: rec {
- name = "httparse";
- version = "1.8.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".httpdate."1.0.2" = overridableMkRustCrate (profileName: rec {
- name = "httpdate";
- version = "1.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".humantime."1.3.0" = overridableMkRustCrate (profileName: rec {
- name = "humantime";
- version = "1.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"; };
- dependencies = {
- quick_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quick-error."1.2.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" = overridableMkRustCrate (profileName: rec {
- name = "hyper";
- version = "0.14.23";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c"; };
- features = builtins.concatLists [
- [ "client" ]
- [ "default" ]
- [ "full" ]
- [ "h2" ]
- [ "http1" ]
- [ "http2" ]
- [ "runtime" ]
- [ "server" ]
- [ "socket2" ]
- [ "stream" ]
- [ "tcp" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- h2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- http_body = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- httparse = rustPackages."registry+https://github.com/rust-lang/crates.io-index".httparse."1.8.0" { inherit profileName; };
- httpdate = rustPackages."registry+https://github.com/rust-lang/crates.io-index".httpdate."1.0.2" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- socket2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.7" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- want = rustPackages."registry+https://github.com/rust-lang/crates.io-index".want."0.3.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hyper-rustls."0.23.2" = overridableMkRustCrate (profileName: rec {
- name = "hyper-rustls";
- version = "0.23.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "http1")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "http2")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "log")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "logging")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "native-tokio")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "rustls-native-certs")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "tls12")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "tokio-runtime")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "log" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "rustls" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustls."0.20.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "rustls_native_certs" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustls-native-certs."0.6.2" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "tokio_rustls" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-rustls."0.23.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hyper-timeout."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "hyper-timeout";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"; };
- dependencies = {
- hyper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_io_timeout = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-io-timeout."1.2.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".hyper-tls."0.5.0" = overridableMkRustCrate (profileName: rec {
- name = "hyper-tls";
- version = "0.5.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"; };
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- hyper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- native_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".native-tls."0.2.11" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_native_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-native-tls."0.3.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".idna."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "idna";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"; };
- dependencies = {
- unicode_bidi = rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-bidi."0.3.8" { inherit profileName; };
- unicode_normalization = rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-normalization."0.1.22" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" = overridableMkRustCrate (profileName: rec {
- name = "indexmap";
- version = "1.9.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"; };
- features = builtins.concatLists [
- [ "serde" ]
- [ "std" ]
- ];
- dependencies = {
- hashbrown = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hashbrown."0.12.3" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".infer."0.2.3" = overridableMkRustCrate (profileName: rec {
- name = "infer";
- version = "0.2.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" = overridableMkRustCrate (profileName: rec {
- name = "instant";
- version = "0.1.12";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ipnet."2.7.1" = overridableMkRustCrate (profileName: rec {
- name = "ipnet";
- version = "2.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".is_ci."1.1.1" = overridableMkRustCrate (profileName: rec {
- name = "is_ci";
- version = "1.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".itertools."0.10.5" = overridableMkRustCrate (profileName: rec {
- name = "itertools";
- version = "0.10.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"; };
- features = builtins.concatLists [
- [ "use_alloc" ]
- ];
- dependencies = {
- either = rustPackages."registry+https://github.com/rust-lang/crates.io-index".either."1.8.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".itoa."0.4.8" = overridableMkRustCrate (profileName: rec {
- name = "itoa";
- version = "0.4.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"; };
- features = builtins.concatLists [
- [ "i128" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" = overridableMkRustCrate (profileName: rec {
- name = "itoa";
- version = "1.0.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".jobserver."0.1.25" = overridableMkRustCrate (profileName: rec {
- name = "jobserver";
- version = "0.1.25";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b"; };
- dependencies = {
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".josekit."0.8.1" = overridableMkRustCrate (profileName: rec {
- name = "josekit";
- version = "0.8.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dee6af62ad98bdf699ad2ecc8323479a1fdc7aa5faa6043d93119d83f6c5fca8"; };
- dependencies = {
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "anyhow" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "base64" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "flate2" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".flate2."1.0.25" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "openssl" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl."0.10.45" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "regex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "serde" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "serde_json" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "thiserror" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "time" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.60" = overridableMkRustCrate (profileName: rec {
- name = "js-sys";
- version = "0.3.60";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"; };
- dependencies = {
- wasm_bindgen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.83" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".json5."0.4.1" = overridableMkRustCrate (profileName: rec {
- name = "json5";
- version = "0.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1"; };
- dependencies = {
- pest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest."2.5.3" { inherit profileName; };
- pest_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pest_derive."2.5.3" { profileName = "__noProfile"; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".jsonwebtoken."8.2.0" = overridableMkRustCrate (profileName: rec {
- name = "jsonwebtoken";
- version = "8.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "09f4f04699947111ec1733e71778d763555737579e44b85844cae8e1940a1828"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "pem" ]
- [ "simple_asn1" ]
- [ "use_pem" ]
- ];
- dependencies = {
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- pem = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pem."1.1.1" { inherit profileName; };
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- simple_asn1 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".simple_asn1."0.6.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".language-tags."0.3.2" = overridableMkRustCrate (profileName: rec {
- name = "language-tags";
- version = "0.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" = overridableMkRustCrate (profileName: rec {
- name = "lazy_static";
- version = "1.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" = overridableMkRustCrate (profileName: rec {
- name = "libc";
- version = "0.2.139";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".libgit2-sys."0.14.2+1.5.1" = overridableMkRustCrate (profileName: rec {
- name = "libgit2-sys";
- version = "0.14.2+1.5.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4"; };
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- libz_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libz-sys."1.1.8" { inherit profileName; };
- };
- buildDependencies = {
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- pkg_config = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pkg-config."0.3.26" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".libm."0.2.6" = overridableMkRustCrate (profileName: rec {
- name = "libm";
- version = "0.2.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".libmimalloc-sys."0.1.30" = overridableMkRustCrate (profileName: rec {
- name = "libmimalloc-sys";
- version = "0.1.30";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dd8c7cbf8b89019683667e347572e6d55a7df7ea36b0c4ce69961b0cde67b174"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/mimalloc") "secure")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/mimalloc" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- buildDependencies = {
- ${ if rootFeatures' ? "router/mimalloc" then "cc" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".libz-sys."1.1.8" = overridableMkRustCrate (profileName: rec {
- name = "libz-sys";
- version = "1.1.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"; };
- features = builtins.concatLists [
- [ "libc" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- buildDependencies = {
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- pkg_config = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pkg-config."0.3.26" { profileName = "__noProfile"; };
- ${ if hostPlatform.parsed.abi.name == "msvc" then "vcpkg" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".vcpkg."0.2.15" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".linked-hash-map."0.5.6" = overridableMkRustCrate (profileName: rec {
- name = "linked-hash-map";
- version = "0.5.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".literally."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "literally";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f0d2be3f5a0d4d5c983d1f8ecc2a87676a0875a14feb9eebf0675f7c3e2f3c35"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".local-channel."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "local-channel";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c"; };
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- local_waker = rustPackages."registry+https://github.com/rust-lang/crates.io-index".local-waker."0.1.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".local-waker."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "local-waker";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".lock_api."0.4.9" = overridableMkRustCrate (profileName: rec {
- name = "lock_api";
- version = "0.4.9";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"; };
- dependencies = {
- scopeguard = rustPackages."registry+https://github.com/rust-lang/crates.io-index".scopeguard."1.1.0" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" = overridableMkRustCrate (profileName: rec {
- name = "log";
- version = "0.4.17";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- };
- });
- "unknown".masking."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "masking";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/masking");
- features = builtins.concatLists [
- [ "alloc" ]
- (lib.optional (rootFeatures' ? "masking/bytes") "bytes")
- [ "default" ]
- [ "diesel" ]
- [ "serde" ]
- ];
- dependencies = {
- ${ if rootFeatures' ? "masking/bytes" then "bytes" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- subtle = rustPackages."registry+https://github.com/rust-lang/crates.io-index".subtle."2.4.1" { inherit profileName; };
- zeroize = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zeroize."1.5.7" { inherit profileName; };
- };
- devDependencies = {
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".matchers."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "matchers";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"; };
- dependencies = {
- regex_automata = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-automata."0.1.10" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".matchit."0.7.0" = overridableMkRustCrate (profileName: rec {
- name = "matchit";
- version = "0.7.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".maud."0.24.0" = overridableMkRustCrate (profileName: rec {
- name = "maud";
- version = "0.24.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "19aff2cd19eb4b93df29efa602652513b0f731f1d3474f6e377f763fddf61e58"; };
- features = builtins.concatLists [
- [ "actix-web" ]
- [ "actix-web-dep" ]
- [ "default" ]
- [ "futures-util" ]
- ];
- dependencies = {
- actix_web_dep = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."0.4.8" { inherit profileName; };
- maud_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".maud_macros."0.24.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".maud_macros."0.24.0" = overridableMkRustCrate (profileName: rec {
- name = "maud_macros";
- version = "0.24.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e5c114f6f24b08fdd4a25d2fb87a8b140df56b577723247b382e8b04c583f2eb"; };
- dependencies = {
- proc_macro_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-error."1.0.4" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" = overridableMkRustCrate (profileName: rec {
- name = "memchr";
- version = "2.5.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".mimalloc."0.1.34" = overridableMkRustCrate (profileName: rec {
- name = "mimalloc";
- version = "0.1.34";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9dcb174b18635f7561a0c6c9fc2ce57218ac7523cf72c50af80e2d79ab8f3ba1"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/mimalloc") "default")
- (lib.optional (rootFeatures' ? "router/mimalloc") "secure")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/mimalloc" then "libmimalloc_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libmimalloc-sys."0.1.30" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" = overridableMkRustCrate (profileName: rec {
- name = "mime";
- version = "0.3.16";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".minimal-lexical."0.2.1" = overridableMkRustCrate (profileName: rec {
- name = "minimal-lexical";
- version = "0.2.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".miniz_oxide."0.6.2" = overridableMkRustCrate (profileName: rec {
- name = "miniz_oxide";
- version = "0.6.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"; };
- features = builtins.concatLists [
- [ "with-alloc" ]
- ];
- dependencies = {
- adler = rustPackages."registry+https://github.com/rust-lang/crates.io-index".adler."1.0.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".mio."0.8.5" = overridableMkRustCrate (profileName: rec {
- name = "mio";
- version = "0.8.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "net" ]
- [ "os-ext" ]
- [ "os-poll" ]
- ];
- dependencies = {
- ${ if hostPlatform.isUnix || hostPlatform.parsed.kernel.name == "wasi" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "wasi" then "wasi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasi."0.11.0+wasi-snapshot-preview1" { inherit profileName; };
- ${ if hostPlatform.isWindows then "windows_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".nanoid."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "nanoid";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8"; };
- dependencies = {
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".native-tls."0.2.11" = overridableMkRustCrate (profileName: rec {
- name = "native-tls";
- version = "0.2.11";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"; };
- dependencies = {
- ${ if hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" then "lazy_static" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if !(hostPlatform.parsed.kernel.name == "windows" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios") then "log" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- ${ if !(hostPlatform.parsed.kernel.name == "windows" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios") then "openssl" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl."0.10.45" { inherit profileName; };
- ${ if !(hostPlatform.parsed.kernel.name == "windows" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios") then "openssl_probe" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl-probe."0.1.5" { inherit profileName; };
- ${ if !(hostPlatform.parsed.kernel.name == "windows" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios") then "openssl_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl-sys."0.9.80" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "windows" then "schannel" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".schannel."0.1.21" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" then "security_framework" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".security-framework."2.7.0" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" then "security_framework_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".security-framework-sys."2.6.1" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "ios" then "tempfile" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tempfile."3.3.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".nom."7.1.3" = overridableMkRustCrate (profileName: rec {
- name = "nom";
- version = "7.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- minimal_lexical = rustPackages."registry+https://github.com/rust-lang/crates.io-index".minimal-lexical."0.2.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".nom8."0.2.0" = overridableMkRustCrate (profileName: rec {
- name = "nom8";
- version = "0.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".nu-ansi-term."0.46.0" = overridableMkRustCrate (profileName: rec {
- name = "nu-ansi-term";
- version = "0.46.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"; };
- dependencies = {
- overload = rustPackages."registry+https://github.com/rust-lang/crates.io-index".overload."0.1.1" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".num-bigint."0.4.3" = overridableMkRustCrate (profileName: rec {
- name = "num-bigint";
- version = "0.4.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"; };
- dependencies = {
- num_integer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-integer."0.1.45" { inherit profileName; };
- num_traits = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".num-integer."0.1.45" = overridableMkRustCrate (profileName: rec {
- name = "num-integer";
- version = "0.1.45";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- [ "i128" ]
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "std")
- ];
- dependencies = {
- num_traits = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" = overridableMkRustCrate (profileName: rec {
- name = "num-traits";
- version = "0.2.15";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"; };
- features = builtins.concatLists [
- [ "i128" ]
- [ "libm" ]
- [ "std" ]
- ];
- dependencies = {
- libm = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libm."0.2.6" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.15.0" = overridableMkRustCrate (profileName: rec {
- name = "num_cpus";
- version = "1.15.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"; };
- dependencies = {
- ${ if (hostPlatform.parsed.cpu.name == "x86_64" || hostPlatform.parsed.cpu.name == "aarch64") && hostPlatform.parsed.kernel.name == "hermit" then "hermit_abi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hermit-abi."0.2.6" { inherit profileName; };
- ${ if !hostPlatform.isWindows then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" = overridableMkRustCrate (profileName: rec {
- name = "once_cell";
- version = "1.17.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "race" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".opaque-debug."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "opaque-debug";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".openssl."0.10.45" = overridableMkRustCrate (profileName: rec {
- name = "openssl";
- version = "0.10.45";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- foreign_types = rustPackages."registry+https://github.com/rust-lang/crates.io-index".foreign-types."0.3.2" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- openssl_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl-macros."0.1.0" { profileName = "__noProfile"; };
- ffi = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl-sys."0.9.80" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".openssl-macros."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "openssl-macros";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".openssl-probe."0.1.5" = overridableMkRustCrate (profileName: rec {
- name = "openssl-probe";
- version = "0.1.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".openssl-sys."0.9.80" = overridableMkRustCrate (profileName: rec {
- name = "openssl-sys";
- version = "0.9.80";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7"; };
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- pkg_config = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pkg-config."0.3.26" { profileName = "__noProfile"; };
- ${ if hostPlatform.parsed.abi.name == "msvc" then "vcpkg" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".vcpkg."0.2.15" { profileName = "__noProfile"; };
- };
- });
- "git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" = overridableMkRustCrate (profileName: rec {
- name = "opentelemetry";
- version = "0.18.0";
- registry = "git+https://github.com/open-telemetry/opentelemetry-rust";
- src = fetchCrateGit {
- url = https://github.com/open-telemetry/opentelemetry-rust;
- name = "opentelemetry";
- version = "0.18.0";
- rev = "44b90202fd744598db8b0ace5b8f0bad7ec45658";};
- features = builtins.concatLists [
- [ "default" ]
- [ "metrics" ]
- [ "rt-tokio-current-thread" ]
- [ "trace" ]
- ];
- dependencies = {
- opentelemetry_api = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry_api."0.18.0" { inherit profileName; };
- opentelemetry_sdk = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry_sdk."0.18.0" { inherit profileName; };
- };
- });
- "git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry-otlp."0.11.0" = overridableMkRustCrate (profileName: rec {
- name = "opentelemetry-otlp";
- version = "0.11.0";
- registry = "git+https://github.com/open-telemetry/opentelemetry-rust";
- src = fetchCrateGit {
- url = https://github.com/open-telemetry/opentelemetry-rust;
- name = "opentelemetry-otlp";
- version = "0.11.0";
- rev = "44b90202fd744598db8b0ace5b8f0bad7ec45658";};
- features = builtins.concatLists [
- [ "default" ]
- [ "grpc-tonic" ]
- [ "http" ]
- [ "metrics" ]
- [ "prost" ]
- [ "tokio" ]
- [ "tonic" ]
- [ "trace" ]
- ];
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- opentelemetry = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" { inherit profileName; };
- opentelemetry_proto = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry-proto."0.1.0" { inherit profileName; };
- prost = rustPackages."registry+https://github.com/rust-lang/crates.io-index".prost."0.11.6" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tonic = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tonic."0.8.3" { inherit profileName; };
- };
- });
- "git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry-proto."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "opentelemetry-proto";
- version = "0.1.0";
- registry = "git+https://github.com/open-telemetry/opentelemetry-rust";
- src = fetchCrateGit {
- url = https://github.com/open-telemetry/opentelemetry-rust;
- name = "opentelemetry-proto";
- version = "0.1.0";
- rev = "44b90202fd744598db8b0ace5b8f0bad7ec45658";};
- features = builtins.concatLists [
- [ "gen-tonic" ]
- [ "metrics" ]
- [ "prost" ]
- [ "tonic" ]
- [ "traces" ]
- ];
- dependencies = {
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- opentelemetry = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" { inherit profileName; };
- prost = rustPackages."registry+https://github.com/rust-lang/crates.io-index".prost."0.11.6" { inherit profileName; };
- tonic = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tonic."0.8.3" { inherit profileName; };
- };
- });
- "git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry_api."0.18.0" = overridableMkRustCrate (profileName: rec {
- name = "opentelemetry_api";
- version = "0.18.0";
- registry = "git+https://github.com/open-telemetry/opentelemetry-rust";
- src = fetchCrateGit {
- url = https://github.com/open-telemetry/opentelemetry-rust;
- name = "opentelemetry_api";
- version = "0.18.0";
- rev = "44b90202fd744598db8b0ace5b8f0bad7ec45658";};
- features = builtins.concatLists [
- [ "default" ]
- [ "fnv" ]
- [ "metrics" ]
- [ "pin-project-lite" ]
- [ "trace" ]
- ];
- dependencies = {
- fnv = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" { inherit profileName; };
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- indexmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "js_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.60" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- };
- });
- "git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry_sdk."0.18.0" = overridableMkRustCrate (profileName: rec {
- name = "opentelemetry_sdk";
- version = "0.18.0";
- registry = "git+https://github.com/open-telemetry/opentelemetry-rust";
- src = fetchCrateGit {
- url = https://github.com/open-telemetry/opentelemetry-rust;
- name = "opentelemetry_sdk";
- version = "0.18.0";
- rev = "44b90202fd744598db8b0ace5b8f0bad7ec45658";};
- features = builtins.concatLists [
- [ "async-trait" ]
- [ "crossbeam-channel" ]
- [ "dashmap" ]
- [ "default" ]
- [ "fnv" ]
- [ "metrics" ]
- [ "percent-encoding" ]
- [ "rand" ]
- [ "rt-tokio-current-thread" ]
- [ "tokio" ]
- [ "tokio-stream" ]
- [ "trace" ]
- ];
- dependencies = {
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- crossbeam_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-channel."0.5.6" { inherit profileName; };
- dashmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".dashmap."5.4.0" { inherit profileName; };
- fnv = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" { inherit profileName; };
- futures_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-channel."0.3.25" { inherit profileName; };
- futures_executor = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-executor."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- opentelemetry_api = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry_api."0.18.0" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_stream = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ordered-multimap."0.4.3" = overridableMkRustCrate (profileName: rec {
- name = "ordered-multimap";
- version = "0.4.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"; };
- dependencies = {
- dlv_list = rustPackages."registry+https://github.com/rust-lang/crates.io-index".dlv-list."0.3.0" { inherit profileName; };
- hashbrown = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hashbrown."0.12.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".os_str_bytes."6.4.1" = overridableMkRustCrate (profileName: rec {
- name = "os_str_bytes";
- version = "6.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"; };
- features = builtins.concatLists [
- [ "raw_os_str" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".outref."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "outref";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".overload."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "overload";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".owo-colors."3.5.0" = overridableMkRustCrate (profileName: rec {
- name = "owo-colors";
- version = "3.5.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"; };
- features = builtins.concatLists [
- [ "supports-color" ]
- [ "supports-colors" ]
- ];
- dependencies = {
- supports_color = rustPackages."registry+https://github.com/rust-lang/crates.io-index".supports-color."1.3.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".parking."2.0.0" = overridableMkRustCrate (profileName: rec {
- name = "parking";
- version = "2.0.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.11.2" = overridableMkRustCrate (profileName: rec {
- name = "parking_lot";
- version = "0.11.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- instant = rustPackages."registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" { inherit profileName; };
- lock_api = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lock_api."0.4.9" { inherit profileName; };
- parking_lot_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot_core."0.8.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" = overridableMkRustCrate (profileName: rec {
- name = "parking_lot";
- version = "0.12.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- lock_api = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lock_api."0.4.9" { inherit profileName; };
- parking_lot_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot_core."0.9.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".parking_lot_core."0.8.6" = overridableMkRustCrate (profileName: rec {
- name = "parking_lot_core";
- version = "0.8.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- instant = rustPackages."registry+https://github.com/rust-lang/crates.io-index".instant."0.1.12" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "redox" then "syscall" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".redox_syscall."0.2.16" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".parking_lot_core."0.9.6" = overridableMkRustCrate (profileName: rec {
- name = "parking_lot_core";
- version = "0.9.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "redox" then "syscall" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".redox_syscall."0.2.16" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- ${ if hostPlatform.isWindows then "windows_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".paste."1.0.11" = overridableMkRustCrate (profileName: rec {
- name = "paste";
- version = "1.0.11";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pathdiff."0.2.1" = overridableMkRustCrate (profileName: rec {
- name = "pathdiff";
- version = "0.2.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pem."1.1.1" = overridableMkRustCrate (profileName: rec {
- name = "pem";
- version = "1.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8"; };
- dependencies = {
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" = overridableMkRustCrate (profileName: rec {
- name = "percent-encoding";
- version = "2.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".pest."2.5.3" = overridableMkRustCrate (profileName: rec {
- name = "pest";
- version = "2.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4257b4a04d91f7e9e6290be5d3da4804dd5784fafde3a497d73eb2b4a158c30a"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- [ "thiserror" ]
- ];
- dependencies = {
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- ucd_trie = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ucd-trie."0.1.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pest_derive."2.5.3" = overridableMkRustCrate (profileName: rec {
- name = "pest_derive";
- version = "2.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "241cda393b0cdd65e62e07e12454f1f25d57017dcc514b1514cd3c4645e3a0a6"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- pest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest."2.5.3" { inherit profileName; };
- pest_generator = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest_generator."2.5.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pest_generator."2.5.3" = overridableMkRustCrate (profileName: rec {
- name = "pest_generator";
- version = "2.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "46b53634d8c8196302953c74d5352f33d0c512a9499bd2ce468fc9f4128fa27c"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- pest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest."2.5.3" { inherit profileName; };
- pest_meta = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest_meta."2.5.3" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pest_meta."2.5.3" = overridableMkRustCrate (profileName: rec {
- name = "pest_meta";
- version = "2.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0ef4f1332a8d4678b41966bb4cc1d0676880e84183a1ecc3f4b69f03e99c7a51"; };
- dependencies = {
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- pest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pest."2.5.3" { inherit profileName; };
- };
- buildDependencies = {
- sha2 = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".sha2."0.10.6" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" = overridableMkRustCrate (profileName: rec {
- name = "pin-project";
- version = "1.0.12";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc"; };
- dependencies = {
- pin_project_internal = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-internal."1.0.12" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pin-project-internal."1.0.12" = overridableMkRustCrate (profileName: rec {
- name = "pin-project-internal";
- version = "1.0.12";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" = overridableMkRustCrate (profileName: rec {
- name = "pin-project-lite";
- version = "0.2.9";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pin-utils."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "pin-utils";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pkg-config."0.3.26" = overridableMkRustCrate (profileName: rec {
- name = "pkg-config";
- version = "0.3.26";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ppv-lite86."0.2.17" = overridableMkRustCrate (profileName: rec {
- name = "ppv-lite86";
- version = "0.2.17";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"; };
- features = builtins.concatLists [
- [ "simd" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".pq-sys."0.4.7" = overridableMkRustCrate (profileName: rec {
- name = "pq-sys";
- version = "0.4.7";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3b845d6d8ec554f972a2c5298aad68953fd64e7441e846075450b44656a016d1"; };
- buildDependencies = {
- ${ if hostPlatform.parsed.abi.name == "msvc" then "vcpkg" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".vcpkg."0.2.15" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".pretty_env_logger."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "pretty_env_logger";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"; };
- dependencies = {
- env_logger = rustPackages."registry+https://github.com/rust-lang/crates.io-index".env_logger."0.7.1" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".proc-macro-error."1.0.4" = overridableMkRustCrate (profileName: rec {
- name = "proc-macro-error";
- version = "1.0.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "syn" ]
- [ "syn-error" ]
- ];
- dependencies = {
- proc_macro_error_attr = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-error-attr."1.0.4" { profileName = "__noProfile"; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- buildDependencies = {
- version_check = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".proc-macro-error-attr."1.0.4" = overridableMkRustCrate (profileName: rec {
- name = "proc-macro-error-attr";
- version = "1.0.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- };
- buildDependencies = {
- version_check = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".proc-macro-hack."0.5.20+deprecated" = overridableMkRustCrate (profileName: rec {
- name = "proc-macro-hack";
- version = "0.5.20+deprecated";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" = overridableMkRustCrate (profileName: rec {
- name = "proc-macro2";
- version = "1.0.50";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "proc-macro" ]
- ];
- dependencies = {
- unicode_ident = rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".proptest."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "proptest";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70"; };
- features = builtins.concatLists [
- [ "bit-set" ]
- [ "break-dead-code" ]
- [ "default" ]
- [ "fork" ]
- [ "lazy_static" ]
- [ "quick-error" ]
- [ "regex-syntax" ]
- [ "rusty-fork" ]
- [ "std" ]
- [ "tempfile" ]
- [ "timeout" ]
- ];
- dependencies = {
- bit_set = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bit-set."0.5.3" { inherit profileName; };
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- byteorder = rustPackages."registry+https://github.com/rust-lang/crates.io-index".byteorder."1.4.3" { inherit profileName; };
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- num_traits = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" { inherit profileName; };
- quick_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quick-error."2.0.1" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- rand_chacha = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.3.1" { inherit profileName; };
- rand_xorshift = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_xorshift."0.3.0" { inherit profileName; };
- regex_syntax = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.6.28" { inherit profileName; };
- rusty_fork = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rusty-fork."0.3.0" { inherit profileName; };
- tempfile = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tempfile."3.3.0" { inherit profileName; };
- unarray = rustPackages."registry+https://github.com/rust-lang/crates.io-index".unarray."0.1.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".prost."0.11.6" = overridableMkRustCrate (profileName: rec {
- name = "prost";
- version = "0.11.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "prost-derive" ]
- [ "std" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- prost_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".prost-derive."0.11.6" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".prost-derive."0.11.6" = overridableMkRustCrate (profileName: rec {
- name = "prost-derive";
- version = "0.11.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d"; };
- dependencies = {
- anyhow = rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" { inherit profileName; };
- itertools = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itertools."0.10.5" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".quick-error."1.2.3" = overridableMkRustCrate (profileName: rec {
- name = "quick-error";
- version = "1.2.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".quick-error."2.0.1" = overridableMkRustCrate (profileName: rec {
- name = "quick-error";
- version = "2.0.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" = overridableMkRustCrate (profileName: rec {
- name = "quote";
- version = "1.0.23";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "proc-macro" ]
- ];
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".r2d2."0.8.10" = overridableMkRustCrate (profileName: rec {
- name = "r2d2";
- version = "0.8.10";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93"; };
- dependencies = {
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- scheduled_thread_pool = rustPackages."registry+https://github.com/rust-lang/crates.io-index".scheduled-thread-pool."0.2.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand."0.7.3" = overridableMkRustCrate (profileName: rec {
- name = "rand";
- version = "0.7.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "getrandom" ]
- [ "getrandom_package" ]
- [ "libc" ]
- [ "std" ]
- ];
- dependencies = {
- getrandom_package = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.1.16" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if !(hostPlatform.parsed.kernel.name == "emscripten") then "rand_chacha" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.2.2" { inherit profileName; };
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.5.1" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "emscripten" then "rand_hc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_hc."0.2.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" = overridableMkRustCrate (profileName: rec {
- name = "rand";
- version = "0.8.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "getrandom" ]
- [ "libc" ]
- [ "rand_chacha" ]
- [ "small_rng" ]
- [ "std" ]
- [ "std_rng" ]
- ];
- dependencies = {
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- rand_chacha = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.3.1" { inherit profileName; };
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.6.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.2.2" = overridableMkRustCrate (profileName: rec {
- name = "rand_chacha";
- version = "0.2.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- ppv_lite86 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ppv-lite86."0.2.17" { inherit profileName; };
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.5.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_chacha."0.3.1" = overridableMkRustCrate (profileName: rec {
- name = "rand_chacha";
- version = "0.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- dependencies = {
- ppv_lite86 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ppv-lite86."0.2.17" { inherit profileName; };
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.6.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_core."0.5.1" = overridableMkRustCrate (profileName: rec {
- name = "rand_core";
- version = "0.5.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "getrandom" ]
- [ "std" ]
- ];
- dependencies = {
- getrandom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.1.16" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_core."0.6.4" = overridableMkRustCrate (profileName: rec {
- name = "rand_core";
- version = "0.6.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "getrandom" ]
- [ "std" ]
- ];
- dependencies = {
- getrandom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.8" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_hc."0.2.0" = overridableMkRustCrate (profileName: rec {
- name = "rand_hc";
- version = "0.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"; };
- dependencies = {
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.5.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rand_xorshift."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "rand_xorshift";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"; };
- dependencies = {
- rand_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand_core."0.6.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".redis-protocol."4.1.0" = overridableMkRustCrate (profileName: rec {
- name = "redis-protocol";
- version = "4.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9c31deddf734dc0a39d3112e73490e88b61a05e83e074d211f348404cee4d2c6"; };
- features = builtins.concatLists [
- [ "decode-mut" ]
- [ "default" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- bytes_utils = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes-utils."0.1.3" { inherit profileName; };
- cookie_factory = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cookie-factory."0.3.2" { inherit profileName; };
- crc16 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crc16."0.4.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- nom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nom."7.1.3" { inherit profileName; };
- };
- });
- "unknown".redis_interface."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "redis_interface";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/redis_interface");
- dependencies = {
- common_utils = rustPackages."unknown".common_utils."0.1.0" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- fred = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fred."5.2.0" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- router_env = rustPackages."unknown".router_env."0.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- };
- devDependencies = {
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".redox_syscall."0.2.16" = overridableMkRustCrate (profileName: rec {
- name = "redox_syscall";
- version = "0.2.16";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"; };
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" = overridableMkRustCrate (profileName: rec {
- name = "regex";
- version = "1.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"; };
- features = builtins.concatLists [
- [ "aho-corasick" ]
- [ "default" ]
- [ "memchr" ]
- [ "perf" ]
- [ "perf-cache" ]
- [ "perf-dfa" ]
- [ "perf-inline" ]
- [ "perf-literal" ]
- [ "std" ]
- [ "unicode" ]
- [ "unicode-age" ]
- [ "unicode-bool" ]
- [ "unicode-case" ]
- [ "unicode-gencat" ]
- [ "unicode-perl" ]
- [ "unicode-script" ]
- [ "unicode-segment" ]
- ];
- dependencies = {
- aho_corasick = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.7.20" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- regex_syntax = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.6.28" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".regex-automata."0.1.10" = overridableMkRustCrate (profileName: rec {
- name = "regex-automata";
- version = "0.1.10";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "regex-syntax" ]
- [ "std" ]
- ];
- dependencies = {
- regex_syntax = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.6.28" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".regex-syntax."0.6.28" = overridableMkRustCrate (profileName: rec {
- name = "regex-syntax";
- version = "0.6.28";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "unicode" ]
- [ "unicode-age" ]
- [ "unicode-bool" ]
- [ "unicode-case" ]
- [ "unicode-gencat" ]
- [ "unicode-perl" ]
- [ "unicode-script" ]
- [ "unicode-segment" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".remove_dir_all."0.5.3" = overridableMkRustCrate (profileName: rec {
- name = "remove_dir_all";
- version = "0.5.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"; };
- dependencies = {
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".reqwest."0.11.14" = overridableMkRustCrate (profileName: rec {
- name = "reqwest";
- version = "0.11.14";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9"; };
- features = builtins.concatLists [
- [ "__tls" ]
- [ "async-compression" ]
- [ "default" ]
- [ "default-tls" ]
- [ "gzip" ]
- [ "hyper-tls" ]
- [ "json" ]
- [ "native-tls" ]
- [ "native-tls-crate" ]
- [ "serde_json" ]
- [ "tokio-native-tls" ]
- [ "tokio-util" ]
- ];
- dependencies = {
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "async_compression" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-compression."0.3.15" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "encoding_rs" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.31" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "h2" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "http_body" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "hyper_tls" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper-tls."0.5.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "ipnet" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ipnet."2.7.1" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "js_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.60" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "log" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "mime" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "native_tls_crate" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".native-tls."0.2.11" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "percent_encoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "pin_project_lite" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "tokio" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "tokio_native_tls" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-native-tls."0.3.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32") then "tokio_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "wasm_bindgen" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.83" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "wasm_bindgen_futures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-futures."0.4.33" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" then "web_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.60" { inherit profileName; };
- ${ if hostPlatform.isWindows then "winreg" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winreg."0.10.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".retain_mut."0.1.9" = overridableMkRustCrate (profileName: rec {
- name = "retain_mut";
- version = "0.1.9";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" = overridableMkRustCrate (profileName: rec {
- name = "ring";
- version = "0.16.20";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "dev_urandom_fallback" ]
- [ "once_cell" ]
- [ "std" ]
- ];
- dependencies = {
- ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "dragonfly" || hostPlatform.parsed.kernel.name == "freebsd" || hostPlatform.parsed.kernel.name == "illumos" || hostPlatform.parsed.kernel.name == "netbsd" || hostPlatform.parsed.kernel.name == "openbsd" || hostPlatform.parsed.kernel.name == "solaris" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" || (hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l") && (hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "linux") then "spin" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".spin."0.5.2" { inherit profileName; };
- untrusted = rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "wasm32" && hostPlatform.parsed.vendor.name == "unknown" && hostPlatform.parsed.kernel.name == "unknown" && hostPlatform.parsed.abi.name == "" then "web_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.60" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "windows" then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- buildDependencies = {
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ron."0.7.1" = overridableMkRustCrate (profileName: rec {
- name = "ron";
- version = "0.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"; };
- dependencies = {
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "unknown".router."0.2.0" = overridableMkRustCrate (profileName: rec {
- name = "router";
- version = "0.2.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/router");
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/accounts_cache" || rootFeatures' ? "router/default") "accounts_cache")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "aws-config")
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "aws-sdk-kms")
- (lib.optional (rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/sandbox") "basilisk")
- (lib.optional (rootFeatures' ? "router/default") "default")
- (lib.optional (rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox") "josekit")
- (lib.optional (rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "kms")
- (lib.optional (rootFeatures' ? "router/default" || rootFeatures' ? "router/kv_store") "kv_store")
- (lib.optional (rootFeatures' ? "router/mimalloc") "mimalloc")
- (lib.optional (rootFeatures' ? "router/default" || rootFeatures' ? "router/olap" || rootFeatures' ? "router/openapi") "olap")
- (lib.optional (rootFeatures' ? "router/default" || rootFeatures' ? "router/oltp" || rootFeatures' ? "router/openapi") "oltp")
- (lib.optional (rootFeatures' ? "router/openapi") "openapi")
- (lib.optional (rootFeatures' ? "router/production") "production")
- (lib.optional (rootFeatures' ? "router/sandbox") "sandbox")
- (lib.optional (rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe") "stripe")
- ];
- dependencies = {
- actix = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix."0.13.0" { inherit profileName; };
- actix_cors = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-cors."0.6.4" { inherit profileName; };
- actix_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-rt."2.8.0" { inherit profileName; };
- actix_web = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" { inherit profileName; };
- api_models = rustPackages."unknown".api_models."0.1.0" { inherit profileName; };
- async_bb8_diesel = rustPackages."git+https://github.com/juspay/async-bb8-diesel".async-bb8-diesel."0.1.0" { inherit profileName; };
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_config" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-config."0.54.1" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "aws_sdk_kms" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".aws-sdk-kms."0.24.0" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" { inherit profileName; };
- bb8 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bb8."0.8.0" { inherit profileName; };
- blake3 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".blake3."1.3.3" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- clap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".clap."4.1.4" { inherit profileName; };
- common_utils = rustPackages."unknown".common_utils."0.1.0" { inherit profileName; };
- config = rustPackages."registry+https://github.com/rust-lang/crates.io-index".config."0.13.3" { inherit profileName; };
- crc32fast = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crc32fast."1.3.2" { inherit profileName; };
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- dyn_clone = rustPackages."registry+https://github.com/rust-lang/crates.io-index".dyn-clone."1.0.10" { inherit profileName; };
- encoding_rs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".encoding_rs."0.8.31" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- frunk = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk."0.4.1" { inherit profileName; };
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- hex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "josekit" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".josekit."0.8.1" { inherit profileName; };
- jsonwebtoken = rustPackages."registry+https://github.com/rust-lang/crates.io-index".jsonwebtoken."8.2.0" { inherit profileName; };
- literally = rustPackages."registry+https://github.com/rust-lang/crates.io-index".literally."0.1.3" { inherit profileName; };
- masking = rustPackages."unknown".masking."0.1.0" { inherit profileName; };
- maud = rustPackages."registry+https://github.com/rust-lang/crates.io-index".maud."0.24.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/mimalloc" then "mimalloc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mimalloc."0.1.34" { inherit profileName; };
- mime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mime."0.3.16" { inherit profileName; };
- nanoid = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nanoid."0.4.0" { inherit profileName; };
- num_cpus = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.15.0" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- redis_interface = rustPackages."unknown".redis_interface."0.1.0" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- reqwest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".reqwest."0.11.14" { inherit profileName; };
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- router_derive = buildRustPackages."unknown".router_derive."0.1.0" { profileName = "__noProfile"; };
- router_env = rustPackages."unknown".router_env."0.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_path_to_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_path_to_error."0.1.9" { inherit profileName; };
- ${ if rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe" then "serde_qs" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_qs."0.11.0" { inherit profileName; };
- serde_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" { inherit profileName; };
- signal_hook = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook."0.3.14" { inherit profileName; };
- signal_hook_tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook-tokio."0.3.1" { inherit profileName; };
- diesel_models = rustPackages."unknown".diesel_models."0.1.0" { inherit profileName; };
- strum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- url = rustPackages."registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" { inherit profileName; };
- utoipa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".utoipa."3.0.1" { inherit profileName; };
- uuid = rustPackages."registry+https://github.com/rust-lang/crates.io-index".uuid."1.2.2" { inherit profileName; };
- };
- devDependencies = {
- actix_http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-http."3.3.0" { inherit profileName; };
- awc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".awc."3.1.0" { inherit profileName; };
- derive_deref = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".derive_deref."1.1.1" { profileName = "__noProfile"; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- serial_test = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serial_test."1.0.0" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- toml = rustPackages."registry+https://github.com/rust-lang/crates.io-index".toml."0.7.2" { inherit profileName; };
- wiremock = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wiremock."0.5.17" { inherit profileName; };
- };
- buildDependencies = {
- router_env = buildRustPackages."unknown".router_env."0.1.0" { profileName = "__noProfile"; };
- };
- });
- "unknown".router_derive."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "router_derive";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/router_derive");
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- devDependencies = {
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- strum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" { inherit profileName; };
- };
- });
- "unknown".router_env."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "router_env";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/router_env");
- features = builtins.concatLists [
- [ "actix_web" ]
- [ "default" ]
- [ "log_custom_entries_to_extra" ]
- [ "log_extra_implicit_fields" ]
- [ "tracing-actix-web" ]
- [ "vergen" ]
- ];
- dependencies = {
- config = rustPackages."registry+https://github.com/rust-lang/crates.io-index".config."0.13.3" { inherit profileName; };
- gethostname = rustPackages."registry+https://github.com/rust-lang/crates.io-index".gethostname."0.4.1" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- opentelemetry = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" { inherit profileName; };
- opentelemetry_otlp = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry-otlp."0.11.0" { inherit profileName; };
- rustc_hash = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc-hash."1.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- serde_path_to_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_path_to_error."0.1.9" { inherit profileName; };
- strum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_actix_web = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-actix-web."0.7.2" { inherit profileName; };
- tracing_appender = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-appender."0.2.2" { inherit profileName; };
- tracing_attributes = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-attributes."0.1.22" { profileName = "__noProfile"; };
- tracing_opentelemetry = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-opentelemetry."0.18.0" { inherit profileName; };
- tracing_subscriber = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-subscriber."0.3.16" { inherit profileName; };
- vergen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".vergen."8.0.0-beta.3" { inherit profileName; };
- };
- devDependencies = {
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- buildDependencies = {
- vergen = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".vergen."8.0.0-beta.3" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rust-ini."0.18.0" = overridableMkRustCrate (profileName: rec {
- name = "rust-ini";
- version = "0.18.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ordered_multimap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ordered-multimap."0.4.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustc-hash."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "rustc-hash";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "rustc_version";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"; };
- dependencies = {
- semver = rustPackages."registry+https://github.com/rust-lang/crates.io-index".semver."1.0.16" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustls."0.20.8" = overridableMkRustCrate (profileName: rec {
- name = "rustls";
- version = "0.20.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f"; };
- features = builtins.concatLists [
- [ "dangerous_configuration" ]
- [ "default" ]
- [ "log" ]
- [ "logging" ]
- [ "tls12" ]
- ];
- dependencies = {
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- sct = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sct."0.7.0" { inherit profileName; };
- webpki = rustPackages."registry+https://github.com/rust-lang/crates.io-index".webpki."0.22.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustls-native-certs."0.6.2" = overridableMkRustCrate (profileName: rec {
- name = "rustls-native-certs";
- version = "0.6.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"; };
- dependencies = {
- ${ if (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") && hostPlatform.isUnix && !(hostPlatform.parsed.kernel.name == "darwin") then "openssl_probe" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".openssl-probe."0.1.5" { inherit profileName; };
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "rustls_pemfile" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustls-pemfile."1.0.2" { inherit profileName; };
- ${ if (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") && hostPlatform.isWindows then "schannel" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".schannel."0.1.21" { inherit profileName; };
- ${ if (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") && hostPlatform.parsed.kernel.name == "darwin" then "security_framework" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".security-framework."2.7.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustls-pemfile."1.0.2" = overridableMkRustCrate (profileName: rec {
- name = "rustls-pemfile";
- version = "1.0.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"; };
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "base64" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.21.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rustversion."1.0.11" = overridableMkRustCrate (profileName: rec {
- name = "rustversion";
- version = "1.0.11";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".rusty-fork."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "rusty-fork";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f"; };
- features = builtins.concatLists [
- [ "timeout" ]
- [ "wait-timeout" ]
- ];
- dependencies = {
- fnv = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fnv."1.0.7" { inherit profileName; };
- quick_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quick-error."1.2.3" { inherit profileName; };
- tempfile = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tempfile."3.3.0" { inherit profileName; };
- wait_timeout = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wait-timeout."0.2.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ryu."1.0.12" = overridableMkRustCrate (profileName: rec {
- name = "ryu";
- version = "1.0.12";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".schannel."0.1.21" = overridableMkRustCrate (profileName: rec {
- name = "schannel";
- version = "0.1.21";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"; };
- dependencies = {
- windows_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".scheduled-thread-pool."0.2.6" = overridableMkRustCrate (profileName: rec {
- name = "scheduled-thread-pool";
- version = "0.2.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf"; };
- dependencies = {
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".scopeguard."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "scopeguard";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sct."0.7.0" = overridableMkRustCrate (profileName: rec {
- name = "sct";
- version = "0.7.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"; };
- dependencies = {
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- untrusted = rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".security-framework."2.7.0" = overridableMkRustCrate (profileName: rec {
- name = "security-framework";
- version = "2.7.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c"; };
- features = builtins.concatLists [
- [ "OSX_10_9" ]
- [ "default" ]
- ];
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- core_foundation = rustPackages."registry+https://github.com/rust-lang/crates.io-index".core-foundation."0.9.3" { inherit profileName; };
- core_foundation_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".core-foundation-sys."0.8.3" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- security_framework_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".security-framework-sys."2.6.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".security-framework-sys."2.6.1" = overridableMkRustCrate (profileName: rec {
- name = "security-framework-sys";
- version = "2.6.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556"; };
- features = builtins.concatLists [
- [ "OSX_10_9" ]
- [ "default" ]
- ];
- dependencies = {
- core_foundation_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".core-foundation-sys."0.8.3" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".semver."1.0.16" = overridableMkRustCrate (profileName: rec {
- name = "semver";
- version = "1.0.16";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" = overridableMkRustCrate (profileName: rec {
- name = "serde";
- version = "1.0.152";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "derive" ]
- [ "serde_derive" ]
- [ "std" ]
- ];
- dependencies = {
- serde_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_derive."1.0.152" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_derive."1.0.152" = overridableMkRustCrate (profileName: rec {
- name = "serde_derive";
- version = "1.0.152";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" = overridableMkRustCrate (profileName: rec {
- name = "serde_json";
- version = "1.0.91";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"; };
- features = builtins.concatLists [
- [ "default" ]
- (lib.optional (rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox") "indexmap")
- (lib.optional (rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox") "preserve_order")
- [ "std" ]
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/basilisk" || rootFeatures' ? "router/josekit" || rootFeatures' ? "router/sandbox" then "indexmap" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- ryu = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ryu."1.0.12" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_path_to_error."0.1.9" = overridableMkRustCrate (profileName: rec {
- name = "serde_path_to_error";
- version = "0.1.9";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "26b04f22b563c91331a10074bda3dd5492e3cc39d56bd557e91c0af42b6c7341"; };
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_qs."0.8.5" = overridableMkRustCrate (profileName: rec {
- name = "serde_qs";
- version = "0.8.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_qs."0.11.0" = overridableMkRustCrate (profileName: rec {
- name = "serde_qs";
- version = "0.11.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c679fa27b429f2bb57fd4710257e643e86c966e716037259f8baa33de594a1b6"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe") "default")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe" then "percent_encoding" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- ${ if rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe" then "serde" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- ${ if rootFeatures' ? "router/default" || rootFeatures' ? "router/sandbox" || rootFeatures' ? "router/stripe" then "thiserror" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_spanned."0.6.1" = overridableMkRustCrate (profileName: rec {
- name = "serde_spanned";
- version = "0.6.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"; };
- features = builtins.concatLists [
- [ "serde" ]
- ];
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serde_urlencoded."0.7.1" = overridableMkRustCrate (profileName: rec {
- name = "serde_urlencoded";
- version = "0.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"; };
- dependencies = {
- form_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".form_urlencoded."1.1.0" { inherit profileName; };
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- ryu = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ryu."1.0.12" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serial_test."1.0.0" = overridableMkRustCrate (profileName: rec {
- name = "serial_test";
- version = "1.0.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "538c30747ae860d6fb88330addbbd3e0ddbe46d662d032855596d8a8ca260611"; };
- features = builtins.concatLists [
- [ "async" ]
- [ "default" ]
- [ "futures" ]
- [ "log" ]
- [ "logging" ]
- ];
- dependencies = {
- dashmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".dashmap."5.4.0" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- serial_test_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".serial_test_derive."1.0.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".serial_test_derive."1.0.0" = overridableMkRustCrate (profileName: rec {
- name = "serial_test_derive";
- version = "1.0.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "079a83df15f85d89a68d64ae1238f142f172b1fa915d0d76b26a7cba1b659a69"; };
- features = builtins.concatLists [
- [ "async" ]
- ];
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sha-1."0.9.8" = overridableMkRustCrate (profileName: rec {
- name = "sha-1";
- version = "0.9.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- block_buffer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".block-buffer."0.9.0" { inherit profileName; };
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" then "cpufeatures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cpufeatures."0.2.5" { inherit profileName; };
- digest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.9.0" { inherit profileName; };
- opaque_debug = rustPackages."registry+https://github.com/rust-lang/crates.io-index".opaque-debug."0.3.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sha1."0.10.5" = overridableMkRustCrate (profileName: rec {
- name = "sha1";
- version = "0.10.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" then "cpufeatures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cpufeatures."0.2.5" { inherit profileName; };
- digest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.10.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sha2."0.10.6" = overridableMkRustCrate (profileName: rec {
- name = "sha2";
- version = "0.10.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "std")
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- ${ if hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "x86_64" || hostPlatform.parsed.cpu.name == "i686" then "cpufeatures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cpufeatures."0.2.5" { inherit profileName; };
- digest = rustPackages."registry+https://github.com/rust-lang/crates.io-index".digest."0.10.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sharded-slab."0.1.4" = overridableMkRustCrate (profileName: rec {
- name = "sharded-slab";
- version = "0.1.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"; };
- dependencies = {
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".signal-hook."0.3.14" = overridableMkRustCrate (profileName: rec {
- name = "signal-hook";
- version = "0.3.14";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"; };
- features = builtins.concatLists [
- [ "channel" ]
- [ "default" ]
- [ "iterator" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- signal_hook_registry = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook-registry."1.4.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".signal-hook-registry."1.4.0" = overridableMkRustCrate (profileName: rec {
- name = "signal-hook-registry";
- version = "1.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"; };
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".signal-hook-tokio."0.3.1" = overridableMkRustCrate (profileName: rec {
- name = "signal-hook-tokio";
- version = "0.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "213241f76fb1e37e27de3b6aa1b068a2c333233b59cca6634f634b80a27ecf1e"; };
- features = builtins.concatLists [
- [ "futures-core-0_3" ]
- [ "futures-v0_3" ]
- ];
- dependencies = {
- futures_core_0_3 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- signal_hook = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook."0.3.14" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".simd-abstraction."0.7.1" = overridableMkRustCrate (profileName: rec {
- name = "simd-abstraction";
- version = "0.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "alloc")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "detect")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "std")
- ];
- dependencies = {
- ${ if rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox" then "outref" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".outref."0.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".simple_asn1."0.6.2" = overridableMkRustCrate (profileName: rec {
- name = "simple_asn1";
- version = "0.6.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085"; };
- dependencies = {
- num_bigint = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-bigint."0.4.3" { inherit profileName; };
- num_traits = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num-traits."0.2.15" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".slab."0.4.7" = overridableMkRustCrate (profileName: rec {
- name = "slab";
- version = "0.4.7";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" = overridableMkRustCrate (profileName: rec {
- name = "smallvec";
- version = "1.10.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.7" = overridableMkRustCrate (profileName: rec {
- name = "socket2";
- version = "0.4.7";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd"; };
- features = builtins.concatLists [
- [ "all" ]
- ];
- dependencies = {
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".spin."0.5.2" = overridableMkRustCrate (profileName: rec {
- name = "spin";
- version = "0.5.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"; };
- });
- "unknown".diesel_models."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "diesel_models";
- version = "0.1.0";
- registry = "unknown";
- src = fetchCrateLocal (workspaceSrc + "/crates/diesel_models");
- features = builtins.concatLists [
- [ "default" ]
- [ "kv_store" ]
- ];
- dependencies = {
- async_bb8_diesel = rustPackages."git+https://github.com/juspay/async-bb8-diesel".async-bb8-diesel."0.1.0" { inherit profileName; };
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- common_utils = rustPackages."unknown".common_utils."0.1.0" { inherit profileName; };
- diesel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".diesel."2.0.3" { inherit profileName; };
- error_stack = rustPackages."registry+https://github.com/rust-lang/crates.io-index".error-stack."0.2.4" { inherit profileName; };
- frunk = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk."0.4.1" { inherit profileName; };
- frunk_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".frunk_core."0.4.1" { inherit profileName; };
- hex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
- masking = rustPackages."unknown".masking."0.1.0" { inherit profileName; };
- router_derive = buildRustPackages."unknown".router_derive."0.1.0" { profileName = "__noProfile"; };
- router_env = rustPackages."unknown".router_env."0.1.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- strum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" { inherit profileName; };
- thiserror = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".strum."0.24.1" = overridableMkRustCrate (profileName: rec {
- name = "strum";
- version = "0.24.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "derive" ]
- [ "std" ]
- [ "strum_macros" ]
- ];
- dependencies = {
- strum_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".strum_macros."0.24.3" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".strum_macros."0.24.3" = overridableMkRustCrate (profileName: rec {
- name = "strum_macros";
- version = "0.24.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"; };
- dependencies = {
- heck = rustPackages."registry+https://github.com/rust-lang/crates.io-index".heck."0.4.0" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- rustversion = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustversion."1.0.11" { profileName = "__noProfile"; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".subtle."2.4.1" = overridableMkRustCrate (profileName: rec {
- name = "subtle";
- version = "2.4.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "i128" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".supports-color."1.3.1" = overridableMkRustCrate (profileName: rec {
- name = "supports-color";
- version = "1.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f"; };
- dependencies = {
- atty = rustPackages."registry+https://github.com/rust-lang/crates.io-index".atty."0.2.14" { inherit profileName; };
- is_ci = rustPackages."registry+https://github.com/rust-lang/crates.io-index".is_ci."1.1.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" = overridableMkRustCrate (profileName: rec {
- name = "syn";
- version = "1.0.107";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"; };
- features = builtins.concatLists [
- [ "clone-impls" ]
- [ "default" ]
- [ "derive" ]
- [ "extra-traits" ]
- [ "fold" ]
- [ "full" ]
- [ "parsing" ]
- [ "printing" ]
- [ "proc-macro" ]
- [ "quote" ]
- [ "visit" ]
- [ "visit-mut" ]
- ];
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- unicode_ident = rustPackages."registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".sync_wrapper."0.1.1" = overridableMkRustCrate (profileName: rec {
- name = "sync_wrapper";
- version = "0.1.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tempfile."3.3.0" = overridableMkRustCrate (profileName: rec {
- name = "tempfile";
- version = "3.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- fastrand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".fastrand."1.8.0" { inherit profileName; };
- ${ if hostPlatform.isUnix || hostPlatform.parsed.kernel.name == "wasi" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- ${ if hostPlatform.parsed.kernel.name == "redox" then "syscall" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".redox_syscall."0.2.16" { inherit profileName; };
- remove_dir_all = rustPackages."registry+https://github.com/rust-lang/crates.io-index".remove_dir_all."0.5.3" { inherit profileName; };
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".termcolor."1.2.0" = overridableMkRustCrate (profileName: rec {
- name = "termcolor";
- version = "1.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"; };
- dependencies = {
- ${ if hostPlatform.isWindows then "winapi_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi-util."0.1.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".thiserror."1.0.38" = overridableMkRustCrate (profileName: rec {
- name = "thiserror";
- version = "1.0.38";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"; };
- dependencies = {
- thiserror_impl = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".thiserror-impl."1.0.38" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".thiserror-impl."1.0.38" = overridableMkRustCrate (profileName: rec {
- name = "thiserror-impl";
- version = "1.0.38";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".thread_local."1.1.4" = overridableMkRustCrate (profileName: rec {
- name = "thread_local";
- version = "1.1.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"; };
- dependencies = {
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" = overridableMkRustCrate (profileName: rec {
- name = "time";
- version = "0.3.17";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "formatting" ]
- [ "macros" ]
- [ "parsing" ]
- [ "serde" ]
- [ "serde-well-known" ]
- [ "std" ]
- ];
- dependencies = {
- itoa = rustPackages."registry+https://github.com/rust-lang/crates.io-index".itoa."1.0.5" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- time_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time-core."0.1.0" { inherit profileName; };
- time_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".time-macros."0.2.6" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".time-core."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "time-core";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".time-macros."0.2.6" = overridableMkRustCrate (profileName: rec {
- name = "time-macros";
- version = "0.2.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"; };
- features = builtins.concatLists [
- [ "formatting" ]
- [ "parsing" ]
- [ "serde" ]
- ];
- dependencies = {
- time_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time-core."0.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tinyvec."1.6.0" = overridableMkRustCrate (profileName: rec {
- name = "tinyvec";
- version = "1.6.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "default" ]
- [ "tinyvec_macros" ]
- ];
- dependencies = {
- tinyvec_macros = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tinyvec_macros."0.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tinyvec_macros."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "tinyvec_macros";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" = overridableMkRustCrate (profileName: rec {
- name = "tokio";
- version = "1.25.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"; };
- features = builtins.concatLists [
- [ "bytes" ]
- [ "default" ]
- (lib.optional (rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "fs")
- [ "io-std" ]
- [ "io-util" ]
- [ "libc" ]
- [ "macros" ]
- [ "memchr" ]
- [ "mio" ]
- [ "net" ]
- [ "num_cpus" ]
- [ "parking_lot" ]
- [ "rt" ]
- [ "rt-multi-thread" ]
- [ "signal" ]
- [ "signal-hook-registry" ]
- [ "socket2" ]
- [ "sync" ]
- [ "time" ]
- [ "tokio-macros" ]
- [ "windows-sys" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- memchr = rustPackages."registry+https://github.com/rust-lang/crates.io-index".memchr."2.5.0" { inherit profileName; };
- mio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".mio."0.8.5" { inherit profileName; };
- num_cpus = rustPackages."registry+https://github.com/rust-lang/crates.io-index".num_cpus."1.15.0" { inherit profileName; };
- parking_lot = rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.12.1" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- ${ if hostPlatform.isUnix then "signal_hook_registry" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".signal-hook-registry."1.4.0" { inherit profileName; };
- ${ if !(hostPlatform.parsed.cpu.name == "wasm32" || hostPlatform.parsed.cpu.name == "wasm64") then "socket2" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".socket2."0.4.7" { inherit profileName; };
- tokio_macros = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-macros."1.8.2" { profileName = "__noProfile"; };
- ${ if hostPlatform.isWindows then "windows_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" { inherit profileName; };
- };
- buildDependencies = {
- autocfg = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-io-timeout."1.2.0" = overridableMkRustCrate (profileName: rec {
- name = "tokio-io-timeout";
- version = "1.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"; };
- dependencies = {
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-macros."1.8.2" = overridableMkRustCrate (profileName: rec {
- name = "tokio-macros";
- version = "1.8.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-native-tls."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "tokio-native-tls";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"; };
- dependencies = {
- native_tls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".native-tls."0.2.11" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-rustls."0.23.4" = overridableMkRustCrate (profileName: rec {
- name = "tokio-rustls";
- version = "0.23.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "logging" ]
- [ "tls12" ]
- ];
- dependencies = {
- rustls = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustls."0.20.8" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- webpki = rustPackages."registry+https://github.com/rust-lang/crates.io-index".webpki."0.22.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" = overridableMkRustCrate (profileName: rec {
- name = "tokio-stream";
- version = "0.1.11";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "time" ]
- ];
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.6.10" = overridableMkRustCrate (profileName: rec {
- name = "tokio-util";
- version = "0.6.10";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"; };
- features = builtins.concatLists [
- [ "codec" ]
- [ "default" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" = overridableMkRustCrate (profileName: rec {
- name = "tokio-util";
- version = "0.7.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740"; };
- features = builtins.concatLists [
- [ "codec" ]
- [ "default" ]
- [ "io" ]
- [ "tracing" ]
- ];
- dependencies = {
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_sink = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-sink."0.3.25" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".toml."0.5.11" = overridableMkRustCrate (profileName: rec {
- name = "toml";
- version = "0.5.11";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"; };
- features = builtins.concatLists [
- [ "default" ]
- ];
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".toml."0.7.2" = overridableMkRustCrate (profileName: rec {
- name = "toml";
- version = "0.7.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "display" ]
- [ "parse" ]
- ];
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_spanned = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_spanned."0.6.1" { inherit profileName; };
- toml_datetime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".toml_datetime."0.6.1" { inherit profileName; };
- toml_edit = rustPackages."registry+https://github.com/rust-lang/crates.io-index".toml_edit."0.19.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".toml_datetime."0.6.1" = overridableMkRustCrate (profileName: rec {
- name = "toml_datetime";
- version = "0.6.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"; };
- features = builtins.concatLists [
- [ "serde" ]
- ];
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".toml_edit."0.19.3" = overridableMkRustCrate (profileName: rec {
- name = "toml_edit";
- version = "0.19.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5e6a7712b49e1775fb9a7b998de6635b299237f48b404dde71704f2e0e7f37e5"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "serde" ]
- ];
- dependencies = {
- indexmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- nom8 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nom8."0.2.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_spanned = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_spanned."0.6.1" { inherit profileName; };
- toml_datetime = rustPackages."registry+https://github.com/rust-lang/crates.io-index".toml_datetime."0.6.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tonic."0.8.3" = overridableMkRustCrate (profileName: rec {
- name = "tonic";
- version = "0.8.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb"; };
- features = builtins.concatLists [
- [ "async-trait" ]
- [ "axum" ]
- [ "channel" ]
- [ "codegen" ]
- [ "default" ]
- [ "h2" ]
- [ "hyper" ]
- [ "hyper-timeout" ]
- [ "prost" ]
- [ "prost-derive" ]
- [ "prost1" ]
- [ "tokio" ]
- [ "tower" ]
- [ "tracing-futures" ]
- [ "transport" ]
- ];
- dependencies = {
- async_stream = rustPackages."registry+https://github.com/rust-lang/crates.io-index".async-stream."0.3.3" { inherit profileName; };
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- axum = rustPackages."registry+https://github.com/rust-lang/crates.io-index".axum."0.6.2" { inherit profileName; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- h2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".h2."0.3.15" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- http_body = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- hyper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- hyper_timeout = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper-timeout."0.4.1" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- pin_project = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" { inherit profileName; };
- prost1 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".prost."0.11.6" { inherit profileName; };
- prost_derive = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".prost-derive."0.11.6" { profileName = "__noProfile"; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_stream = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-stream."0.1.11" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- tower = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- tower_layer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-futures."0.2.5" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" = overridableMkRustCrate (profileName: rec {
- name = "tower";
- version = "0.4.13";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"; };
- features = builtins.concatLists [
- [ "__common" ]
- [ "balance" ]
- [ "buffer" ]
- [ "default" ]
- [ "discover" ]
- [ "futures-core" ]
- [ "futures-util" ]
- [ "indexmap" ]
- [ "limit" ]
- [ "load" ]
- [ "log" ]
- [ "make" ]
- [ "pin-project" ]
- [ "pin-project-lite" ]
- [ "rand" ]
- [ "ready-cache" ]
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "retry")
- [ "slab" ]
- [ "timeout" ]
- [ "tokio" ]
- [ "tokio-util" ]
- [ "tracing" ]
- [ "util" ]
- ];
- dependencies = {
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- indexmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- pin_project = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- rand = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rand."0.8.5" { inherit profileName; };
- slab = rustPackages."registry+https://github.com/rust-lang/crates.io-index".slab."0.4.7" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- tokio_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio-util."0.7.4" { inherit profileName; };
- tower_layer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tower-http."0.3.5" = overridableMkRustCrate (profileName: rec {
- name = "tower-http";
- version = "0.3.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "map-response-body" ]
- [ "tower" ]
- [ "util" ]
- ];
- dependencies = {
- bitflags = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bitflags."1.3.2" { inherit profileName; };
- bytes = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bytes."1.3.0" { inherit profileName; };
- futures_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-core."0.3.25" { inherit profileName; };
- futures_util = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.25" { inherit profileName; };
- http = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; };
- http_body = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-body."0.4.5" { inherit profileName; };
- http_range_header = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-range-header."0.3.0" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tower = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower."0.4.13" { inherit profileName; };
- tower_layer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" { inherit profileName; };
- tower_service = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tower-layer."0.3.2" = overridableMkRustCrate (profileName: rec {
- name = "tower-layer";
- version = "0.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tower-service."0.3.2" = overridableMkRustCrate (profileName: rec {
- name = "tower-service";
- version = "0.3.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" = overridableMkRustCrate (profileName: rec {
- name = "tracing";
- version = "0.1.36";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"; };
- features = builtins.concatLists [
- [ "attributes" ]
- [ "default" ]
- [ "log" ]
- [ "std" ]
- [ "tracing-attributes" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- pin_project_lite = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project-lite."0.2.9" { inherit profileName; };
- tracing_attributes = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-attributes."0.1.22" { profileName = "__noProfile"; };
- tracing_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-actix-web."0.7.2" = overridableMkRustCrate (profileName: rec {
- name = "tracing-actix-web";
- version = "0.7.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4082e4d81173e0b7ad3cfb71e9eaef0dd0cbb7b139fdb56394f488a3b0760b23"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "emit_event_on_error" ]
- [ "opentelemetry_0_18" ]
- [ "opentelemetry_0_18_pkg" ]
- [ "tracing-opentelemetry_0_18_pkg" ]
- ];
- dependencies = {
- actix_web = rustPackages."registry+https://github.com/rust-lang/crates.io-index".actix-web."4.3.0" { inherit profileName; };
- opentelemetry_0_18_pkg = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" { inherit profileName; };
- pin_project = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_opentelemetry_0_18_pkg = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-opentelemetry."0.18.0" { inherit profileName; };
- uuid = rustPackages."registry+https://github.com/rust-lang/crates.io-index".uuid."1.2.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-appender."0.2.2" = overridableMkRustCrate (profileName: rec {
- name = "tracing-appender";
- version = "0.2.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e"; };
- dependencies = {
- crossbeam_channel = rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-channel."0.5.6" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- tracing_subscriber = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-subscriber."0.3.16" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-attributes."0.1.22" = overridableMkRustCrate (profileName: rec {
- name = "tracing-attributes";
- version = "0.1.22";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2"; };
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" = overridableMkRustCrate (profileName: rec {
- name = "tracing-core";
- version = "0.1.30";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "once_cell" ]
- [ "std" ]
- [ "valuable" ]
- ];
- dependencies = {
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- ${ if false then "valuable" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".valuable."0.1.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-futures."0.2.5" = overridableMkRustCrate (profileName: rec {
- name = "tracing-futures";
- version = "0.2.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "pin-project" ]
- [ "std" ]
- [ "std-future" ]
- ];
- dependencies = {
- pin_project = rustPackages."registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-log."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "tracing-log";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"; };
- features = builtins.concatLists [
- [ "log-tracer" ]
- [ "std" ]
- ];
- dependencies = {
- lazy_static = rustPackages."registry+https://github.com/rust-lang/crates.io-index".lazy_static."1.4.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- tracing_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-opentelemetry."0.18.0" = overridableMkRustCrate (profileName: rec {
- name = "tracing-opentelemetry";
- version = "0.18.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "21ebb87a95ea13271332df069020513ab70bdb5637ca42d6e492dc3bbbad48de"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "metrics" ]
- [ "tracing-log" ]
- ];
- dependencies = {
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- opentelemetry = rustPackages."git+https://github.com/open-telemetry/opentelemetry-rust".opentelemetry."0.18.0" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" { inherit profileName; };
- tracing_log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-log."0.1.3" { inherit profileName; };
- tracing_subscriber = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-subscriber."0.3.16" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-serde."0.1.3" = overridableMkRustCrate (profileName: rec {
- name = "tracing-serde";
- version = "0.1.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1"; };
- dependencies = {
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- tracing_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".tracing-subscriber."0.3.16" = overridableMkRustCrate (profileName: rec {
- name = "tracing-subscriber";
- version = "0.3.16";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "ansi" ]
- [ "default" ]
- [ "env-filter" ]
- [ "fmt" ]
- [ "json" ]
- [ "matchers" ]
- [ "nu-ansi-term" ]
- [ "once_cell" ]
- [ "regex" ]
- [ "registry" ]
- [ "serde" ]
- [ "serde_json" ]
- [ "sharded-slab" ]
- [ "smallvec" ]
- [ "std" ]
- [ "thread_local" ]
- [ "tracing" ]
- [ "tracing-log" ]
- [ "tracing-serde" ]
- ];
- dependencies = {
- matchers = rustPackages."registry+https://github.com/rust-lang/crates.io-index".matchers."0.1.0" { inherit profileName; };
- nu_ansi_term = rustPackages."registry+https://github.com/rust-lang/crates.io-index".nu-ansi-term."0.46.0" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- sharded_slab = rustPackages."registry+https://github.com/rust-lang/crates.io-index".sharded-slab."0.1.4" { inherit profileName; };
- smallvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".smallvec."1.10.0" { inherit profileName; };
- thread_local = rustPackages."registry+https://github.com/rust-lang/crates.io-index".thread_local."1.1.4" { inherit profileName; };
- tracing = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.36" { inherit profileName; };
- tracing_core = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-core."0.1.30" { inherit profileName; };
- tracing_log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-log."0.1.3" { inherit profileName; };
- tracing_serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing-serde."0.1.3" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".try-lock."0.2.4" = overridableMkRustCrate (profileName: rec {
- name = "try-lock";
- version = "0.2.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".typenum."1.16.0" = overridableMkRustCrate (profileName: rec {
- name = "typenum";
- version = "1.16.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".ucd-trie."0.1.5" = overridableMkRustCrate (profileName: rec {
- name = "ucd-trie";
- version = "0.1.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81"; };
- features = builtins.concatLists [
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".unarray."0.1.4" = overridableMkRustCrate (profileName: rec {
- name = "unarray";
- version = "0.1.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".unicode-bidi."0.3.8" = overridableMkRustCrate (profileName: rec {
- name = "unicode-bidi";
- version = "0.3.8";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "hardcoded-data" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".unicode-ident."1.0.6" = overridableMkRustCrate (profileName: rec {
- name = "unicode-ident";
- version = "1.0.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".unicode-normalization."0.1.22" = overridableMkRustCrate (profileName: rec {
- name = "unicode-normalization";
- version = "0.1.22";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- dependencies = {
- tinyvec = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tinyvec."1.6.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" = overridableMkRustCrate (profileName: rec {
- name = "untrusted";
- version = "0.7.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".url."2.3.1" = overridableMkRustCrate (profileName: rec {
- name = "url";
- version = "2.3.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "serde" ]
- ];
- dependencies = {
- form_urlencoded = rustPackages."registry+https://github.com/rust-lang/crates.io-index".form_urlencoded."1.1.0" { inherit profileName; };
- idna = rustPackages."registry+https://github.com/rust-lang/crates.io-index".idna."0.3.0" { inherit profileName; };
- percent_encoding = rustPackages."registry+https://github.com/rust-lang/crates.io-index".percent-encoding."2.2.0" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".urlencoding."2.1.2" = overridableMkRustCrate (profileName: rec {
- name = "urlencoding";
- version = "2.1.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".utoipa."3.0.1" = overridableMkRustCrate (profileName: rec {
- name = "utoipa";
- version = "3.0.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "3920fa753064b1be7842bea26175ffa0dfc4a8f30bcb52b8ff03fddf8889914c"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "preserve_order" ]
- [ "time" ]
- ];
- dependencies = {
- indexmap = rustPackages."registry+https://github.com/rust-lang/crates.io-index".indexmap."1.9.2" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- utoipa_gen = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".utoipa-gen."3.0.1" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".utoipa-gen."3.0.1" = overridableMkRustCrate (profileName: rec {
- name = "utoipa-gen";
- version = "3.0.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "720298fac6efca20df9e457e67a1eab41a20d1c3101380b5c4dca1ca60ae0062"; };
- features = builtins.concatLists [
- [ "time" ]
- ];
- dependencies = {
- proc_macro_error = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro-error."1.0.4" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".uuid."1.2.2" = overridableMkRustCrate (profileName: rec {
- name = "uuid";
- version = "1.2.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "getrandom" ]
- [ "rng" ]
- [ "serde" ]
- [ "std" ]
- [ "v4" ]
- ];
- dependencies = {
- getrandom = rustPackages."registry+https://github.com/rust-lang/crates.io-index".getrandom."0.2.8" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".valuable."0.1.0" = overridableMkRustCrate (profileName: rec {
- name = "valuable";
- version = "0.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".vcpkg."0.2.15" = overridableMkRustCrate (profileName: rec {
- name = "vcpkg";
- version = "0.2.15";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".vergen."8.0.0-beta.3" = overridableMkRustCrate (profileName: rec {
- name = "vergen";
- version = "8.0.0-beta.3";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "7ddc80f045ae4afcbb388b085240e773f6728dfbbacff007dd91fc9e2f686fc7"; };
- features = builtins.concatLists [
- [ "cargo" ]
- [ "default" ]
- [ "git" ]
- [ "git2" ]
- [ "git2-rs" ]
- [ "rustc" ]
- [ "rustc_version" ]
- [ "time" ]
- ];
- dependencies = {
- anyhow = rustPackages."registry+https://github.com/rust-lang/crates.io-index".anyhow."1.0.68" { inherit profileName; };
- git2_rs = rustPackages."registry+https://github.com/rust-lang/crates.io-index".git2."0.16.1" { inherit profileName; };
- rustc_version = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.4.0" { inherit profileName; };
- time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".time."0.3.17" { inherit profileName; };
- };
- buildDependencies = {
- rustversion = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".rustversion."1.0.11" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".version_check."0.9.4" = overridableMkRustCrate (profileName: rec {
- name = "version_check";
- version = "0.9.4";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wait-timeout."0.2.0" = overridableMkRustCrate (profileName: rec {
- name = "wait-timeout";
- version = "0.2.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"; };
- dependencies = {
- ${ if hostPlatform.isUnix then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".waker-fn."1.1.0" = overridableMkRustCrate (profileName: rec {
- name = "waker-fn";
- version = "1.1.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".want."0.3.0" = overridableMkRustCrate (profileName: rec {
- name = "want";
- version = "0.3.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"; };
- dependencies = {
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- try_lock = rustPackages."registry+https://github.com/rust-lang/crates.io-index".try-lock."0.2.4" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasi."0.9.0+wasi-snapshot-preview1" = overridableMkRustCrate (profileName: rec {
- name = "wasi";
- version = "0.9.0+wasi-snapshot-preview1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasi."0.11.0+wasi-snapshot-preview1" = overridableMkRustCrate (profileName: rec {
- name = "wasi";
- version = "0.11.0+wasi-snapshot-preview1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "std" ]
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.83" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen";
- version = "0.2.83";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"; };
- features = builtins.concatLists [
- [ "default" ]
- [ "spans" ]
- [ "std" ]
- ];
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- wasm_bindgen_macro = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-macro."0.2.83" { profileName = "__noProfile"; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-backend."0.2.83" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen-backend";
- version = "0.2.83";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"; };
- features = builtins.concatLists [
- [ "spans" ]
- ];
- dependencies = {
- bumpalo = rustPackages."registry+https://github.com/rust-lang/crates.io-index".bumpalo."3.12.0" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- wasm_bindgen_shared = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-shared."0.2.83" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-futures."0.4.33" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen-futures";
- version = "0.4.33";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"; };
- dependencies = {
- cfg_if = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; };
- js_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.60" { inherit profileName; };
- wasm_bindgen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.83" { inherit profileName; };
- ${ if builtins.elem "atomics" hostPlatformFeatures then "web_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.60" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-macro."0.2.83" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen-macro";
- version = "0.2.83";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"; };
- features = builtins.concatLists [
- [ "spans" ]
- ];
- dependencies = {
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- wasm_bindgen_macro_support = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-macro-support."0.2.83" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-macro-support."0.2.83" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen-macro-support";
- version = "0.2.83";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"; };
- features = builtins.concatLists [
- [ "spans" ]
- ];
- dependencies = {
- proc_macro2 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".proc-macro2."1.0.50" { inherit profileName; };
- quote = rustPackages."registry+https://github.com/rust-lang/crates.io-index".quote."1.0.23" { inherit profileName; };
- syn = rustPackages."registry+https://github.com/rust-lang/crates.io-index".syn."1.0.107" { inherit profileName; };
- wasm_bindgen_backend = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-backend."0.2.83" { inherit profileName; };
- wasm_bindgen_shared = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-shared."0.2.83" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen-shared."0.2.83" = overridableMkRustCrate (profileName: rec {
- name = "wasm-bindgen-shared";
- version = "0.2.83";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.60" = overridableMkRustCrate (profileName: rec {
- name = "web-sys";
- version = "0.3.60";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"; };
- features = builtins.concatLists [
- [ "Blob" ]
- [ "BlobPropertyBag" ]
- [ "Crypto" ]
- [ "Event" ]
- [ "EventTarget" ]
- [ "File" ]
- [ "FormData" ]
- [ "Headers" ]
- [ "MessageEvent" ]
- [ "ReadableStream" ]
- [ "Request" ]
- [ "RequestCredentials" ]
- [ "RequestInit" ]
- [ "RequestMode" ]
- [ "Response" ]
- [ "ServiceWorkerGlobalScope" ]
- [ "Window" ]
- [ "Worker" ]
- [ "WorkerGlobalScope" ]
- ];
- dependencies = {
- js_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".js-sys."0.3.60" { inherit profileName; };
- wasm_bindgen = rustPackages."registry+https://github.com/rust-lang/crates.io-index".wasm-bindgen."0.2.83" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".webpki."0.22.0" = overridableMkRustCrate (profileName: rec {
- name = "webpki";
- version = "0.22.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"; };
- features = builtins.concatLists [
- [ "alloc" ]
- [ "std" ]
- ];
- dependencies = {
- ring = rustPackages."registry+https://github.com/rust-lang/crates.io-index".ring."0.16.20" { inherit profileName; };
- untrusted = rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".webpki-roots."0.22.6" = overridableMkRustCrate (profileName: rec {
- name = "webpki-roots";
- version = "0.22.6";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"; };
- dependencies = {
- webpki = rustPackages."registry+https://github.com/rust-lang/crates.io-index".webpki."0.22.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" = overridableMkRustCrate (profileName: rec {
- name = "winapi";
- version = "0.3.9";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"; };
- features = builtins.concatLists [
- [ "consoleapi" ]
- [ "errhandlingapi" ]
- [ "fileapi" ]
- [ "handleapi" ]
- [ "impl-debug" ]
- [ "impl-default" ]
- [ "minwinbase" ]
- [ "minwindef" ]
- [ "ntsecapi" ]
- [ "ntstatus" ]
- [ "processenv" ]
- [ "std" ]
- [ "timezoneapi" ]
- [ "winbase" ]
- [ "wincon" ]
- [ "winerror" ]
- [ "winnt" ]
- [ "winreg" ]
- [ "ws2ipdef" ]
- [ "ws2tcpip" ]
- [ "wtypesbase" ]
- ];
- dependencies = {
- ${ if hostPlatform.config == "i686-pc-windows-gnu" then "winapi_i686_pc_windows_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi-i686-pc-windows-gnu."0.4.0" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-gnu" then "winapi_x86_64_pc_windows_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi-x86_64-pc-windows-gnu."0.4.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".winapi-i686-pc-windows-gnu."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "winapi-i686-pc-windows-gnu";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".winapi-util."0.1.5" = overridableMkRustCrate (profileName: rec {
- name = "winapi-util";
- version = "0.1.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"; };
- dependencies = {
- ${ if hostPlatform.isWindows then "winapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".winapi-x86_64-pc-windows-gnu."0.4.0" = overridableMkRustCrate (profileName: rec {
- name = "winapi-x86_64-pc-windows-gnu";
- version = "0.4.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows."0.43.0" = overridableMkRustCrate (profileName: rec {
- name = "windows";
- version = "0.43.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"; };
- features = builtins.concatLists [
- [ "Win32" ]
- [ "Win32_Foundation" ]
- [ "Win32_System" ]
- [ "Win32_System_SystemInformation" ]
- [ "default" ]
- ];
- dependencies = {
- ${ if hostPlatform.config == "aarch64-pc-windows-gnullvm" then "windows_aarch64_gnullvm" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "aarch64-pc-windows-msvc" || hostPlatform.config == "aarch64-uwp-windows-msvc" then "windows_aarch64_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "i686-pc-windows-gnu" || hostPlatform.config == "i686-uwp-windows-gnu" then "windows_i686_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "i686-pc-windows-msvc" || hostPlatform.config == "i686-uwp-windows-msvc" then "windows_i686_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-gnu" || hostPlatform.config == "x86_64-uwp-windows-gnu" then "windows_x86_64_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-gnullvm" then "windows_x86_64_gnullvm" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-msvc" || hostPlatform.config == "x86_64-uwp-windows-msvc" then "windows_x86_64_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows-sys."0.42.0" = overridableMkRustCrate (profileName: rec {
- name = "windows-sys";
- version = "0.42.0";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"; };
- features = builtins.concatLists [
- [ "Win32" ]
- [ "Win32_Foundation" ]
- [ "Win32_Networking" ]
- [ "Win32_Networking_WinSock" ]
- [ "Win32_Security" ]
- [ "Win32_Security_Authentication" ]
- [ "Win32_Security_Authentication_Identity" ]
- [ "Win32_Security_Authorization" ]
- [ "Win32_Security_Credentials" ]
- [ "Win32_Security_Cryptography" ]
- [ "Win32_Storage" ]
- [ "Win32_Storage_FileSystem" ]
- [ "Win32_System" ]
- [ "Win32_System_Console" ]
- [ "Win32_System_IO" ]
- [ "Win32_System_LibraryLoader" ]
- [ "Win32_System_Memory" ]
- [ "Win32_System_Pipes" ]
- [ "Win32_System_SystemServices" ]
- [ "Win32_System_WindowsProgramming" ]
- [ "default" ]
- ];
- dependencies = {
- ${ if hostPlatform.config == "aarch64-pc-windows-gnullvm" then "windows_aarch64_gnullvm" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "aarch64-pc-windows-msvc" || hostPlatform.config == "aarch64-uwp-windows-msvc" then "windows_aarch64_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "i686-pc-windows-gnu" || hostPlatform.config == "i686-uwp-windows-gnu" then "windows_i686_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "i686-pc-windows-msvc" || hostPlatform.config == "i686-uwp-windows-msvc" then "windows_i686_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-gnu" || hostPlatform.config == "x86_64-uwp-windows-gnu" then "windows_x86_64_gnu" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-gnullvm" then "windows_x86_64_gnullvm" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.1" { inherit profileName; };
- ${ if hostPlatform.config == "x86_64-pc-windows-msvc" || hostPlatform.config == "x86_64-uwp-windows-msvc" then "windows_x86_64_msvc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.1" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_gnullvm."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_aarch64_gnullvm";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_aarch64_msvc."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_aarch64_msvc";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_i686_gnu."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_i686_gnu";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_i686_msvc."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_i686_msvc";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnu."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_x86_64_gnu";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_gnullvm."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_x86_64_gnullvm";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".windows_x86_64_msvc."0.42.1" = overridableMkRustCrate (profileName: rec {
- name = "windows_x86_64_msvc";
- version = "0.42.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"; };
- });
- "registry+https://github.com/rust-lang/crates.io-index".winreg."0.10.1" = overridableMkRustCrate (profileName: rec {
- name = "winreg";
- version = "0.10.1";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"; };
- dependencies = {
- winapi = rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".wiremock."0.5.17" = overridableMkRustCrate (profileName: rec {
- name = "wiremock";
- version = "0.5.17";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "12316b50eb725e22b2f6b9c4cbede5b7b89984274d113a7440c86e5c3fc6f99b"; };
- dependencies = {
- assert_json_diff = rustPackages."registry+https://github.com/rust-lang/crates.io-index".assert-json-diff."2.0.2" { inherit profileName; };
- async_trait = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.63" { profileName = "__noProfile"; };
- base64 = rustPackages."registry+https://github.com/rust-lang/crates.io-index".base64."0.13.1" { inherit profileName; };
- deadpool = rustPackages."registry+https://github.com/rust-lang/crates.io-index".deadpool."0.9.5" { inherit profileName; };
- futures = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; };
- futures_timer = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-timer."3.0.2" { inherit profileName; };
- http_types = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http-types."2.12.0" { inherit profileName; };
- hyper = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.23" { inherit profileName; };
- log = rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; };
- once_cell = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.17.0" { inherit profileName; };
- regex = rustPackages."registry+https://github.com/rust-lang/crates.io-index".regex."1.7.1" { inherit profileName; };
- serde = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde."1.0.152" { inherit profileName; };
- serde_json = rustPackages."registry+https://github.com/rust-lang/crates.io-index".serde_json."1.0.91" { inherit profileName; };
- tokio = rustPackages."registry+https://github.com/rust-lang/crates.io-index".tokio."1.25.0" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".xmlparser."0.13.5" = overridableMkRustCrate (profileName: rec {
- name = "xmlparser";
- version = "0.13.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd"; };
- features = builtins.concatLists [
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "std")
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".yaml-rust."0.4.5" = overridableMkRustCrate (profileName: rec {
- name = "yaml-rust";
- version = "0.4.5";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"; };
- dependencies = {
- linked_hash_map = rustPackages."registry+https://github.com/rust-lang/crates.io-index".linked-hash-map."0.5.6" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".zeroize."1.5.7" = overridableMkRustCrate (profileName: rec {
- name = "zeroize";
- version = "1.5.7";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f"; };
- features = builtins.concatLists [
- [ "alloc" ]
- (lib.optional (rootFeatures' ? "router/aws-config" || rootFeatures' ? "router/aws-sdk-kms" || rootFeatures' ? "router/kms" || rootFeatures' ? "router/sandbox") "default")
- ];
- });
- "registry+https://github.com/rust-lang/crates.io-index".zstd."0.12.2+zstd.1.5.2" = overridableMkRustCrate (profileName: rec {
- name = "zstd";
- version = "0.12.2+zstd.1.5.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "e9262a83dc741c0b0ffec209881b45dbc232c21b02a2b9cb1adb93266e41303d"; };
- features = builtins.concatLists [
- [ "arrays" ]
- [ "default" ]
- [ "legacy" ]
- [ "zdict_builder" ]
- ];
- dependencies = {
- zstd_safe = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zstd-safe."6.0.2+zstd.1.5.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".zstd-safe."6.0.2+zstd.1.5.2" = overridableMkRustCrate (profileName: rec {
- name = "zstd-safe";
- version = "6.0.2+zstd.1.5.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "a6cf39f730b440bab43da8fb5faf5f254574462f73f260f85f7987f32154ff17"; };
- features = builtins.concatLists [
- [ "arrays" ]
- [ "legacy" ]
- [ "std" ]
- [ "zdict_builder" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- zstd_sys = rustPackages."registry+https://github.com/rust-lang/crates.io-index".zstd-sys."2.0.5+zstd.1.5.2" { inherit profileName; };
- };
- });
- "registry+https://github.com/rust-lang/crates.io-index".zstd-sys."2.0.5+zstd.1.5.2" = overridableMkRustCrate (profileName: rec {
- name = "zstd-sys";
- version = "2.0.5+zstd.1.5.2";
- registry = "registry+https://github.com/rust-lang/crates.io-index";
- src = fetchCratesIo { inherit name version; sha256 = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596"; };
- features = builtins.concatLists [
- [ "legacy" ]
- [ "std" ]
- [ "zdict_builder" ]
- ];
- dependencies = {
- libc = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; };
- };
- buildDependencies = {
- cc = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".cc."1.0.78" { profileName = "__noProfile"; };
- pkg_config = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".pkg-config."0.3.26" { profileName = "__noProfile"; };
- };
- });
-}
\ No newline at end of file
diff --git a/flake.lock b/flake.lock
index 1c0c93e34bd..6f955108475 100644
--- a/flake.lock
+++ b/flake.lock
@@ -71,21 +71,6 @@
"type": "github"
}
},
- "flake-utils_2": {
- "locked": {
- "lastModified": 1659877975,
- "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
"nixpkgs": {
"locked": {
"lastModified": 1654275867,
@@ -138,11 +123,11 @@
},
"nixpkgs_3": {
"locked": {
- "lastModified": 1665296151,
- "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
+ "lastModified": 1718428119,
+ "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
+ "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
"type": "github"
},
"original": {
@@ -187,15 +172,14 @@
},
"rust-overlay_2": {
"inputs": {
- "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
- "lastModified": 1676601131,
- "narHash": "sha256-iwCg6NimjD4euquhicmSo0wuyP56xUVJUMe0yqUyQms=",
+ "lastModified": 1726626348,
+ "narHash": "sha256-sYV7e1B1yLcxo8/h+/hTwzZYmaju2oObNiy5iRI0C30=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "d0dc81ffe8ea09dbf3c07db62a1a057f5319e3ce",
+ "rev": "6fd52ad8bd88f39efb2c999cc971921c2fb9f3a2",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index bd651e042c1..ad3de7e660b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,48 +2,41 @@
description = "hyperswitch";
inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+
+ # TODO: Move away from these to https://github.com/juspay/rust-flake
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
rust-overlay.url = "github:oxalica/rust-overlay";
- flake-parts.url = "github:hercules-ci/flake-parts";
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
- outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
- flake-parts.lib.mkFlake { inherit inputs; } {
- systems = nixpkgs.lib.systems.flakeExposed;
- perSystem = { self', pkgs, system, ... }:
+ outputs = inputs:
+ inputs.flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = inputs.nixpkgs.lib.systems.flakeExposed;
+ perSystem = { self', pkgs, lib, system, ... }:
let
- rustVersion = "1.65.0";
- rustPkgs = pkgs.rustBuilder.makePackageSet {
- inherit rustVersion;
- packageFun = import ./Cargo.nix;
- };
+ cargoToml = lib.importTOML ./Cargo.toml;
+ rustVersion = cargoToml.workspace.package.rust-version;
frameworks = pkgs.darwin.apple_sdk.frameworks;
in
{
- _module.args.pkgs = import nixpkgs {
+ _module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.cargo2nix.overlays.default (import inputs.rust-overlay) ];
};
- packages = rec {
- router = (rustPkgs.workspace.router { }).bin;
- default = router;
- };
- apps = {
- router-scheduler = {
- type = "app";
- program = "${self'.packages.router}/bin/scheduler";
- };
- };
devShells.default = pkgs.mkShell {
- buildInputs = with pkgs; [
+ name = "hyperswitch-shell";
+ packages = with pkgs; [
openssl
pkg-config
exa
fd
rust-bin.stable.${rustVersion}.default
- ] ++ lib.optionals stdenv.isDarwin [ frameworks.CoreServices frameworks.Foundation ]; # arch might have issue finding these libs.
-
+ ] ++ lib.optionals stdenv.isDarwin [
+ # arch might have issue finding these libs.
+ frameworks.CoreServices
+ frameworks.Foundation
+ ];
};
};
};
|
chore
|
Unbreak `flake.nix` (#5867)
|
ad991c04ecedd85ca4c432126487042c2fd03a67
|
2023-08-24 08:42:08
|
Pa1NarK
|
chore(creds): Updated the API Keys to not use wrong creds (#2001)
| false
|
diff --git a/.github/secrets/connector_auth.toml.gpg b/.github/secrets/connector_auth.toml.gpg
index 52000f513e6..269b7628490 100644
Binary files a/.github/secrets/connector_auth.toml.gpg and b/.github/secrets/connector_auth.toml.gpg differ
|
chore
|
Updated the API Keys to not use wrong creds (#2001)
|
af2497b5012f048a4cf72b61712812bca534c17c
|
2024-07-01 17:46:13
|
Kiran Kumar
|
fix(connector): [Paypal] dispute webhook deserialization failure (#5111)
| false
|
diff --git a/crates/router/src/connector/paypal.rs b/crates/router/src/connector/paypal.rs
index 456332ea0f1..ee6b6c818c5 100644
--- a/crates/router/src/connector/paypal.rs
+++ b/crates/router/src/connector/paypal.rs
@@ -1465,7 +1465,6 @@ impl
self, req, connectors,
)?)
.build();
-
Ok(Some(request))
}
@@ -1546,11 +1545,11 @@ impl api::IncomingWebhook for Paypal {
}
paypal::PaypalResource::PaypalDisputeWebhooks(resource) => {
Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
- api_models::payments::PaymentIdType::PaymentAttemptId(
+ api_models::payments::PaymentIdType::ConnectorTransactionId(
resource
- .dispute_transactions
+ .disputed_transactions
.first()
- .map(|transaction| transaction.reference_id.clone())
+ .map(|transaction| transaction.seller_transaction_id.clone())
.ok_or(errors::ConnectorError::WebhookReferenceIdNotFound)?,
),
))
@@ -1567,17 +1566,17 @@ impl api::IncomingWebhook for Paypal {
.parse_struct("PaypalWebooksEventType")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
let outcome = match payload.event_type {
- PaypalWebhookEventType::CustomerDisputeCreated
- | PaypalWebhookEventType::CustomerDisputeResolved
- | PaypalWebhookEventType::CustomerDisputedUpdated
- | PaypalWebhookEventType::RiskDisputeCreated => Some(
+ PaypalWebhookEventType::CustomerDisputeResolved => Some(
request
.body
.parse_struct::<paypal::DisputeOutcome>("PaypalWebooksEventType")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?
.outcome_code,
),
- PaypalWebhookEventType::PaymentAuthorizationCreated
+ PaypalWebhookEventType::CustomerDisputeCreated
+ | PaypalWebhookEventType::RiskDisputeCreated
+ | PaypalWebhookEventType::CustomerDisputedUpdated
+ | PaypalWebhookEventType::PaymentAuthorizationCreated
| PaypalWebhookEventType::PaymentAuthorizationVoided
| PaypalWebhookEventType::PaymentCaptureDeclined
| PaypalWebhookEventType::PaymentCaptureCompleted
@@ -1622,27 +1621,37 @@ impl api::IncomingWebhook for Paypal {
&self,
request: &api::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api::disputes::DisputePayload, errors::ConnectorError> {
- let payload: paypal::PaypalDisputeWebhooks = request
+ let webhook_payload: paypal::PaypalWebhooksBody = request
.body
- .parse_struct("PaypalDisputeWebhooks")
+ .parse_struct("PaypalWebhooksBody")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
- Ok(api::disputes::DisputePayload {
- amount: connector_utils::to_currency_lower_unit(
- payload.dispute_amount.value.get_amount_as_string(),
- payload.dispute_amount.currency_code,
- )?,
- currency: payload.dispute_amount.currency_code.to_string(),
- dispute_stage: api_models::enums::DisputeStage::from(
- payload.dispute_life_cycle_stage.clone(),
- ),
- connector_status: payload.status.to_string(),
- connector_dispute_id: payload.dispute_id,
- connector_reason: payload.reason,
- connector_reason_code: payload.external_reason_code,
- challenge_required_by: payload.seller_response_due_date,
- created_at: payload.create_time,
- updated_at: payload.update_time,
- })
+ match webhook_payload.resource {
+ transformers::PaypalResource::PaypalCardWebhooks(_)
+ | transformers::PaypalResource::PaypalRedirectsWebhooks(_)
+ | transformers::PaypalResource::PaypalRefundWebhooks(_) => {
+ Err(errors::ConnectorError::ResponseDeserializationFailed)
+ .attach_printable("Expected Dispute webhooks,but found other webhooks")?
+ }
+ transformers::PaypalResource::PaypalDisputeWebhooks(payload) => {
+ Ok(api::disputes::DisputePayload {
+ amount: connector_utils::to_currency_lower_unit(
+ payload.dispute_amount.value.get_amount_as_string(),
+ payload.dispute_amount.currency_code,
+ )?,
+ currency: payload.dispute_amount.currency_code.to_string(),
+ dispute_stage: api_models::enums::DisputeStage::from(
+ payload.dispute_life_cycle_stage.clone(),
+ ),
+ connector_status: payload.status.to_string(),
+ connector_dispute_id: payload.dispute_id,
+ connector_reason: payload.reason.clone(),
+ connector_reason_code: payload.reason,
+ challenge_required_by: None,
+ created_at: payload.create_time,
+ updated_at: payload.update_time,
+ })
+ }
+ }
}
}
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index c12c7d5da15..39ea808d61f 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -1980,7 +1980,7 @@ pub struct OrderErrorDetails {
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct PaypalOrderErrorResponse {
- pub name: String,
+ pub name: Option<String>,
pub message: String,
pub debug_id: Option<String>,
pub details: Option<Vec<OrderErrorDetails>>,
@@ -1994,7 +1994,7 @@ pub struct ErrorDetails {
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct PaypalPaymentErrorResponse {
- pub name: String,
+ pub name: Option<String>,
pub message: String,
pub debug_id: Option<String>,
pub details: Option<Vec<ErrorDetails>>,
@@ -2056,21 +2056,24 @@ pub enum PaypalResource {
#[derive(Deserialize, Debug, Serialize)]
pub struct PaypalDisputeWebhooks {
pub dispute_id: String,
- pub dispute_transactions: Vec<DisputeTransaction>,
+ pub disputed_transactions: Vec<DisputeTransaction>,
pub dispute_amount: OrderAmount,
- pub dispute_outcome: DisputeOutcome,
+ pub dispute_outcome: Option<DisputeOutcome>,
pub dispute_life_cycle_stage: DisputeLifeCycleStage,
pub status: DisputeStatus,
pub reason: Option<String>,
pub external_reason_code: Option<String>,
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub seller_response_due_date: Option<PrimitiveDateTime>,
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub update_time: Option<PrimitiveDateTime>,
+ #[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub create_time: Option<PrimitiveDateTime>,
}
#[derive(Deserialize, Debug, Serialize)]
pub struct DisputeTransaction {
- pub reference_id: String,
+ pub seller_transaction_id: String,
}
#[derive(Clone, Deserialize, Debug, strum::Display, Serialize)]
|
fix
|
[Paypal] dispute webhook deserialization failure (#5111)
|
2cf2123edd873c1ae0e2ed346a6f2112d9846881
|
2024-06-25 05:44:28
|
github-actions
|
chore(version): 2024.06.25.0
| false
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b8cffb61dd..c806b0ea6c5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,29 @@ All notable changes to HyperSwitch will be documented here.
- - -
+## 2024.06.25.0
+
+### Features
+
+- **ci:** Add vector to handle logs pipeline ([#5021](https://github.com/juspay/hyperswitch/pull/5021)) ([`fed7b69`](https://github.com/juspay/hyperswitch/commit/fed7b697995b37bf3ef198121de571c6e338863c))
+- **router:** Add support for googlepay step up flow ([#2744](https://github.com/juspay/hyperswitch/pull/2744)) ([`ff84d78`](https://github.com/juspay/hyperswitch/commit/ff84d78c6512f70d761148274e97286f5cf021dd))
+- **users:** Decision manager flow changes for SSO ([#4995](https://github.com/juspay/hyperswitch/pull/4995)) ([`8ceaaa9`](https://github.com/juspay/hyperswitch/commit/8ceaaa9e3d95558a7252a9a986b39c8377426857))
+- Added kafka events for authentication create and update ([#4991](https://github.com/juspay/hyperswitch/pull/4991)) ([`10e9121`](https://github.com/juspay/hyperswitch/commit/10e9121341fe25d195f4c9a25dcc383c2ffd0c95))
+
+### Bug Fixes
+
+- **access_token:** Use `merchant_connector_id` in access token ([#5106](https://github.com/juspay/hyperswitch/pull/5106)) ([`b7bf457`](https://github.com/juspay/hyperswitch/commit/b7bf457d0cdcc4d4947b5750a7982aca85d3a7e9))
+
+### Refactors
+
+- **core:** Introduce an interface to switch between old and new connector integration implementations on the connectors ([#5013](https://github.com/juspay/hyperswitch/pull/5013)) ([`e658899`](https://github.com/juspay/hyperswitch/commit/e658899c1406225bb905ce4fb76e13fa3609666e))
+- **events:** Populate object identifiers in outgoing webhooks analytics events during retries ([#5067](https://github.com/juspay/hyperswitch/pull/5067)) ([`b878405`](https://github.com/juspay/hyperswitch/commit/b87840595d4bc325d37779512dc5504a8a613e5d))
+- [Fiserv] Remove Default Case Handling ([#4767](https://github.com/juspay/hyperswitch/pull/4767)) ([`9caabef`](https://github.com/juspay/hyperswitch/commit/9caabeff86dfb93b29d6f734e6724f4d69bdda4e))
+
+**Full Changelog:** [`2024.06.24.0...2024.06.25.0`](https://github.com/juspay/hyperswitch/compare/2024.06.24.0...2024.06.25.0)
+
+- - -
+
## 2024.06.24.0
### Features
|
chore
|
2024.06.25.0
|
9f41919094638baf9ea405a5acb89d69ecf1e2b7
|
2024-05-03 17:24:46
|
Sakil Mostak
|
feat(euclid_wasm): Add configs for new payout connectors (#4528)
| false
|
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index 0f5a953b064..b9fbed28158 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -153,6 +153,8 @@ pub struct ConnectorConfig {
pub nuvei: Option<ConnectorTomlConfig>,
pub payme: Option<ConnectorTomlConfig>,
pub paypal: Option<ConnectorTomlConfig>,
+ #[cfg(feature = "payouts")]
+ pub paypal_payout: Option<ConnectorTomlConfig>,
pub payu: Option<ConnectorTomlConfig>,
pub placetopay: Option<ConnectorTomlConfig>,
pub plaid: Option<ConnectorTomlConfig>,
@@ -219,7 +221,7 @@ impl ConnectorConfig {
PayoutConnectors::Adyen => Ok(connector_data.adyen_payout),
PayoutConnectors::Stripe => Ok(connector_data.stripe_payout),
PayoutConnectors::Wise => Ok(connector_data.wise_payout),
- PayoutConnectors::Paypal => Ok(connector_data.paypal),
+ PayoutConnectors::Paypal => Ok(connector_data.paypal_payout),
PayoutConnectors::Ebanx => Ok(connector_data.ebanx_payout),
}
}
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index a81fb3657ab..b6be7bb0eb3 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -866,6 +866,48 @@ merchant_name="Google Pay Merchant Name"
gateway_merchant_id="Google Pay Merchant Key"
merchant_id="Google Pay Merchant ID"
+[cybersource_payout]
+[[cybersource_payout.credit]]
+ payment_method_type = "Mastercard"
+[[cybersource_payout.credit]]
+ payment_method_type = "Visa"
+[[cybersource_payout.credit]]
+ payment_method_type = "Interac"
+[[cybersource_payout.credit]]
+ payment_method_type = "AmericanExpress"
+[[cybersource_payout.credit]]
+ payment_method_type = "JCB"
+[[cybersource_payout.credit]]
+ payment_method_type = "DinersClub"
+[[cybersource_payout.credit]]
+ payment_method_type = "Discover"
+[[cybersource_payout.credit]]
+ payment_method_type = "CartesBancaires"
+[[cybersource_payout.credit]]
+ payment_method_type = "UnionPay"
+[[cybersource_payout.debit]]
+ payment_method_type = "Mastercard"
+[[cybersource_payout.debit]]
+ payment_method_type = "Visa"
+[[cybersource_payout.debit]]
+ payment_method_type = "Interac"
+[[cybersource_payout.debit]]
+ payment_method_type = "AmericanExpress"
+[[cybersource_payout.debit]]
+ payment_method_type = "JCB"
+[[cybersource_payout.debit]]
+ payment_method_type = "DinersClub"
+[[cybersource_payout.debit]]
+ payment_method_type = "Discover"
+[[cybersource_payout.debit]]
+ payment_method_type = "CartesBancaires"
+[[cybersource_payout.debit]]
+ payment_method_type = "UnionPay"
+[cybersource_payout.connector_auth.SignatureKey]
+api_key="Key"
+key1="Merchant ID"
+api_secret="Shared Secret"
+
[dlocal]
[[dlocal.credit]]
payment_method_type = "Mastercard"
@@ -910,6 +952,12 @@ api_secret="Secret Key"
[dlocal.connector_webhook_details]
merchant_secret="Source verification key"
+[ebanx_payout]
+[[ebanx_payout.bank_transfer]]
+ payment_method_type = "pix"
+[ebanx_payout.connector_auth.HeaderKey]
+api_key = "Integration Key"
+
[fiserv]
[[fiserv.credit]]
payment_method_type = "Mastercard"
@@ -1607,6 +1655,14 @@ key1="Client ID"
[paypal.connector_webhook_details]
merchant_secret="Source verification key"
+[paypal_payout]
+[[paypal.wallet]]
+ payment_method_type = "paypal"
+[[paypal.wallet]]
+ payment_method_type = "venmo"
+[paypal_payout.connector_auth.BodyKey]
+api_key="Client Secret"
+key1="Client ID"
[payu]
[[payu.credit]]
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index 1d0fbb71538..502141382b7 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -866,6 +866,48 @@ merchant_name="Google Pay Merchant Name"
gateway_merchant_id="Google Pay Merchant Key"
merchant_id="Google Pay Merchant ID"
+[cybersource_payout]
+[[cybersource_payout.credit]]
+ payment_method_type = "Mastercard"
+[[cybersource_payout.credit]]
+ payment_method_type = "Visa"
+[[cybersource_payout.credit]]
+ payment_method_type = "Interac"
+[[cybersource_payout.credit]]
+ payment_method_type = "AmericanExpress"
+[[cybersource_payout.credit]]
+ payment_method_type = "JCB"
+[[cybersource_payout.credit]]
+ payment_method_type = "DinersClub"
+[[cybersource_payout.credit]]
+ payment_method_type = "Discover"
+[[cybersource_payout.credit]]
+ payment_method_type = "CartesBancaires"
+[[cybersource_payout.credit]]
+ payment_method_type = "UnionPay"
+[[cybersource_payout.debit]]
+ payment_method_type = "Mastercard"
+[[cybersource_payout.debit]]
+ payment_method_type = "Visa"
+[[cybersource_payout.debit]]
+ payment_method_type = "Interac"
+[[cybersource_payout.debit]]
+ payment_method_type = "AmericanExpress"
+[[cybersource_payout.debit]]
+ payment_method_type = "JCB"
+[[cybersource_payout.debit]]
+ payment_method_type = "DinersClub"
+[[cybersource_payout.debit]]
+ payment_method_type = "Discover"
+[[cybersource_payout.debit]]
+ payment_method_type = "CartesBancaires"
+[[cybersource_payout.debit]]
+ payment_method_type = "UnionPay"
+[cybersource_payout.connector_auth.SignatureKey]
+api_key="Key"
+key1="Merchant ID"
+api_secret="Shared Secret"
+
[dlocal]
[[dlocal.credit]]
payment_method_type = "Mastercard"
@@ -910,6 +952,12 @@ api_secret="Secret Key"
[dlocal.connector_webhook_details]
merchant_secret="Source verification key"
+[ebanx_payout]
+[[ebanx_payout.bank_transfer]]
+ payment_method_type = "pix"
+[ebanx_payout.connector_auth.HeaderKey]
+api_key = "Integration Key"
+
[fiserv]
[[fiserv.credit]]
payment_method_type = "Mastercard"
@@ -1607,6 +1655,14 @@ key1="Client ID"
[paypal.connector_webhook_details]
merchant_secret="Source verification key"
+[paypal_payout]
+[[paypal.wallet]]
+ payment_method_type = "paypal"
+[[paypal.wallet]]
+ payment_method_type = "venmo"
+[paypal_payout.connector_auth.BodyKey]
+api_key="Client Secret"
+key1="Client ID"
[payu]
[[payu.credit]]
|
feat
|
Add configs for new payout connectors (#4528)
|
e8bfd0e2270300fff3f051143f34ebb782da5366
|
2024-12-17 15:55:50
|
Prajjwal Kumar
|
refactor(constraint_graph): handle PML for cases where setup_future_usage is not passed in payments (#6810)
| false
|
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 2dba211e24a..9d8fbf58f5e 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -4593,7 +4593,7 @@ pub async fn filter_payment_methods(
.map(|future_usage| {
future_usage == common_enums::FutureUsage::OnSession
})
- .unwrap_or(false)
+ .unwrap_or(true)
})
.and_then(|res| {
res.then(|| {
|
refactor
|
handle PML for cases where setup_future_usage is not passed in payments (#6810)
|
5c3c51fbd51a504325b104395840657edb4dc3f4
|
2023-02-01 14:25:39
|
Jagan
|
test(connector): add and update tests for stripe, cybersource and shift4 connectors (#485)
| false
|
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index ce7dc0777ba..8282f7d1698 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -1,8 +1,6 @@
mod transformers;
use std::fmt::Debug;
-
-use bytes::Bytes;
use error_stack::{ResultExt, IntoReport};
use crate::{
@@ -52,8 +50,8 @@ impl ConnectorCommon for {{project-name | downcase | pascal_case}} {
connectors.{{project-name}}.base_url.as_ref()
}
- fn get_auth_header(&self,_auth_type:&types::ConnectorAuthType)-> CustomResult<Vec<(String,String)>,errors::ConnectorError> {
- let auth: {{project-name | downcase | pascal_case}}::{{project-name | downcase | pascal_case}}AuthType = auth_type
+ fn get_auth_header(&self, auth_type:&types::ConnectorAuthType)-> CustomResult<Vec<(String,String)>,errors::ConnectorError> {
+ let auth: {{project-name | downcase}}::{{project-name | downcase | pascal_case}}AuthType = auth_type
.try_into()
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(headers::AUTHORIZATION.to_string(), auth.api_key)])
@@ -82,6 +80,13 @@ impl
> for {{project-name | downcase | pascal_case}}
{}
+impl api::ConnectorAccessToken for {{project-name | downcase | pascal_case}} {}
+
+impl ConnectorIntegration<api::AccessTokenAuth, types::AccessTokenRequestData, types::AccessToken>
+ for {{project-name | downcase | pascal_case}}
+{
+}
+
impl api::PaymentSync for {{project-name | downcase | pascal_case}} {}
impl
ConnectorIntegration<api::PSync, types::PaymentsSyncData, types::PaymentsResponseData>
@@ -109,8 +114,8 @@ impl
fn build_request(
&self,
- _req: &types::PaymentsSyncRouterData,
- _connectors: &settings::Connectors,
+ req: &types::PaymentsSyncRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
@@ -123,15 +128,15 @@ impl
fn get_error_response(
&self,
- _res: types::Response,
+ res: Response,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
fn handle_response(
&self,
- _data: &types::PaymentsSyncRouterData,
- _res: Response,
+ data: &types::PaymentsSyncRouterData,
+ res: Response,
) -> CustomResult<types::PaymentsSyncRouterData, errors::ConnectorError> {
logger::debug!(payment_sync_response=?res);
let response: {{project-name | downcase}}:: {{project-name | downcase | pascal_case}}PaymentsResponse = res
@@ -185,8 +190,8 @@ impl
fn build_request(
&self,
- _req: &types::PaymentsCaptureRouterData,
- _connectors: &settings::Connectors,
+ req: &types::PaymentsCaptureRouterData,
+ connectors: &settings::Connectors,
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
Ok(Some(
services::RequestBuilder::new()
@@ -201,8 +206,8 @@ impl
fn handle_response(
&self,
- _data: &types::PaymentsCaptureRouterData,
- _res: Response,
+ data: &types::PaymentsCaptureRouterData,
+ res: Response,
) -> CustomResult<types::PaymentsCaptureRouterData, errors::ConnectorError> {
let response: {{project-name | downcase }}::{{project-name | downcase | pascal_case}}PaymentsResponse = res
.response
@@ -220,7 +225,7 @@ impl
fn get_error_response(
&self,
- _res: types::Response,
+ res: Response,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res)
}
@@ -299,7 +304,7 @@ impl
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
- fn get_error_response(&self, res: types::Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
+ fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
self.build_error_response(res)
}
}
@@ -357,7 +362,7 @@ impl
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
- fn get_error_response(&self, res: types::Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
+ fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
self.build_error_response(res)
}
}
@@ -407,7 +412,7 @@ impl
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
- fn get_error_response(&self, res: types::Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
+ fn get_error_response(&self, res: Response) -> CustomResult<ErrorResponse,errors::ConnectorError> {
self.build_error_response(res)
}
}
diff --git a/connector-template/test.rs b/connector-template/test.rs
index 5926584c526..c9c5fe0b5f0 100644
--- a/connector-template/test.rs
+++ b/connector-template/test.rs
@@ -79,7 +79,7 @@ async fn should_sync_authorized_payment() {
.authorize_payment(None, None)
.await
.expect("Authorize payment response");
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
@@ -182,7 +182,7 @@ async fn should_make_payment() {
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let response = CONNECTOR
.psync_retry_till_status_matches(
@@ -388,7 +388,7 @@ async fn should_fail_payment_for_incorrect_expiry_year() {
async fn should_fail_void_payment_for_auto_capture() {
let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let void_response = CONNECTOR
.void_payment(txn_id.unwrap(), None, None)
diff --git a/connector-template/transformers.rs b/connector-template/transformers.rs
index 2cf351f47f2..ab51bbff3cd 100644
--- a/connector-template/transformers.rs
+++ b/connector-template/transformers.rs
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
-use crate::{core::errors,pii::PeekInterface,types::{self,api, storage::enums}};
+use crate::{core::errors,types::{self,api, storage::enums}};
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
@@ -14,7 +14,9 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for {{project-name | downcase
//TODO: Fill the struct with respective fields
// Auth Struct
-pub struct {{project-name | downcase | pascal_case}}AuthType {}
+pub struct {{project-name | downcase | pascal_case}}AuthType {
+ pub(super) api_key: String
+}
impl TryFrom<&types::ConnectorAuthType> for {{project-name | downcase | pascal_case}}AuthType {
type Error = error_stack::Report<errors::ConnectorError>;
@@ -45,7 +47,10 @@ impl From<{{project-name | downcase | pascal_case}}PaymentStatus> for enums::Att
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
-pub struct {{project-name | downcase | pascal_case}}PaymentsResponse {}
+pub struct {{project-name | downcase | pascal_case}}PaymentsResponse {
+ status: {{project-name | downcase | pascal_case}}PaymentStatus,
+ id: String,
+}
impl<F,T> TryFrom<types::ResponseRouterData<F, {{project-name | downcase | pascal_case}}PaymentsResponse, T, types::PaymentsResponseData>> for types::RouterData<F, T, types::PaymentsResponseData> {
type Error = error_stack::Report<errors::ParsingError>;
@@ -57,6 +62,7 @@ impl<F,T> TryFrom<types::ResponseRouterData<F, {{project-name | downcase | pasca
redirection_data: None,
redirect: false,
mandate_reference: None,
+ connector_metadata: None,
}),
..item.data
})
@@ -87,8 +93,8 @@ pub enum RefundStatus {
Processing,
}
-impl From<self::RefundStatus> for enums::RefundStatus {
- fn from(item: self::RefundStatus) -> Self {
+impl From<RefundStatus> for enums::RefundStatus {
+ fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
@@ -108,7 +114,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::Execute, RefundResponse>>
{
type Error = error_stack::Report<errors::ParsingError>;
fn try_from(
- item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
+ _item: types::RefundsResponseRouterData<api::Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
todo!()
}
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index 05630a7005c..1d0de718a07 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -3,6 +3,7 @@ use error_stack::ResultExt;
use serde::{Deserialize, Serialize};
use crate::{
+ connector::utils::RefundsRequestData,
core::errors,
pii::PeekInterface,
types::{self, api, storage::enums},
@@ -466,12 +467,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for AuthorizedotnetCreateSyncReque
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
- let transaction_id = item
- .request
- .connector_refund_id
- .clone()
- .get_required_value("connector_refund_id")
- .change_context(errors::ConnectorError::MissingConnectorRefundID)?;
+ let transaction_id = item.request.get_connector_refund_id()?;
let merchant_authentication = MerchantAuthentication::try_from(&item.connector_auth_type)?;
let payload = Self {
diff --git a/crates/router/src/connector/checkout.rs b/crates/router/src/connector/checkout.rs
index f1e92ef1556..125ea21420a 100644
--- a/crates/router/src/connector/checkout.rs
+++ b/crates/router/src/connector/checkout.rs
@@ -7,6 +7,7 @@ use std::fmt::Debug;
use error_stack::{IntoReport, ResultExt};
use self::transformers as checkout;
+use super::utils::RefundsRequestData;
use crate::{
configs::settings,
consts,
@@ -19,7 +20,7 @@ use crate::{
self,
api::{self, ConnectorCommon},
},
- utils::{self, BytesExt, OptionExt},
+ utils::{self, BytesExt},
};
#[derive(Debug, Clone)]
@@ -674,12 +675,7 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
data: &types::RefundsRouterData<api::RSync>,
res: types::Response,
) -> CustomResult<types::RefundsRouterData<api::RSync>, errors::ConnectorError> {
- let refund_action_id = data
- .request
- .connector_refund_id
- .clone()
- .get_required_value("connector_refund_id")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let refund_action_id = data.request.get_connector_refund_id()?;
let response: Vec<checkout::ActionResponse> = res
.response
diff --git a/crates/router/src/connector/cybersource.rs b/crates/router/src/connector/cybersource.rs
index 3fd44571f63..a932a3fe829 100644
--- a/crates/router/src/connector/cybersource.rs
+++ b/crates/router/src/connector/cybersource.rs
@@ -11,6 +11,7 @@ use url::Url;
use crate::{
configs::settings,
+ connector::utils::RefundsRequestData,
consts,
core::errors::{self, CustomResult},
headers, logger,
@@ -19,7 +20,7 @@ use crate::{
self,
api::{self, ConnectorCommon, ConnectorCommonExt},
},
- utils::{self, BytesExt, OptionExt},
+ utils::{self, BytesExt},
};
#[derive(Debug, Clone)]
@@ -95,8 +96,19 @@ impl ConnectorCommon for Cybersource {
Ok(types::ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
- message: response.details.to_string(),
- reason: None,
+ message: response
+ .message
+ .map(|m| {
+ format!(
+ "{} {}",
+ m,
+ response.details.map(|d| d.to_string()).unwrap_or_default()
+ )
+ .trim()
+ .to_string()
+ })
+ .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
+ reason: response.reason,
})
}
}
@@ -633,13 +645,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
req: &types::RefundSyncRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let refund_id = req
- .response
- .clone()
- .ok()
- .get_required_value("response")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?
- .connector_refund_id;
+ let refund_id = req.request.get_connector_refund_id()?;
Ok(format!(
"{}tss/v2/transactions/{}",
self.base_url(connectors),
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index d67cbd2205c..acec267d9f4 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -260,7 +260,9 @@ impl From<CybersourcePaymentStatus> for enums::AttemptStatus {
impl From<CybersourcePaymentStatus> for enums::RefundStatus {
fn from(item: CybersourcePaymentStatus) -> Self {
match item {
- CybersourcePaymentStatus::Succeeded => Self::Success,
+ CybersourcePaymentStatus::Succeeded | CybersourcePaymentStatus::Transmitted => {
+ Self::Success
+ }
CybersourcePaymentStatus::Failed => Self::Failure,
_ => Self::Pending,
}
@@ -390,9 +392,10 @@ impl<F, T>
#[serde(rename_all = "camelCase")]
pub struct ErrorResponse {
pub error_information: Option<ErrorInformation>,
- pub status: String,
+ pub status: Option<String>,
pub message: Option<String>,
- pub details: serde_json::Value,
+ pub reason: Option<String>,
+ pub details: Option<serde_json::Value>,
}
#[derive(Debug, Default, Deserialize)]
@@ -413,7 +416,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for CybersourceRefundRequest {
Ok(Self {
order_information: OrderInformation {
amount_details: Amount {
- total_amount: item.request.amount.to_string(),
+ total_amount: item.request.refund_amount.to_string(),
currency: item.request.currency.to_string(),
},
},
diff --git a/crates/router/src/connector/shift4.rs b/crates/router/src/connector/shift4.rs
index 7f2d5ec1280..470eeb2502e 100644
--- a/crates/router/src/connector/shift4.rs
+++ b/crates/router/src/connector/shift4.rs
@@ -6,6 +6,7 @@ use common_utils::ext_traits::ByteSliceExt;
use error_stack::ResultExt;
use transformers as shift4;
+use super::utils::RefundsRequestData;
use crate::{
configs::settings,
consts,
@@ -20,7 +21,7 @@ use crate::{
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse,
},
- utils::{self, BytesExt, OptionExt},
+ utils::{self, BytesExt},
};
#[derive(Debug, Clone)]
@@ -444,12 +445,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
req: &types::RefundSyncRouterData,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let refund_id = req
- .request
- .connector_refund_id
- .clone()
- .get_required_value("connector_refund_id")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+ let refund_id = req.request.get_connector_refund_id()?;
Ok(format!(
"{}refunds/{}",
self.base_url(connectors),
diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs
index c3dac73b976..ea1ebce8c5d 100644
--- a/crates/router/src/connector/shift4/transformers.rs
+++ b/crates/router/src/connector/shift4/transformers.rs
@@ -177,7 +177,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for Shift4RefundRequest {
fn try_from(item: &types::RefundsRouterData<F>) -> Result<Self, Self::Error> {
Ok(Self {
charge_id: item.request.connector_transaction_id.clone(),
- amount: item.request.amount,
+ amount: item.request.refund_amount,
})
}
}
diff --git a/crates/router/src/connector/stripe.rs b/crates/router/src/connector/stripe.rs
index d6841c257cf..fecedb31f1c 100644
--- a/crates/router/src/connector/stripe.rs
+++ b/crates/router/src/connector/stripe.rs
@@ -6,6 +6,7 @@ use error_stack::{IntoReport, ResultExt};
use router_env::{instrument, tracing};
use self::transformers as stripe;
+use super::utils::RefundsRequestData;
use crate::{
configs::settings,
consts,
@@ -19,7 +20,7 @@ use crate::{
self,
api::{self, ConnectorCommon},
},
- utils::{self, crypto, ByteSliceExt, BytesExt, OptionExt},
+ utils::{self, crypto, ByteSliceExt, BytesExt},
};
#[derive(Debug, Clone)]
@@ -779,12 +780,7 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
req: &types::RefundsRouterData<api::RSync>,
connectors: &settings::Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let id = req
- .request
- .connector_refund_id
- .clone()
- .get_required_value("connector_refund_id")
- .change_context(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
+ let id = req.request.get_connector_refund_id()?;
Ok(format!("{}v1/refunds/{}", self.base_url(connectors), id))
}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index cd2d9db446f..20238844ea3 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -1,9 +1,11 @@
+use error_stack::ResultExt;
use masking::Secret;
use crate::{
core::errors,
pii::PeekInterface,
types::{self, api},
+ utils::OptionExt,
};
pub fn missing_field_err(
@@ -40,6 +42,19 @@ pub trait PaymentsRequestData {
fn get_card(&self) -> Result<api::Card, Error>;
}
+pub trait RefundsRequestData {
+ fn get_connector_refund_id(&self) -> Result<String, Error>;
+}
+
+impl RefundsRequestData for types::RefundsData {
+ fn get_connector_refund_id(&self) -> Result<String, Error> {
+ self.connector_refund_id
+ .clone()
+ .get_required_value("connector_refund_id")
+ .change_context(errors::ConnectorError::MissingConnectorTransactionID)
+ }
+}
+
impl PaymentsRequestData for types::PaymentsAuthorizeRouterData {
fn get_attempt_id(&self) -> Result<String, Error> {
self.attempt_id
diff --git a/crates/router/src/connector/worldline.rs b/crates/router/src/connector/worldline.rs
index ceb72f93cdc..7d6f214e96a 100644
--- a/crates/router/src/connector/worldline.rs
+++ b/crates/router/src/connector/worldline.rs
@@ -9,6 +9,7 @@ use storage_models::enums;
use time::{format_description, OffsetDateTime};
use transformers as worldline;
+use super::utils::RefundsRequestData;
use crate::{
configs::settings::Connectors,
consts,
@@ -20,7 +21,7 @@ use crate::{
api::{self, ConnectorCommon, ConnectorCommonExt},
ErrorResponse,
},
- utils::{self, BytesExt, OptionExt},
+ utils::{self, BytesExt},
};
#[derive(Debug, Clone)]
@@ -600,12 +601,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
req: &types::RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- let refund_id = req
- .request
- .connector_refund_id
- .clone()
- .get_required_value("connector_refund_id")
- .change_context(errors::ConnectorError::FailedToObtainIntegrationUrl)?;
+ let refund_id = req.request.get_connector_refund_id()?;
let base_url = self.base_url(connectors);
let auth: worldline::AuthType = worldline::AuthType::try_from(&req.connector_auth_type)?;
let merchant_account_id = auth.merchant_account_id;
diff --git a/crates/router/tests/connectors/cybersource.rs b/crates/router/tests/connectors/cybersource.rs
index 51ba6e39731..f960e3ea2da 100644
--- a/crates/router/tests/connectors/cybersource.rs
+++ b/crates/router/tests/connectors/cybersource.rs
@@ -1,12 +1,13 @@
-use futures::future::OptionFuture;
use masking::Secret;
-use router::types::{self, api, storage::enums};
+use router::types::{
+ self, api,
+ storage::{self, enums},
+};
use crate::{
connector_auth,
utils::{self, ConnectorActions, PaymentAuthorizeType},
};
-
struct Cybersource;
impl ConnectorActions for Cybersource {}
impl utils::Connector for Cybersource {
@@ -18,7 +19,6 @@ impl utils::Connector for Cybersource {
get_token: types::api::GetToken::Connector,
}
}
-
fn get_auth_token(&self) -> types::ConnectorAuthType {
types::ConnectorAuthType::from(
connector_auth::ConnectorAuthentication::new()
@@ -26,7 +26,6 @@ impl utils::Connector for Cybersource {
.expect("Missing connector authentication configuration"),
)
}
-
fn get_name(&self) -> String {
"cybersource".to_string()
}
@@ -56,9 +55,9 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
..Default::default()
})
}
-
fn get_default_payment_authorize_data() -> Option<types::PaymentsAuthorizeData> {
Some(types::PaymentsAuthorizeData {
+ currency: storage::enums::Currency::USD,
email: Some(Secret::new("[email protected]".to_string())),
..PaymentAuthorizeType::default().0
})
@@ -74,180 +73,320 @@ async fn should_only_authorize_payment() {
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
-
#[actix_web::test]
-async fn should_authorize_and_capture_payment() {
+async fn should_make_payment() {
+ let response = Cybersource {}
+ .make_payment(
+ get_default_payment_authorize_data(),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Pending);
+}
+#[actix_web::test]
+async fn should_capture_already_authorized_payment() {
let connector = Cybersource {};
let response = connector
- .make_payment(
+ .authorize_and_capture_payment(
get_default_payment_authorize_data(),
+ None,
get_default_payment_info(),
)
.await;
- let sync_response = connector
- .sync_payment(
- Some(types::PaymentsSyncData {
- connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
- utils::get_connector_transaction_id(response.unwrap()).unwrap(),
- ),
- encoded_data: None,
- capture_method: None,
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending);
+}
+#[actix_web::test]
+async fn should_partially_capture_already_authorized_payment() {
+ let connector = Cybersource {};
+ let response = connector
+ .authorize_and_capture_payment(
+ get_default_payment_authorize_data(),
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: Some(50),
+ ..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
- .await
- .unwrap();
- //cybersource takes sometime to settle the transaction,so it will be in pending for long time
- assert_eq!(sync_response.status, enums::AttemptStatus::Pending);
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending);
}
#[actix_web::test]
-async fn should_sync_capture_payment() {
- let sync_response = Cybersource {}
- .sync_payment(
+async fn should_sync_payment() {
+ let connector = Cybersource {};
+ let response = connector
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
- "6736046645576085004953".to_string(),
+ "6699597903496176903954".to_string(),
),
encoded_data: None,
capture_method: None,
}),
- get_default_payment_info(),
+ None,
)
.await
.unwrap();
- assert_eq!(sync_response.status, enums::AttemptStatus::Charged);
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
-
#[actix_web::test]
-async fn should_capture_already_authorized_payment() {
+async fn should_void_already_authorized_payment() {
let connector = Cybersource {};
- let authorize_response = connector
- .authorize_payment(
+ let response = connector
+ .authorize_and_void_payment(
get_default_payment_authorize_data(),
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: "".to_string(),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Voided);
+}
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_card_number() {
+ let response = Cybersource {}
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_number: Secret::new("4024007134364111".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..get_default_payment_authorize_data().unwrap()
+ }),
get_default_payment_info(),
)
.await
.unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
- let response: OptionFuture<_> = txn_id
- .map(|transaction_id| async move {
- connector
- .capture_payment(transaction_id, None, get_default_payment_info())
- .await
- .unwrap()
- .status
- })
- .into();
- //cybersource takes sometime to settle the transaction,so it will be in pending for long time
- assert_eq!(response.await, Some(enums::AttemptStatus::Pending));
+ let x = response.response.unwrap_err();
+ assert_eq!(x.message, "Decline - Invalid account number",);
}
-
#[actix_web::test]
-async fn should_void_already_authorized_payment() {
+async fn should_fail_payment_for_no_card_number() {
+ let response = Cybersource {}
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_number: Secret::new("".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..get_default_payment_authorize_data().unwrap()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let x = response.response.unwrap_err();
+ assert_eq!(x.message, "The order has been rejected by Decision Manager",);
+}
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = Cybersource {}
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_exp_month: Secret::new("13".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..get_default_payment_authorize_data().unwrap()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let x = response.response.unwrap_err();
+ assert_eq!(
+ x.message,
+ r#"Declined - One or more fields in the request contains invalid data [{"field":"paymentInformation.card.expirationMonth","reason":"INVALID_DATA"}]"#,
+ );
+}
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_year() {
+ let response = Cybersource {}
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_exp_year: Secret::new("2022".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..get_default_payment_authorize_data().unwrap()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let x = response.response.unwrap_err();
+ assert_eq!(x.message, "Decline - Expired card. You might also receive this if the expiration date you provided does not match the date the issuing bank has on file.",);
+}
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_card_cvc() {
+ let response = Cybersource {}
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_cvc: Secret::new("2131233213".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..get_default_payment_authorize_data().unwrap()
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ let x = response.response.unwrap_err();
+ assert_eq!(
+ x.message,
+ r#"Declined - One or more fields in the request contains invalid data [{"field":"paymentInformation.card.securityCode","reason":"INVALID_DATA"}]"#,
+ );
+}
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_reversed_payment() {
let connector = Cybersource {};
+ // Authorize
let authorize_response = connector
- .authorize_payment(
+ .make_payment(
get_default_payment_authorize_data(),
get_default_payment_info(),
)
.await
.unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
- let response: OptionFuture<_> = txn_id
- .map(|transaction_id| async move {
- connector
- .void_payment(transaction_id, None, get_default_payment_info())
- .await
- .unwrap()
- .status
- })
- .into();
- assert_eq!(response.await, Some(enums::AttemptStatus::Voided));
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ // Void
+ let void_response = connector
+ .void_payment("6736046645576085004953".to_string(), None, None)
+ .await
+ .unwrap();
+ let res = void_response.response.unwrap_err();
+ assert_eq!(
+ res.message,
+ "Decline - The authorization has already been reversed."
+ );
+}
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let connector = Cybersource {};
+ let response = connector
+ .capture_payment("12345".to_string(), None, get_default_payment_info())
+ .await
+ .unwrap();
+ let err = response.response.unwrap_err();
+ assert_eq!(
+ err.message,
+ r#"Declined - One or more fields in the request contains invalid data [{"field":"id","reason":"INVALID_DATA"}]"#
+ );
+ assert_eq!(err.code, "No error code".to_string());
}
-
#[actix_web::test]
async fn should_refund_succeeded_payment() {
let connector = Cybersource {};
- //make a successful payment
let response = connector
- .make_payment(
+ .make_payment_and_refund(
get_default_payment_authorize_data(),
+ None,
get_default_payment_info(),
)
.await
.unwrap();
-
- //try refund for previous payment
- let transaction_id = utils::get_connector_transaction_id(response).unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending,
+ );
+}
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let connector = Cybersource {};
let response = connector
- .refund_payment(transaction_id, None, get_default_payment_info())
+ .auth_capture_and_refund(
+ get_default_payment_authorize_data(),
+ None,
+ get_default_payment_info(),
+ )
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
- enums::RefundStatus::Pending, //cybersource takes sometime to refund the transaction,so it will be in pending state for long time
+ enums::RefundStatus::Pending,
+ );
+}
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let connector = Cybersource {};
+ let refund_response = connector
+ .make_payment_and_refund(
+ get_default_payment_authorize_data(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending,
);
}
#[actix_web::test]
-async fn should_sync_refund() {
+async fn should_partially_refund_manually_captured_payment() {
let connector = Cybersource {};
let response = connector
- .sync_refund(
- "6738063831816571404953".to_string(),
- None,
+ .auth_capture_and_refund(
+ get_default_payment_authorize_data(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
- enums::RefundStatus::Pending, //cybersource takes sometime to refund the transaction,so it will be in pending state for long time
+ enums::RefundStatus::Pending,
);
}
#[actix_web::test]
-async fn should_fail_payment_for_incorrect_card_number() {
- let response = Cybersource {}
- .make_payment(
- Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
- card_number: Secret::new("424242442424242".to_string()),
- ..utils::CCardType::default().0
- }),
- ..get_default_payment_authorize_data().unwrap()
+async fn should_fail_refund_for_invalid_amount() {
+ let connector = Cybersource {};
+ let response = connector
+ .make_payment_and_refund(
+ get_default_payment_authorize_data(),
+ Some(types::RefundsData {
+ refund_amount: 15000,
+ ..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
- assert_eq!(response.status, enums::AttemptStatus::Failure);
- let x = response.response.unwrap_err();
- assert_eq!(x.message, "Decline - Invalid account number".to_string(),);
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Pending,
+ );
}
-
#[actix_web::test]
-async fn should_fail_payment_for_incorrect_exp_month() {
- let response = Cybersource {}
- .make_payment(
- Some(types::PaymentsAuthorizeData {
- payment_method_data: types::api::PaymentMethod::Card(api::Card {
- card_number: Secret::new("4242424242424242".to_string()),
- card_exp_month: Secret::new("101".to_string()),
- ..utils::CCardType::default().0
- }),
- ..get_default_payment_authorize_data().unwrap()
- }),
+async fn should_sync_refund() {
+ let connector = Cybersource {};
+ let response = connector
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ "6699597076726585603955".to_string(),
+ None,
get_default_payment_info(),
)
- .await;
- let x = response.unwrap().response.unwrap_err();
+ .await
+ .unwrap();
assert_eq!(
- x.message,
- r#"[{"field":"paymentInformation.card.expirationMonth","reason":"INVALID_DATA"}]"#
- .to_string(),
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
);
}
diff --git a/crates/router/tests/connectors/fiserv.rs b/crates/router/tests/connectors/fiserv.rs
index 25d2539fa6e..1edbb451903 100644
--- a/crates/router/tests/connectors/fiserv.rs
+++ b/crates/router/tests/connectors/fiserv.rs
@@ -101,7 +101,7 @@ async fn should_capture_already_authorized_payment() {
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response: OptionFuture<_> = txn_id
.map(|transaction_id| async move {
connector
@@ -144,7 +144,7 @@ async fn should_refund_succeeded_payment() {
let response = connector.make_payment(None, None).await.unwrap();
//try refund for previous payment
- if let Some(transaction_id) = utils::get_connector_transaction_id(response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(response.response) {
let response = connector
.refund_payment(transaction_id, None, None)
.await
diff --git a/crates/router/tests/connectors/globalpay.rs b/crates/router/tests/connectors/globalpay.rs
index 3f8330b4e1e..971f42f3bcb 100644
--- a/crates/router/tests/connectors/globalpay.rs
+++ b/crates/router/tests/connectors/globalpay.rs
@@ -1,6 +1,5 @@
use std::{thread::sleep, time::Duration};
-use futures::future::OptionFuture;
use masking::Secret;
use router::types::{
self,
@@ -55,8 +54,7 @@ fn get_default_payment_info() -> Option<PaymentInfo> {
}),
..Default::default()
}),
- auth_type: None,
- access_token: None,
+ ..Default::default()
})
}
@@ -81,22 +79,17 @@ async fn should_authorize_and_capture_payment() {
#[actix_web::test]
async fn should_capture_already_authorized_payment() {
let connector = Globalpay {};
- let authorize_response = connector
- .authorize_payment(None, get_default_payment_info())
- .await
- .unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
- let response: OptionFuture<_> = txn_id
- .map(|transaction_id| async move {
- connector
- .capture_payment(transaction_id, None, get_default_payment_info())
- .await
- .unwrap()
- .status
- })
- .into();
- assert_eq!(response.await, Some(enums::AttemptStatus::Charged));
+ let response = connector
+ .authorize_and_capture_payment(
+ None,
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: Some(50),
+ ..utils::PaymentCaptureType::default().0
+ }),
+ get_default_payment_info(),
+ )
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Charged);
}
#[actix_web::test]
@@ -106,10 +99,11 @@ async fn should_sync_payment() {
.authorize_payment(None, get_default_payment_info())
.await
.unwrap();
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
sleep(Duration::from_secs(5)); // to avoid 404 error as globalpay takes some time to process the new transaction
let response = connector
- .sync_payment(
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
@@ -146,16 +140,8 @@ async fn should_fail_payment_for_incorrect_cvc() {
#[actix_web::test]
async fn should_refund_succeeded_payment() {
let connector = Globalpay {};
- //make a successful payment
- let response = connector
- .make_payment(None, get_default_payment_info())
- .await
- .unwrap();
-
- //try refund for previous payment
- let transaction_id = utils::get_connector_transaction_id(response).unwrap();
let response = connector
- .refund_payment(transaction_id, None, get_default_payment_info())
+ .make_payment_and_refund(None, None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
@@ -167,39 +153,26 @@ async fn should_refund_succeeded_payment() {
#[actix_web::test]
async fn should_void_already_authorized_payment() {
let connector = Globalpay {};
- let authorize_response = connector
- .authorize_payment(None, get_default_payment_info())
- .await
- .unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
- let response: OptionFuture<_> = txn_id
- .map(|transaction_id| async move {
- connector
- .void_payment(transaction_id, None, None)
- .await
- .unwrap()
- .status
- })
- .into();
- assert_eq!(response.await, Some(enums::AttemptStatus::Voided));
+ let response = connector
+ .authorize_and_void_payment(None, None, get_default_payment_info())
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Voided);
}
#[actix_web::test]
async fn should_sync_refund() {
let connector = Globalpay {};
- let response = connector
- .make_payment(None, get_default_payment_info())
+ let refund_response = connector
+ .make_payment_and_refund(None, None, get_default_payment_info())
.await
.unwrap();
- let transaction_id = utils::get_connector_transaction_id(response).unwrap();
- connector
- .refund_payment(transaction_id.clone(), None, get_default_payment_info())
- .await
- .unwrap();
- sleep(Duration::from_secs(5)); // to avoid 404 error as globalpay takes some time to process the new transaction
let response = connector
- .sync_refund(transaction_id, None, get_default_payment_info())
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ get_default_payment_info(),
+ )
.await
.unwrap();
assert_eq!(
diff --git a/crates/router/tests/connectors/payu.rs b/crates/router/tests/connectors/payu.rs
index d610119a658..5b6523dcdf5 100644
--- a/crates/router/tests/connectors/payu.rs
+++ b/crates/router/tests/connectors/payu.rs
@@ -41,9 +41,8 @@ fn get_access_token() -> Option<AccessToken> {
}
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
Some(utils::PaymentInfo {
- address: None,
- auth_type: None,
access_token: get_access_token(),
+ ..Default::default()
})
}
@@ -63,7 +62,7 @@ async fn should_authorize_card_payment() {
.unwrap();
// in Payu need Psync to get status therefore set to pending
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
let sync_response = Payu {}
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
@@ -95,7 +94,7 @@ async fn should_authorize_gpay_payment() {
..PaymentAuthorizeType::default().0
}), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
let sync_response = Payu {}
.sync_payment(
Some(types::PaymentsSyncData {
@@ -128,7 +127,7 @@ async fn should_capture_already_authorized_payment() {
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
let sync_response = connector
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
@@ -184,7 +183,7 @@ async fn should_sync_payment() {
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
// Sync the Payment Data
let response = connector
.psync_retry_till_status_matches(
@@ -223,7 +222,7 @@ async fn should_void_already_authorized_payment() {
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
//try CANCEL for previous payment
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
let void_response = connector
.void_payment(transaction_id.clone(), None, get_default_payment_info())
.await
@@ -264,7 +263,7 @@ async fn should_refund_succeeded_payment() {
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
- if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(authorize_response.response) {
let sync_response = connector
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
diff --git a/crates/router/tests/connectors/rapyd.rs b/crates/router/tests/connectors/rapyd.rs
index c17a0be5778..bf47e064112 100644
--- a/crates/router/tests/connectors/rapyd.rs
+++ b/crates/router/tests/connectors/rapyd.rs
@@ -81,7 +81,7 @@ async fn should_capture_already_authorized_payment() {
let connector = Rapyd {};
let authorize_response = connector.authorize_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response: OptionFuture<_> = txn_id
.map(|transaction_id| async move {
connector
@@ -100,7 +100,7 @@ async fn voiding_already_authorized_payment_fails() {
let connector = Rapyd {};
let authorize_response = connector.authorize_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response: OptionFuture<_> = txn_id
.map(|transaction_id| async move {
connector
@@ -120,7 +120,7 @@ async fn should_refund_succeeded_payment() {
let response = connector.make_payment(None, None).await.unwrap();
//try refund for previous payment
- if let Some(transaction_id) = utils::get_connector_transaction_id(response) {
+ if let Some(transaction_id) = utils::get_connector_transaction_id(response.response) {
let response = connector
.refund_payment(transaction_id, None, None)
.await
diff --git a/crates/router/tests/connectors/shift4.rs b/crates/router/tests/connectors/shift4.rs
index 35209ebdf62..66f24aaf2f4 100644
--- a/crates/router/tests/connectors/shift4.rs
+++ b/crates/router/tests/connectors/shift4.rs
@@ -1,4 +1,3 @@
-use futures::future::OptionFuture;
use masking::Secret;
use router::types::{self, api, storage::enums};
@@ -7,9 +6,10 @@ use crate::{
utils::{self, ConnectorActions},
};
-struct Shift4;
-impl ConnectorActions for Shift4 {}
-impl utils::Connector for Shift4 {
+#[derive(Clone, Copy)]
+struct Shift4Test;
+impl ConnectorActions for Shift4Test {}
+impl utils::Connector for Shift4Test {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Shift4;
types::api::ConnectorData {
@@ -32,43 +32,146 @@ impl utils::Connector for Shift4 {
}
}
+static CONNECTOR: Shift4Test = Shift4Test {};
+
+// Cards Positive Tests
+// Creates a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_only_authorize_payment() {
- let response = Shift4 {}.authorize_payment(None, None).await.unwrap();
+ let response = CONNECTOR.authorize_payment(None, None).await.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
+// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
-async fn should_authorize_and_capture_payment() {
- let response = Shift4 {}.make_payment(None, None).await.unwrap();
- assert_eq!(response.status, enums::AttemptStatus::Charged);
+async fn should_make_payment() {
+ let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+}
+
+// Captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_capture_authorized_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .authorize_and_capture_payment(None, None, None)
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Charged);
+}
+
+// Partially captures a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_capture_authorized_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .authorize_and_capture_payment(
+ None,
+ Some(types::PaymentsCaptureData {
+ amount_to_capture: Some(50),
+ ..utils::PaymentCaptureType::default().0
+ }),
+ None,
+ )
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Charged);
}
+// Synchronizes a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
-async fn should_capture_already_authorized_payment() {
- let connector = Shift4 {};
+async fn should_sync_authorized_payment() {
+ let connector = CONNECTOR;
let authorize_response = connector.authorize_payment(None, None).await.unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
- let response: OptionFuture<_> = txn_id
- .map(|transaction_id| async move {
- connector
- .capture_payment(transaction_id, None, None)
- .await
- .unwrap()
- .status
- })
- .into();
- assert_eq!(response.await, Some(enums::AttemptStatus::Charged));
-}
-
-#[actix_web::test]
-async fn should_fail_payment_for_incorrect_cvc() {
- let response = Shift4 {}
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = connector
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Authorized,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ encoded_data: None,
+ capture_method: None,
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Authorized,);
+}
+
+// Synchronizes a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_auto_captured_payment() {
+ // Authorize
+ let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+ let response = CONNECTOR
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ encoded_data: None,
+ capture_method: None,
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
+// Voids a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_void_authorized_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .authorize_and_void_payment(
+ None,
+ Some(types::PaymentsCancelData {
+ connector_transaction_id: "".to_string(),
+ cancellation_reason: Some("requested_by_customer".to_string()),
+ }),
+ None,
+ )
+ .await;
+ assert_eq!(response.unwrap().status, enums::AttemptStatus::Pending); //shift4 doesn't allow voiding a payment
+}
+
+// Cards Negative scenerios
+// Creates a payment with incorrect card number.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_card_number() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_number: Secret::new("1234567891011".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Your request was in test mode, but used a non test card. For a list of valid test cards, visit our doc site.".to_string(),
+ );
+}
+
+// Creates a payment with empty card number.
+#[actix_web::test]
+async fn should_fail_payment_for_empty_card_number() {
+ let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::api::PaymentMethod::Card(api::Card {
- card_number: Secret::new("4024007134364842".to_string()),
+ card_number: Secret::new("".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
@@ -80,25 +183,251 @@ async fn should_fail_payment_for_incorrect_cvc() {
let x = response.response.unwrap_err();
assert_eq!(
x.message,
- "The card's security code failed verification.".to_string(),
+ "The card number is not a valid credit card number.",
);
}
+// Creates a payment with incorrect CVC.
#[actix_web::test]
-async fn should_refund_succeeded_payment() {
- let connector = Shift4 {};
- //make a successful payment
- let response = connector.make_payment(None, None).await.unwrap();
+async fn should_succeed_payment_for_incorrect_cvc() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_cvc: Secret::new("asdasd".to_string()), //shift4 accept invalid CVV as it doesn't accept CVV
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged);
+}
- //try refund for previous payment
- if let Some(transaction_id) = utils::get_connector_transaction_id(response) {
- let response = connector
- .refund_payment(transaction_id, None, None)
- .await
- .unwrap();
- assert_eq!(
- response.response.unwrap().refund_status,
+// Creates a payment with incorrect expiry month.
+#[actix_web::test]
+async fn should_fail_payment_for_invalid_exp_month() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_exp_month: Secret::new("20".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "The card's expiration month is invalid.".to_string(),
+ );
+}
+
+// Creates a payment with incorrect expiry year.
+#[actix_web::test]
+async fn should_fail_payment_for_incorrect_expiry_year() {
+ let response = CONNECTOR
+ .make_payment(
+ Some(types::PaymentsAuthorizeData {
+ payment_method_data: types::api::PaymentMethod::Card(api::Card {
+ card_exp_year: Secret::new("2000".to_string()),
+ ..utils::CCardType::default().0
+ }),
+ ..utils::PaymentAuthorizeType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "The card has expired.".to_string(),
+ );
+}
+
+// Voids a payment using automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_fail_void_payment_for_auto_capture() {
+ // Authorize
+ let authorize_response = CONNECTOR.make_payment(None, None).await.unwrap();
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+
+ // Void
+ let void_response = CONNECTOR
+ .void_payment(txn_id.unwrap(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(void_response.status, enums::AttemptStatus::Pending); //shift4 doesn't allow voiding a payment
+}
+
+// Captures a payment using invalid connector payment id.
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ // Capture
+ let capture_response = CONNECTOR
+ .capture_payment("123456789".to_string(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ capture_response.response.unwrap_err().message,
+ String::from("Charge '123456789' does not exist")
+ );
+}
+
+// Refunds a payment using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_auto_captured_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .make_payment_and_refund(None, None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .auth_capture_and_refund(None, None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+#[actix_web::test]
+async fn should_partially_refund_succeeded_payment() {
+ let connector = CONNECTOR;
+ let refund_response = connector
+ .make_payment_and_refund(
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ refund_response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Partially refunds a payment using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let connector = CONNECTOR;
+ let response = connector
+ .auth_capture_and_refund(
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+#[actix_web::test]
+async fn should_refund_succeeded_payment_multiple_times() {
+ let connector = CONNECTOR;
+ connector
+ .make_payment_and_multiple_refund(
+ None,
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await;
+}
+
+// Refunds a payment with refund amount higher than payment amount.
+#[actix_web::test]
+async fn should_fail_for_refund_amount_higher_than_payment_amount() {
+ let connector = CONNECTOR;
+ let response = connector
+ .make_payment_and_refund(
+ None,
+ Some(types::RefundsData {
+ refund_amount: 150,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap_err().message,
+ "Invalid Refund data",
+ );
+}
+
+// Synchronizes a refund using the automatic capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_refund() {
+ let connector = CONNECTOR;
+ let refund_response = connector
+ .make_payment_and_refund(None, None, None)
+ .await
+ .unwrap();
+ let response = connector
+ .rsync_retry_till_status_matches(
enums::RefundStatus::Success,
- );
- }
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
+// Synchronizes a refund using the manual capture flow (Non 3DS).
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let connector = CONNECTOR;
+ let refund_response = connector
+ .auth_capture_and_refund(None, None, None)
+ .await
+ .unwrap();
+ let response = connector
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
}
diff --git a/crates/router/tests/connectors/stripe.rs b/crates/router/tests/connectors/stripe.rs
index 0537ac45c08..04fa9166ad3 100644
--- a/crates/router/tests/connectors/stripe.rs
+++ b/crates/router/tests/connectors/stripe.rs
@@ -1,5 +1,3 @@
-use std::time::Duration;
-
use masking::Secret;
use router::types::{self, api, storage::enums};
@@ -53,7 +51,7 @@ async fn should_only_authorize_payment() {
}
#[actix_web::test]
-async fn should_authorize_and_capture_payment() {
+async fn should_make_payment() {
let response = Stripe {}
.make_payment(get_payment_authorize_data(), None)
.await
@@ -87,13 +85,13 @@ async fn should_partially_capture_already_authorized_payment() {
}
#[actix_web::test]
-async fn should_sync_payment() {
+async fn should_sync_authorized_payment() {
let connector = Stripe {};
let authorize_response = connector
.authorize_payment(get_payment_authorize_data(), None)
.await
.unwrap();
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = connector
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
@@ -111,6 +109,31 @@ async fn should_sync_payment() {
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
+#[actix_web::test]
+async fn should_sync_payment() {
+ let connector = Stripe {};
+ let authorize_response = connector
+ .make_payment(get_payment_authorize_data(), None)
+ .await
+ .unwrap();
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ let response = connector
+ .psync_retry_till_status_matches(
+ enums::AttemptStatus::Charged,
+ Some(types::PaymentsSyncData {
+ connector_transaction_id: router::types::ResponseId::ConnectorTransactionId(
+ txn_id.unwrap(),
+ ),
+ encoded_data: None,
+ capture_method: None,
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(response.status, enums::AttemptStatus::Charged,);
+}
+
#[actix_web::test]
async fn should_void_already_authorized_payment() {
let connector = Stripe {};
@@ -118,7 +141,7 @@ async fn should_void_already_authorized_payment() {
.authorize_and_void_payment(
get_payment_authorize_data(),
Some(types::PaymentsCancelData {
- connector_transaction_id: "".to_string(),
+ connector_transaction_id: "".to_string(), // this connector_transaction_id will be ignored and the transaction_id from payment authorize data will be used for void
cancellation_reason: Some("requested_by_customer".to_string()),
}),
None,
@@ -228,15 +251,33 @@ async fn should_fail_payment_for_invalid_card_cvc() {
assert_eq!(x.message, "Your card's security code is invalid.",);
}
+// Voids a payment using automatic capture flow (Non 3DS).
#[actix_web::test]
-async fn should_fail_capture_for_invalid_payment() {
+async fn should_fail_void_payment_for_auto_capture() {
let connector = Stripe {};
+ // Authorize
let authorize_response = connector
- .authorize_payment(get_payment_authorize_data(), None)
+ .make_payment(get_payment_authorize_data(), None)
.await
.unwrap();
- assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- tokio::time::sleep(Duration::from_secs(5)).await; // to avoid 404 error as stripe takes some time to process the new transaction
+ assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
+ assert_ne!(txn_id, None, "Empty connector transaction id");
+
+ // Void
+ let void_response = connector
+ .void_payment(txn_id.unwrap(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ void_response.response.unwrap_err().message,
+ "You cannot cancel this PaymentIntent because it has a status of succeeded. Only a PaymentIntent with one of the following statuses may be canceled: requires_payment_method, requires_capture, requires_confirmation, requires_action, processing."
+ );
+}
+
+#[actix_web::test]
+async fn should_fail_capture_for_invalid_payment() {
+ let connector = Stripe {};
let response = connector
.capture_payment("12345".to_string(), None, None)
.await
@@ -259,6 +300,19 @@ async fn should_refund_succeeded_payment() {
);
}
+#[actix_web::test]
+async fn should_refund_manually_captured_payment() {
+ let connector = Stripe {};
+ let response = connector
+ .auth_capture_and_refund(get_payment_authorize_data(), None, None)
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
#[actix_web::test]
async fn should_partially_refund_succeeded_payment() {
let connector = Stripe {};
@@ -279,6 +333,26 @@ async fn should_partially_refund_succeeded_payment() {
);
}
+#[actix_web::test]
+async fn should_partially_refund_manually_captured_payment() {
+ let connector = Stripe {};
+ let response = connector
+ .auth_capture_and_refund(
+ get_payment_authorize_data(),
+ Some(types::RefundsData {
+ refund_amount: 50,
+ ..utils::PaymentRefundType::default().0
+ }),
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
+
#[actix_web::test]
async fn should_refund_succeeded_payment_multiple_times() {
let connector = Stripe {};
@@ -335,3 +409,25 @@ async fn should_sync_refund() {
enums::RefundStatus::Success,
);
}
+
+#[actix_web::test]
+async fn should_sync_manually_captured_refund() {
+ let connector = Stripe {};
+ let refund_response = connector
+ .auth_capture_and_refund(get_payment_authorize_data(), None, None)
+ .await
+ .unwrap();
+ let response = connector
+ .rsync_retry_till_status_matches(
+ enums::RefundStatus::Success,
+ refund_response.response.unwrap().connector_refund_id,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ response.response.unwrap().refund_status,
+ enums::RefundStatus::Success,
+ );
+}
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index b46db3f6e0f..32ab2637bf7 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -29,6 +29,7 @@ pub struct PaymentInfo {
pub address: Option<PaymentAddress>,
pub auth_type: Option<enums::AuthenticationType>,
pub access_token: Option<AccessToken>,
+ pub router_return_url: Option<String>,
}
#[async_trait]
@@ -41,7 +42,7 @@ pub trait ConnectorActions: Connector {
let integration = self.get_data().connector.get_connector_integration();
let request = self.generate_data(
types::PaymentsAuthorizeData {
- confirm: false,
+ confirm: true,
capture_method: Some(storage_models::enums::CaptureMethod::Manual),
..(payment_data.unwrap_or(PaymentAuthorizeType::default().0))
},
@@ -57,7 +58,11 @@ pub trait ConnectorActions: Connector {
) -> Result<types::PaymentsAuthorizeRouterData, Report<ConnectorError>> {
let integration = self.get_data().connector.get_connector_integration();
let request = self.generate_data(
- payment_data.unwrap_or_else(|| PaymentAuthorizeType::default().0),
+ types::PaymentsAuthorizeData {
+ confirm: true,
+ capture_method: Some(storage_models::enums::CaptureMethod::Automatic),
+ ..(payment_data.unwrap_or(PaymentAuthorizeType::default().0))
+ },
payment_info,
);
call_connector(request, integration).await
@@ -125,7 +130,7 @@ pub trait ConnectorActions: Connector {
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = get_connector_transaction_id(authorize_response);
+ let txn_id = get_connector_transaction_id(authorize_response.response);
let response = self
.capture_payment(txn_id.unwrap(), capture_data, payment_info)
.await
@@ -161,7 +166,7 @@ pub trait ConnectorActions: Connector {
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = get_connector_transaction_id(authorize_response);
+ let txn_id = get_connector_transaction_id(authorize_response.response);
tokio::time::sleep(Duration::from_secs(self.get_request_interval())).await; // to avoid 404 error
let response = self
.void_payment(txn_id.unwrap(), void_data, payment_info)
@@ -222,7 +227,28 @@ pub trait ConnectorActions: Connector {
.unwrap();
//try refund for previous payment
- let transaction_id = get_connector_transaction_id(response).unwrap();
+ let transaction_id = get_connector_transaction_id(response.response).unwrap();
+ tokio::time::sleep(Duration::from_secs(self.get_request_interval())).await; // to avoid 404 error
+ Ok(self
+ .refund_payment(transaction_id, refund_data, payment_info)
+ .await
+ .unwrap())
+ }
+
+ async fn auth_capture_and_refund(
+ &self,
+ authorize_data: Option<types::PaymentsAuthorizeData>,
+ refund_data: Option<types::RefundsData>,
+ payment_info: Option<PaymentInfo>,
+ ) -> Result<types::RefundExecuteRouterData, Report<ConnectorError>> {
+ //make a successful payment
+ let response = self
+ .authorize_and_capture_payment(authorize_data, None, payment_info.clone())
+ .await
+ .unwrap();
+
+ //try refund for previous payment
+ let transaction_id = get_connector_transaction_id(response.response).unwrap();
tokio::time::sleep(Duration::from_secs(self.get_request_interval())).await; // to avoid 404 error
Ok(self
.refund_payment(transaction_id, refund_data, payment_info)
@@ -243,7 +269,7 @@ pub trait ConnectorActions: Connector {
.unwrap();
//try refund for previous payment
- let transaction_id = get_connector_transaction_id(response).unwrap();
+ let transaction_id = get_connector_transaction_id(response.response).unwrap();
for _x in 0..2 {
tokio::time::sleep(Duration::from_secs(self.get_request_interval())).await; // to avoid 404 error
let refund_response = self
@@ -324,7 +350,7 @@ pub trait ConnectorActions: Connector {
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: Some(uuid::Uuid::new_v4().to_string()),
status: enums::AttemptStatus::default(),
- router_return_url: None,
+ router_return_url: info.clone().and_then(|a| a.router_return_url),
auth_type: info
.clone()
.map_or(enums::AuthenticationType::NoThreeDs, |a| {
@@ -516,9 +542,9 @@ impl Default for PaymentRefundType {
}
pub fn get_connector_transaction_id(
- response: types::PaymentsAuthorizeRouterData,
+ response: Result<types::PaymentsResponseData, types::ErrorResponse>,
) -> Option<String> {
- match response.response {
+ match response {
Ok(types::PaymentsResponseData::TransactionResponse { resource_id, .. }) => {
resource_id.get_connector_transaction_id().ok()
}
diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs
index 8ae7ded8def..08bcbad43f9 100644
--- a/crates/router/tests/connectors/worldline.rs
+++ b/crates/router/tests/connectors/worldline.rs
@@ -49,8 +49,7 @@ impl WorldlineTest {
}),
..Default::default()
}),
- auth_type: None,
- access_token: None,
+ ..Default::default()
})
}
@@ -196,7 +195,8 @@ async fn should_sync_manual_auth_payment() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let sync_response = connector
.sync_payment(
Some(types::PaymentsSyncData {
@@ -228,7 +228,8 @@ async fn should_sync_auto_auth_payment() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Pending);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let sync_response = connector
.sync_payment(
Some(types::PaymentsSyncData {
@@ -260,7 +261,8 @@ async fn should_capture_authorized_payment() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let capture_response = WorldlineTest {}
.capture_payment(connector_payment_id, None, None)
.await
@@ -298,7 +300,8 @@ async fn should_cancel_unauthorized_payment() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let cancel_response = connector
.void_payment(connector_payment_id, None, None)
.await
@@ -321,7 +324,8 @@ async fn should_cancel_uncaptured_payment() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Pending);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let cancel_response = connector
.void_payment(connector_payment_id, None, None)
.await
@@ -356,7 +360,8 @@ async fn should_fail_refund_with_invalid_payment_status() {
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
- let connector_payment_id = utils::get_connector_transaction_id(response).unwrap_or_default();
+ let connector_payment_id =
+ utils::get_connector_transaction_id(response.response).unwrap_or_default();
let refund_response = connector
.refund_payment(connector_payment_id, None, None)
.await
diff --git a/crates/router/tests/connectors/worldpay.rs b/crates/router/tests/connectors/worldpay.rs
index a0c76a0ea88..17e27f1b4fe 100644
--- a/crates/router/tests/connectors/worldpay.rs
+++ b/crates/router/tests/connectors/worldpay.rs
@@ -51,7 +51,7 @@ async fn should_authorize_card_payment() {
let response = conn.authorize_payment(None, None).await.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
assert_eq!(
- utils::get_connector_transaction_id(response),
+ utils::get_connector_transaction_id(response.response),
Some("123456".to_string())
);
}
@@ -76,7 +76,7 @@ async fn should_authorize_gpay_payment() {
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
assert_eq!(
- utils::get_connector_transaction_id(response),
+ utils::get_connector_transaction_id(response.response),
Some("123456".to_string())
);
}
@@ -101,7 +101,7 @@ async fn should_authorize_applepay_payment() {
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
assert_eq!(
- utils::get_connector_transaction_id(response),
+ utils::get_connector_transaction_id(response.response),
Some("123456".to_string())
);
}
@@ -113,7 +113,7 @@ async fn should_capture_already_authorized_payment() {
let _mock = connector.start_server(get_mock_config()).await;
let authorize_response = connector.authorize_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response: OptionFuture<_> = txn_id
.map(|transaction_id| async move {
connector
@@ -154,7 +154,7 @@ async fn should_void_already_authorized_payment() {
let _mock = connector.start_server(get_mock_config()).await;
let authorize_response = connector.authorize_payment(None, None).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Authorized);
- let txn_id = utils::get_connector_transaction_id(authorize_response);
+ let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response: OptionFuture<_> = txn_id
.map(|transaction_id| async move {
connector
@@ -195,7 +195,7 @@ async fn should_refund_succeeded_payment() {
let response = connector.make_payment(None, None).await.unwrap();
//try refund for previous payment
- let transaction_id = utils::get_connector_transaction_id(response).unwrap();
+ let transaction_id = utils::get_connector_transaction_id(response.response).unwrap();
let response = connector
.refund_payment(transaction_id, None, None)
.await
diff --git a/scripts/add_connector.sh b/scripts/add_connector.sh
index 494cc4a87e8..b4c4a82230c 100644
--- a/scripts/add_connector.sh
+++ b/scripts/add_connector.sh
@@ -11,7 +11,7 @@ fi
cd $SCRIPT/..
# remove template files if already created for this connector
rm -rf $conn/$pg $conn/$pg.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/router/src/configs/defaults.toml crates/api_models/src/enums.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
# add enum for this connector in required places
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
@@ -25,10 +25,9 @@ sed -i'' -e "s/\[connectors.supported\]/[connectors.${pg}]\nbase_url = ""\n\n[co
sed -r -i'' -e "s/cards = \[(.*)\]/cards = [\1, \"${pg}\"]/" config/config.example.toml
sed -i'' -e "s/\[connectors.supported\]/[connectors.${pg}]\nbase_url = ""\n\n[connectors.supported]/" loadtest/config/Development.toml
sed -r -i'' -e "s/cards = \[(.*)\]/cards = [\1, \"${pg}\"]/" loadtest/config/Development.toml
-sed -i'' -e "s/\[connectors.supported\]/[connectors.${pg}]\nbase_url = ""\n\n[connectors.supported]/" crates/router/src/configs/defaults.toml
sed -i'' -e "s/Dummy,/Dummy,\n\t${pgc},/" crates/api_models/src/enums.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/router/src/configs/defaults.toml-e crates/api_models/src/enums.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
cd $conn/
# generate template files for the connector
cargo install cargo-generate
|
test
|
add and update tests for stripe, cybersource and shift4 connectors (#485)
|
bcf1dd3a2446aec2a4fc46850fa51cfb9691fa51
|
2022-12-14 15:47:05
|
kos-for-juspay
|
refactor: use frunk deriving mechanisms to reduce boilerplate (#137)
| false
|
diff --git a/Cargo.lock b/Cargo.lock
index 2d426b834c6..bb6e24c2b93 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -312,6 +312,8 @@ name = "api_models"
version = "0.1.0"
dependencies = [
"common_utils",
+ "frunk",
+ "frunk_core",
"masking",
"router_derive",
"serde",
@@ -1302,6 +1304,70 @@ dependencies = [
"url",
]
+[[package]]
+name = "frunk"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89c703bf50009f383a0873845357cc400a95fc535f836feddfe015d7df6e1e0"
+dependencies = [
+ "frunk_core",
+ "frunk_derives",
+ "frunk_proc_macros",
+]
+
+[[package]]
+name = "frunk_core"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a446d01a558301dca28ef43222864a9fa2bd9a2e71370f769d5d5d5ec9f3537"
+
+[[package]]
+name = "frunk_derives"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b83164912bb4c97cfe0772913c7af7387ee2e00cb6d4636fb65a35b3d0c8f173"
+dependencies = [
+ "frunk_proc_macro_helpers",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "frunk_proc_macro_helpers"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "015425591bbeb0f5b8a75593340f1789af428e9f887a4f1e36c0c471f067ef50"
+dependencies = [
+ "frunk_core",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "frunk_proc_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea01524f285deab48affffb342b97f186e657b119c3f1821ac531780e0fbfae0"
+dependencies = [
+ "frunk_core",
+ "frunk_proc_macros_impl",
+ "proc-macro-hack",
+]
+
+[[package]]
+name = "frunk_proc_macros_impl"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a802d974cc18ee7fe1a7868fc9ce31086294fd96ba62f8da64ecb44e92a2653"
+dependencies = [
+ "frunk_core",
+ "frunk_proc_macro_helpers",
+ "proc-macro-hack",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "futures"
version = "0.3.25"
@@ -2348,6 +2414,12 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "proc-macro-hack"
+version = "0.5.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
+
[[package]]
name = "proc-macro2"
version = "1.0.47"
@@ -2631,6 +2703,8 @@ dependencies = [
"dyn-clone",
"encoding_rs",
"error-stack",
+ "frunk",
+ "frunk_core",
"futures",
"hex",
"http",
@@ -3016,6 +3090,8 @@ dependencies = [
"common_utils",
"diesel",
"error-stack",
+ "frunk",
+ "frunk_core",
"hex",
"masking",
"router_derive",
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index adcb63e16b9..4ef5206b8ae 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -6,6 +6,8 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+frunk = "0.4.1"
+frunk_core = "0.4.1"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
strum = { version = "0.24.1", features = ["derive"] }
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index b7738d8b075..01b79e688e1 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -48,6 +48,7 @@ pub enum AttemptStatus {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -68,6 +69,7 @@ pub enum AuthenticationType {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -89,6 +91,7 @@ pub enum CaptureMethod {
strum::EnumString,
serde::Deserialize,
serde::Serialize,
+ frunk::LabelledGeneric,
)]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
@@ -122,6 +125,7 @@ pub enum ConnectorType {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
pub enum Currency {
AED,
@@ -240,6 +244,7 @@ pub enum Currency {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -258,6 +263,7 @@ pub enum EventType {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -284,6 +290,7 @@ pub enum IntentStatus {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -304,6 +311,7 @@ pub enum FutureUsage {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
@@ -331,6 +339,7 @@ pub enum PaymentMethodIssuerCode {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -355,6 +364,7 @@ pub enum PaymentMethodSubType {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -393,7 +403,17 @@ pub enum WalletIssuer {
ApplePay,
}
-#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, strum::Display, strum::EnumString)]
+#[derive(
+ Clone,
+ Copy,
+ Debug,
+ Default,
+ Eq,
+ PartialEq,
+ strum::Display,
+ strum::EnumString,
+ frunk::LabelledGeneric,
+)]
#[strum(serialize_all = "snake_case")]
pub enum RefundStatus {
Failure,
@@ -414,6 +434,7 @@ pub enum RefundStatus {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -435,6 +456,7 @@ pub enum RoutingAlgorithm {
serde::Serialize,
strum::Display,
strum::EnumString,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index ffa30426599..fb5f287333d 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -270,7 +270,16 @@ impl Default for PaymentIdType {
//}
//}
-#[derive(Default, Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(
+ Default,
+ Clone,
+ Debug,
+ Eq,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ frunk::LabelledGeneric,
+)]
#[serde(deny_unknown_fields)]
pub struct Address {
pub address: Option<AddressDetails>,
@@ -278,7 +287,16 @@ pub struct Address {
}
// used by customers also, could be moved outside
-#[derive(Clone, Default, Debug, Eq, serde::Deserialize, serde::Serialize, PartialEq)]
+#[derive(
+ Clone,
+ Default,
+ Debug,
+ Eq,
+ serde::Deserialize,
+ serde::Serialize,
+ PartialEq,
+ frunk::LabelledGeneric,
+)]
#[serde(deny_unknown_fields)]
pub struct AddressDetails {
pub city: Option<String>,
@@ -292,7 +310,16 @@ pub struct AddressDetails {
pub last_name: Option<Secret<String>>,
}
-#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(
+ Debug,
+ Clone,
+ Default,
+ Eq,
+ PartialEq,
+ serde::Deserialize,
+ serde::Serialize,
+ frunk::LabelledGeneric,
+)]
pub struct PhoneDetails {
pub number: Option<Secret<String>>,
pub country_code: Option<String>,
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index ce973cd2092..e25e9225490 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -37,6 +37,8 @@ diesel = { git = "https://github.com/juspay/diesel", features = ["postgres", "se
dyn-clone = "1.0.9"
encoding_rs = "0.8.31"
error-stack = "0.2.4"
+frunk = "0.4.1"
+frunk_core = "0.4.1"
futures = "0.3.25"
hex = "0.4.3"
http = "0.2.8"
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 9b6bad04baa..5fb459b0282 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -88,273 +88,73 @@ where
impl From<F<api_enums::RoutingAlgorithm>> for F<storage_enums::RoutingAlgorithm> {
fn from(algo: F<api_enums::RoutingAlgorithm>) -> Self {
- match algo.0 {
- api_enums::RoutingAlgorithm::RoundRobin => storage_enums::RoutingAlgorithm::RoundRobin,
- api_enums::RoutingAlgorithm::MaxConversion => {
- storage_enums::RoutingAlgorithm::MaxConversion
- }
- api_enums::RoutingAlgorithm::MinCost => storage_enums::RoutingAlgorithm::MinCost,
- api_enums::RoutingAlgorithm::Custom => storage_enums::RoutingAlgorithm::Custom,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(algo.0))
}
}
impl From<F<storage_enums::RoutingAlgorithm>> for F<api_enums::RoutingAlgorithm> {
fn from(algo: F<storage_enums::RoutingAlgorithm>) -> Self {
- match algo.0 {
- storage_enums::RoutingAlgorithm::RoundRobin => api_enums::RoutingAlgorithm::RoundRobin,
- storage_enums::RoutingAlgorithm::MaxConversion => {
- api_enums::RoutingAlgorithm::MaxConversion
- }
- storage_enums::RoutingAlgorithm::MinCost => api_enums::RoutingAlgorithm::MinCost,
- storage_enums::RoutingAlgorithm::Custom => api_enums::RoutingAlgorithm::Custom,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(algo.0))
}
}
impl From<F<api_enums::ConnectorType>> for F<storage_enums::ConnectorType> {
fn from(conn: F<api_enums::ConnectorType>) -> Self {
- match conn.0 {
- api_enums::ConnectorType::PaymentProcessor => {
- storage_enums::ConnectorType::PaymentProcessor
- }
- api_enums::ConnectorType::PaymentVas => storage_enums::ConnectorType::PaymentVas,
- api_enums::ConnectorType::FinOperations => storage_enums::ConnectorType::FinOperations,
- api_enums::ConnectorType::FizOperations => storage_enums::ConnectorType::FizOperations,
- api_enums::ConnectorType::Networks => storage_enums::ConnectorType::Networks,
- api_enums::ConnectorType::BankingEntities => {
- storage_enums::ConnectorType::BankingEntities
- }
- api_enums::ConnectorType::NonBankingFinance => {
- storage_enums::ConnectorType::NonBankingFinance
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(conn.0))
}
}
impl From<F<storage_enums::ConnectorType>> for F<api_enums::ConnectorType> {
fn from(conn: F<storage_enums::ConnectorType>) -> Self {
- match conn.0 {
- storage_enums::ConnectorType::PaymentProcessor => {
- api_enums::ConnectorType::PaymentProcessor
- }
- storage_enums::ConnectorType::PaymentVas => api_enums::ConnectorType::PaymentVas,
- storage_enums::ConnectorType::FinOperations => api_enums::ConnectorType::FinOperations,
- storage_enums::ConnectorType::FizOperations => api_enums::ConnectorType::FizOperations,
- storage_enums::ConnectorType::Networks => api_enums::ConnectorType::Networks,
- storage_enums::ConnectorType::BankingEntities => {
- api_enums::ConnectorType::BankingEntities
- }
- storage_enums::ConnectorType::NonBankingFinance => {
- api_enums::ConnectorType::NonBankingFinance
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(conn.0))
}
}
impl From<F<storage_enums::MandateStatus>> for F<api_enums::MandateStatus> {
fn from(status: F<storage_enums::MandateStatus>) -> Self {
- match status.0 {
- storage_enums::MandateStatus::Active => api_enums::MandateStatus::Active,
- storage_enums::MandateStatus::Inactive => api_enums::MandateStatus::Inactive,
- storage_enums::MandateStatus::Pending => api_enums::MandateStatus::Pending,
- storage_enums::MandateStatus::Revoked => api_enums::MandateStatus::Revoked,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(status.0))
}
}
impl From<F<api_enums::PaymentMethodType>> for F<storage_enums::PaymentMethodType> {
fn from(pm_type: F<api_enums::PaymentMethodType>) -> Self {
- match pm_type.0 {
- api_enums::PaymentMethodType::Card => storage_enums::PaymentMethodType::Card,
- api_enums::PaymentMethodType::PaymentContainer => {
- storage_enums::PaymentMethodType::PaymentContainer
- }
- api_enums::PaymentMethodType::BankTransfer => {
- storage_enums::PaymentMethodType::BankTransfer
- }
- api_enums::PaymentMethodType::BankDebit => storage_enums::PaymentMethodType::BankDebit,
- api_enums::PaymentMethodType::PayLater => storage_enums::PaymentMethodType::PayLater,
- api_enums::PaymentMethodType::Netbanking => {
- storage_enums::PaymentMethodType::Netbanking
- }
- api_enums::PaymentMethodType::Upi => storage_enums::PaymentMethodType::Upi,
- api_enums::PaymentMethodType::OpenBanking => {
- storage_enums::PaymentMethodType::OpenBanking
- }
- api_enums::PaymentMethodType::ConsumerFinance => {
- storage_enums::PaymentMethodType::ConsumerFinance
- }
- api_enums::PaymentMethodType::Wallet => storage_enums::PaymentMethodType::Wallet,
- api_enums::PaymentMethodType::Klarna => storage_enums::PaymentMethodType::Klarna,
- api_enums::PaymentMethodType::Paypal => storage_enums::PaymentMethodType::Paypal,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(pm_type.0))
}
}
impl From<F<storage_enums::PaymentMethodType>> for F<api_enums::PaymentMethodType> {
fn from(pm_type: F<storage_enums::PaymentMethodType>) -> Self {
- match pm_type.0 {
- storage_enums::PaymentMethodType::Card => api_enums::PaymentMethodType::Card,
- storage_enums::PaymentMethodType::PaymentContainer => {
- api_enums::PaymentMethodType::PaymentContainer
- }
- storage_enums::PaymentMethodType::BankTransfer => {
- api_enums::PaymentMethodType::BankTransfer
- }
- storage_enums::PaymentMethodType::BankDebit => api_enums::PaymentMethodType::BankDebit,
- storage_enums::PaymentMethodType::PayLater => api_enums::PaymentMethodType::PayLater,
- storage_enums::PaymentMethodType::Netbanking => {
- api_enums::PaymentMethodType::Netbanking
- }
- storage_enums::PaymentMethodType::Upi => api_enums::PaymentMethodType::Upi,
- storage_enums::PaymentMethodType::OpenBanking => {
- api_enums::PaymentMethodType::OpenBanking
- }
- storage_enums::PaymentMethodType::ConsumerFinance => {
- api_enums::PaymentMethodType::ConsumerFinance
- }
- storage_enums::PaymentMethodType::Wallet => api_enums::PaymentMethodType::Wallet,
- storage_enums::PaymentMethodType::Klarna => api_enums::PaymentMethodType::Klarna,
- storage_enums::PaymentMethodType::Paypal => api_enums::PaymentMethodType::Paypal,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(pm_type.0))
}
}
impl From<F<api_enums::PaymentMethodSubType>> for F<storage_enums::PaymentMethodSubType> {
fn from(pm_subtype: F<api_enums::PaymentMethodSubType>) -> Self {
- match pm_subtype.0 {
- api_enums::PaymentMethodSubType::Credit => storage_enums::PaymentMethodSubType::Credit,
- api_enums::PaymentMethodSubType::Debit => storage_enums::PaymentMethodSubType::Debit,
- api_enums::PaymentMethodSubType::UpiIntent => {
- storage_enums::PaymentMethodSubType::UpiIntent
- }
- api_enums::PaymentMethodSubType::UpiCollect => {
- storage_enums::PaymentMethodSubType::UpiCollect
- }
- api_enums::PaymentMethodSubType::CreditCardInstallments => {
- storage_enums::PaymentMethodSubType::CreditCardInstallments
- }
- api_enums::PaymentMethodSubType::PayLaterInstallments => {
- storage_enums::PaymentMethodSubType::PayLaterInstallments
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(pm_subtype.0))
}
}
impl From<F<storage_enums::PaymentMethodSubType>> for F<api_enums::PaymentMethodSubType> {
fn from(pm_subtype: F<storage_enums::PaymentMethodSubType>) -> Self {
- match pm_subtype.0 {
- storage_enums::PaymentMethodSubType::Credit => api_enums::PaymentMethodSubType::Credit,
- storage_enums::PaymentMethodSubType::Debit => api_enums::PaymentMethodSubType::Debit,
- storage_enums::PaymentMethodSubType::UpiIntent => {
- api_enums::PaymentMethodSubType::UpiIntent
- }
- storage_enums::PaymentMethodSubType::UpiCollect => {
- api_enums::PaymentMethodSubType::UpiCollect
- }
- storage_enums::PaymentMethodSubType::CreditCardInstallments => {
- api_enums::PaymentMethodSubType::CreditCardInstallments
- }
- storage_enums::PaymentMethodSubType::PayLaterInstallments => {
- api_enums::PaymentMethodSubType::PayLaterInstallments
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(pm_subtype.0))
}
}
impl From<F<storage_enums::PaymentMethodIssuerCode>> for F<api_enums::PaymentMethodIssuerCode> {
fn from(issuer_code: F<storage_enums::PaymentMethodIssuerCode>) -> Self {
- match issuer_code.0 {
- storage_enums::PaymentMethodIssuerCode::JpHdfc => {
- api_enums::PaymentMethodIssuerCode::JpHdfc
- }
- storage_enums::PaymentMethodIssuerCode::JpIcici => {
- api_enums::PaymentMethodIssuerCode::JpIcici
- }
- storage_enums::PaymentMethodIssuerCode::JpGooglepay => {
- api_enums::PaymentMethodIssuerCode::JpGooglepay
- }
- storage_enums::PaymentMethodIssuerCode::JpApplepay => {
- api_enums::PaymentMethodIssuerCode::JpApplepay
- }
- storage_enums::PaymentMethodIssuerCode::JpPhonepay => {
- api_enums::PaymentMethodIssuerCode::JpPhonepay
- }
- storage_enums::PaymentMethodIssuerCode::JpWechat => {
- api_enums::PaymentMethodIssuerCode::JpWechat
- }
- storage_enums::PaymentMethodIssuerCode::JpSofort => {
- api_enums::PaymentMethodIssuerCode::JpSofort
- }
- storage_enums::PaymentMethodIssuerCode::JpGiropay => {
- api_enums::PaymentMethodIssuerCode::JpGiropay
- }
- storage_enums::PaymentMethodIssuerCode::JpSepa => {
- api_enums::PaymentMethodIssuerCode::JpSepa
- }
- storage_enums::PaymentMethodIssuerCode::JpBacs => {
- api_enums::PaymentMethodIssuerCode::JpBacs
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(issuer_code.0))
}
}
impl From<F<storage_enums::IntentStatus>> for F<api_enums::IntentStatus> {
fn from(status: F<storage_enums::IntentStatus>) -> Self {
- match status.0 {
- storage_enums::IntentStatus::Succeeded => api_enums::IntentStatus::Succeeded,
- storage_enums::IntentStatus::Failed => api_enums::IntentStatus::Failed,
- storage_enums::IntentStatus::Cancelled => api_enums::IntentStatus::Cancelled,
- storage_enums::IntentStatus::Processing => api_enums::IntentStatus::Processing,
- storage_enums::IntentStatus::RequiresCustomerAction => {
- api_enums::IntentStatus::RequiresCustomerAction
- }
- storage_enums::IntentStatus::RequiresPaymentMethod => {
- api_enums::IntentStatus::RequiresPaymentMethod
- }
- storage_enums::IntentStatus::RequiresConfirmation => {
- api_enums::IntentStatus::RequiresConfirmation
- }
- storage_enums::IntentStatus::RequiresCapture => {
- api_enums::IntentStatus::RequiresCapture
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(status.0))
}
}
impl From<F<api_enums::IntentStatus>> for F<storage_enums::IntentStatus> {
fn from(status: F<api_enums::IntentStatus>) -> Self {
- match status.0 {
- api_enums::IntentStatus::Succeeded => storage_enums::IntentStatus::Succeeded,
- api_enums::IntentStatus::Failed => storage_enums::IntentStatus::Failed,
- api_enums::IntentStatus::Cancelled => storage_enums::IntentStatus::Cancelled,
- api_enums::IntentStatus::Processing => storage_enums::IntentStatus::Processing,
- api_enums::IntentStatus::RequiresCustomerAction => {
- storage_enums::IntentStatus::RequiresCustomerAction
- }
- api_enums::IntentStatus::RequiresPaymentMethod => {
- storage_enums::IntentStatus::RequiresPaymentMethod
- }
- api_enums::IntentStatus::RequiresConfirmation => {
- storage_enums::IntentStatus::RequiresConfirmation
- }
- api_enums::IntentStatus::RequiresCapture => {
- storage_enums::IntentStatus::RequiresCapture
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(status.0))
}
}
@@ -416,208 +216,55 @@ impl TryFrom<F<api_enums::IntentStatus>> for F<storage_enums::EventType> {
impl From<F<storage_enums::EventType>> for F<api_enums::EventType> {
fn from(event_type: F<storage_enums::EventType>) -> Self {
- match event_type.0 {
- storage_enums::EventType::PaymentSucceeded => api_enums::EventType::PaymentSucceeded,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(event_type.0))
}
}
impl From<F<api_enums::FutureUsage>> for F<storage_enums::FutureUsage> {
fn from(future_usage: F<api_enums::FutureUsage>) -> Self {
- match future_usage.0 {
- api_enums::FutureUsage::OnSession => storage_enums::FutureUsage::OnSession,
- api_enums::FutureUsage::OffSession => storage_enums::FutureUsage::OffSession,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(future_usage.0))
}
}
impl From<F<storage_enums::FutureUsage>> for F<api_enums::FutureUsage> {
fn from(future_usage: F<storage_enums::FutureUsage>) -> Self {
- match future_usage.0 {
- storage_enums::FutureUsage::OnSession => api_enums::FutureUsage::OnSession,
- storage_enums::FutureUsage::OffSession => api_enums::FutureUsage::OffSession,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(future_usage.0))
}
}
impl From<F<storage_enums::RefundStatus>> for F<api_enums::RefundStatus> {
fn from(status: F<storage_enums::RefundStatus>) -> Self {
- match status.0 {
- storage_enums::RefundStatus::Failure => api_enums::RefundStatus::Failure,
- storage_enums::RefundStatus::ManualReview => api_enums::RefundStatus::ManualReview,
- storage_enums::RefundStatus::Pending => api_enums::RefundStatus::Pending,
- storage_enums::RefundStatus::Success => api_enums::RefundStatus::Success,
- storage_enums::RefundStatus::TransactionFailure => {
- api_enums::RefundStatus::TransactionFailure
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(status.0))
}
}
impl From<F<api_enums::CaptureMethod>> for F<storage_enums::CaptureMethod> {
fn from(capture_method: F<api_enums::CaptureMethod>) -> Self {
- match capture_method.0 {
- api_enums::CaptureMethod::Automatic => storage_enums::CaptureMethod::Automatic,
- api_enums::CaptureMethod::Manual => storage_enums::CaptureMethod::Manual,
- api_enums::CaptureMethod::ManualMultiple => {
- storage_enums::CaptureMethod::ManualMultiple
- }
- api_enums::CaptureMethod::Scheduled => storage_enums::CaptureMethod::Scheduled,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(capture_method.0))
}
}
impl From<F<storage_enums::CaptureMethod>> for F<api_enums::CaptureMethod> {
fn from(capture_method: F<storage_enums::CaptureMethod>) -> Self {
- match capture_method.0 {
- storage_enums::CaptureMethod::Automatic => api_enums::CaptureMethod::Automatic,
- storage_enums::CaptureMethod::Manual => api_enums::CaptureMethod::Manual,
- storage_enums::CaptureMethod::ManualMultiple => {
- api_enums::CaptureMethod::ManualMultiple
- }
- storage_enums::CaptureMethod::Scheduled => api_enums::CaptureMethod::Scheduled,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(capture_method.0))
}
}
impl From<F<api_enums::AuthenticationType>> for F<storage_enums::AuthenticationType> {
fn from(auth_type: F<api_enums::AuthenticationType>) -> Self {
- match auth_type.0 {
- api_enums::AuthenticationType::ThreeDs => storage_enums::AuthenticationType::ThreeDs,
- api_enums::AuthenticationType::NoThreeDs => {
- storage_enums::AuthenticationType::NoThreeDs
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(auth_type.0))
}
}
impl From<F<storage_enums::AuthenticationType>> for F<api_enums::AuthenticationType> {
fn from(auth_type: F<storage_enums::AuthenticationType>) -> Self {
- match auth_type.0 {
- storage_enums::AuthenticationType::ThreeDs => api_enums::AuthenticationType::ThreeDs,
- storage_enums::AuthenticationType::NoThreeDs => {
- api_enums::AuthenticationType::NoThreeDs
- }
- }
- .into()
+ Foreign(frunk::labelled_convert_from(auth_type.0))
}
}
impl From<F<api_enums::Currency>> for F<storage_enums::Currency> {
fn from(currency: F<api_enums::Currency>) -> Self {
- match currency.0 {
- api_enums::Currency::AED => storage_enums::Currency::AED,
- api_enums::Currency::ALL => storage_enums::Currency::ALL,
- api_enums::Currency::AMD => storage_enums::Currency::AMD,
- api_enums::Currency::ARS => storage_enums::Currency::ARS,
- api_enums::Currency::AUD => storage_enums::Currency::AUD,
- api_enums::Currency::AWG => storage_enums::Currency::AWG,
- api_enums::Currency::AZN => storage_enums::Currency::AZN,
- api_enums::Currency::BBD => storage_enums::Currency::BBD,
- api_enums::Currency::BDT => storage_enums::Currency::BDT,
- api_enums::Currency::BHD => storage_enums::Currency::BHD,
- api_enums::Currency::BMD => storage_enums::Currency::BMD,
- api_enums::Currency::BND => storage_enums::Currency::BND,
- api_enums::Currency::BOB => storage_enums::Currency::BOB,
- api_enums::Currency::BRL => storage_enums::Currency::BRL,
- api_enums::Currency::BSD => storage_enums::Currency::BSD,
- api_enums::Currency::BWP => storage_enums::Currency::BWP,
- api_enums::Currency::BZD => storage_enums::Currency::BZD,
- api_enums::Currency::CAD => storage_enums::Currency::CAD,
- api_enums::Currency::CHF => storage_enums::Currency::CHF,
- api_enums::Currency::CNY => storage_enums::Currency::CNY,
- api_enums::Currency::COP => storage_enums::Currency::COP,
- api_enums::Currency::CRC => storage_enums::Currency::CRC,
- api_enums::Currency::CUP => storage_enums::Currency::CUP,
- api_enums::Currency::CZK => storage_enums::Currency::CZK,
- api_enums::Currency::DKK => storage_enums::Currency::DKK,
- api_enums::Currency::DOP => storage_enums::Currency::DOP,
- api_enums::Currency::DZD => storage_enums::Currency::DZD,
- api_enums::Currency::EGP => storage_enums::Currency::EGP,
- api_enums::Currency::ETB => storage_enums::Currency::ETB,
- api_enums::Currency::EUR => storage_enums::Currency::EUR,
- api_enums::Currency::FJD => storage_enums::Currency::FJD,
- api_enums::Currency::GBP => storage_enums::Currency::GBP,
- api_enums::Currency::GHS => storage_enums::Currency::GHS,
- api_enums::Currency::GIP => storage_enums::Currency::GIP,
- api_enums::Currency::GMD => storage_enums::Currency::GMD,
- api_enums::Currency::GTQ => storage_enums::Currency::GTQ,
- api_enums::Currency::GYD => storage_enums::Currency::GYD,
- api_enums::Currency::HKD => storage_enums::Currency::HKD,
- api_enums::Currency::HNL => storage_enums::Currency::HNL,
- api_enums::Currency::HRK => storage_enums::Currency::HRK,
- api_enums::Currency::HTG => storage_enums::Currency::HTG,
- api_enums::Currency::HUF => storage_enums::Currency::HUF,
- api_enums::Currency::IDR => storage_enums::Currency::IDR,
- api_enums::Currency::ILS => storage_enums::Currency::ILS,
- api_enums::Currency::INR => storage_enums::Currency::INR,
- api_enums::Currency::JMD => storage_enums::Currency::JMD,
- api_enums::Currency::JOD => storage_enums::Currency::JOD,
- api_enums::Currency::JPY => storage_enums::Currency::JPY,
- api_enums::Currency::KES => storage_enums::Currency::KES,
- api_enums::Currency::KGS => storage_enums::Currency::KGS,
- api_enums::Currency::KHR => storage_enums::Currency::KHR,
- api_enums::Currency::KRW => storage_enums::Currency::KRW,
- api_enums::Currency::KWD => storage_enums::Currency::KWD,
- api_enums::Currency::KYD => storage_enums::Currency::KYD,
- api_enums::Currency::KZT => storage_enums::Currency::KZT,
- api_enums::Currency::LAK => storage_enums::Currency::LAK,
- api_enums::Currency::LBP => storage_enums::Currency::LBP,
- api_enums::Currency::LKR => storage_enums::Currency::LKR,
- api_enums::Currency::LRD => storage_enums::Currency::LRD,
- api_enums::Currency::LSL => storage_enums::Currency::LSL,
- api_enums::Currency::MAD => storage_enums::Currency::MAD,
- api_enums::Currency::MDL => storage_enums::Currency::MDL,
- api_enums::Currency::MKD => storage_enums::Currency::MKD,
- api_enums::Currency::MMK => storage_enums::Currency::MMK,
- api_enums::Currency::MNT => storage_enums::Currency::MNT,
- api_enums::Currency::MOP => storage_enums::Currency::MOP,
- api_enums::Currency::MUR => storage_enums::Currency::MUR,
- api_enums::Currency::MVR => storage_enums::Currency::MVR,
- api_enums::Currency::MWK => storage_enums::Currency::MWK,
- api_enums::Currency::MXN => storage_enums::Currency::MXN,
- api_enums::Currency::MYR => storage_enums::Currency::MYR,
- api_enums::Currency::NAD => storage_enums::Currency::NAD,
- api_enums::Currency::NGN => storage_enums::Currency::NGN,
- api_enums::Currency::NIO => storage_enums::Currency::NIO,
- api_enums::Currency::NOK => storage_enums::Currency::NOK,
- api_enums::Currency::NPR => storage_enums::Currency::NPR,
- api_enums::Currency::NZD => storage_enums::Currency::NZD,
- api_enums::Currency::OMR => storage_enums::Currency::OMR,
- api_enums::Currency::PEN => storage_enums::Currency::PEN,
- api_enums::Currency::PGK => storage_enums::Currency::PGK,
- api_enums::Currency::PHP => storage_enums::Currency::PHP,
- api_enums::Currency::PKR => storage_enums::Currency::PKR,
- api_enums::Currency::PLN => storage_enums::Currency::PLN,
- api_enums::Currency::QAR => storage_enums::Currency::QAR,
- api_enums::Currency::RUB => storage_enums::Currency::RUB,
- api_enums::Currency::SAR => storage_enums::Currency::SAR,
- api_enums::Currency::SCR => storage_enums::Currency::SCR,
- api_enums::Currency::SEK => storage_enums::Currency::SEK,
- api_enums::Currency::SGD => storage_enums::Currency::SGD,
- api_enums::Currency::SLL => storage_enums::Currency::SLL,
- api_enums::Currency::SOS => storage_enums::Currency::SOS,
- api_enums::Currency::SSP => storage_enums::Currency::SSP,
- api_enums::Currency::SVC => storage_enums::Currency::SVC,
- api_enums::Currency::SZL => storage_enums::Currency::SZL,
- api_enums::Currency::THB => storage_enums::Currency::THB,
- api_enums::Currency::TTD => storage_enums::Currency::TTD,
- api_enums::Currency::TWD => storage_enums::Currency::TWD,
- api_enums::Currency::TZS => storage_enums::Currency::TZS,
- api_enums::Currency::USD => storage_enums::Currency::USD,
- api_enums::Currency::UYU => storage_enums::Currency::UYU,
- api_enums::Currency::UZS => storage_enums::Currency::UZS,
- api_enums::Currency::YER => storage_enums::Currency::YER,
- api_enums::Currency::ZAR => storage_enums::Currency::ZAR,
- }
- .into()
+ Foreign(frunk::labelled_convert_from(currency.0))
}
}
diff --git a/crates/storage_models/Cargo.toml b/crates/storage_models/Cargo.toml
index 620b084f689..2d0d2309ead 100644
--- a/crates/storage_models/Cargo.toml
+++ b/crates/storage_models/Cargo.toml
@@ -10,6 +10,8 @@ async-bb8-diesel = { git = "https://github.com/juspay/async-bb8-diesel", rev = "
async-trait = "0.1.57"
diesel = { git = "https://github.com/juspay/diesel", features = ["postgres", "serde_json", "time"], rev = "22f3f59f1db8a3f61623e4d6b375d64cd7bd3d02" }
error-stack = "0.2.1"
+frunk = "0.4.1"
+frunk_core = "0.4.1"
hex = "0.4.3"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
diff --git a/crates/storage_models/src/address.rs b/crates/storage_models/src/address.rs
index af0a5f186b3..d45e74fa3d4 100644
--- a/crates/storage_models/src/address.rs
+++ b/crates/storage_models/src/address.rs
@@ -26,7 +26,7 @@ pub struct AddressNew {
pub merchant_id: String,
}
-#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable)]
+#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, frunk::LabelledGeneric)]
#[diesel(table_name = address)]
pub struct Address {
#[serde(skip_serializing)]
@@ -54,7 +54,7 @@ pub struct Address {
pub merchant_id: String,
}
-#[derive(Debug)]
+#[derive(Debug, frunk::LabelledGeneric)]
pub enum AddressUpdate {
Update {
city: Option<String>,
diff --git a/crates/storage_models/src/enums.rs b/crates/storage_models/src/enums.rs
index a44577fe06d..b49055f2683 100644
--- a/crates/storage_models/src/enums.rs
+++ b/crates/storage_models/src/enums.rs
@@ -67,6 +67,7 @@ pub enum AttemptStatus {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -89,6 +90,7 @@ pub enum AuthenticationType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -112,6 +114,7 @@ pub enum CaptureMethod {
serde::Deserialize,
serde::Serialize,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[strum(serialize_all = "snake_case")]
@@ -147,6 +150,7 @@ pub enum ConnectorType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
pub enum Currency {
@@ -305,6 +309,7 @@ pub enum EventObjectType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -325,6 +330,7 @@ pub enum EventType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -353,6 +359,7 @@ pub enum IntentStatus {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -421,6 +428,7 @@ pub enum PaymentFlow {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[strum(serialize_all = "snake_case")]
@@ -450,6 +458,7 @@ pub enum PaymentMethodIssuerCode {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -476,6 +485,7 @@ pub enum PaymentMethodSubType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
@@ -555,6 +565,7 @@ pub enum ProcessTrackerStatus {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[strum(serialize_all = "snake_case")]
@@ -598,6 +609,7 @@ pub enum RefundType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
@@ -644,6 +656,7 @@ pub enum MandateType {
strum::Display,
strum::EnumString,
router_derive::DieselEnum,
+ frunk::LabelledGeneric,
)]
#[router_derive::diesel_enum]
#[serde(rename_all = "snake_case")]
|
refactor
|
use frunk deriving mechanisms to reduce boilerplate (#137)
|
9ebe97ed74589129fbf41cb564fb3a6a1e2e9e25
|
2023-01-11 13:31:14
|
Jagan
|
docs(github): add `--all` flag to rustfmt command in PR template (#344)
| false
|
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index d8bf264da26..8a5ea67f0a2 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -47,7 +47,7 @@ Or did you test this change manually (provide relevant screenshots)?
## Checklist
<!-- Put an `x` in the boxes that apply -->
-- [ ] I formatted the code `cargo +nightly fmt`
+- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
|
docs
|
add `--all` flag to rustfmt command in PR template (#344)
|
8efd468ac150ff8d28f5b44b25701ba1837f243d
|
2024-04-03 18:17:43
|
Swangi Kumari
|
refactor(payment_methods): add Wallets payment method data to new domain type to be used in connector module (#4160)
| false
|
diff --git a/crates/router/src/connector/aci/transformers.rs b/crates/router/src/connector/aci/transformers.rs
index a478201f96b..846f619d1d0 100644
--- a/crates/router/src/connector/aci/transformers.rs
+++ b/crates/router/src/connector/aci/transformers.rs
@@ -107,46 +107,42 @@ pub enum PaymentDetails {
Mandate,
}
-impl TryFrom<&api_models::payments::WalletData> for PaymentDetails {
+impl TryFrom<&domain::WalletData> for PaymentDetails {
type Error = Error;
- fn try_from(wallet_data: &api_models::payments::WalletData) -> Result<Self, Self::Error> {
+ fn try_from(wallet_data: &domain::WalletData) -> Result<Self, Self::Error> {
let payment_data = match wallet_data {
- api_models::payments::WalletData::MbWayRedirect(data) => {
- Self::Wallet(Box::new(WalletPMData {
- payment_brand: PaymentBrand::Mbway,
- account_id: Some(data.telephone_number.clone()),
- }))
- }
- api_models::payments::WalletData::AliPayRedirect { .. } => {
- Self::Wallet(Box::new(WalletPMData {
- payment_brand: PaymentBrand::AliPay,
- account_id: None,
- }))
- }
- api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect { .. }
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect { .. }
- | api_models::payments::WalletData::VippsRedirect { .. }
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_)
- | api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::GooglePayRedirect(_) => Err(
+ domain::WalletData::MbWayRedirect(data) => Self::Wallet(Box::new(WalletPMData {
+ payment_brand: PaymentBrand::Mbway,
+ account_id: Some(data.telephone_number.clone()),
+ })),
+ domain::WalletData::AliPayRedirect { .. } => Self::Wallet(Box::new(WalletPMData {
+ payment_brand: PaymentBrand::AliPay,
+ account_id: None,
+ })),
+ domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect { .. }
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect { .. }
+ | domain::WalletData::VippsRedirect { .. }
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::GooglePayRedirect(_) => Err(
errors::ConnectorError::NotImplemented("Payment method".to_string()),
)?,
};
@@ -479,14 +475,14 @@ impl TryFrom<&AciRouterData<&types::PaymentsAuthorizeRouterData>> for AciPayment
impl
TryFrom<(
&AciRouterData<&types::PaymentsAuthorizeRouterData>,
- &api_models::payments::WalletData,
+ &domain::WalletData,
)> for AciPaymentsRequest
{
type Error = Error;
fn try_from(
value: (
&AciRouterData<&types::PaymentsAuthorizeRouterData>,
- &api_models::payments::WalletData,
+ &domain::WalletData,
),
) -> Result<Self, Self::Error> {
let (item, wallet_data) = value;
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index 5a1abb147ed..a8bd1ccff30 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -2033,18 +2033,18 @@ impl TryFrom<&utils::CardIssuer> for CardBrand {
}
}
-impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
+impl<'a> TryFrom<&domain::WalletData> for AdyenPaymentMethod<'a> {
type Error = Error;
- fn try_from(wallet_data: &api::WalletData) -> Result<Self, Self::Error> {
+ fn try_from(wallet_data: &domain::WalletData) -> Result<Self, Self::Error> {
match wallet_data {
- api_models::payments::WalletData::GooglePay(data) => {
+ domain::WalletData::GooglePay(data) => {
let gpay_data = AdyenGPay {
payment_type: PaymentType::Googlepay,
google_pay_token: Secret::new(data.tokenization_data.token.to_owned()),
};
Ok(AdyenPaymentMethod::Gpay(Box::new(gpay_data)))
}
- api_models::payments::WalletData::ApplePay(data) => {
+ domain::WalletData::ApplePay(data) => {
let apple_pay_data = AdyenApplePay {
payment_type: PaymentType::Applepay,
apple_pay_token: Secret::new(data.payment_data.to_string()),
@@ -2052,79 +2052,77 @@ impl<'a> TryFrom<&api::WalletData> for AdyenPaymentMethod<'a> {
Ok(AdyenPaymentMethod::ApplePay(Box::new(apple_pay_data)))
}
- api_models::payments::WalletData::PaypalRedirect(_) => {
+ domain::WalletData::PaypalRedirect(_) => {
let wallet = PmdForPaymentType {
payment_type: PaymentType::Paypal,
};
Ok(AdyenPaymentMethod::AdyenPaypal(Box::new(wallet)))
}
- api_models::payments::WalletData::AliPayRedirect(_) => {
+ domain::WalletData::AliPayRedirect(_) => {
let alipay_data = PmdForPaymentType {
payment_type: PaymentType::Alipay,
};
Ok(AdyenPaymentMethod::AliPay(Box::new(alipay_data)))
}
- api_models::payments::WalletData::AliPayHkRedirect(_) => {
+ domain::WalletData::AliPayHkRedirect(_) => {
let alipay_hk_data = PmdForPaymentType {
payment_type: PaymentType::AlipayHk,
};
Ok(AdyenPaymentMethod::AliPayHk(Box::new(alipay_hk_data)))
}
- api_models::payments::WalletData::GoPayRedirect(_) => {
+ domain::WalletData::GoPayRedirect(_) => {
let go_pay_data = GoPayData {};
Ok(AdyenPaymentMethod::GoPay(Box::new(go_pay_data)))
}
- api_models::payments::WalletData::KakaoPayRedirect(_) => {
+ domain::WalletData::KakaoPayRedirect(_) => {
let kakao_pay_data = KakaoPayData {};
Ok(AdyenPaymentMethod::Kakaopay(Box::new(kakao_pay_data)))
}
- api_models::payments::WalletData::GcashRedirect(_) => {
+ domain::WalletData::GcashRedirect(_) => {
let gcash_data = GcashData {};
Ok(AdyenPaymentMethod::Gcash(Box::new(gcash_data)))
}
- api_models::payments::WalletData::MomoRedirect(_) => {
+ domain::WalletData::MomoRedirect(_) => {
let momo_data = MomoData {};
Ok(AdyenPaymentMethod::Momo(Box::new(momo_data)))
}
- api_models::payments::WalletData::TouchNGoRedirect(_) => {
+ domain::WalletData::TouchNGoRedirect(_) => {
let touch_n_go_data = TouchNGoData {};
Ok(AdyenPaymentMethod::TouchNGo(Box::new(touch_n_go_data)))
}
- api_models::payments::WalletData::MbWayRedirect(data) => {
+ domain::WalletData::MbWayRedirect(data) => {
let mbway_data = MbwayData {
payment_type: PaymentType::Mbway,
telephone_number: data.telephone_number.clone(),
};
Ok(AdyenPaymentMethod::Mbway(Box::new(mbway_data)))
}
- api_models::payments::WalletData::MobilePayRedirect(_) => {
+ domain::WalletData::MobilePayRedirect(_) => {
let data = PmdForPaymentType {
payment_type: PaymentType::MobilePay,
};
Ok(AdyenPaymentMethod::MobilePay(Box::new(data)))
}
- api_models::payments::WalletData::WeChatPayRedirect(_) => {
- Ok(AdyenPaymentMethod::WeChatPayWeb)
- }
- api_models::payments::WalletData::SamsungPay(samsung_data) => {
+ domain::WalletData::WeChatPayRedirect(_) => Ok(AdyenPaymentMethod::WeChatPayWeb),
+ domain::WalletData::SamsungPay(samsung_data) => {
let data = SamsungPayPmData {
payment_type: PaymentType::Samsungpay,
samsung_pay_token: samsung_data.token.to_owned(),
};
Ok(AdyenPaymentMethod::SamsungPay(Box::new(data)))
}
- api_models::payments::WalletData::TwintRedirect { .. } => Ok(AdyenPaymentMethod::Twint),
- api_models::payments::WalletData::VippsRedirect { .. } => Ok(AdyenPaymentMethod::Vipps),
- api_models::payments::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana),
- api_models::payments::WalletData::SwishQr(_) => Ok(AdyenPaymentMethod::Swish),
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::TwintRedirect { .. } => Ok(AdyenPaymentMethod::Twint),
+ domain::WalletData::VippsRedirect { .. } => Ok(AdyenPaymentMethod::Vipps),
+ domain::WalletData::DanaRedirect { .. } => Ok(AdyenPaymentMethod::Dana),
+ domain::WalletData::SwishQr(_) => Ok(AdyenPaymentMethod::Swish),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into()),
@@ -3000,14 +2998,14 @@ fn get_shopper_email(
impl<'a>
TryFrom<(
&AdyenRouterData<&types::PaymentsAuthorizeRouterData>,
- &api::WalletData,
+ &domain::WalletData,
)> for AdyenPaymentRequest<'a>
{
type Error = Error;
fn try_from(
value: (
&AdyenRouterData<&types::PaymentsAuthorizeRouterData>,
- &api::WalletData,
+ &domain::WalletData,
),
) -> Result<Self, Self::Error> {
let (item, wallet_data) = value;
diff --git a/crates/router/src/connector/airwallex/transformers.rs b/crates/router/src/connector/airwallex/transformers.rs
index 6d17707355b..e80909d7e01 100644
--- a/crates/router/src/connector/airwallex/transformers.rs
+++ b/crates/router/src/connector/airwallex/transformers.rs
@@ -214,10 +214,10 @@ impl TryFrom<&AirwallexRouterData<&types::PaymentsAuthorizeRouterData>>
}
fn get_wallet_details(
- wallet_data: &api_models::payments::WalletData,
+ wallet_data: &domain::WalletData,
) -> Result<AirwallexPaymentMethod, errors::ConnectorError> {
let wallet_details: AirwallexPaymentMethod = match wallet_data {
- api_models::payments::WalletData::GooglePay(gpay_details) => {
+ domain::WalletData::GooglePay(gpay_details) => {
AirwallexPaymentMethod::Wallets(WalletData::GooglePay(GooglePayData {
googlepay: GooglePayDetails {
encrypted_payment_token: Secret::new(
@@ -228,35 +228,33 @@ fn get_wallet_details(
payment_method_type: AirwallexPaymentType::Googlepay,
}))
}
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("airwallex"),
- ))?
- }
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("airwallex"),
+ ))?,
};
Ok(wallet_details)
}
diff --git a/crates/router/src/connector/authorizedotnet/transformers.rs b/crates/router/src/connector/authorizedotnet/transformers.rs
index 3156f01ebcf..a072fcf3214 100644
--- a/crates/router/src/connector/authorizedotnet/transformers.rs
+++ b/crates/router/src/connector/authorizedotnet/transformers.rs
@@ -1283,55 +1283,49 @@ impl TryFrom<AuthorizedotnetWebhookObjectId> for AuthorizedotnetSyncResponse {
}
fn get_wallet_data(
- wallet_data: &api_models::payments::WalletData,
+ wallet_data: &domain::WalletData,
return_url: &Option<String>,
) -> CustomResult<PaymentDetails, errors::ConnectorError> {
match wallet_data {
- api_models::payments::WalletData::GooglePay(_) => {
- Ok(PaymentDetails::OpaqueData(WalletDetails {
- data_descriptor: WalletMethod::Googlepay,
- data_value: Secret::new(wallet_data.get_encoded_wallet_token()?),
- }))
- }
- api_models::payments::WalletData::ApplePay(applepay_token) => {
+ domain::WalletData::GooglePay(_) => Ok(PaymentDetails::OpaqueData(WalletDetails {
+ data_descriptor: WalletMethod::Googlepay,
+ data_value: Secret::new(wallet_data.get_encoded_wallet_token()?),
+ })),
+ domain::WalletData::ApplePay(applepay_token) => {
Ok(PaymentDetails::OpaqueData(WalletDetails {
data_descriptor: WalletMethod::Applepay,
data_value: Secret::new(applepay_token.payment_data.clone()),
}))
}
- api_models::payments::WalletData::PaypalRedirect(_) => {
- Ok(PaymentDetails::PayPal(PayPalDetails {
- success_url: return_url.to_owned(),
- cancel_url: return_url.to_owned(),
- }))
- }
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("authorizedotnet"),
- ))?
- }
+ domain::WalletData::PaypalRedirect(_) => Ok(PaymentDetails::PayPal(PayPalDetails {
+ success_url: return_url.to_owned(),
+ cancel_url: return_url.to_owned(),
+ })),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("authorizedotnet"),
+ ))?,
}
}
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index d09e6ea5a0e..974d155c94d 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -287,36 +287,36 @@ impl TryFrom<&types::SetupMandateRouterData> for BankOfAmericaPaymentsRequest {
match item.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(card_data) => Self::try_from((item, card_data)),
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- payments::WalletData::ApplePay(apple_pay_data) => {
+ domain::WalletData::ApplePay(apple_pay_data) => {
Self::try_from((item, apple_pay_data))
}
- payments::WalletData::GooglePay(google_pay_data) => {
+ domain::WalletData::GooglePay(google_pay_data) => {
Self::try_from((item, google_pay_data))
}
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("BankOfAmerica"),
))?,
},
@@ -832,7 +832,7 @@ impl
TryFrom<(
&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>,
Box<ApplePayPredecryptData>,
- payments::ApplePayWalletData,
+ domain::ApplePayWalletData,
)> for BankOfAmericaPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
@@ -840,7 +840,7 @@ impl
(item, apple_pay_data, apple_pay_wallet_data): (
&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>,
Box<ApplePayPredecryptData>,
- payments::ApplePayWalletData,
+ domain::ApplePayWalletData,
),
) -> Result<Self, Self::Error> {
let email = item.router_data.request.get_email()?;
@@ -887,14 +887,14 @@ impl
impl
TryFrom<(
&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>,
- payments::GooglePayWalletData,
+ domain::GooglePayWalletData,
)> for BankOfAmericaPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
(item, google_pay_data): (
&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>,
- payments::GooglePayWalletData,
+ domain::GooglePayWalletData,
),
) -> Result<Self, Self::Error> {
let email = item.router_data.request.get_email()?;
@@ -933,7 +933,7 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>>
match item.router_data.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- payments::WalletData::ApplePay(apple_pay_data) => {
+ domain::WalletData::ApplePay(apple_pay_data) => {
match item.router_data.payment_method_token.clone() {
Some(payment_method_token) => match payment_method_token {
types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
@@ -998,34 +998,34 @@ impl TryFrom<&BankOfAmericaRouterData<&types::PaymentsAuthorizeRouterData>>
}
}
}
- payments::WalletData::GooglePay(google_pay_data) => {
+ domain::WalletData::GooglePay(google_pay_data) => {
Self::try_from((item, google_pay_data))
}
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message(
"Bank of America",
@@ -2412,12 +2412,12 @@ impl TryFrom<(&types::SetupMandateRouterData, domain::Card)> for BankOfAmericaPa
}
}
-impl TryFrom<(&types::SetupMandateRouterData, payments::ApplePayWalletData)>
+impl TryFrom<(&types::SetupMandateRouterData, domain::ApplePayWalletData)>
for BankOfAmericaPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- (item, apple_pay_data): (&types::SetupMandateRouterData, payments::ApplePayWalletData),
+ (item, apple_pay_data): (&types::SetupMandateRouterData, domain::ApplePayWalletData),
) -> Result<Self, Self::Error> {
let order_information = OrderInformationWithBill::try_from(item)?;
let client_reference_information = ClientReferenceInformation::from(item);
@@ -2470,18 +2470,12 @@ impl TryFrom<(&types::SetupMandateRouterData, payments::ApplePayWalletData)>
}
}
-impl
- TryFrom<(
- &types::SetupMandateRouterData,
- payments::GooglePayWalletData,
- )> for BankOfAmericaPaymentsRequest
+impl TryFrom<(&types::SetupMandateRouterData, domain::GooglePayWalletData)>
+ for BankOfAmericaPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- (item, google_pay_data): (
- &types::SetupMandateRouterData,
- payments::GooglePayWalletData,
- ),
+ (item, google_pay_data): (&types::SetupMandateRouterData, domain::GooglePayWalletData),
) -> Result<Self, Self::Error> {
let order_information = OrderInformationWithBill::try_from(item)?;
let client_reference_information = ClientReferenceInformation::from(item);
@@ -2585,8 +2579,8 @@ impl TryFrom<&Box<ApplePayPredecryptData>> for PaymentInformation {
}
}
-impl From<&payments::ApplePayWalletData> for PaymentInformation {
- fn from(apple_pay_data: &payments::ApplePayWalletData) -> Self {
+impl From<&domain::ApplePayWalletData> for PaymentInformation {
+ fn from(apple_pay_data: &domain::ApplePayWalletData) -> Self {
Self::ApplePayToken(ApplePayTokenPaymentInformation {
fluid_data: FluidData {
value: Secret::from(apple_pay_data.payment_data.clone()),
@@ -2598,8 +2592,8 @@ impl From<&payments::ApplePayWalletData> for PaymentInformation {
}
}
-impl From<&payments::GooglePayWalletData> for PaymentInformation {
- fn from(google_pay_data: &payments::GooglePayWalletData) -> Self {
+impl From<&domain::GooglePayWalletData> for PaymentInformation {
+ fn from(google_pay_data: &domain::GooglePayWalletData) -> Self {
Self::GooglePay(GooglePayPaymentInformation {
fluid_data: FluidData {
value: Secret::from(
diff --git a/crates/router/src/connector/bluesnap/transformers.rs b/crates/router/src/connector/bluesnap/transformers.rs
index 518fb3f8009..362e1aed183 100644
--- a/crates/router/src/connector/bluesnap/transformers.rs
+++ b/crates/router/src/connector/bluesnap/transformers.rs
@@ -293,7 +293,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
)?,
)),
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- api_models::payments::WalletData::GooglePay(payment_method_data) => {
+ domain::WalletData::GooglePay(payment_method_data) => {
let gpay_object = BluesnapGooglePayObject {
payment_method_data: utils::GooglePayWalletData::from(payment_method_data),
}
@@ -309,7 +309,7 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
None,
))
}
- api_models::payments::WalletData::ApplePay(payment_method_data) => {
+ domain::WalletData::ApplePay(payment_method_data) => {
let apple_pay_payment_data =
payment_method_data.get_applepay_decoded_payment_data()?;
let apple_pay_payment_data: ApplePayEncodedPaymentData = apple_pay_payment_data
@@ -370,30 +370,30 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
)?,
))
}
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_)
- | payments::WalletData::WeChatPayQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("bluesnap"),
))
@@ -431,8 +431,8 @@ impl TryFrom<&BluesnapRouterData<&types::PaymentsAuthorizeRouterData>> for Blues
}
}
-impl From<api_models::payments::ApplepayPaymentMethod> for ApplepayPaymentMethod {
- fn from(item: api_models::payments::ApplepayPaymentMethod) -> Self {
+impl From<domain::ApplepayPaymentMethod> for ApplepayPaymentMethod {
+ fn from(item: domain::ApplepayPaymentMethod) -> Self {
Self {
display_name: item.display_name,
network: item.network,
diff --git a/crates/router/src/connector/boku/transformers.rs b/crates/router/src/connector/boku/transformers.rs
index c2b805b5de0..07b48a5353c 100644
--- a/crates/router/src/connector/boku/transformers.rs
+++ b/crates/router/src/connector/boku/transformers.rs
@@ -100,10 +100,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BokuPaymentsRequest {
}
}
-impl TryFrom<(&types::PaymentsAuthorizeRouterData, &api::WalletData)> for BokuPaymentsRequest {
+impl TryFrom<(&types::PaymentsAuthorizeRouterData, &domain::WalletData)> for BokuPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
- value: (&types::PaymentsAuthorizeRouterData, &api::WalletData),
+ value: (&types::PaymentsAuthorizeRouterData, &domain::WalletData),
) -> Result<Self, Self::Error> {
let (item, wallet_data) = value;
let address = item.get_billing_address()?;
@@ -130,48 +130,36 @@ impl TryFrom<(&types::PaymentsAuthorizeRouterData, &api::WalletData)> for BokuPa
}
}
-fn get_wallet_type(wallet_data: &api::WalletData) -> Result<String, errors::ConnectorError> {
+fn get_wallet_type(wallet_data: &domain::WalletData) -> Result<String, errors::ConnectorError> {
match wallet_data {
- api_models::payments::WalletData::DanaRedirect { .. } => {
- Ok(BokuPaymentType::Dana.to_string())
- }
- api_models::payments::WalletData::MomoRedirect { .. } => {
- Ok(BokuPaymentType::Momo.to_string())
- }
- api_models::payments::WalletData::GcashRedirect { .. } => {
- Ok(BokuPaymentType::Gcash.to_string())
- }
- api_models::payments::WalletData::GoPayRedirect { .. } => {
- Ok(BokuPaymentType::GoPay.to_string())
- }
- api_models::payments::WalletData::KakaoPayRedirect { .. } => {
- Ok(BokuPaymentType::Kakaopay.to_string())
- }
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("boku"),
- ))
- }
+ domain::WalletData::DanaRedirect { .. } => Ok(BokuPaymentType::Dana.to_string()),
+ domain::WalletData::MomoRedirect { .. } => Ok(BokuPaymentType::Momo.to_string()),
+ domain::WalletData::GcashRedirect { .. } => Ok(BokuPaymentType::Gcash.to_string()),
+ domain::WalletData::GoPayRedirect { .. } => Ok(BokuPaymentType::GoPay.to_string()),
+ domain::WalletData::KakaoPayRedirect { .. } => Ok(BokuPaymentType::Kakaopay.to_string()),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("boku"),
+ )),
}
}
diff --git a/crates/router/src/connector/braintree/transformers.rs b/crates/router/src/connector/braintree/transformers.rs
index d9000ade25e..ef111a2588a 100644
--- a/crates/router/src/connector/braintree/transformers.rs
+++ b/crates/router/src/connector/braintree/transformers.rs
@@ -126,34 +126,34 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for BraintreePaymentsRequest {
domain::PaymentMethodData::Wallet(ref wallet_data) => {
Ok(PaymentMethodType::PaymentMethodNonce(Nonce {
payment_method_nonce: match wallet_data {
- api_models::payments::WalletData::PaypalSdk(wallet_data) => {
+ domain::WalletData::PaypalSdk(wallet_data) => {
Ok(wallet_data.token.to_owned())
}
- api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
+ domain::WalletData::ApplePay(_)
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("braintree"),
))
diff --git a/crates/router/src/connector/checkout/transformers.rs b/crates/router/src/connector/checkout/transformers.rs
index 899ea345a3d..a1a4a0095f3 100644
--- a/crates/router/src/connector/checkout/transformers.rs
+++ b/crates/router/src/connector/checkout/transformers.rs
@@ -91,40 +91,40 @@ impl TryFrom<&types::TokenizationRouterData> for TokenRequest {
fn try_from(item: &types::TokenizationRouterData) -> Result<Self, Self::Error> {
match item.request.payment_method_data.clone() {
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() {
- api_models::payments::WalletData::GooglePay(_data) => {
+ domain::WalletData::GooglePay(_data) => {
let json_wallet_data: CheckoutGooglePayData =
wallet_data.get_wallet_token_as_json("Google Pay".to_string())?;
Ok(Self::Googlepay(json_wallet_data))
}
- api_models::payments::WalletData::ApplePay(_data) => {
+ domain::WalletData::ApplePay(_data) => {
let json_wallet_data: CheckoutApplePayData =
wallet_data.get_wallet_token_as_json("Apple Pay".to_string())?;
Ok(Self::Applepay(json_wallet_data))
}
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_)
- | api_models::payments::WalletData::WeChatPayQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("checkout"),
)
@@ -303,22 +303,16 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
Ok(a)
}
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- api_models::payments::WalletData::GooglePay(_) => {
- Ok(PaymentSource::Wallets(WalletSource {
- source_type: CheckoutSourceTypes::Token,
- token: match item.router_data.get_payment_method_token()? {
- types::PaymentMethodToken::Token(token) => token.into(),
- types::PaymentMethodToken::ApplePayDecrypt(_) => {
- Err(unimplemented_payment_method!(
- "Apple Pay",
- "Simplified",
- "Checkout"
- ))?
- }
- },
- }))
- }
- api_models::payments::WalletData::ApplePay(_) => {
+ domain::WalletData::GooglePay(_) => Ok(PaymentSource::Wallets(WalletSource {
+ source_type: CheckoutSourceTypes::Token,
+ token: match item.router_data.get_payment_method_token()? {
+ types::PaymentMethodToken::Token(token) => token.into(),
+ types::PaymentMethodToken::ApplePayDecrypt(_) => Err(
+ unimplemented_payment_method!("Apple Pay", "Simplified", "Checkout"),
+ )?,
+ },
+ })),
+ domain::WalletData::ApplePay(_) => {
let payment_method_token = item.router_data.get_payment_method_token()?;
match payment_method_token {
types::PaymentMethodToken::Token(apple_pay_payment_token) => {
@@ -344,30 +338,30 @@ impl TryFrom<&CheckoutRouterData<&types::PaymentsAuthorizeRouterData>> for Payme
}
}
}
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_)
- | api_models::payments::WalletData::WeChatPayQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("checkout"),
))
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 2dc832841cf..6a51e1e8cd4 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -120,7 +120,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
}
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- payments::WalletData::ApplePay(apple_pay_data) => {
+ domain::WalletData::ApplePay(apple_pay_data) => {
match item.payment_method_token.clone() {
Some(payment_method_token) => match payment_method_token {
types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
@@ -158,7 +158,7 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
),
}
}
- payments::WalletData::GooglePay(google_pay_data) => (
+ domain::WalletData::GooglePay(google_pay_data) => (
PaymentInformation::GooglePay(GooglePayPaymentInformation {
fluid_data: FluidData {
value: Secret::from(
@@ -169,30 +169,30 @@ impl TryFrom<&types::SetupMandateRouterData> for CybersourceZeroMandateRequest {
}),
Some(PaymentSolution::GooglePay),
),
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Cybersource"),
))?,
},
@@ -857,7 +857,7 @@ impl
TryFrom<(
&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
Box<ApplePayPredecryptData>,
- payments::ApplePayWalletData,
+ domain::ApplePayWalletData,
)> for CybersourcePaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
@@ -865,7 +865,7 @@ impl
(item, apple_pay_data, apple_pay_wallet_data): (
&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
Box<ApplePayPredecryptData>,
- payments::ApplePayWalletData,
+ domain::ApplePayWalletData,
),
) -> Result<Self, Self::Error> {
let email = item.router_data.request.get_email()?;
@@ -922,14 +922,14 @@ impl
impl
TryFrom<(
&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
- payments::GooglePayWalletData,
+ domain::GooglePayWalletData,
)> for CybersourcePaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
(item, google_pay_data): (
&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>,
- payments::GooglePayWalletData,
+ domain::GooglePayWalletData,
),
) -> Result<Self, Self::Error> {
let email = item.router_data.request.get_email()?;
@@ -975,7 +975,7 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
match item.router_data.request.payment_method_data.clone() {
domain::PaymentMethodData::Card(ccard) => Self::try_from((item, ccard)),
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- payments::WalletData::ApplePay(apple_pay_data) => {
+ domain::WalletData::ApplePay(apple_pay_data) => {
match item.router_data.payment_method_token.clone() {
Some(payment_method_token) => match payment_method_token {
types::PaymentMethodToken::ApplePayDecrypt(decrypt_data) => {
@@ -1048,33 +1048,33 @@ impl TryFrom<&CybersourceRouterData<&types::PaymentsAuthorizeRouterData>>
}
}
}
- payments::WalletData::GooglePay(google_pay_data) => {
+ domain::WalletData::GooglePay(google_pay_data) => {
Self::try_from((item, google_pay_data))
}
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message(
"Cybersource",
diff --git a/crates/router/src/connector/dummyconnector/transformers.rs b/crates/router/src/connector/dummyconnector/transformers.rs
index 0d4ff3b8508..cf4e19b8e50 100644
--- a/crates/router/src/connector/dummyconnector/transformers.rs
+++ b/crates/router/src/connector/dummyconnector/transformers.rs
@@ -108,16 +108,16 @@ pub enum DummyConnectorWallet {
AliPayHK,
}
-impl TryFrom<api_models::payments::WalletData> for DummyConnectorWallet {
+impl TryFrom<domain::WalletData> for DummyConnectorWallet {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(value: api_models::payments::WalletData) -> Result<Self, Self::Error> {
+ fn try_from(value: domain::WalletData) -> Result<Self, Self::Error> {
match value {
- api_models::payments::WalletData::GooglePayRedirect(_) => Ok(Self::GooglePay),
- api_models::payments::WalletData::PaypalRedirect(_) => Ok(Self::Paypal),
- 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),
+ domain::WalletData::GooglePayRedirect(_) => Ok(Self::GooglePay),
+ domain::WalletData::PaypalRedirect(_) => Ok(Self::Paypal),
+ domain::WalletData::WeChatPayRedirect(_) => Ok(Self::WeChatPay),
+ domain::WalletData::MbWayRedirect(_) => Ok(Self::MbWay),
+ domain::WalletData::AliPayRedirect(_) => Ok(Self::AliPay),
+ domain::WalletData::AliPayHkRedirect(_) => Ok(Self::AliPayHK),
_ => Err(errors::ConnectorError::NotImplemented("Dummy wallet".to_string()).into()),
}
}
diff --git a/crates/router/src/connector/globalpay/transformers.rs b/crates/router/src/connector/globalpay/transformers.rs
index bc39a322206..b361aca79fa 100644
--- a/crates/router/src/connector/globalpay/transformers.rs
+++ b/crates/router/src/connector/globalpay/transformers.rs
@@ -408,7 +408,7 @@ fn get_payment_method_data(
fn get_return_url(item: &types::PaymentsAuthorizeRouterData) -> Option<String> {
match item.request.payment_method_data.clone() {
- domain::PaymentMethodData::Wallet(api_models::payments::WalletData::PaypalRedirect(_)) => {
+ domain::PaymentMethodData::Wallet(domain::WalletData::PaypalRedirect(_)) => {
item.request.complete_authorize_url.clone()
}
_ => item.request.router_return_url.clone(),
@@ -445,16 +445,12 @@ fn get_mandate_details(item: &types::PaymentsAuthorizeRouterData) -> Result<Mand
})
}
-fn get_wallet_data(
- wallet_data: &api_models::payments::WalletData,
-) -> Result<PaymentMethodData, Error> {
+fn get_wallet_data(wallet_data: &domain::WalletData) -> Result<PaymentMethodData, Error> {
match wallet_data {
- api_models::payments::WalletData::PaypalRedirect(_) => {
- Ok(PaymentMethodData::Apm(requests::Apm {
- provider: Some(ApmProvider::Paypal),
- }))
- }
- api_models::payments::WalletData::GooglePay(_) => {
+ domain::WalletData::PaypalRedirect(_) => Ok(PaymentMethodData::Apm(requests::Apm {
+ provider: Some(ApmProvider::Paypal),
+ })),
+ domain::WalletData::GooglePay(_) => {
Ok(PaymentMethodData::DigitalWallet(requests::DigitalWallet {
provider: Some(requests::DigitalWalletProvider::PayByGoogle),
payment_token: wallet_data.get_wallet_token_as_json("Google Pay".to_string())?,
diff --git a/crates/router/src/connector/globepay/transformers.rs b/crates/router/src/connector/globepay/transformers.rs
index bdb3b6ef5c5..efe96454933 100644
--- a/crates/router/src/connector/globepay/transformers.rs
+++ b/crates/router/src/connector/globepay/transformers.rs
@@ -7,7 +7,7 @@ use crate::{
connector::utils::{self, RouterData},
consts,
core::errors,
- types::{self, api, domain, storage::enums},
+ types::{self, domain, storage::enums},
};
type Error = error_stack::Report<errors::ConnectorError>;
@@ -30,32 +30,32 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for GlobepayPaymentsRequest {
fn try_from(item: &types::PaymentsAuthorizeRouterData) -> Result<Self, Self::Error> {
let channel: GlobepayChannel = match &item.request.payment_method_data {
domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
- api::WalletData::AliPayQr(_) => GlobepayChannel::Alipay,
- api::WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat,
- api::WalletData::AliPayRedirect(_)
- | api::WalletData::AliPayHkRedirect(_)
- | api::WalletData::MomoRedirect(_)
- | api::WalletData::KakaoPayRedirect(_)
- | api::WalletData::GoPayRedirect(_)
- | api::WalletData::GcashRedirect(_)
- | api::WalletData::ApplePay(_)
- | api::WalletData::ApplePayRedirect(_)
- | api::WalletData::ApplePayThirdPartySdk(_)
- | api::WalletData::DanaRedirect {}
- | api::WalletData::GooglePay(_)
- | api::WalletData::GooglePayRedirect(_)
- | api::WalletData::GooglePayThirdPartySdk(_)
- | api::WalletData::MbWayRedirect(_)
- | api::WalletData::MobilePayRedirect(_)
- | api::WalletData::PaypalRedirect(_)
- | api::WalletData::PaypalSdk(_)
- | api::WalletData::SamsungPay(_)
- | api::WalletData::TwintRedirect {}
- | api::WalletData::VippsRedirect {}
- | api::WalletData::TouchNGoRedirect(_)
- | api::WalletData::WeChatPayRedirect(_)
- | api::WalletData::CashappQr(_)
- | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::AliPayQr(_) => GlobepayChannel::Alipay,
+ domain::WalletData::WeChatPayQr(_) => GlobepayChannel::Wechat,
+ domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("globepay"),
))?,
},
diff --git a/crates/router/src/connector/mollie/transformers.rs b/crates/router/src/connector/mollie/transformers.rs
index 30856035fde..68ea3ab5868 100644
--- a/crates/router/src/connector/mollie/transformers.rs
+++ b/crates/router/src/connector/mollie/transformers.rs
@@ -325,16 +325,16 @@ impl TryFrom<&types::TokenizationRouterData> for MollieCardTokenRequest {
fn get_payment_method_for_wallet(
item: &types::PaymentsAuthorizeRouterData,
- wallet_data: &api_models::payments::WalletData,
+ wallet_data: &domain::WalletData,
) -> Result<PaymentMethodData, Error> {
match wallet_data {
- api_models::payments::WalletData::PaypalRedirect { .. } => {
+ domain::WalletData::PaypalRedirect { .. } => {
Ok(PaymentMethodData::Paypal(Box::new(PaypalMethodData {
billing_address: get_billing_details(item)?,
shipping_address: get_shipping_details(item)?,
})))
}
- api_models::payments::WalletData::ApplePay(applepay_wallet_data) => {
+ domain::WalletData::ApplePay(applepay_wallet_data) => {
Ok(PaymentMethodData::Applepay(Box::new(ApplePayMethodData {
apple_pay_payment_token: Secret::new(applepay_wallet_data.payment_data.to_owned()),
})))
diff --git a/crates/router/src/connector/multisafepay/transformers.rs b/crates/router/src/connector/multisafepay/transformers.rs
index 8c6d23ca47e..de0a52fe563 100644
--- a/crates/router/src/connector/multisafepay/transformers.rs
+++ b/crates/router/src/connector/multisafepay/transformers.rs
@@ -281,32 +281,32 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
domain::PaymentMethodData::Card(ref _ccard) => Type::Direct,
domain::PaymentMethodData::MandatePayment => Type::Direct,
domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
- api::WalletData::GooglePay(_) => Type::Direct,
- api::WalletData::PaypalRedirect(_) => Type::Redirect,
- api::WalletData::AliPayQr(_)
- | api::WalletData::AliPayRedirect(_)
- | api::WalletData::AliPayHkRedirect(_)
- | api::WalletData::MomoRedirect(_)
- | api::WalletData::KakaoPayRedirect(_)
- | api::WalletData::GoPayRedirect(_)
- | api::WalletData::GcashRedirect(_)
- | api::WalletData::ApplePay(_)
- | api::WalletData::ApplePayRedirect(_)
- | api::WalletData::ApplePayThirdPartySdk(_)
- | api::WalletData::DanaRedirect {}
- | api::WalletData::GooglePayRedirect(_)
- | api::WalletData::GooglePayThirdPartySdk(_)
- | api::WalletData::MbWayRedirect(_)
- | api::WalletData::MobilePayRedirect(_)
- | api::WalletData::PaypalSdk(_)
- | api::WalletData::SamsungPay(_)
- | api::WalletData::TwintRedirect {}
- | api::WalletData::VippsRedirect {}
- | api::WalletData::TouchNGoRedirect(_)
- | api::WalletData::WeChatPayRedirect(_)
- | api::WalletData::WeChatPayQr(_)
- | api::WalletData::CashappQr(_)
- | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::GooglePay(_) => Type::Direct,
+ domain::WalletData::PaypalRedirect(_) => Type::Redirect,
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
},
@@ -319,32 +319,32 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
Some(Gateway::try_from(ccard.get_card_issuer()?)?)
}
domain::PaymentMethodData::Wallet(ref wallet_data) => Some(match wallet_data {
- api::WalletData::GooglePay(_) => Gateway::Googlepay,
- api::WalletData::PaypalRedirect(_) => Gateway::Paypal,
- api::WalletData::AliPayQr(_)
- | api::WalletData::AliPayRedirect(_)
- | api::WalletData::AliPayHkRedirect(_)
- | api::WalletData::MomoRedirect(_)
- | api::WalletData::KakaoPayRedirect(_)
- | api::WalletData::GoPayRedirect(_)
- | api::WalletData::GcashRedirect(_)
- | api::WalletData::ApplePay(_)
- | api::WalletData::ApplePayRedirect(_)
- | api::WalletData::ApplePayThirdPartySdk(_)
- | api::WalletData::DanaRedirect {}
- | api::WalletData::GooglePayRedirect(_)
- | api::WalletData::GooglePayThirdPartySdk(_)
- | api::WalletData::MbWayRedirect(_)
- | api::WalletData::MobilePayRedirect(_)
- | api::WalletData::PaypalSdk(_)
- | api::WalletData::SamsungPay(_)
- | api::WalletData::TwintRedirect {}
- | api::WalletData::VippsRedirect {}
- | api::WalletData::TouchNGoRedirect(_)
- | api::WalletData::WeChatPayRedirect(_)
- | api::WalletData::WeChatPayQr(_)
- | api::WalletData::CashappQr(_)
- | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::GooglePay(_) => Gateway::Googlepay,
+ domain::WalletData::PaypalRedirect(_) => Gateway::Paypal,
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
}),
@@ -441,7 +441,7 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
term_url: None,
})),
domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
- api::WalletData::GooglePay(ref google_pay) => {
+ domain::WalletData::GooglePay(ref google_pay) => {
Some(GatewayInfo::Wallet(WalletInfo::GooglePay({
GpayInfo {
payment_token: Some(Secret::new(
@@ -450,31 +450,31 @@ impl TryFrom<&MultisafepayRouterData<&types::PaymentsAuthorizeRouterData>>
}
})))
}
- api::WalletData::PaypalRedirect(_) => None,
- api::WalletData::AliPayQr(_)
- | api::WalletData::AliPayRedirect(_)
- | api::WalletData::AliPayHkRedirect(_)
- | api::WalletData::MomoRedirect(_)
- | api::WalletData::KakaoPayRedirect(_)
- | api::WalletData::GoPayRedirect(_)
- | api::WalletData::GcashRedirect(_)
- | api::WalletData::ApplePay(_)
- | api::WalletData::ApplePayRedirect(_)
- | api::WalletData::ApplePayThirdPartySdk(_)
- | api::WalletData::DanaRedirect {}
- | api::WalletData::GooglePayRedirect(_)
- | api::WalletData::GooglePayThirdPartySdk(_)
- | api::WalletData::MbWayRedirect(_)
- | api::WalletData::MobilePayRedirect(_)
- | api::WalletData::PaypalSdk(_)
- | api::WalletData::SamsungPay(_)
- | api::WalletData::TwintRedirect {}
- | api::WalletData::VippsRedirect {}
- | api::WalletData::TouchNGoRedirect(_)
- | api::WalletData::WeChatPayRedirect(_)
- | api::WalletData::WeChatPayQr(_)
- | api::WalletData::CashappQr(_)
- | api::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::PaypalRedirect(_) => None,
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("multisafepay"),
))?,
},
diff --git a/crates/router/src/connector/nexinets/transformers.rs b/crates/router/src/connector/nexinets/transformers.rs
index 210910d3e75..693e7671ec9 100644
--- a/crates/router/src/connector/nexinets/transformers.rs
+++ b/crates/router/src/connector/nexinets/transformers.rs
@@ -660,8 +660,8 @@ fn get_card_data(
}
fn get_applepay_details(
- wallet_data: &api_models::payments::WalletData,
- applepay_data: &api_models::payments::ApplePayWalletData,
+ wallet_data: &domain::WalletData,
+ applepay_data: &domain::ApplePayWalletData,
) -> CustomResult<ApplePayDetails, errors::ConnectorError> {
let payment_data = wallet_data.get_wallet_token_as_json("Apple Pay".to_string())?;
Ok(ApplePayDetails {
@@ -687,14 +687,14 @@ fn get_card_details(
}
fn get_wallet_details(
- wallet: &api_models::payments::WalletData,
+ wallet: &domain::WalletData,
) -> Result<
(Option<NexinetsPaymentDetails>, NexinetsProduct),
error_stack::Report<errors::ConnectorError>,
> {
match wallet {
- api_models::payments::WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)),
- api_models::payments::WalletData::ApplePay(applepay_data) => Ok((
+ domain::WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)),
+ domain::WalletData::ApplePay(applepay_data) => Ok((
Some(NexinetsPaymentDetails::Wallet(Box::new(
NexinetsWalletDetails::ApplePayToken(Box::new(get_applepay_details(
wallet,
@@ -703,34 +703,32 @@ fn get_wallet_details(
))),
NexinetsProduct::Applepay,
)),
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect { .. }
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect { .. }
- | api_models::payments::WalletData::VippsRedirect { .. }
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("nexinets"),
- ))?
- }
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect { .. }
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect { .. }
+ | domain::WalletData::VippsRedirect { .. }
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("nexinets"),
+ ))?,
}
}
diff --git a/crates/router/src/connector/nmi/transformers.rs b/crates/router/src/connector/nmi/transformers.rs
index 79e71ca72d8..0ff6a677114 100644
--- a/crates/router/src/connector/nmi/transformers.rs
+++ b/crates/router/src/connector/nmi/transformers.rs
@@ -6,7 +6,7 @@ use common_utils::{
ext_traits::XmlExt,
pii::{self, Email},
};
-use error_stack::{Report, ResultExt};
+use error_stack::{report, Report, ResultExt};
use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -519,40 +519,35 @@ impl TryFrom<&domain::PaymentMethodData> for PaymentMethod {
match &payment_method_data {
domain::PaymentMethodData::Card(ref card) => Ok(Self::try_from(card)?),
domain::PaymentMethodData::Wallet(ref wallet_type) => match wallet_type {
- api_models::payments::WalletData::GooglePay(ref googlepay_data) => {
- Ok(Self::from(googlepay_data))
- }
- api_models::payments::WalletData::ApplePay(ref applepay_data) => {
- Ok(Self::from(applepay_data))
- }
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::GooglePay(ref googlepay_data) => Ok(Self::from(googlepay_data)),
+ domain::WalletData::ApplePay(ref applepay_data) => Ok(Self::from(applepay_data)),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => {
+ Err(report!(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nmi"),
- )
- .into())
+ )))
}
},
domain::PaymentMethodData::CardRedirect(_)
@@ -592,8 +587,8 @@ impl TryFrom<&domain::payments::Card> for PaymentMethod {
}
}
-impl From<&api_models::payments::GooglePayWalletData> for PaymentMethod {
- fn from(wallet_data: &api_models::payments::GooglePayWalletData) -> Self {
+impl From<&domain::GooglePayWalletData> for PaymentMethod {
+ fn from(wallet_data: &domain::GooglePayWalletData) -> Self {
let gpay_data = GooglePayData {
googlepay_payment_data: Secret::new(wallet_data.tokenization_data.token.clone()),
};
@@ -601,8 +596,8 @@ impl From<&api_models::payments::GooglePayWalletData> for PaymentMethod {
}
}
-impl From<&api_models::payments::ApplePayWalletData> for PaymentMethod {
- fn from(wallet_data: &api_models::payments::ApplePayWalletData) -> Self {
+impl From<&domain::ApplePayWalletData> for PaymentMethod {
+ fn from(wallet_data: &domain::ApplePayWalletData) -> Self {
let apple_pay_data = ApplePayData {
applepay_payment_data: Secret::new(wallet_data.payment_data.clone()),
};
diff --git a/crates/router/src/connector/noon/transformers.rs b/crates/router/src/connector/noon/transformers.rs
index c2031fd8954..08b0fff1c7e 100644
--- a/crates/router/src/connector/noon/transformers.rs
+++ b/crates/router/src/connector/noon/transformers.rs
@@ -249,7 +249,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
}))
}
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data.clone() {
- api_models::payments::WalletData::GooglePay(google_pay_data) => {
+ domain::WalletData::GooglePay(google_pay_data) => {
Ok(NoonPaymentData::GooglePay(NoonGooglePay {
api_version_minor: GOOGLEPAY_API_VERSION_MINOR,
api_version: GOOGLEPAY_API_VERSION,
@@ -258,7 +258,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
),
}))
}
- api_models::payments::WalletData::ApplePay(apple_pay_data) => {
+ domain::WalletData::ApplePay(apple_pay_data) => {
let payment_token_data = NoonApplePayTokenData {
token: NoonApplePayData {
payment_data: wallet_data
@@ -281,34 +281,34 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for NoonPaymentsRequest {
payment_info: Secret::new(payment_token),
}))
}
- api_models::payments::WalletData::PaypalRedirect(_) => {
+ domain::WalletData::PaypalRedirect(_) => {
Ok(NoonPaymentData::PayPal(NoonPayPal {
return_url: item.request.get_router_return_url()?,
}))
}
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => {
Err(errors::ConnectorError::NotImplemented(
conn_utils::get_unimplemented_payment_method_error_message("Noon"),
))
diff --git a/crates/router/src/connector/nuvei/transformers.rs b/crates/router/src/connector/nuvei/transformers.rs
index 00da2b9ae5f..ece7c2dcedc 100644
--- a/crates/router/src/connector/nuvei/transformers.rs
+++ b/crates/router/src/connector/nuvei/transformers.rs
@@ -430,9 +430,9 @@ pub struct NuveiCardDetails {
three_d: Option<ThreeD>,
}
-impl TryFrom<payments::GooglePayWalletData> for NuveiPaymentsRequest {
+impl TryFrom<domain::GooglePayWalletData> for NuveiPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(gpay_data: payments::GooglePayWalletData) -> Result<Self, Self::Error> {
+ fn try_from(gpay_data: domain::GooglePayWalletData) -> Result<Self, Self::Error> {
Ok(Self {
payment_option: PaymentOption {
card: Some(Card {
@@ -452,8 +452,8 @@ impl TryFrom<payments::GooglePayWalletData> for NuveiPaymentsRequest {
})
}
}
-impl From<payments::ApplePayWalletData> for NuveiPaymentsRequest {
- fn from(apple_pay_data: payments::ApplePayWalletData) -> Self {
+impl From<domain::ApplePayWalletData> for NuveiPaymentsRequest {
+ fn from(apple_pay_data: domain::ApplePayWalletData) -> Self {
Self {
payment_option: PaymentOption {
card: Some(Card {
@@ -752,36 +752,36 @@ impl<F>
domain::PaymentMethodData::Card(card) => get_card_info(item, &card),
domain::PaymentMethodData::MandatePayment => Self::try_from(item),
domain::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)),
- payments::WalletData::PaypalRedirect(_) => Self::foreign_try_from((
+ domain::WalletData::GooglePay(gpay_data) => Self::try_from(gpay_data),
+ domain::WalletData::ApplePay(apple_pay_data) => Ok(Self::from(apple_pay_data)),
+ domain::WalletData::PaypalRedirect(_) => Self::foreign_try_from((
AlternativePaymentMethodType::Expresscheckout,
None,
item,
)),
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_)
- | payments::WalletData::WeChatPayQr(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nuvei"),
)
diff --git a/crates/router/src/connector/payme/transformers.rs b/crates/router/src/connector/payme/transformers.rs
index d3b9e72e989..0c284a3f8e7 100644
--- a/crates/router/src/connector/payme/transformers.rs
+++ b/crates/router/src/connector/payme/transformers.rs
@@ -385,38 +385,36 @@ impl TryFrom<&PaymentMethodData> for SalePaymentMethod {
match item {
PaymentMethodData::Card(_) => Ok(Self::CreditCard),
PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- api_models::payments::WalletData::ApplePayThirdPartySdk(_) => Ok(Self::ApplePay),
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotSupported {
- message: "Wallet".to_string(),
- connector: "payme",
- }
- .into())
+ domain::WalletData::ApplePayThirdPartySdk(_) => Ok(Self::ApplePay),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotSupported {
+ message: "Wallet".to_string(),
+ connector: "payme",
}
+ .into()),
},
PaymentMethodData::PayLater(_)
| PaymentMethodData::BankRedirect(_)
@@ -551,9 +549,9 @@ impl<F>
let payme_auth_type = PaymeAuthType::try_from(&item.data.connector_auth_type)?;
let session_token = match pmd {
- Some(PaymentMethodData::Wallet(
- api_models::payments::WalletData::ApplePayThirdPartySdk(_),
- )) => Some(api_models::payments::SessionToken::ApplePay(Box::new(
+ Some(PaymentMethodData::Wallet(domain::WalletData::ApplePayThirdPartySdk(
+ _,
+ ))) => Some(api_models::payments::SessionToken::ApplePay(Box::new(
api_models::payments::ApplepaySessionTokenResponse {
session_token_data:
api_models::payments::ApplePaySessionResponse::NoSessionResponse,
diff --git a/crates/router/src/connector/paypal/transformers.rs b/crates/router/src/connector/paypal/transformers.rs
index bd023e703a6..c9cbae95735 100644
--- a/crates/router/src/connector/paypal/transformers.rs
+++ b/crates/router/src/connector/paypal/transformers.rs
@@ -477,7 +477,7 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
})
}
domain::PaymentMethodData::Wallet(ref wallet_data) => match wallet_data {
- api_models::payments::WalletData::PaypalRedirect(_) => {
+ domain::WalletData::PaypalRedirect(_) => {
let intent = if item.router_data.request.is_auto_capture()? {
PaypalPaymentIntent::Capture
} else {
@@ -523,35 +523,33 @@ impl TryFrom<&PaypalRouterData<&types::PaymentsAuthorizeRouterData>> for PaypalP
payment_source,
})
}
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::WeChatPayQr(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Paypal"),
- ))?
- }
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Paypal"),
+ ))?,
},
domain::PaymentMethodData::BankRedirect(ref bank_redirection_data) => {
let intent = if item.router_data.request.is_auto_capture()? {
diff --git a/crates/router/src/connector/payu/transformers.rs b/crates/router/src/connector/payu/transformers.rs
index 93add6f296b..575f199b730 100644
--- a/crates/router/src/connector/payu/transformers.rs
+++ b/crates/router/src/connector/payu/transformers.rs
@@ -79,7 +79,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
}),
}),
domain::PaymentMethodData::Wallet(wallet_data) => match wallet_data {
- api_models::payments::WalletData::GooglePay(data) => Ok(PayuPaymentMethod {
+ domain::WalletData::GooglePay(data) => Ok(PayuPaymentMethod {
pay_method: PayuPaymentMethodData::Wallet({
PayuWallet {
value: PayuWalletCode::Ap,
@@ -90,7 +90,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PayuPaymentsRequest {
}
}),
}),
- api_models::payments::WalletData::ApplePay(data) => Ok(PayuPaymentMethod {
+ domain::WalletData::ApplePay(data) => Ok(PayuPaymentMethod {
pay_method: PayuPaymentMethodData::Wallet({
PayuWallet {
value: PayuWalletCode::Jp,
diff --git a/crates/router/src/connector/rapyd/transformers.rs b/crates/router/src/connector/rapyd/transformers.rs
index 31910f4b932..7950ff323aa 100644
--- a/crates/router/src/connector/rapyd/transformers.rs
+++ b/crates/router/src/connector/rapyd/transformers.rs
@@ -143,11 +143,11 @@ impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPay
}
domain::PaymentMethodData::Wallet(ref wallet_data) => {
let digital_wallet = match wallet_data {
- api_models::payments::WalletData::GooglePay(data) => Some(RapydWallet {
+ domain::WalletData::GooglePay(data) => Some(RapydWallet {
payment_type: "google_pay".to_string(),
token: Some(Secret::new(data.tokenization_data.token.to_owned())),
}),
- api_models::payments::WalletData::ApplePay(data) => Some(RapydWallet {
+ domain::WalletData::ApplePay(data) => Some(RapydWallet {
payment_type: "apple_pay".to_string(),
token: Some(Secret::new(data.payment_data.to_string())),
}),
diff --git a/crates/router/src/connector/shift4/transformers.rs b/crates/router/src/connector/shift4/transformers.rs
index 72a8e299b92..924081da4a9 100644
--- a/crates/router/src/connector/shift4/transformers.rs
+++ b/crates/router/src/connector/shift4/transformers.rs
@@ -177,36 +177,36 @@ impl<T> TryFrom<&types::RouterData<T, types::PaymentsAuthorizeData, types::Payme
}
}
-impl TryFrom<&api_models::payments::WalletData> for Shift4PaymentMethod {
+impl TryFrom<&domain::WalletData> for Shift4PaymentMethod {
type Error = Error;
- fn try_from(wallet_data: &api_models::payments::WalletData) -> Result<Self, Self::Error> {
+ fn try_from(wallet_data: &domain::WalletData) -> Result<Self, Self::Error> {
match wallet_data {
- payments::WalletData::AliPayRedirect(_)
- | payments::WalletData::ApplePay(_)
- | payments::WalletData::WeChatPayRedirect(_)
- | payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePay(_)
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::MobilePayRedirect(_)
- | payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::WeChatPayQr(_)
- | payments::WalletData::CashappQr(_)
- | payments::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Shift4"),
)
.into()),
diff --git a/crates/router/src/connector/square/transformers.rs b/crates/router/src/connector/square/transformers.rs
index eb44cb2c919..abb2f69a42b 100644
--- a/crates/router/src/connector/square/transformers.rs
+++ b/crates/router/src/connector/square/transformers.rs
@@ -1,4 +1,4 @@
-use api_models::payments::{BankDebitData, PayLaterData, WalletData};
+use api_models::payments::{BankDebitData, PayLaterData};
use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
@@ -92,37 +92,39 @@ impl TryFrom<(&types::TokenizationRouterData, PayLaterData)> for SquareTokenRequ
}
}
-impl TryFrom<(&types::TokenizationRouterData, WalletData)> for SquareTokenRequest {
+impl TryFrom<(&types::TokenizationRouterData, domain::WalletData)> for SquareTokenRequest {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(value: (&types::TokenizationRouterData, WalletData)) -> Result<Self, Self::Error> {
+ fn try_from(
+ value: (&types::TokenizationRouterData, domain::WalletData),
+ ) -> Result<Self, Self::Error> {
let (_item, wallet_data) = value;
match wallet_data {
- WalletData::ApplePay(_)
- | WalletData::GooglePay(_)
- | WalletData::AliPayQr(_)
- | WalletData::AliPayRedirect(_)
- | WalletData::AliPayHkRedirect(_)
- | WalletData::MomoRedirect(_)
- | WalletData::KakaoPayRedirect(_)
- | WalletData::GoPayRedirect(_)
- | WalletData::GcashRedirect(_)
- | WalletData::ApplePayRedirect(_)
- | WalletData::ApplePayThirdPartySdk(_)
- | WalletData::DanaRedirect {}
- | WalletData::GooglePayRedirect(_)
- | WalletData::GooglePayThirdPartySdk(_)
- | WalletData::MbWayRedirect(_)
- | WalletData::MobilePayRedirect(_)
- | WalletData::PaypalRedirect(_)
- | WalletData::PaypalSdk(_)
- | WalletData::SamsungPay(_)
- | WalletData::TwintRedirect {}
- | WalletData::VippsRedirect {}
- | WalletData::TouchNGoRedirect(_)
- | WalletData::WeChatPayRedirect(_)
- | WalletData::WeChatPayQr(_)
- | WalletData::CashappQr(_)
- | WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
+ domain::WalletData::ApplePay(_)
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::WeChatPayQr(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Square"),
))?,
}
diff --git a/crates/router/src/connector/stripe/transformers.rs b/crates/router/src/connector/stripe/transformers.rs
index ef613ed7cfe..47bb034f5b5 100644
--- a/crates/router/src/connector/stripe/transformers.rs
+++ b/crates/router/src/connector/stripe/transformers.rs
@@ -984,40 +984,40 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodType {
}
}
-impl ForeignTryFrom<&payments::WalletData> for Option<StripePaymentMethodType> {
+impl ForeignTryFrom<&domain::WalletData> for Option<StripePaymentMethodType> {
type Error = errors::ConnectorError;
- fn foreign_try_from(wallet_data: &payments::WalletData) -> Result<Self, Self::Error> {
+ fn foreign_try_from(wallet_data: &domain::WalletData) -> Result<Self, Self::Error> {
match wallet_data {
- payments::WalletData::AliPayRedirect(_) => Ok(Some(StripePaymentMethodType::Alipay)),
- payments::WalletData::ApplePay(_) => Ok(None),
- payments::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)),
- payments::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)),
- payments::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)),
- payments::WalletData::MobilePayRedirect(_) => {
+ domain::WalletData::AliPayRedirect(_) => Ok(Some(StripePaymentMethodType::Alipay)),
+ domain::WalletData::ApplePay(_) => Ok(None),
+ domain::WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)),
+ domain::WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)),
+ domain::WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)),
+ domain::WalletData::MobilePayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
))
}
- payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::SwishQr(_)
- | payments::WalletData::WeChatPayRedirect(_) => {
+ domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
))
@@ -1504,18 +1504,16 @@ impl TryFrom<(&domain::Card, Auth3ds)> for StripePaymentMethodData {
}
}
-impl TryFrom<(&payments::WalletData, Option<types::PaymentMethodToken>)>
- for StripePaymentMethodData
-{
+impl TryFrom<(&domain::WalletData, Option<types::PaymentMethodToken>)> for StripePaymentMethodData {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
(wallet_data, payment_method_token): (
- &payments::WalletData,
+ &domain::WalletData,
Option<types::PaymentMethodToken>,
),
) -> Result<Self, Self::Error> {
match wallet_data {
- payments::WalletData::ApplePay(applepay_data) => {
+ domain::WalletData::ApplePay(applepay_data) => {
let mut apple_pay_decrypt_data =
if let Some(types::PaymentMethodToken::ApplePayDecrypt(decrypt_data)) =
payment_method_token
@@ -1558,49 +1556,48 @@ impl TryFrom<(&payments::WalletData, Option<types::PaymentMethodToken>)>
.ok_or(errors::ConnectorError::MissingApplePayTokenData)?;
Ok(pmd)
}
- payments::WalletData::WeChatPayQr(_) => Ok(Self::Wallet(
- StripeWallet::WechatpayPayment(WechatpayPayment {
+ domain::WalletData::WeChatPayQr(_) => Ok(Self::Wallet(StripeWallet::WechatpayPayment(
+ WechatpayPayment {
client: WechatClient::Web,
payment_method_data_type: StripePaymentMethodType::Wechatpay,
- }),
- )),
- payments::WalletData::AliPayRedirect(_) => {
+ },
+ ))),
+ domain::WalletData::AliPayRedirect(_) => {
Ok(Self::Wallet(StripeWallet::AlipayPayment(AlipayPayment {
payment_method_data_type: StripePaymentMethodType::Alipay,
})))
}
- payments::WalletData::CashappQr(_) => {
+ domain::WalletData::CashappQr(_) => {
Ok(Self::Wallet(StripeWallet::Cashapp(CashappPayment {
payment_method_data_type: StripePaymentMethodType::Cashapp,
})))
}
- payments::WalletData::GooglePay(gpay_data) => Ok(Self::try_from(gpay_data)?),
- payments::WalletData::PaypalRedirect(_)
- | payments::WalletData::MobilePayRedirect(_) => {
+ domain::WalletData::GooglePay(gpay_data) => Ok(Self::try_from(gpay_data)?),
+ domain::WalletData::PaypalRedirect(_) | domain::WalletData::MobilePayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
)
.into())
}
- payments::WalletData::AliPayQr(_)
- | payments::WalletData::AliPayHkRedirect(_)
- | payments::WalletData::MomoRedirect(_)
- | payments::WalletData::KakaoPayRedirect(_)
- | payments::WalletData::GoPayRedirect(_)
- | payments::WalletData::GcashRedirect(_)
- | payments::WalletData::ApplePayRedirect(_)
- | payments::WalletData::ApplePayThirdPartySdk(_)
- | payments::WalletData::DanaRedirect {}
- | payments::WalletData::GooglePayRedirect(_)
- | payments::WalletData::GooglePayThirdPartySdk(_)
- | payments::WalletData::MbWayRedirect(_)
- | payments::WalletData::PaypalSdk(_)
- | payments::WalletData::SamsungPay(_)
- | payments::WalletData::TwintRedirect {}
- | payments::WalletData::VippsRedirect {}
- | payments::WalletData::TouchNGoRedirect(_)
- | payments::WalletData::SwishQr(_)
- | payments::WalletData::WeChatPayRedirect(_) => {
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayRedirect(_) => {
Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
)
@@ -1702,9 +1699,9 @@ impl TryFrom<&payments::BankRedirectData> for StripePaymentMethodData {
}
}
-impl TryFrom<&payments::GooglePayWalletData> for StripePaymentMethodData {
+impl TryFrom<&domain::GooglePayWalletData> for StripePaymentMethodData {
type Error = error_stack::Report<errors::ConnectorError>;
- fn try_from(gpay_data: &payments::GooglePayWalletData) -> Result<Self, Self::Error> {
+ fn try_from(gpay_data: &domain::GooglePayWalletData) -> Result<Self, Self::Error> {
Ok(Self::Wallet(StripeWallet::GooglepayToken(GooglePayToken {
token: Secret::new(
gpay_data
@@ -1854,7 +1851,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest {
};
payment_data = match item.request.payment_method_data {
- domain::PaymentMethodData::Wallet(payments::WalletData::ApplePay(_)) => {
+ domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(_)) => {
let payment_method_token = item
.payment_method_token
.to_owned()
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index 3edaa319fb5..b2a148b1766 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -856,8 +856,8 @@ pub struct GpayTokenizationData {
pub token: Secret<String>,
}
-impl From<api_models::payments::GooglePayWalletData> for GooglePayWalletData {
- fn from(data: api_models::payments::GooglePayWalletData) -> Self {
+impl From<domain::GooglePayWalletData> for GooglePayWalletData {
+ fn from(data: domain::GooglePayWalletData) -> Self {
Self {
pm_type: data.pm_type,
description: data.description,
@@ -1019,7 +1019,7 @@ pub trait WalletData {
fn get_encoded_wallet_token(&self) -> Result<String, Error>;
}
-impl WalletData for api::WalletData {
+impl WalletData for domain::WalletData {
fn get_wallet_token(&self) -> Result<Secret<String>, Error> {
match self {
Self::GooglePay(data) => Ok(Secret::new(data.tokenization_data.token.clone())),
@@ -1060,7 +1060,7 @@ pub trait ApplePay {
fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error>;
}
-impl ApplePay for payments::ApplePayWalletData {
+impl ApplePay for domain::ApplePayWalletData {
fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
let token = Secret::new(
String::from_utf8(
diff --git a/crates/router/src/connector/worldpay/transformers.rs b/crates/router/src/connector/worldpay/transformers.rs
index 1cbdb71f8b5..35a2f8cee8a 100644
--- a/crates/router/src/connector/worldpay/transformers.rs
+++ b/crates/router/src/connector/worldpay/transformers.rs
@@ -53,49 +53,45 @@ fn fetch_payment_instrument(
..CardPayment::default()
})),
domain::PaymentMethodData::Wallet(wallet) => match wallet {
- api_models::payments::WalletData::GooglePay(data) => {
+ domain::WalletData::GooglePay(data) => {
Ok(PaymentInstrument::Googlepay(WalletPayment {
payment_type: PaymentType::Googlepay,
wallet_token: Secret::new(data.tokenization_data.token),
..WalletPayment::default()
}))
}
- api_models::payments::WalletData::ApplePay(data) => {
- Ok(PaymentInstrument::Applepay(WalletPayment {
- payment_type: PaymentType::Applepay,
- wallet_token: Secret::new(data.payment_data),
- ..WalletPayment::default()
- }))
- }
- api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayRedirect(_)
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_)
- | api_models::payments::WalletData::WeChatPayQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("worldpay"),
- )
- .into())
- }
+ domain::WalletData::ApplePay(data) => Ok(PaymentInstrument::Applepay(WalletPayment {
+ payment_type: PaymentType::Applepay,
+ wallet_token: Secret::new(data.payment_data),
+ ..WalletPayment::default()
+ })),
+ domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayRedirect(_)
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("worldpay"),
+ )
+ .into()),
},
domain::PaymentMethodData::PayLater(_)
| domain::PaymentMethodData::BankRedirect(_)
diff --git a/crates/router/src/connector/zen/transformers.rs b/crates/router/src/connector/zen/transformers.rs
index ec44150ec9d..e6ead170d9f 100644
--- a/crates/router/src/connector/zen/transformers.rs
+++ b/crates/router/src/connector/zen/transformers.rs
@@ -460,14 +460,14 @@ impl
impl
TryFrom<(
&ZenRouterData<&types::PaymentsAuthorizeRouterData>,
- &api_models::payments::WalletData,
+ &domain::WalletData,
)> for ZenPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
(item, wallet_data): (
&ZenRouterData<&types::PaymentsAuthorizeRouterData>,
- &api_models::payments::WalletData,
+ &domain::WalletData,
),
) -> Result<Self, Self::Error> {
let amount = item.amount.to_owned();
@@ -476,7 +476,7 @@ impl
.parse_value("SessionObject")
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let (specified_payment_channel, session_data) = match wallet_data {
- api_models::payments::WalletData::ApplePayRedirect(_) => (
+ domain::WalletData::ApplePayRedirect(_) => (
ZenPaymentChannels::PclApplepay,
session
.apple_pay
@@ -484,7 +484,7 @@ impl
wallet_name: "Apple Pay".to_string(),
})?,
),
- api_models::payments::WalletData::GooglePayRedirect(_) => (
+ domain::WalletData::GooglePayRedirect(_) => (
ZenPaymentChannels::PclGooglepay,
session
.google_pay
@@ -492,34 +492,32 @@ impl
wallet_name: "Google Pay".to_string(),
})?,
),
- api_models::payments::WalletData::WeChatPayRedirect(_)
- | api_models::payments::WalletData::PaypalRedirect(_)
- | api_models::payments::WalletData::ApplePay(_)
- | api_models::payments::WalletData::GooglePay(_)
- | api_models::payments::WalletData::AliPayQr(_)
- | api_models::payments::WalletData::AliPayRedirect(_)
- | api_models::payments::WalletData::AliPayHkRedirect(_)
- | api_models::payments::WalletData::MomoRedirect(_)
- | api_models::payments::WalletData::KakaoPayRedirect(_)
- | api_models::payments::WalletData::GoPayRedirect(_)
- | api_models::payments::WalletData::GcashRedirect(_)
- | api_models::payments::WalletData::ApplePayThirdPartySdk(_)
- | api_models::payments::WalletData::DanaRedirect {}
- | api_models::payments::WalletData::GooglePayThirdPartySdk(_)
- | api_models::payments::WalletData::MbWayRedirect(_)
- | api_models::payments::WalletData::MobilePayRedirect(_)
- | api_models::payments::WalletData::PaypalSdk(_)
- | api_models::payments::WalletData::SamsungPay(_)
- | api_models::payments::WalletData::TwintRedirect {}
- | api_models::payments::WalletData::VippsRedirect {}
- | api_models::payments::WalletData::TouchNGoRedirect(_)
- | api_models::payments::WalletData::CashappQr(_)
- | api_models::payments::WalletData::SwishQr(_)
- | api_models::payments::WalletData::WeChatPayQr(_) => {
- Err(errors::ConnectorError::NotImplemented(
- utils::get_unimplemented_payment_method_error_message("Zen"),
- ))?
- }
+ domain::WalletData::WeChatPayRedirect(_)
+ | domain::WalletData::PaypalRedirect(_)
+ | domain::WalletData::ApplePay(_)
+ | domain::WalletData::GooglePay(_)
+ | domain::WalletData::AliPayQr(_)
+ | domain::WalletData::AliPayRedirect(_)
+ | domain::WalletData::AliPayHkRedirect(_)
+ | domain::WalletData::MomoRedirect(_)
+ | domain::WalletData::KakaoPayRedirect(_)
+ | domain::WalletData::GoPayRedirect(_)
+ | domain::WalletData::GcashRedirect(_)
+ | domain::WalletData::ApplePayThirdPartySdk(_)
+ | domain::WalletData::DanaRedirect {}
+ | domain::WalletData::GooglePayThirdPartySdk(_)
+ | domain::WalletData::MbWayRedirect(_)
+ | domain::WalletData::MobilePayRedirect(_)
+ | domain::WalletData::PaypalSdk(_)
+ | domain::WalletData::SamsungPay(_)
+ | domain::WalletData::TwintRedirect {}
+ | domain::WalletData::VippsRedirect {}
+ | domain::WalletData::TouchNGoRedirect(_)
+ | domain::WalletData::CashappQr(_)
+ | domain::WalletData::SwishQr(_)
+ | domain::WalletData::WeChatPayQr(_) => Err(errors::ConnectorError::NotImplemented(
+ utils::get_unimplemented_payment_method_error_message("Zen"),
+ ))?,
};
let terminal_uuid = session_data
.terminal_uuid
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 72dace68f07..87c93af6635 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1234,15 +1234,21 @@ where
| TokenizationAction::TokenizeInConnectorAndApplepayPreDecrypt
) {
let apple_pay_data = match payment_data.payment_method_data.clone() {
- Some(api_models::payments::PaymentMethodData::Wallet(
- api_models::payments::WalletData::ApplePay(wallet_data),
- )) => Some(
- ApplePayData::token_json(api_models::payments::WalletData::ApplePay(wallet_data))
- .change_context(errors::ApiErrorResponse::InternalServerError)?
- .decrypt(state)
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)?,
- ),
+ Some(payment_data) => {
+ let domain_data = domain::PaymentMethodData::from(payment_data);
+ match domain_data {
+ domain::PaymentMethodData::Wallet(domain::WalletData::ApplePay(
+ wallet_data,
+ )) => Some(
+ ApplePayData::token_json(domain::WalletData::ApplePay(wallet_data))
+ .change_context(errors::ApiErrorResponse::InternalServerError)?
+ .decrypt(state)
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)?,
+ ),
+ _ => None,
+ }
+ }
_ => None,
};
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index d96469b640e..4820db94841 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -3680,7 +3680,7 @@ pub struct ApplePayHeader {
impl ApplePayData {
pub fn token_json(
- wallet_data: api_models::payments::WalletData,
+ wallet_data: domain::WalletData,
) -> CustomResult<Self, errors::ConnectorError> {
let json_wallet_data: Self = connector::utils::WalletData::get_wallet_token_as_json(
&wallet_data,
diff --git a/crates/router/src/types/domain/payments.rs b/crates/router/src/types/domain/payments.rs
index 633193677a4..0ec67ffa91c 100644
--- a/crates/router/src/types/domain/payments.rs
+++ b/crates/router/src/types/domain/payments.rs
@@ -1,6 +1,7 @@
use common_utils::pii::Email;
use masking::Secret;
use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
// We need to derive Serialize and Deserialize because some parts of payment method data are being
// stored in the database as serde_json::Value
@@ -8,7 +9,7 @@ use serde::{Deserialize, Serialize};
pub enum PaymentMethodData {
Card(Card),
CardRedirect(CardRedirectData),
- Wallet(api_models::payments::WalletData),
+ Wallet(WalletData),
PayLater(api_models::payments::PayLaterData),
BankRedirect(api_models::payments::BankRedirectData),
BankDebit(api_models::payments::BankDebitData),
@@ -85,7 +86,7 @@ pub enum PayLaterData {
AtomeRedirect {},
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub enum WalletData {
AliPayQr(Box<AliPayQr>),
@@ -116,14 +117,14 @@ pub enum WalletData {
SwishQr(SwishQrData),
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SamsungPayWalletData {
/// The encrypted payment token from Samsung
pub token: Secret<String>,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayWalletData {
/// The type of payment method
@@ -136,67 +137,67 @@ pub struct GooglePayWalletData {
pub tokenization_data: GpayTokenizationData,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayRedirectData {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayRedirectData {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayThirdPartySdkData {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayThirdPartySdkData {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPayRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPay {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WeChatPayQr {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct CashappQr {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaypalRedirection {
/// paypal's email address
pub email: Option<Email>,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AliPayQr {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AliPayRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AliPayHkRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct MomoRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct KakaoPayRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GoPayRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GcashRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct MobilePayRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct MbWayRedirection {
/// Telephone number of the shopper. Should be Portuguese phone number.
pub telephone_number: Secret<String>,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayPaymentMethodInfo {
/// The name of the card network
@@ -205,19 +206,19 @@ pub struct GooglePayPaymentMethodInfo {
pub card_details: String,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PayPalWalletData {
/// Token generated for the Apple pay
pub token: String,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct TouchNGoRedirection {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SwishQrData {}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GpayTokenizationData {
/// The type of the token
pub token_type: String,
@@ -225,7 +226,7 @@ pub struct GpayTokenizationData {
pub token: String,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayWalletData {
/// The payment data of Apple pay
pub payment_data: String,
@@ -235,7 +236,7 @@ pub struct ApplePayWalletData {
pub transaction_identifier: String,
}
-#[derive(Eq, PartialEq, Clone, Debug)]
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplepayPaymentMethod {
pub display_name: String,
pub network: String,
@@ -328,7 +329,7 @@ impl From<api_models::payments::PaymentMethodData> for PaymentMethodData {
Self::CardRedirect(From::from(card_redirect))
}
api_models::payments::PaymentMethodData::Wallet(wallet_data) => {
- Self::Wallet(wallet_data)
+ Self::Wallet(From::from(wallet_data))
}
api_models::payments::PaymentMethodData::PayLater(pay_later_data) => {
Self::PayLater(pay_later_data)
@@ -403,3 +404,117 @@ impl From<api_models::payments::CardRedirectData> for CardRedirectData {
}
}
}
+
+impl From<api_models::payments::WalletData> for WalletData {
+ fn from(value: api_models::payments::WalletData) -> Self {
+ match value {
+ api_models::payments::WalletData::AliPayQr(_) => Self::AliPayQr(Box::new(AliPayQr {})),
+ api_models::payments::WalletData::AliPayRedirect(_) => {
+ Self::AliPayRedirect(AliPayRedirection {})
+ }
+ api_models::payments::WalletData::AliPayHkRedirect(_) => {
+ Self::AliPayHkRedirect(AliPayHkRedirection {})
+ }
+ api_models::payments::WalletData::MomoRedirect(_) => {
+ Self::MomoRedirect(MomoRedirection {})
+ }
+ api_models::payments::WalletData::KakaoPayRedirect(_) => {
+ Self::KakaoPayRedirect(KakaoPayRedirection {})
+ }
+ api_models::payments::WalletData::GoPayRedirect(_) => {
+ Self::GoPayRedirect(GoPayRedirection {})
+ }
+ api_models::payments::WalletData::GcashRedirect(_) => {
+ Self::GcashRedirect(GcashRedirection {})
+ }
+ api_models::payments::WalletData::ApplePay(apple_pay_data) => {
+ Self::ApplePay(ApplePayWalletData::from(apple_pay_data))
+ }
+ api_models::payments::WalletData::ApplePayRedirect(_) => {
+ Self::ApplePayRedirect(Box::new(ApplePayRedirectData {}))
+ }
+ api_models::payments::WalletData::ApplePayThirdPartySdk(_) => {
+ Self::ApplePayThirdPartySdk(Box::new(ApplePayThirdPartySdkData {}))
+ }
+ api_models::payments::WalletData::DanaRedirect {} => Self::DanaRedirect {},
+ api_models::payments::WalletData::GooglePay(google_pay_data) => {
+ Self::GooglePay(GooglePayWalletData::from(google_pay_data))
+ }
+ api_models::payments::WalletData::GooglePayRedirect(_) => {
+ Self::GooglePayRedirect(Box::new(GooglePayRedirectData {}))
+ }
+ api_models::payments::WalletData::GooglePayThirdPartySdk(_) => {
+ Self::GooglePayThirdPartySdk(Box::new(GooglePayThirdPartySdkData {}))
+ }
+ api_models::payments::WalletData::MbWayRedirect(mbway_redirect_data) => {
+ Self::MbWayRedirect(Box::new(MbWayRedirection {
+ telephone_number: mbway_redirect_data.telephone_number,
+ }))
+ }
+ api_models::payments::WalletData::MobilePayRedirect(_) => {
+ Self::MobilePayRedirect(Box::new(MobilePayRedirection {}))
+ }
+ api_models::payments::WalletData::PaypalRedirect(paypal_redirect_data) => {
+ Self::PaypalRedirect(PaypalRedirection {
+ email: paypal_redirect_data.email,
+ })
+ }
+ api_models::payments::WalletData::PaypalSdk(paypal_sdk_data) => {
+ Self::PaypalSdk(PayPalWalletData {
+ token: paypal_sdk_data.token,
+ })
+ }
+ api_models::payments::WalletData::SamsungPay(samsung_pay_data) => {
+ Self::SamsungPay(Box::new(SamsungPayWalletData {
+ token: samsung_pay_data.token,
+ }))
+ }
+ api_models::payments::WalletData::TwintRedirect {} => Self::TwintRedirect {},
+ api_models::payments::WalletData::VippsRedirect {} => Self::VippsRedirect {},
+ api_models::payments::WalletData::TouchNGoRedirect(_) => {
+ Self::TouchNGoRedirect(Box::new(TouchNGoRedirection {}))
+ }
+ api_models::payments::WalletData::WeChatPayRedirect(_) => {
+ Self::WeChatPayRedirect(Box::new(WeChatPayRedirection {}))
+ }
+ api_models::payments::WalletData::WeChatPayQr(_) => {
+ Self::WeChatPayQr(Box::new(WeChatPayQr {}))
+ }
+ api_models::payments::WalletData::CashappQr(_) => {
+ Self::CashappQr(Box::new(CashappQr {}))
+ }
+ api_models::payments::WalletData::SwishQr(_) => Self::SwishQr(SwishQrData {}),
+ }
+ }
+}
+
+impl From<api_models::payments::GooglePayWalletData> for GooglePayWalletData {
+ fn from(value: api_models::payments::GooglePayWalletData) -> Self {
+ Self {
+ pm_type: value.pm_type,
+ description: value.description,
+ info: GooglePayPaymentMethodInfo {
+ card_network: value.info.card_network,
+ card_details: value.info.card_details,
+ },
+ tokenization_data: GpayTokenizationData {
+ token_type: value.tokenization_data.token_type,
+ token: value.tokenization_data.token,
+ },
+ }
+ }
+}
+
+impl From<api_models::payments::ApplePayWalletData> for ApplePayWalletData {
+ fn from(value: api_models::payments::ApplePayWalletData) -> Self {
+ Self {
+ payment_data: value.payment_data,
+ payment_method: ApplepayPaymentMethod {
+ display_name: value.payment_method.display_name,
+ network: value.payment_method.network,
+ pm_type: value.payment_method.pm_type,
+ },
+ transaction_identifier: value.transaction_identifier,
+ }
+ }
+}
diff --git a/crates/router/tests/connectors/payu.rs b/crates/router/tests/connectors/payu.rs
index 34d7d119953..fc916e33677 100644
--- a/crates/router/tests/connectors/payu.rs
+++ b/crates/router/tests/connectors/payu.rs
@@ -1,5 +1,5 @@
use masking::PeekInterface;
-use router::types::{self, api, storage::enums, AccessToken, ConnectorAuthType};
+use router::types::{self, domain, storage::enums, AccessToken, ConnectorAuthType};
use crate::{
connector_auth,
@@ -89,15 +89,15 @@ async fn should_authorize_gpay_payment() {
let authorize_response = Payu {}
.authorize_payment(
Some(types::PaymentsAuthorizeData {
- payment_method_data: types::domain::PaymentMethodData::Wallet(api::WalletData::GooglePay(
- api_models::payments::GooglePayWalletData {
+ payment_method_data: domain::PaymentMethodData::Wallet(domain::WalletData::GooglePay(
+ domain::GooglePayWalletData {
pm_type: "CARD".to_string(),
description: "Visa1234567890".to_string(),
- info: api_models::payments::GooglePayPaymentMethodInfo {
+ info: domain::GooglePayPaymentMethodInfo {
card_network: "VISA".to_string(),
card_details: "1234".to_string(),
},
- tokenization_data: api_models::payments::GpayTokenizationData {
+ tokenization_data: domain::GpayTokenizationData {
token_type: "payu".to_string(),
token: r#"{"signature":"MEUCIQD7Ta+d9+buesrH2KKkF+03AqTen+eHHN8KFleHoKaiVAIgGvAXyI0Vg3ws8KlF7agW/gmXJhpJOOPkqiNVbn/4f0Y\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"UcdGP9F/1loU0aXvVj6VqGRPA5EAjHYfJrXD0N+5O13RnaJXKWIjch1zzjpy9ONOZHqEGAqYKIcKcpe5ppN4Fpd0dtbm1H4u+lA+SotCff3euPV6sne22/Pl/MNgbz5QvDWR0UjcXvIKSPNwkds1Ib7QMmH4GfZ3vvn6s534hxAmcv/LlkeM4FFf6py9crJK5fDIxtxRJncfLuuPeAXkyy+u4zE33HmT34Oe5MSW/kYZVz31eWqFy2YCIjbJcC9ElMluoOKSZ305UG7tYGB1LCFGQLtLxphrhPu1lEmGEZE1t2cVDoCzjr3rm1OcfENc7eNC4S+ko6yrXh1ZX06c/F9kunyLn0dAz8K5JLIwLdjw3wPADVSd3L0eM7jkzhH80I6nWkutO0x8BFltxWl+OtzrnAe093OUncH6/DK1pCxtJaHdw1WUWrzULcdaMZmPfA\\u003d\\u003d\",\"ephemeralPublicKey\":\"BH7A1FUBWiePkjh/EYmsjY/63D/6wU+4UmkLh7WW6v7PnoqQkjrFpc4kEP5a1Op4FkIlM9LlEs3wGdFB8xIy9cM\\u003d\",\"tag\":\"e/EOsw2Y2wYpJngNWQqH7J62Fhg/tzmgDl6UFGuAN+A\\u003d\"}"}"# .to_string()//Generate new GooglePay token this is bound to expire
},
diff --git a/crates/router/tests/connectors/worldpay.rs b/crates/router/tests/connectors/worldpay.rs
index 7606a63b68b..649b1bebbb1 100644
--- a/crates/router/tests/connectors/worldpay.rs
+++ b/crates/router/tests/connectors/worldpay.rs
@@ -1,5 +1,5 @@
use futures::future::OptionFuture;
-use router::types::{self, api, storage::enums};
+use router::types::{self, domain, storage::enums};
use serde_json::json;
use serial_test::serial;
use wiremock::{
@@ -63,14 +63,14 @@ async fn should_authorize_gpay_payment() {
.authorize_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Wallet(
- api::WalletData::GooglePay(api_models::payments::GooglePayWalletData {
+ domain::WalletData::GooglePay(domain::GooglePayWalletData {
pm_type: "CARD".to_string(),
description: "Visa1234567890".to_string(),
- info: api_models::payments::GooglePayPaymentMethodInfo {
+ info: domain::GooglePayPaymentMethodInfo {
card_network: "VISA".to_string(),
card_details: "1234".to_string(),
},
- tokenization_data: api_models::payments::GpayTokenizationData {
+ tokenization_data: domain::GpayTokenizationData {
token_type: "worldpay".to_string(),
token: "someToken".to_string(),
},
@@ -98,10 +98,10 @@ async fn should_authorize_applepay_payment() {
.authorize_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Wallet(
- api::WalletData::ApplePay(api_models::payments::ApplePayWalletData {
+ domain::WalletData::ApplePay(domain::ApplePayWalletData {
payment_data: "someData".to_string(),
transaction_identifier: "someId".to_string(),
- payment_method: api_models::payments::ApplepayPaymentMethod {
+ payment_method: domain::ApplepayPaymentMethod {
display_name: "someName".to_string(),
network: "visa".to_string(),
pm_type: "card".to_string(),
|
refactor
|
add Wallets payment method data to new domain type to be used in connector module (#4160)
|
88253780d708bc1c005a87c186c4b0b14325c8a0
|
2024-11-04 19:49:23
|
Sandeep Kumar
|
fix(analytics): add dynamic limit by clause in failure reasons metric query (#6462)
| false
|
diff --git a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
index 70ae64e0115..bcbce0502d2 100644
--- a/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
+++ b/crates/analytics/src/payments/metrics/sessionized_metrics/failure_reasons.rs
@@ -148,17 +148,20 @@ where
.attach_printable("Error adding order by clause")
.switch()?;
- for dim in dimensions.iter() {
- if dim != &PaymentDimensions::ErrorReason {
- outer_query_builder
- .add_order_by_clause(dim, Order::Ascending)
- .attach_printable("Error adding order by clause")
- .switch()?;
- }
+ let filtered_dimensions: Vec<&PaymentDimensions> = dimensions
+ .iter()
+ .filter(|&&dim| dim != PaymentDimensions::ErrorReason)
+ .collect();
+
+ for dim in &filtered_dimensions {
+ outer_query_builder
+ .add_order_by_clause(*dim, Order::Ascending)
+ .attach_printable("Error adding order by clause")
+ .switch()?;
}
outer_query_builder
- .set_limit_by(5, &[PaymentDimensions::Connector])
+ .set_limit_by(5, &filtered_dimensions)
.attach_printable("Error adding limit clause")
.switch()?;
|
fix
|
add dynamic limit by clause in failure reasons metric query (#6462)
|
6730fe32cb403ac91079dbefca6c2ea9020906db
|
2023-06-06 19:14:42
|
Kritik Modi
|
feat(ci): Create a new workflow to validate the generated openAPI spec file (openapi_spec.json) (#1323)
| false
|
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 92bed90d8db..5ce0e958dac 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -384,3 +384,4 @@ jobs:
- name: Spell check
uses: crate-ci/typos@master
+
diff --git a/.github/workflows/validate-generated-json.yml b/.github/workflows/validate-generated-json.yml
new file mode 100644
index 00000000000..3604a44cab6
--- /dev/null
+++ b/.github/workflows/validate-generated-json.yml
@@ -0,0 +1,37 @@
+name: Validate Generated OpenAPI Spec File
+
+on:
+ pull_request:
+
+ merge_group:
+ types:
+ - checks_requested
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ validate_json:
+ name: Validate generated openapi spec file
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/[email protected]
+
+ - name: Install Rust
+ uses: dtolnay/rust-toolchain@master
+ with:
+ toolchain: stable
+
+ - name: Generate the spec file
+ shell: bash
+ run: cargo run --features openapi -- generate-openapi-spec
+
+ - name: Install swagger-cli
+ shell: bash
+ run: npm install -g @apidevtools/swagger-cli
+
+ - name: Validate the json file
+ shell: bash
+ run: swagger-cli validate ./openapi/openapi_spec.json
diff --git a/Cargo.lock b/Cargo.lock
index 3690b937999..50173a250e5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11,7 +11,7 @@ dependencies = [
"actix-rt",
"actix_derive",
"bitflags 1.3.2",
- "bytes",
+ "bytes 1.4.0",
"crossbeam-channel",
"futures-core",
"futures-sink",
@@ -20,10 +20,10 @@ dependencies = [
"log",
"once_cell",
"parking_lot",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"smallvec",
- "tokio",
- "tokio-util",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
]
[[package]]
@@ -33,14 +33,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe"
dependencies = [
"bitflags 1.3.2",
- "bytes",
+ "bytes 1.4.0",
"futures-core",
"futures-sink",
"log",
"memchr",
- "pin-project-lite",
- "tokio",
- "tokio-util",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
]
[[package]]
@@ -72,27 +72,27 @@ dependencies = [
"base64 0.21.2",
"bitflags 1.3.2",
"brotli",
- "bytes",
+ "bytes 1.4.0",
"bytestring",
"derive_more",
"encoding_rs",
"flate2",
"futures-core",
- "h2",
+ "h2 0.3.19",
"http",
"httparse",
- "httpdate",
- "itoa",
+ "httpdate 1.0.2",
+ "itoa 1.0.6",
"language-tags",
"local-channel",
"mime",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rand 0.8.5",
"sha1",
"smallvec",
- "tokio",
- "tokio-util",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
"tracing",
"zstd",
]
@@ -116,7 +116,7 @@ dependencies = [
"actix-multipart-derive",
"actix-utils",
"actix-web",
- "bytes",
+ "bytes 1.4.0",
"derive_more",
"futures-core",
"futures-util",
@@ -129,7 +129,7 @@ dependencies = [
"serde_json",
"serde_plain",
"tempfile",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -166,7 +166,7 @@ checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e"
dependencies = [
"actix-macros",
"futures-core",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -180,10 +180,10 @@ dependencies = [
"actix-utils",
"futures-core",
"futures-util",
- "mio",
+ "mio 0.8.6",
"num_cpus",
- "socket2",
- "tokio",
+ "socket2 0.4.9",
+ "tokio 1.28.2",
"tracing",
]
@@ -195,7 +195,7 @@ checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a"
dependencies = [
"futures-core",
"paste",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
]
[[package]]
@@ -211,9 +211,9 @@ dependencies = [
"futures-core",
"http",
"log",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"tokio-rustls",
- "tokio-util",
+ "tokio-util 0.7.8",
"webpki-roots",
]
@@ -224,7 +224,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8"
dependencies = [
"local-waker",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
]
[[package]]
@@ -243,27 +243,27 @@ dependencies = [
"actix-utils",
"actix-web-codegen",
"ahash 0.7.6",
- "bytes",
+ "bytes 1.4.0",
"bytestring",
- "cfg-if",
+ "cfg-if 1.0.0",
"cookie",
"derive_more",
"encoding_rs",
"futures-core",
"futures-util",
"http",
- "itoa",
+ "itoa 1.0.6",
"language-tags",
"log",
"mime",
"once_cell",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"regex",
"serde",
"serde_json",
"serde_urlencoded",
"smallvec",
- "socket2",
+ "socket2 0.4.9",
"time 0.3.21",
"url",
]
@@ -314,7 +314,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"getrandom 0.2.9",
"once_cell",
"version_check",
@@ -378,7 +378,7 @@ dependencies = [
"frunk_core",
"masking",
"mime",
- "reqwest",
+ "reqwest 0.11.18",
"router_derive",
"serde",
"serde_json",
@@ -406,6 +406,12 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545"
+[[package]]
+name = "arrayvec"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
+
[[package]]
name = "arrayvec"
version = "0.7.2"
@@ -431,7 +437,7 @@ dependencies = [
"bb8",
"diesel",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -454,8 +460,8 @@ dependencies = [
"flate2",
"futures-core",
"memchr",
- "pin-project-lite",
- "tokio",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
]
[[package]]
@@ -466,7 +472,7 @@ checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
"async-lock",
"autocfg",
- "cfg-if",
+ "cfg-if 1.0.0",
"concurrent-queue",
"futures-lite",
"log",
@@ -474,7 +480,7 @@ dependencies = [
"polling",
"rustix",
"slab",
- "socket2",
+ "socket2 0.4.9",
"waker-fn",
]
@@ -495,7 +501,7 @@ checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
dependencies = [
"async-stream-impl",
"futures-core",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
]
[[package]]
@@ -528,7 +534,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -551,25 +557,25 @@ dependencies = [
"actix-utils",
"ahash 0.7.6",
"base64 0.21.2",
- "bytes",
- "cfg-if",
+ "bytes 1.4.0",
+ "cfg-if 1.0.0",
"cookie",
"derive_more",
"futures-core",
"futures-util",
- "h2",
+ "h2 0.3.19",
"http",
- "itoa",
+ "itoa 1.0.6",
"log",
"mime",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rand 0.8.5",
"rustls",
"serde",
"serde_json",
"serde_urlencoded",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -589,14 +595,14 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"fastrand",
"hex",
"http",
- "hyper",
+ "hyper 0.14.26",
"ring",
"time 0.3.21",
- "tokio",
+ "tokio 1.28.2",
"tower",
"tracing",
"zeroize",
@@ -611,7 +617,7 @@ dependencies = [
"aws-smithy-async",
"aws-smithy-types",
"fastrand",
- "tokio",
+ "tokio 1.28.2",
"tracing",
"zeroize",
]
@@ -640,12 +646,12 @@ dependencies = [
"aws-smithy-http",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
- "http-body",
+ "http-body 0.4.5",
"lazy_static",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"tracing",
]
@@ -666,7 +672,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
"regex",
"tokio-stream",
@@ -695,9 +701,9 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
- "http-body",
+ "http-body 0.4.5",
"once_cell",
"percent-encoding",
"regex",
@@ -724,7 +730,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
"regex",
"tokio-stream",
@@ -749,7 +755,7 @@ dependencies = [
"aws-smithy-json",
"aws-smithy-types",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
"regex",
"tokio-stream",
@@ -776,7 +782,7 @@ dependencies = [
"aws-smithy-types",
"aws-smithy-xml",
"aws-types",
- "bytes",
+ "bytes 1.4.0",
"http",
"regex",
"tower",
@@ -806,7 +812,7 @@ checksum = "9d2ce6f507be68e968a33485ced670111d1cbad161ddbbab1e313c03d37d8f4c"
dependencies = [
"aws-smithy-eventstream",
"aws-smithy-http",
- "bytes",
+ "bytes 1.4.0",
"form_urlencoded",
"hex",
"hmac",
@@ -826,8 +832,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bda3996044c202d75b91afeb11a9afae9db9a721c6a7a427410018e286b880"
dependencies = [
"futures-util",
- "pin-project-lite",
- "tokio",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
"tokio-stream",
]
@@ -839,14 +845,14 @@ checksum = "07ed8b96d95402f3f6b8b57eb4e0e45ee365f78b1a924faf20ff6e97abf1eae6"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
- "bytes",
+ "bytes 1.4.0",
"crc32c",
"crc32fast",
"hex",
"http",
- "http-body",
+ "http-body 0.4.5",
"md-5",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"sha1",
"sha2",
"tracing",
@@ -862,16 +868,16 @@ dependencies = [
"aws-smithy-http",
"aws-smithy-http-tower",
"aws-smithy-types",
- "bytes",
+ "bytes 1.4.0",
"fastrand",
"http",
- "http-body",
- "hyper",
+ "http-body 0.4.5",
+ "hyper 0.14.26",
"hyper-rustls",
"lazy_static",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rustls",
- "tokio",
+ "tokio 1.28.2",
"tower",
"tracing",
]
@@ -883,7 +889,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460c8da5110835e3d9a717c61f5556b20d03c32a1dec57f8fc559b360f733bb8"
dependencies = [
"aws-smithy-types",
- "bytes",
+ "bytes 1.4.0",
"crc32fast",
]
@@ -895,18 +901,18 @@ checksum = "2b3b693869133551f135e1f2c77cb0b8277d9e3e17feaf2213f735857c4f0d28"
dependencies = [
"aws-smithy-eventstream",
"aws-smithy-types",
- "bytes",
+ "bytes 1.4.0",
"bytes-utils",
"futures-core",
"http",
- "http-body",
- "hyper",
+ "http-body 0.4.5",
+ "hyper 0.14.26",
"once_cell",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"pin-utils",
- "tokio",
- "tokio-util",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
"tracing",
]
@@ -918,10 +924,10 @@ checksum = "3ae4f6c5798a247fac98a867698197d9ac22643596dc3777f0c76b91917616b9"
dependencies = [
"aws-smithy-http",
"aws-smithy-types",
- "bytes",
+ "bytes 1.4.0",
"http",
- "http-body",
- "pin-project-lite",
+ "http-body 0.4.5",
+ "pin-project-lite 0.2.9",
"tower",
"tracing",
]
@@ -952,7 +958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16a3d0bf4f324f4ef9793b86a1701d9700fbcdbd12a846da45eed104c634c6e8"
dependencies = [
"base64-simd",
- "itoa",
+ "itoa 1.0.6",
"num-integer",
"ryu",
"time 0.3.21",
@@ -992,17 +998,17 @@ dependencies = [
"async-trait",
"axum-core",
"bitflags 1.3.2",
- "bytes",
+ "bytes 1.4.0",
"futures-util",
"http",
- "http-body",
- "hyper",
- "itoa",
+ "http-body 0.4.5",
+ "hyper 0.14.26",
+ "itoa 1.0.6",
"matchit",
"memchr",
"mime",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rustversion",
"serde",
"sync_wrapper",
@@ -1018,10 +1024,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
dependencies = [
"async-trait",
- "bytes",
+ "bytes 1.4.0",
"futures-util",
"http",
- "http-body",
+ "http-body 0.4.5",
"mime",
"rustversion",
"tower-layer",
@@ -1060,7 +1066,7 @@ dependencies = [
"futures-channel",
"futures-util",
"parking_lot",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -1090,6 +1096,17 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84"
+[[package]]
+name = "blake2b_simd"
+version = "0.5.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
+dependencies = [
+ "arrayref",
+ "arrayvec 0.5.2",
+ "constant_time_eq 0.1.5",
+]
+
[[package]]
name = "blake3"
version = "1.3.3"
@@ -1097,10 +1114,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef"
dependencies = [
"arrayref",
- "arrayvec",
+ "arrayvec 0.7.2",
"cc",
- "cfg-if",
- "constant_time_eq",
+ "cfg-if 1.0.0",
+ "constant_time_eq 0.2.5",
"digest",
]
@@ -1152,6 +1169,12 @@ version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
+[[package]]
+name = "bytes"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
+
[[package]]
name = "bytes"
version = "1.4.0"
@@ -1164,7 +1187,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"either",
]
@@ -1174,7 +1197,7 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
]
[[package]]
@@ -1217,7 +1240,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa"
dependencies = [
"camino",
"cargo-platform",
- "semver",
+ "semver 1.0.17",
"serde",
"serde_json",
]
@@ -1230,7 +1253,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a"
dependencies = [
"camino",
"cargo-platform",
- "semver",
+ "semver 1.0.17",
"serde",
"serde_json",
"thiserror",
@@ -1256,6 +1279,12 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "cfg-if"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
+
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -1275,7 +1304,7 @@ dependencies = [
"serde",
"time 0.1.45",
"wasm-bindgen",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -1328,6 +1357,17 @@ dependencies = [
"unicode-width",
]
+[[package]]
+name = "colored"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"
+dependencies = [
+ "atty",
+ "lazy_static",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "common_enums"
version = "0.1.0"
@@ -1345,7 +1385,7 @@ name = "common_utils"
version = "0.1.0"
dependencies = [
"async-trait",
- "bytes",
+ "bytes 1.4.0",
"diesel",
"error-stack",
"fake",
@@ -1368,7 +1408,7 @@ dependencies = [
"signal-hook-tokio",
"thiserror",
"time 0.3.21",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -1399,6 +1439,12 @@ dependencies = [
"yaml-rust",
]
+[[package]]
+name = "constant_time_eq"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+
[[package]]
name = "constant_time_eq"
version = "0.2.5"
@@ -1474,7 +1520,7 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -1483,7 +1529,7 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"crossbeam-utils",
]
@@ -1494,7 +1540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
dependencies = [
"autocfg",
- "cfg-if",
+ "cfg-if 1.0.0",
"crossbeam-utils",
"memoffset",
"scopeguard",
@@ -1506,7 +1552,7 @@ version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -1519,6 +1565,27 @@ dependencies = [
"typenum",
]
+[[package]]
+name = "csv"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086"
+dependencies = [
+ "csv-core",
+ "itoa 1.0.6",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "csv-core"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "cxx"
version = "1.0.94"
@@ -1639,7 +1706,7 @@ version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"hashbrown",
"lock_api",
"once_cell",
@@ -1656,7 +1723,7 @@ dependencies = [
"deadpool-runtime",
"num_cpus",
"retain_mut",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -1698,7 +1765,7 @@ dependencies = [
"bitflags 2.3.1",
"byteorder",
"diesel_derives",
- "itoa",
+ "itoa 1.0.6",
"pq-sys",
"r2d2",
"serde_json",
@@ -1743,6 +1810,17 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af83450b771231745d43edf36dc9b7813ab83be5e8cbea344ccced1a09dfebcd"
+[[package]]
+name = "dirs"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
+dependencies = [
+ "libc",
+ "redox_users 0.3.5",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "dirs"
version = "4.0.0"
@@ -1759,8 +1837,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
- "redox_users",
- "winapi",
+ "redox_users 0.4.3",
+ "winapi 0.3.9",
]
[[package]]
@@ -1789,7 +1867,7 @@ dependencies = [
"serde_path_to_error",
"storage_models",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -1804,13 +1882,19 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
+[[package]]
+name = "encode_unicode"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+
[[package]]
name = "encoding_rs"
version = "0.8.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -1891,7 +1975,7 @@ dependencies = [
"router_env",
"serde",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -1915,13 +1999,13 @@ dependencies = [
"futures-core",
"futures-util",
"http",
- "hyper",
+ "hyper 0.14.26",
"hyper-rustls",
"mime",
"serde",
"serde_json",
"time 0.3.21",
- "tokio",
+ "tokio 1.28.2",
"url",
"webdriver",
]
@@ -1993,9 +2077,9 @@ dependencies = [
"arc-swap",
"arcstr",
"async-trait",
- "bytes",
+ "bytes 1.4.0",
"bytes-utils",
- "cfg-if",
+ "cfg-if 1.0.0",
"float-cmp",
"futures",
"lazy_static",
@@ -2004,11 +2088,11 @@ dependencies = [
"pretty_env_logger",
"rand 0.8.5",
"redis-protocol",
- "semver",
+ "semver 1.0.17",
"sha-1",
- "tokio",
+ "tokio 1.28.2",
"tokio-stream",
- "tokio-util",
+ "tokio-util 0.7.8",
"tracing",
"tracing-futures",
"url",
@@ -2078,6 +2162,22 @@ dependencies = [
"syn 1.0.109",
]
+[[package]]
+name = "fuchsia-zircon"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
+dependencies = [
+ "bitflags 1.3.2",
+ "fuchsia-zircon-sys",
+]
+
+[[package]]
+name = "fuchsia-zircon-sys"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
+
[[package]]
name = "futures"
version = "0.3.28"
@@ -2137,7 +2237,7 @@ dependencies = [
"futures-io",
"memchr",
"parking",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"waker-fn",
]
@@ -2183,7 +2283,7 @@ dependencies = [
"futures-sink",
"futures-task",
"memchr",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"pin-utils",
"slab",
]
@@ -2214,7 +2314,7 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
@@ -2225,7 +2325,7 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
]
@@ -2249,13 +2349,33 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+[[package]]
+name = "h2"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535"
+dependencies = [
+ "bytes 0.5.6",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "futures-util",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio 0.2.25",
+ "tokio-util 0.3.1",
+ "tracing",
+ "tracing-futures",
+]
+
[[package]]
name = "h2"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"fnv",
"futures-core",
"futures-sink",
@@ -2263,8 +2383,8 @@ dependencies = [
"http",
"indexmap",
"slab",
- "tokio",
- "tokio-util",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
"tracing",
]
@@ -2328,9 +2448,19 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"fnv",
- "itoa",
+ "itoa 1.0.6",
+]
+
+[[package]]
+name = "http-body"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
+dependencies = [
+ "bytes 0.5.6",
+ "http",
]
[[package]]
@@ -2339,9 +2469,9 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"http",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
]
[[package]]
@@ -2356,7 +2486,7 @@ dependencies = [
"futures-lite",
"http",
"infer 0.2.3",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rand 0.7.3",
"serde",
"serde_json",
@@ -2371,6 +2501,12 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
+[[package]]
+name = "httpdate"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
+
[[package]]
name = "httpdate"
version = "1.0.2"
@@ -2386,25 +2522,49 @@ dependencies = [
"quick-error",
]
+[[package]]
+name = "hyper"
+version = "0.13.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb"
+dependencies = [
+ "bytes 0.5.6",
+ "futures-channel",
+ "futures-core",
+ "futures-util",
+ "h2 0.2.7",
+ "http",
+ "http-body 0.3.1",
+ "httparse",
+ "httpdate 0.3.2",
+ "itoa 0.4.8",
+ "pin-project",
+ "socket2 0.3.19",
+ "tokio 0.2.25",
+ "tower-service",
+ "tracing",
+ "want",
+]
+
[[package]]
name = "hyper"
version = "0.14.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"futures-channel",
"futures-core",
"futures-util",
- "h2",
+ "h2 0.3.19",
"http",
- "http-body",
+ "http-body 0.4.5",
"httparse",
- "httpdate",
- "itoa",
- "pin-project-lite",
- "socket2",
- "tokio",
+ "httpdate 1.0.2",
+ "itoa 1.0.6",
+ "pin-project-lite 0.2.9",
+ "socket2 0.4.9",
+ "tokio 1.28.2",
"tower-service",
"tracing",
"want",
@@ -2417,11 +2577,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"
dependencies = [
"http",
- "hyper",
+ "hyper 0.14.26",
"log",
"rustls",
"rustls-native-certs",
- "tokio",
+ "tokio 1.28.2",
"tokio-rustls",
]
@@ -2431,22 +2591,35 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
- "hyper",
- "pin-project-lite",
- "tokio",
+ "hyper 0.14.26",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
"tokio-io-timeout",
]
+[[package]]
+name = "hyper-tls"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed"
+dependencies = [
+ "bytes 0.5.6",
+ "hyper 0.13.10",
+ "native-tls",
+ "tokio 0.2.25",
+ "tokio-tls",
+]
+
[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
- "bytes",
- "hyper",
+ "bytes 1.4.0",
+ "hyper 0.14.26",
"native-tls",
- "tokio",
+ "tokio 1.28.2",
"tokio-native-tls",
]
@@ -2522,7 +2695,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -2536,6 +2709,15 @@ dependencies = [
"windows-sys 0.48.0",
]
+[[package]]
+name = "iovec"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "ipnet"
version = "2.7.2"
@@ -2551,6 +2733,12 @@ dependencies = [
"either",
]
+[[package]]
+name = "itoa"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
+
[[package]]
name = "itoa"
version = "1.0.6"
@@ -2618,6 +2806,16 @@ dependencies = [
"simple_asn1",
]
+[[package]]
+name = "kernel32-sys"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
+]
+
[[package]]
name = "language-tags"
version = "0.3.2"
@@ -2737,7 +2935,7 @@ version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
]
[[package]]
@@ -2758,11 +2956,17 @@ dependencies = [
"libc",
]
+[[package]]
+name = "maplit"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
+
[[package]]
name = "masking"
version = "0.1.0"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"diesel",
"serde",
"serde_json",
@@ -2793,7 +2997,7 @@ checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00"
dependencies = [
"actix-web",
"futures-util",
- "itoa",
+ "itoa 1.0.6",
"maud_macros",
]
@@ -2879,6 +3083,25 @@ dependencies = [
"adler",
]
+[[package]]
+name = "mio"
+version = "0.6.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
+dependencies = [
+ "cfg-if 0.1.10",
+ "fuchsia-zircon",
+ "fuchsia-zircon-sys",
+ "iovec",
+ "kernel32-sys",
+ "libc",
+ "log",
+ "miow",
+ "net2",
+ "slab",
+ "winapi 0.2.8",
+]
+
[[package]]
name = "mio"
version = "0.8.6"
@@ -2891,6 +3114,18 @@ dependencies = [
"windows-sys 0.45.0",
]
+[[package]]
+name = "miow"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
+dependencies = [
+ "kernel32-sys",
+ "net2",
+ "winapi 0.2.8",
+ "ws2_32-sys",
+]
+
[[package]]
name = "moka"
version = "0.10.2"
@@ -2944,6 +3179,17 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "net2"
+version = "0.2.38"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631"
+dependencies = [
+ "cfg-if 0.1.10",
+ "libc",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "nom"
version = "7.1.3"
@@ -2961,7 +3207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -3005,6 +3251,30 @@ dependencies = [
"libc",
]
+[[package]]
+name = "oas3"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f8d29c198db98412285776c0ff6acdf24b26591730ace3580d1afe9edcbde07"
+dependencies = [
+ "bytes 0.5.6",
+ "colored",
+ "derive_more",
+ "http",
+ "lazy_static",
+ "log",
+ "maplit",
+ "prettytable-rs",
+ "regex",
+ "reqwest 0.10.10",
+ "semver 0.11.0",
+ "serde",
+ "serde_derive",
+ "serde_json",
+ "serde_yaml",
+ "url",
+]
+
[[package]]
name = "once_cell"
version = "1.17.1"
@@ -3018,7 +3288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56"
dependencies = [
"bitflags 1.3.2",
- "cfg-if",
+ "cfg-if 1.0.0",
"foreign-types",
"libc",
"once_cell",
@@ -3077,7 +3347,7 @@ dependencies = [
"opentelemetry-proto",
"prost",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
"tonic",
]
@@ -3104,7 +3374,7 @@ dependencies = [
"indexmap",
"js-sys",
"once_cell",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"thiserror",
]
@@ -3125,7 +3395,7 @@ dependencies = [
"percent-encoding",
"rand 0.8.5",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
"tokio-stream",
]
@@ -3173,7 +3443,7 @@ version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"libc",
"redox_syscall 0.2.16",
"smallvec",
@@ -3277,6 +3547,12 @@ dependencies = [
"syn 2.0.18",
]
+[[package]]
+name = "pin-project-lite"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"
+
[[package]]
name = "pin-project-lite"
version = "0.2.9"
@@ -3303,11 +3579,11 @@ checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa"
dependencies = [
"autocfg",
"bitflags 1.3.2",
- "cfg-if",
+ "cfg-if 1.0.0",
"concurrent-queue",
"libc",
"log",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"windows-sys 0.48.0",
]
@@ -3336,6 +3612,20 @@ dependencies = [
"log",
]
+[[package]]
+name = "prettytable-rs"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fd04b170004fa2daccf418a7f8253aaf033c27760b5f225889024cf66d7ac2e"
+dependencies = [
+ "atty",
+ "csv",
+ "encode_unicode",
+ "lazy_static",
+ "term",
+ "unicode-width",
+]
+
[[package]]
name = "proc-macro-error"
version = "1.0.4"
@@ -3401,7 +3691,7 @@ version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"prost-derive",
]
@@ -3442,7 +3732,7 @@ dependencies = [
"raw-cpuid",
"wasi 0.11.0+wasi-snapshot-preview1",
"web-sys",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -3576,7 +3866,7 @@ version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c31deddf734dc0a39d3112e73490e88b61a05e83e074d211f348404cee4d2c6"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"bytes-utils",
"cookie-factory",
"crc16",
@@ -3596,9 +3886,15 @@ dependencies = [
"router_env",
"serde",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
]
+[[package]]
+name = "redox_syscall"
+version = "0.1.57"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
+
[[package]]
name = "redox_syscall"
version = "0.2.16"
@@ -3617,6 +3913,17 @@ dependencies = [
"bitflags 1.3.2",
]
+[[package]]
+name = "redox_users"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d"
+dependencies = [
+ "getrandom 0.1.16",
+ "redox_syscall 0.1.57",
+ "rust-argon2",
+]
+
[[package]]
name = "redox_users"
version = "0.4.3"
@@ -3660,6 +3967,42 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
+[[package]]
+name = "reqwest"
+version = "0.10.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c"
+dependencies = [
+ "base64 0.13.1",
+ "bytes 0.5.6",
+ "encoding_rs",
+ "futures-core",
+ "futures-util",
+ "http",
+ "http-body 0.3.1",
+ "hyper 0.13.10",
+ "hyper-tls 0.4.3",
+ "ipnet",
+ "js-sys",
+ "lazy_static",
+ "log",
+ "mime",
+ "mime_guess",
+ "native-tls",
+ "percent-encoding",
+ "pin-project-lite 0.2.9",
+ "serde",
+ "serde_json",
+ "serde_urlencoded",
+ "tokio 0.2.25",
+ "tokio-tls",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+ "winreg 0.7.0",
+]
+
[[package]]
name = "reqwest"
version = "0.11.18"
@@ -3668,15 +4011,15 @@ checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55"
dependencies = [
"async-compression",
"base64 0.21.2",
- "bytes",
+ "bytes 1.4.0",
"encoding_rs",
"futures-core",
"futures-util",
- "h2",
+ "h2 0.3.19",
"http",
- "http-body",
- "hyper",
- "hyper-tls",
+ "http-body 0.4.5",
+ "hyper 0.14.26",
+ "hyper-tls 0.5.0",
"ipnet",
"js-sys",
"log",
@@ -3685,19 +4028,19 @@ dependencies = [
"native-tls",
"once_cell",
"percent-encoding",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"serde",
"serde_json",
"serde_urlencoded",
- "tokio",
+ "tokio 1.28.2",
"tokio-native-tls",
- "tokio-util",
+ "tokio-util 0.7.8",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "winreg",
+ "winreg 0.10.1",
]
[[package]]
@@ -3718,7 +4061,7 @@ dependencies = [
"spin",
"untrusted",
"web-sys",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -3751,7 +4094,7 @@ dependencies = [
"base64 0.21.2",
"bb8",
"blake3",
- "bytes",
+ "bytes 1.4.0",
"cards",
"clap",
"common_utils",
@@ -3779,11 +4122,12 @@ dependencies = [
"moka",
"nanoid",
"num_cpus",
+ "oas3",
"once_cell",
"rand 0.8.5",
"redis_interface",
"regex",
- "reqwest",
+ "reqwest 0.11.18",
"ring",
"router_derive",
"router_env",
@@ -3801,7 +4145,7 @@ dependencies = [
"thirtyfour",
"thiserror",
"time 0.3.21",
- "tokio",
+ "tokio 1.28.2",
"toml 0.7.4",
"url",
"utoipa",
@@ -3840,7 +4184,7 @@ dependencies = [
"serde_path_to_error",
"strum",
"time 0.3.21",
- "tokio",
+ "tokio 1.28.2",
"tracing",
"tracing-actix-web",
"tracing-appender",
@@ -3850,6 +4194,18 @@ dependencies = [
"vergen",
]
+[[package]]
+name = "rust-argon2"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
+dependencies = [
+ "base64 0.13.1",
+ "blake2b_simd",
+ "constant_time_eq 0.1.5",
+ "crossbeam-utils",
+]
+
[[package]]
name = "rust-embed"
version = "6.6.1"
@@ -3891,7 +4247,7 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"ordered-multimap",
]
@@ -3907,7 +4263,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
- "semver",
+ "semver 1.0.17",
]
[[package]]
@@ -4053,6 +4409,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "semver"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
+dependencies = [
+ "semver-parser",
+]
+
[[package]]
name = "semver"
version = "1.0.17"
@@ -4062,6 +4427,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "semver-parser"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
+dependencies = [
+ "pest",
+]
+
[[package]]
name = "serde"
version = "1.0.163"
@@ -4089,7 +4463,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
dependencies = [
"indexmap",
- "itoa",
+ "itoa 1.0.6",
"ryu",
"serde",
]
@@ -4161,7 +4535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [
"form_urlencoded",
- "itoa",
+ "itoa 1.0.6",
"ryu",
"serde",
]
@@ -4194,6 +4568,18 @@ dependencies = [
"syn 2.0.18",
]
+[[package]]
+name = "serde_yaml"
+version = "0.8.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
+dependencies = [
+ "indexmap",
+ "ryu",
+ "serde",
+ "yaml-rust",
+]
+
[[package]]
name = "serial_test"
version = "2.0.0"
@@ -4225,7 +4611,7 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest",
]
@@ -4236,7 +4622,7 @@ version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest",
]
@@ -4247,7 +4633,7 @@ version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"cpufeatures",
"digest",
]
@@ -4267,7 +4653,7 @@ version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4"
dependencies = [
- "dirs",
+ "dirs 4.0.0",
]
[[package]]
@@ -4298,7 +4684,7 @@ dependencies = [
"futures-core",
"libc",
"signal-hook",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -4343,6 +4729,17 @@ version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
+[[package]]
+name = "socket2"
+version = "0.3.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
+dependencies = [
+ "cfg-if 1.0.0",
+ "libc",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "socket2"
version = "0.4.9"
@@ -4350,7 +4747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
dependencies = [
"libc",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -4465,13 +4862,24 @@ version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"fastrand",
"redox_syscall 0.3.5",
"rustix",
"windows-sys 0.45.0",
]
+[[package]]
+name = "term"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42"
+dependencies = [
+ "byteorder",
+ "dirs 1.0.5",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "termcolor"
version = "1.2.0"
@@ -4502,7 +4910,7 @@ dependencies = [
"stringmatch",
"thirtyfour-macros",
"thiserror",
- "tokio",
+ "tokio 1.28.2",
"url",
"urlparse",
]
@@ -4545,7 +4953,7 @@ version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"once_cell",
]
@@ -4557,7 +4965,7 @@ checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -4566,7 +4974,7 @@ version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
dependencies = [
- "itoa",
+ "itoa 1.0.6",
"serde",
"time-core",
"time-macros",
@@ -4602,6 +5010,23 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+[[package]]
+name = "tokio"
+version = "0.2.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092"
+dependencies = [
+ "bytes 0.5.6",
+ "fnv",
+ "futures-core",
+ "iovec",
+ "lazy_static",
+ "memchr",
+ "mio 0.6.23",
+ "pin-project-lite 0.1.12",
+ "slab",
+]
+
[[package]]
name = "tokio"
version = "1.28.2"
@@ -4609,14 +5034,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
dependencies = [
"autocfg",
- "bytes",
+ "bytes 1.4.0",
"libc",
- "mio",
+ "mio 0.8.6",
"num_cpus",
"parking_lot",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"signal-hook-registry",
- "socket2",
+ "socket2 0.4.9",
"tokio-macros",
"windows-sys 0.48.0",
]
@@ -4627,8 +5052,8 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
dependencies = [
- "pin-project-lite",
- "tokio",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
]
[[package]]
@@ -4649,7 +5074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
- "tokio",
+ "tokio 1.28.2",
]
[[package]]
@@ -4659,7 +5084,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
dependencies = [
"rustls",
- "tokio",
+ "tokio 1.28.2",
"webpki",
]
@@ -4670,8 +5095,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
dependencies = [
"futures-core",
- "pin-project-lite",
- "tokio",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
+]
+
+[[package]]
+name = "tokio-tls"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343"
+dependencies = [
+ "native-tls",
+ "tokio 0.2.25",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
+dependencies = [
+ "bytes 0.5.6",
+ "futures-core",
+ "futures-sink",
+ "log",
+ "pin-project-lite 0.1.12",
+ "tokio 0.2.25",
]
[[package]]
@@ -4680,11 +5129,11 @@ version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d"
dependencies = [
- "bytes",
+ "bytes 1.4.0",
"futures-core",
"futures-sink",
- "pin-project-lite",
- "tokio",
+ "pin-project-lite 0.2.9",
+ "tokio 1.28.2",
"tracing",
]
@@ -4741,21 +5190,21 @@ dependencies = [
"async-trait",
"axum",
"base64 0.13.1",
- "bytes",
+ "bytes 1.4.0",
"futures-core",
"futures-util",
- "h2",
+ "h2 0.3.19",
"http",
- "http-body",
- "hyper",
+ "http-body 0.4.5",
+ "hyper 0.14.26",
"hyper-timeout",
"percent-encoding",
"pin-project",
"prost",
"prost-derive",
- "tokio",
+ "tokio 1.28.2",
"tokio-stream",
- "tokio-util",
+ "tokio-util 0.7.8",
"tower",
"tower-layer",
"tower-service",
@@ -4773,11 +5222,11 @@ dependencies = [
"futures-util",
"indexmap",
"pin-project",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"rand 0.8.5",
"slab",
- "tokio",
- "tokio-util",
+ "tokio 1.28.2",
+ "tokio-util 0.7.8",
"tower-layer",
"tower-service",
"tracing",
@@ -4801,9 +5250,9 @@ version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"log",
- "pin-project-lite",
+ "pin-project-lite 0.2.9",
"tracing-attributes",
"tracing-core",
]
@@ -5174,7 +5623,9 @@ version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
+ "serde",
+ "serde_json",
"wasm-bindgen-macro",
]
@@ -5199,7 +5650,7 @@ version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
dependencies = [
- "cfg-if",
+ "cfg-if 1.0.0",
"js-sys",
"wasm-bindgen",
"web-sys",
@@ -5251,7 +5702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9973cb72c8587d5ad5efdb91e663d36177dc37725e6c90ca86c626b0cc45c93f"
dependencies = [
"base64 0.13.1",
- "bytes",
+ "bytes 1.4.0",
"cookie",
"http",
"log",
@@ -5282,6 +5733,12 @@ dependencies = [
"webpki",
]
+[[package]]
+name = "winapi"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -5292,6 +5749,12 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
+[[package]]
+name = "winapi-build"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
+
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
@@ -5304,7 +5767,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -5478,13 +5941,22 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "winreg"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
+dependencies = [
+ "winapi 0.3.9",
+]
+
[[package]]
name = "winreg"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
dependencies = [
- "winapi",
+ "winapi 0.3.9",
]
[[package]]
@@ -5500,13 +5972,23 @@ dependencies = [
"futures",
"futures-timer",
"http-types",
- "hyper",
+ "hyper 0.14.26",
"log",
"once_cell",
"regex",
"serde",
"serde_json",
- "tokio",
+ "tokio 1.28.2",
+]
+
+[[package]]
+name = "ws2_32-sys"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
+dependencies = [
+ "winapi 0.2.8",
+ "winapi-build",
]
[[package]]
diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs
index 7e4962a895e..05e2a1307de 100644
--- a/crates/api_models/src/customers.rs
+++ b/crates/api_models/src/customers.rs
@@ -15,13 +15,13 @@ pub struct CustomerRequest {
#[serde(default = "unknown_merchant", skip)]
pub merchant_id: String,
/// The customer's name
- #[schema(max_length = 255, example = "Jon Test")]
+ #[schema(max_length = 255, value_type = Option<String>, example = "Jon Test")]
pub name: Option<Secret<String>>,
/// The customer's email address
- #[schema(value_type = Option<String>,max_length = 255, example = "[email protected]")]
+ #[schema(value_type = Option<String>, max_length = 255, example = "[email protected]")]
pub email: Option<pii::Email>,
/// The customer's phone number
- #[schema(value_type = Option<String>,max_length = 255, example = "9999999999")]
+ #[schema(value_type = Option<String>, max_length = 255, example = "9999999999")]
pub phone: Option<Secret<String>>,
/// An arbitrary string that you can attach to a customer object.
#[schema(max_length = 255, example = "First Customer")]
@@ -55,7 +55,7 @@ pub struct CustomerResponse {
#[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
pub customer_id: String,
/// The customer's name
- #[schema(max_length = 255, example = "Jon Test")]
+ #[schema(max_length = 255, value_type = Option<String>, example = "Jon Test")]
pub name: crypto::OptionalEncryptableName,
/// The customer's email address
#[schema(value_type = Option<String>,max_length = 255, example = "[email protected]")]
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 4815b19ad2d..8f52619c5d0 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -726,14 +726,20 @@ pub enum BankRedirectData {
},
}
-#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AchBillingDetails {
+ /// The Email ID for ACH billing
+ #[schema(value_type = String, example = "[email protected]")]
pub email: Email,
}
-#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SepaAndBacsBillingDetails {
+ /// The Email ID for SEPA and BACS billing
+ #[schema(value_type = String, example = "[email protected]")]
pub email: Email,
+ /// The billing name for SEPA and BACS billing
+ #[schema(value_type = String, example = "Jane Doe")]
pub name: Secret<String>,
}
@@ -762,13 +768,19 @@ pub struct BankRedirectBilling {
#[serde(rename_all = "snake_case")]
pub enum BankTransferData {
AchBankTransfer {
+ /// The billing details for ACH Bank Transfer
billing_details: AchBillingDetails,
},
SepaBankTransfer {
+ /// The billing details for SEPA
billing_details: SepaAndBacsBillingDetails,
+
+ /// The two-letter ISO country code for SEPA and BACS
+ #[schema(value_type = CountryAlpha2, example = "US")]
country: api_enums::CountryAlpha2,
},
BacsBankTransfer {
+ /// The billing details for SEPA
billing_details: SepaAndBacsBillingDetails,
},
}
@@ -1082,48 +1094,65 @@ pub enum NextActionData {
},
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct BankTransferNextStepsData {
+ /// The instructions for performing a bank transfer
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
+ /// The details received by the receiver
pub receiver: ReceiverDetails,
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferInstructions {
+ /// The credit transfer for ACH transactions
AchCreditTransfer(Box<AchTransfer>),
+ /// The instructions for SEPA bank transactions
SepaBankInstructions(Box<SepaBankTransferInstructions>),
+ /// The instructions for BACS bank transactions
BacsBankInstructions(Box<BacsBankTransferInstructions>),
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SepaBankTransferInstructions {
+ #[schema(value_type = String, example = "Jane Doe")]
pub account_holder_name: Secret<String>,
+ #[schema(value_type = String, example = "1024419982")]
pub bic: Secret<String>,
pub country: String,
+ #[schema(value_type = String, example = "123456789")]
pub iban: Secret<String>,
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BacsBankTransferInstructions {
+ #[schema(value_type = String, example = "Jane Doe")]
pub account_holder_name: Secret<String>,
+ #[schema(value_type = String, example = "10244123908")]
pub account_number: Secret<String>,
+ #[schema(value_type = String, example = "012")]
pub sort_code: Secret<String>,
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct AchTransfer {
+ #[schema(value_type = String, example = "122385736258")]
pub account_number: Secret<String>,
pub bank_name: String,
+ #[schema(value_type = String, example = "012")]
pub routing_number: Secret<String>,
+ #[schema(value_type = String, example = "234")]
pub swift_code: Secret<String>,
}
-#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ReceiverDetails {
+ /// The amount received by receiver
amount_received: i64,
+ /// The amount charged by ACH
amount_charged: Option<i64>,
+ /// The amount remaining to be sent via ACH
amount_remaining: Option<i64>,
}
@@ -1296,7 +1325,7 @@ pub struct PaymentsResponse {
pub connector_label: Option<String>,
/// The business country of merchant for this payment
- #[schema(value_type = CountryAlpha2)]
+ #[schema(value_type = CountryAlpha2, example = "US")]
pub business_country: api_enums::CountryAlpha2,
/// The business label of merchant for this payment
@@ -1563,6 +1592,7 @@ pub struct Metadata {
pub order_category: Option<String>,
/// Redirection response coming in request as metadata field only for redirection scenarios
+ #[schema(value_type = Option<RedirectResponse>)]
pub redirect_response: Option<RedirectResponse>,
/// Allowed payment method types for a payment intent
@@ -1572,6 +1602,7 @@ pub struct Metadata {
#[derive(Default, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct RedirectResponse {
+ #[schema(value_type = Option<String>)]
pub param: Option<Secret<String>>,
#[schema(value_type = Option<Object>)]
pub json_payload: Option<pii::SecretSerdeValue>,
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 254503f57d4..3f29ca2408a 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -22,7 +22,7 @@ olap = []
oltp = []
kv_store = []
accounts_cache = []
-openapi = ["olap", "oltp"]
+openapi = ["olap", "oltp", "dep:oas3"]
vergen = ["router_env/vergen"]
multiple_mca = ["api_models/multiple_mca"]
dummy_connector = ["api_models/dummy_connector"]
@@ -62,6 +62,7 @@ mime = "0.3.17"
moka = { version = "0.10", features = ["future"] }
nanoid = "0.4.0"
num_cpus = "1.15.0"
+oas3 = { version = "0.2.1", optional = true }
once_cell = "1.17.1"
rand = "0.8.5"
regex = "1.7.3"
diff --git a/crates/router/src/bin/router.rs b/crates/router/src/bin/router.rs
index 02ff2c241ef..da8880146f5 100644
--- a/crates/router/src/bin/router.rs
+++ b/crates/router/src/bin/router.rs
@@ -13,13 +13,13 @@ async fn main() -> ApplicationResult<()> {
{
use router::configs::settings::Subcommand;
if let Some(Subcommand::GenerateOpenapiSpec) = cmd_line.subcommand {
- let file_path = "openapi/generated.json";
+ let file_path = "openapi/openapi_spec.json";
#[allow(clippy::expect_used)]
std::fs::write(
file_path,
<router::openapi::ApiDoc as utoipa::OpenApi>::openapi()
.to_pretty_json()
- .expect("Failed to generate serialize OpenAPI specification as JSON"),
+ .expect("Failed to serialize OpenAPI specification as JSON"),
)
.expect("Failed to write OpenAPI specification to file");
println!("Successfully saved OpenAPI specification file at '{file_path}'");
diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs
index 03316ae05a3..183ed60cf2e 100644
--- a/crates/router/src/openapi.rs
+++ b/crates/router/src/openapi.rs
@@ -222,6 +222,16 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsCancelRequest,
api_models::payments::PaymentListConstraints,
api_models::payments::PaymentListResponse,
+ api_models::payments::BankTransferData,
+ api_models::payments::BankTransferNextStepsData,
+ api_models::payments::SepaAndBacsBillingDetails,
+ api_models::payments::AchBillingDetails,
+ api_models::payments::BankTransferInstructions,
+ api_models::payments::ReceiverDetails,
+ api_models::payments::AchTransfer,
+ api_models::payments::SepaBankTransferInstructions,
+ api_models::payments::BacsBankTransferInstructions,
+ api_models::payments::RedirectResponse,
api_models::refunds::RefundListRequest,
api_models::refunds::RefundListResponse,
api_models::mandates::MandateRevokedResponse,
diff --git a/openapi/generated.json b/openapi/openapi_spec.json
similarity index 88%
rename from openapi/generated.json
rename to openapi/openapi_spec.json
index 711f1cba104..8b813817436 100644
--- a/openapi/generated.json
+++ b/openapi/openapi_spec.json
@@ -22,7 +22,9 @@
"paths": {
"/account/payment_methods": {
"get": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "List payment methods for a Merchant",
"description": "List payment methods for a Merchant\n\nTo filter and list the applicable payment methods for a particular Merchant ID",
"operationId": "List all Payment Methods for a Merchant",
@@ -129,7 +131,9 @@
},
"/customer/{customer_id}/payment_methods": {
"get": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "List payment methods for a Customer",
"description": "List payment methods for a Customer\n\nTo filter and list the applicable payment methods for a particular Customer ID",
"operationId": "List all Payment Methods for a Customer",
@@ -236,7 +240,9 @@
},
"/customers": {
"post": {
- "tags": ["Customers"],
+ "tags": [
+ "Customers"
+ ],
"summary": "Create Customer",
"description": "Create Customer\n\nCreate a customer object and store the customer details to be reused for future payments. Incase the customer already exists in the system, this API will respond with the customer details.",
"operationId": "Create a Customer",
@@ -274,7 +280,9 @@
},
"/customers/{customer_id}": {
"get": {
- "tags": ["Customers"],
+ "tags": [
+ "Customers"
+ ],
"summary": "Retrieve Customer",
"description": "Retrieve Customer\n\nRetrieve a customer's details.",
"operationId": "Retrieve a Customer",
@@ -314,7 +322,9 @@
]
},
"post": {
- "tags": ["Customers"],
+ "tags": [
+ "Customers"
+ ],
"summary": "Update Customer",
"description": "Update Customer\n\nUpdates the customer's details in a customer object.",
"operationId": "Update a Customer",
@@ -361,7 +371,9 @@
]
},
"delete": {
- "tags": ["Customers"],
+ "tags": [
+ "Customers"
+ ],
"summary": "Delete Customer",
"description": "Delete Customer\n\nDelete a customer record.",
"operationId": "Delete a Customer",
@@ -400,7 +412,9 @@
},
"/disputes/list": {
"get": {
- "tags": ["Disputes"],
+ "tags": [
+ "Disputes"
+ ],
"summary": "Disputes - List Disputes",
"description": "Disputes - List Disputes",
"operationId": "List Disputes",
@@ -547,7 +561,9 @@
},
"/disputes/{dispute_id}": {
"get": {
- "tags": ["Disputes"],
+ "tags": [
+ "Disputes"
+ ],
"summary": "Disputes - Retrieve Dispute",
"description": "Disputes - Retrieve Dispute",
"operationId": "Retrieve a Dispute",
@@ -586,7 +602,9 @@
},
"/mandates/revoke/{mandate_id}": {
"post": {
- "tags": ["Mandates"],
+ "tags": [
+ "Mandates"
+ ],
"summary": "Mandates - Revoke Mandate",
"description": "Mandates - Revoke Mandate\n\nRevoke a mandate",
"operationId": "Revoke a Mandate",
@@ -625,7 +643,9 @@
},
"/mandates/{mandate_id}": {
"get": {
- "tags": ["Mandates"],
+ "tags": [
+ "Mandates"
+ ],
"summary": "Mandates - Retrieve Mandate",
"description": "Mandates - Retrieve Mandate\n\nRetrieve a mandate",
"operationId": "Retrieve a Mandate",
@@ -664,7 +684,9 @@
},
"/payment_methods": {
"post": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "PaymentMethods - Create",
"description": "PaymentMethods - Create\n\nTo create a payment method against a customer object. In case of cards, this API could be used only by PCI compliant merchants",
"operationId": "Create a Payment Method",
@@ -702,7 +724,9 @@
},
"/payment_methods/{method_id}": {
"get": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "Payment Method - Retrieve",
"description": "Payment Method - Retrieve\n\nTo retrieve a payment method",
"operationId": "Retrieve a Payment method",
@@ -739,7 +763,9 @@
]
},
"post": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "Payment Method - Update",
"description": "Payment Method - Update\n\nTo update an existing payment method attached to a customer object. This API is useful for use cases such as updating the card number for expired cards to prevent discontinuity in recurring payments",
"operationId": "Update a Payment method",
@@ -786,7 +812,9 @@
]
},
"delete": {
- "tags": ["Payment Methods"],
+ "tags": [
+ "Payment Methods"
+ ],
"summary": "Payment Method - Delete",
"description": "Payment Method - Delete\n\nDelete payment method",
"operationId": "Delete a Payment method",
@@ -825,7 +853,9 @@
},
"/payments": {
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Create",
"description": "Payments - Create\n\nTo 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",
"operationId": "Create a Payment",
@@ -863,7 +893,9 @@
},
"/payments/list": {
"get": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - List",
"description": "Payments - List\n\nTo list the payments",
"operationId": "List all Payments",
@@ -973,7 +1005,9 @@
},
"/payments/session_tokens": {
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Session token",
"description": "Payments - Session token\n\nTo create the session object or to get session token for wallets",
"operationId": "Create Session tokens for a Payment",
@@ -1011,7 +1045,9 @@
},
"/payments/{payment_id}": {
"get": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Retrieve",
"description": "Payments - Retrieve\n\nTo 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",
"operationId": "Retrieve a Payment",
@@ -1061,7 +1097,9 @@
]
},
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Update",
"description": "Payments - Update\n\nTo update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created",
"operationId": "Update a Payment",
@@ -1113,7 +1151,9 @@
},
"/payments/{payment_id}/cancel": {
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Cancel",
"description": "Payments - Cancel\n\nA Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action",
"operationId": "Cancel a Payment",
@@ -1155,7 +1195,9 @@
},
"/payments/{payment_id}/capture": {
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Capture",
"description": "Payments - Capture\n\nTo capture the funds for an uncaptured payment",
"operationId": "Capture a Payment",
@@ -1204,7 +1246,9 @@
},
"/payments/{payment_id}/confirm": {
"post": {
- "tags": ["Payments"],
+ "tags": [
+ "Payments"
+ ],
"summary": "Payments - Confirm",
"description": "Payments - Confirm\n\nThis 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",
"operationId": "Confirm a Payment",
@@ -1256,7 +1300,9 @@
},
"/refunds": {
"post": {
- "tags": ["Refunds"],
+ "tags": [
+ "Refunds"
+ ],
"summary": "Refunds - Create",
"description": "Refunds - Create\n\nTo create a refund against an already processed payment",
"operationId": "Create a Refund",
@@ -1294,7 +1340,9 @@
},
"/refunds/list": {
"get": {
- "tags": ["Refunds"],
+ "tags": [
+ "Refunds"
+ ],
"summary": "Refunds - List",
"description": "Refunds - List\n\nTo list the refunds associated with a payment_id or with the merchant, if payment_id is not provided",
"operationId": "List all Refunds",
@@ -1390,7 +1438,9 @@
},
"/refunds/{refund_id}": {
"get": {
- "tags": ["Refunds"],
+ "tags": [
+ "Refunds"
+ ],
"summary": "Refunds - Retrieve (GET)",
"description": "Refunds - Retrieve (GET)\n\nTo 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",
"operationId": "Retrieve a Refund",
@@ -1427,7 +1477,9 @@
]
},
"post": {
- "tags": ["Refunds"],
+ "tags": [
+ "Refunds"
+ ],
"summary": "Refunds - Update",
"description": "Refunds - Update\n\nTo update the properties of a Refund object. This may include attaching a reason for the refund or metadata fields",
"operationId": "Update a Refund",
@@ -1479,17 +1531,25 @@
"schemas": {
"AcceptanceType": {
"type": "string",
- "enum": ["online", "offline"]
+ "enum": [
+ "online",
+ "offline"
+ ]
},
"AcceptedCountries": {
"oneOf": [
{
"type": "object",
- "required": ["type", "list"],
+ "required": [
+ "type",
+ "list"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["enable_only"]
+ "enum": [
+ "enable_only"
+ ]
},
"list": {
"type": "array",
@@ -1501,11 +1561,16 @@
},
{
"type": "object",
- "required": ["type", "list"],
+ "required": [
+ "type",
+ "list"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["disable_only"]
+ "enum": [
+ "disable_only"
+ ]
},
"list": {
"type": "array",
@@ -1517,11 +1582,15 @@
},
{
"type": "object",
- "required": ["type"],
+ "required": [
+ "type"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["all_accepted"]
+ "enum": [
+ "all_accepted"
+ ]
}
}
}
@@ -1534,11 +1603,16 @@
"oneOf": [
{
"type": "object",
- "required": ["type", "list"],
+ "required": [
+ "type",
+ "list"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["enable_only"]
+ "enum": [
+ "enable_only"
+ ]
},
"list": {
"type": "array",
@@ -1550,11 +1624,16 @@
},
{
"type": "object",
- "required": ["type", "list"],
+ "required": [
+ "type",
+ "list"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["disable_only"]
+ "enum": [
+ "disable_only"
+ ]
},
"list": {
"type": "array",
@@ -1566,11 +1645,15 @@
},
{
"type": "object",
- "required": ["type"],
+ "required": [
+ "type"
+ ],
"properties": {
"type": {
"type": "string",
- "enum": ["all_accepted"]
+ "enum": [
+ "all_accepted"
+ ]
}
}
}
@@ -1579,6 +1662,45 @@
"propertyName": "type"
}
},
+ "AchBillingDetails": {
+ "type": "object",
+ "required": [
+ "email"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The Email ID for ACH billing",
+ "example": "[email protected]"
+ }
+ }
+ },
+ "AchTransfer": {
+ "type": "object",
+ "required": [
+ "account_number",
+ "bank_name",
+ "routing_number",
+ "swift_code"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "example": "122385736258"
+ },
+ "bank_name": {
+ "type": "string"
+ },
+ "routing_number": {
+ "type": "string",
+ "example": "012"
+ },
+ "swift_code": {
+ "type": "string",
+ "example": "234"
+ }
+ }
+ },
"Address": {
"type": "object",
"properties": {
@@ -1673,7 +1795,11 @@
},
"AmountInfo": {
"type": "object",
- "required": ["label", "type", "amount"],
+ "required": [
+ "label",
+ "type",
+ "amount"
+ ],
"properties": {
"label": {
"type": "string",
@@ -1693,7 +1819,9 @@
"oneOf": [
{
"type": "string",
- "enum": ["never"]
+ "enum": [
+ "never"
+ ]
},
{
"type": "string",
@@ -1832,7 +1960,11 @@
},
"ApplepayPaymentMethod": {
"type": "object",
- "required": ["display_name", "network", "type"],
+ "required": [
+ "display_name",
+ "network",
+ "type"
+ ],
"properties": {
"display_name": {
"type": "string",
@@ -1850,7 +1982,11 @@
},
"ApplepaySessionTokenResponse": {
"type": "object",
- "required": ["session_token_data", "payment_request_data", "connector"],
+ "required": [
+ "session_token_data",
+ "payment_request_data",
+ "connector"
+ ],
"properties": {
"session_token_data": {
"$ref": "#/components/schemas/ApplePaySessionResponse"
@@ -1865,11 +2001,39 @@
},
"AuthenticationType": {
"type": "string",
- "enum": ["three_ds", "no_three_ds"]
+ "enum": [
+ "three_ds",
+ "no_three_ds"
+ ]
+ },
+ "BacsBankTransferInstructions": {
+ "type": "object",
+ "required": [
+ "account_holder_name",
+ "account_number",
+ "sort_code"
+ ],
+ "properties": {
+ "account_holder_name": {
+ "type": "string",
+ "example": "Jane Doe"
+ },
+ "account_number": {
+ "type": "string",
+ "example": "10244123908"
+ },
+ "sort_code": {
+ "type": "string",
+ "example": "012"
+ }
+ }
},
"BankDebitBilling": {
"type": "object",
- "required": ["name", "email"],
+ "required": [
+ "name",
+ "email"
+ ],
"properties": {
"name": {
"type": "string",
@@ -1895,7 +2059,9 @@
"oneOf": [
{
"type": "object",
- "required": ["ach_bank_debit"],
+ "required": [
+ "ach_bank_debit"
+ ],
"properties": {
"ach_bank_debit": {
"type": "object",
@@ -1935,7 +2101,9 @@
},
{
"type": "object",
- "required": ["sepa_bank_debit"],
+ "required": [
+ "sepa_bank_debit"
+ ],
"properties": {
"sepa_bank_debit": {
"type": "object",
@@ -1964,11 +2132,17 @@
},
{
"type": "object",
- "required": ["becs_bank_debit"],
+ "required": [
+ "becs_bank_debit"
+ ],
"properties": {
"becs_bank_debit": {
"type": "object",
- "required": ["billing_details", "account_number", "bsb_number"],
+ "required": [
+ "billing_details",
+ "account_number",
+ "bsb_number"
+ ],
"properties": {
"billing_details": {
"$ref": "#/components/schemas/BankDebitBilling"
@@ -1989,7 +2163,9 @@
},
{
"type": "object",
- "required": ["bacs_bank_debit"],
+ "required": [
+ "bacs_bank_debit"
+ ],
"properties": {
"bacs_bank_debit": {
"type": "object",
@@ -2133,7 +2309,10 @@
},
"BankRedirectBilling": {
"type": "object",
- "required": ["billing_name", "email"],
+ "required": [
+ "billing_name",
+ "email"
+ ],
"properties": {
"billing_name": {
"type": "string",
@@ -2151,7 +2330,9 @@
"oneOf": [
{
"type": "object",
- "required": ["bancontact_card"],
+ "required": [
+ "bancontact_card"
+ ],
"properties": {
"bancontact_card": {
"type": "object",
@@ -2196,11 +2377,15 @@
},
{
"type": "object",
- "required": ["blik"],
+ "required": [
+ "blik"
+ ],
"properties": {
"blik": {
"type": "object",
- "required": ["blik_code"],
+ "required": [
+ "blik_code"
+ ],
"properties": {
"blik_code": {
"type": "string"
@@ -2211,11 +2396,16 @@
},
{
"type": "object",
- "required": ["eps"],
+ "required": [
+ "eps"
+ ],
"properties": {
"eps": {
"type": "object",
- "required": ["billing_details", "bank_name"],
+ "required": [
+ "billing_details",
+ "bank_name"
+ ],
"properties": {
"billing_details": {
"$ref": "#/components/schemas/BankRedirectBilling"
@@ -2229,11 +2419,15 @@
},
{
"type": "object",
- "required": ["giropay"],
+ "required": [
+ "giropay"
+ ],
"properties": {
"giropay": {
"type": "object",
- "required": ["billing_details"],
+ "required": [
+ "billing_details"
+ ],
"properties": {
"billing_details": {
"$ref": "#/components/schemas/BankRedirectBilling"
@@ -2254,11 +2448,16 @@
},
{
"type": "object",
- "required": ["ideal"],
+ "required": [
+ "ideal"
+ ],
"properties": {
"ideal": {
"type": "object",
- "required": ["billing_details", "bank_name"],
+ "required": [
+ "billing_details",
+ "bank_name"
+ ],
"properties": {
"billing_details": {
"$ref": "#/components/schemas/BankRedirectBilling"
@@ -2272,11 +2471,16 @@
},
{
"type": "object",
- "required": ["interac"],
+ "required": [
+ "interac"
+ ],
"properties": {
"interac": {
"type": "object",
- "required": ["country", "email"],
+ "required": [
+ "country",
+ "email"
+ ],
"properties": {
"country": {
"$ref": "#/components/schemas/CountryAlpha2"
@@ -2291,11 +2495,15 @@
},
{
"type": "object",
- "required": ["online_banking_czech_republic"],
+ "required": [
+ "online_banking_czech_republic"
+ ],
"properties": {
"online_banking_czech_republic": {
"type": "object",
- "required": ["issuer"],
+ "required": [
+ "issuer"
+ ],
"properties": {
"issuer": {
"$ref": "#/components/schemas/BankNames"
@@ -2306,7 +2514,9 @@
},
{
"type": "object",
- "required": ["online_banking_finland"],
+ "required": [
+ "online_banking_finland"
+ ],
"properties": {
"online_banking_finland": {
"type": "object",
@@ -2321,11 +2531,15 @@
},
{
"type": "object",
- "required": ["online_banking_poland"],
+ "required": [
+ "online_banking_poland"
+ ],
"properties": {
"online_banking_poland": {
"type": "object",
- "required": ["issuer"],
+ "required": [
+ "issuer"
+ ],
"properties": {
"issuer": {
"$ref": "#/components/schemas/BankNames"
@@ -2336,11 +2550,15 @@
},
{
"type": "object",
- "required": ["online_banking_slovakia"],
+ "required": [
+ "online_banking_slovakia"
+ ],
"properties": {
"online_banking_slovakia": {
"type": "object",
- "required": ["issuer"],
+ "required": [
+ "issuer"
+ ],
"properties": {
"issuer": {
"$ref": "#/components/schemas/BankNames"
@@ -2351,11 +2569,15 @@
},
{
"type": "object",
- "required": ["przelewy24"],
+ "required": [
+ "przelewy24"
+ ],
"properties": {
"przelewy24": {
"type": "object",
- "required": ["billing_details"],
+ "required": [
+ "billing_details"
+ ],
"properties": {
"bank_name": {
"allOf": [
@@ -2374,7 +2596,9 @@
},
{
"type": "object",
- "required": ["sofort"],
+ "required": [
+ "sofort"
+ ],
"properties": {
"sofort": {
"type": "object",
@@ -2401,7 +2625,9 @@
},
{
"type": "object",
- "required": ["swish"],
+ "required": [
+ "swish"
+ ],
"properties": {
"swish": {
"type": "object"
@@ -2410,24 +2636,153 @@
},
{
"type": "object",
- "required": ["trustly"],
+ "required": [
+ "trustly"
+ ],
"properties": {
"trustly": {
"type": "object",
- "required": ["country"],
+ "required": [
+ "country"
+ ],
+ "properties": {
+ "country": {
+ "$ref": "#/components/schemas/CountryAlpha2"
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "BankTransferData": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "ach_bank_transfer"
+ ],
+ "properties": {
+ "ach_bank_transfer": {
+ "type": "object",
+ "required": [
+ "billing_details"
+ ],
+ "properties": {
+ "billing_details": {
+ "$ref": "#/components/schemas/AchBillingDetails"
+ }
+ }
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "sepa_bank_transfer"
+ ],
+ "properties": {
+ "sepa_bank_transfer": {
+ "type": "object",
+ "required": [
+ "billing_details",
+ "country"
+ ],
"properties": {
+ "billing_details": {
+ "$ref": "#/components/schemas/SepaAndBacsBillingDetails"
+ },
"country": {
"$ref": "#/components/schemas/CountryAlpha2"
}
}
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "bacs_bank_transfer"
+ ],
+ "properties": {
+ "bacs_bank_transfer": {
+ "type": "object",
+ "required": [
+ "billing_details"
+ ],
+ "properties": {
+ "billing_details": {
+ "$ref": "#/components/schemas/SepaAndBacsBillingDetails"
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "BankTransferInstructions": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "ach_credit_transfer"
+ ],
+ "properties": {
+ "ach_credit_transfer": {
+ "$ref": "#/components/schemas/AchTransfer"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "sepa_bank_instructions"
+ ],
+ "properties": {
+ "sepa_bank_instructions": {
+ "$ref": "#/components/schemas/SepaBankTransferInstructions"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "bacs_bank_instructions"
+ ],
+ "properties": {
+ "bacs_bank_instructions": {
+ "$ref": "#/components/schemas/BacsBankTransferInstructions"
+ }
+ }
+ }
+ ]
+ },
+ "BankTransferNextStepsData": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BankTransferInstructions"
+ },
+ {
+ "type": "object",
+ "required": [
+ "receiver"
+ ],
+ "properties": {
+ "receiver": {
+ "$ref": "#/components/schemas/ReceiverDetails"
+ }
+ }
}
]
},
"CaptureMethod": {
"type": "string",
- "enum": ["automatic", "manual", "manual_multiple", "scheduled"]
+ "enum": [
+ "automatic",
+ "manual",
+ "manual_multiple",
+ "scheduled"
+ ]
},
"Card": {
"type": "object",
@@ -2570,7 +2925,6 @@
"aci",
"adyen",
"airwallex",
- "applepay",
"authorizedotnet",
"bitpay",
"bluesnap",
@@ -2578,7 +2932,6 @@
"checkout",
"coinbase",
"cybersource",
- "dummy",
"iatapay",
"dummyconnector1",
"dummyconnector2",
@@ -2594,6 +2947,7 @@
"multisafepay",
"nexinets",
"nmi",
+ "noon",
"nuvei",
"paypal",
"payu",
@@ -2875,7 +3229,10 @@
"CreateApiKeyRequest": {
"type": "object",
"description": "The request body for creating an API Key.",
- "required": ["name", "expiration"],
+ "required": [
+ "name",
+ "expiration"
+ ],
"properties": {
"name": {
"type": "string",
@@ -3062,7 +3419,9 @@
},
"CustomerAcceptance": {
"type": "object",
- "required": ["acceptance_type"],
+ "required": [
+ "acceptance_type"
+ ],
"properties": {
"acceptance_type": {
"$ref": "#/components/schemas/AcceptanceType"
@@ -3177,7 +3536,9 @@
"$ref": "#/components/schemas/PaymentExperience"
},
"description": "Type of payment experience enabled with the connector",
- "example": ["redirect_to_url"],
+ "example": [
+ "redirect_to_url"
+ ],
"nullable": true
},
"card": {
@@ -3204,7 +3565,9 @@
},
"CustomerPaymentMethodsListResponse": {
"type": "object",
- "required": ["customer_payment_methods"],
+ "required": [
+ "customer_payment_methods"
+ ],
"properties": {
"customer_payment_methods": {
"type": "array",
@@ -3218,6 +3581,9 @@
"CustomerRequest": {
"type": "object",
"description": "The customer details",
+ "required": [
+ "name"
+ ],
"properties": {
"customer_id": {
"type": "string",
@@ -3229,7 +3595,6 @@
"type": "string",
"description": "The customer's name",
"example": "Jon Test",
- "nullable": true,
"maxLength": 255
},
"email": {
@@ -3274,7 +3639,10 @@
},
"CustomerResponse": {
"type": "object",
- "required": ["customer_id", "created_at"],
+ "required": [
+ "customer_id",
+ "created_at"
+ ],
"properties": {
"customer_id": {
"type": "string",
@@ -3490,7 +3858,11 @@
},
"DisputeStage": {
"type": "string",
- "enum": ["pre_dispute", "dispute", "pre_arbitration"]
+ "enum": [
+ "pre_dispute",
+ "dispute",
+ "pre_arbitration"
+ ]
},
"DisputeStatus": {
"type": "string",
@@ -3504,26 +3876,62 @@
"dispute_lost"
]
},
- "FrmAction": {
- "type": "string",
- "enum": ["cancel_txn", "auto_refund", "manual_review"]
- },
- "FrmConfigs": {
+ "EphemeralKeyCreateResponse": {
"type": "object",
- "description": "Details of FrmConfigs are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table",
- "required": ["frm_action", "frm_preferred_flow_type"],
+ "required": [
+ "customer_id",
+ "created_at",
+ "expires",
+ "secret"
+ ],
"properties": {
- "frm_enabled_pms": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "nullable": true
+ "customer_id": {
+ "type": "string",
+ "description": "customer_id to which this ephemeral key belongs to"
},
- "frm_enabled_pm_types": {
- "type": "array",
- "items": {
- "type": "string"
+ "created_at": {
+ "type": "integer",
+ "format": "int64",
+ "description": "time at which this ephemeral key was created"
+ },
+ "expires": {
+ "type": "integer",
+ "format": "int64",
+ "description": "time at which this ephemeral key would expire"
+ },
+ "secret": {
+ "type": "string",
+ "description": "ephemeral key"
+ }
+ }
+ },
+ "FrmAction": {
+ "type": "string",
+ "enum": [
+ "cancel_txn",
+ "auto_refund",
+ "manual_review"
+ ]
+ },
+ "FrmConfigs": {
+ "type": "object",
+ "description": "Details of FrmConfigs are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table",
+ "required": [
+ "frm_action",
+ "frm_preferred_flow_type"
+ ],
+ "properties": {
+ "frm_enabled_pms": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "nullable": true
+ },
+ "frm_enabled_pm_types": {
+ "type": "array",
+ "items": {
+ "type": "string"
},
"nullable": true
},
@@ -3544,15 +3952,24 @@
},
"FrmPreferredFlowTypes": {
"type": "string",
- "enum": ["pre", "post"]
+ "enum": [
+ "pre",
+ "post"
+ ]
},
"FutureUsage": {
"type": "string",
- "enum": ["off_session", "on_session"]
+ "enum": [
+ "off_session",
+ "on_session"
+ ]
},
"GooglePayPaymentMethodInfo": {
"type": "object",
- "required": ["card_network", "card_details"],
+ "required": [
+ "card_network",
+ "card_details"
+ ],
"properties": {
"card_network": {
"type": "string",
@@ -3566,7 +3983,12 @@
},
"GooglePayWalletData": {
"type": "object",
- "required": ["type", "description", "info", "tokenization_data"],
+ "required": [
+ "type",
+ "description",
+ "info",
+ "tokenization_data"
+ ],
"properties": {
"type": {
"type": "string",
@@ -3586,7 +4008,10 @@
},
"GpayAllowedMethodsParameters": {
"type": "object",
- "required": ["allowed_auth_methods", "allowed_card_networks"],
+ "required": [
+ "allowed_auth_methods",
+ "allowed_card_networks"
+ ],
"properties": {
"allowed_auth_methods": {
"type": "array",
@@ -3606,7 +4031,11 @@
},
"GpayAllowedPaymentMethods": {
"type": "object",
- "required": ["type", "parameters", "tokenization_specification"],
+ "required": [
+ "type",
+ "parameters",
+ "tokenization_specification"
+ ],
"properties": {
"type": {
"type": "string",
@@ -3622,7 +4051,9 @@
},
"GpayMerchantInfo": {
"type": "object",
- "required": ["merchant_name"],
+ "required": [
+ "merchant_name"
+ ],
"properties": {
"merchant_name": {
"type": "string",
@@ -3659,7 +4090,9 @@
},
"GpayTokenParameters": {
"type": "object",
- "required": ["gateway"],
+ "required": [
+ "gateway"
+ ],
"properties": {
"gateway": {
"type": "string",
@@ -3682,7 +4115,10 @@
},
"GpayTokenizationData": {
"type": "object",
- "required": ["type", "token"],
+ "required": [
+ "type",
+ "token"
+ ],
"properties": {
"type": {
"type": "string",
@@ -3696,7 +4132,10 @@
},
"GpayTokenizationSpecification": {
"type": "object",
- "required": ["type", "parameters"],
+ "required": [
+ "type",
+ "parameters"
+ ],
"properties": {
"type": {
"type": "string",
@@ -3728,8 +4167,7 @@
"description": "The total price status (ex: 'FINAL')"
},
"total_price": {
- "type": "integer",
- "format": "int64",
+ "type": "string",
"description": "The total price"
}
}
@@ -3750,7 +4188,10 @@
},
"KlarnaSessionTokenResponse": {
"type": "object",
- "required": ["session_token", "session_id"],
+ "required": [
+ "session_token",
+ "session_id"
+ ],
"properties": {
"session_token": {
"type": "string",
@@ -3764,7 +4205,10 @@
},
"MandateAmountData": {
"type": "object",
- "required": ["amount", "currency"],
+ "required": [
+ "amount",
+ "currency"
+ ],
"properties": {
"amount": {
"type": "integer",
@@ -3843,13 +4287,22 @@
},
"MandateData": {
"type": "object",
- "required": ["customer_acceptance", "mandate_type"],
"properties": {
"customer_acceptance": {
- "$ref": "#/components/schemas/CustomerAcceptance"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CustomerAcceptance"
+ }
+ ],
+ "nullable": true
},
"mandate_type": {
- "$ref": "#/components/schemas/MandateType"
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MandateType"
+ }
+ ],
+ "nullable": true
}
}
},
@@ -3897,7 +4350,10 @@
},
"MandateRevokedResponse": {
"type": "object",
- "required": ["mandate_id", "status"],
+ "required": [
+ "mandate_id",
+ "status"
+ ],
"properties": {
"mandate_id": {
"type": "string",
@@ -3911,13 +4367,20 @@
"MandateStatus": {
"type": "string",
"description": "The status of the mandate, which indicates whether it can be used to initiate a payment",
- "enum": ["active", "inactive", "pending", "revoked"]
+ "enum": [
+ "active",
+ "inactive",
+ "pending",
+ "revoked"
+ ]
},
"MandateType": {
"oneOf": [
{
"type": "object",
- "required": ["single_use"],
+ "required": [
+ "single_use"
+ ],
"properties": {
"single_use": {
"$ref": "#/components/schemas/MandateAmountData"
@@ -3926,7 +4389,9 @@
},
{
"type": "object",
- "required": ["multi_use"],
+ "required": [
+ "multi_use"
+ ],
"properties": {
"multi_use": {
"allOf": [
@@ -3942,7 +4407,9 @@
},
"MbWayRedirection": {
"type": "object",
- "required": ["telephone_number"],
+ "required": [
+ "telephone_number"
+ ],
"properties": {
"telephone_number": {
"type": "string",
@@ -3952,7 +4419,9 @@
},
"MerchantAccountCreate": {
"type": "object",
- "required": ["merchant_id"],
+ "required": [
+ "merchant_id"
+ ],
"properties": {
"merchant_id": {
"type": "string",
@@ -4052,6 +4521,11 @@
],
"nullable": true
},
+ "frm_routing_algorithm": {
+ "type": "object",
+ "description": "The frm routing algorithm to be used for routing payments to desired FRM's",
+ "nullable": true
+ },
"intent_fulfillment_time": {
"type": "integer",
"format": "int32",
@@ -4064,7 +4538,10 @@
},
"MerchantAccountDeleteResponse": {
"type": "object",
- "required": ["merchant_id", "deleted"],
+ "required": [
+ "merchant_id",
+ "deleted"
+ ],
"properties": {
"merchant_id": {
"type": "string",
@@ -4188,6 +4665,14 @@
},
"description": "Default business details for connector routing"
},
+ "frm_routing_algorithm": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RoutingAlgorithm"
+ }
+ ],
+ "nullable": true
+ },
"intent_fulfillment_time": {
"type": "integer",
"format": "int64",
@@ -4198,7 +4683,9 @@
},
"MerchantAccountUpdate": {
"type": "object",
- "required": ["merchant_id"],
+ "required": [
+ "merchant_id"
+ ],
"properties": {
"merchant_id": {
"type": "string",
@@ -4298,6 +4785,11 @@
"description": "Default business details for connector routing",
"nullable": true
},
+ "frm_routing_algorithm": {
+ "type": "object",
+ "description": "The frm routing algorithm to be used for routing payments to desired FRM's",
+ "nullable": true
+ },
"intent_fulfillment_time": {
"type": "integer",
"format": "int32",
@@ -4310,7 +4802,11 @@
"MerchantConnectorCreate": {
"type": "object",
"description": "Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc.\"",
- "required": ["connector_type", "connector_name", "connector_label"],
+ "required": [
+ "connector_type",
+ "connector_name",
+ "connector_label"
+ ],
"properties": {
"connector_type": {
"$ref": "#/components/schemas/ConnectorType"
@@ -4358,16 +4854,32 @@
"example": [
{
"payment_method": "wallet",
- "payment_method_types": ["upi_collect", "upi_intent"],
- "payment_method_issuers": ["labore magna ipsum", "aute"],
- "payment_schemes": ["Discover", "Discover"],
+ "payment_method_types": [
+ "upi_collect",
+ "upi_intent"
+ ],
+ "payment_method_issuers": [
+ "labore magna ipsum",
+ "aute"
+ ],
+ "payment_schemes": [
+ "Discover",
+ "Discover"
+ ],
"accepted_currencies": {
"type": "enable_only",
- "list": ["USD", "EUR"]
+ "list": [
+ "USD",
+ "EUR"
+ ]
},
"accepted_countries": {
"type": "disable_only",
- "list": ["FR", "DE", "IN"]
+ "list": [
+ "FR",
+ "DE",
+ "IN"
+ ]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
@@ -4412,7 +4924,11 @@
},
"MerchantConnectorDeleteResponse": {
"type": "object",
- "required": ["merchant_id", "merchant_connector_id", "deleted"],
+ "required": [
+ "merchant_id",
+ "merchant_connector_id",
+ "deleted"
+ ],
"properties": {
"merchant_id": {
"type": "string",
@@ -4449,7 +4965,9 @@
},
"MerchantConnectorDetailsWrap": {
"type": "object",
- "required": ["creds_identifier"],
+ "required": [
+ "creds_identifier"
+ ],
"properties": {
"creds_identifier": {
"type": "string",
@@ -4467,7 +4985,10 @@
},
"MerchantConnectorId": {
"type": "object",
- "required": ["merchant_id", "merchant_connector_id"],
+ "required": [
+ "merchant_id",
+ "merchant_connector_id"
+ ],
"properties": {
"merchant_id": {
"type": "string"
@@ -4534,16 +5055,32 @@
"example": [
{
"payment_method": "wallet",
- "payment_method_types": ["upi_collect", "upi_intent"],
- "payment_method_issuers": ["labore magna ipsum", "aute"],
- "payment_schemes": ["Discover", "Discover"],
+ "payment_method_types": [
+ "upi_collect",
+ "upi_intent"
+ ],
+ "payment_method_issuers": [
+ "labore magna ipsum",
+ "aute"
+ ],
+ "payment_schemes": [
+ "Discover",
+ "Discover"
+ ],
"accepted_currencies": {
"type": "enable_only",
- "list": ["USD", "EUR"]
+ "list": [
+ "USD",
+ "EUR"
+ ]
},
"accepted_countries": {
"type": "disable_only",
- "list": ["FR", "DE", "IN"]
+ "list": [
+ "FR",
+ "DE",
+ "IN"
+ ]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
@@ -4585,7 +5122,9 @@
"MerchantConnectorUpdate": {
"type": "object",
"description": "Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc.\"",
- "required": ["connector_type"],
+ "required": [
+ "connector_type"
+ ],
"properties": {
"connector_type": {
"$ref": "#/components/schemas/ConnectorType"
@@ -4618,16 +5157,32 @@
"example": [
{
"payment_method": "wallet",
- "payment_method_types": ["upi_collect", "upi_intent"],
- "payment_method_issuers": ["labore magna ipsum", "aute"],
- "payment_schemes": ["Discover", "Discover"],
+ "payment_method_types": [
+ "upi_collect",
+ "upi_intent"
+ ],
+ "payment_method_issuers": [
+ "labore magna ipsum",
+ "aute"
+ ],
+ "payment_schemes": [
+ "Discover",
+ "Discover"
+ ],
"accepted_currencies": {
"type": "enable_only",
- "list": ["USD", "EUR"]
+ "list": [
+ "USD",
+ "EUR"
+ ]
},
"accepted_countries": {
"type": "disable_only",
- "list": ["FR", "DE", "IN"]
+ "list": [
+ "FR",
+ "DE",
+ "IN"
+ ]
},
"minimum_amount": 1,
"maximum_amount": 68607706,
@@ -4731,16 +5286,27 @@
"type": "object",
"properties": {
"order_details": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/OrderDetails"
- },
- "description": "Information about the product and quantity for specific connectors. (e.g. Klarna)",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/OrderDetails"
+ }
+ ],
"nullable": true
},
- "payload": {
+ "routing_parameters": {
"type": "object",
- "description": "Payload coming in request as a metadata field",
+ "description": "Information used for routing",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "nullable": true
+ },
+ "redirect_response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RedirectResponse"
+ }
+ ],
"nullable": true
},
"allowed_payment_method_types": {
@@ -4758,19 +5324,49 @@
"MobilePayRedirection": {
"type": "object"
},
- "NextAction": {
- "type": "object",
- "required": ["type"],
- "properties": {
- "type": {
- "$ref": "#/components/schemas/NextActionType"
- },
- "redirect_to_url": {
- "type": "string",
+ "NextActionData": {
+ "oneOf": [
+ {
+ "type": "object",
"description": "Contains the url for redirection flow",
- "example": "https://router.juspay.io/redirect/fakushdfjlksdfasklhdfj",
- "nullable": true
+ "required": [
+ "redirect_to_url",
+ "type"
+ ],
+ "properties": {
+ "redirect_to_url": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "redirect_to_url"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Informs the next steps for bank transfer and also contains the charges details (ex: amount received, amount charged etc)",
+ "required": [
+ "bank_transfer_steps_and_charges_details",
+ "type"
+ ],
+ "properties": {
+ "bank_transfer_steps_and_charges_details": {
+ "$ref": "#/components/schemas/BankTransferNextStepsData"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "display_bank_transfer_information"
+ ]
+ }
+ }
}
+ ],
+ "discriminator": {
+ "propertyName": "type"
}
},
"NextActionType": {
@@ -4779,12 +5375,16 @@
"redirect_to_url",
"display_qr_code",
"invoke_sdk_client",
- "trigger_api"
+ "trigger_api",
+ "display_bank_transfer_information"
]
},
"OnlineMandate": {
"type": "object",
- "required": ["ip_address", "user_agent"],
+ "required": [
+ "ip_address",
+ "user_agent"
+ ],
"properties": {
"ip_address": {
"type": "string",
@@ -4799,7 +5399,10 @@
},
"OrderDetails": {
"type": "object",
- "required": ["product_name", "quantity", "amount"],
+ "required": [
+ "product_name",
+ "quantity"
+ ],
"properties": {
"product_name": {
"type": "string",
@@ -4813,11 +5416,6 @@
"description": "The quantity of the product to be purchased",
"example": 1,
"minimum": 0.0
- },
- "amount": {
- "type": "integer",
- "format": "int64",
- "description": "the amount per quantity of product"
}
}
},
@@ -4825,12 +5423,17 @@
"oneOf": [
{
"type": "object",
- "required": ["klarna_redirect"],
+ "required": [
+ "klarna_redirect"
+ ],
"properties": {
"klarna_redirect": {
"type": "object",
"description": "For KlarnaRedirect as PayLater Option",
- "required": ["billing_email", "billing_country"],
+ "required": [
+ "billing_email",
+ "billing_country"
+ ],
"properties": {
"billing_email": {
"type": "string",
@@ -4845,12 +5448,16 @@
},
{
"type": "object",
- "required": ["klarna_sdk"],
+ "required": [
+ "klarna_sdk"
+ ],
"properties": {
"klarna_sdk": {
"type": "object",
"description": "For Klarna Sdk as PayLater Option",
- "required": ["token"],
+ "required": [
+ "token"
+ ],
"properties": {
"token": {
"type": "string",
@@ -4862,7 +5469,9 @@
},
{
"type": "object",
- "required": ["affirm_redirect"],
+ "required": [
+ "affirm_redirect"
+ ],
"properties": {
"affirm_redirect": {
"type": "object",
@@ -4872,12 +5481,17 @@
},
{
"type": "object",
- "required": ["afterpay_clearpay_redirect"],
+ "required": [
+ "afterpay_clearpay_redirect"
+ ],
"properties": {
"afterpay_clearpay_redirect": {
"type": "object",
"description": "For AfterpayClearpay redirect as PayLater Option",
- "required": ["billing_email", "billing_name"],
+ "required": [
+ "billing_email",
+ "billing_name"
+ ],
"properties": {
"billing_email": {
"type": "string",
@@ -4893,7 +5507,9 @@
},
{
"type": "object",
- "required": ["pay_bright"],
+ "required": [
+ "pay_bright"
+ ],
"properties": {
"pay_bright": {
"type": "object"
@@ -4902,7 +5518,9 @@
},
{
"type": "object",
- "required": ["walley"],
+ "required": [
+ "walley"
+ ],
"properties": {
"walley": {
"type": "object"
@@ -4913,7 +5531,9 @@
},
"PayPalWalletData": {
"type": "object",
- "required": ["token"],
+ "required": [
+ "token"
+ ],
"properties": {
"token": {
"type": "string",
@@ -4936,7 +5556,9 @@
"oneOf": [
{
"type": "object",
- "required": ["PaymentIntentId"],
+ "required": [
+ "PaymentIntentId"
+ ],
"properties": {
"PaymentIntentId": {
"type": "string",
@@ -4946,7 +5568,9 @@
},
{
"type": "object",
- "required": ["ConnectorTransactionId"],
+ "required": [
+ "ConnectorTransactionId"
+ ],
"properties": {
"ConnectorTransactionId": {
"type": "string",
@@ -4956,13 +5580,27 @@
},
{
"type": "object",
- "required": ["PaymentAttemptId"],
+ "required": [
+ "PaymentAttemptId"
+ ],
"properties": {
"PaymentAttemptId": {
"type": "string",
"description": "The identifier for payment attempt"
}
}
+ },
+ {
+ "type": "object",
+ "required": [
+ "PreprocessingId"
+ ],
+ "properties": {
+ "PreprocessingId": {
+ "type": "string",
+ "description": "The identifier for preprocessing step"
+ }
+ }
}
]
},
@@ -5032,7 +5670,10 @@
},
"PaymentListResponse": {
"type": "object",
- "required": ["size", "data"],
+ "required": [
+ "size",
+ "data"
+ ],
"properties": {
"size": {
"type": "integer",
@@ -5054,13 +5695,16 @@
"pay_later",
"wallet",
"bank_redirect",
+ "bank_transfer",
"crypto",
"bank_debit"
]
},
"PaymentMethodCreate": {
"type": "object",
- "required": ["payment_method"],
+ "required": [
+ "payment_method"
+ ],
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethodType"
@@ -5118,7 +5762,9 @@
"oneOf": [
{
"type": "object",
- "required": ["card"],
+ "required": [
+ "card"
+ ],
"properties": {
"card": {
"$ref": "#/components/schemas/Card"
@@ -5127,7 +5773,9 @@
},
{
"type": "object",
- "required": ["wallet"],
+ "required": [
+ "wallet"
+ ],
"properties": {
"wallet": {
"$ref": "#/components/schemas/WalletData"
@@ -5136,7 +5784,9 @@
},
{
"type": "object",
- "required": ["pay_later"],
+ "required": [
+ "pay_later"
+ ],
"properties": {
"pay_later": {
"$ref": "#/components/schemas/PayLaterData"
@@ -5145,7 +5795,9 @@
},
{
"type": "object",
- "required": ["bank_redirect"],
+ "required": [
+ "bank_redirect"
+ ],
"properties": {
"bank_redirect": {
"$ref": "#/components/schemas/BankRedirectData"
@@ -5154,7 +5806,9 @@
},
{
"type": "object",
- "required": ["bank_debit"],
+ "required": [
+ "bank_debit"
+ ],
"properties": {
"bank_debit": {
"$ref": "#/components/schemas/BankDebitData"
@@ -5163,7 +5817,20 @@
},
{
"type": "object",
- "required": ["crypto"],
+ "required": [
+ "bank_transfer"
+ ],
+ "properties": {
+ "bank_transfer": {
+ "$ref": "#/components/schemas/BankTransferData"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "crypto"
+ ],
"properties": {
"crypto": {
"$ref": "#/components/schemas/CryptoData"
@@ -5172,13 +5839,18 @@
},
{
"type": "string",
- "enum": ["mandate_payment"]
+ "enum": [
+ "mandate_payment"
+ ]
}
]
},
"PaymentMethodDeleteResponse": {
"type": "object",
- "required": ["payment_method_id", "deleted"],
+ "required": [
+ "payment_method_id",
+ "deleted"
+ ],
"properties": {
"payment_method_id": {
"type": "string",
@@ -5209,7 +5881,9 @@
},
"PaymentMethodList": {
"type": "object",
- "required": ["payment_method"],
+ "required": [
+ "payment_method"
+ ],
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
@@ -5220,14 +5894,19 @@
"$ref": "#/components/schemas/PaymentMethodType"
},
"description": "This is a sub-category of payment method.",
- "example": ["credit"],
+ "example": [
+ "credit"
+ ],
"nullable": true
}
}
},
"PaymentMethodListResponse": {
"type": "object",
- "required": ["payment_methods"],
+ "required": [
+ "payment_methods",
+ "mandate_payment"
+ ],
"properties": {
"redirect_url": {
"type": "string",
@@ -5245,9 +5924,15 @@
{
"payment_method": "wallet",
"payment_experience": null,
- "payment_method_issuers": ["labore magna ipsum", "aute"]
+ "payment_method_issuers": [
+ "labore magna ipsum",
+ "aute"
+ ]
}
]
+ },
+ "mandate_payment": {
+ "$ref": "#/components/schemas/MandateType"
}
}
},
@@ -5312,7 +5997,9 @@
"$ref": "#/components/schemas/PaymentExperience"
},
"description": "Type of payment experience enabled with the connector",
- "example": ["redirect_to_url"],
+ "example": [
+ "redirect_to_url"
+ ],
"nullable": true
},
"metadata": {
@@ -5348,6 +6035,7 @@
"giropay",
"google_pay",
"ideal",
+ "interac",
"klarna",
"mb_way",
"mobile_pay",
@@ -5395,7 +6083,9 @@
"PaymentMethodsEnabled": {
"type": "object",
"description": "Details of all the payment methods enabled for the connector for the given merchant account",
- "required": ["payment_method"],
+ "required": [
+ "payment_method"
+ ],
"properties": {
"payment_method": {
"$ref": "#/components/schemas/PaymentMethod"
@@ -5406,7 +6096,9 @@
"$ref": "#/components/schemas/PaymentMethodType"
},
"description": "Subtype of payment method",
- "example": ["credit"],
+ "example": [
+ "credit"
+ ],
"nullable": true
}
}
@@ -5428,7 +6120,9 @@
},
"PaymentsCancelRequest": {
"type": "object",
- "required": ["merchant_connector_details"],
+ "required": [
+ "merchant_connector_details"
+ ],
"properties": {
"cancellation_reason": {
"type": "string",
@@ -5486,85 +6180,52 @@
},
"PaymentsCreateRequest": {
"type": "object",
- "required": ["amount", "currency"],
+ "required": [
+ "currency",
+ "amount",
+ "manual_retry"
+ ],
"properties": {
- "confirm": {
- "type": "boolean",
- "description": "Whether to confirm the payment (if applicable)",
- "default": false,
- "example": true,
- "nullable": true
- },
- "merchant_id": {
+ "mandate_id": {
"type": "string",
- "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
- "example": "merchant_1668273825",
- "nullable": true,
- "maxLength": 255
- },
- "customer_id": {
- "type": "string",
- "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
- "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
- "nullable": true,
- "maxLength": 255
- },
- "name": {
- "type": "string",
- "description": "description: The customer's name",
- "example": "John Test",
- "nullable": true,
- "maxLength": 255
- },
- "connector": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/Connector"
- },
- "description": "This allows the merchant to manually select a connector with which the payment can go through",
- "example": ["stripe", "adyen"],
- "nullable": true
- },
- "phone_country_code": {
- "type": "string",
- "description": "The country code for the customer phone number",
- "example": "+1",
- "nullable": true,
- "maxLength": 255
- },
- "business_label": {
- "type": "string",
- "description": "Business label of the merchant for this payment",
- "example": "food",
- "nullable": true
- },
- "statement_descriptor_name": {
- "type": "string",
- "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
- "example": "Hyperswitch Router",
+ "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data",
+ "example": "mandate_iwer89rnjef349dni3",
"nullable": true,
"maxLength": 255
},
- "payment_experience": {
+ "routing": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentExperience"
+ "$ref": "#/components/schemas/RoutingAlgorithm"
}
],
"nullable": true
},
- "payment_method_data": {
+ "payment_token": {
+ "type": "string",
+ "description": "Provide a reference to a stored payment method",
+ "example": "187282ab-40ef-47a9-9206-5099ba31e432",
+ "nullable": true
+ },
+ "currency": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodData"
+ "$ref": "#/components/schemas/Currency"
}
],
"nullable": true
},
- "authentication_type": {
+ "phone_country_code": {
+ "type": "string",
+ "description": "The country code for the customer phone number",
+ "example": "+1",
+ "nullable": true,
+ "maxLength": 255
+ },
+ "payment_method_type": {
"allOf": [
{
- "$ref": "#/components/schemas/AuthenticationType"
+ "$ref": "#/components/schemas/PaymentMethodType"
}
],
"nullable": true
@@ -5577,76 +6238,105 @@
"description": "Allowed Payment Method Types for a given PaymentIntent",
"nullable": true
},
- "capture_method": {
+ "confirm": {
+ "type": "boolean",
+ "description": "Whether to confirm the payment (if applicable)",
+ "default": false,
+ "example": true,
+ "nullable": true
+ },
+ "metadata": {
"allOf": [
{
- "$ref": "#/components/schemas/CaptureMethod"
+ "$ref": "#/components/schemas/Metadata"
}
],
"nullable": true
},
- "card_cvc": {
- "type": "string",
- "description": "This is used when payment is to be confirmed and the card is not saved",
+ "amount_to_capture": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.",
+ "example": 6540,
"nullable": true
},
- "capture_on": {
- "type": "string",
- "format": "date-time",
- "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
- "example": "2022-09-10T10:11:12Z",
- "nullable": true
+ "amount": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
+ "example": 6540,
+ "nullable": true,
+ "minimum": 0.0
},
- "mandate_id": {
+ "merchant_id": {
"type": "string",
- "description": "A unique identifier to link the payment to a mandate, can be use instead of payment_method_data",
- "example": "mandate_iwer89rnjef349dni3",
+ "description": "This is an identifier for the merchant account. This is inferred from the API key\nprovided during the request",
+ "example": "merchant_1668273825",
"nullable": true,
"maxLength": 255
},
- "merchant_connector_details": {
+ "off_session": {
+ "type": "boolean",
+ "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.",
+ "example": true,
+ "nullable": true
+ },
+ "shipping": {
"allOf": [
{
- "$ref": "#/components/schemas/MerchantConnectorDetailsWrap"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "payment_id": {
+ "phone": {
"type": "string",
- "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.",
- "example": "pay_mbabizu24mvu3mela5njyhpit4",
+ "description": "The customer's phone number",
+ "example": "3141592653",
"nullable": true,
- "maxLength": 30,
- "minLength": 30
+ "maxLength": 255
},
- "routing": {
+ "client_secret": {
+ "type": "string",
+ "description": "It's a token used for client side verification.",
+ "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
+ "nullable": true
+ },
+ "authentication_type": {
"allOf": [
{
- "$ref": "#/components/schemas/RoutingAlgorithm"
+ "$ref": "#/components/schemas/AuthenticationType"
}
],
"nullable": true
},
- "off_session": {
- "type": "boolean",
- "description": "Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.",
- "example": true,
+ "capture_method": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/CaptureMethod"
+ }
+ ],
"nullable": true
},
- "return_url": {
+ "business_label": {
"type": "string",
- "description": "The URL to redirect after the completion of the operation",
- "example": "https://hyperswitch.io",
+ "description": "Business label of the merchant for this payment",
+ "example": "food",
"nullable": true
},
- "amount": {
- "type": "integer",
- "format": "int64",
- "description": "The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,",
- "example": 6540,
+ "statement_descriptor_suffix": {
+ "type": "string",
+ "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.",
+ "example": "Payment for shoes purchase",
"nullable": true,
- "minimum": 0.0
+ "maxLength": 255
+ },
+ "name": {
+ "type": "string",
+ "description": "description: The customer's name",
+ "example": "John Test",
+ "nullable": true,
+ "maxLength": 255
},
"setup_future_usage": {
"allOf": [
@@ -5656,31 +6346,48 @@
],
"nullable": true
},
- "statement_descriptor_suffix": {
+ "connector": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Connector"
+ },
+ "description": "This allows the merchant to manually select a connector with which the payment can go through",
+ "example": [
+ "stripe",
+ "adyen"
+ ],
+ "nullable": true
+ },
+ "statement_descriptor_name": {
"type": "string",
- "description": "Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.",
- "example": "Payment for shoes purchase",
+ "description": "For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.",
+ "example": "Hyperswitch Router",
"nullable": true,
"maxLength": 255
},
- "shipping": {
+ "card_cvc": {
+ "type": "string",
+ "description": "This is used when payment is to be confirmed and the card is not saved",
+ "nullable": true
+ },
+ "payment_method": {
"allOf": [
{
- "$ref": "#/components/schemas/Address"
+ "$ref": "#/components/schemas/PaymentMethod"
}
],
"nullable": true
},
- "client_secret": {
+ "description": {
"type": "string",
- "description": "It's a token used for client side verification.",
- "example": "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo",
+ "description": "A description of the payment",
+ "example": "It's my first payment request",
"nullable": true
},
- "payment_method_type": {
+ "mandate_data": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethodType"
+ "$ref": "#/components/schemas/MandateData"
}
],
"nullable": true
@@ -5693,66 +6400,59 @@
],
"nullable": true
},
- "metadata": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Metadata"
- }
- ],
+ "business_sub_label": {
+ "type": "string",
+ "description": "Business sub label for the payment",
"nullable": true
},
- "billing": {
- "allOf": [
- {
- "$ref": "#/components/schemas/Address"
- }
- ],
+ "capture_on": {
+ "type": "string",
+ "format": "date-time",
+ "description": "A timestamp (ISO 8601 code) that determines when the payment should be captured.\nProviding this field will automatically set `capture` to true",
+ "example": "2022-09-10T10:11:12Z",
"nullable": true
},
- "description": {
+ "return_url": {
"type": "string",
- "description": "A description of the payment",
- "example": "It's my first payment request",
+ "description": "The URL to redirect after the completion of the operation",
+ "example": "https://hyperswitch.io",
"nullable": true
},
- "currency": {
+ "payment_experience": {
"allOf": [
{
- "$ref": "#/components/schemas/Currency"
+ "$ref": "#/components/schemas/PaymentExperience"
}
],
"nullable": true
},
- "business_sub_label": {
- "type": "string",
- "description": "Business sub label for the payment",
- "nullable": true
- },
- "payment_method": {
+ "billing": {
"allOf": [
{
- "$ref": "#/components/schemas/PaymentMethod"
+ "$ref": "#/components/schemas/Address"
}
],
"nullable": true
},
- "phone": {
+ "customer_id": {
"type": "string",
- "description": "The customer's phone number",
- "example": "3141592653",
+ "description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
+ "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"maxLength": 255
},
- "payment_token": {
+ "payment_id": {
"type": "string",
- "description": "Provide a reference to a stored payment method",
- "example": "187282ab-40ef-47a9-9206-5099ba31e432",
- "nullable": true
+ "description": "Unique identifier for the payment. This ensures idempotency for multiple payments\nthat have been done by a single merchant. This field is auto generated and is returned in the API response.",
+ "example": "pay_mbabizu24mvu3mela5njyhpit4",
+ "nullable": true,
+ "maxLength": 30,
+ "minLength": 30
},
- "mandate_data": {
+ "merchant_connector_details": {
"allOf": [
{
- "$ref": "#/components/schemas/MandateData"
+ "$ref": "#/components/schemas/MerchantConnectorDetailsWrap"
}
],
"nullable": true
@@ -5762,11 +6462,12 @@
"description": "Additional details required by 3DS 2.0",
"nullable": true
},
- "amount_to_capture": {
- "type": "integer",
- "format": "int64",
- "description": "The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,\nIf not provided, the default amount_to_capture will be the payment amount.",
- "example": 6540,
+ "payment_method_data": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PaymentMethodData"
+ }
+ ],
"nullable": true
},
"email": {
@@ -5775,6 +6476,10 @@
"example": "[email protected]",
"nullable": true,
"maxLength": 255
+ },
+ "manual_retry": {
+ "type": "boolean",
+ "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
}
}
},
@@ -5818,7 +6523,10 @@
"$ref": "#/components/schemas/Connector"
},
"description": "This allows the merchant to manually select a connector with which the payment can go through",
- "example": ["stripe", "adyen"],
+ "example": [
+ "stripe",
+ "adyen"
+ ],
"nullable": true
},
"currency": {
@@ -6068,6 +6776,10 @@
"type": "string",
"description": "Business sub label for the payment",
"nullable": true
+ },
+ "manual_retry": {
+ "type": "boolean",
+ "description": "If enabled payment can be retried from the client side until the payment is successful or payment expires or the attempts(configured by the merchant) for payment are exhausted."
}
}
},
@@ -6307,7 +7019,7 @@
"next_action": {
"allOf": [
{
- "$ref": "#/components/schemas/NextAction"
+ "$ref": "#/components/schemas/NextActionData"
}
],
"nullable": true
@@ -6370,12 +7082,23 @@
},
"description": "Allowed Payment Method Types for a given PaymentIntent",
"nullable": true
+ },
+ "ephemeral_key": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/EphemeralKeyCreateResponse"
+ }
+ ],
+ "nullable": true
}
}
},
"PaymentsRetrieveRequest": {
"type": "object",
- "required": ["resource_id", "force_sync"],
+ "required": [
+ "resource_id",
+ "force_sync"
+ ],
"properties": {
"resource_id": {
"$ref": "#/components/schemas/PaymentIdType"
@@ -6411,7 +7134,11 @@
},
"PaymentsSessionRequest": {
"type": "object",
- "required": ["payment_id", "client_secret", "wallets"],
+ "required": [
+ "payment_id",
+ "client_secret",
+ "wallets"
+ ],
"properties": {
"payment_id": {
"type": "string",
@@ -6440,7 +7167,11 @@
},
"PaymentsSessionResponse": {
"type": "object",
- "required": ["payment_id", "client_secret", "session_token"],
+ "required": [
+ "payment_id",
+ "client_secret",
+ "session_token"
+ ],
"properties": {
"payment_id": {
"type": "string",
@@ -6461,7 +7192,11 @@
},
"PaymentsStartRequest": {
"type": "object",
- "required": ["payment_id", "merchant_id", "attempt_id"],
+ "required": [
+ "payment_id",
+ "merchant_id",
+ "attempt_id"
+ ],
"properties": {
"payment_id": {
"type": "string",
@@ -6482,7 +7217,9 @@
},
"PaypalSessionTokenResponse": {
"type": "object",
- "required": ["session_token"],
+ "required": [
+ "session_token"
+ ],
"properties": {
"session_token": {
"type": "string",
@@ -6509,7 +7246,10 @@
},
"PrimaryBusinessDetails": {
"type": "object",
- "required": ["country", "business"],
+ "required": [
+ "country",
+ "business"
+ ],
"properties": {
"country": {
"$ref": "#/components/schemas/CountryAlpha2"
@@ -6520,6 +7260,44 @@
}
}
},
+ "ReceiverDetails": {
+ "type": "object",
+ "required": [
+ "amount_received"
+ ],
+ "properties": {
+ "amount_received": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The amount received by receiver"
+ },
+ "amount_charged": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The amount charged by ACH",
+ "nullable": true
+ },
+ "amount_remaining": {
+ "type": "integer",
+ "format": "int64",
+ "description": "The amount remaining to be sent via ACH",
+ "nullable": true
+ }
+ }
+ },
+ "RedirectResponse": {
+ "type": "object",
+ "properties": {
+ "param": {
+ "type": "string",
+ "nullable": true
+ },
+ "json_payload": {
+ "type": "object",
+ "nullable": true
+ }
+ }
+ },
"RefundListRequest": {
"type": "object",
"properties": {
@@ -6568,7 +7346,10 @@
},
"RefundListResponse": {
"type": "object",
- "required": ["size", "data"],
+ "required": [
+ "size",
+ "data"
+ ],
"properties": {
"size": {
"type": "integer",
@@ -6586,7 +7367,9 @@
},
"RefundRequest": {
"type": "object",
- "required": ["payment_id"],
+ "required": [
+ "payment_id"
+ ],
"properties": {
"refund_id": {
"type": "string",
@@ -6721,11 +7504,19 @@
"RefundStatus": {
"type": "string",
"description": "The status for refunds",
- "enum": ["succeeded", "failed", "pending", "review"]
+ "enum": [
+ "succeeded",
+ "failed",
+ "pending",
+ "review"
+ ]
},
"RefundType": {
"type": "string",
- "enum": ["scheduled", "instant"]
+ "enum": [
+ "scheduled",
+ "instant"
+ ]
},
"RefundUpdateRequest": {
"type": "object",
@@ -6800,7 +7591,11 @@
"RevokeApiKeyResponse": {
"type": "object",
"description": "The response body for revoking an API Key.",
- "required": ["merchant_id", "key_id", "revoked"],
+ "required": [
+ "merchant_id",
+ "key_id",
+ "revoked"
+ ],
"properties": {
"merchant_id": {
"type": "string",
@@ -6824,9 +7619,59 @@
"RoutingAlgorithm": {
"type": "string",
"description": "The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'",
- "enum": ["round_robin", "max_conversion", "min_cost", "custom"],
+ "enum": [
+ "round_robin",
+ "max_conversion",
+ "min_cost",
+ "custom"
+ ],
"example": "custom"
},
+ "SepaAndBacsBillingDetails": {
+ "type": "object",
+ "required": [
+ "email",
+ "name"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The Email ID for SEPA and BACS billing",
+ "example": "[email protected]"
+ },
+ "name": {
+ "type": "string",
+ "description": "The billing name for SEPA and BACS billing",
+ "example": "Jane Doe"
+ }
+ }
+ },
+ "SepaBankTransferInstructions": {
+ "type": "object",
+ "required": [
+ "account_holder_name",
+ "bic",
+ "country",
+ "iban"
+ ],
+ "properties": {
+ "account_holder_name": {
+ "type": "string",
+ "example": "Jane Doe"
+ },
+ "bic": {
+ "type": "string",
+ "example": "1024419982"
+ },
+ "country": {
+ "type": "string"
+ },
+ "iban": {
+ "type": "string",
+ "example": "123456789"
+ }
+ }
+ },
"SessionToken": {
"oneOf": [
{
@@ -6836,11 +7681,15 @@
},
{
"type": "object",
- "required": ["wallet_name"],
+ "required": [
+ "wallet_name"
+ ],
"properties": {
"wallet_name": {
"type": "string",
- "enum": ["google_pay"]
+ "enum": [
+ "google_pay"
+ ]
}
}
}
@@ -6853,11 +7702,15 @@
},
{
"type": "object",
- "required": ["wallet_name"],
+ "required": [
+ "wallet_name"
+ ],
"properties": {
"wallet_name": {
"type": "string",
- "enum": ["klarna"]
+ "enum": [
+ "klarna"
+ ]
}
}
}
@@ -6870,11 +7723,15 @@
},
{
"type": "object",
- "required": ["wallet_name"],
+ "required": [
+ "wallet_name"
+ ],
"properties": {
"wallet_name": {
"type": "string",
- "enum": ["paypal"]
+ "enum": [
+ "paypal"
+ ]
}
}
}
@@ -6887,11 +7744,15 @@
},
{
"type": "object",
- "required": ["wallet_name"],
+ "required": [
+ "wallet_name"
+ ],
"properties": {
"wallet_name": {
"type": "string",
- "enum": ["apple_pay"]
+ "enum": [
+ "apple_pay"
+ ]
}
}
}
@@ -6934,7 +7795,9 @@
"oneOf": [
{
"type": "object",
- "required": ["ali_pay"],
+ "required": [
+ "ali_pay"
+ ],
"properties": {
"ali_pay": {
"$ref": "#/components/schemas/AliPayRedirection"
@@ -6943,7 +7806,9 @@
},
{
"type": "object",
- "required": ["apple_pay"],
+ "required": [
+ "apple_pay"
+ ],
"properties": {
"apple_pay": {
"$ref": "#/components/schemas/ApplePayWalletData"
@@ -6952,7 +7817,9 @@
},
{
"type": "object",
- "required": ["google_pay"],
+ "required": [
+ "google_pay"
+ ],
"properties": {
"google_pay": {
"$ref": "#/components/schemas/GooglePayWalletData"
@@ -6961,7 +7828,9 @@
},
{
"type": "object",
- "required": ["mb_way"],
+ "required": [
+ "mb_way"
+ ],
"properties": {
"mb_way": {
"$ref": "#/components/schemas/MbWayRedirection"
@@ -6970,7 +7839,9 @@
},
{
"type": "object",
- "required": ["mobile_pay"],
+ "required": [
+ "mobile_pay"
+ ],
"properties": {
"mobile_pay": {
"$ref": "#/components/schemas/MobilePayRedirection"
@@ -6979,7 +7850,9 @@
},
{
"type": "object",
- "required": ["paypal_redirect"],
+ "required": [
+ "paypal_redirect"
+ ],
"properties": {
"paypal_redirect": {
"$ref": "#/components/schemas/PaypalRedirection"
@@ -6988,7 +7861,9 @@
},
{
"type": "object",
- "required": ["paypal_sdk"],
+ "required": [
+ "paypal_sdk"
+ ],
"properties": {
"paypal_sdk": {
"$ref": "#/components/schemas/PayPalWalletData"
@@ -6997,7 +7872,9 @@
},
{
"type": "object",
- "required": ["we_chat_pay_redirect"],
+ "required": [
+ "we_chat_pay_redirect"
+ ],
"properties": {
"we_chat_pay_redirect": {
"$ref": "#/components/schemas/WeChatPayRedirection"
@@ -7121,4 +7998,4 @@
"description": "Manage disputes"
}
]
-}
+}
\ No newline at end of file
|
feat
|
Create a new workflow to validate the generated openAPI spec file (openapi_spec.json) (#1323)
|
88627463eacd86bf3c8726ea4a08aedb6236ca32
|
2024-02-28 05:45:59
|
github-actions
|
chore(postman): update Postman collection files
| false
|
diff --git a/postman/collection-json/nmi.postman_collection.json b/postman/collection-json/nmi.postman_collection.json
index f09c6bfc1b9..3458081d489 100644
--- a/postman/collection-json/nmi.postman_collection.json
+++ b/postman/collection-json/nmi.postman_collection.json
@@ -86,6 +86,15 @@
{
"name": "Merchant Account - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -150,15 +159,6 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
}
],
"request": {
@@ -327,6 +327,15 @@
{
"name": "Payment Connector - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -374,15 +383,6 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- ""
- ],
- "type": "text/javascript"
- }
}
],
"request": {
@@ -424,7 +424,7 @@
"language": "json"
}
},
- "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"nmi\",\"connector_account_details\":{\"auth_type\":\"HeaderKey\",\"api_key\":\"{{connector_api_key}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"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}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}]}"
+ "raw": "{\"connector_type\":\"fiz_operations\",\"connector_name\":\"nmi\",\"connector_account_details\":{\"auth_type\":\"BodyKey\",\"api_key\":\"{{connector_api_key}}\",\"key1\":\"{{connector_key1}}\"},\"test_mode\":false,\"disabled\":false,\"business_country\":\"US\",\"business_label\":\"default\",\"payment_methods_enabled\":[{\"payment_method\":\"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}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"apple_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]},{\"payment_method\":\"wallet\",\"payment_method_types\":[{\"payment_method_type\":\"google_pay\",\"payment_experience\":\"invoke_sdk_client\",\"minimum_amount\":1,\"maximum_amount\":68607706,\"recurring_enabled\":true,\"installment_payment_enabled\":true}]}]}"
},
"url": {
"raw": "{{baseUrl}}/account/:account_id/connectors",
@@ -451,6 +451,16 @@
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -525,16 +535,6 @@
],
"type": "text/javascript"
}
- },
- {
- "listen": "prerequest",
- "script": {
- "exec": [
- "pm.environment.set(\"random_number\", _.random(1000, 100000));",
- ""
- ],
- "type": "text/javascript"
- }
}
],
"request": {
@@ -551,12 +551,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+1\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -652,6 +652,15 @@
{
"name": "Refunds - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -709,12 +718,12 @@
],
"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"
}
- }
+ },
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/refunds",
@@ -813,17 +822,25 @@
"name": "Happy Cases",
"item": [
{
- "name": "Scenario1-Create payment with confirm true",
+ "name": "Scenario10-Create a mandate and recurring payment",
"item": [
{
"name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
"// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -886,7 +903,7 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
" \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
@@ -895,6 +912,22 @@
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -915,12 +948,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":100000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -1013,6 +1046,22 @@
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1053,21 +1102,24 @@
"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",
+ "name": "Recurring Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
"// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -1130,15 +1182,39 @@
" );",
"}",
"",
- "// Response body should have value \"requires_confirmation\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"payment_method_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1159,12 +1235,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my last payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -1180,29 +1256,26 @@
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Retrieve-copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ "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(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "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(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -1251,15 +1324,31 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1267,55 +1356,27 @@
}
],
"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",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id",
- "confirm"
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
],
"variable": [
{
@@ -1325,31 +1386,49 @@
}
]
},
- "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"
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
},
"response": []
- },
+ }
+ ]
+ },
+ {
+ "name": "Scenario11-Refund recurring payment",
+ "item": [
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
+ "// Set the environment variable 'amount' with the value from the response",
+ "pm.environment.set(\"amount\", pm.response.json().amount);",
+ "",
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - 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.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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -1398,15 +1477,31 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1414,68 +1509,60 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":100000,\"currency\":\"USD\"}}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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"
+ "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": "Scenario3-Create payment without PMD",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Retrieve",
"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.test(\"[GET]::/payments/:id - 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.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(\"[POST]::/payments - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -1524,15 +1611,31 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1540,63 +1643,74 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "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": "Payments - Confirm",
+ "name": "Recurring Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
+ "// 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/:id/confirm - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "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/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -1645,15 +1759,39 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"payment_method_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'payment_method_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.payment_method_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1661,26 +1799,6 @@
}
],
"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": [
{
@@ -1699,32 +1817,23 @@
"language": "json"
}
},
- "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}}}"
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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/:id/confirm",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "confirm"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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"
+ "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",
+ "name": "Payments - Retrieve-copy",
"event": [
{
"listen": "test",
@@ -1792,15 +1901,31 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -1841,90 +1966,73 @@
"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": "Scenario4-Create payment with Manual capture",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Refunds - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
- "pm.environment.set(\"amount\", pm.response.json().amount);",
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
"",
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ "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]::/payments - Content-Type is application/json\", function () {",
+ "pm.test(\"[POST]::/refunds - 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);",
+ "// 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 {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_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 \"pending\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value for \"amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.amount).to.eql(amount);",
" },",
" );",
"}",
@@ -1948,101 +2056,92 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/refunds",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "refunds"
]
},
- "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"
+ "description": "To create a refund against an already processed payment"
},
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Refunds - Retrieve",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
+ "// Get the value of 'amount' from the environment",
+ "const refund_amount = pm.environment.get(\"amount\");",
+ "",
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "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]::/payments/:id - Content-Type is application/json\", function () {",
+ "pm.test(\"[GET]::/refunds/: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);",
+ "// 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 {{mandate_id}} as collection variable for value\",",
- " jsonData.mandate_id,",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_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]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value for \"refund_amount\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/refunds - Content check if value for 'refund_amount' matches '{{refund_amount}}'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.amount).to.eql(refund_amount);",
" },",
" );",
"}",
@@ -2061,59 +2160,62 @@
}
],
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/refunds/:id",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
+ "refunds",
":id"
],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
"variable": [
{
"key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund 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"
+ "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": "Scenario1-Create payment with confirm true",
+ "item": [
{
- "name": "Payments - Capture",
+ "name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const amount = pm.environment.get(\"amount\");",
- "",
"// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "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/:id/capture - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -2165,32 +2267,12 @@
"// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
- "",
- "// Response body should have value \"{{amount}}\" for \"amount\"",
- "if (jsonData?.amount) {",
- " pm.test(",
- " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",
- " function () {",
- " pm.expect(jsonData.amount).to.eql(amount);",
- " },",
- " );",
- "}",
- "",
- "// Response body should have value \"{{amount}}\" for \"amount_received\"",
- "if (jsonData?.amount_received) {",
- " pm.test(",
- " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
- " function () {",
- " pm.expect(jsonData.amount_received).to.eql(amount);",
- " },",
- " );",
- "}",
""
],
"type": "text/javascript"
@@ -2211,37 +2293,28 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount_to_capture\": {{amount}},\n \"statement_descriptor_name\": \"Joseph\",\n \"statement_descriptor_suffix\": \"JS\"\n}",
"options": {
"raw": {
"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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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/:id/capture",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "capture"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "description": "To capture the funds for an uncaptured payment"
+ "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-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
@@ -2309,10 +2382,10 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
@@ -2362,17 +2435,25 @@
]
},
{
- "name": "Scenario5-Void the payment",
+ "name": "Scenario2-Create payment with confirm false",
"item": [
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"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;",
@@ -2435,12 +2516,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"requires_confirmation\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
@@ -2464,12 +2545,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my last payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -2485,26 +2566,29 @@
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Confirm",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -2553,12 +2637,12 @@
" );",
"}",
"",
- "// Response body should have value \"cancelled\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -2569,115 +2653,26 @@
}
],
"request": {
- "method": "GET",
- "header": [
- {
- "key": "Accept",
- "value": "application/json"
- }
- ],
- "url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
- "host": [
- "{{baseUrl}}"
- ],
- "path": [
- "payments",
- ":id"
- ],
- "query": [
+ "auth": {
+ "type": "apikey",
+ "apikey": [
{
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
{
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
}
]
},
- "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": "Payments - Cancel",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
- " );",
- "}",
- "",
- "// Response body should have value \"cancelled\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
- " },",
- " );",
- "}",
- ""
- ],
- "type": "text/javascript"
- }
- }
- ],
- "request": {
"method": "POST",
"header": [
{
@@ -2696,17 +2691,17 @@
"language": "json"
}
},
- "raw": "{\"cancellation_reason\":\"user_cancel\"}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/cancel",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
":id",
- "cancel"
+ "confirm"
],
"variable": [
{
@@ -2716,12 +2711,12 @@
}
]
},
- "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
+ "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-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
@@ -2789,12 +2784,12 @@
" );",
"}",
"",
- "// Response body should have value \"cancelled\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -2842,19 +2837,25 @@
]
},
{
- "name": "Scenario9-Refund full payment",
+ "name": "Scenario2a-Create payment with confirm false card holder name null",
"item": [
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 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;",
@@ -2917,12 +2918,12 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -2946,12 +2947,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -2967,26 +2968,38 @@
"response": []
},
{
- "name": "Payments - Retrieve",
+ "name": "Payments - Confirm",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -3035,12 +3048,12 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -3051,27 +3064,55 @@
}
],
"request": {
- "method": "GET",
+ "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\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":null,\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
+ ":id",
+ "confirm"
],
"variable": [
{
@@ -3081,67 +3122,85 @@
}
]
},
- "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"
+ "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": "Refunds - Create",
+ "name": "Payments - Retrieve",
"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.test(\"[GET]::/payments/:id - 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.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 refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// 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 {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"pending\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(amount);",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -3152,96 +3211,130 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"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",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "description": "To create a refund against an already processed payment"
+ "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": "Scenario2b-Create payment with confirm false card holder name empty",
+ "item": [
{
- "name": "Refunds - Retrieve",
+ "name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const refund_amount = pm.environment.get(\"amount\");",
- "",
"// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments - 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.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 refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// 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 {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"{{refund_amount}}\" for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(refund_amount);",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -3252,62 +3345,72 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
+ "payments"
]
},
- "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"
+ "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": "Scenario10-Partial refund",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Confirm",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"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\",",
- " );",
- "});",
+ "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 - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -3356,22 +3459,41 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
- "}",
- ""
+ "}"
],
"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": [
{
@@ -3385,23 +3507,32 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"\",\"card_cvc\":\"123\"}},\"client_secret\":\"{{client_secret}}\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"125.0.0.1\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "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": []
},
@@ -3474,16 +3605,15 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
" pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
- "}",
- ""
+ "}"
],
"type": "text/javascript"
}
@@ -3523,61 +3653,97 @@
"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": "Scenario3-Create payment without PMD",
+ "item": [
{
- "name": "Refunds - Create",
+ "name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ "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]::/refunds - Content-Type is application/json\", function () {",
+ "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 refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// 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 {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"pending\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"540\" for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '100'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(100);",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -3606,38 +3772,55 @@
"language": "json"
}
},
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":100,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/refunds",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments"
]
},
- "description": "To create a refund against an already processed payment"
+ "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": "Refunds - Retrieve",
+ "name": "Payments - Confirm",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
+ "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",
@@ -3646,35 +3829,51 @@
" 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);",
+ "// 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 {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
" );",
"}",
"",
- "// Response body should have value \"6540\" for \"amount\"",
+ "// 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]::/refunds - Content check if value for 'amount' matches '100'\",",
+ " \"[POST]::/payments:id/confirm - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(100);",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -3685,88 +3884,279 @@
}
],
"request": {
- "method": "GET",
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}}}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
- ":id"
+ "payments",
+ ":id",
+ "confirm"
],
"variable": [
{
"key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment 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"
+ "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": "Refunds - Create-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ "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(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ "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 refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// 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 {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"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]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " \"[POST]::/payments:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario4-Create payment with Manual capture",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"amount\", pm.response.json().amount);",
"",
- "// Response body should have value \"1000\" for \"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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_capture\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(10);",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -3795,75 +4185,6810 @@
"language": "json"
}
},
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/refunds",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments"
]
},
- "description": "To create a refund against an already processed payment"
+ "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": "Refunds - Retrieve-copy",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
"// Validate status 2xx",
- "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ "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]::/refunds/:id - Content-Type is application/json\", function () {",
+ "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 refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ "// 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_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Payments - Capture",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"{{amount}}\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"{{amount}}\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario5-Void the payment",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"cancelled\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Payments - Cancel",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/cancel - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"cancelled\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/cancel - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "{\"cancellation_reason\":\"user_cancel\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/cancel",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "cancel"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy",
+ "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 \"cancelled\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'cancelled'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"cancelled\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Scenario6-Refund full payment",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const refund_amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/refunds/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/refunds/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
+ "if (jsonData?.refund_id) {",
+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ " console.log(",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"{{refund_amount}}\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '{{refund_amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(refund_amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario7-Partial refund",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
+ "if (jsonData?.refund_id) {",
+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ " console.log(",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"540\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(100);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "{\"payment_id\":\"{{payment_id}}\",\"amount\":100,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '100'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(100);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Create-copy",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
+ "if (jsonData?.refund_id) {",
+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ " console.log(",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"1000\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(10);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Retrieve-copy",
+ "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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(10);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"refunds\"",
+ "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",
+ " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",
+ "});",
+ ""
+ ],
+ "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": "Scenario8-Create a failure card payment with confirm true",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 'failed'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"failed\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have value \"200\" for \"error_code\"",
+ "if (jsonData?.error_code) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches '200'\",",
+ " function () {",
+ " pm.expect(jsonData.error_code).to.eql(\"200\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"message - DECLINE\"",
+ "if (jsonData?.error_message) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'DECLINE'\",",
+ " 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",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"01\",\"card_exp_year\":\"26\",\"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\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'failed'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"failed\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have value \"200\" for \"error_code\"",
+ "if (jsonData?.error_code) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_code' matches '200'\",",
+ " function () {",
+ " pm.expect(jsonData.error_code).to.eql(\"200\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"message - DECLINE\"",
+ "if (jsonData?.error_message) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error_message' matches 'DECLINE'\",",
+ " function () {",
+ " pm.expect(jsonData.error_message).to.eql(\"DECLINE\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Scenario9-Update amount with automatic capture",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(1000, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ "})};",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Update",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "pm.environment.set(\"another_random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set the environment variable 'amount' with the value from the response",
+ "pm.environment.set(\"amount\", pm.response.json().amount);",
+ "",
+ "// Get the value of 'amount' from the environment",
+ "const updated_amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "",
+ "// Parse the JSON response",
+ "var jsonData = pm.response.json();",
+ "",
+ "// Check if the 'amount' is equal to \"updated_amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'\", function () {",
+ " pm.expect(jsonData.amount).to.eql(updated_amount);",
+ "});",
+ "",
+ "",
+ ""
+ ],
+ "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\":\"{{another_random_number}}\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Confirm",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments/:id/confirm - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "//// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'processing'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ "})};",
+ "",
+ "",
+ "// Check if the 'amount' is equal to \"amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ "});",
+ "",
+ "//// Response body should have value \"amount_received\" for \"amount\"",
+ "if (jsonData?.amount_received) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ "})};",
+ ""
+ ],
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"setup_future_usage\":\"on_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
+ "};",
+ "",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
+ "",
+ "//// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ "})};",
+ "",
+ "",
+ "// Check if the 'amount' is equal to \"amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ "});",
+ "",
+ "//// Response body should have value \"amount_received\" for \"amount\"",
+ "if (jsonData?.amount_received) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ "})};",
+ ""
+ ],
+ "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": "Scenario9a-Update amount with manual capture",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set customer_id as variable for jsonData.customer_id",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ "})};",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Update",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "pm.environment.set(\"another_random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Set the environment variable 'amount' with the value from the response",
+ "pm.environment.set(\"amount\", pm.response.json().amount);",
+ "",
+ "// Get the value of 'amount' from the environment",
+ "const updated_amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "",
+ "// Parse the JSON response",
+ "var jsonData = pm.response.json();",
+ "",
+ "// Check if the 'amount' is equal to \"updated_amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{updated_amount}}'\", function () {",
+ " pm.expect(jsonData.amount).to.eql(updated_amount);",
+ "});",
+ "",
+ "",
+ ""
+ ],
+ "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\":\"{{another_random_number}}\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "To update the properties of a PaymentIntent object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created "
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Confirm",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments/:id/confirm - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "//// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'processing'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ "})};",
+ "",
+ "",
+ "// Check if the 'amount' is equal to \"amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ "});",
+ "",
+ "//// Response body should have value \"amount_received\" for \"amount\"",
+ "if (jsonData?.amount_received) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ "})};",
+ ""
+ ],
+ "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"
+ },
+ {
+ "key": "x-feature",
+ "value": "router-custom",
+ "type": "text",
+ "disabled": true
+ },
+ {
+ "key": "publishable_key",
+ "value": "",
+ "type": "text",
+ "disabled": true
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"737\"}},\"setup_future_usage\":\"on_session\",\"browser_info\":{\"user_agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36\",\"accept_header\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\"language\":\"nl-NL\",\"color_depth\":24,\"screen_height\":723,\"screen_width\":1536,\"time_zone\":0,\"java_enabled\":true,\"java_script_enabled\":true,\"ip_address\":\"128.0.0.1\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// 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_capture\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ "})};",
+ "",
+ "",
+ "// Check if the 'amount' is equal to \"amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ "});",
+ "",
+ "//// Response body should have value \"amount_received\" for \"amount\"",
+ "if (jsonData?.amount_received) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ "})};",
+ ""
+ ],
+ "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": "Payments - Capture",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ "",
+ "// Response body should have value \"amount\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"0\" for \"amount_capturable\"",
+ "if (jsonData?.amount_capturable) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve Copy",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Validate if response has JSON Body ",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(\"- use {{payment_id}} as collection variable for value\",jsonData.payment_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.');",
+ "};",
+ "",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(\"- use {{mandate_id}} as collection variable for value\",jsonData.mandate_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.');",
+ "};",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(\"- use {{client_secret}} as collection variable for value\",jsonData.client_secret);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.');",
+ "};",
+ "",
+ "//// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ "})};",
+ "",
+ "",
+ "// Check if the 'amount' is equal to \"amount\"",
+ "pm.test(\"[POST]::/payments/:id -Content Check if 'amount' matches '{{amount}}' \", function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ "});",
+ "",
+ "//// Response body should have value \"amount_received\" for \"amount\"",
+ "if (jsonData?.amount_received) {",
+ "pm.test(\"[POST]::/payments - Content check if value for 'amount_received' matches '{{amount}}'\", function() {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ "})};",
+ ""
+ ],
+ "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": "Scenario12-Add card flow",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};",
+ "",
+ "// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " })};"
+ ],
+ "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\":\"{{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\",\"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",
+ "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": "List payment methods for a Customer",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",
+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",
+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "accepted_country",
+ "value": "co",
+ "disabled": true
+ },
+ {
+ "key": "accepted_country",
+ "value": "pa",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "voluptate ea",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "exercitation",
+ "disabled": true
+ },
+ {
+ "key": "minimum_amount",
+ "value": "100",
+ "disabled": true
+ },
+ {
+ "key": "maximum_amount",
+ "value": "10000000",
+ "disabled": true
+ },
+ {
+ "key": "recurring_payment_enabled",
+ "value": "true",
+ "disabled": true
+ },
+ {
+ "key": "installment_payment_enabled",
+ "value": "true",
+ "disabled": true
+ }
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Confirm",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ "// Response body should have value \"nmi\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"737\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "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": "Scenario13-Don't Pass CVV for save card flow and verify success payment",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "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\":\"{{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\",\"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",
+ "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": "List payment methods for a Customer",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",
+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",
+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "accepted_country",
+ "value": "co",
+ "disabled": true
+ },
+ {
+ "key": "accepted_country",
+ "value": "pa",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "voluptate ea",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "exercitation",
+ "disabled": true
+ },
+ {
+ "key": "minimum_amount",
+ "value": "100",
+ "disabled": true
+ },
+ {
+ "key": "maximum_amount",
+ "value": "10000000",
+ "disabled": true
+ },
+ {
+ "key": "recurring_payment_enabled",
+ "value": "true",
+ "disabled": true
+ },
+ {
+ "key": "installment_payment_enabled",
+ "value": "true",
+ "disabled": true
+ }
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Confirm",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"nmi\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(\"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\", function() {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " })};"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario14-Save card payment with manual capture",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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.');",
+ "};",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};",
+ "",
+ "// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}"
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"nmisavecard_{{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\",\"payment_method\":\"card\",\"payment_method_type\":\"credit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"03\",\"card_exp_year\":\"69\",\"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",
+ "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": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ "",
+ "// Response body should have value \"0\" for \"amount_capturable\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(0);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "List payment methods for a Customer",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx ",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payment_methods/:customer_id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(\"application/json\");",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {jsonData = pm.response.json();}catch(e){}",
+ "",
+ "if (jsonData?.customer_payment_methods[0]?.payment_token) {",
+ " pm.collectionVariables.set(\"payment_token\", jsonData.customer_payment_methods[0].payment_token);",
+ " console.log(\"- use {{payment_token}} as collection variable for value\", jsonData.customer_payment_methods[0].payment_token);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{payment_token}}, as jsonData.customer_payment_methods[0].payment_token is undefined.');",
+ "}"
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/customers/:customer_id/payment_methods",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "customers",
+ ":customer_id",
+ "payment_methods"
+ ],
+ "query": [
+ {
+ "key": "accepted_country",
+ "value": "co",
+ "disabled": true
+ },
+ {
+ "key": "accepted_country",
+ "value": "pa",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "voluptate ea",
+ "disabled": true
+ },
+ {
+ "key": "accepted_currency",
+ "value": "exercitation",
+ "disabled": true
+ },
+ {
+ "key": "minimum_amount",
+ "value": "100",
+ "disabled": true
+ },
+ {
+ "key": "maximum_amount",
+ "value": "10000000",
+ "disabled": true
+ },
+ {
+ "key": "recurring_payment_enabled",
+ "value": "true",
+ "disabled": true
+ },
+ {
+ "key": "installment_payment_enabled",
+ "value": "true",
+ "disabled": true
+ }
+ ],
+ "variable": [
+ {
+ "key": "customer_id",
+ "value": "{{customer_id}}",
+ "description": "//Pass the customer id"
+ }
+ ]
+ },
+ "description": "To filter and list the applicable payment methods for a particular Customer ID"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// 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.');",
+ "};",
+ "",
+ "// 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\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "if (jsonData?.customer_id) {",
+ " pm.collectionVariables.set(\"customer_id\", jsonData.customer_id);",
+ " console.log(\"- use {{customer_id}} as collection variable for value\",jsonData.customer_id);",
+ "} else {",
+ " console.log('INFO - Unable to assign variable {{customer_id}}, as jsonData.customer_id is undefined.');",
+ "};"
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"{{customer_id}}\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"joseph\",\"last_name\":\"Doe\"},\"phone\":{\"number\":\"8056594427\",\"country_code\":\"+91\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Save card payments - Confirm",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "",
+ "// Response body should have value \"nmi\" for \"connector\"",
+ "if (jsonData?.connector) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'connector' matches 'nmi'\",",
+ " function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "auth": {
+ "type": "apikey",
+ "apikey": [
+ {
+ "key": "value",
+ "value": "{{publishable_key}}",
+ "type": "string"
+ },
+ {
+ "key": "key",
+ "value": "api-key",
+ "type": "string"
+ },
+ {
+ "key": "in",
+ "value": "header",
+ "type": "string"
+ }
+ ]
+ },
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"client_secret\":\"{{client_secret}}\",\"payment_method\":\"card\",\"payment_token\":\"{{payment_token}}\",\"card_cvc\":\"7373\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/confirm",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "This API is to confirm the payment request and forward payment to the payment processor. This API provides more granular control upon when the API is forwarded to the payment processor. Alternatively you can confirm the payment within the Payments-Create API"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// 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_capture\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_capture'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ "",
+ "// Response body should have value \"amount\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"amount\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"amount\" for \"amount_capturable\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - {{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Payments - Capture",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]:://payments/:id/capture - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ "",
+ "// Response body should have value \"amount\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"0\" for \"amount_capturable\"",
+ "if (jsonData?.amount_capturable) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 0'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount_to_capture\":\"{{amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve-copy-2",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = pm.environment.get(\"amount\");",
+ "",
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ "",
+ "// Response body should have value \"amount\" for \"amount\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"amount\" for \"amount_received\"",
+ "if (jsonData?.amount_received) {",
+ " pm.test(",
+ " \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '{{amount}}'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_received).to.eql(amount);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"6540\" for \"amount_capturable\"",
+ "if (jsonData?.amount) {",
+ " pm.test(",
+ " \"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'\",",
+ " function () {",
+ " pm.expect(jsonData.amount_capturable).to.eql(0);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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": "Refunds - Create Copy",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[POST]::/refunds - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
+ "if (jsonData?.refund_id) {",
+ " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
+ " console.log(",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"pending\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'pending'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"pending\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"10\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(10);",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Validate the connector",
+ "pm.test(\"[POST]::/payments - connector\", function () {",
+ " pm.expect(jsonData.connector).to.eql(\"nmi\");",
+ "});",
+ ""
+ ],
+ "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": "{\"payment_id\":\"{{payment_id}}\",\"amount\":10,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/refunds",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds"
+ ]
+ },
+ "description": "To create a refund against an already processed payment"
+ },
+ "response": []
+ },
+ {
+ "name": "Refunds - Retrieve Copy",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"10\" for \"amount\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " function () {",
+ " pm.expect(jsonData.amount).to.eql(10);",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ }
+ ],
+ "request": {
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/refunds/:id",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "refunds",
+ ":id"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{refund_id}}",
+ "description": "(Required) unique refund id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+ },
+ "response": []
+ }
+ ]
+ },
+ {
+ "name": "Scenario15-Create payment without customer_id and with billing address and shipping address",
+ "item": [
+ {
+ "name": "Payments - Create",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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 \"processing\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"business_country\":\"US\",\"business_label\":\"default\",\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"bernard123\",\"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\",\"payment_method\":\"card\",\"payment_method_type\":\"debit\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"69\",\"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\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\",\"last_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Retrieve",
+ "event": [
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 2xx",
+ "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
+ " pm.response.to.be.success;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have value \"Succeeded\" for \"status\"",
+ "if (jsonData?.status) {",
+ " pm.test(",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " function () {",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " },",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"connector_transaction_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'connector_transaction_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.connector_transaction_id !== \"undefined\").to.be",
+ " .true;",
+ " },",
+ ");",
+ ""
+ ],
+ "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": "Variation Cases",
+ "item": [
+ {
+ "name": "Scenario1-Create payment with Invalid card details",
+ "item": [
+ {
+ "name": "Payments - Create(Invalid card number)",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"error\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ "});",
+ "",
+ "// Response body should have value \"connector error\" for \"error type\"",
+ "if (jsonData?.error?.type) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'\",",
+ " function () {",
+ " pm.expect(jsonData.error.type).to.eql(\"connector_error\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"123456\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Invalid Exp month)",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ " console.log(",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ "});",
+ "",
+ "// Response body should have value \"connector error\" for \"error type\"",
+ "if (jsonData?.error?.type) {",
+ " pm.test(",
+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",
+ " function () {",
+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
+ " },",
+ " );",
+ "}",
+ ""
+ ],
+ "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\":2222,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":2222,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2023\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": [
+ "{{baseUrl}}"
+ ],
+ "path": [
+ "payments"
+ ]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+ },
+ "response": []
+ },
+ {
+ "name": "Payments - Create(Invalid Exp Year)",
+ "event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
+ "});",
+ "",
+ "// Validate if response header has matching content-type",
+ "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ "});",
+ "",
+ "// Validate if response has JSON Body",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ " pm.response.to.have.jsonBody();",
+ "});",
+ "",
+ "// Set response object as internal variable",
+ "let jsonData = {};",
+ "try {",
+ " jsonData = pm.response.json();",
+ "} catch (e) {}",
+ "",
+ "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
+ "if (jsonData?.payment_id) {",
+ " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
+ " console.log(",
+ " \"- use {{payment_id}} as collection variable for value\",",
+ " jsonData.payment_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
+ "if (jsonData?.mandate_id) {",
+ " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
+ " console.log(",
+ " \"- use {{mandate_id}} as collection variable for value\",",
+ " jsonData.mandate_id,",
+ " );",
+ "} else {",
+ " console.log(",
+ " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
+ " );",
+ "}",
+ "",
+ "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
+ "if (jsonData?.client_secret) {",
+ " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
" console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
+ " \"- use {{client_secret}} as collection variable for value\",",
+ " jsonData.client_secret,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
+ " \"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]::/refunds - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
+ "// Response body should have \"next_action.redirect_to_url\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ "});",
"",
- "// Response body should have value \"6540\" for \"amount\"",
- "if (jsonData?.status) {",
+ "// Response body should have value \"connector error\" for \"error type\"",
+ "if (jsonData?.error?.type) {",
" pm.test(",
- " \"[POST]::/refunds - Content check if value for 'amount' matches '10'\",",
+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",
" function () {",
- " pm.expect(jsonData.amount).to.eql(10);",
+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
" },",
" );",
"}",
@@ -3874,55 +10999,69 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"2022\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/refunds/:id",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds",
- ":id"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{refund_id}}",
- "description": "(Required) unique refund id"
- }
+ "payments"
]
},
- "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"
+ "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-copy",
+ "name": "Payments - Create(invalid CVV)",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ "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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -3971,20 +11110,20 @@
" );",
"}",
"",
- "// Response body should have value \"Succeeded\" for \"status\"",
- "if (jsonData?.status) {",
+ "// Response body should have \"error\"",
+ "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ "});",
+ "",
+ "// Response body should have value \"connector error\" for \"error type\"",
+ "if (jsonData?.error?.type) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.error.type).to.eql(\"connector\");",
" },",
" );",
"}",
- "",
- "// Response body should have \"refunds\"",
- "pm.test(\"[POST]::/payments - Content check if 'refunds' exists\", function () {",
- " pm.expect(typeof jsonData.refunds !== \"undefined\").to.be.true;",
- "});",
""
],
"type": "text/javascript"
@@ -3992,62 +11131,64 @@
}
],
"request": {
- "method": "GET",
+ "method": "POST",
"header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
{
"key": "Accept",
"value": "application/json"
}
],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"123456\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"12345\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
+ },
"url": {
- "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id"
- ],
- "query": [
- {
- "key": "force_sync",
- "value": "true"
- }
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "payments"
]
},
- "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"
+ "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": "Variation Cases",
- "item": [
+ },
{
- "name": "Scenario1-Create payment with Invalid card details",
+ "name": "Scenario2-Confirming the payment without PMD",
"item": [
{
- "name": "Payments - Create(Invalid card number)",
+ "name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
- "// Validate status 4xx",
- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
- " pm.response.to.be.error;",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "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",
@@ -4107,17 +11248,12 @@
" );",
"}",
"",
- "// Response body should have \"error\"",
- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
- "});",
- "",
- "// Response body should have value \"connector error\" for \"error type\"",
- "if (jsonData?.error?.type) {",
+ "// Response body should have value \"requires_payment_method\" for \"status\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector_error'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
" function () {",
- " pm.expect(jsonData.error.type).to.eql(\"connector_error\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
" },",
" );",
"}",
@@ -4141,12 +11277,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"123456\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -4162,8 +11298,17 @@
"response": []
},
{
- "name": "Payments - Create(Invalid Exp month)",
+ "name": "Payments - Confirm",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
@@ -4174,14 +11319,17 @@
"});",
"",
"// 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\",",
- " );",
- "});",
+ "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 - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -4230,15 +11378,18 @@
" );",
"}",
"",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
- "});",
+ "// Response body should have \"error\"",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ " },",
+ ");",
"",
"// Response body should have value \"connector error\" for \"error type\"",
"if (jsonData?.error?.type) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",
" function () {",
" pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
" },",
@@ -4251,6 +11402,26 @@
}
],
"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": [
{
@@ -4269,31 +11440,55 @@
"language": "json"
}
},
- "raw": "{\"amount\":2222,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":2222,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"01\",\"card_exp_year\":\"2023\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"client_secret\":\"{{client_secret}}\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id/confirm",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "confirm"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "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": "Scenario3-Capture greater amount",
+ "item": [
{
- "name": "Payments - Create(Invalid Exp Year)",
+ "name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 4xx",
- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
- " pm.response.to.be.error;",
+ "// 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",
@@ -4353,17 +11548,12 @@
" );",
"}",
"",
- "// Response body should have \"next_action.redirect_to_url\"",
- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
- "});",
- "",
- "// Response body should have value \"connector error\" for \"error type\"",
- "if (jsonData?.error?.type) {",
+ "// Response body should have value \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'error.type' matches 'invalid_request'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
@@ -4387,12 +11577,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4242424242424242\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"2022\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"manual\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -4408,28 +11598,26 @@
"response": []
},
{
- "name": "Payments - Create(invalid CVV)",
+ "name": "Payments - Retrieve",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
- "// Validate status 4xx",
- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
- " pm.response.to.be.error;",
+ "// 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(\"[POST]::/payments - Content-Type is application/json\", function () {",
+ "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(\"[POST]::/payments - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -4478,17 +11666,12 @@
" );",
"}",
"",
- "// Response body should have \"error\"",
- "pm.test(\"[POST]::/payments - Content check if 'error' exists\", function () {",
- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
- "});",
- "",
- "// Response body should have value \"connector error\" for \"error type\"",
- "if (jsonData?.error?.type) {",
+ "// Response body should have value \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'error.type' matches 'connector'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.error.type).to.eql(\"connector\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -4499,67 +11682,76 @@
}
],
"request": {
- "method": "POST",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"123456\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"12345\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
- "options": {
- "raw": {
- "language": "json"
- }
- }
- },
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "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-Confirming the payment without PMD",
- "item": [
+ },
{
- "name": "Payments - Create",
+ "name": "Payments - Capture",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ "// Get the value of 'amount' from the environment",
+ "const capture_amount = parseInt(pm.environment.get(\"amount\")) + 1000;",
"",
- "// Validate status 2xx",
- "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
+ "pm.test(",
+ " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " function () {",
+ " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
+ " \"application/json\",",
+ " );",
+ " },",
+ ");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -4608,12 +11800,20 @@
" );",
"}",
"",
- "// Response body should have value \"requires_payment_method\" for \"status\"",
- "if (jsonData?.status) {",
+ "// Response body should have \"error\"",
+ "pm.test(",
+ " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have value \"connector error\" for \"error type\"",
+ "if (jsonData?.error?.type) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_payment_method'\",",
+ " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_payment_method\");",
+ " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
" },",
" );",
"}",
@@ -4637,50 +11837,56 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount_to_capture\":\"{{capture_amount}}\",\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments",
+ "raw": "{{baseUrl}}/payments/:id/capture",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments"
+ "payments",
+ ":id",
+ "capture"
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
]
},
- "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"
+ "description": "To capture the funds for an uncaptured payment"
},
"response": []
},
{
- "name": "Payments - Confirm",
+ "name": "Payments - Retrieve-copy",
"event": [
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 4xx",
- "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
- " pm.response.to.be.error;",
+ "// 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(",
- " \"[POST]::/payments/:id/confirm - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
+ "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(\"[POST]::/payments/:id/confirm - Response has JSON Body\", function () {",
+ "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -4729,20 +11935,12 @@
" );",
"}",
"",
- "// Response body should have \"error\"",
- "pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",
- " function () {",
- " pm.expect(typeof jsonData.error !== \"undefined\").to.be.true;",
- " },",
- ");",
- "",
- "// Response body should have value \"connector error\" for \"error type\"",
- "if (jsonData?.error?.type) {",
+ "// Response body should have value \"requires_capture\" for \"status\"",
+ "if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
" function () {",
- " pm.expect(jsonData.error.type).to.eql(\"invalid_request\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
" },",
" );",
"}",
@@ -4753,55 +11951,27 @@
}
],
"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",
+ "method": "GET",
"header": [
- {
- "key": "Content-Type",
- "value": "application/json"
- },
{
"key": "Accept",
"value": "application/json"
}
],
- "body": {
- "mode": "raw",
- "options": {
- "raw": {
- "language": "json"
- }
- },
- "raw": "{\"client_secret\":\"{{client_secret}}\"}"
- },
"url": {
- "raw": "{{baseUrl}}/payments/:id/confirm",
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
- ":id",
- "confirm"
+ ":id"
+ ],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
],
"variable": [
{
@@ -4811,24 +11981,32 @@
}
]
},
- "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"
+ "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": "Scenario3-Capture greater amount",
+ "name": "Scenario4-Capture the succeeded payment",
"item": [
{
"name": "Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"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;",
@@ -4891,7 +12069,7 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
" \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
@@ -4920,12 +12098,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"manual\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -5009,12 +12187,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -5062,13 +12240,19 @@
{
"name": "Payments - Capture",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const capture_amount = parseInt(pm.environment.get(\"amount\")) + 1000;",
- "",
"// Validate status 4xx",
"pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {",
" pm.response.to.be.error;",
@@ -5171,12 +12355,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount_to_capture\": {{capture_amount}},\n \"statement_descriptor_name\": \"Joseph\",\n \"statement_descriptor_suffix\": \"JS\"\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id/capture",
@@ -5269,12 +12453,12 @@
" );",
"}",
"",
- "// Response body should have value \"requires_capture\" for \"status\"",
+ "// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_capture'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_capture\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
@@ -5322,17 +12506,25 @@
]
},
{
- "name": "Scenario4-Capture the succeeded payment",
+ "name": "Scenario5-Void the success_slash_failure payment",
"item": [
{
"name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
"// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -5424,12 +12616,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -5564,20 +12756,29 @@
"response": []
},
{
- "name": "Payments - Capture",
+ "name": "Payments - Cancel",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
"// Validate status 4xx",
- "pm.test(\"[POST]::/payments/:id/capture - Status code is 4xx\", function () {",
+ "pm.test(\"[POST]::/payments/:id/cancel - Status code is 4xx\", function () {",
" pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
"pm.test(",
- " \"[POST]::/payments/:id/capture - Content-Type is application/json\",",
+ " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
" function () {",
" pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
" \"application/json\",",
@@ -5586,7 +12787,7 @@
");",
"",
"// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/capture - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -5609,19 +12810,6 @@
" );",
"}",
"",
- "// 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);",
@@ -5677,17 +12865,17 @@
"language": "json"
}
},
- "raw": "{\"amount_to_capture\":7000,\"statement_descriptor_name\":\"Joseph\",\"statement_descriptor_suffix\":\"JS\"}"
+ "raw": "{\"cancellation_reason\":\"user_cancel\"}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/capture",
+ "raw": "{{baseUrl}}/payments/:id/cancel",
"host": [
"{{baseUrl}}"
],
"path": [
"payments",
":id",
- "capture"
+ "cancel"
],
"variable": [
{
@@ -5697,142 +12885,34 @@
}
]
},
- "description": "To capture the funds for an uncaptured payment"
+ "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
},
"response": []
- },
+ }
+ ]
+ },
+ {
+ "name": "Scenario7-Refund exceeds amount",
+ "item": [
{
- "name": "Payments - Retrieve-copy",
+ "name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id",
- "if (jsonData?.mandate_id) {",
- " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);",
- " console.log(",
- " \"- use {{mandate_id}} as collection variable for value\",",
- " jsonData.mandate_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
- " console.log(",
- " \"- use {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
- " );",
- "}",
- "",
- "// Response body should have value \"Succeeded\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
- " },",
- " );",
- "}",
+ "pm.environment.set(\"random_number\", _.random(100, 100000));",
""
],
"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": "Scenario5-Void the success_slash_failure payment",
- "item": [
- {
- "name": "Payments - Create",
- "event": [
{
"listen": "test",
"script": {
"exec": [
- "pm.environment.set(\"random_number\", _.random(100, 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 () {",
@@ -5925,12 +13005,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -5952,6 +13032,9 @@
"listen": "test",
"script": {
"exec": [
+ "// Get the value of 'amount' from the environment",
+ "const amount = parseInt(pm.environment.get(\"amount\")) + 100000;",
+ "",
"// Validate status 2xx",
"pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -6065,30 +13148,37 @@
"response": []
},
{
- "name": "Payments - Cancel",
+ "name": "Refunds - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
+ "// Get the value of 'amount' from the environment",
+ "const refund_amount = parseInt(pm.environment.get(\"amount\") + 100000);",
+ "",
+ "// Set 'refund_amount' as an environment variable for the current request",
+ "pm.environment.set(\"refund_amount\", refund_amount);",
+ "",
"// Validate status 4xx",
- "pm.test(\"[POST]::/payments/:id/cancel - Status code is 4xx\", function () {",
+ "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {",
" pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(",
- " \"[POST]::/payments/:id/cancel - Content-Type is application/json\",",
- " function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- " },",
- ");",
- "",
- "// Validate if response has JSON Body",
- "pm.test(\"[POST]::/payments/:id/cancel - Response has JSON Body\", function () {",
- " pm.response.to.have.jsonBody();",
+ "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",
@@ -6097,29 +13187,16 @@
" jsonData = pm.response.json();",
"} catch (e) {}",
"",
- "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id",
- "if (jsonData?.payment_id) {",
- " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);",
- " console.log(",
- " \"- use {{payment_id}} as collection variable for value\",",
- " jsonData.payment_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",",
- " );",
- "}",
- "",
- "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret",
- "if (jsonData?.client_secret) {",
- " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);",
+ "// 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 {{client_secret}} as collection variable for value\",",
- " jsonData.client_secret,",
+ " \"- use {{refund_id}} as collection variable for value\",",
+ " jsonData.refund_id,",
" );",
"} else {",
" console.log(",
- " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",",
+ " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
" );",
"}",
"",
@@ -6165,47 +13242,43 @@
"language": "json"
}
},
- "raw": "{\"cancellation_reason\":\"user_cancel\"}"
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":\"{{refund_amount}}\",\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
- "raw": "{{baseUrl}}/payments/:id/cancel",
+ "raw": "{{baseUrl}}/refunds",
"host": [
"{{baseUrl}}"
],
"path": [
- "payments",
- ":id",
- "cancel"
- ],
- "variable": [
- {
- "key": "id",
- "value": "{{payment_id}}",
- "description": "(Required) unique payment id"
- }
+ "refunds"
]
},
- "description": "A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action"
+ "description": "To create a refund against an already processed payment"
},
"response": []
}
]
},
{
- "name": "Scenario7-Refund exceeds amount",
+ "name": "Scenario8-Refund for unsuccessful payment",
"item": [
{
"name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
- "// Set the environment variable 'amount' with the value from the response",
- "pm.environment.set(\"amount\", pm.response.json().amount);",
- "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
"// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -6268,12 +13341,12 @@
" );",
"}",
"",
- "// Response body should have value \"succeeded\" for \"status\"",
+ "// Response body should have value \"requires_confirmation\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"processing\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
@@ -6297,12 +13370,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": true,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "raw": "{\"amount\":\"{{random_number}}\",\"currency\":\"USD\",\"confirm\":false,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":\"{{random_number}}\",\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"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",
@@ -6324,9 +13397,6 @@
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const amount = parseInt(pm.environment.get(\"amount\")) + 100000;",
- "",
"// Validate status 2xx",
"pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -6392,9 +13462,9 @@
"// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"succeeded\");",
+ " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
" },",
" );",
"}",
@@ -6442,16 +13512,19 @@
{
"name": "Refunds - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Get the value of 'amount' from the environment",
- "const refund_amount = parseInt(pm.environment.get(\"amount\") + 100000);",
- "",
- "// Set 'refund_amount' as an environment variable for the current request",
- "pm.environment.set(\"refund_amount\", refund_amount);",
- "",
"// Validate status 4xx",
"pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {",
" pm.response.to.be.error;",
@@ -6491,7 +13564,7 @@
" },",
");",
"",
- "// Response body should have value \"connector error\" for \"error type\"",
+ "// Response body should have value \"invalid_request\" for \"error type\"",
"if (jsonData?.error?.type) {",
" pm.test(",
" \"[POST]::/payments/:id/confirm - Content check if value for 'error.type' matches 'invalid_request'\",",
@@ -6520,12 +13593,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"payment_id\": \"{{payment_id}}\",\n \"amount\": {{refund_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"
}
- }
+ },
+ "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
},
"url": {
"raw": "{{baseUrl}}/refunds",
@@ -6543,17 +13616,25 @@
]
},
{
- "name": "Scenario8-Refund for unsuccessful payment",
+ "name": "Scenario9-Create a recurring payment with greater mandate amount Copy",
"item": [
{
"name": "Payments - Create",
"event": [
{
- "listen": "test",
+ "listen": "prerequest",
"script": {
"exec": [
"pm.environment.set(\"random_number\", _.random(100, 100000));",
- "",
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
+ {
+ "listen": "test",
+ "script": {
+ "exec": [
"// Validate status 2xx",
"pm.test(\"[POST]::/payments - Status code is 2xx\", function () {",
" pm.response.to.be.success;",
@@ -6616,15 +13697,31 @@
" );",
"}",
"",
- "// Response body should have value \"requires_confirmation\" for \"status\"",
+ "// Response body should have value \"processing\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " \"[POST]::/payments - Content check if value for 'status' matches 'processing'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " pm.expect(jsonData.status).to.eql(\"processing\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -6645,12 +13742,12 @@
],
"body": {
"mode": "raw",
- "raw": "{\n \"amount\": {{random_number}},\n \"currency\": \"USD\",\n \"confirm\": false,\n \"capture_method\": \"automatic\",\n \"capture_on\": \"2022-09-10T10:11:12Z\",\n \"amount_to_capture\": {{random_number}},\n \"customer_id\": \"StripeCustomer\",\n \"email\": \"[email protected]\",\n \"name\": \"John Doe\",\n \"phone\": \"999999999\",\n \"phone_country_code\": \"+65\",\n \"description\": \"Its my first payment request\",\n \"authentication_type\": \"no_three_ds\",\n \"return_url\": \"https://duck.com\",\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_number\": \"4111111111111111\",\n \"card_exp_month\": \"10\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"joseph Doe\",\n \"card_cvc\": \"123\"\n }\n },\n \"billing\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"shipping\": {\n \"address\": {\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"city\": \"San Fransico\",\n \"state\": \"California\",\n \"zip\": \"94122\",\n \"country\": \"US\",\n \"first_name\": \"PiX\"\n }\n },\n \"statement_descriptor_name\": \"joseph\",\n \"statement_descriptor_suffix\": \"JS\",\n \"metadata\": {\n \"udf1\": \"value1\",\n \"new_customer\": \"true\",\n \"login_date\": \"2019-09-10T10:11:12Z\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
- }
+ },
+ "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\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4111111111111111\",\"card_exp_month\":\"10\",\"card_exp_year\":\"69\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"setup_future_usage\":\"off_session\",\"mandate_data\":{\"customer_acceptance\":{\"acceptance_type\":\"offline\",\"accepted_at\":\"1963-05-03T04:07:52.723Z\",\"online\":{\"ip_address\":\"127.0.0.1\",\"user_agent\":\"amet irure esse\"}},\"mandate_type\":{\"single_use\":{\"amount\":7000,\"currency\":\"USD\"}}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
"raw": "{{baseUrl}}/payments",
@@ -6737,12 +13834,28 @@
"// Response body should have value \"Succeeded\" for \"status\"",
"if (jsonData?.status) {",
" pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
+ " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",",
" function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
+ " pm.expect(jsonData.status).to.eql(\"succeeded\");",
" },",
" );",
"}",
+ "",
+ "// Response body should have \"mandate_id\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_id' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_id !== \"undefined\").to.be.true;",
+ " },",
+ ");",
+ "",
+ "// Response body should have \"mandate_data\"",
+ "pm.test(",
+ " \"[POST]::/payments - Content check if 'mandate_data' exists\",",
+ " function () {",
+ " pm.expect(typeof jsonData.mandate_data !== \"undefined\").to.be.true;",
+ " },",
+ ");",
""
],
"type": "text/javascript"
@@ -6785,26 +13898,35 @@
"response": []
},
{
- "name": "Payments - Retrieve-copy",
+ "name": "Recurring Payments - Create",
"event": [
+ {
+ "listen": "prerequest",
+ "script": {
+ "exec": [
+ ""
+ ],
+ "type": "text/javascript"
+ }
+ },
{
"listen": "test",
"script": {
"exec": [
- "// Validate status 2xx",
- "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {",
- " pm.response.to.be.success;",
+ "// Validate status 4xx",
+ "pm.test(\"[POST]::/payments - Status code is 4xx\", function () {",
+ " pm.response.to.be.error;",
"});",
"",
"// Validate if response header has matching content-type",
- "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {",
+ "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(\"[GET]::/payments/:id - Response has JSON Body\", function () {",
+ "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {",
" pm.response.to.have.jsonBody();",
"});",
"",
@@ -6853,94 +13975,6 @@
" );",
"}",
"",
- "// Response body should have value \"requires_confirmation\" for \"status\"",
- "if (jsonData?.status) {",
- " pm.test(",
- " \"[POST]::/payments/:id - Content check if value for 'status' matches 'requires_confirmation'\",",
- " function () {",
- " pm.expect(jsonData.status).to.eql(\"requires_confirmation\");",
- " },",
- " );",
- "}",
- ""
- ],
- "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": "Refunds - Create",
- "event": [
- {
- "listen": "test",
- "script": {
- "exec": [
- "// Validate status 4xx",
- "pm.test(\"[POST]::/refunds - Status code is 4xx\", function () {",
- " pm.response.to.be.error;",
- "});",
- "",
- "// Validate if response header has matching content-type",
- "pm.test(\"[POST]::/refunds - Content-Type is application/json\", function () {",
- " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(",
- " \"application/json\",",
- " );",
- "});",
- "",
- "// Set response object as internal variable",
- "let jsonData = {};",
- "try {",
- " jsonData = pm.response.json();",
- "} catch (e) {}",
- "",
- "// pm.collectionVariables - Set refund_id as variable for jsonData.payment_id",
- "if (jsonData?.refund_id) {",
- " pm.collectionVariables.set(\"refund_id\", jsonData.refund_id);",
- " console.log(",
- " \"- use {{refund_id}} as collection variable for value\",",
- " jsonData.refund_id,",
- " );",
- "} else {",
- " console.log(",
- " \"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.\",",
- " );",
- "}",
- "",
"// Response body should have \"error\"",
"pm.test(",
" \"[POST]::/payments/:id/confirm - Content check if 'error' exists\",",
@@ -6983,18 +14017,18 @@
"language": "json"
}
},
- "raw": "{\"payment_id\":\"{{payment_id}}\",\"amount\":540,\"reason\":\"Customer returned product\",\"refund_type\":\"instant\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}"
+ "raw": "{\"amount\":8040,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\"[email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"mandate_id\":\"{{mandate_id}}\",\"off_session\":true,\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"John\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"},\"routing\":{\"type\":\"single\",\"data\":\"stripe\"}}"
},
"url": {
- "raw": "{{baseUrl}}/refunds",
+ "raw": "{{baseUrl}}/payments",
"host": [
"{{baseUrl}}"
],
"path": [
- "refunds"
+ "payments"
]
},
- "description": "To create a refund against an already processed payment"
+ "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": []
}
@@ -7026,7 +14060,7 @@
]
},
"info": {
- "_postman_id": "4de44872-bdff-465f-a958-52988651e0b8",
+ "_postman_id": "83b726fc-8895-4afd-8f07-a9545e209490",
"name": "nmi",
"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",
@@ -7086,6 +14120,11 @@
"value": "",
"type": "string"
},
+ {
+ "key": "connector_key1",
+ "value": "",
+ "type": "string"
+ },
{
"key": "publishable_key",
"value": "",
diff --git a/postman/collection-json/stripe.postman_collection.json b/postman/collection-json/stripe.postman_collection.json
index 23f922e137a..7df7ba5158d 100644
--- a/postman/collection-json/stripe.postman_collection.json
+++ b/postman/collection-json/stripe.postman_collection.json
@@ -17960,7 +17960,7 @@
"language": "json"
}
},
- "raw": "{\"amount\":1000}"
+ "raw": "{\"amount\":1000,\"amount_to_capture\":1000}"
},
"url": {
"raw": "{{baseUrl}}/payments/:id",
|
chore
|
update Postman collection files
|
4718c174572da5a5a98a6145b4ce5e9422b942fa
|
2024-04-30 14:40:42
|
Shanks
|
ci: fix paypal postman tests (#4501)
| false
|
diff --git a/postman/collection-dir/paypal/event.prerequest.js b/postman/collection-dir/paypal/event.prerequest.js
index f4c9a764864..944aebeb6ee 100644
--- a/postman/collection-dir/paypal/event.prerequest.js
+++ b/postman/collection-dir/paypal/event.prerequest.js
@@ -3,25 +3,28 @@ const isPostRequest = pm.request.method.toString() === "POST";
const isPaymentCreation = path.match(/\/payments$/) && isPostRequest;
if (isPaymentCreation) {
- try {
- const request = JSON.parse(pm.request.body.toJSON().raw);
+ try {
+ const request = JSON.parse(pm.request.body.toJSON().raw);
+ const merchantConnectorId = pm.collectionVariables.get("merchant_connector_id");
- // Attach routing
- const routing = { type: "single", data: "paypal" };
- request["routing"] = routing;
+ // Attach routing
+ const routing = {
+ type: "single", data: { connector: "paypal", merchant_connector_id: merchantConnectorId }
+ };
+ request["routing"] = routing;
- let updatedRequest = {
- mode: "raw",
- raw: JSON.stringify(request),
- options: {
- raw: {
- language: "json",
- },
- },
- };
- pm.request.body.update(updatedRequest);
- } catch (error) {
- console.error("Failed to inject routing in the request");
- console.error(error);
- }
-}
\ No newline at end of file
+ let updatedRequest = {
+ mode: "raw",
+ raw: JSON.stringify(request),
+ options: {
+ raw: {
+ language: "json",
+ },
+ },
+ };
+ pm.request.body.update(updatedRequest);
+ } catch (error) {
+ console.error("Failed to inject routing in the request");
+ console.error(error);
+ }
+}
diff --git a/postman/collection-json/paypal.postman_collection.json b/postman/collection-json/paypal.postman_collection.json
index dfb52bb4ffc..58368b3b856 100644
--- a/postman/collection-json/paypal.postman_collection.json
+++ b/postman/collection-json/paypal.postman_collection.json
@@ -9,28 +9,32 @@
"const isPaymentCreation = path.match(/\\/payments$/) && isPostRequest;",
"",
"if (isPaymentCreation) {",
- " try {",
- " const request = JSON.parse(pm.request.body.toJSON().raw);",
+ " try {",
+ " const request = JSON.parse(pm.request.body.toJSON().raw);",
+ " const merchantConnectorId = pm.collectionVariables.get(\"merchant_connector_id\");",
"",
- " // Attach routing",
- " const routing = { type: \"single\", data: \"paypal\" };",
- " request[\"routing\"] = routing;",
+ " // Attach routing",
+ " const routing = {",
+ " type: \"single\", data: { connector: \"paypal\", merchant_connector_id: merchantConnectorId }",
+ " };",
+ " request[\"routing\"] = routing;",
"",
- " let updatedRequest = {",
- " mode: \"raw\",",
- " raw: JSON.stringify(request),",
- " options: {",
- " raw: {",
- " language: \"json\",",
- " },",
- " },",
- " };",
- " pm.request.body.update(updatedRequest);",
- " } catch (error) {",
- " console.error(\"Failed to inject routing in the request\");",
- " console.error(error);",
- " }",
- "}"
+ " let updatedRequest = {",
+ " mode: \"raw\",",
+ " raw: JSON.stringify(request),",
+ " options: {",
+ " raw: {",
+ " language: \"json\",",
+ " },",
+ " },",
+ " };",
+ " pm.request.body.update(updatedRequest);",
+ " } catch (error) {",
+ " console.error(\"Failed to inject routing in the request\");",
+ " console.error(error);",
+ " }",
+ "}",
+ ""
],
"type": "text/javascript"
}
|
ci
|
fix paypal postman tests (#4501)
|
ef7fa0d16ebe12bd86572c7ab80e7caa70d75578
|
2024-07-31 03:22:54
|
AkshayaFoiger
|
docs: update postgreSQL database url (#5482)
| false
|
diff --git a/docs/try_local_system.md b/docs/try_local_system.md
index e977a443c3b..cba62fd01f2 100644
--- a/docs/try_local_system.md
+++ b/docs/try_local_system.md
@@ -378,13 +378,10 @@ 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
+ brew install rustup
+ rustup default stable
```
- When prompted, proceed with the `default` profile, which installs the stable
- toolchain.
-
Optionally, verify that the Rust compiler and `cargo` are successfully
installed:
@@ -491,7 +488,7 @@ Once you're done with setting up the dependencies, proceed with
Export the `DATABASE_URL` env variable
```shell
- export DATABASE_URL=$DB_USER:$DB_PASS@localhost:5432/$DB_NAME
+ export DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME
```
Run the migrations
|
docs
|
update postgreSQL database url (#5482)
|
3d9ecd09383916fa9ac824e5ebf9052f6862758d
|
2024-06-06 17:33:46
|
AkshayaFoiger
|
fix(connectors): [BOA/CYBS] make avs code optional (#4898)
| false
|
diff --git a/crates/router/src/connector/bankofamerica/transformers.rs b/crates/router/src/connector/bankofamerica/transformers.rs
index 7446749e73c..edff5c251a5 100644
--- a/crates/router/src/connector/bankofamerica/transformers.rs
+++ b/crates/router/src/connector/bankofamerica/transformers.rs
@@ -835,7 +835,7 @@ pub struct ClientRiskInformationRules {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Avs {
- code: String,
+ code: Option<String>,
code_raw: Option<String>,
}
diff --git a/crates/router/src/connector/cybersource/transformers.rs b/crates/router/src/connector/cybersource/transformers.rs
index 3250cb1ba81..ceb0b4ad47f 100644
--- a/crates/router/src/connector/cybersource/transformers.rs
+++ b/crates/router/src/connector/cybersource/transformers.rs
@@ -1766,7 +1766,7 @@ pub struct CardVerification {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Avs {
- code: String,
+ code: Option<String>,
code_raw: Option<String>,
}
|
fix
|
[BOA/CYBS] make avs code optional (#4898)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.