From 70cb8a1b712516b5b6a0490277ab2f7feab213ea Mon Sep 17 00:00:00 2001 From: Sanchith Hegde Date: Fri, 6 Dec 2024 15:13:52 +0530 Subject: [PATCH 01/62] chore: add comments with improvements to be made in merchant payment methods list --- .../router/src/core/payment_methods/cards.rs | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index ad612ed6f3be..495b0ce081ef 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3217,6 +3217,9 @@ pub async fn list_payment_methods( let db = &*state.store; let pm_config_mapping = &state.conf.pm_filters; let key_manager_state = &(&state).into(); + + // Auth is possibly incorrect, why is it happening in core? + // Keep it as is for now let payment_intent = if let Some(cs) = &req.client_secret { if cs.starts_with("pm_") { validate_payment_method_and_client_secret( @@ -3241,6 +3244,7 @@ pub async fn list_payment_methods( None }; + // Shipping, billing address is needed for filtering based on country, currency, etc. let shipping_address = payment_intent .as_ref() .async_map(|pi| async { @@ -3275,6 +3279,7 @@ pub async fn list_payment_methods( .transpose()? .flatten(); + // This is needed for customer PML let customer = payment_intent .as_ref() .async_and_then(|pi| async { @@ -3318,6 +3323,8 @@ pub async fn list_payment_methods( || setup_future_usage .map(|future_usage| future_usage == common_enums::FutureUsage::OffSession) .unwrap_or(false); + + // This is most probably deprecated, can be inferred from path(?) let payment_type = payment_attempt.as_ref().map(|pa| { let amount = api::Amount::from(pa.net_amount.get_order_amount()); let mandate_type = if pa.mandate_id.is_some() { @@ -3331,6 +3338,7 @@ pub async fn list_payment_methods( helpers::infer_payment_type(&amount, mandate_type.as_ref()) }); + // Include profile context, remove merchant ID let all_mcas = db .find_merchant_connector_account_by_merchant_id_and_disabled_list( key_manager_state, @@ -3378,6 +3386,9 @@ pub async fn list_payment_methods( logger::debug!(mca_before_filtering=?filtered_mcas); let mut response: Vec = vec![]; + + // Should be deprecated, use get intent API + // Also, update it to be an impl method on some type // Key creation for storing PM_FILTER_CGRAPH let key = { format!( @@ -3386,7 +3397,7 @@ pub async fn list_payment_methods( profile_id.get_string_repr() ) }; - + // Find graph in cache or create it. Then call filter PM outside, which is common to both. if let Some(graph) = get_merchant_pm_filter_graph(&state, &key).await { // Derivation of PM_FILTER_CGRAPH from MokaCache successful for mca in &filtered_mcas { @@ -3394,6 +3405,8 @@ pub async fn list_payment_methods( Some(pm) => pm, None => continue, }; + // This can be written in the form of try_fold + // Can do some simpler filters before, the cheaper ones that don't need CGraph filter_payment_methods( &graph, mca.get_id(), @@ -3470,13 +3483,17 @@ pub async fn list_payment_methods( ); // Filter out wallet payment method from mca if customer has already saved it + // Can merge customer PML here customer .as_ref() + // Why big block using customer as parameter? + // Just get customer PMs, then do stuff. .async_map(|customer| async { let wallet_pm_exists = response .iter() .any(|mca| mca.payment_method == enums::PaymentMethod::Wallet); if wallet_pm_exists { + // Are we doing the same query in customer PML? match db .find_payment_method_by_customer_id_merchant_id_list( &((&state).into()), @@ -3486,6 +3503,7 @@ pub async fn list_payment_methods( None, ) .await + // Move above DB query to DB layer, then do other stuff { Ok(customer_payment_methods) => { let customer_wallet_pm = customer_payment_methods @@ -3527,6 +3545,7 @@ pub async fn list_payment_methods( HashMap, > = HashMap::new(); + // Ignore session flow routing in merchant PML if let Some((payment_attempt, payment_intent)) = payment_attempt.as_ref().zip(payment_intent.as_ref()) { @@ -3762,6 +3781,8 @@ pub async fn list_payment_methods( .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; } + // For country filter, take PMs, accept country, return filtered PMs + // Check for `use_billing_as_payment_method_billing` config under business_profile // If this is disabled, then the billing details in required fields will be empty and have to be collected by the customer let billing_address_for_calculating_required_fields = business_profile @@ -3771,6 +3792,7 @@ pub async fn list_payment_methods( .then_some(billing_address.as_ref()) .flatten(); + // Make new module for dynamic fields, take required stuff as input, do not leak dynamic field related stuff in PM flow let req = api_models::payments::PaymentsRequest::foreign_try_from(( payment_attempt.as_ref(), payment_intent.as_ref(), @@ -3782,6 +3804,7 @@ pub async fn list_payment_methods( let req_val = serde_json::to_value(req).ok(); logger::debug!(filtered_payment_methods=?response); + // IIRC someone said if payment experience is none, the others won't be populated or something let mut payment_experiences_consolidated_hm: HashMap< api_enums::PaymentMethod, HashMap>>, @@ -3873,6 +3896,7 @@ pub async fn list_payment_methods( }, ); + // Can possibly use HM.entry().or_insert() (or_insert_with()) if let Some(payment_experience) = element.payment_experience { if let Some(payment_method_hm) = payment_experiences_consolidated_hm.get_mut(&payment_method) @@ -3994,6 +4018,7 @@ pub async fn list_payment_methods( }) } + // How do we wanna restructure `ResponsePaymentMethodTypes`? payment_method_types.push(ResponsePaymentMethodTypes { payment_method_type: *payment_method_types_hm.0, payment_experience: Some(payment_experience_types), @@ -4173,6 +4198,8 @@ pub async fn list_payment_methods( .as_ref() .and_then(|intent| intent.request_external_three_ds_authentication) .unwrap_or(false); + + // What to do about surcharge? let merchant_surcharge_configs = if let Some((payment_attempt, payment_intent, business_profile)) = payment_attempt .as_ref() @@ -4231,6 +4258,7 @@ pub async fn list_payment_methods( merchant_name: merchant_account.merchant_name, payment_type, payment_methods: payment_method_responses, + // What should we do about this field? Not required mandate_payment: payment_attempt.and_then(|inner| inner.mandate_details).map( |d| match d { hyperswitch_domain_models::mandates::MandateDataType::SingleUse(i) => { @@ -4459,6 +4487,7 @@ pub async fn call_surcharge_decision_management_for_saved_card( Ok(()) } +// Need not be async at all #[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") @@ -4477,12 +4506,14 @@ pub async fn filter_payment_methods( saved_payment_methods: &settings::EligiblePaymentMethods, ) -> errors::CustomResult<(), errors::ApiErrorResponse> { for payment_method in payment_methods.iter() { + // Create a wrapper struct PMs(Vec), iter, map, deserialize, log in case of deserialization errors, possibly have metrics about failures, return list of successful PMs let parse_result = serde_json::from_value::( payment_method.clone().expose().clone(), ); if let Ok(payment_methods_enabled) = parse_result { let payment_method = payment_methods_enabled.payment_method; + // Can move this outside for loop, or even pass it to function, to avoid repeated deserialization let allowed_payment_method_types = payment_intent.and_then(|payment_intent| { payment_intent .allowed_payment_method_types @@ -4498,6 +4529,8 @@ pub async fn filter_payment_methods( }) }); + // Use iteration, fold etc. + // Use impl based stuff instead of hanging functions for payment_method_type_info in payment_methods_enabled .payment_method_types .unwrap_or_default() @@ -4551,11 +4584,13 @@ pub async fn filter_payment_methods( ))); }; + // Can use HashSet instead of Vec let filter_pm_based_on_allowed_types = filter_pm_based_on_allowed_types( allowed_payment_method_types.as_ref(), &payment_method_object.payment_method_type, ); + // Ignore mandate related stuff (this and next block), ensure normal payments (non-mandate stuff) are not affected in any manner if payment_attempt .and_then(|attempt| attempt.mandate_details.as_ref()) .is_some() @@ -4593,12 +4628,14 @@ pub async fn filter_payment_methods( context_values.push(dir::DirValue::CaptureMethod(capture_method)); }); + // Remove this part, deprecate `card_networks` field in `PaymentMethodListRequest` let filter_pm_card_network_based = filter_pm_card_network_based( payment_method_object.card_networks.as_ref(), req.card_networks.as_ref(), &payment_method_object.payment_method_type, ); + // Check with the team, do not include if this part is only needed for PM management let saved_payment_methods_filter = req .client_secret .as_ref() @@ -4641,6 +4678,7 @@ pub async fn filter_payment_methods( mca_id.get_string_repr().to_string(), payment_method, ); + // Don't mutate, iterate, return values resp.push(response_pm_type); } else { logger::error!("Filtering Payment Methods Failed"); From 3e7833fafd3bb09d92fdfcc7676936d6aa339194 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Tue, 10 Dec 2024 18:21:17 +0530 Subject: [PATCH 02/62] refactor: change payment_methods_enabled column to type for v2 --- crates/api_models/src/admin.rs | 10 +- crates/api_models/src/events/payment.rs | 8 + crates/api_models/src/payments.rs | 20 +++ crates/common_utils/src/types.rs | 119 +++++++++++++ .../src/merchant_connector_account.rs | 10 +- .../src/query/merchant_connector_account.rs | 18 ++ crates/diesel_models/src/schema_v2.rs | 2 +- crates/euclid_wasm/Cargo.toml | 1 + crates/euclid_wasm/src/lib.rs | 18 +- .../src/merchant_connector_account.rs | 57 ++---- crates/kgraph_utils/benches/evaluation.rs | 47 +++-- crates/kgraph_utils/src/mca.rs | 113 ++++++------ crates/router/src/core/admin.rs | 10 +- crates/router/src/core/payments.rs | 3 + .../src/core/payments/payment_methods.rs | 85 +++++++++ crates/router/src/core/payments/routing.rs | 163 ++++++++++-------- crates/router/src/core/payout_link.rs | 2 +- crates/router/src/core/payouts.rs | 17 +- crates/router/src/core/payouts/helpers.rs | 1 + crates/router/src/db/kafka_store.rs | 17 ++ .../src/db/merchant_connector_account.rs | 55 ++++++ crates/router/src/routes/app.rs | 4 +- crates/router/src/routes/payment_methods.rs | 39 ----- crates/router/src/routes/payments.rs | 48 ++++++ crates/router/src/types/transformers.rs | 102 ++++++++++- .../2024-08-28-081721_add_v2_columns/down.sql | 3 + .../2024-08-28-081721_add_v2_columns/up.sql | 4 + .../2024-10-08-081847_drop_v1_columns/up.sql | 2 +- 28 files changed, 717 insertions(+), 261 deletions(-) create mode 100644 crates/router/src/core/payments/payment_methods.rs diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 53ce86789665..97805a215395 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -676,9 +676,11 @@ 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, + /// Name of the Connector #[schema(value_type = Connector, example = "stripe")] pub connector_name: api_enums::Connector, + /// This is an unique label you can generate and pass in order to identify this connector account on your Hyperswitch dashboard and reports, If not passed then if will take `connector_name`_`profile_name`. Eg: if your profile label is `default`, connector label can be `stripe_default` #[schema(example = "stripe_US_travel")] pub connector_label: Option, @@ -721,7 +723,7 @@ pub struct MerchantConnectorCreate { "installment_payment_enabled": true } ]))] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ @@ -1085,7 +1087,7 @@ pub struct MerchantConnectorResponse { "installment_payment_enabled": true } ]))] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ @@ -1410,7 +1412,7 @@ pub struct MerchantConnectorListResponse { "installment_payment_enabled": true } ]))] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// A boolean value to indicate if the connector is disabled. By default, its value is false. #[schema(default = false, example = false)] @@ -1597,7 +1599,7 @@ pub struct MerchantConnectorUpdate { "installment_payment_enabled": true } ]))] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index 6015682f7c38..1f96f306a1bb 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -418,3 +418,11 @@ impl ApiEventMetric for PaymentStartRedirectionRequest { }) } } + +#[cfg(feature = "v2")] +impl ApiEventMetric for payments::PaymentMethodListResponse { + // Payment id would be populated by the request + fn get_api_event_type(&self) -> Option { + None + } +} diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 603c0f769347..e5550b28e6ca 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -35,6 +35,9 @@ use crate::{ refunds, }; +#[cfg(feature = "v2")] +use crate::payment_methods; + #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum PaymentOp { Create, @@ -6276,6 +6279,23 @@ pub struct SdkInformation { pub sdk_max_timeout: u8, } +#[cfg(feature = "v2")] +#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] +pub struct PaymentMethodsListRequest {} + +#[cfg(feature = "v2")] +#[derive(Debug, serde::Serialize, ToSchema)] +pub struct PaymentMethodListResponse { + /// The list of payment methods that are enabled for the business profile + pub payment_methods: Vec, + + /// flag that indicates whether to collect shipping details from wallets or from the customer + pub collect_shipping_details_from_wallets: Option, + + /// flag that indicates whether to collect billing details from wallets or from the customer + pub collect_billing_details_from_wallets: Option, +} + #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] pub struct PaymentsExternalAuthenticationResponse { /// Indicates the transaction status diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 0d39841fe09b..16b745702eb0 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -1579,3 +1579,122 @@ where self.0.to_sql(out) } } + +/// Details of all the payment methods enabled for the connector for the given merchant account +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)] +#[serde(deny_unknown_fields)] +#[diesel(sql_type = Jsonb)] +pub struct PaymentMethodsEnabled { + /// Type of payment method. + #[schema(value_type = PaymentMethod,example = "card")] + pub payment_method: common_enums::PaymentMethod, + + /// Payment method configuration, this includes all the filters associated with the payment method + pub payment_method_types: Option>, +} + +/// Details of a specific payment method subtype enabled for the connector for the given merchant account +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq, Hash)] +pub struct RequestPaymentMethodTypes { + /// The payment method subtype + #[schema(value_type = PaymentMethodType)] + pub payment_method_type: common_enums::PaymentMethodType, + + /// The payment experience for the payment method + #[schema(value_type = Option)] + pub payment_experience: Option, + + /// List of cards networks that are enabled for this payment method, applicable for credit and debit payment method subtypes only + #[schema(value_type = Option>)] + pub card_networks: Option>, + /// List of currencies accepted or has the processing capabilities of the processor + #[schema(example = json!( + { + "type": "enable_only", + "list": ["USD", "INR"] + } + ), value_type = Option)] + pub accepted_currencies: Option, + + /// List of Countries accepted or has the processing capabilities of the processor + #[schema(example = json!( + { + "type": "enable_only", + "list": ["UK", "AU"] + } + ), value_type = Option)] + pub accepted_countries: Option, + + /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents) + #[schema(example = 1)] + pub minimum_amount: Option, + + /// Maximum amount supported by the processor. To be represented in the lowest denomination of + /// the target currency (For example, for USD it should be in cents) + #[schema(example = 1313)] + pub maximum_amount: Option, + + /// Boolean to enable recurring payments / mandates. Default is true. + #[schema(default = true, example = false)] + pub recurring_enabled: bool, + + /// Boolean to enable installment / EMI / BNPL payments. Default is true. + #[schema(default = true, example = false)] + pub installment_payment_enabled: bool, +} + +#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] +#[serde( + deny_unknown_fields, + tag = "type", + content = "list", + rename_all = "snake_case" +)] +/// Object to filter the countries for which the payment method subtype is enabled +pub enum AcceptedCountries { + /// Only enable the payment method subtype for specific countries + #[schema(value_type = Vec)] + EnableOnly(Vec), + + /// Only disable the payment method subtype for specific countries + #[schema(value_type = Vec)] + DisableOnly(Vec), + + /// Enable the payment method subtype for all countries, in which the processor has the processing capabilities + AllAccepted, +} + +#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] +#[serde( + deny_unknown_fields, + tag = "type", + content = "list", + rename_all = "snake_case" +)] +/// Object to filter the countries for which the payment method subtype is enabled +pub enum AcceptedCurrencies { + /// Only enable the payment method subtype for specific currencies + #[schema(value_type = Vec)] + EnableOnly(Vec), + + /// Only disable the payment method subtype for specific currencies + #[schema(value_type = Vec)] + DisableOnly(Vec), + + /// Enable the payment method subtype for all currencies, in which the processor has the processing capabilities + AllAccepted, +} + +impl Queryable for PaymentMethodsEnabled +where + DB: Backend, + Self: FromSql, +{ + type Row = Self; + + fn build(row: Self::Row) -> deserialize::Result { + Ok(row) + } +} + +crate::impl_to_sql_from_sql_json!(PaymentMethodsEnabled); diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs index f78886b8c936..3693ccae4fa2 100644 --- a/crates/diesel_models/src/merchant_connector_account.rs +++ b/crates/diesel_models/src/merchant_connector_account.rs @@ -76,8 +76,8 @@ pub struct MerchantConnectorAccount { pub connector_name: String, pub connector_account_details: Encryption, pub disabled: Option, - #[diesel(deserialize_as = super::OptionalDieselArray)] - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub connector_type: storage_enums::ConnectorType, pub metadata: Option, pub connector_label: Option, @@ -146,7 +146,8 @@ pub struct MerchantConnectorAccountNew { pub connector_name: Option, pub connector_account_details: Option, pub disabled: Option, - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub metadata: Option, pub connector_label: Option, pub created_at: time::PrimitiveDateTime, @@ -199,7 +200,8 @@ pub struct MerchantConnectorAccountUpdateInternal { pub connector_account_details: Option, pub connector_label: Option, pub disabled: Option, - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub metadata: Option, pub modified_at: Option, pub connector_webhook_details: Option, diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs index 0f0954420047..7abc0d6efde7 100644 --- a/crates/diesel_models/src/query/merchant_connector_account.rs +++ b/crates/diesel_models/src/query/merchant_connector_account.rs @@ -241,4 +241,22 @@ impl MerchantConnectorAccount { ) .await } + + pub async fn list_enabled_by_profile_id( + conn: &PgPooledConn, + profile_id: &common_utils::id_type::ProfileId, + connector_type: common_enums::ConnectorType, + ) -> StorageResult> { + generics::generic_filter::<::Table, _, _, _>( + conn, + dsl::profile_id + .eq(profile_id.to_owned()) + .and(dsl::disabled.eq(false)) + .and(dsl::connector_type.eq(connector_type)), + None, + None, + Some(dsl::created_at.asc()), + ) + .await + } } diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index 12bb19c0a7f1..1a04fb65011f 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -718,7 +718,7 @@ diesel::table! { connector_name -> Varchar, connector_account_details -> Bytea, disabled -> Nullable, - payment_methods_enabled -> Nullable>>, + payment_methods_enabled -> Nullable>>, connector_type -> ConnectorType, metadata -> Nullable, #[max_length = 255] diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index f8c97699d06d..fe5a54a56ed9 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -18,6 +18,7 @@ development = ["connector_configs/development"] sandbox = ["connector_configs/sandbox"] payouts = ["api_models/payouts", "euclid/payouts"] v1 = ["api_models/v1"] +v2 = [] [dependencies] api_models = { version = "0.1.0", path = "../api_models", package = "api_models" } diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs index 9f610f9e6a33..b299ced68b01 100644 --- a/crates/euclid_wasm/src/lib.rs +++ b/crates/euclid_wasm/src/lib.rs @@ -7,8 +7,8 @@ use std::{ }; use api_models::{ - admin as admin_api, conditional_configs::ConditionalConfigs, enums as api_model_enums, - routing::ConnectorSelection, surcharge_decision_configs::SurchargeDecisionConfigs, + conditional_configs::ConditionalConfigs, enums as api_model_enums, routing::ConnectorSelection, + surcharge_decision_configs::SurchargeDecisionConfigs, }; use common_enums::RoutableConnectors; use connector_configs::{ @@ -20,7 +20,7 @@ use currency_conversion::{ }; use euclid::{ backend::{inputs, interpreter::InterpreterBackend, EuclidBackend}, - dssa::{self, analyzer, graph::CgraphExt, state_machine, truth}, + dssa::{self, analyzer, graph::CgraphExt, state_machine}, frontend::{ ast, dir::{self, enums as dir_enums, EuclidDirFilter}, @@ -76,9 +76,11 @@ pub fn convert_forex_value(amount: i64, from_currency: JsValue, to_currency: JsV /// This function can be used by the frontend to provide the WASM with information about /// all the merchant's connector accounts. The input argument is a vector of all the merchant's /// connector accounts from the API. +#[cfg(feature = "v1")] #[wasm_bindgen(js_name = seedKnowledgeGraph)] pub fn seed_knowledge_graph(mcas: JsValue) -> JsResult { - let mcas: Vec = serde_wasm_bindgen::from_value(mcas)?; + let mcas: Vec = + serde_wasm_bindgen::from_value(mcas)?; let connectors: Vec = mcas .iter() .map(|mca| { @@ -95,9 +97,11 @@ pub fn seed_knowledge_graph(mcas: JsValue) -> JsResult { default_configs: Some(pm_filter), }; let mca_graph = kgraph_utils::mca::make_mca_graph(mcas, &config).err_to_js()?; - let analysis_graph = - hyperswitch_constraint_graph::ConstraintGraph::combine(&mca_graph, &truth::ANALYSIS_GRAPH) - .err_to_js()?; + let analysis_graph = hyperswitch_constraint_graph::ConstraintGraph::combine( + &mca_graph, + &dssa::truth::ANALYSIS_GRAPH, + ) + .err_to_js()?; SEED_DATA .set(SeedData { diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index 51c75113dcda..5269a8044ecf 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -73,7 +73,7 @@ pub struct MerchantConnectorAccount { #[encrypt] pub connector_account_details: Encryptable>, pub disabled: Option, - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, pub connector_type: enums::ConnectorType, pub metadata: Option, pub frm_configs: Option>, @@ -102,23 +102,6 @@ impl MerchantConnectorAccount { self.metadata.clone() } - pub fn get_parsed_payment_methods_enabled( - &self, - ) -> Vec> { - self.payment_methods_enabled - .clone() - .unwrap_or_default() - .into_iter() - .map(|payment_methods_enabled| { - payment_methods_enabled - .parse_value::("payment_methods_enabled") - .change_context(ApiErrorResponse::InvalidDataValue { - field_name: "payment_methods_enabled", - }) - }) - .collect() - } - pub fn is_disabled(&self) -> bool { self.disabled.unwrap_or(false) } @@ -169,7 +152,7 @@ pub enum MerchantConnectorAccountUpdate { connector_type: Option, connector_account_details: Box>>, disabled: Option, - payment_methods_enabled: Option>, + payment_methods_enabled: Option>, metadata: Option, frm_configs: Option>, connector_webhook_details: Option, @@ -567,34 +550,20 @@ common_utils::create_list_wrapper!( pub fn get_connector_and_supporting_payment_method_type_for_session_call( &self, ) -> Vec<(&MerchantConnectorAccount, common_enums::PaymentMethodType)> { + // This vector is created to work around lifetimes + let ref_vector = Vec::default(); + let connector_and_supporting_payment_method_type = self.iter().flat_map(|connector_account| { connector_account - .get_parsed_payment_methods_enabled() - // TODO: make payment_methods_enabled strict type in DB - .into_iter() - .filter_map(|parsed_payment_method_result| { - parsed_payment_method_result - .inspect_err(|err| { - logger::error!(session_token_parsing_error=?err); - }) - .ok() + .payment_methods_enabled.as_ref() + .unwrap_or(&Vec::default()) + .iter() + .flat_map(|payment_method_types| payment_method_types.payment_method_types.as_ref().unwrap_or(&ref_vector)) + .filter(|payment_method_types_enabled| { + payment_method_types_enabled.payment_experience == Some(api_models::enums::PaymentExperience::InvokeSdkClient) }) - .flat_map(|parsed_payment_methods_enabled| { - parsed_payment_methods_enabled - .payment_method_types - .unwrap_or_default() - .into_iter() - .filter(|payment_method_type| { - let is_invoke_sdk_client = matches!( - payment_method_type.payment_experience, - Some(api_models::enums::PaymentExperience::InvokeSdkClient) - ); - is_invoke_sdk_client - }) - .map(|payment_method_type| { - (connector_account, payment_method_type.payment_method_type) - }) - .collect::>() + .map(|payment_method_types| { + (connector_account, payment_method_types.payment_method_type) }) .collect::>() }).collect(); diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rs index 858c013f41dd..e492ec46eb5e 100644 --- a/crates/kgraph_utils/benches/evaluation.rs +++ b/crates/kgraph_utils/benches/evaluation.rs @@ -16,6 +16,7 @@ use euclid::{ use hyperswitch_constraint_graph::{CycleCheck, Memoization}; use kgraph_utils::{error::KgraphError, transformers::IntoDirValue, types::CountryCurrencyFilter}; +#[cfg(feature = "v1")] fn build_test_data( total_enabled: usize, total_pm_types: usize, @@ -54,25 +55,25 @@ fn build_test_data( let profile_id = common_utils::generate_profile_id_of_default_length(); - #[cfg(feature = "v2")] - let stripe_account = MerchantConnectorResponse { - connector_type: api_enums::ConnectorType::FizOperations, - connector_name: "stripe".to_string(), - id: common_utils::generate_merchant_connector_account_id_of_default_length(), - connector_account_details: masking::Secret::new(serde_json::json!({})), - disabled: None, - metadata: None, - payment_methods_enabled: Some(pms_enabled), - connector_label: Some("something".to_string()), - frm_configs: None, - connector_webhook_details: None, - profile_id, - applepay_verified_domains: None, - pm_auth_config: None, - status: api_enums::ConnectorStatus::Inactive, - additional_merchant_data: None, - connector_wallets_details: None, - }; + // #[cfg(feature = "v2")] + // let stripe_account = MerchantConnectorResponse { + // connector_type: api_enums::ConnectorType::FizOperations, + // connector_name: "stripe".to_string(), + // id: common_utils::generate_merchant_connector_account_id_of_default_length(), + // connector_account_details: masking::Secret::new(serde_json::json!({})), + // disabled: None, + // metadata: None, + // payment_methods_enabled: Some(pms_enabled), + // connector_label: Some("something".to_string()), + // frm_configs: None, + // connector_webhook_details: None, + // profile_id, + // applepay_verified_domains: None, + // pm_auth_config: None, + // status: api_enums::ConnectorStatus::Inactive, + // additional_merchant_data: None, + // connector_wallets_details: None, + // }; #[cfg(feature = "v1")] let stripe_account = MerchantConnectorResponse { @@ -102,10 +103,13 @@ fn build_test_data( connector_configs: HashMap::new(), default_configs: None, }; + + #[cfg(feature = "v1")] kgraph_utils::mca::make_mca_graph(vec![stripe_account], &config) .expect("Failed graph construction") } +#[cfg(feature = "v1")] fn evaluation(c: &mut Criterion) { let small_graph = build_test_data(3, 8); let big_graph = build_test_data(20, 20); @@ -149,5 +153,10 @@ fn evaluation(c: &mut Criterion) { }); } +#[cfg(feature = "v1")] criterion_group!(benches, evaluation); +#[cfg(feature = "v1")] criterion_main!(benches); + +#[cfg(feature = "v2")] +fn main() {} diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index c65ec864d321..34fce3c9203f 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -605,6 +605,7 @@ fn compile_config_graph( .map_err(KgraphError::GraphConstructionError) } +#[cfg(feature = "v1")] fn compile_merchant_connector_graph( builder: &mut cgraph::ConstraintGraphBuilder, mca: admin_api::MerchantConnectorResponse, @@ -675,6 +676,7 @@ fn compile_merchant_connector_graph( Ok(()) } +#[cfg(feature = "v1")] pub fn make_mca_graph( accts: Vec, config: &kgraph_types::CountryCurrencyFilter, @@ -691,6 +693,7 @@ pub fn make_mca_graph( Ok(builder.build()) } +#[cfg(feature = "v1")] #[cfg(test)] mod tests { #![allow(clippy::expect_used)] @@ -711,61 +714,61 @@ mod tests { use api_models::{admin::*, payment_methods::*}; let profile_id = common_utils::generate_profile_id_of_default_length(); - #[cfg(feature = "v2")] - let stripe_account = MerchantConnectorResponse { - connector_type: api_enums::ConnectorType::FizOperations, - connector_name: "stripe".to_string(), - id: common_utils::generate_merchant_connector_account_id_of_default_length(), - connector_label: Some("something".to_string()), - connector_account_details: masking::Secret::new(serde_json::json!({})), - disabled: None, - metadata: None, - payment_methods_enabled: Some(vec![PaymentMethodsEnabled { - payment_method: api_enums::PaymentMethod::Card, - payment_method_types: Some(vec![ - RequestPaymentMethodTypes { - payment_method_type: api_enums::PaymentMethodType::Credit, - payment_experience: None, - card_networks: Some(vec![ - api_enums::CardNetwork::Visa, - api_enums::CardNetwork::Mastercard, - ]), - accepted_currencies: Some(AcceptedCurrencies::EnableOnly(vec![ - api_enums::Currency::INR, - ])), - accepted_countries: None, - minimum_amount: Some(MinorUnit::new(10)), - maximum_amount: Some(MinorUnit::new(1000)), - recurring_enabled: true, - installment_payment_enabled: true, - }, - RequestPaymentMethodTypes { - payment_method_type: api_enums::PaymentMethodType::Debit, - payment_experience: None, - card_networks: Some(vec![ - api_enums::CardNetwork::Maestro, - api_enums::CardNetwork::JCB, - ]), - accepted_currencies: Some(AcceptedCurrencies::EnableOnly(vec![ - api_enums::Currency::GBP, - ])), - accepted_countries: None, - minimum_amount: Some(MinorUnit::new(10)), - maximum_amount: Some(MinorUnit::new(1000)), - recurring_enabled: true, - installment_payment_enabled: true, - }, - ]), - }]), - frm_configs: None, - connector_webhook_details: None, - profile_id, - applepay_verified_domains: None, - pm_auth_config: None, - status: api_enums::ConnectorStatus::Inactive, - additional_merchant_data: None, - connector_wallets_details: None, - }; + // #[cfg(feature = "v2")] + // let stripe_account = MerchantConnectorResponse { + // connector_type: api_enums::ConnectorType::FizOperations, + // connector_name: "stripe".to_string(), + // id: common_utils::generate_merchant_connector_account_id_of_default_length(), + // connector_label: Some("something".to_string()), + // connector_account_details: masking::Secret::new(serde_json::json!({})), + // disabled: None, + // metadata: None, + // payment_methods_enabled: Some(vec![PaymentMethodsEnabled { + // payment_method: api_enums::PaymentMethod::Card, + // payment_method_types: Some(vec![ + // RequestPaymentMethodTypes { + // payment_method_type: api_enums::PaymentMethodType::Credit, + // payment_experience: None, + // card_networks: Some(vec![ + // api_enums::CardNetwork::Visa, + // api_enums::CardNetwork::Mastercard, + // ]), + // accepted_currencies: Some(AcceptedCurrencies::EnableOnly(vec![ + // api_enums::Currency::INR, + // ])), + // accepted_countries: None, + // minimum_amount: Some(MinorUnit::new(10)), + // maximum_amount: Some(MinorUnit::new(1000)), + // recurring_enabled: true, + // installment_payment_enabled: true, + // }, + // RequestPaymentMethodTypes { + // payment_method_type: api_enums::PaymentMethodType::Debit, + // payment_experience: None, + // card_networks: Some(vec![ + // api_enums::CardNetwork::Maestro, + // api_enums::CardNetwork::JCB, + // ]), + // accepted_currencies: Some(AcceptedCurrencies::EnableOnly(vec![ + // api_enums::Currency::GBP, + // ])), + // accepted_countries: None, + // minimum_amount: Some(MinorUnit::new(10)), + // maximum_amount: Some(MinorUnit::new(1000)), + // recurring_enabled: true, + // installment_payment_enabled: true, + // }, + // ]), + // }]), + // frm_configs: None, + // connector_webhook_details: None, + // profile_id, + // applepay_verified_domains: None, + // pm_auth_config: None, + // status: api_enums::ConnectorStatus::Inactive, + // additional_merchant_data: None, + // connector_wallets_details: None, + // }; #[cfg(feature = "v1")] let stripe_account = MerchantConnectorResponse { connector_type: api_enums::ConnectorType::FizOperations, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 40ed4e755210..ed6afbd3845c 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -2114,10 +2114,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect key_manager_state: &KeyManagerState, merchant_account: &domain::MerchantAccount, ) -> RouterResult { - let payment_methods_enabled = PaymentMethodsEnabled { - payment_methods_enabled: &self.payment_methods_enabled, - }; - let payment_methods_enabled = payment_methods_enabled.get_payment_methods_enabled()?; + let payment_methods_enabled = self.payment_methods_enabled.clone(); let frm_configs = self.get_frm_config_as_secret(); @@ -2454,11 +2451,8 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { ) -> RouterResult { // If connector label is not passed in the request, generate one let connector_label = self.get_connector_label(business_profile.profile_name.clone()); - let payment_methods_enabled = PaymentMethodsEnabled { - payment_methods_enabled: &self.payment_methods_enabled, - }; - let payment_methods_enabled = payment_methods_enabled.get_payment_methods_enabled()?; let frm_configs = self.get_frm_config_as_secret(); + let payment_methods_enabled = self.payment_methods_enabled; // Validate Merchant api details and return error if not in correct format let auth = types::ConnectorAuthType::from_option_secret_value( self.connector_account_details.clone(), diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 99b0a6354006..1329aa3dd943 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -19,6 +19,9 @@ use std::{ collections::HashSet, fmt::Debug, marker::PhantomData, ops::Deref, time::Instant, vec::IntoIter, }; +#[cfg(feature = "v2")] +pub mod payment_methods; + #[cfg(feature = "olap")] use api_models::admin::MerchantConnectorInfo; use api_models::{ diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs new file mode 100644 index 000000000000..e2d190706acc --- /dev/null +++ b/crates/router/src/core/payments/payment_methods.rs @@ -0,0 +1,85 @@ +//! Contains functions of payment methods that are used in payments +//! one of such functions is `list_payment_methods` + +use super::errors; +use crate::{routes, types::domain}; +use common_utils::id_type; + +#[cfg(all( + feature = "v2", + feature = "customer_v2", + feature = "payment_methods_v2" +))] +pub async fn list_payment_methods( + state: routes::SessionState, + merchant_account: domain::MerchantAccount, + profile: domain::Profile, + key_store: domain::MerchantKeyStore, + payment_id: id_type::GlobalPaymentId, + req: api_models::payments::PaymentMethodsListRequest, + header_payload: &hyperswitch_domain_models::payments::HeaderPayload, +) -> errors::RouterResponse { + // use common_utils::ext_traits::OptionExt; + // use error_stack::ResultExt; + + // use crate::db::errors::StorageErrorExt; + + // let db = &*state.store; + // let key_manager_state = &state.into(); + + // let payment_intent = db + // .find_payment_intent_by_id( + // key_manager_state, + // &payment_id, + // &key_store, + // merchant_account.storage_scheme, + // ) + // .await + // .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; + + // validate_payment_status(payment_intent.status)?; + // let client_secret = header_payload + // .client_secret + // .as_ref() + // .get_required_value("client_secret header")?; + // payment_intent.validate_client_secret(client_secret)?; + + // let payment_connector_accounts = db + // .list_enabled_connector_accounts_by_profile_id( + // state, + // profile.get_id(), + // &key_store, + // common_enums::ConnectorType::PaymentProcessor, + // ) + // .await + // .change_context(errors::ApiErrorResponse::InternalServerError) + // .attach_printable("error when fetching merchant connector accounts")?; + + todo!() +} + +/// Validate if payment methods list can be performed on the current status of payment intent +fn validate_payment_status( + intent_status: common_enums::IntentStatus, +) -> Result<(), errors::ApiErrorResponse> { + match intent_status { + common_enums::IntentStatus::RequiresPaymentMethod => Ok(()), + common_enums::IntentStatus::Succeeded + | common_enums::IntentStatus::Failed + | common_enums::IntentStatus::Cancelled + | common_enums::IntentStatus::Processing + | common_enums::IntentStatus::RequiresCustomerAction + | common_enums::IntentStatus::RequiresMerchantAction + | common_enums::IntentStatus::RequiresCapture + | common_enums::IntentStatus::PartiallyCaptured + | common_enums::IntentStatus::RequiresConfirmation + | common_enums::IntentStatus::PartiallyCapturedAndCapturable => { + Err(errors::ApiErrorResponse::PaymentUnexpectedState { + current_flow: "list_payment_methods".to_string(), + field_name: "status".to_string(), + current_value: intent_status.to_string(), + states: ["requires_payment_method".to_string()].join(", "), + }) + } + } +} diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index b3be47a87438..ac8b48459ebf 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -553,6 +553,7 @@ pub fn perform_volume_split( Ok(splits.into_iter().map(|sp| sp.connector).collect()) } +#[cfg(feature = "v1")] pub async fn get_merchant_cgraph<'a>( state: &SessionState, key_store: &domain::MerchantKeyStore, @@ -599,6 +600,7 @@ pub async fn get_merchant_cgraph<'a>( Ok(cgraph) } +#[cfg(feature = "v1")] pub async fn refresh_cgraph_cache<'a>( state: &SessionState, key_store: &domain::MerchantKeyStore, @@ -695,6 +697,21 @@ pub async fn refresh_cgraph_cache<'a>( Ok(cgraph) } +#[cfg(feature = "v2")] +#[allow(clippy::too_many_arguments)] +pub async fn perform_cgraph_filtering( + state: &SessionState, + key_store: &domain::MerchantKeyStore, + chosen: Vec, + backend_input: dsl_inputs::BackendInput, + eligible_connectors: Option<&Vec>, + profile_id: &common_utils::id_type::ProfileId, + transaction_type: &api_enums::TransactionType, +) -> RoutingResult> { + todo!() +} + +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn perform_cgraph_filtering( state: &SessionState, @@ -1124,80 +1141,78 @@ async fn perform_session_routing_for_pm_type( } } -#[cfg(feature = "v2")] -async fn perform_session_routing_for_pm_type( - session_pm_input: &SessionRoutingPmTypeInput<'_>, - transaction_type: &api_enums::TransactionType, - business_profile: &domain::Profile, -) -> RoutingResult>> { - let merchant_id = &session_pm_input.key_store.merchant_id; - - let MerchantAccountRoutingAlgorithm::V1(algorithm_id) = session_pm_input.routing_algorithm; - - let profile_wrapper = admin::ProfileWrapper::new(business_profile.clone()); - let chosen_connectors = if let Some(ref algorithm_id) = algorithm_id { - let cached_algorithm = ensure_algorithm_cached_v1( - &session_pm_input.state.clone(), - merchant_id, - algorithm_id, - session_pm_input.profile_id, - transaction_type, - ) - .await?; - - match cached_algorithm.as_ref() { - CachedAlgorithm::Single(conn) => vec![(**conn).clone()], - CachedAlgorithm::Priority(plist) => plist.clone(), - CachedAlgorithm::VolumeSplit(splits) => { - perform_volume_split(splits.to_vec(), Some(session_pm_input.attempt_id)) - .change_context(errors::RoutingError::ConnectorSelectionFailed)? - } - CachedAlgorithm::Advanced(interpreter) => execute_dsl_and_get_connector_v1( - session_pm_input.backend_input.clone(), - interpreter, - )?, - } - } else { - profile_wrapper - .get_default_fallback_list_of_connector_under_profile() - .change_context(errors::RoutingError::FallbackConfigFetchFailed)? - }; - - let mut final_selection = perform_cgraph_filtering( - &session_pm_input.state.clone(), - session_pm_input.key_store, - chosen_connectors, - session_pm_input.backend_input.clone(), - None, - session_pm_input.profile_id, - transaction_type, - ) - .await?; - - if final_selection.is_empty() { - let fallback = profile_wrapper - .get_default_fallback_list_of_connector_under_profile() - .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; - - final_selection = perform_cgraph_filtering( - &session_pm_input.state.clone(), - session_pm_input.key_store, - fallback, - session_pm_input.backend_input.clone(), - None, - session_pm_input.profile_id, - transaction_type, - ) - .await?; - } - - if final_selection.is_empty() { - Ok(None) - } else { - Ok(Some(final_selection)) - } -} - +// async fn perform_session_routing_for_pm_type( +// session_pm_input: &SessionRoutingPmTypeInput<'_>, +// transaction_type: &api_enums::TransactionType, +// business_profile: &domain::Profile, +// ) -> RoutingResult>> { +// let merchant_id = &session_pm_input.key_store.merchant_id; + +// let MerchantAccountRoutingAlgorithm::V1(algorithm_id) = session_pm_input.routing_algorithm; + +// let profile_wrapper = admin::ProfileWrapper::new(business_profile.clone()); +// let chosen_connectors = if let Some(ref algorithm_id) = algorithm_id { +// let cached_algorithm = ensure_algorithm_cached_v1( +// &session_pm_input.state.clone(), +// merchant_id, +// algorithm_id, +// session_pm_input.profile_id, +// transaction_type, +// ) +// .await?; + +// match cached_algorithm.as_ref() { +// CachedAlgorithm::Single(conn) => vec![(**conn).clone()], +// CachedAlgorithm::Priority(plist) => plist.clone(), +// CachedAlgorithm::VolumeSplit(splits) => { +// perform_volume_split(splits.to_vec(), Some(session_pm_input.attempt_id)) +// .change_context(errors::RoutingError::ConnectorSelectionFailed)? +// } +// CachedAlgorithm::Advanced(interpreter) => execute_dsl_and_get_connector_v1( +// session_pm_input.backend_input.clone(), +// interpreter, +// )?, +// } +// } else { +// profile_wrapper +// .get_default_fallback_list_of_connector_under_profile() +// .change_context(errors::RoutingError::FallbackConfigFetchFailed)? +// }; + +// let mut final_selection = perform_cgraph_filtering( +// &session_pm_input.state.clone(), +// session_pm_input.key_store, +// chosen_connectors, +// session_pm_input.backend_input.clone(), +// None, +// session_pm_input.profile_id, +// transaction_type, +// ) +// .await?; + +// if final_selection.is_empty() { +// let fallback = profile_wrapper +// .get_default_fallback_list_of_connector_under_profile() +// .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; + +// final_selection = perform_cgraph_filtering( +// &session_pm_input.state.clone(), +// session_pm_input.key_store, +// fallback, +// session_pm_input.backend_input.clone(), +// None, +// session_pm_input.profile_id, +// transaction_type, +// ) +// .await?; +// } + +// if final_selection.is_empty() { +// Ok(None) +// } else { +// Ok(Some(final_selection)) +// } +// } #[cfg(feature = "v2")] pub fn make_dsl_input_for_surcharge( _payment_attempt: &oss_storage::PaymentAttempt, diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs index 61ebffe6b83a..22354b4c00fc 100644 --- a/crates/router/src/core/payout_link.rs +++ b/crates/router/src/core/payout_link.rs @@ -329,7 +329,7 @@ pub async fn initiate_payout_link( } } -#[cfg(feature = "payouts")] +#[cfg(all(feature = "payouts", feature = "v1"))] pub async fn filter_payout_methods( state: &SessionState, merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index 94946b7e0e0c..9f7fc74b6325 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -84,7 +84,7 @@ pub fn get_next_connector( .attach_printable("Connector not found in connectors iterator") } -#[cfg(feature = "payouts")] +#[cfg(all(feature = "payouts", feature = "v1"))] pub async fn get_connector_choice( state: &SessionState, merchant_account: &domain::MerchantAccount, @@ -263,6 +263,7 @@ pub async fn make_connector_decision( } } +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn payouts_core( state: &SessionState, @@ -297,6 +298,19 @@ pub async fn payouts_core( .await } +#[cfg(feature = "v2")] +#[instrument(skip_all)] +pub async fn payouts_core( + state: &SessionState, + merchant_account: &domain::MerchantAccount, + key_store: &domain::MerchantKeyStore, + payout_data: &mut PayoutData, + routing_algorithm: Option, + eligible_connectors: Option>, +) -> RouterResult<()> { + todo!() +} + #[instrument(skip_all)] pub async fn payouts_create_core( state: SessionState, @@ -517,6 +531,7 @@ pub async fn payouts_update_core( response_handler(&state, &merchant_account, &payout_data).await } +#[cfg(all(feature = "payouts", feature = "v1"))] #[instrument(skip_all)] pub async fn payouts_retrieve_core( state: SessionState, diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index 5becf01597cb..2eab793216e7 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -769,6 +769,7 @@ pub(super) async fn get_or_create_customer_details( } } +#[cfg(all(feature = "payouts", feature = "v1"))] pub async fn decide_payout_connector( state: &SessionState, merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index 47c9adafb718..c256892647d4 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -1194,6 +1194,23 @@ impl MerchantConnectorAccountInterface for KafkaStore { .await } + #[cfg(all(feature = "oltp", feature = "v2"))] + async fn list_enabled_connector_accounts_by_profile_id( + &self, + state: &KeyManagerState, + profile_id: &id_type::ProfileId, + key_store: &domain::MerchantKeyStore, + connector_type: common_enums::ConnectorType, + ) -> CustomResult, errors::StorageError> { + self.list_enabled_connector_accounts_by_profile_id( + state, + profile_id, + key_store, + connector_type, + ) + .await + } + async fn insert_merchant_connector_account( &self, state: &KeyManagerState, diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs index 687f6e8fea24..0abbccd2cb35 100644 --- a/crates/router/src/db/merchant_connector_account.rs +++ b/crates/router/src/db/merchant_connector_account.rs @@ -189,6 +189,15 @@ where key_store: &domain::MerchantKeyStore, ) -> CustomResult, errors::StorageError>; + #[cfg(all(feature = "oltp", feature = "v2"))] + async fn list_enabled_connector_accounts_by_profile_id( + &self, + state: &KeyManagerState, + profile_id: &common_utils::id_type::ProfileId, + key_store: &domain::MerchantKeyStore, + connector_type: common_enums::ConnectorType, + ) -> CustomResult, errors::StorageError>; + async fn update_merchant_connector_account( &self, state: &KeyManagerState, @@ -493,6 +502,41 @@ impl MerchantConnectorAccountInterface for Store { .await } + #[cfg(all(feature = "oltp", feature = "v2"))] + async fn list_enabled_connector_accounts_by_profile_id( + &self, + state: &KeyManagerState, + profile_id: &common_utils::id_type::ProfileId, + key_store: &domain::MerchantKeyStore, + connector_type: common_enums::ConnectorType, + ) -> CustomResult, errors::StorageError> { + let conn = connection::pg_connection_read(self).await?; + + storage::MerchantConnectorAccount::list_enabled_by_profile_id( + &conn, + profile_id, + connector_type, + ) + .await + .map_err(|error| report!(errors::StorageError::from(error))) + .async_and_then(|items| async { + let mut output = Vec::with_capacity(items.len()); + for item in items.into_iter() { + output.push( + item.convert( + state, + key_store.key.get_inner(), + key_store.merchant_id.clone().into(), + ) + .await + .change_context(errors::StorageError::DecryptionError)?, + ) + } + Ok(output) + }) + .await + } + #[instrument(skip_all)] async fn find_merchant_connector_account_by_merchant_id_and_disabled_list( &self, @@ -1010,6 +1054,17 @@ impl MerchantConnectorAccountInterface for MockDb { } } + #[cfg(all(feature = "oltp", feature = "v2"))] + async fn list_enabled_connector_accounts_by_profile_id( + &self, + state: &KeyManagerState, + profile_id: &common_utils::id_type::ProfileId, + key_store: &domain::MerchantKeyStore, + connector_type: common_enums::ConnectorType, + ) -> CustomResult, errors::StorageError> { + todo!() + } + #[cfg(feature = "v1")] async fn find_merchant_connector_account_by_merchant_id_connector_name( &self, diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index ad0b42cd933e..232ee48d76ca 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -565,8 +565,8 @@ impl Payments { .route(web::get().to(payments::payments_start_redirection)), ) .service( - web::resource("/saved-payment-methods") - .route(web::get().to(list_customer_payment_method_for_payment)), + web::resource("/payment-methods") + .route(web::get().to(payments::list_payment_methods)), ) .service( web::resource("/finish-redirection/{publishable_key}/{profile_id}") diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index 8ee31ecf943a..26253bf11bc8 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -507,45 +507,6 @@ pub async fn list_customer_payment_method_api( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] -#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))] -pub async fn list_customer_payment_method_for_payment( - state: web::Data, - payment_id: web::Path<(String,)>, - req: HttpRequest, - query_payload: web::Query, -) -> HttpResponse { - let flow = Flow::CustomerPaymentMethodsList; - let payload = query_payload.into_inner(); - let _payment_id = payment_id.into_inner().0.clone(); - - let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) { - Ok((auth, _auth_flow)) => (auth, _auth_flow), - Err(e) => return api::log_and_return_error_response(e), - }; - - Box::pin(api::server_wrap( - flow, - state, - &req, - payload, - |state, auth: auth::AuthenticationData, req, _| { - list_customer_payment_method_util( - state, - auth.merchant_account, - auth.profile, - auth.key_store, - Some(req), - None, - true, - ) - }, - &*auth, - api_locking::LockAction::NotApplicable, - )) - .await -} - #[cfg(all( feature = "v2", feature = "payment_methods_v2", diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs index 27a5462c05ea..d850506a52ae 100644 --- a/crates/router/src/routes/payments.rs +++ b/crates/router/src/routes/payments.rs @@ -2385,3 +2385,51 @@ pub async fn payments_finish_redirection( ) .await } + +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] +pub async fn list_payment_methods( + state: web::Data, + req: actix_web::HttpRequest, + path: web::Path, + query_payload: web::Query, +) -> impl Responder { + let flow = Flow::PaymentMethodsList; + let payload = query_payload.into_inner(); + let global_payment_id = path.into_inner(); + + tracing::Span::current().record("payment_id", global_payment_id.get_string_repr()); + + let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId { + global_payment_id, + payload, + }; + + let header_payload = match HeaderPayload::foreign_try_from(req.headers()) { + Ok(headers) => headers, + Err(err) => { + return api::log_and_return_error_response(err); + } + }; + + Box::pin(api::server_wrap( + flow, + state, + &req, + internal_payload, + |state, auth, req, _| { + payments::payment_methods::list_payment_methods( + state, + auth.merchant_account, + auth.profile, + auth.key_store, + req.global_payment_id, + req.payload, + &header_payload, + ) + }, + &auth::PublishableKeyAuth, + api_locking::LockAction::NotApplicable, + )) + .await +} diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 55a523b528eb..d7eafaf76361 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -992,6 +992,7 @@ impl ForeignTryFrom { type Error = error_stack::Report; fn foreign_try_from(item: domain::MerchantConnectorAccount) -> Result { + #[cfg(feature = "v1")] let payment_methods_enabled = match item.payment_methods_enabled { Some(secret_val) => { let val = secret_val @@ -1004,6 +1005,7 @@ impl ForeignTryFrom } None => None, }; + let frm_configs = match item.frm_configs { Some(frm_value) => { let configs_for_frm : Vec = frm_value @@ -1047,7 +1049,7 @@ impl ForeignTryFrom connector_name: item.connector_name, connector_label: item.connector_label, disabled: item.disabled, - payment_methods_enabled, + payment_methods_enabled: item.payment_methods_enabled, frm_configs, profile_id: item.profile_id, applepay_verified_domains: item.applepay_verified_domains, @@ -1058,6 +1060,7 @@ impl ForeignTryFrom } } +#[cfg(feature = "v1")] impl ForeignTryFrom for api_models::admin::MerchantConnectorResponse { @@ -1221,6 +1224,103 @@ impl ForeignTryFrom } } +#[cfg(feature = "v2")] +impl ForeignTryFrom + for api_models::admin::MerchantConnectorResponse +{ + type Error = error_stack::Report; + fn foreign_try_from(item: domain::MerchantConnectorAccount) -> Result { + let frm_configs = match item.frm_configs { + Some(ref frm_value) => { + let configs_for_frm : Vec = frm_value + .iter() + .map(|config| { config + .peek() + .clone() + .parse_value("FrmConfigs") + .change_context(errors::ApiErrorResponse::InvalidDataFormat { + field_name: "frm_configs".to_string(), + expected_format: r#"[{ "gateway": "stripe", "payment_methods": [{ "payment_method": "card","payment_method_types": [{"payment_method_type": "credit","card_networks": ["Visa"],"flow": "pre","action": "cancel_txn"}]}]}]"#.to_string(), + }) + }) + .collect::, _>>()?; + Some(configs_for_frm) + } + None => None, + }; + + // parse the connector_account_details into ConnectorAuthType + let connector_account_details: hyperswitch_domain_models::router_data::ConnectorAuthType = + item.connector_account_details + .clone() + .into_inner() + .parse_value("ConnectorAuthType") + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed while parsing value for ConnectorAuthType")?; + // get the masked keys from the ConnectorAuthType and encode it to secret value + let masked_connector_account_details = Secret::new( + connector_account_details + .get_masked_keys() + .encode_to_value() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to encode ConnectorAuthType")?, + ); + + let response = Self { + id: item.get_id(), + connector_type: item.connector_type, + connector_name: item.connector_name, + connector_label: item.connector_label, + connector_account_details: masked_connector_account_details, + disabled: item.disabled, + payment_methods_enabled: item.payment_methods_enabled, + metadata: item.metadata, + frm_configs, + connector_webhook_details: item + .connector_webhook_details + .map(|webhook_details| { + serde_json::Value::parse_value( + webhook_details.expose(), + "MerchantConnectorWebhookDetails", + ) + .attach_printable("Unable to deserialize connector_webhook_details") + .change_context(errors::ApiErrorResponse::InternalServerError) + }) + .transpose()?, + profile_id: item.profile_id, + applepay_verified_domains: item.applepay_verified_domains, + pm_auth_config: item.pm_auth_config, + status: item.status, + additional_merchant_data: item + .additional_merchant_data + .map(|data| { + let data = data.into_inner(); + serde_json::Value::parse_value::( + data.expose(), + "AdditionalMerchantData", + ) + .attach_printable("Unable to deserialize additional_merchant_data") + .change_context(errors::ApiErrorResponse::InternalServerError) + }) + .transpose()? + .map(api_models::admin::AdditionalMerchantData::foreign_from), + connector_wallets_details: item + .connector_wallets_details + .map(|data| { + data.into_inner() + .expose() + .parse_value::( + "ConnectorWalletDetails", + ) + .attach_printable("Unable to deserialize connector_wallets_details") + .change_context(errors::ApiErrorResponse::InternalServerError) + }) + .transpose()?, + }; + Ok(response) + } +} + #[cfg(feature = "v1")] impl ForeignFrom for payments::PaymentAttemptResponse { fn foreign_from(payment_attempt: storage::PaymentAttempt) -> Self { diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql index d008367af333..a4616016abfc 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/down.sql @@ -43,3 +43,6 @@ ALTER TABLE payment_attempt DROP COLUMN payment_method_type_v2, DROP COLUMN payment_method_billing_address, DROP COLUMN redirection_data, DROP COLUMN connector_payment_data; + +ALTER TABLE merchant_connector_account +ALTER COLUMN payment_methods_enabled TYPE JSON [ ]; diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql index a402beac139c..faebb36cdf9d 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql @@ -52,3 +52,7 @@ ADD COLUMN payment_method_type_v2 VARCHAR, ADD COLUMN payment_method_billing_address BYTEA, ADD COLUMN redirection_data JSONB, ADD COLUMN connector_payment_data VARCHAR(512); + +-- Change the type of the column from JSON to JSONB +ALTER TABLE merchant_connector_account +ALTER COLUMN payment_methods_enabled TYPE JSONB [ ]; diff --git a/v2_migrations/2024-10-08-081847_drop_v1_columns/up.sql b/v2_migrations/2024-10-08-081847_drop_v1_columns/up.sql index 507b29dadf7d..276bea10bd51 100644 --- a/v2_migrations/2024-10-08-081847_drop_v1_columns/up.sql +++ b/v2_migrations/2024-10-08-081847_drop_v1_columns/up.sql @@ -33,7 +33,7 @@ ALTER TABLE business_profile DROP COLUMN profile_id, DROP COLUMN frm_routing_algorithm, DROP COLUMN payout_routing_algorithm; --- This migration is to remove the business_country, business_label, business_sub_label, test_mode, merchant_connector_id and frm_configs columns from the merchant_connector_account table +-- This migration is to remove the fields that are no longer used by the v1 application, or some type changes. ALTER TABLE merchant_connector_account DROP COLUMN IF EXISTS business_country, DROP COLUMN IF EXISTS business_label, DROP COLUMN IF EXISTS business_sub_label, From 560d3f638260c052037b2619a819dda270c608cf Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 11 Dec 2024 00:39:47 +0530 Subject: [PATCH 03/62] feat(payments_v2): implement payment methods list for v2 --- crates/api_models/src/payment_methods.rs | 13 +- crates/api_models/src/payments.rs | 8 +- crates/router/src/core/admin.rs | 26 -- .../src/core/payments/payment_methods.rs | 251 +++++++++++++++--- 4 files changed, 214 insertions(+), 84 deletions(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 283a0d662d71..bcba44c6f828 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1244,29 +1244,18 @@ pub struct ResponsePaymentMethodTypes { #[schema(example = "klarna", value_type = PaymentMethodType)] pub payment_method_subtype: api_enums::PaymentMethodType, - /// The list of payment experiences enabled, if applicable for a payment method type - pub payment_experience: Option>, - /// The list of card networks enabled, if applicable for a payment method type pub card_networks: Option>, /// The list of banks enabled, if applicable for a payment method type pub bank_names: Option>, - /// The Bank debit payment method information, if applicable for a payment method type. - pub bank_debits: Option, - - /// The Bank transfer payment method information, if applicable for a payment method type. - pub bank_transfers: Option, - /// Required fields for the payment_method_type. + /// This is the union of all the required fields for the payment method type enabled in all the connectors. pub required_fields: Option>, /// surcharge details for this payment method type if exists pub surcharge_details: Option, - - /// auth service connector label for this payment method type, if exists - pub pm_auth_connector: Option, } #[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema)] diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index e5550b28e6ca..a449d0e2d71b 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6287,13 +6287,7 @@ pub struct PaymentMethodsListRequest {} #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodListResponse { /// The list of payment methods that are enabled for the business profile - pub payment_methods: Vec, - - /// flag that indicates whether to collect shipping details from wallets or from the customer - pub collect_shipping_details_from_wallets: Option, - - /// flag that indicates whether to collect billing details from wallets or from the customer - pub collect_billing_details_from_wallets: Option, + pub payment_methods: Vec, } #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index ed6afbd3845c..29c9927867a8 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1705,32 +1705,6 @@ impl ConnectorStatusAndDisabledValidation<'_> { } } -struct PaymentMethodsEnabled<'a> { - payment_methods_enabled: &'a Option>, -} - -impl PaymentMethodsEnabled<'_> { - fn get_payment_methods_enabled(&self) -> RouterResult>> { - let mut vec = Vec::new(); - let payment_methods_enabled = match self.payment_methods_enabled.clone() { - Some(val) => { - for pm in val.into_iter() { - let pm_value = pm - .encode_to_value() - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable( - "Failed while encoding to serde_json::Value, PaymentMethod", - )?; - vec.push(Secret::new(pm_value)) - } - Some(vec) - } - None => None, - }; - Ok(payment_methods_enabled) - } -} - struct ConnectorMetadata<'a> { connector_metadata: &'a Option, } diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index e2d190706acc..c2648ea46ae1 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -2,8 +2,9 @@ //! one of such functions is `list_payment_methods` use super::errors; -use crate::{routes, types::domain}; -use common_utils::id_type; +use crate::{db::errors::StorageErrorExt, routes, types::domain}; +use common_utils::{ext_traits::OptionExt, id_type}; +use error_stack::ResultExt; #[cfg(all( feature = "v2", @@ -19,43 +20,215 @@ pub async fn list_payment_methods( req: api_models::payments::PaymentMethodsListRequest, header_payload: &hyperswitch_domain_models::payments::HeaderPayload, ) -> errors::RouterResponse { - // use common_utils::ext_traits::OptionExt; - // use error_stack::ResultExt; - - // use crate::db::errors::StorageErrorExt; - - // let db = &*state.store; - // let key_manager_state = &state.into(); - - // let payment_intent = db - // .find_payment_intent_by_id( - // key_manager_state, - // &payment_id, - // &key_store, - // merchant_account.storage_scheme, - // ) - // .await - // .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - - // validate_payment_status(payment_intent.status)?; - // let client_secret = header_payload - // .client_secret - // .as_ref() - // .get_required_value("client_secret header")?; - // payment_intent.validate_client_secret(client_secret)?; - - // let payment_connector_accounts = db - // .list_enabled_connector_accounts_by_profile_id( - // state, - // profile.get_id(), - // &key_store, - // common_enums::ConnectorType::PaymentProcessor, - // ) - // .await - // .change_context(errors::ApiErrorResponse::InternalServerError) - // .attach_printable("error when fetching merchant connector accounts")?; - - todo!() + let db = &*state.store; + let key_manager_state = &(&state).into(); + + let payment_intent = db + .find_payment_intent_by_id( + key_manager_state, + &payment_id, + &key_store, + merchant_account.storage_scheme, + ) + .await + .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; + + validate_payment_status(payment_intent.status)?; + + let client_secret = header_payload + .client_secret + .as_ref() + .get_required_value("client_secret header") + .change_context(errors::ApiErrorResponse::MissingRequiredField { + field_name: "client_secret header", + })?; + + payment_intent.validate_client_secret(client_secret)?; + + let payment_connector_accounts = db + .list_enabled_connector_accounts_by_profile_id( + key_manager_state, + profile.get_id(), + &key_store, + common_enums::ConnectorType::PaymentProcessor, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("error when fetching merchant connector accounts")?; + + let response = PaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts) + .perform_filtering() + .get_required_fields(RequiredFieldsInput::new()) + .perform_surcharge_calculation() + .generate_response(); + + Ok(hyperswitch_domain_models::api::ApplicationResponse::Json( + response, + )) +} + +struct PaymentMethodsEnabledForConnector { + payment_methods_enabled: common_utils::types::RequestPaymentMethodTypes, + payment_method: common_enums::PaymentMethod, + connector: String, +} + +struct PaymentMethodsEnabled { + payment_methods_enabled: Vec, +} + +struct FilteredPaymentMethodsEnabled { + payment_methods_enabled: Vec, +} + +struct RequiredFieldsInput {} + +impl RequiredFieldsInput { + fn new() -> Self { + Self {} + } +} + +impl FilteredPaymentMethodsEnabled { + fn get_required_fields( + self, + input: RequiredFieldsInput, + ) -> PaymentMethodsEnabledWithRequiredFieldsContainer { + let required_fields_info = self + .payment_methods_enabled + .into_iter() + .map( + |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFields { + required_field: None, + payment_method_subtype: payment_methods_enabled + .payment_methods_enabled + .payment_method_type, + }, + ) + .collect(); + + PaymentMethodsEnabledWithRequiredFieldsContainer { + payment_methods_enabled: required_fields_info, + } + } +} + +struct PaymentMethodsEnabledWithRequiredFields { + required_field: + Option>, + payment_method_subtype: common_enums::PaymentMethodType, +} + +struct PaymentMethodsEnabledWithRequiredFieldsContainer { + payment_methods_enabled: Vec, +} + +struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { + required_field: + Option>, + payment_method_subtype: common_enums::PaymentMethodType, + surcharge: Option, +} + +struct PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { + payment_methods_enabled: Vec, +} + +impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { + fn generate_response(self) -> api_models::payments::PaymentMethodListResponse { + let response_payment_methods = self + .payment_methods_enabled + .into_iter() + .map(|payment_methods_enabled| { + api_models::payment_methods::ResponsePaymentMethodTypes { + payment_method_subtype: payment_methods_enabled.payment_method_subtype, + required_fields: payment_methods_enabled.required_field, + surcharge_details: payment_methods_enabled.surcharge, + card_networks: None, + bank_names: None, + } + }) + .collect(); + + api_models::payments::PaymentMethodListResponse { + payment_methods: response_payment_methods, + } + } +} + +impl PaymentMethodsEnabledWithRequiredFieldsContainer { + fn perform_surcharge_calculation( + self, + ) -> PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { + let details_with_surcharge = self + .payment_methods_enabled + .into_iter() + .map( + |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { + required_field: payment_methods_enabled.required_field, + payment_method_subtype: payment_methods_enabled.payment_method_subtype, + surcharge: None, + }, + ) + .collect(); + + PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { + payment_methods_enabled: details_with_surcharge, + } + } +} + +impl PaymentMethodsEnabled { + /// This functions flattens the payment methods enabled from the connector accounts + /// Retains the connector name and payment method in every flattened element + fn from_payment_connectors_list( + payment_connectors: Vec, + ) -> Self { + let payment_methods_enabled_flattened_with_connector = payment_connectors + .into_iter() + .map(|connector| { + ( + connector.payment_methods_enabled.unwrap_or_default(), + connector.connector_name, + ) + }) + .flat_map(|(payment_method_enabled, connector_name)| { + payment_method_enabled + .into_iter() + .flat_map(move |payment_method| { + let request_payment_methods_enabled = + payment_method.payment_method_types.unwrap_or_default(); + let length = request_payment_methods_enabled.len(); + request_payment_methods_enabled.into_iter().zip( + std::iter::repeat(( + connector_name.clone(), + payment_method.payment_method, + )) + .take(length), + ) + }) + }) + .map( + |(request_payment_methods, (connector_name, payment_method))| { + PaymentMethodsEnabledForConnector { + payment_methods_enabled: request_payment_methods, + connector: connector_name.clone(), + payment_method: payment_method.clone(), + } + }, + ) + .collect(); + + Self { + payment_methods_enabled: payment_methods_enabled_flattened_with_connector, + } + } + + fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { + FilteredPaymentMethodsEnabled { + payment_methods_enabled: self.payment_methods_enabled, + } + } } /// Validate if payment methods list can be performed on the current status of payment intent From 09acb50340f98806b396ba8e608fbf5cafb1c277 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 11 Dec 2024 12:04:59 +0530 Subject: [PATCH 04/62] feat(payments_v2): add customers_payment_methods in pm list --- crates/api_models/src/payments.rs | 4 ++++ crates/router/src/core/payments/payment_methods.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index a449d0e2d71b..4a36c640770c 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6288,6 +6288,10 @@ pub struct PaymentMethodsListRequest {} pub struct PaymentMethodListResponse { /// The list of payment methods that are enabled for the business profile pub payment_methods: Vec, + + /// The list of payment methods that are saved by the given customer + /// This field is only returned if the customer_id is provided in the request + pub customer_payment_methods: Vec, } #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index c2648ea46ae1..ba924314d1c8 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -17,7 +17,7 @@ pub async fn list_payment_methods( profile: domain::Profile, key_store: domain::MerchantKeyStore, payment_id: id_type::GlobalPaymentId, - req: api_models::payments::PaymentMethodsListRequest, + _req: api_models::payments::PaymentMethodsListRequest, header_payload: &hyperswitch_domain_models::payments::HeaderPayload, ) -> errors::RouterResponse { let db = &*state.store; @@ -152,6 +152,7 @@ impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { api_models::payments::PaymentMethodListResponse { payment_methods: response_payment_methods, + customer_payment_methods: Vec::new(), } } } From 940e2c11afe6f76e537ffbf5e187c22921c14121 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 11 Dec 2024 16:09:19 +0530 Subject: [PATCH 05/62] feat(payments_v2): add list_payment_methods to openapi --- .../profile--connector-accounts-list.mdx | 3 + .../merchant-account--profile-list.mdx | 3 + .../connector-account--create.mdx | 3 + .../connector-account--retrieve.mdx | 3 + .../connector-account--update.mdx | 3 + .../merchant-connector--delete.mdx | 3 + ...t-saved-payment-methods-for-a-customer.mdx | 3 + .../payments/payment-methods--list.mdx | 3 + api-reference-v2/mint.json | 11 +- api-reference-v2/openapi_spec.json | 366 ++++++------------ 10 files changed, 153 insertions(+), 248 deletions(-) create mode 100644 api-reference-v2/api-reference/business-profile/profile--connector-accounts-list.mdx create mode 100644 api-reference-v2/api-reference/merchant-account/merchant-account--profile-list.mdx create mode 100644 api-reference-v2/api-reference/merchant-connector-account/connector-account--create.mdx create mode 100644 api-reference-v2/api-reference/merchant-connector-account/connector-account--retrieve.mdx create mode 100644 api-reference-v2/api-reference/merchant-connector-account/connector-account--update.mdx create mode 100644 api-reference-v2/api-reference/merchant-connector-account/merchant-connector--delete.mdx create mode 100644 api-reference-v2/api-reference/payment-methods/list-saved-payment-methods-for-a-customer.mdx create mode 100644 api-reference-v2/api-reference/payments/payment-methods--list.mdx diff --git a/api-reference-v2/api-reference/business-profile/profile--connector-accounts-list.mdx b/api-reference-v2/api-reference/business-profile/profile--connector-accounts-list.mdx new file mode 100644 index 000000000000..55218be7c0b4 --- /dev/null +++ b/api-reference-v2/api-reference/business-profile/profile--connector-accounts-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/profiles/{id}/connector-accounts +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/merchant-account/merchant-account--profile-list.mdx b/api-reference-v2/api-reference/merchant-account/merchant-account--profile-list.mdx new file mode 100644 index 000000000000..069bd602ddf4 --- /dev/null +++ b/api-reference-v2/api-reference/merchant-account/merchant-account--profile-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/merchant-accounts/{id}/profiles +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/merchant-connector-account/connector-account--create.mdx b/api-reference-v2/api-reference/merchant-connector-account/connector-account--create.mdx new file mode 100644 index 000000000000..d672d6fa34dc --- /dev/null +++ b/api-reference-v2/api-reference/merchant-connector-account/connector-account--create.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v2/connector-accounts +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/merchant-connector-account/connector-account--retrieve.mdx b/api-reference-v2/api-reference/merchant-connector-account/connector-account--retrieve.mdx new file mode 100644 index 000000000000..dbd26b9b10b1 --- /dev/null +++ b/api-reference-v2/api-reference/merchant-connector-account/connector-account--retrieve.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/connector-accounts/{id} +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/merchant-connector-account/connector-account--update.mdx b/api-reference-v2/api-reference/merchant-connector-account/connector-account--update.mdx new file mode 100644 index 000000000000..fe864d538f8f --- /dev/null +++ b/api-reference-v2/api-reference/merchant-connector-account/connector-account--update.mdx @@ -0,0 +1,3 @@ +--- +openapi: put /v2/connector-accounts/{id} +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--delete.mdx b/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--delete.mdx new file mode 100644 index 000000000000..15fdd6644126 --- /dev/null +++ b/api-reference-v2/api-reference/merchant-connector-account/merchant-connector--delete.mdx @@ -0,0 +1,3 @@ +--- +openapi: delete /v2/connector-accounts/{id} +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/payment-methods/list-saved-payment-methods-for-a-customer.mdx b/api-reference-v2/api-reference/payment-methods/list-saved-payment-methods-for-a-customer.mdx new file mode 100644 index 000000000000..ef5a27f9604d --- /dev/null +++ b/api-reference-v2/api-reference/payment-methods/list-saved-payment-methods-for-a-customer.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/customers/{id}/saved-payment-methods +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/payments/payment-methods--list.mdx b/api-reference-v2/api-reference/payments/payment-methods--list.mdx new file mode 100644 index 000000000000..80ad4cb172fc --- /dev/null +++ b/api-reference-v2/api-reference/payments/payment-methods--list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/payments/{id}/payment_methods +--- \ No newline at end of file diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json index aed89492443d..ef398daa67b6 100644 --- a/api-reference-v2/mint.json +++ b/api-reference-v2/mint.json @@ -23,9 +23,7 @@ "navigation": [ { "group": "Get Started", - "pages": [ - "introduction" - ] + "pages": ["introduction"] }, { "group": "Essentials", @@ -41,6 +39,7 @@ "api-reference/payments/payments--create-intent", "api-reference/payments/payments--get-intent", "api-reference/payments/payments--session-token", + "api-reference/payments/payment-methods--list", "api-reference/payments/payments--confirm-intent", "api-reference/payments/payments--get" ] @@ -134,10 +133,8 @@ "github": "https://github.com/juspay/hyperswitch", "linkedin": "https://www.linkedin.com/company/hyperswitch" }, - "openapi": [ - "openapi_spec.json" - ], + "openapi": ["openapi_spec.json"], "api": { "maintainOrder": true } -} \ No newline at end of file +} diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 778e89ab30b6..b7ce7b7878b5 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -674,57 +674,6 @@ ] } }, - "/v2/payments/{payment_id}/create-external-sdk-tokens": { - "post": { - "tags": [ - "Payments" - ], - "summary": "Payments - Session token", - "description": "Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.", - "operationId": "Create Session tokens for a Payment", - "parameters": [ - { - "name": "payment_id", - "in": "path", - "description": "The identifier for payment", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentsSessionRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Payment session object created or session token was retrieved from wallets", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentsSessionResponse" - } - } - } - }, - "400": { - "description": "Missing mandatory fields" - } - }, - "security": [ - { - "publishable_key": [] - } - ] - } - }, "/v2/profiles": { "post": { "tags": [ @@ -1962,7 +1911,7 @@ }, "security": [ { - "publisable_key": [] + "publishable_key": [] } ] } @@ -2017,6 +1966,98 @@ ] } }, + "/v2/payments/{payment_id}/create-external-sdk-tokens": { + "post": { + "tags": [ + "Payments" + ], + "summary": "Payments - Session token", + "description": "Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.", + "operationId": "Create Session tokens for a Payment", + "parameters": [ + { + "name": "payment_id", + "in": "path", + "description": "The identifier for payment", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentsSessionRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Payment session object created or session token was retrieved from wallets", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentsSessionResponse" + } + } + } + }, + "400": { + "description": "Missing mandatory fields" + } + }, + "security": [ + { + "publishable_key": [] + } + ] + } + }, + "/v2/payments/{id}/payment_methods": { + "get": { + "tags": [ + "Payments" + ], + "summary": "Payment Methods - List", + "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", + "operationId": "Retrieve Payment methods for a Payment", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The global payment id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Get the payment methods", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodListResponseForPayments" + } + } + } + }, + "404": { + "description": "No payment found with the given id" + } + }, + "security": [ + { + "publishable_key": [] + } + ] + } + }, "/v2/payments/{id}/saved-payment-methods": { "get": { "tags": [ @@ -10100,7 +10141,8 @@ "required": [ "connector_type", "connector_name", - "profile_id" + "profile_id", + "payment_methods_enabled" ], "properties": { "connector_type": { @@ -10129,48 +10171,7 @@ "nullable": true }, "payment_methods_enabled": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PaymentMethodsEnabled" - }, - "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account", - "example": [ - { - "accepted_countries": { - "list": [ - "FR", - "DE", - "IN" - ], - "type": "disable_only" - }, - "accepted_currencies": { - "list": [ - "USD", - "EUR" - ], - "type": "enable_only" - }, - "installment_payment_enabled": true, - "maximum_amount": 68607706, - "minimum_amount": 1, - "payment_method": "wallet", - "payment_method_issuers": [ - "labore magna ipsum", - "aute" - ], - "payment_method_types": [ - "upi_collect", - "upi_intent" - ], - "payment_schemes": [ - "Discover", - "Discover" - ], - "recurring_enabled": true - } - ], - "nullable": true + "$ref": "#/components/schemas/PaymentMethodsEnabled" }, "connector_webhook_details": { "allOf": [ @@ -10313,6 +10314,7 @@ "connector_name", "id", "profile_id", + "payment_methods_enabled", "status" ], "properties": { @@ -10343,44 +10345,7 @@ "items": { "$ref": "#/components/schemas/PaymentMethodsEnabled" }, - "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account", - "example": [ - { - "accepted_countries": { - "list": [ - "FR", - "DE", - "IN" - ], - "type": "disable_only" - }, - "accepted_currencies": { - "list": [ - "USD", - "EUR" - ], - "type": "enable_only" - }, - "installment_payment_enabled": true, - "maximum_amount": 68607706, - "minimum_amount": 1, - "payment_method": "wallet", - "payment_method_issuers": [ - "labore magna ipsum", - "aute" - ], - "payment_method_types": [ - "upi_collect", - "upi_intent" - ], - "payment_schemes": [ - "Discover", - "Discover" - ], - "recurring_enabled": true - } - ], - "nullable": true + "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account" }, "disabled": { "type": "boolean", @@ -10424,6 +10389,7 @@ "connector_name", "id", "profile_id", + "payment_methods_enabled", "status" ], "properties": { @@ -10462,44 +10428,7 @@ "items": { "$ref": "#/components/schemas/PaymentMethodsEnabled" }, - "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account", - "example": [ - { - "accepted_countries": { - "list": [ - "FR", - "DE", - "IN" - ], - "type": "disable_only" - }, - "accepted_currencies": { - "list": [ - "USD", - "EUR" - ], - "type": "enable_only" - }, - "installment_payment_enabled": true, - "maximum_amount": 68607706, - "minimum_amount": 1, - "payment_method": "wallet", - "payment_method_issuers": [ - "labore magna ipsum", - "aute" - ], - "payment_method_types": [ - "upi_collect", - "upi_intent" - ], - "payment_schemes": [ - "Discover", - "Discover" - ], - "recurring_enabled": true - } - ], - "nullable": true + "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account" }, "connector_webhook_details": { "allOf": [ @@ -10597,42 +10526,6 @@ "$ref": "#/components/schemas/PaymentMethodsEnabled" }, "description": "An object containing the details about the payment methods that need to be enabled under this merchant connector account", - "example": [ - { - "accepted_countries": { - "list": [ - "FR", - "DE", - "IN" - ], - "type": "disable_only" - }, - "accepted_currencies": { - "list": [ - "USD", - "EUR" - ], - "type": "enable_only" - }, - "installment_payment_enabled": true, - "maximum_amount": 68607706, - "minimum_amount": 1, - "payment_method": "wallet", - "payment_method_issuers": [ - "labore magna ipsum", - "aute" - ], - "payment_method_types": [ - "upi_collect", - "upi_intent" - ], - "payment_schemes": [ - "Discover", - "Discover" - ], - "recurring_enabled": true - } - ], "nullable": true }, "connector_webhook_details": { @@ -13531,6 +13424,29 @@ } } }, + "PaymentMethodListResponseForPayments": { + "type": "object", + "required": [ + "payment_methods", + "customer_payment_methods" + ], + "properties": { + "payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ResponsePaymentMethodTypes" + }, + "description": "The list of payment methods that are enabled for the business profile" + }, + "customer_payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerPaymentMethod" + }, + "description": "The list of payment methods that are saved by the given customer\nThis field is only returned if the customer_id is provided in the request" + } + } + }, "PaymentMethodResponse": { "type": "object", "required": [ @@ -13778,10 +13694,7 @@ "items": { "$ref": "#/components/schemas/RequestPaymentMethodTypes" }, - "description": "Subtype of payment method", - "example": [ - "credit" - ], + "description": "Payment method configuration, this includes all the filters associated with the payment method", "nullable": true } }, @@ -18358,14 +18271,6 @@ "payment_method_subtype": { "$ref": "#/components/schemas/PaymentMethodType" }, - "payment_experience": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PaymentExperienceTypes" - }, - "description": "The list of payment experiences enabled, if applicable for a payment method type", - "nullable": true - }, "card_networks": { "type": "array", "items": { @@ -18382,25 +18287,9 @@ "description": "The list of banks enabled, if applicable for a payment method type", "nullable": true }, - "bank_debits": { - "allOf": [ - { - "$ref": "#/components/schemas/BankDebitTypes" - } - ], - "nullable": true - }, - "bank_transfers": { - "allOf": [ - { - "$ref": "#/components/schemas/BankTransferTypes" - } - ], - "nullable": true - }, "required_fields": { "type": "object", - "description": "Required fields for the payment_method_type.", + "description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors.", "additionalProperties": { "$ref": "#/components/schemas/RequiredFieldInfo" }, @@ -18413,11 +18302,6 @@ } ], "nullable": true - }, - "pm_auth_connector": { - "type": "string", - "description": "auth service connector label for this payment method type, if exists", - "nullable": true } } }, From 19ae04f0a2f15001189da649ae3b2b8e45aef3d0 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 11 Dec 2024 16:11:31 +0530 Subject: [PATCH 06/62] feat(payments_v2): add list_payment_methods to openapi --- crates/api_models/src/admin.rs | 120 +----------------- crates/api_models/src/events/payment.rs | 2 +- crates/api_models/src/payments.rs | 4 +- crates/openapi/src/openapi_v2.rs | 9 +- crates/openapi/src/routes/payments.rs | 22 +++- crates/router/src/core/admin.rs | 29 +++++ .../src/core/payments/payment_methods.rs | 4 +- 7 files changed, 65 insertions(+), 125 deletions(-) diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 97805a215395..38cbda9e8f5d 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -694,35 +694,7 @@ pub struct MerchantConnectorCreate { pub connector_account_details: Option, /// An object containing the details about the payment methods that need to be enabled under this merchant connector account - #[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 - } - ]))] + #[schema(value_type = PaymentMethodsEnabled)] pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector @@ -1058,35 +1030,7 @@ pub struct MerchantConnectorResponse { pub connector_account_details: pii::SecretSerdeValue, /// An object containing the details about the payment methods that need to be enabled under this merchant connector account - #[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 - } - ]))] + #[schema(value_type = Vec)] pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector @@ -1383,35 +1327,7 @@ pub struct MerchantConnectorListResponse { pub profile_id: id_type::ProfileId, /// An object containing the details about the payment methods that need to be enabled under this merchant connector account - #[schema(example = json!([ - { - "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 - } - ]))] + #[schema(value_type = Vec)] pub payment_methods_enabled: Option>, /// A boolean value to indicate if the connector is disabled. By default, its value is false. @@ -1570,35 +1486,7 @@ pub struct MerchantConnectorUpdate { pub connector_account_details: Option, /// An object containing the details about the payment methods that need to be enabled under this merchant connector account - #[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 - } - ]))] + #[schema(value_type = Option>)] pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index 1f96f306a1bb..808e9511142e 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -420,7 +420,7 @@ impl ApiEventMetric for PaymentStartRedirectionRequest { } #[cfg(feature = "v2")] -impl ApiEventMetric for payments::PaymentMethodListResponse { +impl ApiEventMetric for payments::PaymentMethodListResponseForPayments { // Payment id would be populated by the request fn get_api_event_type(&self) -> Option { None diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 4a36c640770c..979acccbec39 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6285,12 +6285,14 @@ pub struct PaymentMethodsListRequest {} #[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] -pub struct PaymentMethodListResponse { +pub struct PaymentMethodListResponseForPayments { /// The list of payment methods that are enabled for the business profile + #[schema(value_type = Vec)] pub payment_methods: Vec, /// The list of payment methods that are saved by the given customer /// This field is only returned if the customer_id is provided in the request + #[schema(value_type = Vec)] pub customer_payment_methods: Vec, } diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 2221055be5ab..896ab0017dc7 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -87,9 +87,6 @@ Never share your secret api keys. Keep them guarded and secure. routes::merchant_account::merchant_account_update, routes::merchant_account::profiles_list, - // Routes for payments - routes::payments::payments_connector_session, - // Routes for profile routes::profile::profile_create, routes::profile::profile_retrieve, @@ -126,6 +123,8 @@ Never share your secret api keys. Keep them guarded and secure. routes::payments::payments_get_intent, routes::payments::payments_confirm_intent, routes::payments::payment_status, + routes::payments::payments_connector_session, + routes::payments::list_payment_methods, //Routes for payment methods routes::payment_method::list_customer_payment_method_for_payment, @@ -157,6 +156,8 @@ Never share your secret api keys. Keep them guarded and secure. common_utils::payout_method_utils::PixBankTransferAdditionalData, common_utils::payout_method_utils::PaypalAdditionalData, common_utils::payout_method_utils::VenmoAdditionalData, + common_utils::types::PaymentMethodsEnabled, + api_models::payments::PaymentMethodListResponseForPayments, api_models::refunds::RefundRequest, api_models::refunds::RefundsCreateRequest, api_models::refunds::RefundErrorDetails, @@ -259,7 +260,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::FrmConfigs, api_models::admin::FrmPaymentMethod, api_models::admin::FrmPaymentMethodType, - api_models::admin::PaymentMethodsEnabled, + // api_models::admin::PaymentMethodsEnabled, api_models::admin::MerchantConnectorDetailsWrap, api_models::admin::MerchantConnectorDetails, api_models::admin::MerchantConnectorWebhookDetails, diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index 4c9d069a4586..dee3d8567a84 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -681,7 +681,7 @@ pub fn payments_get_intent() {} ), tag = "Payments", operation_id = "Confirm Payment Intent", - security(("publisable_key" = [])), + security(("publishable_key" = [])), )] #[cfg(feature = "v2")] pub fn payments_confirm_intent() {} @@ -715,3 +715,23 @@ pub(crate) enum ForceSync { /// Do not force sync with the connector / processor. Get the status which is available in the database False, } + +/// Payment Methods - List +/// +/// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment +#[utoipa::path( + get, + path = "/v2/payments/{id}/payment_methods", + params( + ("id" = String, Path, description = "The global payment id"), + ), + responses( + (status = 200, description = "Get the payment methods", body = PaymentMethodListResponseForPayments), + (status = 404, description = "No payment found with the given id") + ), + tag = "Payments", + operation_id = "Retrieve Payment methods for a Payment", + security(("publishable_key" = [])) +)] +#[cfg(feature = "v2")] +pub fn list_payment_methods() {} diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 29c9927867a8..060b9899f7bc 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -2570,6 +2570,35 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { } } +#[cfg(feature= "v1")] +struct PaymentMethodsEnabled<'a> { + payment_methods_enabled: &'a Option>, +} + +#[cfg(feature= "v1")] +impl PaymentMethodsEnabled<'_> { + fn get_payment_methods_enabled(&self) -> RouterResult>> { + let mut vec = Vec::new(); + let payment_methods_enabled = match self.payment_methods_enabled.clone() { + Some(val) => { + for pm in val.into_iter() { + let pm_value = pm + .encode_to_value() + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable( + "Failed while encoding to serde_json::Value, PaymentMethod", + )?; + vec.push(Secret::new(pm_value)) + } + Some(vec) + } + None => None, + }; + Ok(payment_methods_enabled) + } +} + + #[cfg(all(feature = "v1", feature = "olap"))] #[async_trait::async_trait] impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index ba924314d1c8..2da6d27a39d9 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -19,7 +19,7 @@ pub async fn list_payment_methods( payment_id: id_type::GlobalPaymentId, _req: api_models::payments::PaymentMethodsListRequest, header_payload: &hyperswitch_domain_models::payments::HeaderPayload, -) -> errors::RouterResponse { +) -> errors::RouterResponse { let db = &*state.store; let key_manager_state = &(&state).into(); @@ -214,7 +214,7 @@ impl PaymentMethodsEnabled { PaymentMethodsEnabledForConnector { payment_methods_enabled: request_payment_methods, connector: connector_name.clone(), - payment_method: payment_method.clone(), + payment_method: payment_method, } }, ) From f8956082f0cea16423e068c552cd679ecef5635f Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:50 +0000 Subject: [PATCH 07/62] chore: run formatter --- crates/api_models/src/admin.rs | 2 +- crates/api_models/src/payments.rs | 5 ++--- crates/router/src/core/admin.rs | 5 ++--- crates/router/src/core/payments/payment_methods.rs | 5 +++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 38cbda9e8f5d..7845979aaf97 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1486,7 +1486,7 @@ pub struct MerchantConnectorUpdate { pub connector_account_details: Option, /// An object containing the details about the payment methods that need to be enabled under this merchant connector account - #[schema(value_type = Option>)] + #[schema(value_type = Option>)] pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 979acccbec39..5e6cc8023e6d 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -27,6 +27,8 @@ use time::{Date, PrimitiveDateTime}; use url::Url; use utoipa::ToSchema; +#[cfg(feature = "v2")] +use crate::payment_methods; use crate::{ admin::{self, MerchantConnectorInfo}, disputes, enums as api_enums, @@ -35,9 +37,6 @@ use crate::{ refunds, }; -#[cfg(feature = "v2")] -use crate::payment_methods; - #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum PaymentOp { Create, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 060b9899f7bc..36941babdb78 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -2570,12 +2570,12 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { } } -#[cfg(feature= "v1")] +#[cfg(feature = "v1")] struct PaymentMethodsEnabled<'a> { payment_methods_enabled: &'a Option>, } -#[cfg(feature= "v1")] +#[cfg(feature = "v1")] impl PaymentMethodsEnabled<'_> { fn get_payment_methods_enabled(&self) -> RouterResult>> { let mut vec = Vec::new(); @@ -2598,7 +2598,6 @@ impl PaymentMethodsEnabled<'_> { } } - #[cfg(all(feature = "v1", feature = "olap"))] #[async_trait::async_trait] impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 2da6d27a39d9..4d0269b9d1c1 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -1,11 +1,12 @@ //! Contains functions of payment methods that are used in payments //! one of such functions is `list_payment_methods` -use super::errors; -use crate::{db::errors::StorageErrorExt, routes, types::domain}; use common_utils::{ext_traits::OptionExt, id_type}; use error_stack::ResultExt; +use super::errors; +use crate::{db::errors::StorageErrorExt, routes, types::domain}; + #[cfg(all( feature = "v2", feature = "customer_v2", From 1096cbe500851f7270995fc6379f767d5e9089f6 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 11 Dec 2024 21:28:05 +0530 Subject: [PATCH 08/62] chore: add doc comments --- api-reference-v2/openapi_spec.json | 9 +++-- crates/api_models/src/admin.rs | 1 + crates/api_models/src/payments.rs | 2 +- crates/openapi/src/routes/payments.rs | 2 +- crates/router/src/core/admin.rs | 4 ++- .../src/core/payments/payment_methods.rs | 36 ++++++++++++------- 6 files changed, 33 insertions(+), 21 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index b7ce7b7878b5..d859f50b8acf 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -2022,7 +2022,7 @@ "tags": [ "Payments" ], - "summary": "Payment Methods - List", + "summary": "Payments - Payment Methods List", "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", "operationId": "Retrieve Payment methods for a Payment", "parameters": [ @@ -13427,11 +13427,11 @@ "PaymentMethodListResponseForPayments": { "type": "object", "required": [ - "payment_methods", + "payment_methods_enabled", "customer_payment_methods" ], "properties": { - "payment_methods": { + "payment_methods_enabled": { "type": "array", "items": { "$ref": "#/components/schemas/ResponsePaymentMethodTypes" @@ -17155,8 +17155,7 @@ "ProfileCreate": { "type": "object", "required": [ - "profile_name", - "is_click_to_pay_enabled" + "profile_name" ], "properties": { "profile_name": { diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 7845979aaf97..b1fdb31a9464 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1971,6 +1971,7 @@ pub struct ProfileCreate { /// Indicates if click to pay is enabled or not. #[schema(default = false, example = false)] + #[serde(default)] pub is_click_to_pay_enabled: bool, } diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 5e6cc8023e6d..ddc739f8667f 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6287,7 +6287,7 @@ pub struct PaymentMethodsListRequest {} pub struct PaymentMethodListResponseForPayments { /// The list of payment methods that are enabled for the business profile #[schema(value_type = Vec)] - pub payment_methods: Vec, + pub payment_methods_enabled: Vec, /// The list of payment methods that are saved by the given customer /// This field is only returned if the customer_id is provided in the request diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index dee3d8567a84..b119c970a131 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -716,7 +716,7 @@ pub(crate) enum ForceSync { False, } -/// Payment Methods - List +/// Payments - Payment Methods List /// /// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment #[utoipa::path( diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 36941babdb78..b2ca22378992 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -1698,7 +1698,8 @@ impl ConnectorStatusAndDisabledValidation<'_> { } (Some(disabled), _) => Some(*disabled), (None, common_enums::ConnectorStatus::Inactive) => Some(true), - (None, _) => None, + // Enable the connector if nothing is passed in the request + (None, _) => Some(false), }; Ok((*connector_status, disabled)) @@ -2450,6 +2451,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { }; let (connector_status, disabled) = connector_status_and_disabled_validation.validate_status_and_disabled()?; + let identifier = km_types::Identifier::Merchant(business_profile.merchant_id.clone()); let merchant_recipient_data = if let Some(data) = &self.additional_merchant_data { Some( diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 4d0269b9d1c1..424f9dc8c279 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -68,20 +68,16 @@ pub async fn list_payment_methods( )) } +/// Holds the payment methods enabled for a connector along with the connector name +/// This struct is a flattened representation of the payment methods enabled for a connector +#[derive(Debug)] struct PaymentMethodsEnabledForConnector { payment_methods_enabled: common_utils::types::RequestPaymentMethodTypes, payment_method: common_enums::PaymentMethod, connector: String, } -struct PaymentMethodsEnabled { - payment_methods_enabled: Vec, -} - -struct FilteredPaymentMethodsEnabled { - payment_methods_enabled: Vec, -} - +/// Container for the inputs required for the required fields struct RequiredFieldsInput {} impl RequiredFieldsInput { @@ -90,10 +86,15 @@ impl RequiredFieldsInput { } } +/// Container for the filtered payment methods +struct FilteredPaymentMethodsEnabled { + payment_methods_enabled: Vec, +} + impl FilteredPaymentMethodsEnabled { fn get_required_fields( self, - input: RequiredFieldsInput, + _input: RequiredFieldsInput, ) -> PaymentMethodsEnabledWithRequiredFieldsContainer { let required_fields_info = self .payment_methods_enabled @@ -114,16 +115,19 @@ impl FilteredPaymentMethodsEnabled { } } +/// Element container to hold the filtered payment methods with required fields struct PaymentMethodsEnabledWithRequiredFields { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, } +/// Container to hold the filtered payment methods enabled with required fields struct PaymentMethodsEnabledWithRequiredFieldsContainer { payment_methods_enabled: Vec, } +/// Element Container to hold the filtered payment methods enabled with required fields and surcharge struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { required_field: Option>, @@ -131,12 +135,13 @@ struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { surcharge: Option, } +/// Container to hold the filtered payment methods enabled with required fields and surcharge struct PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { payment_methods_enabled: Vec, } impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { - fn generate_response(self) -> api_models::payments::PaymentMethodListResponse { + fn generate_response(self) -> api_models::payments::PaymentMethodListResponseForPayments { let response_payment_methods = self .payment_methods_enabled .into_iter() @@ -151,8 +156,8 @@ impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { }) .collect(); - api_models::payments::PaymentMethodListResponse { - payment_methods: response_payment_methods, + api_models::payments::PaymentMethodListResponseForPayments { + payment_methods_enabled: response_payment_methods, customer_payment_methods: Vec::new(), } } @@ -180,6 +185,11 @@ impl PaymentMethodsEnabledWithRequiredFieldsContainer { } } +/// Holds the payment methods enabled for a connector +struct PaymentMethodsEnabled { + payment_methods_enabled: Vec, +} + impl PaymentMethodsEnabled { /// This functions flattens the payment methods enabled from the connector accounts /// Retains the connector name and payment method in every flattened element @@ -215,7 +225,7 @@ impl PaymentMethodsEnabled { PaymentMethodsEnabledForConnector { payment_methods_enabled: request_payment_methods, connector: connector_name.clone(), - payment_method: payment_method, + payment_method, } }, ) From b6ab7d2c942a2e7f77b86fb1f20c91def2ea0462 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 12 Dec 2024 17:18:52 +0530 Subject: [PATCH 09/62] refactor: address PR comments --- crates/api_models/src/payment_methods.rs | 6 +- crates/common_utils/src/types.rs | 9 ++- .../src/merchant_connector_account.rs | 63 ++++++++++++++- crates/router/src/core/admin.rs | 4 +- .../router/src/core/payment_methods/cards.rs | 13 ---- .../src/core/payments/payment_methods.rs | 76 +++++-------------- 6 files changed, 94 insertions(+), 77 deletions(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index bcba44c6f828..0b228a64342d 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1242,7 +1242,11 @@ pub struct ResponsePaymentMethodTypes { pub struct ResponsePaymentMethodTypes { /// The payment method type enabled #[schema(example = "klarna", value_type = PaymentMethodType)] - pub payment_method_subtype: api_enums::PaymentMethodType, + pub payment_method_type: common_enums::PaymentMethod, + + /// The payment method subtype enabled + #[schema(example = "klarna", value_type = PaymentMethodType)] + pub payment_method_subtype: common_enums::PaymentMethodType, /// The list of card networks enabled, if applicable for a payment method type pub card_networks: Option>, diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 16b745702eb0..7f7621581667 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -1580,6 +1580,7 @@ where } } +#[cfg(feature = "v2")] /// Details of all the payment methods enabled for the connector for the given merchant account #[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)] #[serde(deny_unknown_fields)] @@ -1587,10 +1588,10 @@ where pub struct PaymentMethodsEnabled { /// Type of payment method. #[schema(value_type = PaymentMethod,example = "card")] - pub payment_method: common_enums::PaymentMethod, + pub payment_method_type: common_enums::PaymentMethod, /// Payment method configuration, this includes all the filters associated with the payment method - pub payment_method_types: Option>, + pub payment_method_subtypes: Option>, } /// Details of a specific payment method subtype enabled for the connector for the given merchant account @@ -1598,7 +1599,7 @@ pub struct PaymentMethodsEnabled { pub struct RequestPaymentMethodTypes { /// The payment method subtype #[schema(value_type = PaymentMethodType)] - pub payment_method_type: common_enums::PaymentMethodType, + pub payment_method_subtype: common_enums::PaymentMethodType, /// The payment experience for the payment method #[schema(value_type = Option)] @@ -1685,6 +1686,7 @@ pub enum AcceptedCurrencies { AllAccepted, } +#[cfg(feature = "v2")] impl Queryable for PaymentMethodsEnabled where DB: Backend, @@ -1697,4 +1699,5 @@ where } } +#[cfg(feature = "v2")] crate::impl_to_sql_from_sql_json!(PaymentMethodsEnabled); diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index 5269a8044ecf..b717e9c55e06 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -119,6 +119,65 @@ impl MerchantConnectorAccount { } } +/// Holds the payment methods enabled for a connector along with the connector name +/// This struct is a flattened representation of the payment methods enabled for a connector +#[derive(Debug)] +pub struct PaymentMethodsEnabledForConnector { + pub payment_methods_enabled: common_utils::types::RequestPaymentMethodTypes, + pub payment_method: common_enums::PaymentMethod, + pub connector: String, +} + +/// Holds the payment methods enabled for a connector +pub struct FlattenedPaymentMethodsEnabled { + pub payment_methods_enabled: Vec, +} + +impl FlattenedPaymentMethodsEnabled { + /// This functions flattens the payment methods enabled from the connector accounts + /// Retains the connector name and payment method in every flattened element + pub fn from_payment_connectors_list(payment_connectors: Vec) -> Self { + let payment_methods_enabled_flattened_with_connector = payment_connectors + .into_iter() + .map(|connector| { + ( + connector.payment_methods_enabled.unwrap_or_default(), + connector.connector_name, + ) + }) + .flat_map(|(payment_method_enabled, connector_name)| { + payment_method_enabled + .into_iter() + .flat_map(move |payment_method| { + let request_payment_methods_enabled = + payment_method.payment_method_subtypes.unwrap_or_default(); + let length = request_payment_methods_enabled.len(); + request_payment_methods_enabled.into_iter().zip( + std::iter::repeat(( + connector_name.clone(), + payment_method.payment_method_type, + )) + .take(length), + ) + }) + }) + .map( + |(request_payment_methods, (connector_name, payment_method))| { + PaymentMethodsEnabledForConnector { + payment_methods_enabled: request_payment_methods, + connector: connector_name.clone(), + payment_method, + } + }, + ) + .collect(); + + Self { + payment_methods_enabled: payment_methods_enabled_flattened_with_connector, + } + } +} + #[cfg(feature = "v1")] #[derive(Debug)] pub enum MerchantConnectorAccountUpdate { @@ -558,12 +617,12 @@ common_utils::create_list_wrapper!( .payment_methods_enabled.as_ref() .unwrap_or(&Vec::default()) .iter() - .flat_map(|payment_method_types| payment_method_types.payment_method_types.as_ref().unwrap_or(&ref_vector)) + .flat_map(|payment_method_types| payment_method_types.payment_method_subtypes.as_ref().unwrap_or(&ref_vector)) .filter(|payment_method_types_enabled| { payment_method_types_enabled.payment_experience == Some(api_models::enums::PaymentExperience::InvokeSdkClient) }) .map(|payment_method_types| { - (connector_account, payment_method_types.payment_method_type) + (connector_account, payment_method_types.payment_method_subtype) }) .collect::>() }).collect(); diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 7d9113576536..42c61c67019c 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -2088,10 +2088,10 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect key_manager_state: &KeyManagerState, merchant_account: &domain::MerchantAccount, ) -> RouterResult { - let payment_methods_enabled = self.payment_methods_enabled.clone(); - let frm_configs = self.get_frm_config_as_secret(); + let payment_methods_enabled = self.payment_methods_enabled; + let auth = types::ConnectorAuthType::from_secret_value( self.connector_account_details .clone() diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index b974e643fb6c..62a7df4d1462 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3188,19 +3188,6 @@ fn get_val(str: String, val: &serde_json::Value) -> Option { .and_then(|v| v.as_str()) .map(|s| s.to_string()) } -#[cfg(all( - feature = "v2", - feature = "customer_v2", - feature = "payment_methods_v2" -))] -pub async fn list_payment_methods( - _state: routes::SessionState, - _merchant_account: domain::MerchantAccount, - _key_store: domain::MerchantKeyStore, - mut _req: api::PaymentMethodListRequest, -) -> errors::RouterResponse { - todo!() -} #[cfg(all( any(feature = "v1", feature = "v2"), diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 424f9dc8c279..e2cbe47543f2 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -57,11 +57,12 @@ pub async fn list_payment_methods( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("error when fetching merchant connector accounts")?; - let response = PaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts) - .perform_filtering() - .get_required_fields(RequiredFieldsInput::new()) - .perform_surcharge_calculation() - .generate_response(); + let response = + hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts) + .perform_filtering() + .get_required_fields(RequiredFieldsInput::new()) + .perform_surcharge_calculation() + .generate_response(); Ok(hyperswitch_domain_models::api::ApplicationResponse::Json( response, @@ -88,7 +89,9 @@ impl RequiredFieldsInput { /// Container for the filtered payment methods struct FilteredPaymentMethodsEnabled { - payment_methods_enabled: Vec, + payment_methods_enabled: Vec< + hyperswitch_domain_models::merchant_connector_account::PaymentMethodsEnabledForConnector, + >, } impl FilteredPaymentMethodsEnabled { @@ -102,9 +105,10 @@ impl FilteredPaymentMethodsEnabled { .map( |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFields { required_field: None, + payment_method_type: payment_methods_enabled.payment_method, payment_method_subtype: payment_methods_enabled .payment_methods_enabled - .payment_method_type, + .payment_method_subtype, }, ) .collect(); @@ -120,6 +124,7 @@ struct PaymentMethodsEnabledWithRequiredFields { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, + payment_method_type: common_enums::PaymentMethod, } /// Container to hold the filtered payment methods enabled with required fields @@ -132,6 +137,7 @@ struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, + payment_method_type: common_enums::PaymentMethod, surcharge: Option, } @@ -147,6 +153,7 @@ impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { .into_iter() .map(|payment_methods_enabled| { api_models::payment_methods::ResponsePaymentMethodTypes { + payment_method_type: payment_methods_enabled.payment_method_type, payment_method_subtype: payment_methods_enabled.payment_method_subtype, required_fields: payment_methods_enabled.required_field, surcharge_details: payment_methods_enabled.surcharge, @@ -172,6 +179,7 @@ impl PaymentMethodsEnabledWithRequiredFieldsContainer { .into_iter() .map( |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { + payment_method_type: payment_methods_enabled.payment_method_type, required_field: payment_methods_enabled.required_field, payment_method_subtype: payment_methods_enabled.payment_method_subtype, surcharge: None, @@ -185,57 +193,13 @@ impl PaymentMethodsEnabledWithRequiredFieldsContainer { } } -/// Holds the payment methods enabled for a connector -struct PaymentMethodsEnabled { - payment_methods_enabled: Vec, +trait PerformFilteringOnPaymentMethodsEnabled { + fn perform_filtering(self) -> FilteredPaymentMethodsEnabled; } -impl PaymentMethodsEnabled { - /// This functions flattens the payment methods enabled from the connector accounts - /// Retains the connector name and payment method in every flattened element - fn from_payment_connectors_list( - payment_connectors: Vec, - ) -> Self { - let payment_methods_enabled_flattened_with_connector = payment_connectors - .into_iter() - .map(|connector| { - ( - connector.payment_methods_enabled.unwrap_or_default(), - connector.connector_name, - ) - }) - .flat_map(|(payment_method_enabled, connector_name)| { - payment_method_enabled - .into_iter() - .flat_map(move |payment_method| { - let request_payment_methods_enabled = - payment_method.payment_method_types.unwrap_or_default(); - let length = request_payment_methods_enabled.len(); - request_payment_methods_enabled.into_iter().zip( - std::iter::repeat(( - connector_name.clone(), - payment_method.payment_method, - )) - .take(length), - ) - }) - }) - .map( - |(request_payment_methods, (connector_name, payment_method))| { - PaymentMethodsEnabledForConnector { - payment_methods_enabled: request_payment_methods, - connector: connector_name.clone(), - payment_method, - } - }, - ) - .collect(); - - Self { - payment_methods_enabled: payment_methods_enabled_flattened_with_connector, - } - } - +impl PerformFilteringOnPaymentMethodsEnabled + for hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled +{ fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { FilteredPaymentMethodsEnabled { payment_methods_enabled: self.payment_methods_enabled, From 6a2c2c18ef65615d859f1afe88d978b7080f5443 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 12 Dec 2024 17:19:02 +0530 Subject: [PATCH 10/62] Revert "chore: add comments with improvements to be made in merchant payment methods list" This reverts commit 70cb8a1b712516b5b6a0490277ab2f7feab213ea. --- .../router/src/core/payment_methods/cards.rs | 40 +------------------ 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 62a7df4d1462..935843d97350 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3203,9 +3203,6 @@ pub async fn list_payment_methods( let db = &*state.store; let pm_config_mapping = &state.conf.pm_filters; let key_manager_state = &(&state).into(); - - // Auth is possibly incorrect, why is it happening in core? - // Keep it as is for now let payment_intent = if let Some(cs) = &req.client_secret { if cs.starts_with("pm_") { validate_payment_method_and_client_secret( @@ -3230,7 +3227,6 @@ pub async fn list_payment_methods( None }; - // Shipping, billing address is needed for filtering based on country, currency, etc. let shipping_address = payment_intent .as_ref() .async_map(|pi| async { @@ -3265,7 +3261,6 @@ pub async fn list_payment_methods( .transpose()? .flatten(); - // This is needed for customer PML let customer = payment_intent .as_ref() .async_and_then(|pi| async { @@ -3309,8 +3304,6 @@ pub async fn list_payment_methods( || setup_future_usage .map(|future_usage| future_usage == common_enums::FutureUsage::OffSession) .unwrap_or(false); - - // This is most probably deprecated, can be inferred from path(?) let payment_type = payment_attempt.as_ref().map(|pa| { let amount = api::Amount::from(pa.net_amount.get_order_amount()); let mandate_type = if pa.mandate_id.is_some() { @@ -3324,7 +3317,6 @@ pub async fn list_payment_methods( helpers::infer_payment_type(amount, mandate_type.as_ref()) }); - // Include profile context, remove merchant ID let all_mcas = db .find_merchant_connector_account_by_merchant_id_and_disabled_list( key_manager_state, @@ -3372,9 +3364,6 @@ pub async fn list_payment_methods( logger::debug!(mca_before_filtering=?filtered_mcas); let mut response: Vec = vec![]; - - // Should be deprecated, use get intent API - // Also, update it to be an impl method on some type // Key creation for storing PM_FILTER_CGRAPH let key = { format!( @@ -3383,7 +3372,7 @@ pub async fn list_payment_methods( profile_id.get_string_repr() ) }; - // Find graph in cache or create it. Then call filter PM outside, which is common to both. + if let Some(graph) = get_merchant_pm_filter_graph(&state, &key).await { // Derivation of PM_FILTER_CGRAPH from MokaCache successful for mca in &filtered_mcas { @@ -3391,8 +3380,6 @@ pub async fn list_payment_methods( Some(pm) => pm, None => continue, }; - // This can be written in the form of try_fold - // Can do some simpler filters before, the cheaper ones that don't need CGraph filter_payment_methods( &graph, mca.get_id(), @@ -3469,17 +3456,13 @@ pub async fn list_payment_methods( ); // Filter out wallet payment method from mca if customer has already saved it - // Can merge customer PML here customer .as_ref() - // Why big block using customer as parameter? - // Just get customer PMs, then do stuff. .async_map(|customer| async { let wallet_pm_exists = response .iter() .any(|mca| mca.payment_method == enums::PaymentMethod::Wallet); if wallet_pm_exists { - // Are we doing the same query in customer PML? match db .find_payment_method_by_customer_id_merchant_id_list( &((&state).into()), @@ -3489,7 +3472,6 @@ pub async fn list_payment_methods( None, ) .await - // Move above DB query to DB layer, then do other stuff { Ok(customer_payment_methods) => { let customer_wallet_pm = customer_payment_methods @@ -3531,7 +3513,6 @@ pub async fn list_payment_methods( HashMap, > = HashMap::new(); - // Ignore session flow routing in merchant PML if let Some((payment_attempt, payment_intent)) = payment_attempt.as_ref().zip(payment_intent.as_ref()) { @@ -3767,8 +3748,6 @@ pub async fn list_payment_methods( .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; } - // For country filter, take PMs, accept country, return filtered PMs - // Check for `use_billing_as_payment_method_billing` config under business_profile // If this is disabled, then the billing details in required fields will be empty and have to be collected by the customer let billing_address_for_calculating_required_fields = business_profile @@ -3778,7 +3757,6 @@ pub async fn list_payment_methods( .then_some(billing_address.as_ref()) .flatten(); - // Make new module for dynamic fields, take required stuff as input, do not leak dynamic field related stuff in PM flow let req = api_models::payments::PaymentsRequest::foreign_try_from(( payment_attempt.as_ref(), payment_intent.as_ref(), @@ -3790,7 +3768,6 @@ pub async fn list_payment_methods( let req_val = serde_json::to_value(req).ok(); logger::debug!(filtered_payment_methods=?response); - // IIRC someone said if payment experience is none, the others won't be populated or something let mut payment_experiences_consolidated_hm: HashMap< api_enums::PaymentMethod, HashMap>>, @@ -3882,7 +3859,6 @@ pub async fn list_payment_methods( }, ); - // Can possibly use HM.entry().or_insert() (or_insert_with()) if let Some(payment_experience) = element.payment_experience { if let Some(payment_method_hm) = payment_experiences_consolidated_hm.get_mut(&payment_method) @@ -4004,7 +3980,6 @@ pub async fn list_payment_methods( }) } - // How do we wanna restructure `ResponsePaymentMethodTypes`? payment_method_types.push(ResponsePaymentMethodTypes { payment_method_type: *payment_method_types_hm.0, payment_experience: Some(payment_experience_types), @@ -4184,8 +4159,6 @@ pub async fn list_payment_methods( .as_ref() .and_then(|intent| intent.request_external_three_ds_authentication) .unwrap_or(false); - - // What to do about surcharge? let merchant_surcharge_configs = if let Some((payment_attempt, payment_intent, business_profile)) = payment_attempt .as_ref() @@ -4244,7 +4217,6 @@ pub async fn list_payment_methods( merchant_name: merchant_account.merchant_name, payment_type, payment_methods: payment_method_responses, - // What should we do about this field? Not required mandate_payment: payment_attempt.and_then(|inner| inner.mandate_details).map( |d| match d { hyperswitch_domain_models::mandates::MandateDataType::SingleUse(i) => { @@ -4473,7 +4445,6 @@ pub async fn call_surcharge_decision_management_for_saved_card( Ok(()) } -// Need not be async at all #[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") @@ -4492,14 +4463,12 @@ pub async fn filter_payment_methods( saved_payment_methods: &settings::EligiblePaymentMethods, ) -> errors::CustomResult<(), errors::ApiErrorResponse> { for payment_method in payment_methods.iter() { - // Create a wrapper struct PMs(Vec), iter, map, deserialize, log in case of deserialization errors, possibly have metrics about failures, return list of successful PMs let parse_result = serde_json::from_value::( payment_method.clone().expose().clone(), ); if let Ok(payment_methods_enabled) = parse_result { let payment_method = payment_methods_enabled.payment_method; - // Can move this outside for loop, or even pass it to function, to avoid repeated deserialization let allowed_payment_method_types = payment_intent.and_then(|payment_intent| { payment_intent .allowed_payment_method_types @@ -4515,8 +4484,6 @@ pub async fn filter_payment_methods( }) }); - // Use iteration, fold etc. - // Use impl based stuff instead of hanging functions for payment_method_type_info in payment_methods_enabled .payment_method_types .unwrap_or_default() @@ -4570,13 +4537,11 @@ pub async fn filter_payment_methods( ))); }; - // Can use HashSet instead of Vec let filter_pm_based_on_allowed_types = filter_pm_based_on_allowed_types( allowed_payment_method_types.as_ref(), payment_method_object.payment_method_type, ); - // Ignore mandate related stuff (this and next block), ensure normal payments (non-mandate stuff) are not affected in any manner if payment_attempt .and_then(|attempt| attempt.mandate_details.as_ref()) .is_some() @@ -4627,14 +4592,12 @@ pub async fn filter_payment_methods( context_values.push(dir::DirValue::CaptureMethod(capture_method)); }); - // Remove this part, deprecate `card_networks` field in `PaymentMethodListRequest` let filter_pm_card_network_based = filter_pm_card_network_based( payment_method_object.card_networks.as_ref(), req.card_networks.as_ref(), payment_method_object.payment_method_type, ); - // Check with the team, do not include if this part is only needed for PM management let saved_payment_methods_filter = req .client_secret .as_ref() @@ -4677,7 +4640,6 @@ pub async fn filter_payment_methods( mca_id.get_string_repr().to_string(), payment_method, ); - // Don't mutate, iterate, return values resp.push(response_pm_type); } else { logger::error!("Filtering Payment Methods Failed"); From fac85212489396c77c231dbb785826cc8c667bf2 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:52:29 +0000 Subject: [PATCH 11/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 7674301a6cb3..4e8fca958309 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -13843,13 +13843,13 @@ "type": "object", "description": "Details of all the payment methods enabled for the connector for the given merchant account", "required": [ - "payment_method" + "payment_method_type" ], "properties": { - "payment_method": { + "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" }, - "payment_method_types": { + "payment_method_subtypes": { "type": "array", "items": { "$ref": "#/components/schemas/RequestPaymentMethodTypes" @@ -18594,9 +18594,13 @@ "ResponsePaymentMethodTypes": { "type": "object", "required": [ + "payment_method_type", "payment_method_subtype" ], "properties": { + "payment_method_type": { + "$ref": "#/components/schemas/PaymentMethodType" + }, "payment_method_subtype": { "$ref": "#/components/schemas/PaymentMethodType" }, From 65f811371bbcb40153ffb03c18f1e4dbd717e2c0 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 12 Dec 2024 19:01:02 +0530 Subject: [PATCH 12/62] chore: cargo clippy --- .../src/merchant_connector_account.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index b717e9c55e06..ffd01690f780 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -119,6 +119,7 @@ impl MerchantConnectorAccount { } } +#[cfg(feature = "v2")] /// Holds the payment methods enabled for a connector along with the connector name /// This struct is a flattened representation of the payment methods enabled for a connector #[derive(Debug)] @@ -128,11 +129,13 @@ pub struct PaymentMethodsEnabledForConnector { pub connector: String, } +#[cfg(feature = "v2")] /// Holds the payment methods enabled for a connector pub struct FlattenedPaymentMethodsEnabled { pub payment_methods_enabled: Vec, } +#[cfg(feature = "v2")] impl FlattenedPaymentMethodsEnabled { /// This functions flattens the payment methods enabled from the connector accounts /// Retains the connector name and payment method in every flattened element From 593df4db2473fd14fb8c242b8315f6b8c9d47c63 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Mon, 16 Dec 2024 11:46:55 +0530 Subject: [PATCH 13/62] chore: rename fields --- .../src/core/payments/payment_methods.rs | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index e2cbe47543f2..ebe0d277e5f6 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -69,15 +69,6 @@ pub async fn list_payment_methods( )) } -/// Holds the payment methods enabled for a connector along with the connector name -/// This struct is a flattened representation of the payment methods enabled for a connector -#[derive(Debug)] -struct PaymentMethodsEnabledForConnector { - payment_methods_enabled: common_utils::types::RequestPaymentMethodTypes, - payment_method: common_enums::PaymentMethod, - connector: String, -} - /// Container for the inputs required for the required fields struct RequiredFieldsInput {} @@ -98,12 +89,12 @@ impl FilteredPaymentMethodsEnabled { fn get_required_fields( self, _input: RequiredFieldsInput, - ) -> PaymentMethodsEnabledWithRequiredFieldsContainer { + ) -> PaymentMethodTypesEnabledWithRequiredFieldsContainer { let required_fields_info = self .payment_methods_enabled .into_iter() .map( - |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFields { + |payment_methods_enabled| PaymentMethodTypesEnabledWithRequiredFieldsElement { required_field: None, payment_method_type: payment_methods_enabled.payment_method, payment_method_subtype: payment_methods_enabled @@ -113,14 +104,14 @@ impl FilteredPaymentMethodsEnabled { ) .collect(); - PaymentMethodsEnabledWithRequiredFieldsContainer { + PaymentMethodTypesEnabledWithRequiredFieldsContainer { payment_methods_enabled: required_fields_info, } } } /// Element container to hold the filtered payment methods with required fields -struct PaymentMethodsEnabledWithRequiredFields { +struct PaymentMethodTypesEnabledWithRequiredFieldsElement { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, @@ -128,12 +119,12 @@ struct PaymentMethodsEnabledWithRequiredFields { } /// Container to hold the filtered payment methods enabled with required fields -struct PaymentMethodsEnabledWithRequiredFieldsContainer { - payment_methods_enabled: Vec, +struct PaymentMethodTypesEnabledWithRequiredFieldsContainer { + payment_methods_enabled: Vec, } /// Element Container to hold the filtered payment methods enabled with required fields and surcharge -struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { +struct PaymentMethodTypessEnabledWithRequiredFieldsAndSurcharge { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, @@ -143,7 +134,7 @@ struct PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { /// Container to hold the filtered payment methods enabled with required fields and surcharge struct PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { - payment_methods_enabled: Vec, + payment_methods_enabled: Vec, } impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { @@ -170,21 +161,21 @@ impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { } } -impl PaymentMethodsEnabledWithRequiredFieldsContainer { +impl PaymentMethodTypesEnabledWithRequiredFieldsContainer { fn perform_surcharge_calculation( self, ) -> PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { let details_with_surcharge = self .payment_methods_enabled .into_iter() - .map( - |payment_methods_enabled| PaymentMethodsEnabledWithRequiredFieldsAndSurcharge { + .map(|payment_methods_enabled| { + PaymentMethodTypessEnabledWithRequiredFieldsAndSurcharge { payment_method_type: payment_methods_enabled.payment_method_type, required_field: payment_methods_enabled.required_field, payment_method_subtype: payment_methods_enabled.payment_method_subtype, surcharge: None, - }, - ) + } + }) .collect(); PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { From 6938d61ef9338b6ddc773d597fbec588a09a36d8 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Mon, 16 Dec 2024 15:23:26 +0530 Subject: [PATCH 14/62] chore: rename fields --- .../src/core/payments/payment_methods.rs | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index ebe0d277e5f6..5f6cefc69fc1 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -79,22 +79,20 @@ impl RequiredFieldsInput { } /// Container for the filtered payment methods -struct FilteredPaymentMethodsEnabled { - payment_methods_enabled: Vec< - hyperswitch_domain_models::merchant_connector_account::PaymentMethodsEnabledForConnector, - >, -} +struct FilteredPaymentMethodsEnabled( + Vec, +); impl FilteredPaymentMethodsEnabled { fn get_required_fields( self, _input: RequiredFieldsInput, - ) -> PaymentMethodTypesEnabledWithRequiredFieldsContainer { + ) -> RequiredFieldsForEnabledPaymentMethodTypes { let required_fields_info = self - .payment_methods_enabled + .0 .into_iter() .map( - |payment_methods_enabled| PaymentMethodTypesEnabledWithRequiredFieldsElement { + |payment_methods_enabled| RequiredFieldsForEnabledPaymentMethod { required_field: None, payment_method_type: payment_methods_enabled.payment_method, payment_method_subtype: payment_methods_enabled @@ -104,14 +102,12 @@ impl FilteredPaymentMethodsEnabled { ) .collect(); - PaymentMethodTypesEnabledWithRequiredFieldsContainer { - payment_methods_enabled: required_fields_info, - } + RequiredFieldsForEnabledPaymentMethodTypes(required_fields_info) } } /// Element container to hold the filtered payment methods with required fields -struct PaymentMethodTypesEnabledWithRequiredFieldsElement { +struct RequiredFieldsForEnabledPaymentMethod { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, @@ -119,12 +115,10 @@ struct PaymentMethodTypesEnabledWithRequiredFieldsElement { } /// Container to hold the filtered payment methods enabled with required fields -struct PaymentMethodTypesEnabledWithRequiredFieldsContainer { - payment_methods_enabled: Vec, -} +struct RequiredFieldsForEnabledPaymentMethodTypes(Vec); /// Element Container to hold the filtered payment methods enabled with required fields and surcharge -struct PaymentMethodTypessEnabledWithRequiredFieldsAndSurcharge { +struct RequiredFieldsAndSurchargeForEnabledPaymentMethodType { required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, @@ -133,14 +127,14 @@ struct PaymentMethodTypessEnabledWithRequiredFieldsAndSurcharge { } /// Container to hold the filtered payment methods enabled with required fields and surcharge -struct PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { - payment_methods_enabled: Vec, -} +struct RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes( + Vec, +); -impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { +impl RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes { fn generate_response(self) -> api_models::payments::PaymentMethodListResponseForPayments { let response_payment_methods = self - .payment_methods_enabled + .0 .into_iter() .map(|payment_methods_enabled| { api_models::payment_methods::ResponsePaymentMethodTypes { @@ -161,26 +155,24 @@ impl PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { } } -impl PaymentMethodTypesEnabledWithRequiredFieldsContainer { +impl RequiredFieldsForEnabledPaymentMethodTypes { fn perform_surcharge_calculation( self, - ) -> PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { + ) -> RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes { let details_with_surcharge = self - .payment_methods_enabled + .0 .into_iter() - .map(|payment_methods_enabled| { - PaymentMethodTypessEnabledWithRequiredFieldsAndSurcharge { + .map( + |payment_methods_enabled| RequiredFieldsAndSurchargeForEnabledPaymentMethodType { payment_method_type: payment_methods_enabled.payment_method_type, required_field: payment_methods_enabled.required_field, payment_method_subtype: payment_methods_enabled.payment_method_subtype, surcharge: None, - } - }) + }, + ) .collect(); - PaymentMethodsEnabledWithRequiredFieldsAndSurchargeContainer { - payment_methods_enabled: details_with_surcharge, - } + RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes(details_with_surcharge) } } @@ -192,9 +184,7 @@ impl PerformFilteringOnPaymentMethodsEnabled for hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled { fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { - FilteredPaymentMethodsEnabled { - payment_methods_enabled: self.payment_methods_enabled, - } + FilteredPaymentMethodsEnabled(self.payment_methods_enabled) } } From 5d510922ed114d2a0b8e38c5439328bc35d50f16 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Tue, 17 Dec 2024 16:07:00 +0530 Subject: [PATCH 15/62] chore: cargo clippy --- crates/euclid_wasm/Cargo.toml | 2 +- crates/kgraph_utils/src/mca.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index fe5a54a56ed9..5df76d08d5ea 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -17,7 +17,7 @@ production = ["connector_configs/production"] development = ["connector_configs/development"] sandbox = ["connector_configs/sandbox"] payouts = ["api_models/payouts", "euclid/payouts"] -v1 = ["api_models/v1"] +v1 = ["api_models/v1", "kgraph_utils/v1"] v2 = [] [dependencies] diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs index 34fce3c9203f..a3e1dfc6220f 100644 --- a/crates/kgraph_utils/src/mca.rs +++ b/crates/kgraph_utils/src/mca.rs @@ -16,6 +16,7 @@ use crate::{error::KgraphError, transformers::IntoDirValue, types as kgraph_type pub const DOMAIN_IDENTIFIER: &str = "payment_methods_enabled_for_merchantconnectoraccount"; +#[cfg(feature = "v1")] fn get_dir_value_payment_method( from: api_enums::PaymentMethodType, ) -> Result { @@ -153,6 +154,7 @@ fn get_dir_value_payment_method( } } +#[cfg(feature = "v1")] fn compile_request_pm_types( builder: &mut cgraph::ConstraintGraphBuilder, pm_types: RequestPaymentMethodTypes, @@ -338,6 +340,7 @@ fn compile_request_pm_types( .map_err(KgraphError::GraphConstructionError) } +#[cfg(feature = "v1")] fn compile_payment_method_enabled( builder: &mut cgraph::ConstraintGraphBuilder, enabled: admin_api::PaymentMethodsEnabled, @@ -405,6 +408,8 @@ macro_rules! collect_global_variants { .collect::>() }; } + +#[cfg(feature = "v1")] fn global_vec_pmt( enabled_pmt: Vec, builder: &mut cgraph::ConstraintGraphBuilder, @@ -512,6 +517,7 @@ fn compile_graph_for_countries_and_currencies( .map_err(KgraphError::GraphConstructionError) } +#[cfg(feature = "v1")] fn compile_config_graph( builder: &mut cgraph::ConstraintGraphBuilder, config: &kgraph_types::CountryCurrencyFilter, From c92ced0e8e48f5f63dceae8294d1600f6403dc81 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Tue, 17 Dec 2024 18:36:38 +0530 Subject: [PATCH 16/62] chore: fix openapi --- crates/openapi/src/openapi_v2.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 3199bac08140..3adf5d3bc891 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -161,6 +161,7 @@ Never share your secret api keys. Keep them guarded and secure. common_types::payments::StripeSplitPaymentRequest, common_types::refunds::StripeSplitRefundRequest, common_utils::types::ChargeRefunds, + common_utils::types::PaymentMethodsEnabled, common_types::refunds::SplitRefund, api_models::payments::SplitPaymentsResponse, api_models::payments::StripeSplitPaymentsResponse, @@ -270,7 +271,6 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::FrmConfigs, api_models::admin::FrmPaymentMethod, api_models::admin::FrmPaymentMethodType, - // api_models::admin::PaymentMethodsEnabled, api_models::admin::MerchantConnectorDetailsWrap, api_models::admin::MerchantConnectorDetails, api_models::admin::MerchantConnectorWebhookDetails, @@ -467,6 +467,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentsConfirmIntentResponse, api_models::payments::AmountDetailsResponse, api_models::payments::BankCodeResponse, + api_models::payments::PaymentMethodListResponseForPayments, api_models::payment_methods::RequiredFieldInfo, api_models::payment_methods::DefaultPaymentMethod, api_models::payment_methods::MaskedBankDetails, From a6f1da5084820e70b9f1240810ff07753a6cd2ce Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Wed, 18 Dec 2024 15:52:49 +0530 Subject: [PATCH 17/62] chore: add .vscode/settings to gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1209263db3c8..dcbeddf7adab 100644 --- a/.gitignore +++ b/.gitignore @@ -187,7 +187,7 @@ target/ ### VisualStudioCode ### .vscode/* -!.vscode/settings.json +.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json @@ -268,4 +268,4 @@ creds.json /.direnv # Nix services data -/data \ No newline at end of file +/data From c3dd71d9a2e8fd779ed0b1d1c43d5f960e8f87e7 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Wed, 18 Dec 2024 15:54:27 +0530 Subject: [PATCH 18/62] refactor: move payment methods type to common_types --- crates/api_models/src/admin.rs | 8 +- crates/common_types/Cargo.toml | 5 + crates/common_types/src/lib.rs | 1 + crates/common_types/src/payment_methods.rs | 134 ++++++++++++++++++ crates/common_utils/src/types.rs | 122 ---------------- .../src/merchant_connector_account.rs | 12 +- 6 files changed, 150 insertions(+), 132 deletions(-) create mode 100644 crates/common_types/src/payment_methods.rs diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 414683a862db..6325c1988ea3 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -695,7 +695,7 @@ pub struct MerchantConnectorCreate { /// An object containing the details about the payment methods that need to be enabled under this merchant connector account #[schema(value_type = PaymentMethodsEnabled)] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ @@ -1031,7 +1031,7 @@ pub struct MerchantConnectorResponse { /// An object containing the details about the payment methods that need to be enabled under this merchant connector account #[schema(value_type = Vec)] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ @@ -1328,7 +1328,7 @@ pub struct MerchantConnectorListResponse { /// An object containing the details about the payment methods that need to be enabled under this merchant connector account #[schema(value_type = Vec)] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// A boolean value to indicate if the connector is disabled. By default, its value is false. #[schema(default = false, example = false)] @@ -1487,7 +1487,7 @@ pub struct MerchantConnectorUpdate { /// An object containing the details about the payment methods that need to be enabled under this merchant connector account #[schema(value_type = Option>)] - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, /// Webhook details of this merchant connector #[schema(example = json!({ diff --git a/crates/common_types/Cargo.toml b/crates/common_types/Cargo.toml index b21d7211a344..33dd799f0f60 100644 --- a/crates/common_types/Cargo.toml +++ b/crates/common_types/Cargo.toml @@ -6,6 +6,11 @@ edition.workspace = true rust-version.workspace = true license.workspace = true +[features] +default = [] +v1 = ["common_utils/v1"] +v2 = ["common_utils/v2"] + [dependencies] diesel = "2.2.3" serde = { version = "1.0.197", features = ["derive"] } diff --git a/crates/common_types/src/lib.rs b/crates/common_types/src/lib.rs index 30b46d98ae2f..b0b258ecb6d8 100644 --- a/crates/common_types/src/lib.rs +++ b/crates/common_types/src/lib.rs @@ -2,5 +2,6 @@ #![warn(missing_docs, missing_debug_implementations)] +pub mod payment_methods; pub mod payments; pub mod refunds; diff --git a/crates/common_types/src/payment_methods.rs b/crates/common_types/src/payment_methods.rs new file mode 100644 index 000000000000..68cfdb38f3fe --- /dev/null +++ b/crates/common_types/src/payment_methods.rs @@ -0,0 +1,134 @@ +//! Common types to be used in payment methods + +use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow, Queryable}; +use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; + +use diesel::{ + backend::Backend, + deserialize, + deserialize::FromSql, + serialize::{Output, ToSql}, +}; + +#[cfg(feature = "v2")] +/// Details of all the payment methods enabled for the connector for the given merchant account +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)] +#[serde(deny_unknown_fields)] +#[diesel(sql_type = Jsonb)] +pub struct PaymentMethodsEnabled { + /// Type of payment method. + #[schema(value_type = PaymentMethod,example = "card")] + pub payment_method_type: common_enums::PaymentMethod, + + /// Payment method configuration, this includes all the filters associated with the payment method + pub payment_method_subtypes: Option>, +} + +/// Details of a specific payment method subtype enabled for the connector for the given merchant account +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq, Hash)] +pub struct RequestPaymentMethodTypes { + /// The payment method subtype + #[schema(value_type = PaymentMethodType)] + pub payment_method_subtype: common_enums::PaymentMethodType, + + /// The payment experience for the payment method + #[schema(value_type = Option)] + pub payment_experience: Option, + + /// List of cards networks that are enabled for this payment method, applicable for credit and debit payment method subtypes only + #[schema(value_type = Option>)] + pub card_networks: Option>, + /// List of currencies accepted or has the processing capabilities of the processor + #[schema(example = json!( + { + "type": "enable_only", + "list": ["USD", "INR"] + } + ), value_type = Option)] + pub accepted_currencies: Option, + + /// List of Countries accepted or has the processing capabilities of the processor + #[schema(example = json!( + { + "type": "enable_only", + "list": ["UK", "AU"] + } + ), value_type = Option)] + pub accepted_countries: Option, + + /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents) + #[schema(example = 1)] + pub minimum_amount: Option, + + /// Maximum amount supported by the processor. To be represented in the lowest denomination of + /// the target currency (For example, for USD it should be in cents) + #[schema(example = 1313)] + pub maximum_amount: Option, + + /// Boolean to enable recurring payments / mandates. Default is true. + #[schema(default = true, example = false)] + pub recurring_enabled: bool, + + /// Boolean to enable installment / EMI / BNPL payments. Default is true. + #[schema(default = true, example = false)] + pub installment_payment_enabled: bool, +} + +#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] +#[serde( + deny_unknown_fields, + tag = "type", + content = "list", + rename_all = "snake_case" +)] +/// Object to filter the countries for which the payment method subtype is enabled +pub enum AcceptedCountries { + /// Only enable the payment method subtype for specific countries + #[schema(value_type = Vec)] + EnableOnly(Vec), + + /// Only disable the payment method subtype for specific countries + #[schema(value_type = Vec)] + DisableOnly(Vec), + + /// Enable the payment method subtype for all countries, in which the processor has the processing capabilities + AllAccepted, +} + +#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] +#[serde( + deny_unknown_fields, + tag = "type", + content = "list", + rename_all = "snake_case" +)] +/// Object to filter the countries for which the payment method subtype is enabled +pub enum AcceptedCurrencies { + /// Only enable the payment method subtype for specific currencies + #[schema(value_type = Vec)] + EnableOnly(Vec), + + /// Only disable the payment method subtype for specific currencies + #[schema(value_type = Vec)] + DisableOnly(Vec), + + /// Enable the payment method subtype for all currencies, in which the processor has the processing capabilities + AllAccepted, +} + +#[cfg(feature = "v2")] +impl Queryable for PaymentMethodsEnabled +where + DB: Backend, + Self: FromSql, +{ + type Row = Self; + + fn build(row: Self::Row) -> deserialize::Result { + Ok(row) + } +} + +#[cfg(feature = "v2")] +common_utils::impl_to_sql_from_sql_json!(PaymentMethodsEnabled); diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rs index 7f7621581667..0d39841fe09b 100644 --- a/crates/common_utils/src/types.rs +++ b/crates/common_utils/src/types.rs @@ -1579,125 +1579,3 @@ where self.0.to_sql(out) } } - -#[cfg(feature = "v2")] -/// Details of all the payment methods enabled for the connector for the given merchant account -#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)] -#[serde(deny_unknown_fields)] -#[diesel(sql_type = Jsonb)] -pub struct PaymentMethodsEnabled { - /// Type of payment method. - #[schema(value_type = PaymentMethod,example = "card")] - pub payment_method_type: common_enums::PaymentMethod, - - /// Payment method configuration, this includes all the filters associated with the payment method - pub payment_method_subtypes: Option>, -} - -/// Details of a specific payment method subtype enabled for the connector for the given merchant account -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq, Hash)] -pub struct RequestPaymentMethodTypes { - /// The payment method subtype - #[schema(value_type = PaymentMethodType)] - pub payment_method_subtype: common_enums::PaymentMethodType, - - /// The payment experience for the payment method - #[schema(value_type = Option)] - pub payment_experience: Option, - - /// List of cards networks that are enabled for this payment method, applicable for credit and debit payment method subtypes only - #[schema(value_type = Option>)] - pub card_networks: Option>, - /// List of currencies accepted or has the processing capabilities of the processor - #[schema(example = json!( - { - "type": "enable_only", - "list": ["USD", "INR"] - } - ), value_type = Option)] - pub accepted_currencies: Option, - - /// List of Countries accepted or has the processing capabilities of the processor - #[schema(example = json!( - { - "type": "enable_only", - "list": ["UK", "AU"] - } - ), value_type = Option)] - pub accepted_countries: Option, - - /// Minimum amount supported by the processor. To be represented in the lowest denomination of the target currency (For example, for USD it should be in cents) - #[schema(example = 1)] - pub minimum_amount: Option, - - /// Maximum amount supported by the processor. To be represented in the lowest denomination of - /// the target currency (For example, for USD it should be in cents) - #[schema(example = 1313)] - pub maximum_amount: Option, - - /// Boolean to enable recurring payments / mandates. Default is true. - #[schema(default = true, example = false)] - pub recurring_enabled: bool, - - /// Boolean to enable installment / EMI / BNPL payments. Default is true. - #[schema(default = true, example = false)] - pub installment_payment_enabled: bool, -} - -#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] -#[serde( - deny_unknown_fields, - tag = "type", - content = "list", - rename_all = "snake_case" -)] -/// Object to filter the countries for which the payment method subtype is enabled -pub enum AcceptedCountries { - /// Only enable the payment method subtype for specific countries - #[schema(value_type = Vec)] - EnableOnly(Vec), - - /// Only disable the payment method subtype for specific countries - #[schema(value_type = Vec)] - DisableOnly(Vec), - - /// Enable the payment method subtype for all countries, in which the processor has the processing capabilities - AllAccepted, -} - -#[derive(PartialEq, Eq, Hash, Debug, Clone, serde::Serialize, Deserialize, ToSchema)] -#[serde( - deny_unknown_fields, - tag = "type", - content = "list", - rename_all = "snake_case" -)] -/// Object to filter the countries for which the payment method subtype is enabled -pub enum AcceptedCurrencies { - /// Only enable the payment method subtype for specific currencies - #[schema(value_type = Vec)] - EnableOnly(Vec), - - /// Only disable the payment method subtype for specific currencies - #[schema(value_type = Vec)] - DisableOnly(Vec), - - /// Enable the payment method subtype for all currencies, in which the processor has the processing capabilities - AllAccepted, -} - -#[cfg(feature = "v2")] -impl Queryable for PaymentMethodsEnabled -where - DB: Backend, - Self: FromSql, -{ - type Row = Self; - - fn build(row: Self::Row) -> deserialize::Result { - Ok(row) - } -} - -#[cfg(feature = "v2")] -crate::impl_to_sql_from_sql_json!(PaymentMethodsEnabled); diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs index 3693ccae4fa2..1ecff0fc70a0 100644 --- a/crates/diesel_models/src/merchant_connector_account.rs +++ b/crates/diesel_models/src/merchant_connector_account.rs @@ -76,8 +76,8 @@ pub struct MerchantConnectorAccount { pub connector_name: String, pub connector_account_details: Encryption, pub disabled: Option, - #[diesel(deserialize_as = super::OptionalDieselArray)] - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub connector_type: storage_enums::ConnectorType, pub metadata: Option, pub connector_label: Option, @@ -146,8 +146,8 @@ pub struct MerchantConnectorAccountNew { pub connector_name: Option, pub connector_account_details: Option, pub disabled: Option, - #[diesel(deserialize_as = super::OptionalDieselArray)] - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub metadata: Option, pub connector_label: Option, pub created_at: time::PrimitiveDateTime, @@ -200,8 +200,8 @@ pub struct MerchantConnectorAccountUpdateInternal { pub connector_account_details: Option, pub connector_label: Option, pub disabled: Option, - #[diesel(deserialize_as = super::OptionalDieselArray)] - pub payment_methods_enabled: Option>, + #[diesel(deserialize_as = super::OptionalDieselArray)] + pub payment_methods_enabled: Option>, pub metadata: Option, pub modified_at: Option, pub connector_webhook_details: Option, From 32122adf1728ded393c47afabad87ce3ac18e26b Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:30:55 +0000 Subject: [PATCH 19/62] chore: run formatter --- crates/common_types/src/payment_methods.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/common_types/src/payment_methods.rs b/crates/common_types/src/payment_methods.rs index 68cfdb38f3fe..a92935c1f387 100644 --- a/crates/common_types/src/payment_methods.rs +++ b/crates/common_types/src/payment_methods.rs @@ -1,15 +1,15 @@ //! Common types to be used in payment methods -use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow, Queryable}; -use serde::{Deserialize, Serialize}; -use utoipa::ToSchema; - use diesel::{ backend::Backend, deserialize, deserialize::FromSql, serialize::{Output, ToSql}, + sql_types::Jsonb, + AsExpression, FromSqlRow, Queryable, }; +use serde::{Deserialize, Serialize}; +use utoipa::ToSchema; #[cfg(feature = "v2")] /// Details of all the payment methods enabled for the connector for the given merchant account From fc2453c89613ed9902aa7d77d89566bce4c977f5 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Thu, 19 Dec 2024 12:58:50 +0530 Subject: [PATCH 20/62] chore: cargo clippy_v2 --- crates/common_types/src/payment_methods.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/crates/common_types/src/payment_methods.rs b/crates/common_types/src/payment_methods.rs index a92935c1f387..702d8c0e7000 100644 --- a/crates/common_types/src/payment_methods.rs +++ b/crates/common_types/src/payment_methods.rs @@ -1,17 +1,11 @@ //! Common types to be used in payment methods use diesel::{ - backend::Backend, - deserialize, - deserialize::FromSql, - serialize::{Output, ToSql}, - sql_types::Jsonb, - AsExpression, FromSqlRow, Queryable, + backend::Backend, deserialize, deserialize::FromSql, sql_types::Jsonb, AsExpression, Queryable, }; use serde::{Deserialize, Serialize}; use utoipa::ToSchema; -#[cfg(feature = "v2")] /// Details of all the payment methods enabled for the connector for the given merchant account #[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)] #[serde(deny_unknown_fields)] @@ -117,7 +111,6 @@ pub enum AcceptedCurrencies { AllAccepted, } -#[cfg(feature = "v2")] impl Queryable for PaymentMethodsEnabled where DB: Backend, @@ -130,5 +123,4 @@ where } } -#[cfg(feature = "v2")] common_utils::impl_to_sql_from_sql_json!(PaymentMethodsEnabled); From 60a82e2a5a70b90ba6c7f1cc00c19dd3ca6bcd7d Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Thu, 19 Dec 2024 13:14:31 +0530 Subject: [PATCH 21/62] chore: fix openapi --- crates/openapi/src/openapi_v2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 97a42f4ca164..fb60a57e6e95 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -161,7 +161,7 @@ Never share your secret api keys. Keep them guarded and secure. common_types::payments::StripeSplitPaymentRequest, common_types::refunds::StripeSplitRefundRequest, common_utils::types::ChargeRefunds, - common_utils::types::PaymentMethodsEnabled, + common_types::payment_methods::PaymentMethodsEnabled, common_types::refunds::SplitRefund, api_models::payments::SplitPaymentsResponse, api_models::payments::StripeSplitPaymentsResponse, From 7618c9d5623b486f08633fcf94d5597d87f0b33e Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Thu, 19 Dec 2024 13:46:21 +0530 Subject: [PATCH 22/62] chore: cargo clippy_v2 --- .../src/merchant_connector_account.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index ffd01690f780..35994877a16c 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -73,7 +73,7 @@ pub struct MerchantConnectorAccount { #[encrypt] pub connector_account_details: Encryptable>, pub disabled: Option, - pub payment_methods_enabled: Option>, + pub payment_methods_enabled: Option>, pub connector_type: enums::ConnectorType, pub metadata: Option, pub frm_configs: Option>, @@ -124,7 +124,7 @@ impl MerchantConnectorAccount { /// This struct is a flattened representation of the payment methods enabled for a connector #[derive(Debug)] pub struct PaymentMethodsEnabledForConnector { - pub payment_methods_enabled: common_utils::types::RequestPaymentMethodTypes, + pub payment_methods_enabled: common_types::payment_methods::RequestPaymentMethodTypes, pub payment_method: common_enums::PaymentMethod, pub connector: String, } @@ -214,7 +214,7 @@ pub enum MerchantConnectorAccountUpdate { connector_type: Option, connector_account_details: Box>>, disabled: Option, - payment_methods_enabled: Option>, + payment_methods_enabled: Option>, metadata: Option, frm_configs: Option>, connector_webhook_details: Option, From a801fed85aac4df11d77c738afec6bedc8e56849 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Fri, 20 Dec 2024 15:05:08 +0530 Subject: [PATCH 23/62] chore: add extra information enum and make customer_payment_methods as optional --- api-reference-v2/openapi_spec.json | 52 ++++++++++++++----- crates/api_models/src/payment_methods.rs | 19 +++++-- crates/api_models/src/payments.rs | 4 +- crates/openapi/src/openapi_v2.rs | 1 + .../src/core/payments/payment_methods.rs | 5 +- 5 files changed, 57 insertions(+), 24 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index ecef9128be1d..7ebbac68e88f 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -13947,6 +13947,38 @@ "awaiting_data" ] }, + "PaymentMethodSubtypeSpecificData": { + "oneOf": [ + { + "type": "object", + "required": [ + "card_networks" + ], + "properties": { + "card_networks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CardNetworkTypes" + } + } + } + }, + { + "type": "object", + "required": [ + "bank_names" + ], + "properties": { + "bank_names": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BankCodeResponse" + } + } + } + } + ] + }, "PaymentMethodType": { "type": "string", "description": "Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.", @@ -18858,20 +18890,12 @@ "payment_method_subtype": { "$ref": "#/components/schemas/PaymentMethodType" }, - "card_networks": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CardNetworkTypes" - }, - "description": "The list of card networks enabled, if applicable for a payment method type", - "nullable": true - }, - "bank_names": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BankCodeResponse" - }, - "description": "The list of banks enabled, if applicable for a payment method type", + "extra_information": { + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodSubtypeSpecificData" + } + ], "nullable": true }, "required_fields": { diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index ddb88fe7a84f..41c588af49d0 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1252,6 +1252,18 @@ pub struct ResponsePaymentMethodTypes { pub pm_auth_connector: Option, } +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] +#[serde(untagged)] // Untagged used for serialization only +pub enum PaymentMethodSubtypeSpecificData { + Card { + card_networks: Vec, + }, + Bank { + bank_names: Vec, + }, +} + #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypes { @@ -1263,11 +1275,8 @@ pub struct ResponsePaymentMethodTypes { #[schema(example = "klarna", value_type = PaymentMethodType)] pub payment_method_subtype: common_enums::PaymentMethodType, - /// The list of card networks enabled, if applicable for a payment method type - pub card_networks: Option>, - - /// The list of banks enabled, if applicable for a payment method type - pub bank_names: Option>, + /// payment method subtype specific information + pub extra_information: Option, /// Required fields for the payment_method_type. /// This is the union of all the required fields for the payment method type enabled in all the connectors. diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 7daa985e7991..ff6abbd94e76 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6472,8 +6472,8 @@ pub struct PaymentMethodListResponseForPayments { /// The list of payment methods that are saved by the given customer /// This field is only returned if the customer_id is provided in the request - #[schema(value_type = Vec)] - pub customer_payment_methods: Vec, + #[schema(value_type = Option>)] + pub customer_payment_methods: Option>, } #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index fb60a57e6e95..d693fe24961a 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -198,6 +198,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payment_methods::PaymentMethodListRequest, api_models::payment_methods::PaymentMethodListResponse, api_models::payment_methods::ResponsePaymentMethodsEnabled, + api_models::payment_methods::PaymentMethodSubtypeSpecificData, api_models::payment_methods::ResponsePaymentMethodTypes, api_models::payment_methods::PaymentExperienceTypes, api_models::payment_methods::CardNetworkTypes, diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 5f6cefc69fc1..6ed436ae3c77 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -142,15 +142,14 @@ impl RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes { payment_method_subtype: payment_methods_enabled.payment_method_subtype, required_fields: payment_methods_enabled.required_field, surcharge_details: payment_methods_enabled.surcharge, - card_networks: None, - bank_names: None, + extra_information: None, } }) .collect(); api_models::payments::PaymentMethodListResponseForPayments { payment_methods_enabled: response_payment_methods, - customer_payment_methods: Vec::new(), + customer_payment_methods: None, } } } From 79c2a5bb027bbd5a2f1f0e3dc0a849ad4c888be3 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:38:17 +0000 Subject: [PATCH 24/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 7ebbac68e88f..558d51f0f1ec 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -13831,8 +13831,7 @@ "PaymentMethodListResponseForPayments": { "type": "object", "required": [ - "payment_methods_enabled", - "customer_payment_methods" + "payment_methods_enabled" ], "properties": { "payment_methods_enabled": { @@ -13847,7 +13846,8 @@ "items": { "$ref": "#/components/schemas/CustomerPaymentMethod" }, - "description": "The list of payment methods that are saved by the given customer\nThis field is only returned if the customer_id is provided in the request" + "description": "The list of payment methods that are saved by the given customer\nThis field is only returned if the customer_id is provided in the request", + "nullable": true } } }, From 4acd9e08387e520b170e18652dc8c62b74406422 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 20 Dec 2024 18:06:14 +0530 Subject: [PATCH 25/62] chore: add serde flatten --- crates/api_models/src/payment_methods.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 41c588af49d0..20ef4e380209 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1276,6 +1276,7 @@ pub struct ResponsePaymentMethodTypes { pub payment_method_subtype: common_enums::PaymentMethodType, /// payment method subtype specific information + #[serde(flatten)] pub extra_information: Option, /// Required fields for the payment_method_type. From a4c5b93c3eaae598713e5efa9f77fd33eac9c9a7 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:39:03 +0000 Subject: [PATCH 26/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 58 ++++++++++++++++-------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 558d51f0f1ec..53d113beaf8f 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -18878,19 +18878,8 @@ } }, "ResponsePaymentMethodTypes": { - "type": "object", - "required": [ - "payment_method_type", - "payment_method_subtype" - ], - "properties": { - "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" - }, - "payment_method_subtype": { - "$ref": "#/components/schemas/PaymentMethodType" - }, - "extra_information": { + "allOf": [ + { "allOf": [ { "$ref": "#/components/schemas/PaymentMethodSubtypeSpecificData" @@ -18898,23 +18887,38 @@ ], "nullable": true }, - "required_fields": { + { "type": "object", - "description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors.", - "additionalProperties": { - "$ref": "#/components/schemas/RequiredFieldInfo" - }, - "nullable": true - }, - "surcharge_details": { - "allOf": [ - { - "$ref": "#/components/schemas/SurchargeDetailsResponse" - } + "required": [ + "payment_method_type", + "payment_method_subtype" ], - "nullable": true + "properties": { + "payment_method_type": { + "$ref": "#/components/schemas/PaymentMethodType" + }, + "payment_method_subtype": { + "$ref": "#/components/schemas/PaymentMethodType" + }, + "required_fields": { + "type": "object", + "description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors.", + "additionalProperties": { + "$ref": "#/components/schemas/RequiredFieldInfo" + }, + "nullable": true + }, + "surcharge_details": { + "allOf": [ + { + "$ref": "#/components/schemas/SurchargeDetailsResponse" + } + ], + "nullable": true + } + } } - } + ] }, "ResponsePaymentMethodsEnabled": { "type": "object", From d58841d398466852f7f83156825d3a27f5deb69d Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 20 Dec 2024 19:03:28 +0530 Subject: [PATCH 27/62] chore: change route to use kebab-case --- crates/openapi/src/routes/payments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index ee105aeb6ded..abcac4781beb 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -758,7 +758,7 @@ pub(crate) enum ForceSync { /// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment #[utoipa::path( get, - path = "/v2/payments/{id}/payment_methods", + path = "/v2/payments/{id}/payment-methods", params( ("id" = String, Path, description = "The global payment id"), ), From 5025e6461e0d95ed22ca8644847a878ccd1dc006 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:36:58 +0000 Subject: [PATCH 28/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 53d113beaf8f..b12abec82580 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -2090,7 +2090,7 @@ ] } }, - "/v2/payments/{id}/payment_methods": { + "/v2/payments/{id}/payment-methods": { "get": { "tags": [ "Payments" From 51ad828432598056e30cd7ee31d670ee7471446f Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 20 Dec 2024 19:30:30 +0530 Subject: [PATCH 29/62] refactor: fix openapi --- crates/openapi/src/routes/payments.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index abcac4781beb..3766420f0825 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -691,6 +691,18 @@ pub fn payments_update_intent() {} #[utoipa::path( post, path = "/v2/payments/{id}/confirm-intent", + params (("id" = String, Path, description = "The unique identifier for the Payment Intent"), + ( + "X-Profile-Id" = String, Header, + description = "Profile ID associated to the payment intent", + example = json!({"X-Profile-Id": "pro_abcdefghijklmnop"}) + ), + ( + "X-Client-Secret" = String, Header, + description = "Client Secret Associated with the payment intent", + example = json!({"X-Client-Secret": "12345_pay_0193e41106e07e518940f8b51b9c8121_secret_0193e41107027a928d61d292e6a5dba9"}) + ), + ), request_body( content = PaymentsConfirmIntentRequest, examples( @@ -761,6 +773,16 @@ pub(crate) enum ForceSync { path = "/v2/payments/{id}/payment-methods", params( ("id" = String, Path, description = "The global payment id"), + ( + "X-Profile-Id" = String, Header, + description = "Profile ID associated to the payment intent", + example = json!({"X-Profile-Id": "pro_abcdefghijklmnop"}) + ), + ( + "X-Client-Secret" = String, Header, + description = "Client Secret Associated with the payment intent", + example = json!({"X-Client-Secret": "12345_pay_0193e41106e07e518940f8b51b9c8121_secret_0193e41107027a928d61d292e6a5dba9"}) + ), ), responses( (status = 200, description = "Get the payment methods", body = PaymentMethodListResponseForPayments), From 40146e5d664e12fffdd31bcbf6170018056e4672 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:03:37 +0000 Subject: [PATCH 30/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index b12abec82580..daa7608c7d38 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -1941,6 +1941,41 @@ "summary": "Payments - Confirm Intent", "description": "**Confirms a payment intent object with the payment method data**\n\n.", "operationId": "Confirm Payment Intent", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The unique identifier for the Payment Intent", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Profile-Id", + "in": "header", + "description": "Profile ID associated to the payment intent", + "required": true, + "schema": { + "type": "string" + }, + "example": { + "X-Profile-Id": "pro_abcdefghijklmnop" + } + }, + { + "name": "X-Client-Secret", + "in": "header", + "description": "Client Secret Associated with the payment intent", + "required": true, + "schema": { + "type": "string" + }, + "example": { + "X-Client-Secret": "12345_pay_0193e41106e07e518940f8b51b9c8121_secret_0193e41107027a928d61d292e6a5dba9" + } + } + ], "requestBody": { "content": { "application/json": { @@ -2107,6 +2142,30 @@ "schema": { "type": "string" } + }, + { + "name": "X-Profile-Id", + "in": "header", + "description": "Profile ID associated to the payment intent", + "required": true, + "schema": { + "type": "string" + }, + "example": { + "X-Profile-Id": "pro_abcdefghijklmnop" + } + }, + { + "name": "X-Client-Secret", + "in": "header", + "description": "Client Secret Associated with the payment intent", + "required": true, + "schema": { + "type": "string" + }, + "example": { + "X-Client-Secret": "12345_pay_0193e41106e07e518940f8b51b9c8121_secret_0193e41107027a928d61d292e6a5dba9" + } } ], "responses": { From ac8074d1b66f05fe78ea879a852c36b49bbd44f2 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 20 Dec 2024 20:48:27 +0530 Subject: [PATCH 31/62] fix: openapi_v2 --- .../api-reference/payments/payment-methods--list.mdx | 3 --- .../api-reference/payments/payments--payment-methods-list.mdx | 3 +++ api-reference-v2/mint.json | 2 +- crates/openapi/src/routes/payments.rs | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) delete mode 100644 api-reference-v2/api-reference/payments/payment-methods--list.mdx create mode 100644 api-reference-v2/api-reference/payments/payments--payment-methods-list.mdx diff --git a/api-reference-v2/api-reference/payments/payment-methods--list.mdx b/api-reference-v2/api-reference/payments/payment-methods--list.mdx deleted file mode 100644 index 80ad4cb172fc..000000000000 --- a/api-reference-v2/api-reference/payments/payment-methods--list.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: get /v2/payments/{id}/payment_methods ---- \ No newline at end of file diff --git a/api-reference-v2/api-reference/payments/payments--payment-methods-list.mdx b/api-reference-v2/api-reference/payments/payments--payment-methods-list.mdx new file mode 100644 index 000000000000..87e2a93586cc --- /dev/null +++ b/api-reference-v2/api-reference/payments/payments--payment-methods-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/payments/{id}/payment-methods +--- \ No newline at end of file diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json index d171391fe31c..080adae5ad1c 100644 --- a/api-reference-v2/mint.json +++ b/api-reference-v2/mint.json @@ -40,7 +40,7 @@ "api-reference/payments/payments--get-intent", "api-reference/payments/payments--update-intent", "api-reference/payments/payments--session-token", - "api-reference/payments/payment-methods--list", + "api-reference/payments/payments--payment-methods-list", "api-reference/payments/payments--confirm-intent", "api-reference/payments/payments--get" ] diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index 3766420f0825..1e4e0b25c2f5 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -768,6 +768,7 @@ pub(crate) enum ForceSync { /// Payments - Payment Methods List /// /// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment +#[cfg(feature = "v2")] #[utoipa::path( get, path = "/v2/payments/{id}/payment-methods", From 7ae9fb442247216f445cb58b07856d1deafd6006 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 20 Dec 2024 22:50:17 +0530 Subject: [PATCH 32/62] chore: cargo clippy_v2 --- crates/openapi/src/routes/payments.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index 1e4e0b25c2f5..33bb95618e89 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -793,5 +793,4 @@ pub(crate) enum ForceSync { operation_id = "Retrieve Payment methods for a Payment", security(("publishable_key" = [])) )] -#[cfg(feature = "v2")] pub fn list_payment_methods() {} From 5bc9c590b1041bb0162b64c4c150a530825dbb7a Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Sat, 21 Dec 2024 20:56:27 +0530 Subject: [PATCH 33/62] chore: merge fixes --- crates/router/src/routes/payments.rs | 72 ++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs index f73d93a98001..fdc7d9ced072 100644 --- a/crates/router/src/routes/payments.rs +++ b/crates/router/src/routes/payments.rs @@ -2448,6 +2448,78 @@ pub async fn payments_finish_redirection( .await } +#[cfg(feature = "v2")] +#[instrument(skip(state, req), fields(flow, payment_id))] +pub async fn payments_capture( + state: web::Data, + req: actix_web::HttpRequest, + payload: web::Json, + path: web::Path, +) -> impl Responder { + use hyperswitch_domain_models::payments::PaymentCaptureData; + let flow = Flow::PaymentsCapture; + + let global_payment_id = path.into_inner(); + tracing::Span::current().record("payment_id", global_payment_id.get_string_repr()); + + let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId { + global_payment_id, + payload: payload.into_inner(), + }; + + let header_payload = match HeaderPayload::foreign_try_from(req.headers()) { + Ok(headers) => headers, + Err(err) => { + return api::log_and_return_error_response(err); + } + }; + + let locking_action = internal_payload.get_locking_input(flow.clone()); + + Box::pin(api::server_wrap( + flow, + state, + &req, + internal_payload, + |state, auth: auth::AuthenticationData, req, req_state| async { + let payment_id = req.global_payment_id; + let request = req.payload; + + let operation = payments::operations::payment_capture_v2::PaymentsCapture; + + Box::pin(payments::payments_core::< + api_types::Capture, + api_models::payments::PaymentsCaptureResponse, + _, + _, + _, + PaymentCaptureData, + >( + state, + req_state, + auth.merchant_account, + auth.profile, + auth.key_store, + operation, + request, + payment_id, + payments::CallConnectorAction::Trigger, + header_payload.clone(), + )) + .await + }, + auth::auth_type( + &auth::HeaderAuth(auth::ApiKeyAuth), + &auth::JWTAuth { + permission: Permission::ProfileAccountWrite, + }, + req.headers(), + ), + locking_action, + )) + .await +} + #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] pub async fn list_payment_methods( From eaff74ebbbd68cbdfa693630e38cf46924a07755 Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Mon, 23 Dec 2024 16:30:04 +0530 Subject: [PATCH 34/62] chore: remove specific imports --- crates/router/src/routes/app.rs | 111 ++++++++++++-------- crates/router/src/routes/payment_methods.rs | 13 +++ 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 23fee350da02..de69e788c39a 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -34,7 +34,7 @@ use super::dummy_connector::*; ))] use super::ephemeral_key::*; #[cfg(any(feature = "olap", feature = "oltp"))] -use super::payment_methods::*; +use super::payment_methods; #[cfg(feature = "payouts")] use super::payout_link::*; #[cfg(feature = "payouts")] @@ -60,7 +60,7 @@ use super::{ #[cfg(feature = "v1")] use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events}; #[cfg(any(feature = "olap", feature = "oltp"))] -use super::{configs::*, customers::*, payments}; +use super::{configs::*, customers, payments}; #[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v1"))] use super::{mandates::*, refunds::*}; #[cfg(feature = "olap")] @@ -968,24 +968,25 @@ impl Customers { 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))) + route = route + .service(web::resource("/list").route(web::get().to(customers::customers_list))) } #[cfg(all(feature = "oltp", feature = "v2", feature = "customer_v2"))] { route = route - .service(web::resource("").route(web::post().to(customers_create))) + .service(web::resource("").route(web::post().to(customers::customers_create))) .service( web::resource("/{id}") - .route(web::put().to(customers_update)) - .route(web::get().to(customers_retrieve)) - .route(web::delete().to(customers_delete)), + .route(web::put().to(customers::customers_update)) + .route(web::get().to(customers::customers_retrieve)) + .route(web::delete().to(customers::customers_delete)), ) } #[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))] { route = route.service( web::resource("/{customer_id}/saved-payment-methods") - .route(web::get().to(list_customer_payment_method_api)), + .route(web::get().to(payment_methods::list_customer_payment_method_api)), ); } route @@ -1007,32 +1008,33 @@ impl Customers { route = route .service( web::resource("/{customer_id}/mandates") - .route(web::get().to(get_customer_mandates)), + .route(web::get().to(customers::get_customer_mandates)), ) - .service(web::resource("/list").route(web::get().to(customers_list))) + .service(web::resource("/list").route(web::get().to(customers::customers_list))) } #[cfg(feature = "oltp")] { route = route - .service(web::resource("").route(web::post().to(customers_create))) + .service(web::resource("").route(web::post().to(customers::customers_create))) .service( - web::resource("/payment_methods") - .route(web::get().to(list_customer_payment_method_api_client)), + web::resource("/payment_methods").route( + web::get().to(payment_methods::list_customer_payment_method_api_client), + ), ) .service( web::resource("/{customer_id}/payment_methods") - .route(web::get().to(list_customer_payment_method_api)), + .route(web::get().to(payment_methods::list_customer_payment_method_api)), ) .service( web::resource("/{customer_id}/payment_methods/{payment_method_id}/default") - .route(web::post().to(default_payment_method_set_api)), + .route(web::post().to(payment_methods::default_payment_method_set_api)), ) .service( web::resource("/{customer_id}") - .route(web::get().to(customers_retrieve)) - .route(web::post().to(customers_update)) - .route(web::delete().to(customers_delete)), + .route(web::get().to(customers::customers_retrieve)) + .route(web::post().to(customers::customers_update)) + .route(web::delete().to(customers::customers_delete)), ) } @@ -1131,21 +1133,34 @@ impl PaymentMethods { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/v2/payment-methods").app_data(web::Data::new(state)); route = route - .service(web::resource("").route(web::post().to(create_payment_method_api))) .service( - web::resource("/create-intent") - .route(web::post().to(create_payment_method_intent_api)), + web::resource("").route(web::post().to(payment_methods::create_payment_method_api)), ) .service( - web::resource("/{id}/confirm-intent") - .route(web::post().to(confirm_payment_method_intent_api)), - ) - .service( - web::resource("/{id}/update-saved-payment-method") - .route(web::patch().to(payment_method_update_api)), - ) - .service(web::resource("/{id}").route(web::get().to(payment_method_retrieve_api))) - .service(web::resource("/{id}").route(web::delete().to(payment_method_delete_api))); + web::resource("/create-intent") + .route(web::post().to(payment_methods::create_payment_method_intent_api)), + ); + + route = route.service( + web::scope("/{id}") + .service( + web::resource("") + .route(web::get().to(payment_methods::payment_method_retrieve_api)) + .route(web::delete().to(payment_methods::payment_method_delete_api)), + ) + .service( + web::resource("/list-payment-methods") + .route(web::post().to(payment_methods::confirm_payment_method_intent_api)), + ) + .service( + web::resource("/confirm-intent") + .route(web::post().to(payment_methods::confirm_payment_method_intent_api)), + ) + .service( + web::resource("/update-saved-payment-method") + .route(web::patch().to(payment_methods::payment_method_update_api)), + ), + ); route } @@ -1162,44 +1177,49 @@ impl PaymentMethods { let mut route = web::scope("/payment_methods").app_data(web::Data::new(state)); #[cfg(feature = "olap")] { - route = route.service( - web::resource("/filter") - .route(web::get().to(list_countries_currencies_for_connector_payment_method)), - ); + route = + route.service(web::resource("/filter").route( + web::get().to( + payment_methods::list_countries_currencies_for_connector_payment_method, + ), + )); } #[cfg(feature = "oltp")] { route = route .service( web::resource("") - .route(web::post().to(create_payment_method_api)) - .route(web::get().to(list_payment_method_api)), // TODO : added for sdk compatibility for now, need to deprecate this later + .route(web::post().to(payment_methods::create_payment_method_api)) + .route(web::get().to(payment_methods::list_payment_method_api)), // TODO : added for sdk compatibility for now, need to deprecate this later ) .service( - web::resource("/migrate").route(web::post().to(migrate_payment_method_api)), + web::resource("/migrate") + .route(web::post().to(payment_methods::migrate_payment_method_api)), ) .service( - web::resource("/migrate-batch").route(web::post().to(migrate_payment_methods)), + web::resource("/migrate-batch") + .route(web::post().to(payment_methods::migrate_payment_methods)), ) .service( - web::resource("/collect").route(web::post().to(initiate_pm_collect_link_flow)), + web::resource("/collect") + .route(web::post().to(payment_methods::initiate_pm_collect_link_flow)), ) .service( web::resource("/collect/{merchant_id}/{collect_id}") - .route(web::get().to(render_pm_collect_link)), + .route(web::get().to(payment_methods::render_pm_collect_link)), ) .service( web::resource("/{payment_method_id}") - .route(web::get().to(payment_method_retrieve_api)) - .route(web::delete().to(payment_method_delete_api)), + .route(web::get().to(payment_methods::payment_method_retrieve_api)) + .route(web::delete().to(payment_methods::payment_method_delete_api)), ) .service( web::resource("/{payment_method_id}/update") - .route(web::post().to(payment_method_update_api)), + .route(web::post().to(payment_methods::payment_method_update_api)), ) .service( web::resource("/{payment_method_id}/save") - .route(web::post().to(save_payment_method_api)), + .route(web::post().to(payment_methods::save_payment_method_api)), ) .service( web::resource("/auth/link").route(web::post().to(pm_auth::link_token_create)), @@ -1396,7 +1416,8 @@ impl MerchantConnectorAccount { #[cfg(feature = "oltp")] { route = route.service( - web::resource("/payment_methods").route(web::get().to(list_payment_method_api)), + web::resource("/payment_methods") + .route(web::get().to(payment_methods::list_payment_method_api)), ); } route diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index a85cc468a629..8a63bdbf0824 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -179,6 +179,19 @@ pub async fn confirm_payment_method_intent_api( .await } +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] +pub async fn list_payment_methods( + state: web::Data, + req: HttpRequest, + path: web::Path, +) -> HttpResponse { + let flow = Flow::PaymentMethodsList; + let pm_id = path.into_inner(); + + todo!() +} + #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsUpdate))] pub async fn payment_method_update_api( From ea72debccb79baf873ed658b64a900c9f6c11c6f Mon Sep 17 00:00:00 2001 From: Narayanbhat166 Date: Mon, 23 Dec 2024 18:46:41 +0530 Subject: [PATCH 35/62] chore: remove redundant code because of merge conflicts --- .../src/merchant_connector_account.rs | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index 0791ed80a940..7789c05e9902 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -197,68 +197,6 @@ impl FlattenedPaymentMethodsEnabled { } } -#[cfg(feature = "v2")] -/// Holds the payment methods enabled for a connector along with the connector name -/// This struct is a flattened representation of the payment methods enabled for a connector -#[derive(Debug)] -pub struct PaymentMethodsEnabledForConnector { - pub payment_methods_enabled: common_types::payment_methods::RequestPaymentMethodTypes, - pub payment_method: common_enums::PaymentMethod, - pub connector: String, -} - -#[cfg(feature = "v2")] -/// Holds the payment methods enabled for a connector -pub struct FlattenedPaymentMethodsEnabled { - pub payment_methods_enabled: Vec, -} - -#[cfg(feature = "v2")] -impl FlattenedPaymentMethodsEnabled { - /// This functions flattens the payment methods enabled from the connector accounts - /// Retains the connector name and payment method in every flattened element - pub fn from_payment_connectors_list(payment_connectors: Vec) -> Self { - let payment_methods_enabled_flattened_with_connector = payment_connectors - .into_iter() - .map(|connector| { - ( - connector.payment_methods_enabled.unwrap_or_default(), - connector.connector_name, - ) - }) - .flat_map(|(payment_method_enabled, connector_name)| { - payment_method_enabled - .into_iter() - .flat_map(move |payment_method| { - let request_payment_methods_enabled = - payment_method.payment_method_subtypes.unwrap_or_default(); - let length = request_payment_methods_enabled.len(); - request_payment_methods_enabled.into_iter().zip( - std::iter::repeat(( - connector_name.clone(), - payment_method.payment_method_type, - )) - .take(length), - ) - }) - }) - .map( - |(request_payment_methods, (connector_name, payment_method))| { - PaymentMethodsEnabledForConnector { - payment_methods_enabled: request_payment_methods, - connector: connector_name.clone(), - payment_method, - } - }, - ) - .collect(); - - Self { - payment_methods_enabled: payment_methods_enabled_flattened_with_connector, - } - } -} - #[cfg(feature = "v1")] #[derive(Debug)] pub enum MerchantConnectorAccountUpdate { From c4b9b726cb1295dd8e5403a980fd437f95530af4 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Tue, 24 Dec 2024 18:55:23 +0530 Subject: [PATCH 36/62] refactor: add locker config --- config/development.toml | 134 +++++++++++++++++++++----------- crates/router/src/routes/app.rs | 2 +- 2 files changed, 91 insertions(+), 45 deletions(-) diff --git a/config/development.toml b/config/development.toml index 133823d6cb37..8af67c281cbd 100644 --- a/config/development.toml +++ b/config/development.toml @@ -69,12 +69,11 @@ common_merchant_identifier = "COMMON MERCHANT IDENTIFIER" applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT" [locker] -host = "" -host_rs = "" -mock_locker = true -basilisk_host = "" -locker_enabled = true -ttl_for_storage_in_secs = 220752000 +host = "http://127.0.0.1:3000" +host_rs = "http://127.0.0.1:3000" +mock_locker = false +basilisk_host = "http://127.0.0.1:3000" +locker_enabled = false [forex_api] call_delay = 21600 @@ -86,9 +85,57 @@ fallback_api_key = "YOUR API KEY HERE" redis_lock_timeout = 26000 [jwekey] -vault_encryption_key = "" -rust_locker_encryption_key = "" -vault_private_key = "" +vault_encryption_key = """ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa6siKaSYqD1o4J3AbHq +Km8oVTvep7GoN/C45qY60C7DO72H1O7Ujt6ZsSiK83EyI0CaUg3ORPS3ayobFNmu +zR366ckK8GIf3BG7sVI6u/9751z4OvBHZMM9JFWa7Bx/RCPQ8aeM+iJoqf9auuQm +3NCTlfaZJif45pShswR+xuZTR/bqnsOSP/MFROI9ch0NE7KRogy0tvrZe21lP24i +Ro2LJJG+bYshxBddhxQf2ryJ85+/Trxdu16PunodGzCl6EMT3bvb4ZC41i15omqU +aXXV1Z1wYUhlsO0jyd1bVvjyuE/KE1TbBS0gfR/RkacODmmE2zEdZ0EyyiXwqkmc +oQIDAQAB +-----END PUBLIC KEY----- +""" +rust_locker_encryption_key = """ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa6siKaSYqD1o4J3AbHq +Km8oVTvep7GoN/C45qY60C7DO72H1O7Ujt6ZsSiK83EyI0CaUg3ORPS3ayobFNmu +zR366ckK8GIf3BG7sVI6u/9751z4OvBHZMM9JFWa7Bx/RCPQ8aeM+iJoqf9auuQm +3NCTlfaZJif45pShswR+xuZTR/bqnsOSP/MFROI9ch0NE7KRogy0tvrZe21lP24i +Ro2LJJG+bYshxBddhxQf2ryJ85+/Trxdu16PunodGzCl6EMT3bvb4ZC41i15omqU +aXXV1Z1wYUhlsO0jyd1bVvjyuE/KE1TbBS0gfR/RkacODmmE2zEdZ0EyyiXwqkmc +oQIDAQAB +-----END PUBLIC KEY----- +""" +vault_private_key = """ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA5Z/K0JWds8iHhWCa+rj0rhOQX1nVs/ArQ1D0vh3UlSPR2vZU +TrkdP7i3amv4d2XDC+3+5/YWExTkpxqnfl1T9J37leN2guAARed6oYoTDEP/OoKt +nUrKK2xk/+V5DNOWcRiSpcCrJOOIEoACOlPIrXQSg16KDZQb0QTMntnsiPIJDbsO +GcdKytRAcNaokiKLnia1v13N3bk6dSplrj1YzawslZfgqD0eov4FjzBMoA19yNtl +VLLf6kOkLcFQjTKXJLP1tLflLUBPTg8fm9wgAPK2BjMQ2AMkUxx0ubbtw/9CeJ+b +FWrqGnEhlvfDMlyAV77sAiIdQ4mXs3TLcLb/AQIDAQABAoIBAGNekD1N0e5AZG1S +zh6cNb6zVrH8xV9WGtLJ0PAJJrrXwnQYT4m10DOIM0+Jo/+/ePXLq5kkRI9DZmPu +Q/eKWc+tInfN9LZUS6n0r3wCrZWMQ4JFlO5RtEWwZdDbtFPZqOwObz/treKL2JHw +9YXaRijR50UUf3e61YLRqd9AfX0RNuuG8H+WgU3Gwuh5TwRnljM3JGaDPHsf7HLS +tNkqJuByp26FEbOLTokZDbHN0sy7/6hufxnIS9AK4vp8y9mZAjghG26Rbg/H71mp +Z+Q6P1y7xdgAKbhq7usG3/o4Y1e9wnghHvFS7DPwGekHQH2+LsYNEYOir1iRjXxH +GUXOhfUCgYEA+cR9jONQFco8Zp6z0wdGlBeYoUHVMjThQWEblWL2j4RG/qQd/y0j +uhVeU0/PmkYK2mgcjrh/pgDTtPymc+QuxBi+lexs89ppuJIAgMvLUiJT67SBHguP +l4+oL9U78KGh7PfJpMKH+Pk5yc1xucAevk0wWmr5Tz2vKRDavFTPV+MCgYEA61qg +Y7yN0cDtxtqlZdMC8BJPFCQ1+s3uB0wetAY3BEKjfYc2O/4sMbixXzt5PkZqZy96 +QBUBxhcM/rIolpM3nrgN7h1nmJdk9ljCTjWoTJ6fDk8BUh8+0GrVhTbe7xZ+bFUN +UioIqvfapr/q/k7Ah2mCBE04wTZFry9fndrH2ssCgYEAh1T2Cj6oiAX6UEgxe2h3 +z4oxgz6efAO3AavSPFFQ81Zi+VqHflpA/3TQlSerfxXwj4LV5mcFkzbjfy9eKXE7 +/bjCm41tQ3vWyNEjQKYr1qcO/aniRBtThHWsVa6eObX6fOGN+p4E+txfeX693j3A +6q/8QSGxUERGAmRFgMIbTq0CgYAmuTeQkXKII4U75be3BDwEgg6u0rJq/L0ASF74 +4djlg41g1wFuZ4if+bJ9Z8ywGWfiaGZl6s7q59oEgg25kKljHQd1uTLVYXuEKOB3 +e86gJK0o7ojaGTf9lMZi779IeVv9uRTDAxWAA93e987TXuPAo/R3frkq2SIoC9Rg +paGidwKBgBqYd/iOJWsUZ8cWEhSE1Huu5rDEpjra8JPXHqQdILirxt1iCA5aEQou +BdDGaDr8sepJbGtjwTyiG8gEaX1DD+KsF2+dQRQdQfcYC40n8fKkvpFwrKjDj1ac +VuY3OeNxi+dC2r7HppP3O/MJ4gX/RJJfSrcaGP8/Ke1W5+jE97Qy +-----END RSA PRIVATE KEY----- +""" tunnel_private_key = "" [connectors.supported] @@ -229,8 +276,8 @@ elavon.base_url = "https://api.demo.convergepay.com/VirtualMerchantDemo/" fiserv.base_url = "https://cert.api.fiservapps.com/" fiservemea.base_url = "https://prod.emea.api.fiservapps.com/sandbox" fiuu.base_url = "https://sandbox.merchant.razer.com/" -fiuu.secondary_base_url="https://sandbox.merchant.razer.com/" -fiuu.third_base_url="https://api.merchant.razer.com/" +fiuu.secondary_base_url = "https://sandbox.merchant.razer.com/" +fiuu.third_base_url = "https://api.merchant.razer.com/" forte.base_url = "https://sandbox.forte.net/api/v3" globalpay.base_url = "https://apis.sandbox.globalpay.com/ucp/" globepay.base_url = "https://pay.globepay.co/" @@ -241,7 +288,7 @@ iatapay.base_url = "https://sandbox.iata-pay.iata.org/api/v1" inespay.base_url = "https://apiflow.inespay.com/san/v21" itaubank.base_url = "https://sandbox.devportal.itau.com.br/" jpmorgan.base_url = "https://api-mock.payments.jpmorgan.com/api/v2" -jpmorgan.secondary_base_url= "https://id.payments.jpmorgan.com" +jpmorgan.secondary_base_url = "https://id.payments.jpmorgan.com" klarna.base_url = "https://api{{klarna_region}}.playground.klarna.com/" mifinity.base_url = "https://demo.mifinity.com/" mollie.base_url = "https://api.mollie.com/v2/" @@ -259,7 +306,7 @@ nuvei.base_url = "https://ppp-test.nuvei.com/" opayo.base_url = "https://pi-test.sagepay.com/" opennode.base_url = "https://dev-api.opennode.com" paybox.base_url = "https://preprod-ppps.paybox.com/PPPS.php" -paybox.secondary_base_url="https://preprod-tpeweb.paybox.com/" +paybox.secondary_base_url = "https://preprod-tpeweb.paybox.com/" payeezy.base_url = "https://api-cert.payeezy.com/" payme.base_url = "https://sandbox.payme.io/" payone.base_url = "https://payment.preprod.payone.com/" @@ -343,7 +390,7 @@ adyen = { banks = "bank_austria,bawag_psk_ag,dolomitenbank,easybank_ag,erste_ban [bank_config.ideal] stripe = { banks = "abn_amro,asn_bank,bunq,handelsbanken,ing,knab,moneyou,rabobank,regiobank,revolut,sns_bank,triodos_bank,van_lanschot" } adyen = { banks = "abn_amro,asn_bank,bunq,ing,knab,n26,nationale_nederlanden,rabobank,regiobank,revolut,sns_bank,triodos_bank,van_lanschot, yoursafe" } -multisafepay = { banks="abn_amro, asn_bank, bunq, handelsbanken, nationale_nederlanden, n26, ing, knab, rabobank, regiobank, revolut, sns_bank,triodos_bank, van_lanschot, yoursafe" } +multisafepay = { banks = "abn_amro, asn_bank, bunq, handelsbanken, nationale_nederlanden, n26, ing, knab, rabobank, regiobank, revolut, sns_bank,triodos_bank, van_lanschot, yoursafe" } [bank_config.online_banking_czech_republic] adyen = { banks = "ceska_sporitelna,komercni_banka,platnosc_online_karta_platnicza" } @@ -395,10 +442,10 @@ cashapp = { country = "US", currency = "USD" } open_banking_uk = { country = "DE,GB,AT,BE,CY,EE,ES,FI,FR,GR,HR,IE,IT,LT,LU,LV,MT,NL,PT,SI,SK,BG,CZ,DK,HU,NO,PL,RO,SE,AU,BR", currency = "EUR,GBP,DKK,NOK,PLN,SEK,AUD,BRL" } [pm_filters.razorpay] -upi_collect = {country = "IN", currency = "INR"} +upi_collect = { country = "IN", currency = "INR" } [pm_filters.plaid] -open_banking_pis = {currency = "EUR,GBP"} +open_banking_pis = { currency = "EUR,GBP" } [pm_filters.adyen] google_pay = { country = "AU,NZ,JP,HK,SG,MY,TH,VN,BH,AE,KW,BR,ES,GB,SE,NO,SK,AT,NL,DE,HU,CY,LU,CH,BE,FR,DK,RO,HR,LI,MT,SI,GR,PT,IE,CZ,EE,LT,LV,IT,PL,TR,IS,CA,US", currency = "AED,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CHF,CLP,CNY,COP,CRC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,FKP,GBP,GEL,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HTG,HUF,IDR,ILS,INR,IQD,JMD,JOD,JPY,KES,KGS,KHR,KMF,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LYD,MAD,MDL,MKD,MMK,MNT,MOP,MRU,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLE,SOS,SRD,STN,SVC,SZL,THB,TND,TOP,TRY,TTD,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,XOF,XPF,YER,ZAR,ZMW" } @@ -479,11 +526,11 @@ credit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,B debit = { country = "AT,BE,CY,EE,FI,FR,DE,GR,IE,IT,LV,LT,LU,MT,NL,PT,SK,SI,ES,BG,HR,DK,GB,NO,PL,CZ,RO,SE,CH,HU", currency = "ARS,AUD,BHD,CAD,CLP,CNY,COP,HRK,CZK,DKK,HKD,HUF,INR,JPY,KZT,JOD,KRW,KWD,MYR,MXN,NGN,NOK,PHP,QAR,RUB,SAR,SGD,VND,ZAR,SEK,CHF,THB,AED,EGP,GBP,USD,TWD,BYN,RSD,AZN,RON,TRY,AOA,BGN,EUR,UAH,PLN,BRL" } [pm_filters.novalnet] -credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"} -debit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"} -apple_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"} -google_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"} -paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW"} +credit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" } +debit = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" } +apple_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" } +google_pay = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" } +paypal = { country = "AD,AE,AL,AM,AR,AT,AU,AZ,BA,BB,BD,BE,BG,BH,BI,BM,BN,BO,BR,BS,BW,BY,BZ,CA,CD,CH,CL,CN,CO,CR,CU,CY,CZ,DE,DJ,DK,DO,DZ,EE,EG,ET,ES,FI,FJ,FR,GB,GE,GH,GI,GM,GR,GT,GY,HK,HN,HR,HU,ID,IE,IL,IN,IS,IT,JM,JO,JP,KE,KH,KR,KW,KY,KZ,LB,LK,LT,LV,LY,MA,MC,MD,ME,MG,MK,MN,MO,MT,MV,MW,MX,MY,NG,NI,NO,NP,NL,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PY,QA,RO,RS,RU,RW,SA,SB,SC,SE,SG,SH,SI,SK,SL,SO,SM,SR,ST,SV,SY,TH,TJ,TN,TO,TR,TW,TZ,UA,UG,US,UY,UZ,VE,VA,VN,VU,WS,CF,AG,DM,GD,KN,LC,VC,YE,ZA,ZM", currency = "AED,ALL,AMD,ARS,AUD,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BWP,BYN,BZD,CAD,CDF,CHF,CLP,CNY,COP,CRC,CUP,CZK,DJF,DKK,DOP,DZD,EGP,ETB,EUR,FJD,GBP,GEL,GHS,GIP,GMD,GTQ,GYD,HKD,HNL,HRK,HUF,IDR,ILS,INR,ISK,JMD,JOD,JPY,KES,KHR,KRW,KWD,KYD,KZT,LBP,LKR,LYD,MAD,MDL,MGA,MKD,MNT,MOP,MVR,MWK,MXN,MYR,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SEK,SGD,SHP,SLL,SOS,SRD,STN,SVC,SYP,THB,TJS,TND,TOP,TRY,TWD,TZS,UAH,UGX,USD,UYU,UZS,VES,VND,VUV,WST,XAF,XCD,YER,ZAR,ZMW" } [pm_filters.braintree] paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" } @@ -522,7 +569,6 @@ credit = { not_available_flows = { capture_method = "manual" } } debit = { not_available_flows = { capture_method = "manual" } } - [pm_filters.mollie] credit = { not_available_flows = { capture_method = "manual" } } debit = { not_available_flows = { capture_method = "manual" } } @@ -562,7 +608,7 @@ credit = { currency = "USD" } debit = { currency = "USD" } [pm_filters.fiuu] -duit_now = { country ="MY", currency = "MYR" } +duit_now = { country = "MY", currency = "MYR" } [tokenization] stripe = { long_lived_token = false, payment_method = "wallet", payment_method_type = { type = "disable_only", list = "google_pay" } } @@ -619,16 +665,16 @@ connectors_with_delayed_session_response = "trustpay,payme" connectors_with_webhook_source_verification_call = "paypal" [mandates.supported_payment_methods] -bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } -bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } -bank_debit.bacs = { connector_list = "stripe,gocardless" } -bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } -card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" -card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" -pay_later.klarna.connector_list = "adyen" -wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet" -wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet" -wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal" +bank_debit.ach = { connector_list = "gocardless,adyen,stripe" } +bank_debit.becs = { connector_list = "gocardless,stripe,adyen" } +bank_debit.bacs = { connector_list = "stripe,gocardless" } +bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" } +card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" +card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal" +pay_later.klarna.connector_list = "adyen" +wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet" +wallet.google_pay.connector_list = "stripe,adyen,cybersource,bankofamerica,noon,globalpay,multisafepay,novalnet" +wallet.paypal.connector_list = "adyen,globalpay,nexinets,novalnet,paypal" wallet.momo.connector_list = "adyen" wallet.kakao_pay.connector_list = "adyen" wallet.go_pay.connector_list = "adyen" @@ -637,13 +683,13 @@ wallet.dana.connector_list = "adyen" wallet.twint.connector_list = "adyen" wallet.vipps.connector_list = "adyen" -bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets" -bank_redirect.sofort.connector_list = "stripe,adyen,globalpay" -bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets" -bank_redirect.bancontact_card.connector_list="adyen,stripe" -bank_redirect.trustly.connector_list="adyen" -bank_redirect.open_banking_uk.connector_list="adyen" -bank_redirect.eps.connector_list="globalpay,nexinets" +bank_redirect.ideal.connector_list = "stripe,adyen,globalpay,multisafepay,nexinets" +bank_redirect.sofort.connector_list = "stripe,adyen,globalpay" +bank_redirect.giropay.connector_list = "adyen,globalpay,multisafepay,nexinets" +bank_redirect.bancontact_card.connector_list = "adyen,stripe" +bank_redirect.trustly.connector_list = "adyen" +bank_redirect.open_banking_uk.connector_list = "adyen" +bank_redirect.eps.connector_list = "globalpay,nexinets" [mandates.update_mandate_supported] card.credit = { connector_list = "cybersource" } @@ -693,7 +739,7 @@ merchant_name = "HyperSwitch" card = "credit,debit" [payout_method_filters.adyenplatform] -sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH" , currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } +sepa = { country = "ES,SK,AT,NL,DE,BE,FR,FI,PT,IE,EE,LT,LV,IT,CZ,DE,HU,NO,PL,SE,GB,CH", currency = "EUR,CZK,DKK,HUF,NOK,PLN,SEK,GBP,CHF" } [payout_method_filters.stripe] ach = { country = "US", currency = "USD" } @@ -721,7 +767,7 @@ source = "logs" [events.kafka] brokers = ["localhost:9092"] -fraud_check_analytics_topic= "hyperswitch-fraud-check-events" +fraud_check_analytics_topic = "hyperswitch-fraud-check-events" intent_analytics_topic = "hyperswitch-payment-intent-events" attempt_analytics_topic = "hyperswitch-payment-attempt-events" refund_analytics_topic = "hyperswitch-refund-events" @@ -790,7 +836,7 @@ sdk_eligible_payment_methods = "card" [multitenancy] enabled = false -global_tenant = { schema = "public", redis_key_prefix = "", clickhouse_database = "default"} +global_tenant = { schema = "public", redis_key_prefix = "", clickhouse_database = "default" } [multitenancy.tenants.public] base_url = "http://localhost:8080" @@ -799,7 +845,7 @@ redis_key_prefix = "" clickhouse_database = "default" [multitenancy.tenants.public.user] -control_center_url = "http://localhost:9000" +control_center_url = "http://localhost:9000" [user_auth_methods] encryption_key = "A8EF32E029BC3342E54BF2E172A4D7AA43E8EF9D2C3A624A9F04E2EF79DC698F" diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index fe44b8134301..ca2ac302be7e 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -1166,7 +1166,7 @@ impl PaymentMethods { ) .service( web::resource("/list-payment-methods") - .route(web::post().to(payment_methods::confirm_payment_method_intent_api)), + .route(web::post().to(payment_methods::list_payment_methods)), ) .service( web::resource("/confirm-intent") From 4f31d6ad6c2699fe535e0df0ef118d0da82bd16e Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 25 Dec 2024 15:34:46 +0530 Subject: [PATCH 37/62] feat(payment_methods): add payment methods list --- config/development.toml | 1 - crates/api_models/src/events/payment.rs | 21 ++- crates/api_models/src/payment_methods.rs | 58 ++++--- crates/api_models/src/payments.rs | 25 ++- crates/common_utils/src/events.rs | 11 ++ .../src/id_type/global_id/payment_methods.rs | 13 +- .../src/merchant_connector_account.rs | 6 - crates/openapi/src/openapi_v2.rs | 1 - crates/router/src/core/payment_methods.rs | 146 +++++++++++++++++- .../router/src/core/payment_methods/cards.rs | 23 +-- .../src/core/payment_methods/transformers.rs | 2 +- .../src/core/payments/payment_methods.rs | 6 +- crates/router/src/routes/app.rs | 2 +- crates/router/src/routes/payment_methods.rs | 32 +++- 14 files changed, 273 insertions(+), 74 deletions(-) diff --git a/config/development.toml b/config/development.toml index 7582d3bffa61..8245008bb83e 100644 --- a/config/development.toml +++ b/config/development.toml @@ -83,7 +83,6 @@ api_timeout = 20000 api_key = "YOUR API KEY HERE" fallback_api_key = "YOUR API KEY HERE" redis_lock_timeout = 26000 - [jwekey] vault_encryption_key = """ -----BEGIN PUBLIC KEY----- diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index c242788e090b..e749e5d1b3a6 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -14,7 +14,7 @@ use crate::payment_methods::CustomerPaymentMethodsListResponse; use crate::{events, payment_methods::CustomerPaymentMethodsListResponse}; use crate::{ payment_methods::{ - CustomerDefaultPaymentMethodResponse, DefaultPaymentMethod, ListCountriesCurrenciesRequest, + self, DefaultPaymentMethod, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse, PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, PaymentMethodCollectLinkResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest, PaymentMethodListResponse, @@ -211,7 +211,7 @@ impl ApiEventMetric for PaymentMethodResponse { #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { - payment_method_id: self.payment_method_id.clone(), + payment_method_id: self.id.clone(), payment_method: self.payment_method_type, payment_method_type: self.payment_method_subtype, }) @@ -234,7 +234,7 @@ impl ApiEventMetric for PaymentMethodMigrateResponse { #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { - payment_method_id: self.payment_method_response.payment_method_id.clone(), + payment_method_id: self.payment_method_response.id.clone(), payment_method: self.payment_method_response.payment_method_type, payment_method_type: self.payment_method_response.payment_method_subtype, }) @@ -253,6 +253,18 @@ impl ApiEventMetric for DefaultPaymentMethod { } } +#[cfg(feature = "v2")] +impl ApiEventMetric for PaymentMethodDeleteResponse { + fn get_api_event_type(&self) -> Option { + Some(ApiEventsType::PaymentMethod { + payment_method_id: self.id.clone(), + payment_method: None, + payment_method_type: None, + }) + } +} + +#[cfg(feature = "v1")] impl ApiEventMetric for PaymentMethodDeleteResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { @@ -282,7 +294,8 @@ impl ApiEventMetric for ListCountriesCurrenciesRequest {} impl ApiEventMetric for ListCountriesCurrenciesResponse {} impl ApiEventMetric for PaymentMethodListResponse {} -impl ApiEventMetric for CustomerDefaultPaymentMethodResponse { +#[cfg(feature = "v1")] +impl ApiEventMetric for payment_methods::CustomerDefaultPaymentMethodResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.default_payment_method_id.clone().unwrap_or_default(), diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 18d18f08fd24..0ed3cd6e9853 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -194,25 +194,14 @@ impl PaymentMethodIntentConfirm { } } +/// This struct is used internally only #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] -#[serde(deny_unknown_fields)] +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct PaymentMethodIntentConfirmInternal { - #[schema(value_type = Option, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")] - pub id: String, - /// The type of payment method use for the payment. - #[schema(value_type = PaymentMethod,example = "card")] + pub id: id_type::GlobalPaymentMethodId, pub payment_method_type: api_enums::PaymentMethod, - - /// This is a sub-category of payment method. - #[schema(value_type = PaymentMethodType,example = "credit")] pub payment_method_subtype: api_enums::PaymentMethodType, - - /// The unique identifier of the customer. - #[schema(value_type = Option, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")] pub customer_id: Option, - - /// Payment method data to be passed pub payment_method_data: PaymentMethodCreateData, } @@ -776,6 +765,10 @@ pub struct PaymentMethodResponse { #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema, Clone)] pub struct PaymentMethodResponse { + /// The unique identifier of the Payment method + #[schema(value_type = String, example = "card_rGK4Vi5iSW70MY7J2mIg")] + pub id: id_type::GlobalPaymentMethodId, + /// Unique identifier for a merchant #[schema(value_type = String, example = "merchant_1671528864")] pub merchant_id: id_type::MerchantId, @@ -789,10 +782,6 @@ pub struct PaymentMethodResponse { )] pub customer_id: id_type::GlobalCustomerId, - /// The unique identifier of the Payment method - #[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")] - pub payment_method_id: String, - /// The type of payment method use for the payment. #[schema(value_type = PaymentMethod, example = "card")] pub payment_method_type: Option, @@ -1043,6 +1032,19 @@ impl From for payments::AdditionalCardInfo { } } +#[cfg(feature = "v2")] +#[derive(Debug, serde::Serialize, ToSchema)] +pub struct PaymentMethodListResponse { + /// The list of payment methods that are enabled for the business profile + #[schema(value_type = Vec)] + pub payment_methods_enabled: Vec, + + /// The list of payment methods that are saved by the given customer + /// This field is only returned if the customer_id is provided in the request + #[schema(value_type = Option>)] + pub customer_payment_methods: Option>, +} + #[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") @@ -1272,9 +1274,6 @@ pub struct ResponsePaymentMethodTypes { /// Required fields for the payment_method_type. /// This is the union of all the required fields for the payment method type enabled in all the connectors. pub required_fields: Option>, - - /// surcharge details for this payment method type if exists - pub surcharge_details: Option, } #[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema)] @@ -1678,6 +1677,7 @@ fn set_or_reject_duplicate( } } +#[cfg(feature = "v1")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodListResponse { /// Redirect URL of the merchant @@ -1758,9 +1758,11 @@ pub struct PaymentMethodDeleteResponse { #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodDeleteResponse { /// The unique identifier of the Payment method - #[schema(example = "card_rGK4Vi5iSW70MY7J2mIg")] - pub payment_method_id: String, + #[schema(value_type = String, example = "card_rGK4Vi5iSW70MY7J2mIg")] + pub id: id_type::GlobalPaymentMethodId, } + +#[cfg(feature = "v1")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct CustomerDefaultPaymentMethodResponse { /// The unique identifier of the Payment method @@ -2046,12 +2048,22 @@ pub struct PaymentMethodId { pub payment_method_id: String, } +#[cfg(feature = "v1")] #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] pub struct DefaultPaymentMethod { #[schema(value_type = String, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")] pub customer_id: id_type::CustomerId, pub payment_method_id: String, } + +#[cfg(feature = "v2")] +#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] +pub struct DefaultPaymentMethod { + #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44")] + pub customer_id: id_type::GlobalCustomerId, + #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44")] + pub payment_method_id: id_type::GlobalPaymentMethodId, +} //------------------------------------------------TokenizeService------------------------------------------------ #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TokenizePayloadEncrypted { diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index a17189440954..163a684b6e11 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6559,7 +6559,7 @@ pub struct PaymentMethodsListRequest {} pub struct PaymentMethodListResponseForPayments { /// The list of payment methods that are enabled for the business profile #[schema(value_type = Vec)] - pub payment_methods_enabled: Vec, + pub payment_methods_enabled: Vec, /// The list of payment methods that are saved by the given customer /// This field is only returned if the customer_id is provided in the request @@ -6567,6 +6567,29 @@ pub struct PaymentMethodListResponseForPayments { pub customer_payment_methods: Option>, } +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] +pub struct ResponsePaymentMethodTypesForPayments { + /// The payment method type enabled + #[schema(example = "klarna", value_type = PaymentMethodType)] + pub payment_method_type: common_enums::PaymentMethod, + + /// The payment method subtype enabled + #[schema(example = "klarna", value_type = PaymentMethodType)] + pub payment_method_subtype: common_enums::PaymentMethodType, + + /// payment method subtype specific information + #[serde(flatten)] + pub extra_information: Option, + + /// Required fields for the payment_method_type. + /// This is the union of all the required fields for the payment method type enabled in all the connectors. + pub required_fields: Option>, + + /// surcharge details for this payment method type if exists + pub surcharge_details: Option, +} + #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] pub struct PaymentsExternalAuthenticationResponse { /// Indicates the transaction status diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs index 9494b8209e75..92adb6dc3c66 100644 --- a/crates/common_utils/src/events.rs +++ b/crates/common_utils/src/events.rs @@ -33,11 +33,18 @@ pub enum ApiEventsType { payment_id: id_type::GlobalPaymentId, refund_id: id_type::GlobalRefundId, }, + #[cfg(feature = "v1")] PaymentMethod { payment_method_id: String, payment_method: Option, payment_method_type: Option, }, + #[cfg(feature = "v2")] + PaymentMethod { + payment_method_id: id_type::GlobalPaymentMethodId, + payment_method: Option, + payment_method_type: Option, + }, #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] PaymentMethodCreate, #[cfg(all(feature = "v2", feature = "customer_v2"))] @@ -60,6 +67,10 @@ pub enum ApiEventsType { PaymentMethodList { payment_id: Option, }, + #[cfg(feature = "v2")] + PaymentMethodListForPaymentMethods { + payment_method_id: id_type::GlobalPaymentMethodId, + }, #[cfg(feature = "v1")] Webhooks { connector: String, 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 40bd6ec0df4a..a4fec5e836ae 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 @@ -1,9 +1,8 @@ use error_stack::ResultExt; use crate::{ - errors, errors::CustomResult, - id_type::global_id::{CellId, GlobalEntity, GlobalId, GlobalIdError}, + id_type::global_id::{CellId, GlobalEntity, GlobalId}, }; /// A global id that can be used to identify a payment method @@ -26,6 +25,16 @@ pub enum GlobalPaymentMethodIdError { ConstructionError, } +impl crate::events::ApiEventMetric for GlobalPaymentMethodId { + fn get_api_event_type(&self) -> Option { + Some( + crate::events::ApiEventsType::PaymentMethodListForPaymentMethods { + payment_method_id: self.clone(), + }, + ) + } +} + impl GlobalPaymentMethodId { /// Create a new GlobalPaymentMethodId from cell id information pub fn generate(cell_id: &CellId) -> error_stack::Result { diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index 7789c05e9902..33d168955d51 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -1,5 +1,3 @@ -#[cfg(feature = "v2")] -use api_models::admin; use common_utils::{ crypto::Encryptable, date_time, @@ -12,14 +10,10 @@ use common_utils::{ use diesel_models::{enums, merchant_connector_account::MerchantConnectorAccountUpdateInternal}; use error_stack::ResultExt; use masking::{PeekInterface, Secret}; -#[cfg(feature = "v2")] -use router_env::logger; use rustc_hash::FxHashMap; use serde_json::Value; use super::behaviour; -#[cfg(feature = "v2")] -use crate::errors::api_error_response::ApiErrorResponse; use crate::{ router_data, type_encryption::{crypto_operation, CryptoOperation}, diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 12b0fd003559..e357d31f7960 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -208,7 +208,6 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payment_methods::PaymentMethodDeleteResponse, api_models::payment_methods::PaymentMethodUpdate, api_models::payment_methods::PaymentMethodUpdateData, - api_models::payment_methods::CustomerDefaultPaymentMethodResponse, api_models::payment_methods::CardDetailFromLocker, api_models::payment_methods::PaymentMethodCreateData, api_models::payment_methods::CardDetail, diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index 6cdadf07320c..b3d5bafc2039 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1025,15 +1025,12 @@ pub async fn payment_method_intent_confirm( req: api::PaymentMethodIntentConfirm, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - pm_id: String, + pm_id: id_type::GlobalPaymentMethodId, ) -> RouterResponse { let key_manager_state = &(state).into(); req.validate()?; let db = &*state.store; - let pm_id = id_type::GlobalPaymentMethodId::generate_from_string(pm_id) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Unable to generate GlobalPaymentMethodId")?; let payment_method = db .find_payment_method( @@ -1131,6 +1128,141 @@ pub async fn payment_method_intent_confirm( Ok(services::ApplicationResponse::Json(response)) } +#[cfg(feature = "v2")] +trait PerformFilteringOnPaymentMethodsEnabled { + fn perform_filtering(self) -> FilteredPaymentMethodsEnabled; +} + +#[cfg(feature = "v2")] +impl PerformFilteringOnPaymentMethodsEnabled + for hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled +{ + fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { + FilteredPaymentMethodsEnabled(self.payment_methods_enabled) + } +} + +#[cfg(feature = "v2")] +/// Container for the inputs required for the required fields +struct RequiredFieldsInput {} + +#[cfg(feature = "v2")] +impl RequiredFieldsInput { + fn new() -> Self { + Self {} + } +} + +#[cfg(feature = "v2")] +/// Container for the filtered payment methods +struct FilteredPaymentMethodsEnabled( + Vec, +); + +#[cfg(feature = "v2")] +impl FilteredPaymentMethodsEnabled { + fn get_required_fields( + self, + _input: RequiredFieldsInput, + ) -> RequiredFieldsForEnabledPaymentMethodTypes { + let required_fields_info = self + .0 + .into_iter() + .map( + |payment_methods_enabled| RequiredFieldsForEnabledPaymentMethod { + required_field: None, + payment_method_type: payment_methods_enabled.payment_method, + payment_method_subtype: payment_methods_enabled + .payment_methods_enabled + .payment_method_subtype, + }, + ) + .collect(); + + RequiredFieldsForEnabledPaymentMethodTypes(required_fields_info) + } +} + +#[cfg(feature = "v2")] +/// Element container to hold the filtered payment methods with required fields +struct RequiredFieldsForEnabledPaymentMethod { + required_field: Option>, + payment_method_subtype: common_enums::PaymentMethodType, + payment_method_type: common_enums::PaymentMethod, +} + +#[cfg(feature = "v2")] +/// Container to hold the filtered payment methods enabled with required fields +struct RequiredFieldsForEnabledPaymentMethodTypes(Vec); + +#[cfg(feature = "v2")] +impl RequiredFieldsForEnabledPaymentMethodTypes { + fn generate_response(self) -> payment_methods::PaymentMethodListResponse { + let response_payment_methods = self + .0 + .into_iter() + .map( + |payment_methods_enabled| payment_methods::ResponsePaymentMethodTypes { + payment_method_type: payment_methods_enabled.payment_method_type, + payment_method_subtype: payment_methods_enabled.payment_method_subtype, + required_fields: payment_methods_enabled.required_field, + extra_information: None, + }, + ) + .collect(); + + payment_methods::PaymentMethodListResponse { + payment_methods_enabled: response_payment_methods, + customer_payment_methods: None, + } + } +} + +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[instrument(skip_all)] +pub async fn list_payment_methods( + state: SessionState, + merchant_account: domain::MerchantAccount, + key_store: domain::MerchantKeyStore, + profile: domain::Profile, + payment_method_id: id_type::GlobalPaymentMethodId, +) -> RouterResponse { + let key_manager_state = &(&state).into(); + + let db = &*state.store; + + db.find_payment_method( + key_manager_state, + &key_store, + &payment_method_id, + merchant_account.storage_scheme, + ) + .await + .change_context(errors::ApiErrorResponse::PaymentMethodNotFound) + .attach_printable("Unable to find payment method")?; + + let payment_connector_accounts = db + .list_enabled_connector_accounts_by_profile_id( + key_manager_state, + profile.get_id(), + &key_store, + common_enums::ConnectorType::PaymentProcessor, + ) + .await + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("error when fetching merchant connector accounts")?; + + let response = + hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts) + .perform_filtering() + .get_required_fields(RequiredFieldsInput::new()) + .generate_response(); + + Ok(hyperswitch_domain_models::api::ApplicationResponse::Json( + response, + )) +} + #[cfg(all( feature = "v2", feature = "payment_methods_v2", @@ -1787,7 +1919,7 @@ pub async fn retrieve_payment_method( let resp = api::PaymentMethodResponse { merchant_id: payment_method.merchant_id.to_owned(), customer_id: payment_method.customer_id.to_owned(), - payment_method_id: payment_method.id.get_string_repr().to_string(), + id: payment_method.id.to_owned(), payment_method_type: payment_method.get_payment_method_type(), payment_method_subtype: payment_method.get_payment_method_subtype(), created: Some(payment_method.created_at), @@ -1955,9 +2087,7 @@ pub async fn delete_payment_method( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to delete payment method from vault")?; - let response = api::PaymentMethodDeleteResponse { - payment_method_id: pm_id.get_string_repr().to_string(), - }; + let response = api::PaymentMethodDeleteResponse { id: pm_id }; Ok(services::ApplicationResponse::Json(response)) } diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 164c0e9557af..82240a265d1b 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -13,10 +13,9 @@ use api_models::{ enums as api_enums, payment_methods::{ BankAccountTokenData, Card, CardDetailUpdate, CardDetailsPaymentMethod, CardNetworkTypes, - CountryCodeWithName, CustomerDefaultPaymentMethodResponse, ListCountriesCurrenciesRequest, - ListCountriesCurrenciesResponse, MaskedBankDetails, PaymentExperienceTypes, - PaymentMethodsData, RequestPaymentMethodTypes, RequiredFieldInfo, - ResponsePaymentMethodIntermediate, ResponsePaymentMethodTypes, + CountryCodeWithName, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse, + MaskedBankDetails, PaymentExperienceTypes, PaymentMethodsData, RequestPaymentMethodTypes, + RequiredFieldInfo, ResponsePaymentMethodIntermediate, ResponsePaymentMethodTypes, ResponsePaymentMethodsEnabled, }, payments::BankCodeResponse, @@ -5511,18 +5510,6 @@ pub async fn get_bank_account_connector_details( } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] -pub async fn set_default_payment_method( - _state: &routes::SessionState, - _merchant_id: &id_type::MerchantId, - _key_store: domain::MerchantKeyStore, - _customer_id: &id_type::CustomerId, - _payment_method_id: String, - _storage_scheme: MerchantStorageScheme, -) -> errors::RouterResponse { - todo!() -} - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] pub async fn set_default_payment_method( state: &routes::SessionState, @@ -5531,7 +5518,7 @@ pub async fn set_default_payment_method( customer_id: &id_type::CustomerId, payment_method_id: String, storage_scheme: MerchantStorageScheme, -) -> errors::RouterResponse { +) -> errors::RouterResponse { let db = &*state.store; let key_manager_state = &state.into(); // check for the customer @@ -5599,7 +5586,7 @@ pub async fn set_default_payment_method( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to update the default payment method id for the customer")?; - let resp = CustomerDefaultPaymentMethodResponse { + let resp = api_models::payment_methods::CustomerDefaultPaymentMethodResponse { default_payment_method_id: updated_customer_details.default_payment_method_id, customer_id, payment_method_type: payment_method.get_payment_method_subtype(), diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs index ce95096a0fb3..4a43eef1ed66 100644 --- a/crates/router/src/core/payment_methods/transformers.rs +++ b/crates/router/src/core/payment_methods/transformers.rs @@ -567,7 +567,7 @@ pub fn generate_payment_method_response( let resp = api::PaymentMethodResponse { merchant_id: pm.merchant_id.to_owned(), customer_id: pm.customer_id.to_owned(), - payment_method_id: pm.id.get_string_repr().to_owned(), + id: pm.id.to_owned(), payment_method_type: pm.get_payment_method_type(), payment_method_subtype: pm.get_payment_method_subtype(), created: Some(pm.created_at), diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 6ed436ae3c77..33358cece03b 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -34,7 +34,7 @@ pub async fn list_payment_methods( .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; - validate_payment_status(payment_intent.status)?; + validate_payment_status_for_payment_method_list(payment_intent.status)?; let client_secret = header_payload .client_secret @@ -137,7 +137,7 @@ impl RequiredFieldsAndSurchargeForEnabledPaymentMethodTypes { .0 .into_iter() .map(|payment_methods_enabled| { - api_models::payment_methods::ResponsePaymentMethodTypes { + api_models::payments::ResponsePaymentMethodTypesForPayments { payment_method_type: payment_methods_enabled.payment_method_type, payment_method_subtype: payment_methods_enabled.payment_method_subtype, required_fields: payment_methods_enabled.required_field, @@ -188,7 +188,7 @@ impl PerformFilteringOnPaymentMethodsEnabled } /// Validate if payment methods list can be performed on the current status of payment intent -fn validate_payment_status( +fn validate_payment_status_for_payment_method_list( intent_status: common_enums::IntentStatus, ) -> Result<(), errors::ApiErrorResponse> { match intent_status { diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 26c785d25030..dfa3178d6038 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -1169,7 +1169,7 @@ impl PaymentMethods { ) .service( web::resource("/list-payment-methods") - .route(web::post().to(payment_methods::list_payment_methods)), + .route(web::get().to(payment_methods::list_payment_methods)), ) .service( web::resource("/confirm-intent") diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index de78711fee60..c20ccf5be3bf 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -135,7 +135,7 @@ pub async fn confirm_payment_method_intent_api( state: web::Data, req: HttpRequest, json_payload: web::Json, - path: web::Path, + path: web::Path, ) -> HttpResponse { let flow = Flow::PaymentMethodsCreate; let pm_id = path.into_inner(); @@ -147,7 +147,7 @@ pub async fn confirm_payment_method_intent_api( }; let inner_payload = payment_methods::PaymentMethodIntentConfirmInternal { - id: pm_id.clone(), + id: pm_id.to_owned(), payment_method_type: payload.payment_method_type, payment_method_subtype: payload.payment_method_subtype, customer_id: payload.customer_id.to_owned(), @@ -186,9 +186,31 @@ pub async fn list_payment_methods( path: web::Path, ) -> HttpResponse { let flow = Flow::PaymentMethodsList; - let pm_id = path.into_inner(); + let payment_method_id = path.into_inner(); + + let auth = match auth::is_ephemeral_or_publishible_auth(req.headers()) { + Ok(auth) => auth, + Err(e) => return api::log_and_return_error_response(e), + }; - todo!() + Box::pin(api::server_wrap( + flow, + state, + &req, + payment_method_id, + |state, auth: auth::AuthenticationData, payment_method_id, _| { + payment_methods_routes::list_payment_methods( + state, + auth.merchant_account, + auth.key_store, + auth.profile, + payment_method_id, + ) + }, + &*auth, + api_locking::LockAction::NotApplicable, + )) + .await } #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] @@ -534,7 +556,7 @@ pub async fn list_customer_payment_method_api( state: web::Data, customer_id: web::Path, req: HttpRequest, - query_payload: web::Query, + query_payload: web::Query, ) -> HttpResponse { let flow = Flow::CustomerPaymentMethodsList; let payload = query_payload.into_inner(); From 89f90c6a4f8019c42d981fdc32b4e9867c8b3af2 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Wed, 25 Dec 2024 10:27:11 +0000 Subject: [PATCH 38/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 128 ++++++----------------------- 1 file changed, 23 insertions(+), 105 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 636723d808a4..dbb199e0c636 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -7461,39 +7461,6 @@ }, "additionalProperties": false }, - "CustomerDefaultPaymentMethodResponse": { - "type": "object", - "required": [ - "customer_id", - "payment_method" - ], - "properties": { - "default_payment_method_id": { - "type": "string", - "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg", - "nullable": true - }, - "customer_id": { - "type": "string", - "description": "The unique identifier of the customer.", - "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 64, - "minLength": 1 - }, - "payment_method": { - "$ref": "#/components/schemas/PaymentMethod" - }, - "payment_method_type": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentMethodType" - } - ], - "nullable": true - } - } - }, "CustomerDeleteResponse": { "type": "object", "required": [ @@ -8003,12 +7970,15 @@ "properties": { "customer_id": { "type": "string", - "example": "cus_y3oqhf46pyzuxjbcn2giaqnb44", + "example": "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44", "maxLength": 64, "minLength": 1 }, "payment_method_id": { - "type": "string" + "type": "string", + "example": "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44", + "maxLength": 64, + "minLength": 1 } } }, @@ -13896,10 +13866,10 @@ "PaymentMethodDeleteResponse": { "type": "object", "required": [ - "payment_method_id" + "id" ], "properties": { - "payment_method_id": { + "id": { "type": "string", "description": "The unique identifier of the Payment method", "example": "card_rGK4Vi5iSW70MY7J2mIg" @@ -14079,67 +14049,23 @@ "PaymentMethodListResponse": { "type": "object", "required": [ - "currency", - "payment_methods", - "mandate_payment", - "show_surcharge_breakup_screen", - "request_external_three_ds_authentication", - "is_tax_calculation_enabled" + "payment_methods_enabled" ], "properties": { - "redirect_url": { - "type": "string", - "description": "Redirect URL of the merchant", - "example": "https://www.google.com", - "nullable": true - }, - "currency": { - "$ref": "#/components/schemas/Currency" - }, - "payment_methods": { + "payment_methods_enabled": { "type": "array", "items": { - "$ref": "#/components/schemas/ResponsePaymentMethodsEnabled" + "$ref": "#/components/schemas/ResponsePaymentMethodTypes" }, - "description": "Information about the payment method" - }, - "mandate_payment": { - "$ref": "#/components/schemas/MandateType" - }, - "merchant_name": { - "type": "string", - "nullable": true - }, - "show_surcharge_breakup_screen": { - "type": "boolean", - "description": "flag to indicate if surcharge and tax breakup screen should be shown or not" - }, - "payment_type": { - "allOf": [ - { - "$ref": "#/components/schemas/PaymentType" - } - ], - "nullable": true - }, - "request_external_three_ds_authentication": { - "type": "boolean", - "description": "flag to indicate whether to perform external 3ds authentication", - "example": true - }, - "collect_shipping_details_from_wallets": { - "type": "boolean", - "description": "flag that indicates whether to collect shipping details from wallets or from the customer", - "nullable": true + "description": "The list of payment methods that are enabled for the business profile" }, - "collect_billing_details_from_wallets": { - "type": "boolean", - "description": "flag that indicates whether to collect billing details from wallets or from the customer", + "customer_payment_methods": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerPaymentMethod" + }, + "description": "The list of payment methods that are saved by the given customer\nThis field is only returned if the customer_id is provided in the request", "nullable": true - }, - "is_tax_calculation_enabled": { - "type": "boolean", - "description": "flag that indicates whether to calculate tax on the order amount" } } }, @@ -14169,13 +14095,18 @@ "PaymentMethodResponse": { "type": "object", "required": [ + "id", "merchant_id", "customer_id", - "payment_method_id", "payment_method_type", "recurring_enabled" ], "properties": { + "id": { + "type": "string", + "description": "The unique identifier of the Payment method", + "example": "card_rGK4Vi5iSW70MY7J2mIg" + }, "merchant_id": { "type": "string", "description": "Unique identifier for a merchant", @@ -14188,11 +14119,6 @@ "maxLength": 64, "minLength": 32 }, - "payment_method_id": { - "type": "string", - "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg" - }, "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" }, @@ -19210,14 +19136,6 @@ "$ref": "#/components/schemas/RequiredFieldInfo" }, "nullable": true - }, - "surcharge_details": { - "allOf": [ - { - "$ref": "#/components/schemas/SurchargeDetailsResponse" - } - ], - "nullable": true } } } From 289b0e5418c54fe6e9ea6c5a03facfe6569dd618 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 25 Dec 2024 17:11:38 +0530 Subject: [PATCH 39/62] feat: add openapi endpoints for payment methods list --- .../payment-method--payment-methods-list.mdx | 3 + api-reference-v2/mint.json | 10 +- api-reference-v2/openapi_spec.json | 167 ++++++++++-------- crates/openapi/src/openapi_v2.rs | 5 +- crates/openapi/src/routes/payment_method.rs | 41 +++-- 5 files changed, 121 insertions(+), 105 deletions(-) create mode 100644 api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx new file mode 100644 index 000000000000..7131915402ac --- /dev/null +++ b/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v2/payment-methods/{id}/list-payment-methods +--- \ No newline at end of file diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json index 080adae5ad1c..706f90b97088 100644 --- a/api-reference-v2/mint.json +++ b/api-reference-v2/mint.json @@ -49,13 +49,13 @@ "group": "Payment Methods", "pages": [ "api-reference/payment-methods/payment-method--create", - "api-reference/payment-methods/payment-method--retrieve", - "api-reference/payment-methods/payment-method--update", - "api-reference/payment-methods/payment-method--delete", "api-reference/payment-methods/payment-method--create-intent", + "api-reference/payment-methods/payment-method--payment-methods-list", "api-reference/payment-methods/payment-method--confirm-intent", - "api-reference/payment-methods/list-customer-saved-payment-methods-for-a-payment", - "api-reference/payment-methods/list-payment-methods-for-a-customer" + "api-reference/payment-methods/payment-method--update", + "api-reference/payment-methods/payment-method--retrieve", + "api-reference/payment-methods/payment-method--delete", + "api-reference/payment-methods/list-saved-payment-methods-for-a-customer" ] }, { diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index dbb199e0c636..c55b7fe5f6ad 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -2190,62 +2190,19 @@ ] } }, - "/v2/payments/{id}/saved-payment-methods": { - "get": { - "tags": [ - "Payment Methods" - ], - "summary": "List customer saved payment methods for a payment", - "description": "To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment", - "operationId": "List all Payment Methods for a Customer", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodListRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" - } - } - } - }, - "400": { - "description": "Invalid Data" - }, - "404": { - "description": "Payment Methods does not exist in records" - } - }, - "security": [ - { - "publishable_key": [] - } - ] - } - }, - "/v2/customers/{id}/saved-payment-methods": { - "get": { + "/v2/payment-methods": { + "post": { "tags": [ "Payment Methods" ], - "summary": "List saved payment methods for a Customer", - "description": "To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context", - "operationId": "List all Payment Methods for a Customer", + "summary": "Payment Method - Create", + "description": "Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.", + "operationId": "Create Payment Method", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodListRequest" + "$ref": "#/components/schemas/PaymentMethodCreate" } } }, @@ -2253,20 +2210,17 @@ }, "responses": { "200": { - "description": "Payment Methods retrieved", + "description": "Payment Method Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" + "$ref": "#/components/schemas/PaymentMethodResponse" } } } }, "400": { "description": "Invalid Data" - }, - "404": { - "description": "Payment Methods does not exist in records" } }, "security": [ @@ -2276,19 +2230,19 @@ ] } }, - "/v2/payment-methods": { + "/v2/payment-methods/create-intent": { "post": { "tags": [ "Payment Methods" ], - "summary": "Payment Method - Create", - "description": "Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.", - "operationId": "Create Payment Method", + "summary": "Payment Method - Create Intent", + "description": "Creates a payment method for customer with billing information and other metadata.", + "operationId": "Create Payment Method Intent", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodCreate" + "$ref": "#/components/schemas/PaymentMethodIntentCreate" } } }, @@ -2296,7 +2250,7 @@ }, "responses": { "200": { - "description": "Payment Method Created", + "description": "Payment Method Intent Created", "content": { "application/json": { "schema": { @@ -2316,42 +2270,56 @@ ] } }, - "/v2/payment-methods/create-intent": { - "post": { + "/v2/payment-methods/{id}/list-payment-methods": { + "get": { "tags": [ "Payment Methods" ], - "summary": "Payment Method - Create Intent", - "description": "Creates a payment method for customer with billing information and other metadata.", - "operationId": "Create Payment Method Intent", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodIntentCreate" - } + "summary": "Payment Methods - Payment Methods List", + "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", + "operationId": "Retrieve Payment methods for a Payment Method Intent", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "The global payment method id", + "required": true, + "schema": { + "type": "string" } }, - "required": true - }, + { + "name": "X-Profile-Id", + "in": "header", + "description": "Profile ID associated to the payment method intent", + "required": true, + "schema": { + "type": "string" + }, + "example": { + "X-Profile-Id": "pro_abcdefghijklmnop" + } + } + ], "responses": { "200": { - "description": "Payment Method Intent Created", + "description": "Get the payment methods", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PaymentMethodResponse" + "$ref": "#/components/schemas/PaymentMethodListResponseForPayments" } } } }, - "400": { - "description": "Invalid Data" + "404": { + "description": "No payment method found with the given id" } }, "security": [ { - "api_key": [] + "api_key": [], + "ephemeral_key": [] } ] } @@ -2516,6 +2484,49 @@ ] } }, + "/v2/customers/{id}/saved-payment-methods": { + "get": { + "tags": [ + "Payment Methods" + ], + "summary": "List saved payment methods for a Customer", + "description": "To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context", + "operationId": "List all Payment Methods for a Customer", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaymentMethodListRequest" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Payment Methods retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" + } + } + } + }, + "400": { + "description": "Invalid Data" + }, + "404": { + "description": "Payment Methods does not exist in records" + } + }, + "security": [ + { + "api_key": [] + } + ] + } + }, "/v2/refunds": { "post": { "tags": [ diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index e357d31f7960..35cd1ed899aa 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -128,15 +128,14 @@ Never share your secret api keys. Keep them guarded and secure. routes::payments::list_payment_methods, //Routes for payment methods - routes::payment_method::list_customer_payment_method_for_payment, - routes::payment_method::list_customer_payment_method_api, routes::payment_method::create_payment_method_api, routes::payment_method::create_payment_method_intent_api, + routes::payment_method::list_payment_methods, routes::payment_method::confirm_payment_method_intent_api, routes::payment_method::payment_method_update_api, routes::payment_method::payment_method_retrieve_api, routes::payment_method::payment_method_delete_api, - + routes::payment_method::list_customer_payment_method_api, //Routes for refunds routes::refunds::refunds_create, diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs index b38a23426788..024d133e1ef5 100644 --- a/crates/openapi/src/routes/payment_method.rs +++ b/crates/openapi/src/routes/payment_method.rs @@ -322,46 +322,49 @@ pub async fn payment_method_update_api() {} #[cfg(feature = "v2")] pub async fn payment_method_delete_api() {} -/// List customer saved payment methods for a payment +/// List saved payment methods for a Customer /// -/// To filter and list the applicable payment methods for a particular Customer ID, is to be associated with a payment +/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context #[utoipa::path( get, - path = "/v2/payments/{id}/saved-payment-methods", + path = "/v2/customers/{id}/saved-payment-methods", request_body( content = PaymentMethodListRequest, // TODO: Add examples and add param for customer_id ), responses( - (status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", body = CustomerPaymentMethodsListResponse), + (status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse), (status = 400, description = "Invalid Data"), (status = 404, description = "Payment Methods does not exist in records") ), tag = "Payment Methods", operation_id = "List all Payment Methods for a Customer", - security(("publishable_key" = [])) + security(("api_key" = [])) )] #[cfg(feature = "v2")] -pub async fn list_customer_payment_method_for_payment() {} +pub async fn list_customer_payment_method_api() {} -/// List saved payment methods for a Customer +/// Payment Methods - Payment Methods List /// -/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context +/// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment +#[cfg(feature = "v2")] #[utoipa::path( get, - path = "/v2/customers/{id}/saved-payment-methods", - request_body( - content = PaymentMethodListRequest, - // TODO: Add examples and add param for customer_id + path = "/v2/payment-methods/{id}/list-payment-methods", + params( + ("id" = String, Path, description = "The global payment method id"), + ( + "X-Profile-Id" = String, Header, + description = "Profile ID associated to the payment method intent", + example = json!({"X-Profile-Id": "pro_abcdefghijklmnop"}) + ), ), responses( - (status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse), - (status = 400, description = "Invalid Data"), - (status = 404, description = "Payment Methods does not exist in records") + (status = 200, description = "Get the payment methods", body = PaymentMethodListResponseForPayments), + (status = 404, description = "No payment method found with the given id") ), tag = "Payment Methods", - operation_id = "List all Payment Methods for a Customer", - security(("api_key" = [])) + operation_id = "Retrieve Payment methods for a Payment Method Intent", + security(("api_key" = [], "ephemeral_key" = [])) )] -#[cfg(feature = "v2")] -pub async fn list_customer_payment_method_api() {} +pub fn list_payment_methods() {} From 3105443bfeaaff1bd37bb6e3f4736367820c65dd Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 2 Jan 2025 15:28:40 +0530 Subject: [PATCH 40/62] chore: address PR comments --- config/development.toml | 2 +- crates/api_models/src/events.rs | 4 ++-- crates/api_models/src/events/payment.rs | 11 ++++++----- crates/api_models/src/payment_methods.rs | 6 ++---- crates/api_models/src/payments.rs | 3 +-- crates/common_utils/src/events.rs | 4 ++-- crates/openapi/src/openapi.rs | 4 ++-- crates/openapi/src/routes.rs | 5 ----- crates/router/src/routes/app.rs | 2 +- 9 files changed, 17 insertions(+), 24 deletions(-) diff --git a/config/development.toml b/config/development.toml index 8245008bb83e..a3521da2e242 100644 --- a/config/development.toml +++ b/config/development.toml @@ -71,7 +71,7 @@ applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT" [locker] host = "http://127.0.0.1:3000" host_rs = "http://127.0.0.1:3000" -mock_locker = false +mock_locker = true basilisk_host = "http://127.0.0.1:3000" locker_enabled = false diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index 72a0d592513f..ea173d5b6303 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -184,8 +184,8 @@ impl ApiEventMetric for PaymentMethodIntentConfirmInternal { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), - payment_method: Some(self.payment_method_type), - payment_method_type: Some(self.payment_method_subtype), + payment_method_type: Some(self.payment_method_type), + payment_method_subtype: Some(self.payment_method_subtype), }) } } diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index e749e5d1b3a6..333a134e7fd5 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -212,8 +212,8 @@ impl ApiEventMetric for PaymentMethodResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), - payment_method: self.payment_method_type, - payment_method_type: self.payment_method_subtype, + payment_method_type: self.payment_method_type, + payment_method_subtype: self.payment_method_subtype, }) } } @@ -235,14 +235,15 @@ impl ApiEventMetric for PaymentMethodMigrateResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_response.id.clone(), - payment_method: self.payment_method_response.payment_method_type, - payment_method_type: self.payment_method_response.payment_method_subtype, + payment_method_type: self.payment_method_response.payment_method_type, + payment_method_subtype: self.payment_method_response.payment_method_subtype, }) } } impl ApiEventMetric for PaymentMethodUpdate {} +#[cfg(feature = "v1")] impl ApiEventMetric for DefaultPaymentMethod { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { @@ -258,8 +259,8 @@ impl ApiEventMetric for PaymentMethodDeleteResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), - payment_method: None, payment_method_type: None, + payment_method_subtype: None, }) } } diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 0ed3cd6e9853..9c80094247e5 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -766,7 +766,7 @@ pub struct PaymentMethodResponse { #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema, Clone)] pub struct PaymentMethodResponse { /// The unique identifier of the Payment method - #[schema(value_type = String, example = "card_rGK4Vi5iSW70MY7J2mIg")] + #[schema(value_type = String, example = "12345_pm_01926c58bc6e77c09e809964e72af8c8")] pub id: id_type::GlobalPaymentMethodId, /// Unique identifier for a merchant @@ -1036,12 +1036,10 @@ impl From for payments::AdditionalCardInfo { #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodListResponse { /// The list of payment methods that are enabled for the business profile - #[schema(value_type = Vec)] pub payment_methods_enabled: Vec, /// The list of payment methods that are saved by the given customer /// This field is only returned if the customer_id is provided in the request - #[schema(value_type = Option>)] pub customer_payment_methods: Option>, } @@ -1758,7 +1756,7 @@ pub struct PaymentMethodDeleteResponse { #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodDeleteResponse { /// The unique identifier of the Payment method - #[schema(value_type = String, example = "card_rGK4Vi5iSW70MY7J2mIg")] + #[schema(value_type = String, example = "12345_pm_01926c58bc6e77c09e809964e72af8c8")] pub id: id_type::GlobalPaymentMethodId, } diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 163a684b6e11..4bf09c221322 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6558,7 +6558,6 @@ pub struct PaymentMethodsListRequest {} #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodListResponseForPayments { /// The list of payment methods that are enabled for the business profile - #[schema(value_type = Vec)] pub payment_methods_enabled: Vec, /// The list of payment methods that are saved by the given customer @@ -6571,7 +6570,7 @@ pub struct PaymentMethodListResponseForPayments { #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypesForPayments { /// The payment method type enabled - #[schema(example = "klarna", value_type = PaymentMethodType)] + #[schema(example = "klarna", value_type = PaymentMethod)] pub payment_method_type: common_enums::PaymentMethod, /// The payment method subtype enabled diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs index 92adb6dc3c66..0ce351698d64 100644 --- a/crates/common_utils/src/events.rs +++ b/crates/common_utils/src/events.rs @@ -42,8 +42,8 @@ pub enum ApiEventsType { #[cfg(feature = "v2")] PaymentMethod { payment_method_id: id_type::GlobalPaymentMethodId, - payment_method: Option, - payment_method_type: Option, + payment_method_type: Option, + payment_method_subtype: Option, }, #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] PaymentMethodCreate, diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index 2f068b5609b8..32c2402e1081 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -85,8 +85,8 @@ Never share your secret api keys. Keep them guarded and secure. routes::payments::payments_post_session_tokens, // Routes for relay - routes::relay, - routes::relay_retrieve, + routes::relay::relay, + routes::relay::relay_retrieve, // Routes for refunds routes::refunds::refunds_create, diff --git a/crates/openapi/src/routes.rs b/crates/openapi/src/routes.rs index 2c1c58244124..4486df82b00b 100644 --- a/crates/openapi/src/routes.rs +++ b/crates/openapi/src/routes.rs @@ -19,8 +19,3 @@ pub mod refunds; pub mod relay; pub mod routing; pub mod webhook_events; - -pub use self::{ - customers::*, mandates::*, merchant_account::*, merchant_connector_account::*, organization::*, - payment_method::*, payments::*, poll::*, refunds::*, relay::*, routing::*, webhook_events::*, -}; diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index dfa3178d6038..65e53a47f2b4 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -1177,7 +1177,7 @@ impl PaymentMethods { ) .service( web::resource("/update-saved-payment-method") - .route(web::patch().to(payment_methods::payment_method_update_api)), + .route(web::put().to(payment_methods::payment_method_update_api)), ), ); From 96b4d958f7f8918736b5a5b679fd1b21c5a469da Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 2 Jan 2025 17:04:08 +0530 Subject: [PATCH 41/62] fix: openapi --- crates/api_models/src/payment_methods.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 9c80094247e5..37a154893016 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1258,7 +1258,7 @@ pub enum PaymentMethodSubtypeSpecificData { #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypes { /// The payment method type enabled - #[schema(example = "klarna", value_type = PaymentMethodType)] + #[schema(example = "pay_later", value_type = PaymentMethod)] pub payment_method_type: common_enums::PaymentMethod, /// The payment method subtype enabled From 4684a97c4e932e9cd4431bbad532bed98b6b8ac5 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 3 Jan 2025 15:06:35 +0530 Subject: [PATCH 42/62] feat: add required fields support for payment methods --- Cargo.lock | 1 + config/payment_required_fields.toml | 16 + crates/api_models/src/admin.rs | 6 +- crates/api_models/src/connector_enums.rs | 321 +------------- crates/api_models/src/payment_methods.rs | 2 +- crates/common_enums/src/connector_enums.rs | 410 +++++++++++++++++- crates/common_utils/src/events.rs | 9 +- .../src/merchant_connector_account.rs | 4 +- .../src/merchant_connector_account.rs | 13 +- crates/router/Cargo.toml | 1 + .../payment_connector_required_fields.rs | 15 +- .../defaults/payout_required_fields.rs | 9 + crates/router/src/configs/settings.rs | 12 + crates/router/src/core/admin.rs | 42 +- crates/router/src/core/disputes.rs | 1 + crates/router/src/core/payment_methods.rs | 83 +++- .../src/core/payments/flows/session_flow.rs | 38 ++ crates/router/src/core/payments/helpers.rs | 3 +- .../router/src/core/payouts/transformers.rs | 1 + crates/router/src/core/relay.rs | 18 +- crates/router/src/core/relay/utils.rs | 7 +- crates/router/src/core/routing/helpers.rs | 31 +- .../src/core/user/dashboard_metadata.rs | 2 + .../router/src/core/webhooks/incoming_v2.rs | 7 +- .../src/db/merchant_connector_account.rs | 6 +- crates/router/src/routes/disputes.rs | 1 + crates/router/src/routes/user.rs | 1 + 27 files changed, 660 insertions(+), 400 deletions(-) create mode 100644 config/payment_required_fields.toml diff --git a/Cargo.lock b/Cargo.lock index e34c80bd9278..ce3065c68071 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6635,6 +6635,7 @@ dependencies = [ "thiserror", "time", "tokio 1.40.0", + "toml 0.8.19", "totp-rs", "tracing-futures", "unicode-segmentation", diff --git a/config/payment_required_fields.toml b/config/payment_required_fields.toml new file mode 100644 index 000000000000..8cc5e62c3561 --- /dev/null +++ b/config/payment_required_fields.toml @@ -0,0 +1,16 @@ +[[required_fields.card.credit.fields.stripe.common]] +required_field = "payment_method_data.card.card_number" +display_name = "card_number" +field_type = "user_card_number" +[[required_fields.card.credit.fields.stripe.common]] +required_field = "payment_method_data.card.card_exp_year" +display_name = "card_exp_year" +field_type = "user_card_expiry_year" +[[required_fields.card.credit.fields.stripe.common]] +required_field = "payment_method_data.card.card_cvc" +display_name = "card_cvc" +field_type = "user_card_cvc" +[[required_fields.card.credit.fields.stripe.common]] +required_field = "payment_method_data.card.card_exp_month" +display_name = "card_exp_month" +field_type = "user_card_expiry_month" diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index ef25a4350d95..cbd44c15699b 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -1009,9 +1009,10 @@ 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(value_type = Connector, example = "stripe")] - pub connector_name: String, + pub connector_name: common_enums::connector_enums::Connector, /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] @@ -1310,9 +1311,10 @@ pub struct MerchantConnectorListResponse { /// 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(value_type = Connector, example = "stripe")] - pub connector_name: String, + pub connector_name: common_enums::connector_enums::Connector, /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] diff --git a/crates/api_models/src/connector_enums.rs b/crates/api_models/src/connector_enums.rs index 3a3fe5e8f429..668c62c0c3ab 100644 --- a/crates/api_models/src/connector_enums.rs +++ b/crates/api_models/src/connector_enums.rs @@ -1,320 +1 @@ -pub use common_enums::enums::{PaymentMethod, PayoutType}; -#[cfg(feature = "dummy_connector")] -use common_utils::errors; -use utoipa::ToSchema; - -/// A connector is an integration to fulfill payments -#[derive( - Clone, - Copy, - Debug, - Eq, - PartialEq, - ToSchema, - serde::Deserialize, - serde::Serialize, - strum::VariantNames, - strum::EnumIter, - strum::Display, - strum::EnumString, - Hash, -)] -#[serde(rename_all = "snake_case")] -#[strum(serialize_all = "snake_case")] -pub enum Connector { - Adyenplatform, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "phonypay")] - #[strum(serialize = "phonypay")] - DummyConnector1, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "fauxpay")] - #[strum(serialize = "fauxpay")] - DummyConnector2, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "pretendpay")] - #[strum(serialize = "pretendpay")] - DummyConnector3, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "stripe_test")] - #[strum(serialize = "stripe_test")] - DummyConnector4, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "adyen_test")] - #[strum(serialize = "adyen_test")] - DummyConnector5, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "checkout_test")] - #[strum(serialize = "checkout_test")] - DummyConnector6, - #[cfg(feature = "dummy_connector")] - #[serde(rename = "paypal_test")] - #[strum(serialize = "paypal_test")] - DummyConnector7, - Aci, - Adyen, - Airwallex, - // Amazonpay, - Authorizedotnet, - Bambora, - Bamboraapac, - Bankofamerica, - Billwerk, - Bitpay, - Bluesnap, - Boku, - Braintree, - Cashtocode, - Checkout, - Coinbase, - Cryptopay, - CtpMastercard, - Cybersource, - Datatrans, - Deutschebank, - Digitalvirgo, - Dlocal, - Ebanx, - Elavon, - Fiserv, - Fiservemea, - Fiuu, - Forte, - Globalpay, - Globepay, - Gocardless, - Gpayments, - Helcim, - // Inespay, - Iatapay, - Itaubank, - Jpmorgan, - Klarna, - Mifinity, - Mollie, - Multisafepay, - Netcetera, - Nexinets, - Nexixpay, - Nmi, - // Nomupay, - Noon, - Novalnet, - Nuvei, - // Opayo, added as template code for future usage - Opennode, - Paybox, - // Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage - Payme, - Payone, - Paypal, - Payu, - Placetopay, - Powertranz, - Prophetpay, - Rapyd, - Razorpay, - // Redsys, - Shift4, - Square, - Stax, - Stripe, - Taxjar, - Threedsecureio, - //Thunes, - Trustpay, - Tsys, - // UnifiedAuthenticationService, - Volt, - Wellsfargo, - // Wellsfargopayout, - Wise, - Worldline, - Worldpay, - Signifyd, - Plaid, - Riskified, - // Xendit, - Zen, - Zsl, -} - -impl Connector { - #[cfg(feature = "payouts")] - pub fn supports_instant_payout(self, payout_method: Option) -> bool { - matches!( - (self, payout_method), - (Self::Paypal, Some(PayoutType::Wallet)) - | (_, Some(PayoutType::Card)) - | (Self::Adyenplatform, _) - ) - } - #[cfg(feature = "payouts")] - pub fn supports_create_recipient(self, payout_method: Option) -> bool { - matches!((self, payout_method), (_, Some(PayoutType::Bank))) - } - #[cfg(feature = "payouts")] - pub fn supports_payout_eligibility(self, payout_method: Option) -> bool { - matches!((self, payout_method), (_, Some(PayoutType::Card))) - } - #[cfg(feature = "payouts")] - pub fn is_payout_quote_call_required(self) -> bool { - matches!(self, Self::Wise) - } - #[cfg(feature = "payouts")] - pub fn supports_access_token_for_payout(self, payout_method: Option) -> bool { - matches!((self, payout_method), (Self::Paypal, _)) - } - #[cfg(feature = "payouts")] - pub fn supports_vendor_disburse_account_create_for_payout(self) -> bool { - matches!(self, Self::Stripe) - } - pub fn supports_access_token(self, payment_method: PaymentMethod) -> bool { - matches!( - (self, payment_method), - (Self::Airwallex, _) - | (Self::Deutschebank, _) - | (Self::Globalpay, _) - | (Self::Jpmorgan, _) - | (Self::Paypal, _) - | (Self::Payu, _) - | (Self::Trustpay, PaymentMethod::BankRedirect) - | (Self::Iatapay, _) - | (Self::Volt, _) - | (Self::Itaubank, _) - ) - } - pub fn supports_file_storage_module(self) -> bool { - matches!(self, Self::Stripe | Self::Checkout) - } - pub fn requires_defend_dispute(self) -> bool { - matches!(self, Self::Checkout) - } - pub fn is_separate_authentication_supported(self) -> bool { - match self { - #[cfg(feature = "dummy_connector")] - Self::DummyConnector1 - | Self::DummyConnector2 - | Self::DummyConnector3 - | Self::DummyConnector4 - | Self::DummyConnector5 - | Self::DummyConnector6 - | Self::DummyConnector7 => false, - Self::Aci - // Add Separate authentication support for connectors - | Self::Adyen - | Self::Adyenplatform - | Self::Airwallex - // | Self::Amazonpay - | Self::Authorizedotnet - | Self::Bambora - | Self::Bamboraapac - | Self::Bankofamerica - | Self::Billwerk - | Self::Bitpay - | Self::Bluesnap - | Self::Boku - | Self::Braintree - | Self::Cashtocode - | Self::Coinbase - | Self::Cryptopay - | Self::Deutschebank - | Self::Digitalvirgo - | Self::Dlocal - | Self::Ebanx - | Self::Elavon - | Self::Fiserv - | Self::Fiservemea - | Self::Fiuu - | Self::Forte - | Self::Globalpay - | Self::Globepay - | Self::Gocardless - | Self::Gpayments - | Self::Helcim - | Self::Iatapay - // | Self::Inespay - | Self::Itaubank - | Self::Jpmorgan - | Self::Klarna - | Self::Mifinity - | Self::Mollie - | Self::Multisafepay - | Self::Nexinets - | Self::Nexixpay - // | Self::Nomupay - | Self::Novalnet - | Self::Nuvei - | Self::Opennode - | Self::Paybox - | Self::Payme - | Self::Payone - | Self::Paypal - | Self::Payu - | Self::Placetopay - | Self::Powertranz - | Self::Prophetpay - | Self::Rapyd - // | Self::Redsys - | Self::Shift4 - | Self::Square - | Self::Stax - | Self::Taxjar - // | Self::Thunes - | Self::Trustpay - | Self::Tsys - // | Self::UnifiedAuthenticationService - | Self::Volt - | Self::Wellsfargo - // | Self::Wellsfargopayout - | Self::Wise - | Self::Worldline - | Self::Worldpay - // | Self::Xendit - | Self::Zen - | Self::Zsl - | Self::Signifyd - | Self::Plaid - | Self::Razorpay - | Self::Riskified - | Self::Threedsecureio - | Self::Datatrans - | Self::Netcetera - | Self::CtpMastercard - | Self::Noon - | Self::Stripe => false, - Self::Checkout | Self::Nmi | Self::Cybersource => true, - } - } - pub fn is_pre_processing_required_before_authorize(self) -> bool { - matches!(self, Self::Airwallex) - } - pub fn should_acknowledge_webhook_for_resource_not_found_errors(self) -> bool { - matches!(self, Self::Adyenplatform) - } - #[cfg(feature = "dummy_connector")] - pub fn validate_dummy_connector_enabled( - self, - is_dummy_connector_enabled: bool, - ) -> errors::CustomResult<(), errors::ValidationError> { - if !is_dummy_connector_enabled - && matches!( - self, - Self::DummyConnector1 - | Self::DummyConnector2 - | Self::DummyConnector3 - | Self::DummyConnector4 - | Self::DummyConnector5 - | Self::DummyConnector6 - | Self::DummyConnector7 - ) - { - Err(errors::ValidationError::InvalidValue { - message: "Invalid connector name".to_string(), - } - .into()) - } else { - Ok(()) - } - } -} +pub use common_enums::connector_enums::Connector; diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 37a154893016..3aecd0fe4f5f 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1271,7 +1271,7 @@ pub struct ResponsePaymentMethodTypes { /// Required fields for the payment_method_type. /// This is the union of all the required fields for the payment method type enabled in all the connectors. - pub required_fields: Option>, + pub required_fields: Vec, } #[derive(Clone, Debug, PartialEq, serde::Serialize, ToSchema)] diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs index 127d5a9901c6..5cc9ec1ea0e3 100644 --- a/crates/common_enums/src/connector_enums.rs +++ b/crates/common_enums/src/connector_enums.rs @@ -1,4 +1,6 @@ +pub use super::enums::{PaymentMethod, PayoutType}; use utoipa::ToSchema; + #[derive( Clone, Copy, @@ -17,7 +19,7 @@ use utoipa::ToSchema; #[router_derive::diesel_enum(storage_type = "db_enum")] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] -/// Connectors eligible for payments routing +/// RoutableConnectors are the subset of Connectors that are eligible for payments routing pub enum RoutableConnectors { Adyenplatform, #[cfg(feature = "dummy_connector")] @@ -127,8 +129,412 @@ pub enum RoutableConnectors { Wise, Worldline, Worldpay, - Xendit, + // Xendit, Zen, Plaid, Zsl, } + +// A connector is an integration to fulfill payments +#[derive( + Clone, + Copy, + Debug, + Eq, + PartialEq, + ToSchema, + serde::Deserialize, + serde::Serialize, + strum::VariantNames, + strum::EnumIter, + strum::Display, + strum::EnumString, + Hash, +)] +#[router_derive::diesel_enum(storage_type = "text")] +#[serde(rename_all = "snake_case")] +#[strum(serialize_all = "snake_case")] +pub enum Connector { + Adyenplatform, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "phonypay")] + #[strum(serialize = "phonypay")] + DummyConnector1, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "fauxpay")] + #[strum(serialize = "fauxpay")] + DummyConnector2, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "pretendpay")] + #[strum(serialize = "pretendpay")] + DummyConnector3, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "stripe_test")] + #[strum(serialize = "stripe_test")] + DummyConnector4, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "adyen_test")] + #[strum(serialize = "adyen_test")] + DummyConnector5, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "checkout_test")] + #[strum(serialize = "checkout_test")] + DummyConnector6, + #[cfg(feature = "dummy_connector")] + #[serde(rename = "paypal_test")] + #[strum(serialize = "paypal_test")] + DummyConnector7, + Aci, + Adyen, + Airwallex, + // Amazonpay, + Authorizedotnet, + Bambora, + Bamboraapac, + Bankofamerica, + Billwerk, + Bitpay, + Bluesnap, + Boku, + Braintree, + Cashtocode, + Checkout, + Coinbase, + Cryptopay, + CtpMastercard, + Cybersource, + Datatrans, + Deutschebank, + Digitalvirgo, + Dlocal, + Ebanx, + Elavon, + Fiserv, + Fiservemea, + Fiuu, + Forte, + Globalpay, + Globepay, + Gocardless, + Gpayments, + Helcim, + // Inespay, + Iatapay, + Itaubank, + Jpmorgan, + Klarna, + Mifinity, + Mollie, + Multisafepay, + Netcetera, + Nexinets, + Nexixpay, + Nmi, + // Nomupay, + Noon, + Novalnet, + Nuvei, + // Opayo, added as template code for future usage + Opennode, + Paybox, + // Payeezy, As psync and rsync are not supported by this connector, it is added as template code for future usage + Payme, + Payone, + Paypal, + Payu, + Placetopay, + Powertranz, + Prophetpay, + Rapyd, + Razorpay, + // Redsys, + Shift4, + Square, + Stax, + Stripe, + Taxjar, + Threedsecureio, + //Thunes, + Trustpay, + Tsys, + // UnifiedAuthenticationService, + Volt, + Wellsfargo, + // Wellsfargopayout, + Wise, + Worldline, + Worldpay, + Signifyd, + Plaid, + Riskified, + // Xendit, + Zen, + Zsl, +} + +impl Connector { + #[cfg(feature = "payouts")] + pub fn supports_instant_payout(self, payout_method: Option) -> bool { + matches!( + (self, payout_method), + (Self::Paypal, Some(PayoutType::Wallet)) + | (_, Some(PayoutType::Card)) + | (Self::Adyenplatform, _) + ) + } + #[cfg(feature = "payouts")] + pub fn supports_create_recipient(self, payout_method: Option) -> bool { + matches!((self, payout_method), (_, Some(PayoutType::Bank))) + } + #[cfg(feature = "payouts")] + pub fn supports_payout_eligibility(self, payout_method: Option) -> bool { + matches!((self, payout_method), (_, Some(PayoutType::Card))) + } + #[cfg(feature = "payouts")] + pub fn is_payout_quote_call_required(self) -> bool { + matches!(self, Self::Wise) + } + #[cfg(feature = "payouts")] + pub fn supports_access_token_for_payout(self, payout_method: Option) -> bool { + matches!((self, payout_method), (Self::Paypal, _)) + } + #[cfg(feature = "payouts")] + pub fn supports_vendor_disburse_account_create_for_payout(self) -> bool { + matches!(self, Self::Stripe) + } + pub fn supports_access_token(self, payment_method: PaymentMethod) -> bool { + matches!( + (self, payment_method), + (Self::Airwallex, _) + | (Self::Deutschebank, _) + | (Self::Globalpay, _) + | (Self::Jpmorgan, _) + | (Self::Paypal, _) + | (Self::Payu, _) + | (Self::Trustpay, PaymentMethod::BankRedirect) + | (Self::Iatapay, _) + | (Self::Volt, _) + | (Self::Itaubank, _) + ) + } + pub fn supports_file_storage_module(self) -> bool { + matches!(self, Self::Stripe | Self::Checkout) + } + pub fn requires_defend_dispute(self) -> bool { + matches!(self, Self::Checkout) + } + pub fn is_separate_authentication_supported(self) -> bool { + match self { + #[cfg(feature = "dummy_connector")] + Self::DummyConnector1 + | Self::DummyConnector2 + | Self::DummyConnector3 + | Self::DummyConnector4 + | Self::DummyConnector5 + | Self::DummyConnector6 + | Self::DummyConnector7 => false, + Self::Aci + // Add Separate authentication support for connectors + | Self::Adyen + | Self::Adyenplatform + | Self::Airwallex + // | Self::Amazonpay + | Self::Authorizedotnet + | Self::Bambora + | Self::Bamboraapac + | Self::Bankofamerica + | Self::Billwerk + | Self::Bitpay + | Self::Bluesnap + | Self::Boku + | Self::Braintree + | Self::Cashtocode + | Self::Coinbase + | Self::Cryptopay + | Self::Deutschebank + | Self::Digitalvirgo + | Self::Dlocal + | Self::Ebanx + | Self::Elavon + | Self::Fiserv + | Self::Fiservemea + | Self::Fiuu + | Self::Forte + | Self::Globalpay + | Self::Globepay + | Self::Gocardless + | Self::Gpayments + | Self::Helcim + | Self::Iatapay + // | Self::Inespay + | Self::Itaubank + | Self::Jpmorgan + | Self::Klarna + | Self::Mifinity + | Self::Mollie + | Self::Multisafepay + | Self::Nexinets + | Self::Nexixpay + // | Self::Nomupay + | Self::Novalnet + | Self::Nuvei + | Self::Opennode + | Self::Paybox + | Self::Payme + | Self::Payone + | Self::Paypal + | Self::Payu + | Self::Placetopay + | Self::Powertranz + | Self::Prophetpay + | Self::Rapyd + // | Self::Redsys + | Self::Shift4 + | Self::Square + | Self::Stax + | Self::Taxjar + // | Self::Thunes + | Self::Trustpay + | Self::Tsys + // | Self::UnifiedAuthenticationService + | Self::Volt + | Self::Wellsfargo + // | Self::Wellsfargopayout + | Self::Wise + | Self::Worldline + | Self::Worldpay + // | Self::Xendit + | Self::Zen + | Self::Zsl + | Self::Signifyd + | Self::Plaid + | Self::Razorpay + | Self::Riskified + | Self::Threedsecureio + | Self::Datatrans + | Self::Netcetera + | Self::CtpMastercard + | Self::Noon + | Self::Stripe => false, + Self::Checkout | Self::Nmi | Self::Cybersource => true, + } + } + + pub fn is_pre_processing_required_before_authorize(self) -> bool { + matches!(self, Self::Airwallex) + } + + pub fn should_acknowledge_webhook_for_resource_not_found_errors(self) -> bool { + matches!(self, Self::Adyenplatform) + } + + /// Validates if dummy connector can be created + /// Dummy connectors can be created only if dummy_connector feature is enabled in the configs + #[cfg(feature = "dummy_connector")] + pub fn validate_dummy_connector_create(self, is_dummy_connector_enabled: bool) -> bool { + matches!( + self, + Self::DummyConnector1 + | Self::DummyConnector2 + | Self::DummyConnector3 + | Self::DummyConnector4 + | Self::DummyConnector5 + | Self::DummyConnector6 + | Self::DummyConnector7 + ) && !is_dummy_connector_enabled + } +} + +/// Convert the RoutableConnectors to Connector +impl From for Connector { + fn from(routable_connector: RoutableConnectors) -> Self { + match routable_connector { + RoutableConnectors::Adyenplatform => Self::Adyenplatform, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector1 => Self::DummyConnector1, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector2 => Self::DummyConnector2, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector3 => Self::DummyConnector3, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector4 => Self::DummyConnector4, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector5 => Self::DummyConnector5, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector6 => Self::DummyConnector6, + #[cfg(feature = "dummy_connector")] + RoutableConnectors::DummyConnector7 => Self::DummyConnector7, + RoutableConnectors::Aci => Self::Aci, + RoutableConnectors::Adyen => Self::Adyen, + RoutableConnectors::Airwallex => Self::Airwallex, + RoutableConnectors::Authorizedotnet => Self::Authorizedotnet, + RoutableConnectors::Bankofamerica => Self::Bankofamerica, + RoutableConnectors::Billwerk => Self::Billwerk, + RoutableConnectors::Bitpay => Self::Bitpay, + RoutableConnectors::Bambora => Self::Bambora, + RoutableConnectors::Bamboraapac => Self::Bamboraapac, + RoutableConnectors::Bluesnap => Self::Bluesnap, + RoutableConnectors::Boku => Self::Boku, + RoutableConnectors::Braintree => Self::Braintree, + RoutableConnectors::Cashtocode => Self::Cashtocode, + RoutableConnectors::Checkout => Self::Checkout, + RoutableConnectors::Coinbase => Self::Coinbase, + RoutableConnectors::Cryptopay => Self::Cryptopay, + RoutableConnectors::Cybersource => Self::Cybersource, + RoutableConnectors::Datatrans => Self::Datatrans, + RoutableConnectors::Deutschebank => Self::Deutschebank, + RoutableConnectors::Digitalvirgo => Self::Digitalvirgo, + RoutableConnectors::Dlocal => Self::Dlocal, + RoutableConnectors::Ebanx => Self::Ebanx, + RoutableConnectors::Elavon => Self::Elavon, + RoutableConnectors::Fiserv => Self::Fiserv, + RoutableConnectors::Fiservemea => Self::Fiservemea, + RoutableConnectors::Fiuu => Self::Fiuu, + RoutableConnectors::Forte => Self::Forte, + RoutableConnectors::Globalpay => Self::Globalpay, + RoutableConnectors::Globepay => Self::Globepay, + RoutableConnectors::Gocardless => Self::Gocardless, + RoutableConnectors::Helcim => Self::Helcim, + RoutableConnectors::Iatapay => Self::Iatapay, + RoutableConnectors::Itaubank => Self::Itaubank, + RoutableConnectors::Jpmorgan => Self::Jpmorgan, + RoutableConnectors::Klarna => Self::Klarna, + RoutableConnectors::Mifinity => Self::Mifinity, + RoutableConnectors::Mollie => Self::Mollie, + RoutableConnectors::Multisafepay => Self::Multisafepay, + RoutableConnectors::Nexinets => Self::Nexinets, + RoutableConnectors::Nexixpay => Self::Nexixpay, + RoutableConnectors::Nmi => Self::Nmi, + RoutableConnectors::Noon => Self::Noon, + RoutableConnectors::Novalnet => Self::Novalnet, + RoutableConnectors::Nuvei => Self::Nuvei, + RoutableConnectors::Opennode => Self::Opennode, + RoutableConnectors::Paybox => Self::Paybox, + RoutableConnectors::Payme => Self::Payme, + RoutableConnectors::Payone => Self::Payone, + RoutableConnectors::Paypal => Self::Paypal, + RoutableConnectors::Payu => Self::Payu, + RoutableConnectors::Placetopay => Self::Placetopay, + RoutableConnectors::Powertranz => Self::Powertranz, + RoutableConnectors::Prophetpay => Self::Prophetpay, + RoutableConnectors::Rapyd => Self::Rapyd, + RoutableConnectors::Razorpay => Self::Razorpay, + RoutableConnectors::Riskified => Self::Riskified, + RoutableConnectors::Shift4 => Self::Shift4, + RoutableConnectors::Signifyd => Self::Signifyd, + RoutableConnectors::Square => Self::Square, + RoutableConnectors::Stax => Self::Stax, + RoutableConnectors::Stripe => Self::Stripe, + RoutableConnectors::Trustpay => Self::Trustpay, + RoutableConnectors::Tsys => Self::Tsys, + RoutableConnectors::Volt => Self::Volt, + RoutableConnectors::Wellsfargo => Self::Wellsfargo, + RoutableConnectors::Wise => Self::Wise, + RoutableConnectors::Worldline => Self::Worldline, + RoutableConnectors::Worldpay => Self::Worldpay, + RoutableConnectors::Zen => Self::Zen, + RoutableConnectors::Plaid => Self::Plaid, + RoutableConnectors::Zsl => Self::Zsl, + } + } +} diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs index 0ce351698d64..bae525f4562f 100644 --- a/crates/common_utils/src/events.rs +++ b/crates/common_utils/src/events.rs @@ -1,4 +1,3 @@ -use common_enums::{PaymentMethod, PaymentMethodType}; use serde::Serialize; use crate::{id_type, types::TimeRange}; @@ -36,14 +35,14 @@ pub enum ApiEventsType { #[cfg(feature = "v1")] PaymentMethod { payment_method_id: String, - payment_method: Option, - payment_method_type: Option, + payment_method: Option, + payment_method_type: Option, }, #[cfg(feature = "v2")] PaymentMethod { payment_method_id: id_type::GlobalPaymentMethodId, - payment_method_type: Option, - payment_method_subtype: Option, + payment_method_type: Option, + payment_method_subtype: Option, }, #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] PaymentMethodCreate, diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs index 1ecff0fc70a0..e536648a6d72 100644 --- a/crates/diesel_models/src/merchant_connector_account.rs +++ b/crates/diesel_models/src/merchant_connector_account.rs @@ -73,7 +73,7 @@ impl MerchantConnectorAccount { #[diesel(table_name = merchant_connector_account, check_for_backend(diesel::pg::Pg))] pub struct MerchantConnectorAccount { pub merchant_id: id_type::MerchantId, - pub connector_name: String, + pub connector_name: common_enums::connector_enums::Connector, pub connector_account_details: Encryption, pub disabled: Option, #[diesel(deserialize_as = super::OptionalDieselArray)] @@ -143,7 +143,7 @@ pub struct MerchantConnectorAccountNew { pub struct MerchantConnectorAccountNew { pub merchant_id: Option, pub connector_type: Option, - pub connector_name: Option, + pub connector_name: Option, pub connector_account_details: Option, pub disabled: Option, #[diesel(deserialize_as = super::OptionalDieselArray)] diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs index 33d168955d51..a25b99799627 100644 --- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs +++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs @@ -76,7 +76,7 @@ impl MerchantConnectorAccount { pub struct MerchantConnectorAccount { pub id: id_type::MerchantConnectorAccountId, pub merchant_id: id_type::MerchantId, - pub connector_name: String, + pub connector_name: common_enums::connector_enums::Connector, #[encrypt] pub connector_account_details: Encryptable>, pub disabled: Option, @@ -136,7 +136,7 @@ impl MerchantConnectorAccount { pub struct PaymentMethodsEnabledForConnector { pub payment_methods_enabled: common_types::payment_methods::RequestPaymentMethodTypes, pub payment_method: common_enums::PaymentMethod, - pub connector: String, + pub connector: common_enums::connector_enums::Connector, } #[cfg(feature = "v2")] @@ -166,11 +166,8 @@ impl FlattenedPaymentMethodsEnabled { payment_method.payment_method_subtypes.unwrap_or_default(); let length = request_payment_methods_enabled.len(); request_payment_methods_enabled.into_iter().zip( - std::iter::repeat(( - connector_name.clone(), - payment_method.payment_method_type, - )) - .take(length), + std::iter::repeat((connector_name, payment_method.payment_method_type)) + .take(length), ) }) }) @@ -178,7 +175,7 @@ impl FlattenedPaymentMethodsEnabled { |(request_payment_methods, (connector_name, payment_method))| { PaymentMethodsEnabledForConnector { payment_methods_enabled: request_payment_methods, - connector: connector_name.clone(), + connector: connector_name, payment_method, } }, diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 619d2fb19375..8a4b51828e66 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -145,6 +145,7 @@ router_derive = { version = "0.1.0", path = "../router_derive" } router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } scheduler = { version = "0.1.0", path = "../scheduler", default-features = false } storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false } +toml = "0.8.19" [build-dependencies] router_env = { version = "0.1.0", path = "../router_env", default-features = false } diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs index 9e42aec4a51d..ea5fda61a107 100644 --- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs +++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs @@ -105,6 +105,15 @@ impl Default for Mandates { } } +// The values will be filled in from the config file in configs/payment_required_fields.toml +#[cfg(feature = "v2")] +impl Default for settings::RequiredFields { + fn default() -> Self { + Self(HashMap::new()) + } +} + +#[cfg(feature = "v1")] impl Default for settings::RequiredFields { fn default() -> Self { Self(HashMap::from([ @@ -1019,7 +1028,7 @@ impl Default for settings::RequiredFields { common:HashMap::new(), } ), - #[cfg(feature = "dummy_connector")] + #[cfg(feature = "dummy_connector")] ( enums::Connector::DummyConnector1, RequiredFieldFinal { @@ -9750,7 +9759,7 @@ impl Default for settings::RequiredFields { "VI".to_string(), "WF".to_string(), "EH".to_string(), - "ZM".to_string(), + "ZM".to_string(), ] }, value: None, @@ -12528,7 +12537,7 @@ impl Default for settings::RequiredFields { "ES".to_string(), "FR".to_string(), "IE".to_string(), - "NL".to_string(), + "NL".to_string(), ], }, value: None, diff --git a/crates/router/src/configs/defaults/payout_required_fields.rs b/crates/router/src/configs/defaults/payout_required_fields.rs index 0b8d380f7a31..67d9c6744ad3 100644 --- a/crates/router/src/configs/defaults/payout_required_fields.rs +++ b/crates/router/src/configs/defaults/payout_required_fields.rs @@ -14,6 +14,14 @@ use crate::settings::{ RequiredFieldFinal, }; +#[cfg(feature = "v2")] +impl Default for PayoutRequiredFields { + fn default() -> Self { + Self(HashMap::new()) + } +} + +#[cfg(feature = "v1")] impl Default for PayoutRequiredFields { fn default() -> Self { Self(HashMap::from([ @@ -65,6 +73,7 @@ impl Default for PayoutRequiredFields { } } +#[cfg(feature = "v1")] fn get_connector_payment_method_type_fields( connector: PayoutConnectors, payment_method_type: PaymentMethodType, diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index ad5d9e89aaae..c388ef4ed618 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -548,6 +548,7 @@ pub struct ConnectorFields { pub fields: HashMap, } +#[cfg(feature = "v1")] #[derive(Debug, Deserialize, Clone)] pub struct RequiredFieldFinal { pub mandate: HashMap, @@ -555,6 +556,14 @@ pub struct RequiredFieldFinal { pub common: HashMap, } +#[cfg(feature = "v2")] +#[derive(Debug, Deserialize, Clone)] +pub struct RequiredFieldFinal { + pub mandate: Option>, + pub non_mandate: Option>, + pub common: Option>, +} + #[derive(Debug, Default, Deserialize, Clone)] #[serde(default)] pub struct Secrets { @@ -793,9 +802,12 @@ impl Settings { let environment = env::which(); let config_path = router_env::Config::config_path(&environment.to_string(), config_path); + let required_fields_path_buf = PathBuf::from("config/payment_required_fields.toml"); + let config = router_env::Config::builder(&environment.to_string()) .change_context(ApplicationError::ConfigurationError)? .add_source(File::from(config_path).required(false)) + .add_source(File::from(required_fields_path_buf).required(true)) .add_source( Environment::with_prefix("ROUTER") .try_parsing(true) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 24a2b25d6ce9..574bba4861fb 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -7,7 +7,7 @@ use api_models::{ use common_utils::{ date_time, ext_traits::{AsyncExt, Encode, OptionExt, ValueExt}, - id_type, pii, type_name, + fp_utils, id_type, pii, type_name, types::keymanager::{self as km_types, KeyManagerState, ToEncryptable}, }; use diesel_models::configs; @@ -2111,19 +2111,12 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect let metadata = self.metadata.clone().or(mca.metadata.clone()); - let connector_name = mca.connector_name.as_ref(); - let connector_enum = api_models::enums::Connector::from_str(connector_name) - .change_context(errors::ApiErrorResponse::InvalidDataValue { - field_name: "connector", - }) - .attach_printable_lazy(|| { - format!("unable to parse connector name {connector_name:?}") - })?; let connector_auth_type_and_metadata_validation = ConnectorAuthTypeAndMetadataValidation { - connector_name: &connector_enum, + connector_name: &mca.connector_name, auth_type: &auth, connector_meta_data: &metadata, }; + connector_auth_type_and_metadata_validation.validate_auth_and_metadata_type()?; let connector_status_and_disabled_validation = ConnectorStatusAndDisabledValidation { status: &self.status, @@ -2131,6 +2124,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect auth: &auth, current_status: &mca.status, }; + let (connector_status, disabled) = connector_status_and_disabled_validation.validate_status_and_disabled()?; @@ -2153,7 +2147,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect merchant_account.get_id(), &auth, &self.connector_type, - &connector_enum, + &mca.connector_name, types::AdditionalMerchantData::foreign_from(data.clone()), ) .await?, @@ -2520,7 +2514,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { Ok(domain::MerchantConnectorAccount { merchant_id: business_profile.merchant_id.clone(), connector_type: self.connector_type, - connector_name: self.connector_name.to_string(), + connector_name: self.connector_name, connector_account_details: encrypted_data.connector_account_details, payment_methods_enabled, disabled, @@ -2819,11 +2813,16 @@ pub async fn create_connector( let store = state.store.as_ref(); let key_manager_state = &(&state).into(); #[cfg(feature = "dummy_connector")] - req.connector_name - .validate_dummy_connector_enabled(state.conf.dummy_connector.enabled) - .change_context(errors::ApiErrorResponse::InvalidRequestData { - message: "Invalid connector name".to_string(), - })?; + fp_utils::when( + !req.connector_name + .validate_dummy_connector_create(state.conf.dummy_connector.enabled), + || { + Err(errors::ApiErrorResponse::InvalidRequestData { + message: "Invalid connector name".to_string(), + }) + }, + )?; + let connector_metadata = ConnectorMetadata { connector_metadata: &req.metadata, }; @@ -3331,11 +3330,12 @@ pub async fn delete_connector( let merchant_default_config_delete = DefaultFallbackRoutingConfigUpdate { routable_connector: &Some( - common_enums::RoutableConnectors::from_str(&mca.connector_name).map_err(|_| { - errors::ApiErrorResponse::InvalidDataValue { + // TODO: check why we are converting connector to routable_connector + common_enums::RoutableConnectors::from_str(&mca.connector_name.to_string()).map_err( + |_| errors::ApiErrorResponse::InvalidDataValue { field_name: "connector_name", - } - })?, + }, + )?, ), merchant_connector_id: &mca.get_id(), store: db, diff --git a/crates/router/src/core/disputes.rs b/crates/router/src/core/disputes.rs index 15bdbafb135b..c450139fc5cc 100644 --- a/crates/router/src/core/disputes.rs +++ b/crates/router/src/core/disputes.rs @@ -79,6 +79,7 @@ pub async fn accept_dispute( todo!() } +#[cfg(feature = "v1")] #[instrument(skip(state))] pub async fn get_filters_for_disputes( state: SessionState, diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index b3d5bafc2039..92d87a300f6c 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1144,12 +1144,16 @@ impl PerformFilteringOnPaymentMethodsEnabled #[cfg(feature = "v2")] /// Container for the inputs required for the required fields -struct RequiredFieldsInput {} +struct RequiredFieldsInput { + required_fields_config: settings::RequiredFields, +} #[cfg(feature = "v2")] impl RequiredFieldsInput { - fn new() -> Self { - Self {} + fn new(required_fields_config: settings::RequiredFields) -> Self { + Self { + required_fields_config, + } } } @@ -1159,24 +1163,79 @@ struct FilteredPaymentMethodsEnabled( Vec, ); +#[cfg(feature = "v2")] +trait GetRequiredFields { + fn get_required_fields( + &self, + payment_method_enabled: &hyperswitch_domain_models::merchant_connector_account::PaymentMethodsEnabledForConnector, + ) -> Option<&settings::RequiredFieldFinal>; +} + +#[cfg(feature = "v2")] +impl GetRequiredFields for settings::RequiredFields { + fn get_required_fields( + &self, + payment_method_enabled: &hyperswitch_domain_models::merchant_connector_account::PaymentMethodsEnabledForConnector, + ) -> Option<&settings::RequiredFieldFinal> { + self.0 + .get(&payment_method_enabled.payment_method) + .and_then(|required_fields_for_payment_method| { + required_fields_for_payment_method.0.get( + &payment_method_enabled + .payment_methods_enabled + .payment_method_subtype, + ) + }) + .map(|connector_fields| &connector_fields.fields) + .and_then(|connector_hashmap| connector_hashmap.get(&payment_method_enabled.connector)) + } +} + #[cfg(feature = "v2")] impl FilteredPaymentMethodsEnabled { fn get_required_fields( self, - _input: RequiredFieldsInput, + input: RequiredFieldsInput, ) -> RequiredFieldsForEnabledPaymentMethodTypes { + let required_fields_config = input.required_fields_config; + let required_fields_info = self .0 .into_iter() - .map( - |payment_methods_enabled| RequiredFieldsForEnabledPaymentMethod { - required_field: None, + .map(|payment_methods_enabled| { + let required_fields = + required_fields_config.get_required_fields(&payment_methods_enabled); + + let required_fields = required_fields + .map(|required_fields| { + let common_required_fields = required_fields + .common + .iter() + .flatten() + .map(ToOwned::to_owned); + + // Collect mandate required fields because this is for zero auth mandates only + let mandate_required_fields = required_fields + .mandate + .iter() + .flatten() + .map(ToOwned::to_owned); + + // Combine both common and mandate required fields + common_required_fields + .chain(mandate_required_fields) + .collect::>() + }) + .unwrap_or_default(); + + RequiredFieldsForEnabledPaymentMethod { + required_fields, payment_method_type: payment_methods_enabled.payment_method, payment_method_subtype: payment_methods_enabled .payment_methods_enabled .payment_method_subtype, - }, - ) + } + }) .collect(); RequiredFieldsForEnabledPaymentMethodTypes(required_fields_info) @@ -1186,7 +1245,7 @@ impl FilteredPaymentMethodsEnabled { #[cfg(feature = "v2")] /// Element container to hold the filtered payment methods with required fields struct RequiredFieldsForEnabledPaymentMethod { - required_field: Option>, + required_fields: Vec, payment_method_subtype: common_enums::PaymentMethodType, payment_method_type: common_enums::PaymentMethod, } @@ -1205,7 +1264,7 @@ impl RequiredFieldsForEnabledPaymentMethodTypes { |payment_methods_enabled| payment_methods::ResponsePaymentMethodTypes { payment_method_type: payment_methods_enabled.payment_method_type, payment_method_subtype: payment_methods_enabled.payment_method_subtype, - required_fields: payment_methods_enabled.required_field, + required_fields: payment_methods_enabled.required_fields, extra_information: None, }, ) @@ -1255,7 +1314,7 @@ pub async fn list_payment_methods( let response = hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled::from_payment_connectors_list(payment_connector_accounts) .perform_filtering() - .get_required_fields(RequiredFieldsInput::new()) + .get_required_fields(RequiredFieldsInput::new(state.conf.required_fields.clone())) .generate_response(); Ok(hyperswitch_domain_models::api::ApplicationResponse::Json( diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs index 1e3432220ac1..65688c5d465c 100644 --- a/crates/router/src/core/payments/flows/session_flow.rs +++ b/crates/router/src/core/payments/flows/session_flow.rs @@ -156,6 +156,7 @@ impl Feature for types::PaymentsSessio /// This function checks if for a given connector, payment_method and payment_method_type, /// the list of required_field_type is present in dynamic fields +#[cfg(feature = "v1")] fn is_dynamic_fields_required( required_fields: &settings::RequiredFields, payment_method: enums::PaymentMethod, @@ -187,6 +188,43 @@ fn is_dynamic_fields_required( .unwrap_or(false) } +/// This function checks if for a given connector, payment_method and payment_method_type, +/// the list of required_field_type is present in dynamic fields +#[cfg(feature = "v2")] +fn is_dynamic_fields_required( + required_fields: &settings::RequiredFields, + payment_method: enums::PaymentMethod, + payment_method_type: enums::PaymentMethodType, + connector: types::Connector, + required_field_type: Vec, +) -> bool { + required_fields + .0 + .get(&payment_method) + .and_then(|pm_type| pm_type.0.get(&payment_method_type)) + .and_then(|required_fields_for_connector| { + required_fields_for_connector.fields.get(&connector) + }) + .map(|required_fields_final| { + required_fields_final + .non_mandate + .iter() + .flatten() + .any(|field_info| required_field_type.contains(&field_info.field_type)) + || required_fields_final + .mandate + .iter() + .flatten() + .any(|field_info| required_field_type.contains(&field_info.field_type)) + || required_fields_final + .common + .iter() + .flatten() + .any(|field_info| required_field_type.contains(&field_info.field_type)) + }) + .unwrap_or(false) +} + fn build_apple_pay_session_request( state: &routes::SessionState, request: payment_types::ApplepaySessionRequest, diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index b2c90e03b589..b3d1fbadf3e0 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -5108,7 +5108,7 @@ pub fn get_applepay_metadata( }) } -#[cfg(feature = "retry")] +#[cfg(all(feature = "retry", feature = "v1"))] pub async fn get_apple_pay_retryable_connectors( state: &SessionState, merchant_account: &domain::MerchantAccount, @@ -6166,6 +6166,7 @@ where Ok(()) } +#[cfg(feature = "v1")] pub async fn validate_merchant_connector_ids_in_connector_mandate_details( state: &SessionState, key_store: &domain::MerchantKeyStore, diff --git a/crates/router/src/core/payouts/transformers.rs b/crates/router/src/core/payouts/transformers.rs index c1f314043053..b4e41ecb09d6 100644 --- a/crates/router/src/core/payouts/transformers.rs +++ b/crates/router/src/core/payouts/transformers.rs @@ -119,6 +119,7 @@ impl } } +#[cfg(feature = "v1")] impl ForeignFrom<( &PayoutRequiredFields, diff --git a/crates/router/src/core/relay.rs b/crates/router/src/core/relay.rs index d25296635ad1..9492816452ae 100644 --- a/crates/router/src/core/relay.rs +++ b/crates/router/src/core/relay.rs @@ -109,9 +109,15 @@ pub async fn relay_refund( let merchant_id = merchant_account.get_id(); + #[cfg(feature = "v1")] + let connector_name = &connector_account.connector_name; + + #[cfg(feature = "v2")] + let connector_name = &connector_account.connector_name.to_string(); + let connector_data = api::ConnectorData::get_connector_by_name( &state.conf.connectors, - &connector_account.connector_name, + connector_name, api::GetToken::Connector, Some(connector_id.clone()), )?; @@ -124,7 +130,6 @@ pub async fn relay_refund( let router_data = utils::construct_relay_refund_router_data( state, - &connector_account.connector_name, merchant_id, &connector_account, relay_record, @@ -289,9 +294,15 @@ pub async fn sync_relay_refund_with_gateway( let connector_id = &relay_record.connector_id; let merchant_id = merchant_account.get_id(); + #[cfg(feature = "v1")] + let connector_name = &connector_account.connector_name; + + #[cfg(feature = "v2")] + let connector_name = &connector_account.connector_name.to_string(); + let connector_data: api::ConnectorData = api::ConnectorData::get_connector_by_name( &state.conf.connectors, - &connector_account.connector_name, + connector_name, api::GetToken::Connector, Some(connector_id.clone()), ) @@ -300,7 +311,6 @@ pub async fn sync_relay_refund_with_gateway( let router_data = utils::construct_relay_refund_router_data( state, - &connector_account.connector_name, merchant_id, &connector_account, relay_record, diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs index 946f8df7d64e..37d11924a6c4 100644 --- a/crates/router/src/core/relay/utils.rs +++ b/crates/router/src/core/relay/utils.rs @@ -19,7 +19,6 @@ const IRRELEVANT_PAYMENT_ATTEMPT_ID: &str = "irrelevant_payment_attempt_id"; pub async fn construct_relay_refund_router_data<'a, F>( state: &'a SessionState, - connector_name: &str, merchant_id: &id_type::MerchantId, connector_account: &domain::MerchantConnectorAccount, relay_record: &hyperswitch_domain_models::relay::Relay, @@ -29,6 +28,12 @@ pub async fn construct_relay_refund_router_data<'a, F>( .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed while parsing value for ConnectorAuthType")?; + #[cfg(feature = "v2")] + let connector_name = &connector_account.connector_name.to_string(); + + #[cfg(feature = "v1")] + let connector_name = &connector_account.connector_name; + let webhook_url = Some(payments::helpers::create_webhook_url( &state.base_url.clone(), merchant_id, diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index 489c3122a8e9..c69102660f9a 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -300,10 +300,13 @@ pub struct RoutingAlgorithmHelpers<'h> { #[derive(Clone, Debug)] pub struct ConnectNameAndMCAIdForProfile<'a>( - pub FxHashSet<(&'a String, id_type::MerchantConnectorAccountId)>, + pub FxHashSet<( + &'a common_enums::connector_enums::Connector, + id_type::MerchantConnectorAccountId, + )>, ); #[derive(Clone, Debug)] -pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a String>); +pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a common_enums::connector_enums::Connector>); #[cfg(feature = "v2")] #[derive(Clone, Debug)] @@ -368,23 +371,25 @@ impl RoutingAlgorithmHelpers<'_> { choice: &routing_types::RoutableConnectorChoice, ) -> RouterResult<()> { if let Some(ref mca_id) = choice.merchant_connector_id { + let connector_choice = common_enums::connector_enums::Connector::from(choice.connector); error_stack::ensure!( - self.name_mca_id_set.0.contains(&(&choice.connector.to_string(), mca_id.clone())), - errors::ApiErrorResponse::InvalidRequestData { - message: format!( - "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile", - choice.connector, - mca_id, - ) - } - ); + self.name_mca_id_set.0.contains(&(&connector_choice, mca_id.clone())), + errors::ApiErrorResponse::InvalidRequestData { + message: format!( + "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile", + connector_choice, + mca_id, + ) + } + ); } else { + let connector_choice = common_enums::connector_enums::Connector::from(choice.connector); error_stack::ensure!( - self.name_set.0.contains(&choice.connector.to_string()), + self.name_set.0.contains(&connector_choice), errors::ApiErrorResponse::InvalidRequestData { message: format!( "connector with name '{}' not found for the given profile", - choice.connector, + connector_choice, ) } ); diff --git a/crates/router/src/core/user/dashboard_metadata.rs b/crates/router/src/core/user/dashboard_metadata.rs index aa67a70223ff..689762c1f43b 100644 --- a/crates/router/src/core/user/dashboard_metadata.rs +++ b/crates/router/src/core/user/dashboard_metadata.rs @@ -34,6 +34,7 @@ pub async fn set_metadata( Ok(ApplicationResponse::StatusOk) } +#[cfg(feature = "v1")] pub async fn get_multiple_metadata( state: SessionState, user: UserFromToken, @@ -622,6 +623,7 @@ async fn fetch_metadata( Ok(dashboard_metadata) } +#[cfg(feature = "v1")] pub async fn backfill_metadata( state: &SessionState, user: &UserFromToken, diff --git a/crates/router/src/core/webhooks/incoming_v2.rs b/crates/router/src/core/webhooks/incoming_v2.rs index 569cd330a079..01f8ee5e11af 100644 --- a/crates/router/src/core/webhooks/incoming_v2.rs +++ b/crates/router/src/core/webhooks/incoming_v2.rs @@ -755,8 +755,11 @@ async fn fetch_mca_and_connector( }) .attach_printable("error while fetching merchant_connector_account from connector_id")?; - let (connector, connector_name) = - get_connector_by_connector_name(state, &mca.connector_name, Some(mca.get_id()))?; + let (connector, connector_name) = get_connector_by_connector_name( + state, + &mca.connector_name.to_string(), + Some(mca.get_id()), + )?; Ok((mca, connector, connector_name)) } diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs index 0abbccd2cb35..3abf5f200df1 100644 --- a/crates/router/src/db/merchant_connector_account.rs +++ b/crates/router/src/db/merchant_connector_account.rs @@ -627,7 +627,7 @@ impl MerchantConnectorAccountInterface for Store { for (merchant_connector_account, update_merchant_connector_account) in merchant_connector_accounts { - let _connector_name = merchant_connector_account.connector_name.clone(); + let _connector_name = merchant_connector_account.connector_name; let _profile_id = merchant_connector_account.profile_id.clone(); let _merchant_id = merchant_connector_account.merchant_id.clone(); @@ -791,7 +791,7 @@ impl MerchantConnectorAccountInterface for Store { merchant_connector_account: storage::MerchantConnectorAccountUpdateInternal, key_store: &domain::MerchantKeyStore, ) -> CustomResult { - let _connector_name = this.connector_name.clone(); + let _connector_name = this.connector_name; let _profile_id = this.profile_id.clone(); let _merchant_id = this.merchant_id.clone(); @@ -1805,7 +1805,7 @@ mod merchant_connector_account_cache_tests { let mca = domain::MerchantConnectorAccount { id: id.clone(), merchant_id: merchant_id.clone(), - connector_name: "stripe".to_string(), + connector_name: common_enums::connector_enums::Connector::Stripe, connector_account_details: domain::types::crypto_operation( key_manager_state, type_name!(domain::MerchantConnectorAccount), diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs index 1935b8cd00ec..c919bfcd40ea 100644 --- a/crates/router/src/routes/disputes.rs +++ b/crates/router/src/routes/disputes.rs @@ -168,6 +168,7 @@ pub async fn retrieve_disputes_list_profile( .await } +#[cfg(feature = "v1")] /// Disputes - Disputes Filters #[utoipa::path( get, diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs index d075048ddb6b..1af22d0338ac 100644 --- a/crates/router/src/routes/user.rs +++ b/crates/router/src/routes/user.rs @@ -197,6 +197,7 @@ pub async fn set_dashboard_metadata( .await } +#[cfg(feature = "v1")] pub async fn get_multiple_dashboard_metadata( state: web::Data, req: HttpRequest, From 7362fb3c0bf57d84a95f6417b0890e2121e3e521 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:37:43 +0000 Subject: [PATCH 43/62] chore: run formatter --- crates/common_enums/src/connector_enums.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rs index 5cc9ec1ea0e3..e3a634eb4e21 100644 --- a/crates/common_enums/src/connector_enums.rs +++ b/crates/common_enums/src/connector_enums.rs @@ -1,6 +1,7 @@ -pub use super::enums::{PaymentMethod, PayoutType}; use utoipa::ToSchema; +pub use super::enums::{PaymentMethod, PayoutType}; + #[derive( Clone, Copy, From d5b694291f594391917c3f6df2a2bee384899873 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 3 Jan 2025 17:27:35 +0530 Subject: [PATCH 44/62] chore: cargo clippy --- .../configs/defaults/payment_connector_required_fields.rs | 8 -------- .../router/src/configs/defaults/payout_required_fields.rs | 7 ------- crates/router/src/configs/settings.rs | 2 ++ .../router/src/core/apple_pay_certificates_migration.rs | 1 + crates/router/src/db/merchant_connector_account.rs | 7 ++++++- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/crates/router/src/configs/defaults/payment_connector_required_fields.rs b/crates/router/src/configs/defaults/payment_connector_required_fields.rs index ea5fda61a107..e0b43af45ae9 100644 --- a/crates/router/src/configs/defaults/payment_connector_required_fields.rs +++ b/crates/router/src/configs/defaults/payment_connector_required_fields.rs @@ -105,14 +105,6 @@ impl Default for Mandates { } } -// The values will be filled in from the config file in configs/payment_required_fields.toml -#[cfg(feature = "v2")] -impl Default for settings::RequiredFields { - fn default() -> Self { - Self(HashMap::new()) - } -} - #[cfg(feature = "v1")] impl Default for settings::RequiredFields { fn default() -> Self { diff --git a/crates/router/src/configs/defaults/payout_required_fields.rs b/crates/router/src/configs/defaults/payout_required_fields.rs index 67d9c6744ad3..5ec8161c5948 100644 --- a/crates/router/src/configs/defaults/payout_required_fields.rs +++ b/crates/router/src/configs/defaults/payout_required_fields.rs @@ -14,13 +14,6 @@ use crate::settings::{ RequiredFieldFinal, }; -#[cfg(feature = "v2")] -impl Default for PayoutRequiredFields { - fn default() -> Self { - Self(HashMap::new()) - } -} - #[cfg(feature = "v1")] impl Default for PayoutRequiredFields { fn default() -> Self { diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index c388ef4ed618..83156d5968cf 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -535,9 +535,11 @@ pub struct NotAvailableFlows { #[cfg(feature = "payouts")] #[derive(Debug, Deserialize, Clone)] +#[cfg_attr(feature = "v2", derive(Default))] // Configs are read from the config file in config/payout_required_fields.toml pub struct PayoutRequiredFields(pub HashMap); #[derive(Debug, Deserialize, Clone)] +#[cfg_attr(feature = "v2", derive(Default))] // Configs are read from the config file in config/payment_required_fields.toml pub struct RequiredFields(pub HashMap); #[derive(Debug, Deserialize, Clone)] diff --git a/crates/router/src/core/apple_pay_certificates_migration.rs b/crates/router/src/core/apple_pay_certificates_migration.rs index 44be8f33bbec..21f38e59566a 100644 --- a/crates/router/src/core/apple_pay_certificates_migration.rs +++ b/crates/router/src/core/apple_pay_certificates_migration.rs @@ -13,6 +13,7 @@ use crate::{ types::{domain::types as domain_types, storage}, }; +#[cfg(feature = "v1")] pub async fn apple_pay_certificates_migration( state: SessionState, req: &apple_pay_certificates_migration::ApplePayCertificatesMigrationRequest, diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs index 3abf5f200df1..0cd496686771 100644 --- a/crates/router/src/db/merchant_connector_account.rs +++ b/crates/router/src/db/merchant_connector_account.rs @@ -627,7 +627,12 @@ impl MerchantConnectorAccountInterface for Store { for (merchant_connector_account, update_merchant_connector_account) in merchant_connector_accounts { - let _connector_name = merchant_connector_account.connector_name; + #[cfg(feature = "v1")] + let _connector_name = merchant_connector_account.connector_name.clone(); + + #[cfg(feature = "v2")] + let _connector_name = merchant_connector_account.connector_name.to_string(); + let _profile_id = merchant_connector_account.profile_id.clone(); let _merchant_id = merchant_connector_account.merchant_id.clone(); From d538cc1815f791fd70d28118d30375ff6e75a43e Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 3 Jan 2025 22:16:38 +0530 Subject: [PATCH 45/62] refactor: add the required fields config only for v2 --- crates/router/src/configs/settings.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 83156d5968cf..41d1ed37f1a2 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -804,12 +804,17 @@ impl Settings { let environment = env::which(); let config_path = router_env::Config::config_path(&environment.to_string(), config_path); - let required_fields_path_buf = PathBuf::from("config/payment_required_fields.toml"); - let config = router_env::Config::builder(&environment.to_string()) .change_context(ApplicationError::ConfigurationError)? - .add_source(File::from(config_path).required(false)) - .add_source(File::from(required_fields_path_buf).required(true)) + .add_source(File::from(config_path).required(false)); + + #[cfg(feature = "v2")] + let config = { + let required_fields_path_buf = PathBuf::from("config/payment_required_fields.toml"); + config.add_source(File::from(required_fields_path_buf).required(true)) + }; + + let config = config .add_source( Environment::with_prefix("ROUTER") .try_parsing(true) From 1f20a9577ccdbe794faa498c8b250f7f6ad05703 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 3 Jan 2025 23:32:51 +0530 Subject: [PATCH 46/62] fix: openapi v2 --- api-reference-v2/openapi_spec.json | 63 ++++++++++++++++++++++++------ api-reference/openapi_spec.json | 4 +- crates/api_models/src/payments.rs | 7 +++- crates/openapi/src/openapi_v2.rs | 2 + 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index c55b7fe5f6ad..e8d6b8987e5d 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -6623,7 +6623,6 @@ }, "Connector": { "type": "string", - "description": "A connector is an integration to fulfill payments", "enum": [ "adyenplatform", "phonypay", @@ -13883,7 +13882,7 @@ "id": { "type": "string", "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg" + "example": "12345_pm_01926c58bc6e77c09e809964e72af8c8" } } }, @@ -14089,7 +14088,7 @@ "payment_methods_enabled": { "type": "array", "items": { - "$ref": "#/components/schemas/ResponsePaymentMethodTypes" + "$ref": "#/components/schemas/ResponsePaymentMethodTypesForPayments" }, "description": "The list of payment methods that are enabled for the business profile" }, @@ -14116,7 +14115,7 @@ "id": { "type": "string", "description": "The unique identifier of the Payment method", - "example": "card_rGK4Vi5iSW70MY7J2mIg" + "example": "12345_pm_01926c58bc6e77c09e809964e72af8c8" }, "merchant_id": { "type": "string", @@ -19131,21 +19130,64 @@ "type": "object", "required": [ "payment_method_type", - "payment_method_subtype" + "payment_method_subtype", + "required_fields" ], "properties": { "payment_method_type": { - "$ref": "#/components/schemas/PaymentMethodType" + "$ref": "#/components/schemas/PaymentMethod" }, "payment_method_subtype": { "$ref": "#/components/schemas/PaymentMethodType" }, "required_fields": { - "type": "object", - "description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors.", - "additionalProperties": { + "type": "array", + "items": { "$ref": "#/components/schemas/RequiredFieldInfo" }, + "description": "Required fields for the payment_method_type.\nThis is the union of all the required fields for the payment method type enabled in all the connectors." + } + } + } + ] + }, + "ResponsePaymentMethodTypesForPayments": { + "allOf": [ + { + "allOf": [ + { + "$ref": "#/components/schemas/PaymentMethodSubtypeSpecificData" + } + ], + "nullable": true + }, + { + "type": "object", + "required": [ + "payment_method_type", + "payment_method_subtype" + ], + "properties": { + "payment_method_type": { + "$ref": "#/components/schemas/PaymentMethod" + }, + "payment_method_subtype": { + "$ref": "#/components/schemas/PaymentMethodType" + }, + "required_fields": { + "allOf": [ + { + "$ref": "#/components/schemas/RequiredFieldInfo" + } + ], + "nullable": true + }, + "surcharge_details": { + "allOf": [ + { + "$ref": "#/components/schemas/SurchargeDetailsResponse" + } + ], "nullable": true } } @@ -19370,7 +19412,7 @@ }, "RoutableConnectors": { "type": "string", - "description": "Connectors eligible for payments routing", + "description": "RoutableConnectors are the subset of Connectors that are eligible for payments routing", "enum": [ "adyenplatform", "phonypay", @@ -19448,7 +19490,6 @@ "wise", "worldline", "worldpay", - "xendit", "zen", "plaid", "zsl" diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 3c80fd8c4634..2a83bef52fd6 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -9231,7 +9231,6 @@ }, "Connector": { "type": "string", - "description": "A connector is an integration to fulfill payments", "enum": [ "adyenplatform", "phonypay", @@ -23886,7 +23885,7 @@ }, "RoutableConnectors": { "type": "string", - "description": "Connectors eligible for payments routing", + "description": "RoutableConnectors are the subset of Connectors that are eligible for payments routing", "enum": [ "adyenplatform", "phonypay", @@ -23964,7 +23963,6 @@ "wise", "worldline", "worldpay", - "xendit", "zen", "plaid", "zsl" diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 4bf09c221322..571c705f1c63 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -6570,7 +6570,7 @@ pub struct PaymentMethodListResponseForPayments { #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypesForPayments { /// The payment method type enabled - #[schema(example = "klarna", value_type = PaymentMethod)] + #[schema(example = "pay_later", value_type = PaymentMethod)] pub payment_method_type: common_enums::PaymentMethod, /// The payment method subtype enabled @@ -6579,13 +6579,16 @@ pub struct ResponsePaymentMethodTypesForPayments { /// payment method subtype specific information #[serde(flatten)] + #[schema(value_type = Option)] pub extra_information: Option, /// Required fields for the payment_method_type. /// This is the union of all the required fields for the payment method type enabled in all the connectors. - pub required_fields: Option>, + #[schema(value_type = Option)] + pub required_fields: Option>, /// surcharge details for this payment method type if exists + #[schema(value_type = Option)] pub surcharge_details: Option, } diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 35cd1ed899aa..5b66f77f0f2f 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -475,6 +475,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::AmountDetailsResponse, api_models::payments::BankCodeResponse, api_models::payments::PaymentMethodListResponseForPayments, + api_models::payments::ResponsePaymentMethodTypesForPayments, api_models::payment_methods::RequiredFieldInfo, api_models::payment_methods::DefaultPaymentMethod, api_models::payment_methods::MaskedBankDetails, @@ -483,6 +484,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payment_methods::SurchargePercentage, api_models::payment_methods::PaymentMethodCollectLinkRequest, api_models::payment_methods::PaymentMethodCollectLinkResponse, + api_models::payment_methods::PaymentMethodSubtypeSpecificData, api_models::payments::PaymentsRetrieveResponse, api_models::refunds::RefundListRequest, api_models::refunds::RefundListResponse, From 64808eb5c88430d8f4586be3a6d5ed9df66b398b Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Fri, 3 Jan 2025 23:57:49 +0530 Subject: [PATCH 47/62] fix: openapi v2 --- crates/api_models/src/payment_methods.rs | 6 +++--- crates/openapi/src/routes/payment_method.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 3aecd0fe4f5f..b70173312bb5 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1246,12 +1246,12 @@ pub struct ResponsePaymentMethodTypes { #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] #[serde(untagged)] // Untagged used for serialization only pub enum PaymentMethodSubtypeSpecificData { + #[schema(title = "card")] Card { card_networks: Vec, }, - Bank { - bank_names: Vec, - }, + #[schema(title = "bank")] + Bank { bank_names: Vec }, } #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs index 024d133e1ef5..54b0d74e39af 100644 --- a/crates/openapi/src/routes/payment_method.rs +++ b/crates/openapi/src/routes/payment_method.rs @@ -346,7 +346,7 @@ pub async fn list_customer_payment_method_api() {} /// Payment Methods - Payment Methods List /// -/// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment +/// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer. #[cfg(feature = "v2")] #[utoipa::path( get, From 1ce18db0b562f51dd18321a2537c196afc011aea Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:30:49 +0000 Subject: [PATCH 48/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index e8d6b8987e5d..742a2b5303cf 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -2276,7 +2276,7 @@ "Payment Methods" ], "summary": "Payment Methods - Payment Methods List", - "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", + "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer.", "operationId": "Retrieve Payment methods for a Payment Method Intent", "parameters": [ { @@ -14202,6 +14202,7 @@ "oneOf": [ { "type": "object", + "title": "card", "required": [ "card_networks" ], @@ -14216,6 +14217,7 @@ }, { "type": "object", + "title": "bank", "required": [ "bank_names" ], From bdfdeeb4797447fd2990a7eec57528fccec777ad Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Sat, 4 Jan 2025 02:08:49 +0530 Subject: [PATCH 49/62] chore: cargo clippy --- crates/router/src/core/admin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 574bba4861fb..6c9eb26a72b4 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -2814,7 +2814,7 @@ pub async fn create_connector( let key_manager_state = &(&state).into(); #[cfg(feature = "dummy_connector")] fp_utils::when( - !req.connector_name + req.connector_name .validate_dummy_connector_create(state.conf.dummy_connector.enabled), || { Err(errors::ApiErrorResponse::InvalidRequestData { From 68c93c4bb301888207df299c758a4d364a39de9f Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Sat, 4 Jan 2025 09:35:22 +0530 Subject: [PATCH 50/62] chore: revert config changes --- config/development.toml | 64 ++++++----------------------------------- 1 file changed, 9 insertions(+), 55 deletions(-) diff --git a/config/development.toml b/config/development.toml index a3521da2e242..de03f6b93508 100644 --- a/config/development.toml +++ b/config/development.toml @@ -69,11 +69,12 @@ common_merchant_identifier = "COMMON MERCHANT IDENTIFIER" applepay_endpoint = "DOMAIN SPECIFIC ENDPOINT" [locker] -host = "http://127.0.0.1:3000" -host_rs = "http://127.0.0.1:3000" +host = "" +host_rs = "" mock_locker = true -basilisk_host = "http://127.0.0.1:3000" -locker_enabled = false +basilisk_host = "" +locker_enabled = true +ttl_for_storage_in_secs = 220752000 [forex_api] call_delay = 21600 @@ -83,58 +84,11 @@ api_timeout = 20000 api_key = "YOUR API KEY HERE" fallback_api_key = "YOUR API KEY HERE" redis_lock_timeout = 26000 + [jwekey] -vault_encryption_key = """ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa6siKaSYqD1o4J3AbHq -Km8oVTvep7GoN/C45qY60C7DO72H1O7Ujt6ZsSiK83EyI0CaUg3ORPS3ayobFNmu -zR366ckK8GIf3BG7sVI6u/9751z4OvBHZMM9JFWa7Bx/RCPQ8aeM+iJoqf9auuQm -3NCTlfaZJif45pShswR+xuZTR/bqnsOSP/MFROI9ch0NE7KRogy0tvrZe21lP24i -Ro2LJJG+bYshxBddhxQf2ryJ85+/Trxdu16PunodGzCl6EMT3bvb4ZC41i15omqU -aXXV1Z1wYUhlsO0jyd1bVvjyuE/KE1TbBS0gfR/RkacODmmE2zEdZ0EyyiXwqkmc -oQIDAQAB ------END PUBLIC KEY----- -""" -rust_locker_encryption_key = """ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwa6siKaSYqD1o4J3AbHq -Km8oVTvep7GoN/C45qY60C7DO72H1O7Ujt6ZsSiK83EyI0CaUg3ORPS3ayobFNmu -zR366ckK8GIf3BG7sVI6u/9751z4OvBHZMM9JFWa7Bx/RCPQ8aeM+iJoqf9auuQm -3NCTlfaZJif45pShswR+xuZTR/bqnsOSP/MFROI9ch0NE7KRogy0tvrZe21lP24i -Ro2LJJG+bYshxBddhxQf2ryJ85+/Trxdu16PunodGzCl6EMT3bvb4ZC41i15omqU -aXXV1Z1wYUhlsO0jyd1bVvjyuE/KE1TbBS0gfR/RkacODmmE2zEdZ0EyyiXwqkmc -oQIDAQAB ------END PUBLIC KEY----- -""" -vault_private_key = """ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA5Z/K0JWds8iHhWCa+rj0rhOQX1nVs/ArQ1D0vh3UlSPR2vZU -TrkdP7i3amv4d2XDC+3+5/YWExTkpxqnfl1T9J37leN2guAARed6oYoTDEP/OoKt -nUrKK2xk/+V5DNOWcRiSpcCrJOOIEoACOlPIrXQSg16KDZQb0QTMntnsiPIJDbsO -GcdKytRAcNaokiKLnia1v13N3bk6dSplrj1YzawslZfgqD0eov4FjzBMoA19yNtl -VLLf6kOkLcFQjTKXJLP1tLflLUBPTg8fm9wgAPK2BjMQ2AMkUxx0ubbtw/9CeJ+b -FWrqGnEhlvfDMlyAV77sAiIdQ4mXs3TLcLb/AQIDAQABAoIBAGNekD1N0e5AZG1S -zh6cNb6zVrH8xV9WGtLJ0PAJJrrXwnQYT4m10DOIM0+Jo/+/ePXLq5kkRI9DZmPu -Q/eKWc+tInfN9LZUS6n0r3wCrZWMQ4JFlO5RtEWwZdDbtFPZqOwObz/treKL2JHw -9YXaRijR50UUf3e61YLRqd9AfX0RNuuG8H+WgU3Gwuh5TwRnljM3JGaDPHsf7HLS -tNkqJuByp26FEbOLTokZDbHN0sy7/6hufxnIS9AK4vp8y9mZAjghG26Rbg/H71mp -Z+Q6P1y7xdgAKbhq7usG3/o4Y1e9wnghHvFS7DPwGekHQH2+LsYNEYOir1iRjXxH -GUXOhfUCgYEA+cR9jONQFco8Zp6z0wdGlBeYoUHVMjThQWEblWL2j4RG/qQd/y0j -uhVeU0/PmkYK2mgcjrh/pgDTtPymc+QuxBi+lexs89ppuJIAgMvLUiJT67SBHguP -l4+oL9U78KGh7PfJpMKH+Pk5yc1xucAevk0wWmr5Tz2vKRDavFTPV+MCgYEA61qg -Y7yN0cDtxtqlZdMC8BJPFCQ1+s3uB0wetAY3BEKjfYc2O/4sMbixXzt5PkZqZy96 -QBUBxhcM/rIolpM3nrgN7h1nmJdk9ljCTjWoTJ6fDk8BUh8+0GrVhTbe7xZ+bFUN -UioIqvfapr/q/k7Ah2mCBE04wTZFry9fndrH2ssCgYEAh1T2Cj6oiAX6UEgxe2h3 -z4oxgz6efAO3AavSPFFQ81Zi+VqHflpA/3TQlSerfxXwj4LV5mcFkzbjfy9eKXE7 -/bjCm41tQ3vWyNEjQKYr1qcO/aniRBtThHWsVa6eObX6fOGN+p4E+txfeX693j3A -6q/8QSGxUERGAmRFgMIbTq0CgYAmuTeQkXKII4U75be3BDwEgg6u0rJq/L0ASF74 -4djlg41g1wFuZ4if+bJ9Z8ywGWfiaGZl6s7q59oEgg25kKljHQd1uTLVYXuEKOB3 -e86gJK0o7ojaGTf9lMZi779IeVv9uRTDAxWAA93e987TXuPAo/R3frkq2SIoC9Rg -paGidwKBgBqYd/iOJWsUZ8cWEhSE1Huu5rDEpjra8JPXHqQdILirxt1iCA5aEQou -BdDGaDr8sepJbGtjwTyiG8gEaX1DD+KsF2+dQRQdQfcYC40n8fKkvpFwrKjDj1ac -VuY3OeNxi+dC2r7HppP3O/MJ4gX/RJJfSrcaGP8/Ke1W5+jE97Qy ------END RSA PRIVATE KEY----- -""" +vault_encryption_key = "" +rust_locker_encryption_key = "" +vault_private_key = "" tunnel_private_key = "" [connectors.supported] From 2c3828d7ca5a3fd803d34bdbdabbaab1645f010a Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Mon, 6 Jan 2025 13:06:17 +0530 Subject: [PATCH 51/62] chore: cargo clippy --- crates/router/src/core/payments/payment_methods.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index 33358cece03b..df100d2e9b63 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -108,8 +108,7 @@ impl FilteredPaymentMethodsEnabled { /// Element container to hold the filtered payment methods with required fields struct RequiredFieldsForEnabledPaymentMethod { - required_field: - Option>, + required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, payment_method_type: common_enums::PaymentMethod, } @@ -119,8 +118,7 @@ struct RequiredFieldsForEnabledPaymentMethodTypes(Vec>, + required_field: Option>, payment_method_subtype: common_enums::PaymentMethodType, payment_method_type: common_enums::PaymentMethod, surcharge: Option, From b02524c1c0cd9394583fec2ec56de5697e75f5e3 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Mon, 6 Jan 2025 16:46:55 +0530 Subject: [PATCH 52/62] refactor: remove customer payment methods from payment methods --- crates/api_models/src/payment_methods.rs | 4 ---- crates/router/src/core/payment_methods.rs | 1 - 2 files changed, 5 deletions(-) diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index b70173312bb5..89f9ec7238ac 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1037,10 +1037,6 @@ impl From for payments::AdditionalCardInfo { pub struct PaymentMethodListResponse { /// The list of payment methods that are enabled for the business profile pub payment_methods_enabled: Vec, - - /// The list of payment methods that are saved by the given customer - /// This field is only returned if the customer_id is provided in the request - pub customer_payment_methods: Option>, } #[cfg(all( diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index 92d87a300f6c..c61f0658ab4f 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1272,7 +1272,6 @@ impl RequiredFieldsForEnabledPaymentMethodTypes { payment_methods::PaymentMethodListResponse { payment_methods_enabled: response_payment_methods, - customer_payment_methods: None, } } } From 0bac917da0a5cee4b01a735c7a723eb1d54e6398 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 11:19:44 +0000 Subject: [PATCH 53/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 742a2b5303cf..cc4aceb21dcd 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -14068,14 +14068,6 @@ "$ref": "#/components/schemas/ResponsePaymentMethodTypes" }, "description": "The list of payment methods that are enabled for the business profile" - }, - "customer_payment_methods": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CustomerPaymentMethod" - }, - "description": "The list of payment methods that are saved by the given customer\nThis field is only returned if the customer_id is provided in the request", - "nullable": true } } }, From 4b05c972904c1a82f898a8e35a14c1372e7b1321 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Mon, 6 Jan 2025 19:31:19 +0530 Subject: [PATCH 54/62] refactor: remove hardcoding required fields config --- ...lds.toml => payment_required_fields_v2.toml} | 0 crates/router/src/configs/settings.rs | 7 +++++-- crates/router_env/src/logger/config.rs | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) rename config/{payment_required_fields.toml => payment_required_fields_v2.toml} (100%) diff --git a/config/payment_required_fields.toml b/config/payment_required_fields_v2.toml similarity index 100% rename from config/payment_required_fields.toml rename to config/payment_required_fields_v2.toml diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 41d1ed37f1a2..d25c1ec42e49 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -39,6 +39,8 @@ use crate::{ events::EventsConfig, }; +pub const REQUIRED_FIELDS_CONFIG_FILE: &str = "payment_required_fields_v2.toml"; + #[derive(clap::Parser, Default)] #[cfg_attr(feature = "vergen", command(version = router_env::version!()))] pub struct CmdLineConf { @@ -810,8 +812,9 @@ impl Settings { #[cfg(feature = "v2")] let config = { - let required_fields_path_buf = PathBuf::from("config/payment_required_fields.toml"); - config.add_source(File::from(required_fields_path_buf).required(true)) + let required_fields_path_buf = + router_env::Config::get_config_directory().join(REQUIRED_FIELDS_CONFIG_FILE); + config.add_source(File::from(required_fields_path_buf).required(false)) }; let config = config diff --git a/crates/router_env/src/logger/config.rs b/crates/router_env/src/logger/config.rs index 431fb5a6368e..a7bdbe0696a2 100644 --- a/crates/router_env/src/logger/config.rs +++ b/crates/router_env/src/logger/config.rs @@ -175,18 +175,29 @@ impl Config { if let Some(explicit_config_path_val) = explicit_config_path { config_path.push(explicit_config_path_val); } else { - let config_directory = - std::env::var(crate::env::vars::CONFIG_DIR).unwrap_or_else(|_| "config".into()); let config_file_name = match environment { "production" => "production.toml", "sandbox" => "sandbox.toml", _ => "development.toml", }; - config_path.push(crate::env::workspace_path()); + let config_directory = Self::get_config_directory(); config_path.push(config_directory); config_path.push(config_file_name); } config_path } + + /// Get the Directory for the config file + /// Read the env variable `CONFIG_DIR` or fallback to `config` + pub fn get_config_directory() -> PathBuf { + let mut config_path = PathBuf::new(); + + let config_directory = + std::env::var(crate::env::vars::CONFIG_DIR).unwrap_or_else(|_| "config".into()); + + config_path.push(crate::env::workspace_path()); + config_path.push(config_directory); + config_path + } } From 3379758459e4b14c2a5b5deebc37f4b70935162d Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Tue, 7 Jan 2025 13:49:38 +0530 Subject: [PATCH 55/62] chore: merge fixes --- crates/api_models/src/events/payment.rs | 12 ++++++------ crates/api_models/src/payment_methods.rs | 16 ++++++++-------- crates/openapi/src/openapi_v2.rs | 1 - crates/router/src/types/api/payment_methods.rs | 4 ++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index 333a134e7fd5..e6de6190b83d 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -14,11 +14,11 @@ use crate::payment_methods::CustomerPaymentMethodsListResponse; use crate::{events, payment_methods::CustomerPaymentMethodsListResponse}; use crate::{ payment_methods::{ - self, DefaultPaymentMethod, ListCountriesCurrenciesRequest, - ListCountriesCurrenciesResponse, PaymentMethodCollectLinkRenderRequest, - PaymentMethodCollectLinkRequest, PaymentMethodCollectLinkResponse, - PaymentMethodDeleteResponse, PaymentMethodListRequest, PaymentMethodListResponse, - PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodUpdate, + self, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse, + PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, + PaymentMethodCollectLinkResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest, + PaymentMethodListResponse, PaymentMethodMigrateResponse, PaymentMethodResponse, + PaymentMethodUpdate, }, payments::{ self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints, @@ -244,7 +244,7 @@ impl ApiEventMetric for PaymentMethodMigrateResponse { impl ApiEventMetric for PaymentMethodUpdate {} #[cfg(feature = "v1")] -impl ApiEventMetric for DefaultPaymentMethod { +impl ApiEventMetric for payment_methods::DefaultPaymentMethod { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 89f9ec7238ac..5e05d8cc62bb 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -2050,14 +2050,14 @@ pub struct DefaultPaymentMethod { pub payment_method_id: String, } -#[cfg(feature = "v2")] -#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] -pub struct DefaultPaymentMethod { - #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44")] - pub customer_id: id_type::GlobalCustomerId, - #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44")] - pub payment_method_id: id_type::GlobalPaymentMethodId, -} +// #[cfg(feature = "v2")] +// #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] +// pub struct DefaultPaymentMethod { +// #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44")] +// pub customer_id: id_type::GlobalCustomerId, +// #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44")] +// pub payment_method_id: id_type::GlobalPaymentMethodId, +// } //------------------------------------------------TokenizeService------------------------------------------------ #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TokenizePayloadEncrypted { diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 5b66f77f0f2f..19e66e472df0 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -477,7 +477,6 @@ Never share your secret api keys. Keep them guarded and secure. api_models::payments::PaymentMethodListResponseForPayments, api_models::payments::ResponsePaymentMethodTypesForPayments, api_models::payment_methods::RequiredFieldInfo, - api_models::payment_methods::DefaultPaymentMethod, api_models::payment_methods::MaskedBankDetails, api_models::payment_methods::SurchargeDetailsResponse, api_models::payment_methods::SurchargeResponse, diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs index 25227ae5383a..e4d9adbd90bb 100644 --- a/crates/router/src/types/api/payment_methods.rs +++ b/crates/router/src/types/api/payment_methods.rs @@ -1,8 +1,8 @@ #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] pub use api_models::payment_methods::{ CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CardType, CustomerPaymentMethod, - CustomerPaymentMethodsListResponse, DefaultPaymentMethod, DeleteTokenizeByTokenRequest, - GetTokenizePayloadRequest, GetTokenizePayloadResponse, ListCountriesCurrenciesRequest, + CustomerPaymentMethodsListResponse, DeleteTokenizeByTokenRequest, GetTokenizePayloadRequest, + GetTokenizePayloadResponse, ListCountriesCurrenciesRequest, PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, PaymentMethodCreate, PaymentMethodCreateData, PaymentMethodDeleteResponse, PaymentMethodId, PaymentMethodIntentConfirm, PaymentMethodIntentConfirmInternal, PaymentMethodIntentCreate, From af28c4487806f46c96ea77dfc2d9f247bdb42c5a Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 08:22:31 +0000 Subject: [PATCH 56/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 564b83507361..4ec2720b0ffc 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -7971,27 +7971,6 @@ "frictionless" ] }, - "DefaultPaymentMethod": { - "type": "object", - "required": [ - "customer_id", - "payment_method_id" - ], - "properties": { - "customer_id": { - "type": "string", - "example": "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 64, - "minLength": 1 - }, - "payment_method_id": { - "type": "string", - "example": "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 64, - "minLength": 1 - } - } - }, "DeviceChannel": { "type": "string", "description": "Device Channel indicating whether request is coming from App or Browser", From de3ee96375035116525cc0d27749949924358411 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 8 Jan 2025 12:54:27 +0530 Subject: [PATCH 57/62] chore: address PR comments --- api-reference-v2/openapi_spec.json | 45 +-------------------- crates/api_models/src/payment_methods.rs | 8 ---- crates/openapi/src/openapi_v2.rs | 2 +- crates/openapi/src/routes/payment_method.rs | 2 +- crates/router/src/configs/settings.rs | 4 +- crates/router/src/core/admin.rs | 1 - crates/router/src/core/payment_methods.rs | 4 +- 7 files changed, 7 insertions(+), 59 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 4ec2720b0ffc..139d2c85d133 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -2277,7 +2277,7 @@ ], "summary": "Payment Methods - Payment Methods List", "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer.", - "operationId": "Retrieve Payment methods for a Payment Method Intent", + "operationId": "List Payment methods for a Payment Method Intent", "parameters": [ { "name": "id", @@ -2484,49 +2484,6 @@ ] } }, - "/v2/customers/{id}/saved-payment-methods": { - "get": { - "tags": [ - "Payment Methods" - ], - "summary": "List saved payment methods for a Customer", - "description": "To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context", - "operationId": "List all Payment Methods for a Customer", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PaymentMethodListRequest" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Payment Methods retrieved", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CustomerPaymentMethodsListResponse" - } - } - } - }, - "400": { - "description": "Invalid Data" - }, - "404": { - "description": "Payment Methods does not exist in records" - } - }, - "security": [ - { - "api_key": [] - } - ] - } - }, "/v2/refunds": { "post": { "tags": [ diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 5e05d8cc62bb..057c20f1b188 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -2050,14 +2050,6 @@ pub struct DefaultPaymentMethod { pub payment_method_id: String, } -// #[cfg(feature = "v2")] -// #[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)] -// pub struct DefaultPaymentMethod { -// #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_cus_y3oqhf46pyzuxjbcn2giaqnb44")] -// pub customer_id: id_type::GlobalCustomerId, -// #[schema(value_type = String, max_length = 64, min_length = 1, example = "12345_pm_y3oqhf46pyzuxjbcn2giaqnb44")] -// pub payment_method_id: id_type::GlobalPaymentMethodId, -// } //------------------------------------------------TokenizeService------------------------------------------------ #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct TokenizePayloadEncrypted { diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index 19e66e472df0..5b4c89c3f4a6 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -135,7 +135,7 @@ Never share your secret api keys. Keep them guarded and secure. routes::payment_method::payment_method_update_api, routes::payment_method::payment_method_retrieve_api, routes::payment_method::payment_method_delete_api, - routes::payment_method::list_customer_payment_method_api, + // routes::payment_method::list_customer_payment_method_api, //Routes for refunds routes::refunds::refunds_create, diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs index 54b0d74e39af..e3596a8325b0 100644 --- a/crates/openapi/src/routes/payment_method.rs +++ b/crates/openapi/src/routes/payment_method.rs @@ -364,7 +364,7 @@ pub async fn list_customer_payment_method_api() {} (status = 404, description = "No payment method found with the given id") ), tag = "Payment Methods", - operation_id = "Retrieve Payment methods for a Payment Method Intent", + operation_id = "List Payment methods for a Payment Method Intent", security(("api_key" = [], "ephemeral_key" = [])) )] pub fn list_payment_methods() {} diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs index 79f4f8a0643b..9d606a9e6074 100644 --- a/crates/router/src/configs/settings.rs +++ b/crates/router/src/configs/settings.rs @@ -814,9 +814,9 @@ impl Settings { #[cfg(feature = "v2")] let config = { - let required_fields_path_buf = + let required_fields_config_file = router_env::Config::get_config_directory().join(REQUIRED_FIELDS_CONFIG_FILE); - config.add_source(File::from(required_fields_path_buf).required(false)) + config.add_source(File::from(required_fields_config_file).required(false)) }; let config = config diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index ad692405c6dc..35df1ca8df3e 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -3330,7 +3330,6 @@ pub async fn delete_connector( let merchant_default_config_delete = DefaultFallbackRoutingConfigUpdate { routable_connector: &Some( - // TODO: check why we are converting connector to routable_connector common_enums::RoutableConnectors::from_str(&mca.connector_name.to_string()).map_err( |_| errors::ApiErrorResponse::InvalidDataValue { field_name: "connector_name", diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index c61f0658ab4f..7f3c30cf48bd 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1129,12 +1129,12 @@ pub async fn payment_method_intent_confirm( } #[cfg(feature = "v2")] -trait PerformFilteringOnPaymentMethodsEnabled { +trait PerformFilteringOnEnabledPaymentMethods { fn perform_filtering(self) -> FilteredPaymentMethodsEnabled; } #[cfg(feature = "v2")] -impl PerformFilteringOnPaymentMethodsEnabled +impl PerformFilteringOnEnabledPaymentMethods for hyperswitch_domain_models::merchant_connector_account::FlattenedPaymentMethodsEnabled { fn perform_filtering(self) -> FilteredPaymentMethodsEnabled { From 2901eaf02a06d623fbd009293864733249ec609c Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Wed, 8 Jan 2025 16:00:12 +0530 Subject: [PATCH 58/62] chore: remove toml dependency --- Cargo.lock | 1 - crates/router/Cargo.toml | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce3065c68071..e34c80bd9278 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6635,7 +6635,6 @@ dependencies = [ "thiserror", "time", "tokio 1.40.0", - "toml 0.8.19", "totp-rs", "tracing-futures", "unicode-segmentation", diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 8a4b51828e66..db65482628fd 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -17,7 +17,7 @@ email = ["external_services/email", "scheduler/email", "olap"] # keymanager_create, keymanager_mtls, encryption_service should not be removed or added to default feature. Once this features were enabled it can't be disabled as these are breaking changes. keymanager_create = [] keymanager_mtls = ["reqwest/rustls-tls", "common_utils/keymanager_mtls"] -encryption_service = ["keymanager_create","hyperswitch_domain_models/encryption_service", "common_utils/encryption_service"] +encryption_service = ["keymanager_create", "hyperswitch_domain_models/encryption_service", "common_utils/encryption_service"] km_forward_x_request_id = ["common_utils/km_forward_x_request_id"] frm = ["api_models/frm", "hyperswitch_domain_models/frm", "hyperswitch_connectors/frm", "hyperswitch_interfaces/frm"] stripe = [] @@ -145,7 +145,6 @@ router_derive = { version = "0.1.0", path = "../router_derive" } router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] } scheduler = { version = "0.1.0", path = "../scheduler", default-features = false } storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false } -toml = "0.8.19" [build-dependencies] router_env = { version = "0.1.0", path = "../router_env", default-features = false } From c5755cc7376f3cdb1f58179b7ed40f1d146e0e63 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 9 Jan 2025 19:21:36 +0530 Subject: [PATCH 59/62] chore: move the struct to appropriate place --- crates/api_models/src/events.rs | 11 +----- crates/api_models/src/payment_methods.rs | 22 ------------ crates/router/src/routes/payment_methods.rs | 36 ++++++++++++++++++- .../router/src/types/api/payment_methods.rs | 12 +++---- 4 files changed, 42 insertions(+), 39 deletions(-) diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index ea173d5b6303..b252ee6f0a33 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -179,16 +179,7 @@ impl ApiEventMetric for DisputesMetricsResponse { Some(ApiEventsType::Miscellaneous) } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] -impl ApiEventMetric for PaymentMethodIntentConfirmInternal { - fn get_api_event_type(&self) -> Option { - Some(ApiEventsType::PaymentMethod { - payment_method_id: self.id.clone(), - payment_method_type: Some(self.payment_method_type), - payment_method_subtype: Some(self.payment_method_subtype), - }) - } -} + #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] impl ApiEventMetric for PaymentMethodIntentCreate { diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index 057c20f1b188..82a7abc6ef1c 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -194,28 +194,6 @@ impl PaymentMethodIntentConfirm { } } -/// This struct is used internally only -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] -pub struct PaymentMethodIntentConfirmInternal { - pub id: id_type::GlobalPaymentMethodId, - pub payment_method_type: api_enums::PaymentMethod, - pub payment_method_subtype: api_enums::PaymentMethodType, - pub customer_id: Option, - pub payment_method_data: PaymentMethodCreateData, -} - -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] -impl From for PaymentMethodIntentConfirm { - fn from(item: PaymentMethodIntentConfirmInternal) -> Self { - Self { - payment_method_type: item.payment_method_type, - payment_method_subtype: item.payment_method_subtype, - customer_id: item.customer_id, - payment_method_data: item.payment_method_data.clone(), - } - } -} #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] /// This struct is only used by and internal api to migrate payment method pub struct PaymentMethodMigrate { diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index c20ccf5be3bf..a248b9b7eeeb 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -129,6 +129,40 @@ pub async fn create_payment_method_intent_api( .await } +/// This struct is used internally only +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] +pub struct PaymentMethodIntentConfirmInternal { + pub id: id_type::GlobalPaymentMethodId, + pub payment_method_type: common_enums::PaymentMethod, + pub payment_method_subtype: common_enums::PaymentMethodType, + pub customer_id: Option, + pub payment_method_data: payment_methods::PaymentMethodCreateData, +} + +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +impl From for payment_methods::PaymentMethodIntentConfirm { + fn from(item: PaymentMethodIntentConfirmInternal) -> Self { + Self { + payment_method_type: item.payment_method_type, + payment_method_subtype: item.payment_method_subtype, + customer_id: item.customer_id, + payment_method_data: item.payment_method_data.clone(), + } + } +} + +#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +impl common_utils::events::ApiEventMetric for PaymentMethodIntentConfirmInternal { + fn get_api_event_type(&self) -> Option { + Some(common_utils::events::ApiEventsType::PaymentMethod { + payment_method_id: self.id.clone(), + payment_method_type: Some(self.payment_method_type), + payment_method_subtype: Some(self.payment_method_subtype), + }) + } +} + #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsCreate))] pub async fn confirm_payment_method_intent_api( @@ -146,7 +180,7 @@ pub async fn confirm_payment_method_intent_api( Err(e) => return api::log_and_return_error_response(e), }; - let inner_payload = payment_methods::PaymentMethodIntentConfirmInternal { + let inner_payload = PaymentMethodIntentConfirmInternal { id: pm_id.to_owned(), payment_method_type: payload.payment_method_type, payment_method_subtype: payload.payment_method_subtype, diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs index e4d9adbd90bb..47ad15727ee0 100644 --- a/crates/router/src/types/api/payment_methods.rs +++ b/crates/router/src/types/api/payment_methods.rs @@ -5,12 +5,12 @@ pub use api_models::payment_methods::{ GetTokenizePayloadResponse, ListCountriesCurrenciesRequest, PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, PaymentMethodCreate, PaymentMethodCreateData, PaymentMethodDeleteResponse, PaymentMethodId, - PaymentMethodIntentConfirm, PaymentMethodIntentConfirmInternal, PaymentMethodIntentCreate, - PaymentMethodListData, PaymentMethodListRequest, PaymentMethodListResponse, - PaymentMethodMigrate, PaymentMethodMigrateResponse, PaymentMethodResponse, - PaymentMethodResponseData, PaymentMethodUpdate, PaymentMethodUpdateData, PaymentMethodsData, - TokenizePayloadEncrypted, TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, - TokenizedWalletValue1, TokenizedWalletValue2, + PaymentMethodIntentConfirm, PaymentMethodIntentCreate, PaymentMethodListData, + PaymentMethodListRequest, PaymentMethodListResponse, PaymentMethodMigrate, + PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodResponseData, + PaymentMethodUpdate, PaymentMethodUpdateData, PaymentMethodsData, TokenizePayloadEncrypted, + TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, + TokenizedWalletValue2, }; #[cfg(all( any(feature = "v2", feature = "v1"), From 4bfd11ada4e1fad477864cfcb959268ec6c4c8df Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:52:29 +0000 Subject: [PATCH 60/62] chore: run formatter --- crates/api_models/src/events.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index b252ee6f0a33..27cbbd614d69 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -180,7 +180,6 @@ impl ApiEventMetric for DisputesMetricsResponse { } } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] impl ApiEventMetric for PaymentMethodIntentCreate { fn get_api_event_type(&self) -> Option { From ad6a2214203ca9a1535cb74e4f0912290bdf32c3 Mon Sep 17 00:00:00 2001 From: Narayan Bhat Date: Thu, 9 Jan 2025 20:28:30 +0530 Subject: [PATCH 61/62] refactor: change list_payment_methods to list_enabled_payment_methods --- .../payment-method--payment-methods-list.mdx | 4 +- api-reference-v2/mint.json | 3 +- api-reference-v2/openapi_spec.json | 3057 ++++------------- crates/openapi/src/routes/payment_method.rs | 26 +- crates/router/src/core/payment_methods.rs | 2 +- crates/router/src/routes/app.rs | 4 +- crates/router/src/routes/payment_methods.rs | 4 +- 7 files changed, 693 insertions(+), 2407 deletions(-) diff --git a/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx b/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx index 7131915402ac..13eb3b58aa9b 100644 --- a/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx +++ b/api-reference-v2/api-reference/payment-methods/payment-method--payment-methods-list.mdx @@ -1,3 +1,3 @@ --- -openapi: get /v2/payment-methods/{id}/list-payment-methods ---- \ No newline at end of file +openapi: get /v2/payment-methods/{id}/list-enabled-payment-methods +--- diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json index 706f90b97088..d47cf7aee6d4 100644 --- a/api-reference-v2/mint.json +++ b/api-reference-v2/mint.json @@ -54,8 +54,7 @@ "api-reference/payment-methods/payment-method--confirm-intent", "api-reference/payment-methods/payment-method--update", "api-reference/payment-methods/payment-method--retrieve", - "api-reference/payment-methods/payment-method--delete", - "api-reference/payment-methods/list-saved-payment-methods-for-a-customer" + "api-reference/payment-methods/payment-method--delete" ] }, { diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 139d2c85d133..684251c64a35 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -22,9 +22,7 @@ "paths": { "/v2/organization": { "post": { - "tags": [ - "Organization" - ], + "tags": ["Organization"], "summary": "Organization - Create", "description": "Create a new organization", "operationId": "Create an Organization", @@ -69,9 +67,7 @@ }, "/v2/organization/{id}": { "get": { - "tags": [ - "Organization" - ], + "tags": ["Organization"], "summary": "Organization - Retrieve", "description": "Retrieve an existing organization", "operationId": "Retrieve an Organization", @@ -108,9 +104,7 @@ ] }, "put": { - "tags": [ - "Organization" - ], + "tags": ["Organization"], "summary": "Organization - Update", "description": "Create a new organization for .", "operationId": "Update an Organization", @@ -166,9 +160,7 @@ }, "/v2/organization/{id}/merchant-accounts": { "get": { - "tags": [ - "Organization" - ], + "tags": ["Organization"], "summary": "Organization - Merchant Account - List", "description": "List merchant accounts for an Organization", "operationId": "List Merchant Accounts", @@ -210,9 +202,7 @@ }, "/v2/connector-accounts": { "post": { - "tags": [ - "Merchant Connector Account" - ], + "tags": ["Merchant Connector Account"], "summary": "Connector Account - Create", "description": "Creates a new Connector Account for the merchant account. The connector could be a payment processor/facilitator/acquirer or a provider of specialized services like Fraud/Accounting etc.", "operationId": "Create a Merchant Connector", @@ -287,9 +277,7 @@ }, "/v2/connector-accounts/{id}": { "get": { - "tags": [ - "Merchant Connector Account" - ], + "tags": ["Merchant Connector Account"], "summary": "Connector Account - Retrieve", "description": "Retrieves details of a Connector account", "operationId": "Retrieve a Merchant Connector", @@ -330,9 +318,7 @@ ] }, "put": { - "tags": [ - "Merchant Connector Account" - ], + "tags": ["Merchant Connector Account"], "summary": "Connector Account - Update", "description": "To update an existing Connector account. Helpful in enabling/disabling different payment methods and other settings for the connector", "operationId": "Update a Merchant Connector", @@ -402,9 +388,7 @@ ] }, "delete": { - "tags": [ - "Merchant Connector Account" - ], + "tags": ["Merchant Connector Account"], "summary": "Merchant Connector - Delete", "description": "Delete or Detach a Merchant Connector from Merchant Account", "operationId": "Delete a Merchant Connector", @@ -447,9 +431,7 @@ }, "/v2/merchant-accounts": { "post": { - "tags": [ - "Merchant Account" - ], + "tags": ["Merchant Account"], "summary": "Merchant Account - Create", "description": "Create a new account for a *merchant* and the *merchant* could be a seller or retailer or client who likes to receive and send payments.\n\nBefore creating the merchant account, it is mandatory to create an organization.", "operationId": "Create a Merchant Account", @@ -526,9 +508,7 @@ }, "/v2/merchant-accounts/{id}": { "get": { - "tags": [ - "Merchant Account" - ], + "tags": ["Merchant Account"], "summary": "Merchant Account - Retrieve", "description": "Retrieve a *merchant* account details.", "operationId": "Retrieve a Merchant Account", @@ -565,9 +545,7 @@ ] }, "put": { - "tags": [ - "Merchant Account" - ], + "tags": ["Merchant Account"], "summary": "Merchant Account - Update", "description": "Updates details of an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc", "operationId": "Update a Merchant Account", @@ -632,9 +610,7 @@ }, "/v2/merchant-accounts/{id}/profiles": { "get": { - "tags": [ - "Merchant Account" - ], + "tags": ["Merchant Account"], "summary": "Merchant Account - Profile List", "description": "List profiles for an Merchant", "operationId": "List Profiles", @@ -676,9 +652,7 @@ }, "/v2/profiles": { "post": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Create", "description": "Creates a new *profile* for a merchant", "operationId": "Create A Profile", @@ -737,9 +711,7 @@ }, "/v2/profiles/{id}": { "get": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Retrieve", "description": "Retrieve existing *profile*", "operationId": "Retrieve a Profile", @@ -788,9 +760,7 @@ ] }, "put": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Update", "description": "Update the *profile*", "operationId": "Update a Profile", @@ -858,9 +828,7 @@ }, "/v2/profiles/{id}/connector-accounts": { "get": { - "tags": [ - "Business Profile" - ], + "tags": ["Business Profile"], "summary": "Profile - Connector Accounts List", "description": "List Connector Accounts for the profile", "operationId": "List all Merchant Connectors", @@ -917,9 +885,7 @@ }, "/v2/profiles/{id}/activate-routing-algorithm": { "patch": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Activate routing algorithm", "description": "Activates a routing algorithm under a profile", "operationId": "Activates a routing algorithm under a profile", @@ -984,9 +950,7 @@ }, "/v2/profiles/{id}/deactivate-routing-algorithm": { "patch": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Deactivate routing algorithm", "description": "Deactivates a routing algorithm under a profile", "operationId": " Deactivates a routing algorithm under a profile", @@ -1037,9 +1001,7 @@ }, "/v2/profiles/{id}/fallback-routing": { "patch": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Update Default Fallback Routing Algorithm", "description": "Update the default fallback routing algorithm for the profile", "operationId": "Update the default fallback routing algorithm for the profile", @@ -1101,9 +1063,7 @@ ] }, "get": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Retrieve Default Fallback Routing Algorithm", "description": "Retrieve the default fallback routing algorithm for the profile", "operationId": "Retrieve the default fallback routing algorithm for the profile", @@ -1148,9 +1108,7 @@ }, "/v2/profiles/{id}/routing-algorithm": { "get": { - "tags": [ - "Profile" - ], + "tags": ["Profile"], "summary": "Profile - Retrieve Active Routing Algorithm", "description": "_\nRetrieve active routing algorithm under the profile", "operationId": "Retrieve the active routing algorithm under the profile", @@ -1222,9 +1180,7 @@ }, "/v2/routing-algorithm": { "post": { - "tags": [ - "Routing" - ], + "tags": ["Routing"], "summary": "Routing - Create", "description": "Create a routing algorithm", "operationId": "Create a routing algorithm", @@ -1277,9 +1233,7 @@ }, "/v2/routing-algorithm/{id}": { "get": { - "tags": [ - "Routing" - ], + "tags": ["Routing"], "summary": "Routing - Retrieve", "description": "Retrieve a routing algorithm with its algorithm id", "operationId": "Retrieve a routing algorithm with its algorithm id", @@ -1327,9 +1281,7 @@ }, "/v2/api-keys": { "post": { - "tags": [ - "API Key" - ], + "tags": ["API Key"], "summary": "API Key - Create", "description": "Create a new API Key for accessing our APIs from your servers. The plaintext API Key will be\ndisplayed only once on creation, so ensure you store it securely.", "operationId": "Create an API Key", @@ -1367,9 +1319,7 @@ }, "/v2/api-keys/{id}": { "get": { - "tags": [ - "API Key" - ], + "tags": ["API Key"], "summary": "API Key - Retrieve", "description": "Retrieve information about the specified API Key.", "operationId": "Retrieve an API Key", @@ -1406,9 +1356,7 @@ ] }, "put": { - "tags": [ - "API Key" - ], + "tags": ["API Key"], "summary": "API Key - Update", "description": "Update information for the specified API Key.", "operationId": "Update an API Key", @@ -1455,9 +1403,7 @@ ] }, "delete": { - "tags": [ - "API Key" - ], + "tags": ["API Key"], "summary": "API Key - Revoke", "description": "Revoke the specified API Key. Once revoked, the API Key can no longer be used for\nauthenticating with our APIs.", "operationId": "Revoke an API Key", @@ -1496,9 +1442,7 @@ }, "/v2/api-keys/list": { "get": { - "tags": [ - "API Key" - ], + "tags": ["API Key"], "summary": "API Key - List", "description": "List all the API Keys associated to a merchant account.", "operationId": "List all API Keys associated with a merchant account", @@ -1550,9 +1494,7 @@ }, "/v2/customers": { "post": { - "tags": [ - "Customers" - ], + "tags": ["Customers"], "summary": "Customers - Create", "description": "Creates a customer object and stores the customer details to be reused for future payments.\nIncase the customer already exists in the system, this API will respond with the customer details.", "operationId": "Create a Customer", @@ -1598,9 +1540,7 @@ }, "/v2/customers/{id}": { "get": { - "tags": [ - "Customers" - ], + "tags": ["Customers"], "summary": "Customers - Retrieve", "description": "Retrieves a customer's details.", "operationId": "Retrieve a Customer", @@ -1640,9 +1580,7 @@ ] }, "post": { - "tags": [ - "Customers" - ], + "tags": ["Customers"], "summary": "Customers - Update", "description": "Updates the customer's details in a customer object.", "operationId": "Update a Customer", @@ -1697,9 +1635,7 @@ ] }, "delete": { - "tags": [ - "Customers" - ], + "tags": ["Customers"], "summary": "Customers - Delete", "description": "Delete a customer record.", "operationId": "Delete a Customer", @@ -1738,9 +1674,7 @@ }, "/v2/customers/list": { "get": { - "tags": [ - "Customers" - ], + "tags": ["Customers"], "summary": "Customers - List", "description": "Lists all the customers for a particular merchant id.", "operationId": "List all Customers for a Merchant", @@ -1771,9 +1705,7 @@ }, "/v2/payments/create-intent": { "post": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Create Intent", "description": "**Creates a payment intent object when amount_details are passed.**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the first call, and use the 'client secret' returned in this API along with your 'publishable key' to make subsequent API calls from your client.", "operationId": "Create a Payment Intent", @@ -1821,9 +1753,7 @@ }, "/v2/payments/{id}/get-intent": { "get": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Get Intent", "description": "**Get a payment intent object when id is passed in path**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the call.", "operationId": "Get the Payment Intent details", @@ -1862,9 +1792,7 @@ }, "/v2/payments/{id}/update-intent": { "put": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Update Intent", "description": "**Update a payment intent object**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the call.", "operationId": "Update a Payment Intent", @@ -1935,9 +1863,7 @@ }, "/v2/payments/{id}/confirm-intent": { "post": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Confirm Intent", "description": "**Confirms a payment intent object with the payment method data**\n\n.", "operationId": "Confirm Payment Intent", @@ -2026,9 +1952,7 @@ }, "/v2/payments/{id}": { "get": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Get", "description": "Retrieves a Payment. This API can also be used to get the status of a previously initiated payment or next action for an ongoing payment", "operationId": "Retrieve a Payment", @@ -2076,9 +2000,7 @@ }, "/v2/payments/{payment_id}/create-external-sdk-tokens": { "post": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Session token", "description": "Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.", "operationId": "Create Session tokens for a Payment", @@ -2127,9 +2049,7 @@ }, "/v2/payments/{id}/payment-methods": { "get": { - "tags": [ - "Payments" - ], + "tags": ["Payments"], "summary": "Payments - Payment Methods List", "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", "operationId": "Retrieve Payment methods for a Payment", @@ -2192,9 +2112,7 @@ }, "/v2/payment-methods": { "post": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Create", "description": "Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.", "operationId": "Create Payment Method", @@ -2232,9 +2150,7 @@ }, "/v2/payment-methods/create-intent": { "post": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Create Intent", "description": "Creates a payment method for customer with billing information and other metadata.", "operationId": "Create Payment Method Intent", @@ -2270,13 +2186,11 @@ ] } }, - "/v2/payment-methods/{id}/list-payment-methods": { + "/v2/payment-methods/{id}/list-enabled-payment-methods": { "get": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Methods - Payment Methods List", - "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer.", + "description": "List the payment methods eligible for a payment method.", "operationId": "List Payment methods for a Payment Method Intent", "parameters": [ { @@ -2326,9 +2240,7 @@ }, "/v2/payment-methods/{id}/confirm-intent": { "post": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Confirm Intent", "description": "Update a payment method with customer's payment method related information.", "operationId": "Confirm Payment Method Intent", @@ -2366,9 +2278,7 @@ }, "/v2/payment-methods/{id}/update-saved-payment-method": { "patch": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Update", "description": "Update an existing payment method of a customer.", "operationId": "Update Payment Method", @@ -2406,9 +2316,7 @@ }, "/v2/payment-methods/{id}": { "get": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Retrieve", "description": "Retrieves a payment method of a customer.", "operationId": "Retrieve Payment Method", @@ -2445,9 +2353,7 @@ ] }, "delete": { - "tags": [ - "Payment Methods" - ], + "tags": ["Payment Methods"], "summary": "Payment Method - Delete", "description": "Deletes a payment method of a customer.", "operationId": "Delete Payment Method", @@ -2486,9 +2392,7 @@ }, "/v2/refunds": { "post": { - "tags": [ - "Refunds" - ], + "tags": ["Refunds"], "summary": "Refunds - Create", "description": "Creates a refund against an already processed payment. In case of some processors, you can even opt to refund only a partial amount multiple times until the original charge amount has been refunded", "operationId": "Create a Refund", @@ -2556,25 +2460,17 @@ "AcceptanceType": { "type": "string", "description": "This is used to indicate if the mandate was accepted online or offline", - "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", @@ -2586,16 +2482,11 @@ }, { "type": "object", - "required": [ - "type", - "list" - ], + "required": ["type", "list"], "properties": { "type": { "type": "string", - "enum": [ - "disable_only" - ] + "enum": ["disable_only"] }, "list": { "type": "array", @@ -2607,15 +2498,11 @@ }, { "type": "object", - "required": [ - "type" - ], + "required": ["type"], "properties": { "type": { "type": "string", - "enum": [ - "all_accepted" - ] + "enum": ["all_accepted"] } } } @@ -2629,16 +2516,11 @@ "oneOf": [ { "type": "object", - "required": [ - "type", - "list" - ], + "required": ["type", "list"], "properties": { "type": { "type": "string", - "enum": [ - "enable_only" - ] + "enum": ["enable_only"] }, "list": { "type": "array", @@ -2650,16 +2532,11 @@ }, { "type": "object", - "required": [ - "type", - "list" - ], + "required": ["type", "list"], "properties": { "type": { "type": "string", - "enum": [ - "disable_only" - ] + "enum": ["disable_only"] }, "list": { "type": "array", @@ -2671,15 +2548,11 @@ }, { "type": "object", - "required": [ - "type" - ], + "required": ["type"], "properties": { "type": { "type": "string", - "enum": [ - "all_accepted" - ] + "enum": ["all_accepted"] } } } @@ -2690,10 +2563,7 @@ }, "AchBankDebitAdditionalData": { "type": "object", - "required": [ - "account_number", - "routing_number" - ], + "required": ["account_number", "routing_number"], "properties": { "account_number": { "type": "string", @@ -2745,10 +2615,7 @@ }, "AchBankTransfer": { "type": "object", - "required": [ - "bank_account_number", - "bank_routing_number" - ], + "required": ["bank_account_number", "bank_routing_number"], "properties": { "bank_name": { "type": "string", @@ -2785,10 +2652,7 @@ "AchBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for ach bank transfer payout method", - "required": [ - "bank_account_number", - "bank_routing_number" - ], + "required": ["bank_account_number", "bank_routing_number"], "properties": { "bank_account_number": { "type": "string", @@ -2865,9 +2729,7 @@ "oneOf": [ { "type": "object", - "required": [ - "open_banking_recipient_data" - ], + "required": ["open_banking_recipient_data"], "properties": { "open_banking_recipient_data": { "$ref": "#/components/schemas/MerchantRecipientData" @@ -2880,9 +2742,7 @@ "oneOf": [ { "type": "object", - "required": [ - "Card" - ], + "required": ["Card"], "properties": { "Card": { "$ref": "#/components/schemas/CardAdditionalData" @@ -2891,9 +2751,7 @@ }, { "type": "object", - "required": [ - "Bank" - ], + "required": ["Bank"], "properties": { "Bank": { "$ref": "#/components/schemas/BankAdditionalData" @@ -2902,9 +2760,7 @@ }, { "type": "object", - "required": [ - "Wallet" - ], + "required": ["Wallet"], "properties": { "Wallet": { "$ref": "#/components/schemas/WalletAdditionalData" @@ -3054,9 +2910,7 @@ }, "AmountDetails": { "type": "object", - "required": [ - "currency" - ], + "required": ["currency"], "properties": { "order_amount": { "type": "integer", @@ -3255,10 +3109,7 @@ }, "AmountInfo": { "type": "object", - "required": [ - "label", - "amount" - ], + "required": ["label", "amount"], "properties": { "label": { "type": "string", @@ -3280,9 +3131,7 @@ "oneOf": [ { "type": "string", - "enum": [ - "never" - ] + "enum": ["never"] }, { "type": "string", @@ -3292,11 +3141,7 @@ }, "ApplePayAddressParameters": { "type": "string", - "enum": [ - "postalAddress", - "phone", - "email" - ] + "enum": ["postalAddress", "phone", "email"] }, "ApplePayBillingContactFields": { "type": "array", @@ -3306,11 +3151,7 @@ }, "ApplePayPaymentRequest": { "type": "object", - "required": [ - "country_code", - "currency_code", - "total" - ], + "required": ["country_code", "currency_code", "total"], "properties": { "country_code": { "$ref": "#/components/schemas/CountryAlpha2" @@ -3369,10 +3210,7 @@ }, "ApplePayPaymentTiming": { "type": "string", - "enum": [ - "immediate", - "recurring" - ] + "enum": ["immediate", "recurring"] }, "ApplePayRecurringDetails": { "type": "object", @@ -3433,9 +3271,7 @@ }, "ApplePayRegularBillingDetails": { "type": "object", - "required": [ - "label" - ], + "required": ["label"], "properties": { "label": { "type": "string", @@ -3473,11 +3309,7 @@ }, "ApplePayRegularBillingRequest": { "type": "object", - "required": [ - "amount", - "label", - "payment_timing" - ], + "required": ["amount", "label", "payment_timing"], "properties": { "amount": { "type": "string", @@ -3579,18 +3411,11 @@ }, "ApplepayInitiative": { "type": "string", - "enum": [ - "web", - "ios" - ] + "enum": ["web", "ios"] }, "ApplepayPaymentMethod": { "type": "object", - "required": [ - "display_name", - "network", - "type" - ], + "required": ["display_name", "network", "type"], "properties": { "display_name": { "type": "string", @@ -3608,11 +3433,7 @@ }, "ApplepaySessionTokenResponse": { "type": "object", - "required": [ - "connector", - "delayed_session_token", - "sdk_next_action" - ], + "required": ["connector", "delayed_session_token", "sdk_next_action"], "properties": { "session_token_data": { "allOf": [ @@ -3690,10 +3511,7 @@ }, "AuthenticationConnectorDetails": { "type": "object", - "required": [ - "authentication_connectors", - "three_ds_requestor_url" - ], + "required": ["authentication_connectors", "three_ds_requestor_url"], "properties": { "authentication_connectors": { "type": "array", @@ -3720,36 +3538,20 @@ }, "AuthenticationStatus": { "type": "string", - "enum": [ - "started", - "pending", - "success", - "failed" - ] + "enum": ["started", "pending", "success", "failed"] }, "AuthenticationType": { "type": "string", "description": "Pass this parameter to force 3DS or non 3DS auth for this payment. Some connectors will still force 3DS auth even in case of passing 'no_three_ds' here and vice versa. Default value is 'no_three_ds' if not set", - "enum": [ - "three_ds", - "no_three_ds" - ] + "enum": ["three_ds", "no_three_ds"] }, "AuthorizationStatus": { "type": "string", - "enum": [ - "success", - "failure", - "processing", - "unresolved" - ] + "enum": ["success", "failure", "processing", "unresolved"] }, "BacsBankDebitAdditionalData": { "type": "object", - "required": [ - "account_number", - "sort_code" - ], + "required": ["account_number", "sort_code"], "properties": { "account_number": { "type": "string", @@ -3771,10 +3573,7 @@ }, "BacsBankTransfer": { "type": "object", - "required": [ - "bank_account_number", - "bank_sort_code" - ], + "required": ["bank_account_number", "bank_sort_code"], "properties": { "bank_name": { "type": "string", @@ -3811,10 +3610,7 @@ "BacsBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for bacs bank transfer payout method", - "required": [ - "bank_sort_code", - "bank_account_number" - ], + "required": ["bank_sort_code", "bank_account_number"], "properties": { "bank_sort_code": { "type": "string", @@ -3850,11 +3646,7 @@ }, "BacsBankTransferInstructions": { "type": "object", - "required": [ - "account_holder_name", - "account_number", - "sort_code" - ], + "required": ["account_holder_name", "account_number", "sort_code"], "properties": { "account_holder_name": { "type": "string", @@ -3934,10 +3726,7 @@ }, "BankCodeResponse": { "type": "object", - "required": [ - "bank_name", - "eligible_connectors" - ], + "required": ["bank_name", "eligible_connectors"], "properties": { "bank_name": { "type": "array", @@ -3957,9 +3746,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ach" - ], + "required": ["ach"], "properties": { "ach": { "$ref": "#/components/schemas/AchBankDebitAdditionalData" @@ -3968,9 +3755,7 @@ }, { "type": "object", - "required": [ - "bacs" - ], + "required": ["bacs"], "properties": { "bacs": { "$ref": "#/components/schemas/BacsBankDebitAdditionalData" @@ -3979,9 +3764,7 @@ }, { "type": "object", - "required": [ - "becs" - ], + "required": ["becs"], "properties": { "becs": { "$ref": "#/components/schemas/BecsBankDebitAdditionalData" @@ -3990,9 +3773,7 @@ }, { "type": "object", - "required": [ - "sepa" - ], + "required": ["sepa"], "properties": { "sepa": { "$ref": "#/components/schemas/SepaBankDebitAdditionalData" @@ -4030,9 +3811,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ach_bank_debit" - ], + "required": ["ach_bank_debit"], "properties": { "ach_bank_debit": { "type": "object", @@ -4091,16 +3870,11 @@ }, { "type": "object", - "required": [ - "sepa_bank_debit" - ], + "required": ["sepa_bank_debit"], "properties": { "sepa_bank_debit": { "type": "object", - "required": [ - "iban", - "bank_account_holder_name" - ], + "required": ["iban", "bank_account_holder_name"], "properties": { "billing_details": { "allOf": [ @@ -4126,16 +3900,11 @@ }, { "type": "object", - "required": [ - "becs_bank_debit" - ], + "required": ["becs_bank_debit"], "properties": { "becs_bank_debit": { "type": "object", - "required": [ - "account_number", - "bsb_number" - ], + "required": ["account_number", "bsb_number"], "properties": { "billing_details": { "allOf": [ @@ -4167,9 +3936,7 @@ }, { "type": "object", - "required": [ - "bacs_bank_debit" - ], + "required": ["bacs_bank_debit"], "properties": { "bacs_bank_debit": { "type": "object", @@ -4225,9 +3992,7 @@ }, "BankDebitTypes": { "type": "object", - "required": [ - "eligible_connectors" - ], + "required": ["eligible_connectors"], "properties": { "eligible_connectors": { "type": "array", @@ -4239,10 +4004,7 @@ }, "BankHolderType": { "type": "string", - "enum": [ - "personal", - "business" - ] + "enum": ["personal", "business"] }, "BankNames": { "type": "string", @@ -4398,10 +4160,7 @@ }, "BankRedirectBilling": { "type": "object", - "required": [ - "billing_name", - "email" - ], + "required": ["billing_name", "email"], "properties": { "billing_name": { "type": "string", @@ -4419,9 +4178,7 @@ "oneOf": [ { "type": "object", - "required": [ - "bancontact_card" - ], + "required": ["bancontact_card"], "properties": { "bancontact_card": { "type": "object", @@ -4466,9 +4223,7 @@ }, { "type": "object", - "required": [ - "bizum" - ], + "required": ["bizum"], "properties": { "bizum": { "type": "object" @@ -4477,9 +4232,7 @@ }, { "type": "object", - "required": [ - "blik" - ], + "required": ["blik"], "properties": { "blik": { "type": "object", @@ -4494,16 +4247,11 @@ }, { "type": "object", - "required": [ - "eps" - ], + "required": ["eps"], "properties": { "eps": { "type": "object", - "required": [ - "bank_name", - "country" - ], + "required": ["bank_name", "country"], "properties": { "billing_details": { "allOf": [ @@ -4525,15 +4273,11 @@ }, { "type": "object", - "required": [ - "giropay" - ], + "required": ["giropay"], "properties": { "giropay": { "type": "object", - "required": [ - "country" - ], + "required": ["country"], "properties": { "billing_details": { "allOf": [ @@ -4562,16 +4306,11 @@ }, { "type": "object", - "required": [ - "ideal" - ], + "required": ["ideal"], "properties": { "ideal": { "type": "object", - "required": [ - "bank_name", - "country" - ], + "required": ["bank_name", "country"], "properties": { "billing_details": { "allOf": [ @@ -4593,9 +4332,7 @@ }, { "type": "object", - "required": [ - "interac" - ], + "required": ["interac"], "properties": { "interac": { "type": "object", @@ -4619,15 +4356,11 @@ }, { "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" @@ -4638,9 +4371,7 @@ }, { "type": "object", - "required": [ - "online_banking_finland" - ], + "required": ["online_banking_finland"], "properties": { "online_banking_finland": { "type": "object", @@ -4655,15 +4386,11 @@ }, { "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" @@ -4674,15 +4401,11 @@ }, { "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" @@ -4693,16 +4416,11 @@ }, { "type": "object", - "required": [ - "open_banking_uk" - ], + "required": ["open_banking_uk"], "properties": { "open_banking_uk": { "type": "object", - "required": [ - "issuer", - "country" - ], + "required": ["issuer", "country"], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4716,9 +4434,7 @@ }, { "type": "object", - "required": [ - "przelewy24" - ], + "required": ["przelewy24"], "properties": { "przelewy24": { "type": "object", @@ -4745,15 +4461,11 @@ }, { "type": "object", - "required": [ - "sofort" - ], + "required": ["sofort"], "properties": { "sofort": { "type": "object", - "required": [ - "country" - ], + "required": ["country"], "properties": { "billing_details": { "allOf": [ @@ -4778,15 +4490,11 @@ }, { "type": "object", - "required": [ - "trustly" - ], + "required": ["trustly"], "properties": { "trustly": { "type": "object", - "required": [ - "country" - ], + "required": ["country"], "properties": { "country": { "$ref": "#/components/schemas/CountryAlpha2" @@ -4797,15 +4505,11 @@ }, { "type": "object", - "required": [ - "online_banking_fpx" - ], + "required": ["online_banking_fpx"], "properties": { "online_banking_fpx": { "type": "object", - "required": [ - "issuer" - ], + "required": ["issuer"], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4816,15 +4520,11 @@ }, { "type": "object", - "required": [ - "online_banking_thailand" - ], + "required": ["online_banking_thailand"], "properties": { "online_banking_thailand": { "type": "object", - "required": [ - "issuer" - ], + "required": ["issuer"], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4835,9 +4535,7 @@ }, { "type": "object", - "required": [ - "local_bank_redirect" - ], + "required": ["local_bank_redirect"], "properties": { "local_bank_redirect": { "type": "object" @@ -4850,9 +4548,7 @@ "oneOf": [ { "type": "object", - "required": [ - "BancontactCard" - ], + "required": ["BancontactCard"], "properties": { "BancontactCard": { "$ref": "#/components/schemas/BancontactBankRedirectAdditionalData" @@ -4861,9 +4557,7 @@ }, { "type": "object", - "required": [ - "Blik" - ], + "required": ["Blik"], "properties": { "Blik": { "$ref": "#/components/schemas/BlikBankRedirectAdditionalData" @@ -4872,9 +4566,7 @@ }, { "type": "object", - "required": [ - "Giropay" - ], + "required": ["Giropay"], "properties": { "Giropay": { "$ref": "#/components/schemas/GiropayBankRedirectAdditionalData" @@ -4912,9 +4604,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ach" - ], + "required": ["ach"], "properties": { "ach": { "type": "object" @@ -4923,9 +4613,7 @@ }, { "type": "object", - "required": [ - "sepa" - ], + "required": ["sepa"], "properties": { "sepa": { "type": "object" @@ -4934,9 +4622,7 @@ }, { "type": "object", - "required": [ - "bacs" - ], + "required": ["bacs"], "properties": { "bacs": { "type": "object" @@ -4945,9 +4631,7 @@ }, { "type": "object", - "required": [ - "multibanco" - ], + "required": ["multibanco"], "properties": { "multibanco": { "type": "object" @@ -4956,9 +4640,7 @@ }, { "type": "object", - "required": [ - "permata" - ], + "required": ["permata"], "properties": { "permata": { "type": "object" @@ -4967,9 +4649,7 @@ }, { "type": "object", - "required": [ - "bca" - ], + "required": ["bca"], "properties": { "bca": { "type": "object" @@ -4978,9 +4658,7 @@ }, { "type": "object", - "required": [ - "bni_va" - ], + "required": ["bni_va"], "properties": { "bni_va": { "type": "object" @@ -4989,9 +4667,7 @@ }, { "type": "object", - "required": [ - "bri_va" - ], + "required": ["bri_va"], "properties": { "bri_va": { "type": "object" @@ -5000,9 +4676,7 @@ }, { "type": "object", - "required": [ - "cimb_va" - ], + "required": ["cimb_va"], "properties": { "cimb_va": { "type": "object" @@ -5011,9 +4685,7 @@ }, { "type": "object", - "required": [ - "danamon_va" - ], + "required": ["danamon_va"], "properties": { "danamon_va": { "type": "object" @@ -5022,9 +4694,7 @@ }, { "type": "object", - "required": [ - "mandiri_va" - ], + "required": ["mandiri_va"], "properties": { "mandiri_va": { "type": "object" @@ -5033,9 +4703,7 @@ }, { "type": "object", - "required": [ - "pix" - ], + "required": ["pix"], "properties": { "pix": { "$ref": "#/components/schemas/PixBankTransferAdditionalData" @@ -5044,9 +4712,7 @@ }, { "type": "object", - "required": [ - "pse" - ], + "required": ["pse"], "properties": { "pse": { "type": "object" @@ -5055,9 +4721,7 @@ }, { "type": "object", - "required": [ - "local_bank_transfer" - ], + "required": ["local_bank_transfer"], "properties": { "local_bank_transfer": { "$ref": "#/components/schemas/LocalBankTransferAdditionalData" @@ -5070,9 +4734,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ach_bank_transfer" - ], + "required": ["ach_bank_transfer"], "properties": { "ach_bank_transfer": { "type": "object", @@ -5091,15 +4753,11 @@ }, { "type": "object", - "required": [ - "sepa_bank_transfer" - ], + "required": ["sepa_bank_transfer"], "properties": { "sepa_bank_transfer": { "type": "object", - "required": [ - "country" - ], + "required": ["country"], "properties": { "billing_details": { "allOf": [ @@ -5118,9 +4776,7 @@ }, { "type": "object", - "required": [ - "bacs_bank_transfer" - ], + "required": ["bacs_bank_transfer"], "properties": { "bacs_bank_transfer": { "type": "object", @@ -5139,9 +4795,7 @@ }, { "type": "object", - "required": [ - "multibanco_bank_transfer" - ], + "required": ["multibanco_bank_transfer"], "properties": { "multibanco_bank_transfer": { "type": "object", @@ -5160,9 +4814,7 @@ }, { "type": "object", - "required": [ - "permata_bank_transfer" - ], + "required": ["permata_bank_transfer"], "properties": { "permata_bank_transfer": { "type": "object", @@ -5181,9 +4833,7 @@ }, { "type": "object", - "required": [ - "bca_bank_transfer" - ], + "required": ["bca_bank_transfer"], "properties": { "bca_bank_transfer": { "type": "object", @@ -5202,9 +4852,7 @@ }, { "type": "object", - "required": [ - "bni_va_bank_transfer" - ], + "required": ["bni_va_bank_transfer"], "properties": { "bni_va_bank_transfer": { "type": "object", @@ -5223,9 +4871,7 @@ }, { "type": "object", - "required": [ - "bri_va_bank_transfer" - ], + "required": ["bri_va_bank_transfer"], "properties": { "bri_va_bank_transfer": { "type": "object", @@ -5244,9 +4890,7 @@ }, { "type": "object", - "required": [ - "cimb_va_bank_transfer" - ], + "required": ["cimb_va_bank_transfer"], "properties": { "cimb_va_bank_transfer": { "type": "object", @@ -5265,9 +4909,7 @@ }, { "type": "object", - "required": [ - "danamon_va_bank_transfer" - ], + "required": ["danamon_va_bank_transfer"], "properties": { "danamon_va_bank_transfer": { "type": "object", @@ -5286,9 +4928,7 @@ }, { "type": "object", - "required": [ - "mandiri_va_bank_transfer" - ], + "required": ["mandiri_va_bank_transfer"], "properties": { "mandiri_va_bank_transfer": { "type": "object", @@ -5307,9 +4947,7 @@ }, { "type": "object", - "required": [ - "pix" - ], + "required": ["pix"], "properties": { "pix": { "type": "object", @@ -5338,9 +4976,7 @@ }, { "type": "object", - "required": [ - "pse" - ], + "required": ["pse"], "properties": { "pse": { "type": "object" @@ -5349,9 +4985,7 @@ }, { "type": "object", - "required": [ - "local_bank_transfer" - ], + "required": ["local_bank_transfer"], "properties": { "local_bank_transfer": { "type": "object", @@ -5370,9 +5004,7 @@ "oneOf": [ { "type": "object", - "required": [ - "doku_bank_transfer_instructions" - ], + "required": ["doku_bank_transfer_instructions"], "properties": { "doku_bank_transfer_instructions": { "$ref": "#/components/schemas/DokuBankTransferInstructions" @@ -5381,9 +5013,7 @@ }, { "type": "object", - "required": [ - "ach_credit_transfer" - ], + "required": ["ach_credit_transfer"], "properties": { "ach_credit_transfer": { "$ref": "#/components/schemas/AchTransfer" @@ -5392,9 +5022,7 @@ }, { "type": "object", - "required": [ - "sepa_bank_instructions" - ], + "required": ["sepa_bank_instructions"], "properties": { "sepa_bank_instructions": { "$ref": "#/components/schemas/SepaBankTransferInstructions" @@ -5403,9 +5031,7 @@ }, { "type": "object", - "required": [ - "bacs_bank_instructions" - ], + "required": ["bacs_bank_instructions"], "properties": { "bacs_bank_instructions": { "$ref": "#/components/schemas/BacsBankTransferInstructions" @@ -5414,9 +5040,7 @@ }, { "type": "object", - "required": [ - "multibanco" - ], + "required": ["multibanco"], "properties": { "multibanco": { "$ref": "#/components/schemas/MultibancoTransferInstructions" @@ -5462,9 +5086,7 @@ }, "BankTransferTypes": { "type": "object", - "required": [ - "eligible_connectors" - ], + "required": ["eligible_connectors"], "properties": { "eligible_connectors": { "type": "array", @@ -5472,26 +5094,17 @@ "type": "string" }, "description": "The list of eligible connectors for a given payment experience", - "example": [ - "stripe", - "adyen" - ] + "example": ["stripe", "adyen"] } } }, "BankType": { "type": "string", - "enum": [ - "checking", - "savings" - ] + "enum": ["checking", "savings"] }, "BecsBankDebitAdditionalData": { "type": "object", - "required": [ - "account_number", - "bsb_number" - ], + "required": ["account_number", "bsb_number"], "properties": { "account_number": { "type": "string", @@ -5523,26 +5136,17 @@ }, "BlocklistDataKind": { "type": "string", - "enum": [ - "payment_method", - "card_bin", - "extended_card_bin" - ] + "enum": ["payment_method", "card_bin", "extended_card_bin"] }, "BlocklistRequest": { "oneOf": [ { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "card_bin" - ] + "enum": ["card_bin"] }, "data": { "type": "string" @@ -5551,16 +5155,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "fingerprint" - ] + "enum": ["fingerprint"] }, "data": { "type": "string" @@ -5569,16 +5168,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "extended_card_bin" - ] + "enum": ["extended_card_bin"] }, "data": { "type": "string" @@ -5592,11 +5186,7 @@ }, "BlocklistResponse": { "type": "object", - "required": [ - "fingerprint_id", - "data_kind", - "created_at" - ], + "required": ["fingerprint_id", "data_kind", "created_at"], "properties": { "fingerprint_id": { "type": "string" @@ -5706,9 +5296,7 @@ }, { "type": "object", - "required": [ - "enabled_payment_methods" - ], + "required": ["enabled_payment_methods"], "properties": { "enabled_payment_methods": { "type": "array", @@ -5729,9 +5317,7 @@ }, { "type": "object", - "required": [ - "allowed_domains" - ], + "required": ["allowed_domains"], "properties": { "domain_name": { "type": "string", @@ -5900,12 +5486,7 @@ }, "CaptureStatus": { "type": "string", - "enum": [ - "started", - "charged", - "pending", - "failed" - ] + "enum": ["started", "charged", "pending", "failed"] }, "Card": { "type": "object", @@ -5982,11 +5563,7 @@ "CardAdditionalData": { "type": "object", "description": "Masked payout method details for card payout method", - "required": [ - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], + "required": ["card_exp_month", "card_exp_year", "card_holder_name"], "properties": { "card_issuer": { "type": "string", @@ -6113,9 +5690,7 @@ }, "CardDetailFromLocker": { "type": "object", - "required": [ - "saved_to_locker" - ], + "required": ["saved_to_locker"], "properties": { "issuer_country": { "allOf": [ @@ -6176,9 +5751,7 @@ }, "CardDetailUpdate": { "type": "object", - "required": [ - "card_holder_name" - ], + "required": ["card_holder_name"], "properties": { "card_holder_name": { "type": "string", @@ -6213,9 +5786,7 @@ }, "CardNetworkTypes": { "type": "object", - "required": [ - "eligible_connectors" - ], + "required": ["eligible_connectors"], "properties": { "card_network": { "allOf": [ @@ -6239,10 +5810,7 @@ "type": "string" }, "description": "The list of eligible connectors for a given card network", - "example": [ - "stripe", - "adyen" - ] + "example": ["stripe", "adyen"] } } }, @@ -6279,9 +5847,7 @@ "oneOf": [ { "type": "object", - "required": [ - "knet" - ], + "required": ["knet"], "properties": { "knet": { "type": "object" @@ -6290,9 +5856,7 @@ }, { "type": "object", - "required": [ - "benefit" - ], + "required": ["benefit"], "properties": { "benefit": { "type": "object" @@ -6301,9 +5865,7 @@ }, { "type": "object", - "required": [ - "momo_atm" - ], + "required": ["momo_atm"], "properties": { "momo_atm": { "type": "object" @@ -6312,9 +5874,7 @@ }, { "type": "object", - "required": [ - "card_redirect" - ], + "required": ["card_redirect"], "properties": { "card_redirect": { "type": "object" @@ -6395,9 +5955,7 @@ }, "CardToken": { "type": "object", - "required": [ - "card_holder_name" - ], + "required": ["card_holder_name"], "properties": { "card_holder_name": { "type": "string", @@ -6413,9 +5971,7 @@ }, "CardTokenAdditionalData": { "type": "object", - "required": [ - "card_holder_name" - ], + "required": ["card_holder_name"], "properties": { "card_holder_name": { "type": "string", @@ -6441,10 +5997,7 @@ }, "CardType": { "type": "string", - "enum": [ - "credit", - "debit" - ] + "enum": ["credit", "debit"] }, "CashappQr": { "type": "object" @@ -6452,9 +6005,7 @@ "ChargeRefunds": { "type": "object", "description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.", - "required": [ - "charge_id" - ], + "required": ["charge_id"], "properties": { "charge_id": { "type": "string", @@ -6542,12 +6093,7 @@ "Comparison": { "type": "object", "description": "Represents a single comparison condition.", - "required": [ - "lhs", - "comparison", - "value", - "metadata" - ], + "required": ["lhs", "comparison", "value", "metadata"], "properties": { "lhs": { "type": "string", @@ -6669,10 +6215,7 @@ }, "ConnectorFeatureMatrixResponse": { "type": "object", - "required": [ - "name", - "supported_payment_methods" - ], + "required": ["name", "supported_payment_methods"], "properties": { "name": { "type": "string" @@ -6738,16 +6281,11 @@ "oneOf": [ { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "priority" - ] + "enum": ["priority"] }, "data": { "type": "array", @@ -6759,16 +6297,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "volume_split" - ] + "enum": ["volume_split"] }, "data": { "type": "array", @@ -6785,10 +6318,7 @@ }, "ConnectorStatus": { "type": "string", - "enum": [ - "inactive", - "active" - ] + "enum": ["inactive", "active"] }, "ConnectorType": { "type": "string", @@ -6809,10 +6339,7 @@ }, "ConnectorVolumeSplit": { "type": "object", - "required": [ - "connector", - "split" - ], + "required": ["connector", "split"], "properties": { "connector": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -7107,10 +6634,7 @@ "CreateApiKeyRequest": { "type": "object", "description": "The request body for creating an API Key.", - "required": [ - "name", - "expiration" - ], + "required": ["name", "expiration"], "properties": { "name": { "type": "string", @@ -7403,9 +6927,7 @@ "CustomerAcceptance": { "type": "object", "description": "This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.", - "required": [ - "acceptance_type" - ], + "required": ["acceptance_type"], "properties": { "acceptance_type": { "$ref": "#/components/schemas/AcceptanceType" @@ -7471,9 +6993,7 @@ "CustomerDetails": { "type": "object", "description": "Passing this object creates a new customer or attaches an existing customer to the payment", - "required": [ - "id" - ], + "required": ["id"], "properties": { "id": { "type": "string", @@ -7659,9 +7179,7 @@ }, "CustomerPaymentMethodsListResponse": { "type": "object", - "required": [ - "customer_payment_methods" - ], + "required": ["customer_payment_methods"], "properties": { "customer_payment_methods": { "type": "array", @@ -7680,10 +7198,7 @@ "CustomerRequest": { "type": "object", "description": "The customer details", - "required": [ - "name", - "email" - ], + "required": ["name", "email"], "properties": { "merchant_reference_id": { "type": "string", @@ -7752,11 +7267,7 @@ }, "CustomerResponse": { "type": "object", - "required": [ - "id", - "merchant_reference_id", - "created_at" - ], + "required": ["id", "merchant_reference_id", "created_at"], "properties": { "id": { "type": "string", @@ -7845,10 +7356,7 @@ }, "CustomerUpdateRequest": { "type": "object", - "required": [ - "name", - "email" - ], + "required": ["name", "email"], "properties": { "merchant_reference_id": { "type": "string", @@ -7923,26 +7431,16 @@ }, "DecoupledAuthenticationType": { "type": "string", - "enum": [ - "challenge", - "frictionless" - ] + "enum": ["challenge", "frictionless"] }, "DeviceChannel": { "type": "string", "description": "Device Channel indicating whether request is coming from App or Browser", - "enum": [ - "APP", - "BRW" - ] + "enum": ["APP", "BRW"] }, "DisplayAmountOnSdk": { "type": "object", - "required": [ - "net_amount", - "order_tax_amount", - "shipping_cost" - ], + "required": ["net_amount", "order_tax_amount", "shipping_cost"], "properties": { "net_amount": { "type": "string", @@ -8123,11 +7621,7 @@ "DisputeStage": { "type": "string", "description": "Stage of the dispute", - "enum": [ - "pre_dispute", - "dispute", - "pre_arbitration" - ] + "enum": ["pre_dispute", "dispute", "pre_arbitration"] }, "DisputeStatus": { "type": "string", @@ -8144,11 +7638,7 @@ }, "DokuBankTransferInstructions": { "type": "object", - "required": [ - "expires_at", - "reference", - "instructions_url" - ], + "required": ["expires_at", "reference", "instructions_url"], "properties": { "expires_at": { "type": "string", @@ -8204,9 +7694,7 @@ "oneOf": [ { "type": "object", - "required": [ - "Variants" - ], + "required": ["Variants"], "properties": { "Variants": { "$ref": "#/components/schemas/SizeVariants" @@ -8215,9 +7703,7 @@ }, { "type": "object", - "required": [ - "Percentage" - ], + "required": ["Percentage"], "properties": { "Percentage": { "type": "integer", @@ -8228,9 +7714,7 @@ }, { "type": "object", - "required": [ - "Pixels" - ], + "required": ["Pixels"], "properties": { "Pixels": { "type": "integer", @@ -8244,18 +7728,12 @@ "EnablePaymentLinkRequest": { "type": "string", "description": "Whether payment link is requested to be enabled or not for this transaction", - "enum": [ - "Enable", - "Skip" - ] + "enum": ["Enable", "Skip"] }, "EnabledPaymentMethod": { "type": "object", "description": "Object for EnabledPaymentMethod", - "required": [ - "payment_method", - "payment_method_types" - ], + "required": ["payment_method", "payment_method_types"], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -8273,12 +7751,7 @@ "EphemeralKeyCreateResponse": { "type": "object", "description": "ephemeral_key for the customer_id mentioned", - "required": [ - "customer_id", - "created_at", - "expires", - "secret" - ], + "required": ["customer_id", "created_at", "expires", "secret"], "properties": { "customer_id": { "type": "string", @@ -8316,10 +7789,7 @@ "ErrorDetails": { "type": "object", "description": "Error details for the payment", - "required": [ - "code", - "message" - ], + "required": ["code", "message"], "properties": { "code": { "type": "string", @@ -8343,13 +7813,7 @@ }, "EventClass": { "type": "string", - "enum": [ - "payments", - "refunds", - "disputes", - "mandates", - "payouts" - ] + "enum": ["payments", "refunds", "disputes", "mandates", "payouts"] }, "EventListItemResponse": { "type": "object", @@ -8421,10 +7885,7 @@ }, { "type": "object", - "required": [ - "request", - "response" - ], + "required": ["request", "response"], "properties": { "request": { "$ref": "#/components/schemas/OutgoingWebhookRequestContent" @@ -8543,9 +8004,7 @@ }, "ExtendedCardInfoConfig": { "type": "object", - "required": [ - "public_key" - ], + "required": ["public_key"], "properties": { "public_key": { "type": "string", @@ -8563,9 +8022,7 @@ }, "ExtendedCardInfoResponse": { "type": "object", - "required": [ - "payload" - ], + "required": ["payload"], "properties": { "payload": { "type": "string" @@ -8575,17 +8032,12 @@ "External3dsAuthenticationRequest": { "type": "string", "description": "Whether 3ds authentication is requested or not", - "enum": [ - "Enable", - "Skip" - ] + "enum": ["Enable", "Skip"] }, "ExternalAuthenticationDetailsResponse": { "type": "object", "description": "Details of external authentication", - "required": [ - "status" - ], + "required": ["status"], "properties": { "authentication_flow": { "allOf": [ @@ -8627,10 +8079,7 @@ }, "FeatureMatrixListResponse": { "type": "object", - "required": [ - "connector_count", - "connectors" - ], + "required": ["connector_count", "connectors"], "properties": { "connector_count": { "type": "integer", @@ -8690,72 +8139,49 @@ "FeatureStatus": { "type": "string", "description": "The status of the feature", - "enum": [ - "not_supported", - "supported" - ] + "enum": ["not_supported", "supported"] }, "FieldType": { "oneOf": [ { "type": "string", - "enum": [ - "user_card_number" - ] + "enum": ["user_card_number"] }, { "type": "string", - "enum": [ - "user_card_expiry_month" - ] + "enum": ["user_card_expiry_month"] }, { "type": "string", - "enum": [ - "user_card_expiry_year" - ] + "enum": ["user_card_expiry_year"] }, { "type": "string", - "enum": [ - "user_card_cvc" - ] + "enum": ["user_card_cvc"] }, { "type": "string", - "enum": [ - "user_full_name" - ] + "enum": ["user_full_name"] }, { "type": "string", - "enum": [ - "user_email_address" - ] + "enum": ["user_email_address"] }, { "type": "string", - "enum": [ - "user_phone_number" - ] + "enum": ["user_phone_number"] }, { "type": "string", - "enum": [ - "user_phone_number_country_code" - ] + "enum": ["user_phone_number_country_code"] }, { "type": "object", - "required": [ - "user_country" - ], + "required": ["user_country"], "properties": { "user_country": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8769,15 +8195,11 @@ }, { "type": "object", - "required": [ - "user_currency" - ], + "required": ["user_currency"], "properties": { "user_currency": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8791,57 +8213,39 @@ }, { "type": "string", - "enum": [ - "user_crypto_currency_network" - ] + "enum": ["user_crypto_currency_network"] }, { "type": "string", - "enum": [ - "user_billing_name" - ] + "enum": ["user_billing_name"] }, { "type": "string", - "enum": [ - "user_address_line1" - ] + "enum": ["user_address_line1"] }, { "type": "string", - "enum": [ - "user_address_line2" - ] + "enum": ["user_address_line2"] }, { "type": "string", - "enum": [ - "user_address_city" - ] + "enum": ["user_address_city"] }, { "type": "string", - "enum": [ - "user_address_pincode" - ] + "enum": ["user_address_pincode"] }, { "type": "string", - "enum": [ - "user_address_state" - ] + "enum": ["user_address_state"] }, { "type": "object", - "required": [ - "user_address_country" - ], + "required": ["user_address_country"], "properties": { "user_address_country": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8855,51 +8259,35 @@ }, { "type": "string", - "enum": [ - "user_shipping_name" - ] + "enum": ["user_shipping_name"] }, { "type": "string", - "enum": [ - "user_shipping_address_line1" - ] + "enum": ["user_shipping_address_line1"] }, { "type": "string", - "enum": [ - "user_shipping_address_line2" - ] + "enum": ["user_shipping_address_line2"] }, { "type": "string", - "enum": [ - "user_shipping_address_city" - ] + "enum": ["user_shipping_address_city"] }, { "type": "string", - "enum": [ - "user_shipping_address_pincode" - ] + "enum": ["user_shipping_address_pincode"] }, { "type": "string", - "enum": [ - "user_shipping_address_state" - ] + "enum": ["user_shipping_address_state"] }, { "type": "object", - "required": [ - "user_shipping_address_country" - ], + "required": ["user_shipping_address_country"], "properties": { "user_shipping_address_country": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8913,39 +8301,27 @@ }, { "type": "string", - "enum": [ - "user_blik_code" - ] + "enum": ["user_blik_code"] }, { "type": "string", - "enum": [ - "user_bank" - ] + "enum": ["user_bank"] }, { "type": "string", - "enum": [ - "user_bank_account_number" - ] + "enum": ["user_bank_account_number"] }, { "type": "string", - "enum": [ - "text" - ] + "enum": ["text"] }, { "type": "object", - "required": [ - "drop_down" - ], + "required": ["drop_down"], "properties": { "drop_down": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8959,27 +8335,19 @@ }, { "type": "string", - "enum": [ - "user_date_of_birth" - ] + "enum": ["user_date_of_birth"] }, { "type": "string", - "enum": [ - "user_vpa_id" - ] + "enum": ["user_vpa_id"] }, { "type": "object", - "required": [ - "language_preference" - ], + "required": ["language_preference"], "properties": { "language_preference": { "type": "object", - "required": [ - "options" - ], + "required": ["options"], "properties": { "options": { "type": "array", @@ -8993,89 +8361,59 @@ }, { "type": "string", - "enum": [ - "user_pix_key" - ] + "enum": ["user_pix_key"] }, { "type": "string", - "enum": [ - "user_cpf" - ] + "enum": ["user_cpf"] }, { "type": "string", - "enum": [ - "user_cnpj" - ] + "enum": ["user_cnpj"] }, { "type": "string", - "enum": [ - "user_iban" - ] + "enum": ["user_iban"] }, { "type": "string", - "enum": [ - "user_bsb_number" - ] + "enum": ["user_bsb_number"] }, { "type": "string", - "enum": [ - "user_bank_sort_code" - ] + "enum": ["user_bank_sort_code"] }, { "type": "string", - "enum": [ - "user_bank_routing_number" - ] + "enum": ["user_bank_routing_number"] }, { "type": "string", - "enum": [ - "user_msisdn" - ] + "enum": ["user_msisdn"] }, { "type": "string", - "enum": [ - "user_client_identifier" - ] + "enum": ["user_client_identifier"] }, { "type": "string", - "enum": [ - "order_details_product_name" - ] + "enum": ["order_details_product_name"] } ], "description": "Possible field type of required fields in payment_method_data" }, "ForceSync": { "type": "string", - "enum": [ - "true", - "false" - ] + "enum": ["true", "false"] }, "FrmAction": { "type": "string", - "enum": [ - "cancel_txn", - "auto_refund", - "manual_review" - ] + "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": [ - "gateway", - "payment_methods" - ], + "required": ["gateway", "payment_methods"], "properties": { "gateway": { "$ref": "#/components/schemas/ConnectorType" @@ -9093,9 +8431,7 @@ "FrmMessage": { "type": "object", "description": "frm message is an object sent inside the payments response...when frm is invoked, its value is Some(...), else its None", - "required": [ - "frm_name" - ], + "required": ["frm_name"], "properties": { "frm_name": { "type": "string" @@ -9129,9 +8465,7 @@ "FrmPaymentMethod": { "type": "object", "description": "Details of FrmPaymentMethod are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table", - "required": [ - "payment_method" - ], + "required": ["payment_method"], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -9158,12 +8492,7 @@ "FrmPaymentMethodType": { "type": "object", "description": "Details of FrmPaymentMethodType are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table", - "required": [ - "payment_method_type", - "card_networks", - "flow", - "action" - ], + "required": ["payment_method_type", "card_networks", "flow", "action"], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethodType" @@ -9182,18 +8511,12 @@ }, "FrmPreferredFlowTypes": { "type": "string", - "enum": [ - "pre", - "post" - ] + "enum": ["pre", "post"] }, "FutureUsage": { "type": "string", "description": "Indicates that you intend to make future payments with the payment methods used for this Payment. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.\n- On_session - Payment method saved only at hyperswitch when consent is provided by the user. CVV will asked during the returning user payment\n- Off_session - Payment method saved at both hyperswitch and Processor when consent is provided by the user. No input is required during the returning user payment.", - "enum": [ - "off_session", - "on_session" - ] + "enum": ["off_session", "on_session"] }, "GcashRedirection": { "type": "object" @@ -9229,9 +8552,7 @@ "oneOf": [ { "type": "object", - "required": [ - "givex" - ], + "required": ["givex"], "properties": { "givex": { "$ref": "#/components/schemas/GivexGiftCardAdditionalData" @@ -9240,9 +8561,7 @@ }, { "type": "object", - "required": [ - "pay_safe_card" - ], + "required": ["pay_safe_card"], "properties": { "pay_safe_card": { "type": "object" @@ -9255,9 +8574,7 @@ "oneOf": [ { "type": "object", - "required": [ - "givex" - ], + "required": ["givex"], "properties": { "givex": { "$ref": "#/components/schemas/GiftCardDetails" @@ -9266,9 +8583,7 @@ }, { "type": "object", - "required": [ - "pay_safe_card" - ], + "required": ["pay_safe_card"], "properties": { "pay_safe_card": { "type": "object" @@ -9279,10 +8594,7 @@ }, "GiftCardDetails": { "type": "object", - "required": [ - "number", - "cvc" - ], + "required": ["number", "cvc"], "properties": { "number": { "type": "string", @@ -9334,9 +8646,7 @@ }, "GivexGiftCardAdditionalData": { "type": "object", - "required": [ - "last4" - ], + "required": ["last4"], "properties": { "last4": { "type": "string", @@ -9350,10 +8660,7 @@ }, "GooglePayAssuranceDetails": { "type": "object", - "required": [ - "card_holder_authenticated", - "account_verified" - ], + "required": ["card_holder_authenticated", "account_verified"], "properties": { "card_holder_authenticated": { "type": "boolean", @@ -9367,10 +8674,7 @@ }, "GooglePayPaymentMethodInfo": { "type": "object", - "required": [ - "card_network", - "card_details" - ], + "required": ["card_network", "card_details"], "properties": { "card_network": { "type": "string", @@ -9454,11 +8758,7 @@ }, "GooglePayThirdPartySdk": { "type": "object", - "required": [ - "delayed_session_token", - "connector", - "sdk_next_action" - ], + "required": ["delayed_session_token", "connector", "sdk_next_action"], "properties": { "delayed_session_token": { "type": "boolean", @@ -9478,12 +8778,7 @@ }, "GooglePayWalletData": { "type": "object", - "required": [ - "type", - "description", - "info", - "tokenization_data" - ], + "required": ["type", "description", "info", "tokenization_data"], "properties": { "type": { "type": "string", @@ -9503,10 +8798,7 @@ }, "GpayAllowedMethodsParameters": { "type": "object", - "required": [ - "allowed_auth_methods", - "allowed_card_networks" - ], + "required": ["allowed_auth_methods", "allowed_card_networks"], "properties": { "allowed_auth_methods": { "type": "array", @@ -9544,11 +8836,7 @@ }, "GpayAllowedPaymentMethods": { "type": "object", - "required": [ - "type", - "parameters", - "tokenization_specification" - ], + "required": ["type", "parameters", "tokenization_specification"], "properties": { "type": { "type": "string", @@ -9564,17 +8852,11 @@ }, "GpayBillingAddressFormat": { "type": "string", - "enum": [ - "FULL", - "MIN" - ] + "enum": ["FULL", "MIN"] }, "GpayBillingAddressParameters": { "type": "object", - "required": [ - "phone_number_required", - "format" - ], + "required": ["phone_number_required", "format"], "properties": { "phone_number_required": { "type": "boolean", @@ -9587,9 +8869,7 @@ }, "GpayMerchantInfo": { "type": "object", - "required": [ - "merchant_name" - ], + "required": ["merchant_name"], "properties": { "merchant_id": { "type": "string", @@ -9614,9 +8894,7 @@ }, "GpayShippingAddressParameters": { "type": "object", - "required": [ - "phone_number_required" - ], + "required": ["phone_number_required"], "properties": { "phone_number_required": { "type": "boolean", @@ -9626,9 +8904,7 @@ }, "GpayTokenParameters": { "type": "object", - "required": [ - "gateway" - ], + "required": ["gateway"], "properties": { "gateway": { "type": "string", @@ -9651,10 +8927,7 @@ }, "GpayTokenizationData": { "type": "object", - "required": [ - "type", - "token" - ], + "required": ["type", "token"], "properties": { "type": { "type": "string", @@ -9668,10 +8941,7 @@ }, "GpayTokenizationSpecification": { "type": "object", - "required": [ - "type", - "parameters" - ], + "required": ["type", "parameters"], "properties": { "type": { "type": "string", @@ -9778,21 +9048,11 @@ }, "GsmDecision": { "type": "string", - "enum": [ - "retry", - "requeue", - "do_default" - ] + "enum": ["retry", "requeue", "do_default"] }, "GsmDeleteRequest": { "type": "object", - "required": [ - "connector", - "flow", - "sub_flow", - "code", - "message" - ], + "required": ["connector", "flow", "sub_flow", "code", "message"], "properties": { "connector": { "type": "string", @@ -9919,13 +9179,7 @@ }, "GsmRetrieveRequest": { "type": "object", - "required": [ - "connector", - "flow", - "sub_flow", - "code", - "message" - ], + "required": ["connector", "flow", "sub_flow", "code", "message"], "properties": { "connector": { "$ref": "#/components/schemas/Connector" @@ -9950,13 +9204,7 @@ }, "GsmUpdateRequest": { "type": "object", - "required": [ - "connector", - "flow", - "sub_flow", - "code", - "message" - ], + "required": ["connector", "flow", "sub_flow", "code", "message"], "properties": { "connector": { "type": "string", @@ -10024,9 +9272,7 @@ "IfStatement": { "type": "object", "description": "Represents an IF statement with conditions and optional nested IF statements\n\n```text\npayment.method = card {\npayment.method.cardtype = (credit, debit) {\npayment.method.network = (amex, rupay, diners)\n}\n}\n```", - "required": [ - "condition" - ], + "required": ["condition"], "properties": { "condition": { "type": "array", @@ -10163,10 +9409,7 @@ }, "KlarnaSessionTokenResponse": { "type": "object", - "required": [ - "session_token", - "session_id" - ], + "required": ["session_token", "session_id"], "properties": { "session_token": { "type": "string", @@ -10193,9 +9436,7 @@ }, "ListBlocklistQuery": { "type": "object", - "required": [ - "data_kind" - ], + "required": ["data_kind"], "properties": { "data_kind": { "$ref": "#/components/schemas/BlocklistDataKind" @@ -10225,10 +9466,7 @@ }, "MandateAmountData": { "type": "object", - "required": [ - "amount", - "currency" - ], + "required": ["amount", "currency"], "properties": { "amount": { "type": "integer", @@ -10410,10 +9648,7 @@ }, "MandateRevokedResponse": { "type": "object", - "required": [ - "mandate_id", - "status" - ], + "required": ["mandate_id", "status"], "properties": { "mandate_id": { "type": "string", @@ -10439,20 +9674,13 @@ "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" @@ -10461,9 +9689,7 @@ }, { "type": "object", - "required": [ - "multi_use" - ], + "required": ["multi_use"], "properties": { "multi_use": { "allOf": [ @@ -10479,9 +9705,7 @@ }, "MaskedBankDetails": { "type": "object", - "required": [ - "mask" - ], + "required": ["mask"], "properties": { "mask": { "type": "string" @@ -10490,9 +9714,7 @@ }, "MbWayRedirection": { "type": "object", - "required": [ - "telephone_number" - ], + "required": ["telephone_number"], "properties": { "telephone_number": { "type": "string", @@ -10502,9 +9724,7 @@ }, "MerchantAccountCreate": { "type": "object", - "required": [ - "merchant_name" - ], + "required": ["merchant_name"], "properties": { "merchant_name": { "type": "string", @@ -10532,16 +9752,11 @@ "oneOf": [ { "type": "object", - "required": [ - "iban" - ], + "required": ["iban"], "properties": { "iban": { "type": "object", - "required": [ - "iban", - "name" - ], + "required": ["iban", "name"], "properties": { "iban": { "type": "string" @@ -10559,17 +9774,11 @@ }, { "type": "object", - "required": [ - "bacs" - ], + "required": ["bacs"], "properties": { "bacs": { "type": "object", - "required": [ - "account_number", - "sort_code", - "name" - ], + "required": ["account_number", "sort_code", "name"], "properties": { "account_number": { "type": "string" @@ -10592,10 +9801,7 @@ }, "MerchantAccountDeleteResponse": { "type": "object", - "required": [ - "merchant_id", - "deleted" - ], + "required": ["merchant_id", "deleted"], "properties": { "merchant_id": { "type": "string", @@ -10787,11 +9993,7 @@ }, "MerchantConnectorDeleteResponse": { "type": "object", - "required": [ - "merchant_id", - "id", - "deleted" - ], + "required": ["merchant_id", "id", "deleted"], "properties": { "merchant_id": { "type": "string", @@ -10829,9 +10031,7 @@ "MerchantConnectorDetailsWrap": { "type": "object", "description": "Merchant connector details used to make payments.", - "required": [ - "creds_identifier" - ], + "required": ["creds_identifier"], "properties": { "creds_identifier": { "type": "string", @@ -10849,9 +10049,7 @@ }, "MerchantConnectorId": { "type": "object", - "required": [ - "id" - ], + "required": ["id"], "properties": { "id": { "type": "string" @@ -11048,11 +10246,7 @@ "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", - "status", - "merchant_id" - ], + "required": ["connector_type", "status", "merchant_id"], "properties": { "connector_type": { "$ref": "#/components/schemas/ConnectorType" @@ -11144,10 +10338,7 @@ }, "MerchantConnectorWebhookDetails": { "type": "object", - "required": [ - "merchant_secret", - "additional_secret" - ], + "required": ["merchant_secret", "additional_secret"], "properties": { "merchant_secret": { "type": "string", @@ -11234,9 +10425,7 @@ "oneOf": [ { "type": "object", - "required": [ - "connector_recipient_id" - ], + "required": ["connector_recipient_id"], "properties": { "connector_recipient_id": { "type": "string", @@ -11246,9 +10435,7 @@ }, { "type": "object", - "required": [ - "wallet_id" - ], + "required": ["wallet_id"], "properties": { "wallet_id": { "type": "string", @@ -11258,9 +10445,7 @@ }, { "type": "object", - "required": [ - "account_data" - ], + "required": ["account_data"], "properties": { "account_data": { "$ref": "#/components/schemas/MerchantAccountData" @@ -11313,10 +10498,7 @@ }, "MetadataValue": { "type": "object", - "required": [ - "key", - "value" - ], + "required": ["key", "value"], "properties": { "key": { "type": "string" @@ -11328,9 +10510,7 @@ }, "MifinityData": { "type": "object", - "required": [ - "date_of_birth" - ], + "required": ["date_of_birth"], "properties": { "date_of_birth": { "type": "string", @@ -11349,35 +10529,24 @@ }, "MitExemptionRequest": { "type": "string", - "enum": [ - "Apply", - "Skip" - ] + "enum": ["Apply", "Skip"] }, "MobilePayRedirection": { "type": "object" }, "MobilePaymentConsent": { "type": "string", - "enum": [ - "consent_required", - "consent_not_required", - "consent_optional" - ] + "enum": ["consent_required", "consent_not_required", "consent_optional"] }, "MobilePaymentData": { "oneOf": [ { "type": "object", - "required": [ - "direct_carrier_billing" - ], + "required": ["direct_carrier_billing"], "properties": { "direct_carrier_billing": { "type": "object", - "required": [ - "msisdn" - ], + "required": ["msisdn"], "properties": { "msisdn": { "type": "string", @@ -11398,9 +10567,7 @@ }, "MobilePaymentNextStepData": { "type": "object", - "required": [ - "consent_data_required" - ], + "required": ["consent_data_required"], "properties": { "consent_data_required": { "$ref": "#/components/schemas/MobilePaymentConsent" @@ -11437,10 +10604,7 @@ }, "MultibancoTransferInstructions": { "type": "object", - "required": [ - "reference", - "entity" - ], + "required": ["reference", "entity"], "properties": { "reference": { "type": "string", @@ -11525,59 +10689,42 @@ }, "NextActionCall": { "type": "string", - "enum": [ - "post_session_tokens", - "confirm", - "sync", - "complete_authorize" - ] + "enum": ["post_session_tokens", "confirm", "sync", "complete_authorize"] }, "NextActionData": { "oneOf": [ { "type": "object", "description": "Contains the url for redirection flow", - "required": [ - "redirect_to_url", - "type" - ], + "required": ["redirect_to_url", "type"], "properties": { "redirect_to_url": { "type": "string" }, "type": { "type": "string", - "enum": [ - "redirect_to_url" - ] + "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" - ], + "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" - ] + "enum": ["display_bank_transfer_information"] } } }, { "type": "object", "description": "Contains third party sdk session token response", - "required": [ - "type" - ], + "required": ["type"], "properties": { "session_token": { "allOf": [ @@ -11589,20 +10736,14 @@ }, "type": { "type": "string", - "enum": [ - "third_party_sdk_session_token" - ] + "enum": ["third_party_sdk_session_token"] } } }, { "type": "object", "description": "Contains url for Qr code image, this qr code has to be shown in sdk", - "required": [ - "image_data_url", - "qr_code_url", - "type" - ], + "required": ["image_data_url", "qr_code_url", "type"], "properties": { "image_data_url": { "type": "string", @@ -11619,57 +10760,42 @@ }, "type": { "type": "string", - "enum": [ - "qr_code_information" - ] + "enum": ["qr_code_information"] } } }, { "type": "object", "description": "Contains url to fetch Qr code data", - "required": [ - "qr_code_fetch_url", - "type" - ], + "required": ["qr_code_fetch_url", "type"], "properties": { "qr_code_fetch_url": { "type": "string" }, "type": { "type": "string", - "enum": [ - "fetch_qr_code_information" - ] + "enum": ["fetch_qr_code_information"] } } }, { "type": "object", "description": "Contains the download url and the reference number for transaction", - "required": [ - "voucher_details", - "type" - ], + "required": ["voucher_details", "type"], "properties": { "voucher_details": { "type": "string" }, "type": { "type": "string", - "enum": [ - "display_voucher_information" - ] + "enum": ["display_voucher_information"] } } }, { "type": "object", "description": "Contains duration for displaying a wait screen, wait screen with timer is displayed by sdk", - "required": [ - "display_from_timestamp", - "type" - ], + "required": ["display_from_timestamp", "type"], "properties": { "display_from_timestamp": { "type": "integer" @@ -11680,65 +10806,48 @@ }, "type": { "type": "string", - "enum": [ - "wait_screen_information" - ] + "enum": ["wait_screen_information"] } } }, { "type": "object", "description": "Contains the information regarding three_ds_method_data submission, three_ds authentication, and authorization flows", - "required": [ - "three_ds_data", - "type" - ], + "required": ["three_ds_data", "type"], "properties": { "three_ds_data": { "$ref": "#/components/schemas/ThreeDsData" }, "type": { "type": "string", - "enum": [ - "three_ds_invoke" - ] + "enum": ["three_ds_invoke"] } } }, { "type": "object", - "required": [ - "next_action_data", - "type" - ], + "required": ["next_action_data", "type"], "properties": { "next_action_data": { "$ref": "#/components/schemas/SdkNextActionData" }, "type": { "type": "string", - "enum": [ - "invoke_sdk_client" - ] + "enum": ["invoke_sdk_client"] } } }, { "type": "object", "description": "Contains consent to collect otp for mobile payment", - "required": [ - "consent_data_required", - "type" - ], + "required": ["consent_data_required", "type"], "properties": { "consent_data_required": { "$ref": "#/components/schemas/MobilePaymentConsent" }, "type": { "type": "string", - "enum": [ - "collect_otp" - ] + "enum": ["collect_otp"] } } } @@ -11840,10 +10949,7 @@ "NumberComparison": { "type": "object", "description": "Represents a number comparison for \"NumberComparisonArrayValue\"", - "required": [ - "comparisonType", - "number" - ], + "required": ["comparisonType", "number"], "properties": { "comparisonType": { "$ref": "#/components/schemas/ComparisonType" @@ -11855,10 +10961,7 @@ }, "OnlineMandate": { "type": "object", - "required": [ - "ip_address", - "user_agent" - ], + "required": ["ip_address", "user_agent"], "properties": { "ip_address": { "type": "string", @@ -11876,9 +10979,7 @@ "oneOf": [ { "type": "object", - "required": [ - "open_banking_pis" - ], + "required": ["open_banking_pis"], "properties": { "open_banking_pis": { "type": "object" @@ -11904,9 +11005,7 @@ }, "OpenBankingSessionToken": { "type": "object", - "required": [ - "open_banking_session_token" - ], + "required": ["open_banking_session_token"], "properties": { "open_banking_session_token": { "type": "string", @@ -11916,11 +11015,7 @@ }, "OrderDetailsWithAmount": { "type": "object", - "required": [ - "product_name", - "quantity", - "amount" - ], + "required": ["product_name", "quantity", "amount"], "properties": { "product_name": { "type": "string", @@ -11998,16 +11093,11 @@ }, "OrderFulfillmentTimeOrigin": { "type": "string", - "enum": [ - "create", - "confirm" - ] + "enum": ["create", "confirm"] }, "OrganizationCreateRequest": { "type": "object", - "required": [ - "organization_name" - ], + "required": ["organization_name"], "properties": { "organization_name": { "type": "string", @@ -12028,11 +11118,7 @@ }, "OrganizationResponse": { "type": "object", - "required": [ - "id", - "modified_at", - "created_at" - ], + "required": ["id", "modified_at", "created_at"], "properties": { "id": { "type": "string", @@ -12089,12 +11175,7 @@ }, "OutgoingWebhook": { "type": "object", - "required": [ - "merchant_id", - "event_id", - "event_type", - "content" - ], + "required": ["merchant_id", "event_id", "event_type", "content"], "properties": { "merchant_id": { "type": "string", @@ -12122,16 +11203,11 @@ { "type": "object", "title": "PaymentsResponse", - "required": [ - "type", - "object" - ], + "required": ["type", "object"], "properties": { "type": { "type": "string", - "enum": [ - "payment_details" - ] + "enum": ["payment_details"] }, "object": { "$ref": "#/components/schemas/PaymentsResponse" @@ -12141,16 +11217,11 @@ { "type": "object", "title": "RefundResponse", - "required": [ - "type", - "object" - ], + "required": ["type", "object"], "properties": { "type": { "type": "string", - "enum": [ - "refund_details" - ] + "enum": ["refund_details"] }, "object": { "$ref": "#/components/schemas/RefundResponse" @@ -12160,16 +11231,11 @@ { "type": "object", "title": "DisputeResponse", - "required": [ - "type", - "object" - ], + "required": ["type", "object"], "properties": { "type": { "type": "string", - "enum": [ - "dispute_details" - ] + "enum": ["dispute_details"] }, "object": { "$ref": "#/components/schemas/DisputeResponse" @@ -12179,16 +11245,11 @@ { "type": "object", "title": "MandateResponse", - "required": [ - "type", - "object" - ], + "required": ["type", "object"], "properties": { "type": { "type": "string", - "enum": [ - "mandate_details" - ] + "enum": ["mandate_details"] }, "object": { "$ref": "#/components/schemas/MandateResponse" @@ -12198,16 +11259,11 @@ { "type": "object", "title": "PayoutCreateResponse", - "required": [ - "type", - "object" - ], + "required": ["type", "object"], "properties": { "type": { "type": "string", - "enum": [ - "payout_details" - ] + "enum": ["payout_details"] }, "object": { "$ref": "#/components/schemas/PayoutCreateResponse" @@ -12222,10 +11278,7 @@ "OutgoingWebhookRequestContent": { "type": "object", "description": "The request information (headers and body) sent in the webhook.", - "required": [ - "body", - "headers" - ], + "required": ["body", "headers"], "properties": { "body": { "type": "string", @@ -12248,14 +11301,8 @@ }, "description": "The request headers sent in the webhook.", "example": [ - [ - "content-type", - "application/json" - ], - [ - "content-length", - "1024" - ] + ["content-type", "application/json"], + ["content-length", "1024"] ] } } @@ -12286,14 +11333,8 @@ }, "description": "The response headers received for the webhook sent.", "example": [ - [ - "content-type", - "application/json" - ], - [ - "content-length", - "1024" - ] + ["content-type", "application/json"], + ["content-length", "1024"] ], "nullable": true }, @@ -12317,9 +11358,7 @@ "oneOf": [ { "type": "object", - "required": [ - "klarna_redirect" - ], + "required": ["klarna_redirect"], "properties": { "klarna_redirect": { "type": "object", @@ -12344,16 +11383,12 @@ }, { "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", @@ -12365,9 +11400,7 @@ }, { "type": "object", - "required": [ - "klarna_checkout" - ], + "required": ["klarna_checkout"], "properties": { "klarna_checkout": { "type": "object" @@ -12376,9 +11409,7 @@ }, { "type": "object", - "required": [ - "affirm_redirect" - ], + "required": ["affirm_redirect"], "properties": { "affirm_redirect": { "type": "object", @@ -12388,9 +11419,7 @@ }, { "type": "object", - "required": [ - "afterpay_clearpay_redirect" - ], + "required": ["afterpay_clearpay_redirect"], "properties": { "afterpay_clearpay_redirect": { "type": "object", @@ -12412,9 +11441,7 @@ }, { "type": "object", - "required": [ - "pay_bright_redirect" - ], + "required": ["pay_bright_redirect"], "properties": { "pay_bright_redirect": { "type": "object", @@ -12424,9 +11451,7 @@ }, { "type": "object", - "required": [ - "walley_redirect" - ], + "required": ["walley_redirect"], "properties": { "walley_redirect": { "type": "object", @@ -12436,9 +11461,7 @@ }, { "type": "object", - "required": [ - "alma_redirect" - ], + "required": ["alma_redirect"], "properties": { "alma_redirect": { "type": "object", @@ -12448,9 +11471,7 @@ }, { "type": "object", - "required": [ - "atome_redirect" - ], + "required": ["atome_redirect"], "properties": { "atome_redirect": { "type": "object" @@ -12461,9 +11482,7 @@ }, "PayPalWalletData": { "type": "object", - "required": [ - "token" - ], + "required": ["token"], "properties": { "token": { "type": "string", @@ -12728,9 +11747,7 @@ "oneOf": [ { "type": "object", - "required": [ - "Stripe" - ], + "required": ["Stripe"], "properties": { "Stripe": { "$ref": "#/components/schemas/StripeChargeType" @@ -12780,9 +11797,7 @@ }, "PaymentExperienceTypes": { "type": "object", - "required": [ - "eligible_connectors" - ], + "required": ["eligible_connectors"], "properties": { "payment_experience_type": { "allOf": [ @@ -12798,18 +11813,13 @@ "type": "string" }, "description": "The list of eligible connectors for a given payment experience", - "example": [ - "stripe", - "adyen" - ] + "example": ["stripe", "adyen"] } } }, "PaymentLinkBackgroundImageConfig": { "type": "object", - "required": [ - "url" - ], + "required": ["url"], "properties": { "url": { "type": "string", @@ -13016,17 +12026,11 @@ }, "PaymentLinkDetailsLayout": { "type": "string", - "enum": [ - "layout1", - "layout2" - ] + "enum": ["layout1", "layout2"] }, "PaymentLinkInitiateRequest": { "type": "object", - "required": [ - "merchant_id", - "payment_id" - ], + "required": ["merchant_id", "payment_id"], "properties": { "merchant_id": { "type": "string" @@ -13038,10 +12042,7 @@ }, "PaymentLinkResponse": { "type": "object", - "required": [ - "link", - "payment_link_id" - ], + "required": ["link", "payment_link_id"], "properties": { "link": { "type": "string", @@ -13061,17 +12062,11 @@ "PaymentLinkStatus": { "type": "string", "description": "Status Of the Payment Link", - "enum": [ - "active", - "expired" - ] + "enum": ["active", "expired"] }, "PaymentLinkTransactionDetails": { "type": "object", - "required": [ - "key", - "value" - ], + "required": ["key", "value"], "properties": { "key": { "type": "string", @@ -13166,10 +12161,7 @@ }, "PaymentListResponse": { "type": "object", - "required": [ - "size", - "data" - ], + "required": ["size", "data"], "properties": { "size": { "type": "integer", @@ -13217,9 +12209,7 @@ }, { "type": "object", - "required": [ - "customer_id" - ], + "required": ["customer_id"], "properties": { "pm_collect_link_id": { "type": "string", @@ -13266,12 +12256,7 @@ }, { "type": "object", - "required": [ - "pm_collect_link_id", - "customer_id", - "expiry", - "link" - ], + "required": ["pm_collect_link_id", "customer_id", "expiry", "link"], "properties": { "pm_collect_link_id": { "type": "string", @@ -13358,9 +12343,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardDetail" @@ -13374,9 +12357,7 @@ { "type": "object", "title": "Card", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/Card" @@ -13386,9 +12367,7 @@ { "type": "object", "title": "CardRedirect", - "required": [ - "card_redirect" - ], + "required": ["card_redirect"], "properties": { "card_redirect": { "$ref": "#/components/schemas/CardRedirectData" @@ -13398,9 +12377,7 @@ { "type": "object", "title": "Wallet", - "required": [ - "wallet" - ], + "required": ["wallet"], "properties": { "wallet": { "$ref": "#/components/schemas/WalletData" @@ -13410,9 +12387,7 @@ { "type": "object", "title": "PayLater", - "required": [ - "pay_later" - ], + "required": ["pay_later"], "properties": { "pay_later": { "$ref": "#/components/schemas/PayLaterData" @@ -13422,9 +12397,7 @@ { "type": "object", "title": "BankRedirect", - "required": [ - "bank_redirect" - ], + "required": ["bank_redirect"], "properties": { "bank_redirect": { "$ref": "#/components/schemas/BankRedirectData" @@ -13434,9 +12407,7 @@ { "type": "object", "title": "BankDebit", - "required": [ - "bank_debit" - ], + "required": ["bank_debit"], "properties": { "bank_debit": { "$ref": "#/components/schemas/BankDebitData" @@ -13446,9 +12417,7 @@ { "type": "object", "title": "BankTransfer", - "required": [ - "bank_transfer" - ], + "required": ["bank_transfer"], "properties": { "bank_transfer": { "$ref": "#/components/schemas/BankTransferData" @@ -13458,9 +12427,7 @@ { "type": "object", "title": "RealTimePayment", - "required": [ - "real_time_payment" - ], + "required": ["real_time_payment"], "properties": { "real_time_payment": { "$ref": "#/components/schemas/RealTimePaymentData" @@ -13470,9 +12437,7 @@ { "type": "object", "title": "Crypto", - "required": [ - "crypto" - ], + "required": ["crypto"], "properties": { "crypto": { "$ref": "#/components/schemas/CryptoData" @@ -13482,23 +12447,17 @@ { "type": "string", "title": "MandatePayment", - "enum": [ - "mandate_payment" - ] + "enum": ["mandate_payment"] }, { "type": "string", "title": "Reward", - "enum": [ - "reward" - ] + "enum": ["reward"] }, { "type": "object", "title": "Upi", - "required": [ - "upi" - ], + "required": ["upi"], "properties": { "upi": { "$ref": "#/components/schemas/UpiData" @@ -13508,9 +12467,7 @@ { "type": "object", "title": "Voucher", - "required": [ - "voucher" - ], + "required": ["voucher"], "properties": { "voucher": { "$ref": "#/components/schemas/VoucherData" @@ -13520,9 +12477,7 @@ { "type": "object", "title": "GiftCard", - "required": [ - "gift_card" - ], + "required": ["gift_card"], "properties": { "gift_card": { "$ref": "#/components/schemas/GiftCardData" @@ -13532,9 +12487,7 @@ { "type": "object", "title": "CardToken", - "required": [ - "card_token" - ], + "required": ["card_token"], "properties": { "card_token": { "$ref": "#/components/schemas/CardToken" @@ -13544,9 +12497,7 @@ { "type": "object", "title": "OpenBanking", - "required": [ - "open_banking" - ], + "required": ["open_banking"], "properties": { "open_banking": { "$ref": "#/components/schemas/OpenBankingData" @@ -13556,9 +12507,7 @@ { "type": "object", "title": "MobilePayment", - "required": [ - "mobile_payment" - ], + "required": ["mobile_payment"], "properties": { "mobile_payment": { "$ref": "#/components/schemas/MobilePaymentData" @@ -13597,9 +12546,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardResponse" @@ -13608,9 +12555,7 @@ }, { "type": "object", - "required": [ - "bank_transfer" - ], + "required": ["bank_transfer"], "properties": { "bank_transfer": { "$ref": "#/components/schemas/BankTransferResponse" @@ -13619,9 +12564,7 @@ }, { "type": "object", - "required": [ - "wallet" - ], + "required": ["wallet"], "properties": { "wallet": { "$ref": "#/components/schemas/WalletResponse" @@ -13630,9 +12573,7 @@ }, { "type": "object", - "required": [ - "pay_later" - ], + "required": ["pay_later"], "properties": { "pay_later": { "$ref": "#/components/schemas/PaylaterResponse" @@ -13641,9 +12582,7 @@ }, { "type": "object", - "required": [ - "bank_redirect" - ], + "required": ["bank_redirect"], "properties": { "bank_redirect": { "$ref": "#/components/schemas/BankRedirectResponse" @@ -13652,9 +12591,7 @@ }, { "type": "object", - "required": [ - "crypto" - ], + "required": ["crypto"], "properties": { "crypto": { "$ref": "#/components/schemas/CryptoResponse" @@ -13663,9 +12600,7 @@ }, { "type": "object", - "required": [ - "bank_debit" - ], + "required": ["bank_debit"], "properties": { "bank_debit": { "$ref": "#/components/schemas/BankDebitResponse" @@ -13674,9 +12609,7 @@ }, { "type": "object", - "required": [ - "mandate_payment" - ], + "required": ["mandate_payment"], "properties": { "mandate_payment": { "type": "object" @@ -13685,9 +12618,7 @@ }, { "type": "object", - "required": [ - "reward" - ], + "required": ["reward"], "properties": { "reward": { "type": "object" @@ -13696,9 +12627,7 @@ }, { "type": "object", - "required": [ - "real_time_payment" - ], + "required": ["real_time_payment"], "properties": { "real_time_payment": { "$ref": "#/components/schemas/RealTimePaymentDataResponse" @@ -13707,9 +12636,7 @@ }, { "type": "object", - "required": [ - "upi" - ], + "required": ["upi"], "properties": { "upi": { "$ref": "#/components/schemas/UpiResponse" @@ -13718,9 +12645,7 @@ }, { "type": "object", - "required": [ - "voucher" - ], + "required": ["voucher"], "properties": { "voucher": { "$ref": "#/components/schemas/VoucherResponse" @@ -13729,9 +12654,7 @@ }, { "type": "object", - "required": [ - "gift_card" - ], + "required": ["gift_card"], "properties": { "gift_card": { "$ref": "#/components/schemas/GiftCardResponse" @@ -13740,9 +12663,7 @@ }, { "type": "object", - "required": [ - "card_redirect" - ], + "required": ["card_redirect"], "properties": { "card_redirect": { "$ref": "#/components/schemas/CardRedirectResponse" @@ -13751,9 +12672,7 @@ }, { "type": "object", - "required": [ - "card_token" - ], + "required": ["card_token"], "properties": { "card_token": { "$ref": "#/components/schemas/CardTokenResponse" @@ -13762,9 +12681,7 @@ }, { "type": "object", - "required": [ - "open_banking" - ], + "required": ["open_banking"], "properties": { "open_banking": { "$ref": "#/components/schemas/OpenBankingResponse" @@ -13773,9 +12690,7 @@ }, { "type": "object", - "required": [ - "mobile_payment" - ], + "required": ["mobile_payment"], "properties": { "mobile_payment": { "$ref": "#/components/schemas/MobilePaymentResponse" @@ -13811,9 +12726,7 @@ }, "PaymentMethodDeleteResponse": { "type": "object", - "required": [ - "id" - ], + "required": ["id"], "properties": { "id": { "type": "string", @@ -13852,9 +12765,7 @@ }, "PaymentMethodIntentCreate": { "type": "object", - "required": [ - "customer_id" - ], + "required": ["customer_id"], "properties": { "metadata": { "type": "object", @@ -13898,9 +12809,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardDetailFromLocker" @@ -13909,9 +12818,7 @@ }, { "type": "object", - "required": [ - "bank" - ], + "required": ["bank"], "properties": { "bank": { "$ref": "#/components/schemas/Bank" @@ -13937,11 +12844,7 @@ "$ref": "#/components/schemas/CountryAlpha2" }, "description": "The two-letter ISO currency code", - "example": [ - "US", - "UK", - "IN" - ], + "example": ["US", "UK", "IN"], "nullable": true }, "amount": { @@ -13958,10 +12861,7 @@ "$ref": "#/components/schemas/Currency" }, "description": "The three-letter ISO currency code", - "example": [ - "USD", - "EUR" - ], + "example": ["USD", "EUR"], "nullable": true }, "recurring_enabled": { @@ -13976,10 +12876,7 @@ "$ref": "#/components/schemas/CardNetwork" }, "description": "Indicates whether the payment method is eligible for card netwotks", - "example": [ - "visa", - "mastercard" - ], + "example": ["visa", "mastercard"], "nullable": true }, "limit": { @@ -13994,9 +12891,7 @@ }, "PaymentMethodListResponse": { "type": "object", - "required": [ - "payment_methods_enabled" - ], + "required": ["payment_methods_enabled"], "properties": { "payment_methods_enabled": { "type": "array", @@ -14009,9 +12904,7 @@ }, "PaymentMethodListResponseForPayments": { "type": "object", - "required": [ - "payment_methods_enabled" - ], + "required": ["payment_methods_enabled"], "properties": { "payment_methods_enabled": { "type": "array", @@ -14105,9 +12998,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardDetailFromLocker" @@ -14119,21 +13010,14 @@ "PaymentMethodStatus": { "type": "string", "description": "Payment Method Status", - "enum": [ - "active", - "inactive", - "processing", - "awaiting_data" - ] + "enum": ["active", "inactive", "processing", "awaiting_data"] }, "PaymentMethodSubtypeSpecificData": { "oneOf": [ { "type": "object", "title": "card", - "required": [ - "card_networks" - ], + "required": ["card_networks"], "properties": { "card_networks": { "type": "array", @@ -14146,9 +13030,7 @@ { "type": "object", "title": "bank", - "required": [ - "bank_names" - ], + "required": ["bank_names"], "properties": { "bank_names": { "type": "array", @@ -14263,9 +13145,7 @@ }, "PaymentMethodUpdate": { "type": "object", - "required": [ - "payment_method_data" - ], + "required": ["payment_method_data"], "properties": { "payment_method_data": { "$ref": "#/components/schemas/PaymentMethodUpdateData" @@ -14277,9 +13157,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardDetailUpdate" @@ -14291,9 +13169,7 @@ "PaymentMethodsEnabled": { "type": "object", "description": "Details of all the payment methods enabled for the connector for the given merchant account", - "required": [ - "payment_method_type" - ], + "required": ["payment_method_type"], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" @@ -14333,15 +13209,11 @@ }, { "type": "object", - "required": [ - "payment_processing_details_at" - ], + "required": ["payment_processing_details_at"], "properties": { "payment_processing_details_at": { "type": "string", - "enum": [ - "Hyperswitch" - ] + "enum": ["Hyperswitch"] } } } @@ -14349,15 +13221,11 @@ }, { "type": "object", - "required": [ - "payment_processing_details_at" - ], + "required": ["payment_processing_details_at"], "properties": { "payment_processing_details_at": { "type": "string", - "enum": [ - "Connector" - ] + "enum": ["Connector"] } } } @@ -14399,12 +13267,7 @@ "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.", - "enum": [ - "normal", - "new_mandate", - "setup_mandate", - "recurring_mandate" - ] + "enum": ["normal", "new_mandate", "setup_mandate", "recurring_mandate"] }, "PaymentsCancelRequest": { "type": "object", @@ -14438,9 +13301,7 @@ }, "PaymentsCompleteAuthorizeRequest": { "type": "object", - "required": [ - "client_secret" - ], + "required": ["client_secret"], "properties": { "shipping": { "allOf": [ @@ -14616,10 +13477,7 @@ }, "PaymentsCreateIntentRequest": { "type": "object", - "required": [ - "amount_details", - "customer_id" - ], + "required": ["amount_details", "customer_id"], "properties": { "amount_details": { "$ref": "#/components/schemas/AmountDetails" @@ -15347,11 +14205,7 @@ }, "PaymentsDynamicTaxCalculationRequest": { "type": "object", - "required": [ - "shipping", - "client_secret", - "payment_method_type" - ], + "required": ["shipping", "client_secret", "payment_method_type"], "properties": { "shipping": { "$ref": "#/components/schemas/Address" @@ -15372,11 +14226,7 @@ }, "PaymentsDynamicTaxCalculationResponse": { "type": "object", - "required": [ - "payment_id", - "net_amount", - "display_amount" - ], + "required": ["payment_id", "net_amount", "display_amount"], "properties": { "payment_id": { "type": "string", @@ -15436,10 +14286,7 @@ }, "PaymentsExternalAuthenticationResponse": { "type": "object", - "required": [ - "trans_status", - "three_ds_requestor_url" - ], + "required": ["trans_status", "three_ds_requestor_url"], "properties": { "trans_status": { "$ref": "#/components/schemas/TransactionStatus" @@ -15482,9 +14329,7 @@ }, "PaymentsIncrementalAuthorizationRequest": { "type": "object", - "required": [ - "amount" - ], + "required": ["amount"], "properties": { "amount": { "type": "integer", @@ -16388,10 +15233,7 @@ }, "PaymentsSessionResponse": { "type": "object", - "required": [ - "payment_id", - "session_token" - ], + "required": ["payment_id", "session_token"], "properties": { "payment_id": { "type": "string", @@ -16581,11 +15423,7 @@ }, "PayoutAttemptResponse": { "type": "object", - "required": [ - "attempt_id", - "status", - "amount" - ], + "required": ["attempt_id", "status", "amount"], "properties": { "attempt_id": { "type": "string", @@ -16773,10 +15611,7 @@ "$ref": "#/components/schemas/PayoutConnectors" }, "description": "This field allows the merchant to manually select a connector with which the payout can go through.", - "example": [ - "wise", - "adyen" - ], + "example": ["wise", "adyen"], "nullable": true }, "confirm": { @@ -17216,10 +16051,7 @@ }, "PayoutLinkInitiateRequest": { "type": "object", - "required": [ - "merchant_id", - "payout_id" - ], + "required": ["merchant_id", "payout_id"], "properties": { "merchant_id": { "type": "string" @@ -17231,10 +16063,7 @@ }, "PayoutLinkResponse": { "type": "object", - "required": [ - "payout_link_id", - "link" - ], + "required": ["payout_link_id", "link"], "properties": { "payout_link_id": { "type": "string" @@ -17306,10 +16135,7 @@ }, { "type": "object", - "required": [ - "currency", - "entity_type" - ], + "required": ["currency", "entity_type"], "properties": { "payout_id": { "type": "string", @@ -17349,10 +16175,7 @@ "$ref": "#/components/schemas/PayoutConnectors" }, "description": "The list of connectors to filter payouts list", - "example": [ - "wise", - "adyen" - ], + "example": ["wise", "adyen"], "nullable": true }, "currency": { @@ -17364,10 +16187,7 @@ "$ref": "#/components/schemas/PayoutStatus" }, "description": "The list of payout status to filter payouts list", - "example": [ - "pending", - "failed" - ], + "example": ["pending", "failed"], "nullable": true }, "payout_method": { @@ -17376,10 +16196,7 @@ "$ref": "#/components/schemas/PayoutType" }, "description": "The list of payout methods to filter payouts list", - "example": [ - "bank", - "card" - ], + "example": ["bank", "card"], "nullable": true }, "entity_type": { @@ -17391,10 +16208,7 @@ }, "PayoutListResponse": { "type": "object", - "required": [ - "size", - "data" - ], + "required": ["size", "data"], "properties": { "size": { "type": "integer", @@ -17420,9 +16234,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardPayout" @@ -17431,9 +16243,7 @@ }, { "type": "object", - "required": [ - "bank" - ], + "required": ["bank"], "properties": { "bank": { "$ref": "#/components/schemas/Bank" @@ -17442,9 +16252,7 @@ }, { "type": "object", - "required": [ - "wallet" - ], + "required": ["wallet"], "properties": { "wallet": { "$ref": "#/components/schemas/Wallet" @@ -17458,9 +16266,7 @@ "oneOf": [ { "type": "object", - "required": [ - "card" - ], + "required": ["card"], "properties": { "card": { "$ref": "#/components/schemas/CardAdditionalData" @@ -17469,9 +16275,7 @@ }, { "type": "object", - "required": [ - "bank" - ], + "required": ["bank"], "properties": { "bank": { "$ref": "#/components/schemas/BankAdditionalData" @@ -17480,9 +16284,7 @@ }, { "type": "object", - "required": [ - "wallet" - ], + "required": ["wallet"], "properties": { "wallet": { "$ref": "#/components/schemas/WalletAdditionalData" @@ -17496,9 +16298,7 @@ "oneOf": [ { "type": "object", - "required": [ - "PayoutActionRequest" - ], + "required": ["PayoutActionRequest"], "properties": { "PayoutActionRequest": { "$ref": "#/components/schemas/PayoutActionRequest" @@ -17507,9 +16307,7 @@ }, { "type": "object", - "required": [ - "PayoutCreateRequest" - ], + "required": ["PayoutCreateRequest"], "properties": { "PayoutCreateRequest": { "$ref": "#/components/schemas/PayoutCreateRequest" @@ -17518,9 +16316,7 @@ }, { "type": "object", - "required": [ - "PayoutRetrieveRequest" - ], + "required": ["PayoutRetrieveRequest"], "properties": { "PayoutRetrieveRequest": { "$ref": "#/components/schemas/PayoutRetrieveRequest" @@ -17544,9 +16340,7 @@ }, "PayoutRetrieveRequest": { "type": "object", - "required": [ - "payout_id" - ], + "required": ["payout_id"], "properties": { "payout_id": { "type": "string", @@ -17602,19 +16396,11 @@ "PayoutType": { "type": "string", "description": "The payout_type of the payout request is a mandatory field for confirming the payouts. It should be specified in the Create request. If not provided, it must be updated in the Payout Update request before it can be confirmed.", - "enum": [ - "card", - "bank", - "wallet" - ] + "enum": ["card", "bank", "wallet"] }, "Paypal": { "type": "object", - "required": [ - "email", - "telephone_number", - "paypal_id" - ], + "required": ["email", "telephone_number", "paypal_id"], "properties": { "email": { "type": "string", @@ -17671,11 +16457,7 @@ }, "PaypalSessionTokenResponse": { "type": "object", - "required": [ - "connector", - "session_token", - "sdk_next_action" - ], + "required": ["connector", "session_token", "sdk_next_action"], "properties": { "connector": { "type": "string", @@ -17731,9 +16513,7 @@ }, "PazeWalletData": { "type": "object", - "required": [ - "complete_response" - ], + "required": ["complete_response"], "properties": { "complete_response": { "type": "string" @@ -17759,10 +16539,7 @@ }, "PixBankTransfer": { "type": "object", - "required": [ - "bank_account_number", - "pix_key" - ], + "required": ["bank_account_number", "pix_key"], "properties": { "bank_name": { "type": "string", @@ -17819,11 +16596,7 @@ }, "PollConfigResponse": { "type": "object", - "required": [ - "poll_id", - "delay_in_secs", - "frequency" - ], + "required": ["poll_id", "delay_in_secs", "frequency"], "properties": { "poll_id": { "type": "string", @@ -17843,10 +16616,7 @@ }, "PollResponse": { "type": "object", - "required": [ - "poll_id", - "status" - ], + "required": ["poll_id", "status"], "properties": { "poll_id": { "type": "string", @@ -17859,26 +16629,16 @@ }, "PollStatus": { "type": "string", - "enum": [ - "pending", - "completed", - "not_found" - ] + "enum": ["pending", "completed", "not_found"] }, "PresenceOfCustomerDuringPayment": { "type": "string", "description": "Set to `present` to indicate that the customer is in your checkout flow during this payment, and therefore is able to authenticate. This parameter should be `absent` when merchant's doing merchant initiated payments and customer is not present while doing the payment.", - "enum": [ - "present", - "absent" - ] + "enum": ["present", "absent"] }, "PrimaryBusinessDetails": { "type": "object", - "required": [ - "country", - "business" - ], + "required": ["country", "business"], "properties": { "country": { "$ref": "#/components/schemas/CountryAlpha2" @@ -17893,9 +16653,7 @@ "ProcessorPaymentToken": { "type": "object", "description": "Processor payment token for MIT payments where payment_method_data is not available", - "required": [ - "processor_payment_token" - ], + "required": ["processor_payment_token"], "properties": { "processor_payment_token": { "type": "string" @@ -17919,9 +16677,7 @@ }, "ProfileCreate": { "type": "object", - "required": [ - "profile_name" - ], + "required": ["profile_name"], "properties": { "profile_name": { "type": "string", @@ -18095,10 +16851,7 @@ }, "ProfileDefaultRoutingConfig": { "type": "object", - "required": [ - "profile_id", - "connectors" - ], + "required": ["profile_id", "connectors"], "properties": { "profile_id": { "type": "string" @@ -18319,11 +17072,7 @@ "ProgramConnectorSelection": { "type": "object", "description": "The program, having a default connector selection and\na bunch of rules. Also can hold arbitrary metadata.", - "required": [ - "defaultSelection", - "rules", - "metadata" - ], + "required": ["defaultSelection", "rules", "metadata"], "properties": { "defaultSelection": { "$ref": "#/components/schemas/ConnectorSelection" @@ -18341,9 +17090,7 @@ "oneOf": [ { "type": "object", - "required": [ - "fps" - ], + "required": ["fps"], "properties": { "fps": { "type": "object" @@ -18352,9 +17099,7 @@ }, { "type": "object", - "required": [ - "duit_now" - ], + "required": ["duit_now"], "properties": { "duit_now": { "type": "object" @@ -18363,9 +17108,7 @@ }, { "type": "object", - "required": [ - "prompt_pay" - ], + "required": ["prompt_pay"], "properties": { "prompt_pay": { "type": "object" @@ -18374,9 +17117,7 @@ }, { "type": "object", - "required": [ - "viet_qr" - ], + "required": ["viet_qr"], "properties": { "viet_qr": { "type": "object" @@ -18402,9 +17143,7 @@ }, "ReceiverDetails": { "type": "object", - "required": [ - "amount_received" - ], + "required": ["amount_received"], "properties": { "amount_received": { "type": "integer", @@ -18427,27 +17166,17 @@ }, "ReconStatus": { "type": "string", - "enum": [ - "not_requested", - "requested", - "active", - "disabled" - ] + "enum": ["not_requested", "requested", "active", "disabled"] }, "RecurringDetails": { "oneOf": [ { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "mandate_id" - ] + "enum": ["mandate_id"] }, "data": { "type": "string" @@ -18456,16 +17185,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "payment_method_id" - ] + "enum": ["payment_method_id"] }, "data": { "type": "string" @@ -18474,16 +17198,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "processor_payment_token" - ] + "enum": ["processor_payment_token"] }, "data": { "$ref": "#/components/schemas/ProcessorPaymentToken" @@ -18492,16 +17211,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "network_transaction_id_and_card_details" - ] + "enum": ["network_transaction_id_and_card_details"] }, "data": { "$ref": "#/components/schemas/NetworkTransactionIdAndCardDetails" @@ -18516,13 +17230,7 @@ }, "RecurringPaymentIntervalUnit": { "type": "string", - "enum": [ - "year", - "month", - "day", - "hour", - "minute" - ] + "enum": ["year", "month", "day", "hour", "minute"] }, "RedirectResponse": { "type": "object", @@ -18539,10 +17247,7 @@ }, "RefundErrorDetails": { "type": "object", - "required": [ - "code", - "message" - ], + "required": ["code", "message"], "properties": { "code": { "type": "string" @@ -18638,11 +17343,7 @@ }, "RefundListResponse": { "type": "object", - "required": [ - "count", - "total_count", - "data" - ], + "required": ["count", "total_count", "data"], "properties": { "count": { "type": "integer", @@ -18665,9 +17366,7 @@ }, "RefundRequest": { "type": "object", - "required": [ - "payment_id" - ], + "required": ["payment_id"], "properties": { "payment_id": { "type": "string", @@ -18832,20 +17531,12 @@ "RefundStatus": { "type": "string", "description": "The status for refunds", - "enum": [ - "succeeded", - "failed", - "pending", - "review" - ] + "enum": ["succeeded", "failed", "pending", "review"] }, "RefundType": { "type": "string", "description": "To indicate whether to refund needs to be instant or scheduled", - "enum": [ - "scheduled", - "instant" - ] + "enum": ["scheduled", "instant"] }, "RefundUpdateRequest": { "type": "object", @@ -18867,9 +17558,7 @@ }, "RefundsCreateRequest": { "type": "object", - "required": [ - "payment_id" - ], + "required": ["payment_id"], "properties": { "payment_id": { "type": "string", @@ -18920,11 +17609,7 @@ }, "RequestIncrementalAuthorization": { "type": "string", - "enum": [ - "true", - "false", - "default" - ] + "enum": ["true", "false", "default"] }, "RequestPaymentMethodTypes": { "type": "object", @@ -19001,9 +17686,7 @@ "RequestSurchargeDetails": { "type": "object", "description": "Details of surcharge applied on this payment, if applicable", - "required": [ - "surcharge_amount" - ], + "required": ["surcharge_amount"], "properties": { "surcharge_amount": { "type": "integer", @@ -19023,11 +17706,7 @@ "RequiredFieldInfo": { "type": "object", "description": "Required fields info used while listing the payment_method_data", - "required": [ - "required_field", - "display_name", - "field_type" - ], + "required": ["required_field", "display_name", "field_type"], "properties": { "required_field": { "type": "string", @@ -19093,10 +17772,7 @@ }, { "type": "object", - "required": [ - "payment_method_type", - "payment_method_subtype" - ], + "required": ["payment_method_type", "payment_method_subtype"], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" @@ -19126,10 +17802,7 @@ }, "ResponsePaymentMethodsEnabled": { "type": "object", - "required": [ - "payment_method", - "payment_method_types" - ], + "required": ["payment_method", "payment_method_types"], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -19272,19 +17945,12 @@ "RetryAction": { "type": "string", "description": "Denotes the retry action", - "enum": [ - "manual_retry", - "requeue" - ] + "enum": ["manual_retry", "requeue"] }, "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", @@ -19307,9 +17973,7 @@ }, "RewardData": { "type": "object", - "required": [ - "merchant_id" - ], + "required": ["merchant_id"], "properties": { "merchant_id": { "type": "string", @@ -19319,17 +17983,12 @@ }, "RoutableChoiceKind": { "type": "string", - "enum": [ - "OnlyConnector", - "FullStruct" - ] + "enum": ["OnlyConnector", "FullStruct"] }, "RoutableConnectorChoice": { "type": "object", "description": "Routable Connector chosen for a payment", - "required": [ - "connector" - ], + "required": ["connector"], "properties": { "connector": { "$ref": "#/components/schemas/RoutableConnectors" @@ -19429,16 +18088,11 @@ "oneOf": [ { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "single" - ] + "enum": ["single"] }, "data": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -19447,16 +18101,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "priority" - ] + "enum": ["priority"] }, "data": { "type": "array", @@ -19468,16 +18117,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "volume_split" - ] + "enum": ["volume_split"] }, "data": { "type": "array", @@ -19489,16 +18133,11 @@ }, { "type": "object", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "advanced" - ] + "enum": ["advanced"] }, "data": { "$ref": "#/components/schemas/ProgramConnectorSelection" @@ -19513,9 +18152,7 @@ }, "RoutingAlgorithmId": { "type": "object", - "required": [ - "routing_algorithm_id" - ], + "required": ["routing_algorithm_id"], "properties": { "routing_algorithm_id": { "type": "string" @@ -19524,22 +18161,11 @@ }, "RoutingAlgorithmKind": { "type": "string", - "enum": [ - "single", - "priority", - "volume_split", - "advanced", - "dynamic" - ] + "enum": ["single", "priority", "volume_split", "advanced", "dynamic"] }, "RoutingConfigRequest": { "type": "object", - "required": [ - "name", - "description", - "algorithm", - "profile_id" - ], + "required": ["name", "description", "algorithm", "profile_id"], "properties": { "name": { "type": "string" @@ -19557,10 +18183,7 @@ }, "RoutingDictionary": { "type": "object", - "required": [ - "merchant_id", - "records" - ], + "required": ["merchant_id", "records"], "properties": { "merchant_id": { "type": "string" @@ -19652,11 +18275,7 @@ "RuleConnectorSelection": { "type": "object", "description": "Represents a rule\n\n```text\nrule_name: [stripe, adyen, checkout]\n{\npayment.method = card {\npayment.method.cardtype = (credit, debit) {\npayment.method.network = (amex, rupay, diners)\n}\n\npayment.method.cardtype = credit\n}\n}\n```", - "required": [ - "name", - "connectorSelection", - "statements" - ], + "required": ["name", "connectorSelection", "statements"], "properties": { "name": { "type": "string" @@ -19674,11 +18293,7 @@ }, "SamsungPayAmountDetails": { "type": "object", - "required": [ - "option", - "currency_code", - "total" - ], + "required": ["option", "currency_code", "total"], "properties": { "option": { "$ref": "#/components/schemas/SamsungPayAmountFormat" @@ -19695,10 +18310,7 @@ }, "SamsungPayAmountFormat": { "type": "string", - "enum": [ - "FORMAT_TOTAL_PRICE_ONLY", - "FORMAT_TOTAL_ESTIMATED_AMOUNT" - ] + "enum": ["FORMAT_TOTAL_PRICE_ONLY", "FORMAT_TOTAL_ESTIMATED_AMOUNT"] }, "SamsungPayAppWalletData": { "type": "object", @@ -19747,20 +18359,11 @@ }, "SamsungPayCardBrand": { "type": "string", - "enum": [ - "visa", - "mastercard", - "amex", - "discover", - "unknown" - ] + "enum": ["visa", "mastercard", "amex", "discover", "unknown"] }, "SamsungPayMerchantPaymentInformation": { "type": "object", - "required": [ - "name", - "country_code" - ], + "required": ["name", "country_code"], "properties": { "name": { "type": "string", @@ -19778,9 +18381,7 @@ }, "SamsungPayProtocolType": { "type": "string", - "enum": [ - "PROTOCOL3DS" - ] + "enum": ["PROTOCOL3DS"] }, "SamsungPaySessionTokenResponse": { "type": "object", @@ -19826,10 +18427,7 @@ }, "SamsungPayTokenData": { "type": "object", - "required": [ - "version", - "data" - ], + "required": ["version", "data"], "properties": { "type": { "type": "string", @@ -19858,9 +18456,7 @@ }, "SamsungPayWalletData": { "type": "object", - "required": [ - "payment_credential" - ], + "required": ["payment_credential"], "properties": { "payment_credential": { "$ref": "#/components/schemas/SamsungPayWalletCredentials" @@ -19869,11 +18465,7 @@ }, "SamsungPayWebWalletData": { "type": "object", - "required": [ - "card_brand", - "card_last4digits", - "3_d_s" - ], + "required": ["card_brand", "card_last4digits", "3_d_s"], "properties": { "method": { "type": "string", @@ -19900,10 +18492,7 @@ "ScaExemptionType": { "type": "string", "description": "SCA Exemptions types available for authentication", - "enum": [ - "low_value", - "transaction_risk_analysis" - ] + "enum": ["low_value", "transaction_risk_analysis"] }, "SdkInformation": { "type": "object", @@ -19950,9 +18539,7 @@ }, "SdkNextAction": { "type": "object", - "required": [ - "next_action" - ], + "required": ["next_action"], "properties": { "next_action": { "$ref": "#/components/schemas/NextActionCall" @@ -19961,9 +18548,7 @@ }, "SdkNextActionData": { "type": "object", - "required": [ - "next_action" - ], + "required": ["next_action"], "properties": { "next_action": { "$ref": "#/components/schemas/NextActionCall" @@ -19976,10 +18561,7 @@ }, "SecretInfoToInitiateSdk": { "type": "object", - "required": [ - "display", - "payment" - ], + "required": ["display", "payment"], "properties": { "display": { "type": "string" @@ -20008,9 +18590,7 @@ }, "SepaBankDebitAdditionalData": { "type": "object", - "required": [ - "iban" - ], + "required": ["iban"], "properties": { "iban": { "type": "string", @@ -20027,10 +18607,7 @@ }, "SepaBankTransfer": { "type": "object", - "required": [ - "iban", - "bic" - ], + "required": ["iban", "bic"], "properties": { "bank_name": { "type": "string", @@ -20067,9 +18644,7 @@ "SepaBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for sepa bank transfer payout method", - "required": [ - "iban" - ], + "required": ["iban"], "properties": { "iban": { "type": "string", @@ -20144,15 +18719,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "google_pay" - ] + "enum": ["google_pay"] } } } @@ -20165,15 +18736,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "samsung_pay" - ] + "enum": ["samsung_pay"] } } } @@ -20186,15 +18753,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "klarna" - ] + "enum": ["klarna"] } } } @@ -20207,15 +18770,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "paypal" - ] + "enum": ["paypal"] } } } @@ -20228,15 +18787,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "apple_pay" - ] + "enum": ["apple_pay"] } } } @@ -20249,15 +18804,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "open_banking" - ] + "enum": ["open_banking"] } } } @@ -20270,15 +18821,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "paze" - ] + "enum": ["paze"] } } } @@ -20291,15 +18838,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "click_to_pay" - ] + "enum": ["click_to_pay"] } } } @@ -20307,15 +18850,11 @@ }, { "type": "object", - "required": [ - "wallet_name" - ], + "required": ["wallet_name"], "properties": { "wallet_name": { "type": "string", - "enum": [ - "no_session_token_received" - ] + "enum": ["no_session_token_received"] } } } @@ -20377,18 +18916,13 @@ }, "SizeVariants": { "type": "string", - "enum": [ - "cover", - "contain" - ] + "enum": ["cover", "contain"] }, "SplitPaymentsRequest": { "oneOf": [ { "type": "object", - "required": [ - "stripe_split_payment" - ], + "required": ["stripe_split_payment"], "properties": { "stripe_split_payment": { "$ref": "#/components/schemas/StripeSplitPaymentRequest" @@ -20402,9 +18936,7 @@ "oneOf": [ { "type": "object", - "required": [ - "stripe_split_payment" - ], + "required": ["stripe_split_payment"], "properties": { "stripe_split_payment": { "$ref": "#/components/schemas/StripeSplitPaymentsResponse" @@ -20417,9 +18949,7 @@ "oneOf": [ { "type": "object", - "required": [ - "stripe_split_refund" - ], + "required": ["stripe_split_refund"], "properties": { "stripe_split_refund": { "$ref": "#/components/schemas/StripeSplitRefundRequest" @@ -20434,16 +18964,11 @@ { "type": "object", "title": "Single", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "single" - ] + "enum": ["single"] }, "data": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -20453,16 +18978,11 @@ { "type": "object", "title": "Priority", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "priority" - ] + "enum": ["priority"] }, "data": { "type": "array", @@ -20475,16 +18995,11 @@ { "type": "object", "title": "VolumeSplit", - "required": [ - "type", - "data" - ], + "required": ["type", "data"], "properties": { "type": { "type": "string", - "enum": [ - "volume_split" - ] + "enum": ["volume_split"] }, "data": { "type": "array", @@ -20501,19 +19016,12 @@ }, "StripeChargeType": { "type": "string", - "enum": [ - "direct", - "destination" - ] + "enum": ["direct", "destination"] }, "StripeSplitPaymentRequest": { "type": "object", "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe", - "required": [ - "charge_type", - "application_fees", - "transfer_account_id" - ], + "required": ["charge_type", "application_fees", "transfer_account_id"], "properties": { "charge_type": { "$ref": "#/components/schemas/PaymentChargeType" @@ -20534,11 +19042,7 @@ "StripeSplitPaymentsResponse": { "type": "object", "description": "Fee information to be charged on the payment being collected", - "required": [ - "charge_type", - "application_fees", - "transfer_account_id" - ], + "required": ["charge_type", "application_fees", "transfer_account_id"], "properties": { "charge_id": { "type": "string", @@ -20625,10 +19129,7 @@ }, "SurchargeCalculationOverride": { "type": "string", - "enum": [ - "skip", - "calculate" - ] + "enum": ["skip", "calculate"] }, "SurchargeDetailsResponse": { "type": "object", @@ -20669,9 +19170,7 @@ }, "SurchargePercentage": { "type": "object", - "required": [ - "percentage" - ], + "required": ["percentage"], "properties": { "percentage": { "type": "number", @@ -20683,16 +19182,11 @@ "oneOf": [ { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "fixed" - ] + "enum": ["fixed"] }, "value": { "$ref": "#/components/schemas/MinorUnit" @@ -20701,16 +19195,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "rate" - ] + "enum": ["rate"] }, "value": { "$ref": "#/components/schemas/SurchargePercentage" @@ -20727,16 +19216,11 @@ }, "TaxCalculationOverride": { "type": "string", - "enum": [ - "skip", - "calculate" - ] + "enum": ["skip", "calculate"] }, "ThirdPartySdkSessionResponse": { "type": "object", - "required": [ - "secrets" - ], + "required": ["secrets"], "properties": { "secrets": { "$ref": "#/components/schemas/SecretInfoToInitiateSdk" @@ -20745,11 +19229,7 @@ }, "ThreeDsCompletionIndicator": { "type": "string", - "enum": [ - "Y", - "N", - "U" - ] + "enum": ["Y", "N", "U"] }, "ThreeDsData": { "type": "object", @@ -20811,9 +19291,7 @@ }, "three_ds_method_key": { "type": "string", - "enum": [ - "threeDSMethodData" - ] + "enum": ["threeDSMethodData"] } } } @@ -20825,9 +19303,7 @@ "TimeRange": { "type": "object", "description": "A type representing a range of time for filtering, including a mandatory start time and an optional end time.", - "required": [ - "start_time" - ], + "required": ["start_time"], "properties": { "start_time": { "type": "string", @@ -20844,9 +19320,7 @@ }, "ToggleBlocklistResponse": { "type": "object", - "required": [ - "blocklist_guard_status" - ], + "required": ["blocklist_guard_status"], "properties": { "blocklist_guard_status": { "type": "string" @@ -20855,9 +19329,7 @@ }, "ToggleKVRequest": { "type": "object", - "required": [ - "kv_enabled" - ], + "required": ["kv_enabled"], "properties": { "kv_enabled": { "type": "boolean", @@ -20868,10 +19340,7 @@ }, "ToggleKVResponse": { "type": "object", - "required": [ - "merchant_id", - "kv_enabled" - ], + "required": ["merchant_id", "kv_enabled"], "properties": { "merchant_id": { "type": "string", @@ -20918,30 +19387,15 @@ "TransactionStatus": { "type": "string", "description": "Indicates the transaction status", - "enum": [ - "Y", - "N", - "U", - "A", - "R", - "C", - "D", - "I" - ] + "enum": ["Y", "N", "U", "A", "R", "C", "D", "I"] }, "TransactionType": { "type": "string", - "enum": [ - "payment", - "payout" - ] + "enum": ["payment", "payout"] }, "UIWidgetFormLayout": { "type": "string", - "enum": [ - "tabs", - "journey" - ] + "enum": ["tabs", "journey"] }, "UpdateApiKeyRequest": { "type": "object", @@ -20976,9 +19430,7 @@ "oneOf": [ { "type": "object", - "required": [ - "upi_collect" - ], + "required": ["upi_collect"], "properties": { "upi_collect": { "$ref": "#/components/schemas/UpiCollectAdditionalData" @@ -20987,9 +19439,7 @@ }, { "type": "object", - "required": [ - "upi_intent" - ], + "required": ["upi_intent"], "properties": { "upi_intent": { "$ref": "#/components/schemas/UpiIntentData" @@ -21023,9 +19473,7 @@ "oneOf": [ { "type": "object", - "required": [ - "upi_collect" - ], + "required": ["upi_collect"], "properties": { "upi_collect": { "$ref": "#/components/schemas/UpiCollectData" @@ -21034,9 +19482,7 @@ }, { "type": "object", - "required": [ - "upi_intent" - ], + "required": ["upi_intent"], "properties": { "upi_intent": { "$ref": "#/components/schemas/UpiIntentData" @@ -21067,16 +19513,11 @@ "oneOf": [ { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "number" - ] + "enum": ["number"] }, "value": { "$ref": "#/components/schemas/MinorUnit" @@ -21085,16 +19526,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "enum_variant" - ] + "enum": ["enum_variant"] }, "value": { "type": "string", @@ -21104,16 +19540,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "metadata_variant" - ] + "enum": ["metadata_variant"] }, "value": { "$ref": "#/components/schemas/MetadataValue" @@ -21122,16 +19553,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "str_value" - ] + "enum": ["str_value"] }, "value": { "type": "string", @@ -21141,16 +19567,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "number_array" - ] + "enum": ["number_array"] }, "value": { "type": "array", @@ -21163,16 +19584,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "enum_variant_array" - ] + "enum": ["enum_variant_array"] }, "value": { "type": "array", @@ -21185,16 +19601,11 @@ }, { "type": "object", - "required": [ - "type", - "value" - ], + "required": ["type", "value"], "properties": { "type": { "type": "string", - "enum": [ - "number_comparison_array" - ] + "enum": ["number_comparison_array"] }, "value": { "type": "array", @@ -21213,9 +19624,7 @@ }, "Venmo": { "type": "object", - "required": [ - "telephone_number" - ], + "required": ["telephone_number"], "properties": { "telephone_number": { "type": "string", @@ -21240,9 +19649,7 @@ "oneOf": [ { "type": "object", - "required": [ - "boleto" - ], + "required": ["boleto"], "properties": { "boleto": { "$ref": "#/components/schemas/BoletoVoucherData" @@ -21251,33 +19658,23 @@ }, { "type": "string", - "enum": [ - "efecty" - ] + "enum": ["efecty"] }, { "type": "string", - "enum": [ - "pago_efectivo" - ] + "enum": ["pago_efectivo"] }, { "type": "string", - "enum": [ - "red_compra" - ] + "enum": ["red_compra"] }, { "type": "string", - "enum": [ - "red_pagos" - ] + "enum": ["red_pagos"] }, { "type": "object", - "required": [ - "alfamart" - ], + "required": ["alfamart"], "properties": { "alfamart": { "$ref": "#/components/schemas/AlfamartVoucherData" @@ -21286,9 +19683,7 @@ }, { "type": "object", - "required": [ - "indomaret" - ], + "required": ["indomaret"], "properties": { "indomaret": { "$ref": "#/components/schemas/IndomaretVoucherData" @@ -21297,15 +19692,11 @@ }, { "type": "string", - "enum": [ - "oxxo" - ] + "enum": ["oxxo"] }, { "type": "object", - "required": [ - "seven_eleven" - ], + "required": ["seven_eleven"], "properties": { "seven_eleven": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21314,9 +19705,7 @@ }, { "type": "object", - "required": [ - "lawson" - ], + "required": ["lawson"], "properties": { "lawson": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21325,9 +19714,7 @@ }, { "type": "object", - "required": [ - "mini_stop" - ], + "required": ["mini_stop"], "properties": { "mini_stop": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21336,9 +19723,7 @@ }, { "type": "object", - "required": [ - "family_mart" - ], + "required": ["family_mart"], "properties": { "family_mart": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21347,9 +19732,7 @@ }, { "type": "object", - "required": [ - "seicomart" - ], + "required": ["seicomart"], "properties": { "seicomart": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21358,9 +19741,7 @@ }, { "type": "object", - "required": [ - "pay_easy" - ], + "required": ["pay_easy"], "properties": { "pay_easy": { "$ref": "#/components/schemas/JCSVoucherData" @@ -21388,9 +19769,7 @@ "oneOf": [ { "type": "object", - "required": [ - "paypal" - ], + "required": ["paypal"], "properties": { "paypal": { "$ref": "#/components/schemas/Paypal" @@ -21399,9 +19778,7 @@ }, { "type": "object", - "required": [ - "venmo" - ], + "required": ["venmo"], "properties": { "venmo": { "$ref": "#/components/schemas/Venmo" @@ -21423,11 +19800,7 @@ }, "WalletAdditionalDataForCard": { "type": "object", - "required": [ - "last4", - "card_network", - "type" - ], + "required": ["last4", "card_network", "type"], "properties": { "last4": { "type": "string", @@ -21447,9 +19820,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ali_pay_qr" - ], + "required": ["ali_pay_qr"], "properties": { "ali_pay_qr": { "$ref": "#/components/schemas/AliPayQr" @@ -21458,9 +19829,7 @@ }, { "type": "object", - "required": [ - "ali_pay_redirect" - ], + "required": ["ali_pay_redirect"], "properties": { "ali_pay_redirect": { "$ref": "#/components/schemas/AliPayRedirection" @@ -21469,9 +19838,7 @@ }, { "type": "object", - "required": [ - "ali_pay_hk_redirect" - ], + "required": ["ali_pay_hk_redirect"], "properties": { "ali_pay_hk_redirect": { "$ref": "#/components/schemas/AliPayHkRedirection" @@ -21480,9 +19847,7 @@ }, { "type": "object", - "required": [ - "momo_redirect" - ], + "required": ["momo_redirect"], "properties": { "momo_redirect": { "$ref": "#/components/schemas/MomoRedirection" @@ -21491,9 +19856,7 @@ }, { "type": "object", - "required": [ - "kakao_pay_redirect" - ], + "required": ["kakao_pay_redirect"], "properties": { "kakao_pay_redirect": { "$ref": "#/components/schemas/KakaoPayRedirection" @@ -21502,9 +19865,7 @@ }, { "type": "object", - "required": [ - "go_pay_redirect" - ], + "required": ["go_pay_redirect"], "properties": { "go_pay_redirect": { "$ref": "#/components/schemas/GoPayRedirection" @@ -21513,9 +19874,7 @@ }, { "type": "object", - "required": [ - "gcash_redirect" - ], + "required": ["gcash_redirect"], "properties": { "gcash_redirect": { "$ref": "#/components/schemas/GcashRedirection" @@ -21524,9 +19883,7 @@ }, { "type": "object", - "required": [ - "apple_pay" - ], + "required": ["apple_pay"], "properties": { "apple_pay": { "$ref": "#/components/schemas/ApplePayWalletData" @@ -21535,9 +19892,7 @@ }, { "type": "object", - "required": [ - "apple_pay_redirect" - ], + "required": ["apple_pay_redirect"], "properties": { "apple_pay_redirect": { "$ref": "#/components/schemas/ApplePayRedirectData" @@ -21546,9 +19901,7 @@ }, { "type": "object", - "required": [ - "apple_pay_third_party_sdk" - ], + "required": ["apple_pay_third_party_sdk"], "properties": { "apple_pay_third_party_sdk": { "$ref": "#/components/schemas/ApplePayThirdPartySdkData" @@ -21557,9 +19910,7 @@ }, { "type": "object", - "required": [ - "dana_redirect" - ], + "required": ["dana_redirect"], "properties": { "dana_redirect": { "type": "object", @@ -21569,9 +19920,7 @@ }, { "type": "object", - "required": [ - "google_pay" - ], + "required": ["google_pay"], "properties": { "google_pay": { "$ref": "#/components/schemas/GooglePayWalletData" @@ -21580,9 +19929,7 @@ }, { "type": "object", - "required": [ - "google_pay_redirect" - ], + "required": ["google_pay_redirect"], "properties": { "google_pay_redirect": { "$ref": "#/components/schemas/GooglePayRedirectData" @@ -21591,9 +19938,7 @@ }, { "type": "object", - "required": [ - "google_pay_third_party_sdk" - ], + "required": ["google_pay_third_party_sdk"], "properties": { "google_pay_third_party_sdk": { "$ref": "#/components/schemas/GooglePayThirdPartySdkData" @@ -21602,9 +19947,7 @@ }, { "type": "object", - "required": [ - "mb_way_redirect" - ], + "required": ["mb_way_redirect"], "properties": { "mb_way_redirect": { "$ref": "#/components/schemas/MbWayRedirection" @@ -21613,9 +19956,7 @@ }, { "type": "object", - "required": [ - "mobile_pay_redirect" - ], + "required": ["mobile_pay_redirect"], "properties": { "mobile_pay_redirect": { "$ref": "#/components/schemas/MobilePayRedirection" @@ -21624,9 +19965,7 @@ }, { "type": "object", - "required": [ - "paypal_redirect" - ], + "required": ["paypal_redirect"], "properties": { "paypal_redirect": { "$ref": "#/components/schemas/PaypalRedirection" @@ -21635,9 +19974,7 @@ }, { "type": "object", - "required": [ - "paypal_sdk" - ], + "required": ["paypal_sdk"], "properties": { "paypal_sdk": { "$ref": "#/components/schemas/PayPalWalletData" @@ -21646,9 +19983,7 @@ }, { "type": "object", - "required": [ - "paze" - ], + "required": ["paze"], "properties": { "paze": { "$ref": "#/components/schemas/PazeWalletData" @@ -21657,9 +19992,7 @@ }, { "type": "object", - "required": [ - "samsung_pay" - ], + "required": ["samsung_pay"], "properties": { "samsung_pay": { "$ref": "#/components/schemas/SamsungPayWalletData" @@ -21668,9 +20001,7 @@ }, { "type": "object", - "required": [ - "twint_redirect" - ], + "required": ["twint_redirect"], "properties": { "twint_redirect": { "type": "object", @@ -21680,9 +20011,7 @@ }, { "type": "object", - "required": [ - "vipps_redirect" - ], + "required": ["vipps_redirect"], "properties": { "vipps_redirect": { "type": "object", @@ -21692,9 +20021,7 @@ }, { "type": "object", - "required": [ - "touch_n_go_redirect" - ], + "required": ["touch_n_go_redirect"], "properties": { "touch_n_go_redirect": { "$ref": "#/components/schemas/TouchNGoRedirection" @@ -21703,9 +20030,7 @@ }, { "type": "object", - "required": [ - "we_chat_pay_redirect" - ], + "required": ["we_chat_pay_redirect"], "properties": { "we_chat_pay_redirect": { "$ref": "#/components/schemas/WeChatPayRedirection" @@ -21714,9 +20039,7 @@ }, { "type": "object", - "required": [ - "we_chat_pay_qr" - ], + "required": ["we_chat_pay_qr"], "properties": { "we_chat_pay_qr": { "$ref": "#/components/schemas/WeChatPayQr" @@ -21725,9 +20048,7 @@ }, { "type": "object", - "required": [ - "cashapp_qr" - ], + "required": ["cashapp_qr"], "properties": { "cashapp_qr": { "$ref": "#/components/schemas/CashappQr" @@ -21736,9 +20057,7 @@ }, { "type": "object", - "required": [ - "swish_qr" - ], + "required": ["swish_qr"], "properties": { "swish_qr": { "$ref": "#/components/schemas/SwishQrData" @@ -21747,9 +20066,7 @@ }, { "type": "object", - "required": [ - "mifinity" - ], + "required": ["mifinity"], "properties": { "mifinity": { "$ref": "#/components/schemas/MifinityData" @@ -21777,9 +20094,7 @@ "oneOf": [ { "type": "object", - "required": [ - "apple_pay" - ], + "required": ["apple_pay"], "properties": { "apple_pay": { "$ref": "#/components/schemas/WalletAdditionalDataForCard" @@ -21788,9 +20103,7 @@ }, { "type": "object", - "required": [ - "google_pay" - ], + "required": ["google_pay"], "properties": { "google_pay": { "$ref": "#/components/schemas/WalletAdditionalDataForCard" @@ -21811,11 +20124,7 @@ }, "WebhookDeliveryAttempt": { "type": "string", - "enum": [ - "initial_attempt", - "automatic_retry", - "manual_retry" - ] + "enum": ["initial_attempt", "automatic_retry", "manual_retry"] }, "WebhookDetails": { "type": "object", @@ -21954,4 +20263,4 @@ "description": "Manage events" } ] -} \ No newline at end of file +} diff --git a/crates/openapi/src/routes/payment_method.rs b/crates/openapi/src/routes/payment_method.rs index e3596a8325b0..afc9f4a17355 100644 --- a/crates/openapi/src/routes/payment_method.rs +++ b/crates/openapi/src/routes/payment_method.rs @@ -322,35 +322,13 @@ pub async fn payment_method_update_api() {} #[cfg(feature = "v2")] pub async fn payment_method_delete_api() {} -/// List saved payment methods for a Customer -/// -/// To filter and list the applicable payment methods for a particular Customer ID, to be used in a non-payments context -#[utoipa::path( - get, - path = "/v2/customers/{id}/saved-payment-methods", - request_body( - content = PaymentMethodListRequest, - // TODO: Add examples and add param for customer_id - ), - responses( - (status = 200, description = "Payment Methods retrieved", body = CustomerPaymentMethodsListResponse), - (status = 400, description = "Invalid Data"), - (status = 404, description = "Payment Methods does not exist in records") - ), - tag = "Payment Methods", - operation_id = "List all Payment Methods for a Customer", - security(("api_key" = [])) -)] -#[cfg(feature = "v2")] -pub async fn list_customer_payment_method_api() {} - /// Payment Methods - Payment Methods List /// -/// List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer. +/// List the payment methods eligible for a payment method. #[cfg(feature = "v2")] #[utoipa::path( get, - path = "/v2/payment-methods/{id}/list-payment-methods", + path = "/v2/payment-methods/{id}/list-enabled-payment-methods", params( ("id" = String, Path, description = "The global payment method id"), ( diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index 7f3c30cf48bd..25ece15d47d5 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1278,7 +1278,7 @@ impl RequiredFieldsForEnabledPaymentMethodTypes { #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[instrument(skip_all)] -pub async fn list_payment_methods( +pub async fn list_payment_methods_enabled( state: SessionState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 65e53a47f2b4..3752f01e3eb5 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -1168,8 +1168,8 @@ impl PaymentMethods { .route(web::delete().to(payment_methods::payment_method_delete_api)), ) .service( - web::resource("/list-payment-methods") - .route(web::get().to(payment_methods::list_payment_methods)), + web::resource("/list-enabled-payment-methods") + .route(web::get().to(payment_methods::list_payment_methods_enabled)), ) .service( web::resource("/confirm-intent") diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index a248b9b7eeeb..c8e6303562c9 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -214,7 +214,7 @@ pub async fn confirm_payment_method_intent_api( #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] -pub async fn list_payment_methods( +pub async fn list_payment_methods_enabled( state: web::Data, req: HttpRequest, path: web::Path, @@ -233,7 +233,7 @@ pub async fn list_payment_methods( &req, payment_method_id, |state, auth: auth::AuthenticationData, payment_method_id, _| { - payment_methods_routes::list_payment_methods( + payment_methods_routes::list_payment_methods_enabled( state, auth.merchant_account, auth.key_store, From f3cf1f92c244916b31a2040b0b6bcd7d5740a374 Mon Sep 17 00:00:00 2001 From: "hyperswitch-bot[bot]" <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:01:31 +0000 Subject: [PATCH 62/62] docs(openapi): re-generate OpenAPI specification --- api-reference-v2/openapi_spec.json | 3057 +++++++++++++++++++++------- 1 file changed, 2374 insertions(+), 683 deletions(-) diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 684251c64a35..2ef30449b3bb 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -22,7 +22,9 @@ "paths": { "/v2/organization": { "post": { - "tags": ["Organization"], + "tags": [ + "Organization" + ], "summary": "Organization - Create", "description": "Create a new organization", "operationId": "Create an Organization", @@ -67,7 +69,9 @@ }, "/v2/organization/{id}": { "get": { - "tags": ["Organization"], + "tags": [ + "Organization" + ], "summary": "Organization - Retrieve", "description": "Retrieve an existing organization", "operationId": "Retrieve an Organization", @@ -104,7 +108,9 @@ ] }, "put": { - "tags": ["Organization"], + "tags": [ + "Organization" + ], "summary": "Organization - Update", "description": "Create a new organization for .", "operationId": "Update an Organization", @@ -160,7 +166,9 @@ }, "/v2/organization/{id}/merchant-accounts": { "get": { - "tags": ["Organization"], + "tags": [ + "Organization" + ], "summary": "Organization - Merchant Account - List", "description": "List merchant accounts for an Organization", "operationId": "List Merchant Accounts", @@ -202,7 +210,9 @@ }, "/v2/connector-accounts": { "post": { - "tags": ["Merchant Connector Account"], + "tags": [ + "Merchant Connector Account" + ], "summary": "Connector Account - Create", "description": "Creates a new Connector Account for the merchant account. The connector could be a payment processor/facilitator/acquirer or a provider of specialized services like Fraud/Accounting etc.", "operationId": "Create a Merchant Connector", @@ -277,7 +287,9 @@ }, "/v2/connector-accounts/{id}": { "get": { - "tags": ["Merchant Connector Account"], + "tags": [ + "Merchant Connector Account" + ], "summary": "Connector Account - Retrieve", "description": "Retrieves details of a Connector account", "operationId": "Retrieve a Merchant Connector", @@ -318,7 +330,9 @@ ] }, "put": { - "tags": ["Merchant Connector Account"], + "tags": [ + "Merchant Connector Account" + ], "summary": "Connector Account - Update", "description": "To update an existing Connector account. Helpful in enabling/disabling different payment methods and other settings for the connector", "operationId": "Update a Merchant Connector", @@ -388,7 +402,9 @@ ] }, "delete": { - "tags": ["Merchant Connector Account"], + "tags": [ + "Merchant Connector Account" + ], "summary": "Merchant Connector - Delete", "description": "Delete or Detach a Merchant Connector from Merchant Account", "operationId": "Delete a Merchant Connector", @@ -431,7 +447,9 @@ }, "/v2/merchant-accounts": { "post": { - "tags": ["Merchant Account"], + "tags": [ + "Merchant Account" + ], "summary": "Merchant Account - Create", "description": "Create a new account for a *merchant* and the *merchant* could be a seller or retailer or client who likes to receive and send payments.\n\nBefore creating the merchant account, it is mandatory to create an organization.", "operationId": "Create a Merchant Account", @@ -508,7 +526,9 @@ }, "/v2/merchant-accounts/{id}": { "get": { - "tags": ["Merchant Account"], + "tags": [ + "Merchant Account" + ], "summary": "Merchant Account - Retrieve", "description": "Retrieve a *merchant* account details.", "operationId": "Retrieve a Merchant Account", @@ -545,7 +565,9 @@ ] }, "put": { - "tags": ["Merchant Account"], + "tags": [ + "Merchant Account" + ], "summary": "Merchant Account - Update", "description": "Updates details of an existing merchant account. Helpful in updating merchant details such as email, contact details, or other configuration details like webhook, routing algorithm etc", "operationId": "Update a Merchant Account", @@ -610,7 +632,9 @@ }, "/v2/merchant-accounts/{id}/profiles": { "get": { - "tags": ["Merchant Account"], + "tags": [ + "Merchant Account" + ], "summary": "Merchant Account - Profile List", "description": "List profiles for an Merchant", "operationId": "List Profiles", @@ -652,7 +676,9 @@ }, "/v2/profiles": { "post": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Create", "description": "Creates a new *profile* for a merchant", "operationId": "Create A Profile", @@ -711,7 +737,9 @@ }, "/v2/profiles/{id}": { "get": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Retrieve", "description": "Retrieve existing *profile*", "operationId": "Retrieve a Profile", @@ -760,7 +788,9 @@ ] }, "put": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Update", "description": "Update the *profile*", "operationId": "Update a Profile", @@ -828,7 +858,9 @@ }, "/v2/profiles/{id}/connector-accounts": { "get": { - "tags": ["Business Profile"], + "tags": [ + "Business Profile" + ], "summary": "Profile - Connector Accounts List", "description": "List Connector Accounts for the profile", "operationId": "List all Merchant Connectors", @@ -885,7 +917,9 @@ }, "/v2/profiles/{id}/activate-routing-algorithm": { "patch": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Activate routing algorithm", "description": "Activates a routing algorithm under a profile", "operationId": "Activates a routing algorithm under a profile", @@ -950,7 +984,9 @@ }, "/v2/profiles/{id}/deactivate-routing-algorithm": { "patch": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Deactivate routing algorithm", "description": "Deactivates a routing algorithm under a profile", "operationId": " Deactivates a routing algorithm under a profile", @@ -1001,7 +1037,9 @@ }, "/v2/profiles/{id}/fallback-routing": { "patch": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Update Default Fallback Routing Algorithm", "description": "Update the default fallback routing algorithm for the profile", "operationId": "Update the default fallback routing algorithm for the profile", @@ -1063,7 +1101,9 @@ ] }, "get": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Retrieve Default Fallback Routing Algorithm", "description": "Retrieve the default fallback routing algorithm for the profile", "operationId": "Retrieve the default fallback routing algorithm for the profile", @@ -1108,7 +1148,9 @@ }, "/v2/profiles/{id}/routing-algorithm": { "get": { - "tags": ["Profile"], + "tags": [ + "Profile" + ], "summary": "Profile - Retrieve Active Routing Algorithm", "description": "_\nRetrieve active routing algorithm under the profile", "operationId": "Retrieve the active routing algorithm under the profile", @@ -1180,7 +1222,9 @@ }, "/v2/routing-algorithm": { "post": { - "tags": ["Routing"], + "tags": [ + "Routing" + ], "summary": "Routing - Create", "description": "Create a routing algorithm", "operationId": "Create a routing algorithm", @@ -1233,7 +1277,9 @@ }, "/v2/routing-algorithm/{id}": { "get": { - "tags": ["Routing"], + "tags": [ + "Routing" + ], "summary": "Routing - Retrieve", "description": "Retrieve a routing algorithm with its algorithm id", "operationId": "Retrieve a routing algorithm with its algorithm id", @@ -1281,7 +1327,9 @@ }, "/v2/api-keys": { "post": { - "tags": ["API Key"], + "tags": [ + "API Key" + ], "summary": "API Key - Create", "description": "Create a new API Key for accessing our APIs from your servers. The plaintext API Key will be\ndisplayed only once on creation, so ensure you store it securely.", "operationId": "Create an API Key", @@ -1319,7 +1367,9 @@ }, "/v2/api-keys/{id}": { "get": { - "tags": ["API Key"], + "tags": [ + "API Key" + ], "summary": "API Key - Retrieve", "description": "Retrieve information about the specified API Key.", "operationId": "Retrieve an API Key", @@ -1356,7 +1406,9 @@ ] }, "put": { - "tags": ["API Key"], + "tags": [ + "API Key" + ], "summary": "API Key - Update", "description": "Update information for the specified API Key.", "operationId": "Update an API Key", @@ -1403,7 +1455,9 @@ ] }, "delete": { - "tags": ["API Key"], + "tags": [ + "API Key" + ], "summary": "API Key - Revoke", "description": "Revoke the specified API Key. Once revoked, the API Key can no longer be used for\nauthenticating with our APIs.", "operationId": "Revoke an API Key", @@ -1442,7 +1496,9 @@ }, "/v2/api-keys/list": { "get": { - "tags": ["API Key"], + "tags": [ + "API Key" + ], "summary": "API Key - List", "description": "List all the API Keys associated to a merchant account.", "operationId": "List all API Keys associated with a merchant account", @@ -1494,7 +1550,9 @@ }, "/v2/customers": { "post": { - "tags": ["Customers"], + "tags": [ + "Customers" + ], "summary": "Customers - Create", "description": "Creates a customer object and stores the customer details to be reused for future payments.\nIncase the customer already exists in the system, this API will respond with the customer details.", "operationId": "Create a Customer", @@ -1540,7 +1598,9 @@ }, "/v2/customers/{id}": { "get": { - "tags": ["Customers"], + "tags": [ + "Customers" + ], "summary": "Customers - Retrieve", "description": "Retrieves a customer's details.", "operationId": "Retrieve a Customer", @@ -1580,7 +1640,9 @@ ] }, "post": { - "tags": ["Customers"], + "tags": [ + "Customers" + ], "summary": "Customers - Update", "description": "Updates the customer's details in a customer object.", "operationId": "Update a Customer", @@ -1635,7 +1697,9 @@ ] }, "delete": { - "tags": ["Customers"], + "tags": [ + "Customers" + ], "summary": "Customers - Delete", "description": "Delete a customer record.", "operationId": "Delete a Customer", @@ -1674,7 +1738,9 @@ }, "/v2/customers/list": { "get": { - "tags": ["Customers"], + "tags": [ + "Customers" + ], "summary": "Customers - List", "description": "Lists all the customers for a particular merchant id.", "operationId": "List all Customers for a Merchant", @@ -1705,7 +1771,9 @@ }, "/v2/payments/create-intent": { "post": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Create Intent", "description": "**Creates a payment intent object when amount_details are passed.**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the first call, and use the 'client secret' returned in this API along with your 'publishable key' to make subsequent API calls from your client.", "operationId": "Create a Payment Intent", @@ -1753,7 +1821,9 @@ }, "/v2/payments/{id}/get-intent": { "get": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Get Intent", "description": "**Get a payment intent object when id is passed in path**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the call.", "operationId": "Get the Payment Intent details", @@ -1792,7 +1862,9 @@ }, "/v2/payments/{id}/update-intent": { "put": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Update Intent", "description": "**Update a payment intent object**\n\nYou will require the 'API - Key' from the Hyperswitch dashboard to make the call.", "operationId": "Update a Payment Intent", @@ -1863,7 +1935,9 @@ }, "/v2/payments/{id}/confirm-intent": { "post": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Confirm Intent", "description": "**Confirms a payment intent object with the payment method data**\n\n.", "operationId": "Confirm Payment Intent", @@ -1952,7 +2026,9 @@ }, "/v2/payments/{id}": { "get": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Get", "description": "Retrieves a Payment. This API can also be used to get the status of a previously initiated payment or next action for an ongoing payment", "operationId": "Retrieve a Payment", @@ -2000,7 +2076,9 @@ }, "/v2/payments/{payment_id}/create-external-sdk-tokens": { "post": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Session token", "description": "Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.", "operationId": "Create Session tokens for a Payment", @@ -2049,7 +2127,9 @@ }, "/v2/payments/{id}/payment-methods": { "get": { - "tags": ["Payments"], + "tags": [ + "Payments" + ], "summary": "Payments - Payment Methods List", "description": "List the payment methods eligible for a payment. This endpoint also returns the saved payment methods for the customer when the customer_id is passed when creating the payment", "operationId": "Retrieve Payment methods for a Payment", @@ -2112,7 +2192,9 @@ }, "/v2/payment-methods": { "post": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Create", "description": "Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.", "operationId": "Create Payment Method", @@ -2150,7 +2232,9 @@ }, "/v2/payment-methods/create-intent": { "post": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Create Intent", "description": "Creates a payment method for customer with billing information and other metadata.", "operationId": "Create Payment Method Intent", @@ -2188,7 +2272,9 @@ }, "/v2/payment-methods/{id}/list-enabled-payment-methods": { "get": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Methods - Payment Methods List", "description": "List the payment methods eligible for a payment method.", "operationId": "List Payment methods for a Payment Method Intent", @@ -2240,7 +2326,9 @@ }, "/v2/payment-methods/{id}/confirm-intent": { "post": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Confirm Intent", "description": "Update a payment method with customer's payment method related information.", "operationId": "Confirm Payment Method Intent", @@ -2278,7 +2366,9 @@ }, "/v2/payment-methods/{id}/update-saved-payment-method": { "patch": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Update", "description": "Update an existing payment method of a customer.", "operationId": "Update Payment Method", @@ -2316,7 +2406,9 @@ }, "/v2/payment-methods/{id}": { "get": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Retrieve", "description": "Retrieves a payment method of a customer.", "operationId": "Retrieve Payment Method", @@ -2353,7 +2445,9 @@ ] }, "delete": { - "tags": ["Payment Methods"], + "tags": [ + "Payment Methods" + ], "summary": "Payment Method - Delete", "description": "Deletes a payment method of a customer.", "operationId": "Delete Payment Method", @@ -2392,7 +2486,9 @@ }, "/v2/refunds": { "post": { - "tags": ["Refunds"], + "tags": [ + "Refunds" + ], "summary": "Refunds - Create", "description": "Creates a refund against an already processed payment. In case of some processors, you can even opt to refund only a partial amount multiple times until the original charge amount has been refunded", "operationId": "Create a Refund", @@ -2460,17 +2556,25 @@ "AcceptanceType": { "type": "string", "description": "This is used to indicate if the mandate was accepted online or offline", - "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", @@ -2482,11 +2586,16 @@ }, { "type": "object", - "required": ["type", "list"], + "required": [ + "type", + "list" + ], "properties": { "type": { "type": "string", - "enum": ["disable_only"] + "enum": [ + "disable_only" + ] }, "list": { "type": "array", @@ -2498,11 +2607,15 @@ }, { "type": "object", - "required": ["type"], + "required": [ + "type" + ], "properties": { "type": { "type": "string", - "enum": ["all_accepted"] + "enum": [ + "all_accepted" + ] } } } @@ -2516,11 +2629,16 @@ "oneOf": [ { "type": "object", - "required": ["type", "list"], + "required": [ + "type", + "list" + ], "properties": { "type": { "type": "string", - "enum": ["enable_only"] + "enum": [ + "enable_only" + ] }, "list": { "type": "array", @@ -2532,11 +2650,16 @@ }, { "type": "object", - "required": ["type", "list"], + "required": [ + "type", + "list" + ], "properties": { "type": { "type": "string", - "enum": ["disable_only"] + "enum": [ + "disable_only" + ] }, "list": { "type": "array", @@ -2548,11 +2671,15 @@ }, { "type": "object", - "required": ["type"], + "required": [ + "type" + ], "properties": { "type": { "type": "string", - "enum": ["all_accepted"] + "enum": [ + "all_accepted" + ] } } } @@ -2563,7 +2690,10 @@ }, "AchBankDebitAdditionalData": { "type": "object", - "required": ["account_number", "routing_number"], + "required": [ + "account_number", + "routing_number" + ], "properties": { "account_number": { "type": "string", @@ -2615,7 +2745,10 @@ }, "AchBankTransfer": { "type": "object", - "required": ["bank_account_number", "bank_routing_number"], + "required": [ + "bank_account_number", + "bank_routing_number" + ], "properties": { "bank_name": { "type": "string", @@ -2652,7 +2785,10 @@ "AchBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for ach bank transfer payout method", - "required": ["bank_account_number", "bank_routing_number"], + "required": [ + "bank_account_number", + "bank_routing_number" + ], "properties": { "bank_account_number": { "type": "string", @@ -2729,7 +2865,9 @@ "oneOf": [ { "type": "object", - "required": ["open_banking_recipient_data"], + "required": [ + "open_banking_recipient_data" + ], "properties": { "open_banking_recipient_data": { "$ref": "#/components/schemas/MerchantRecipientData" @@ -2742,7 +2880,9 @@ "oneOf": [ { "type": "object", - "required": ["Card"], + "required": [ + "Card" + ], "properties": { "Card": { "$ref": "#/components/schemas/CardAdditionalData" @@ -2751,7 +2891,9 @@ }, { "type": "object", - "required": ["Bank"], + "required": [ + "Bank" + ], "properties": { "Bank": { "$ref": "#/components/schemas/BankAdditionalData" @@ -2760,7 +2902,9 @@ }, { "type": "object", - "required": ["Wallet"], + "required": [ + "Wallet" + ], "properties": { "Wallet": { "$ref": "#/components/schemas/WalletAdditionalData" @@ -2910,7 +3054,9 @@ }, "AmountDetails": { "type": "object", - "required": ["currency"], + "required": [ + "currency" + ], "properties": { "order_amount": { "type": "integer", @@ -3109,7 +3255,10 @@ }, "AmountInfo": { "type": "object", - "required": ["label", "amount"], + "required": [ + "label", + "amount" + ], "properties": { "label": { "type": "string", @@ -3131,7 +3280,9 @@ "oneOf": [ { "type": "string", - "enum": ["never"] + "enum": [ + "never" + ] }, { "type": "string", @@ -3141,7 +3292,11 @@ }, "ApplePayAddressParameters": { "type": "string", - "enum": ["postalAddress", "phone", "email"] + "enum": [ + "postalAddress", + "phone", + "email" + ] }, "ApplePayBillingContactFields": { "type": "array", @@ -3151,7 +3306,11 @@ }, "ApplePayPaymentRequest": { "type": "object", - "required": ["country_code", "currency_code", "total"], + "required": [ + "country_code", + "currency_code", + "total" + ], "properties": { "country_code": { "$ref": "#/components/schemas/CountryAlpha2" @@ -3210,7 +3369,10 @@ }, "ApplePayPaymentTiming": { "type": "string", - "enum": ["immediate", "recurring"] + "enum": [ + "immediate", + "recurring" + ] }, "ApplePayRecurringDetails": { "type": "object", @@ -3271,7 +3433,9 @@ }, "ApplePayRegularBillingDetails": { "type": "object", - "required": ["label"], + "required": [ + "label" + ], "properties": { "label": { "type": "string", @@ -3309,7 +3473,11 @@ }, "ApplePayRegularBillingRequest": { "type": "object", - "required": ["amount", "label", "payment_timing"], + "required": [ + "amount", + "label", + "payment_timing" + ], "properties": { "amount": { "type": "string", @@ -3411,11 +3579,18 @@ }, "ApplepayInitiative": { "type": "string", - "enum": ["web", "ios"] + "enum": [ + "web", + "ios" + ] }, "ApplepayPaymentMethod": { "type": "object", - "required": ["display_name", "network", "type"], + "required": [ + "display_name", + "network", + "type" + ], "properties": { "display_name": { "type": "string", @@ -3433,7 +3608,11 @@ }, "ApplepaySessionTokenResponse": { "type": "object", - "required": ["connector", "delayed_session_token", "sdk_next_action"], + "required": [ + "connector", + "delayed_session_token", + "sdk_next_action" + ], "properties": { "session_token_data": { "allOf": [ @@ -3511,7 +3690,10 @@ }, "AuthenticationConnectorDetails": { "type": "object", - "required": ["authentication_connectors", "three_ds_requestor_url"], + "required": [ + "authentication_connectors", + "three_ds_requestor_url" + ], "properties": { "authentication_connectors": { "type": "array", @@ -3538,20 +3720,36 @@ }, "AuthenticationStatus": { "type": "string", - "enum": ["started", "pending", "success", "failed"] + "enum": [ + "started", + "pending", + "success", + "failed" + ] }, "AuthenticationType": { "type": "string", "description": "Pass this parameter to force 3DS or non 3DS auth for this payment. Some connectors will still force 3DS auth even in case of passing 'no_three_ds' here and vice versa. Default value is 'no_three_ds' if not set", - "enum": ["three_ds", "no_three_ds"] + "enum": [ + "three_ds", + "no_three_ds" + ] }, "AuthorizationStatus": { "type": "string", - "enum": ["success", "failure", "processing", "unresolved"] + "enum": [ + "success", + "failure", + "processing", + "unresolved" + ] }, "BacsBankDebitAdditionalData": { "type": "object", - "required": ["account_number", "sort_code"], + "required": [ + "account_number", + "sort_code" + ], "properties": { "account_number": { "type": "string", @@ -3573,7 +3771,10 @@ }, "BacsBankTransfer": { "type": "object", - "required": ["bank_account_number", "bank_sort_code"], + "required": [ + "bank_account_number", + "bank_sort_code" + ], "properties": { "bank_name": { "type": "string", @@ -3610,7 +3811,10 @@ "BacsBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for bacs bank transfer payout method", - "required": ["bank_sort_code", "bank_account_number"], + "required": [ + "bank_sort_code", + "bank_account_number" + ], "properties": { "bank_sort_code": { "type": "string", @@ -3646,7 +3850,11 @@ }, "BacsBankTransferInstructions": { "type": "object", - "required": ["account_holder_name", "account_number", "sort_code"], + "required": [ + "account_holder_name", + "account_number", + "sort_code" + ], "properties": { "account_holder_name": { "type": "string", @@ -3726,7 +3934,10 @@ }, "BankCodeResponse": { "type": "object", - "required": ["bank_name", "eligible_connectors"], + "required": [ + "bank_name", + "eligible_connectors" + ], "properties": { "bank_name": { "type": "array", @@ -3746,7 +3957,9 @@ "oneOf": [ { "type": "object", - "required": ["ach"], + "required": [ + "ach" + ], "properties": { "ach": { "$ref": "#/components/schemas/AchBankDebitAdditionalData" @@ -3755,7 +3968,9 @@ }, { "type": "object", - "required": ["bacs"], + "required": [ + "bacs" + ], "properties": { "bacs": { "$ref": "#/components/schemas/BacsBankDebitAdditionalData" @@ -3764,7 +3979,9 @@ }, { "type": "object", - "required": ["becs"], + "required": [ + "becs" + ], "properties": { "becs": { "$ref": "#/components/schemas/BecsBankDebitAdditionalData" @@ -3773,7 +3990,9 @@ }, { "type": "object", - "required": ["sepa"], + "required": [ + "sepa" + ], "properties": { "sepa": { "$ref": "#/components/schemas/SepaBankDebitAdditionalData" @@ -3811,7 +4030,9 @@ "oneOf": [ { "type": "object", - "required": ["ach_bank_debit"], + "required": [ + "ach_bank_debit" + ], "properties": { "ach_bank_debit": { "type": "object", @@ -3870,11 +4091,16 @@ }, { "type": "object", - "required": ["sepa_bank_debit"], + "required": [ + "sepa_bank_debit" + ], "properties": { "sepa_bank_debit": { "type": "object", - "required": ["iban", "bank_account_holder_name"], + "required": [ + "iban", + "bank_account_holder_name" + ], "properties": { "billing_details": { "allOf": [ @@ -3900,11 +4126,16 @@ }, { "type": "object", - "required": ["becs_bank_debit"], + "required": [ + "becs_bank_debit" + ], "properties": { "becs_bank_debit": { "type": "object", - "required": ["account_number", "bsb_number"], + "required": [ + "account_number", + "bsb_number" + ], "properties": { "billing_details": { "allOf": [ @@ -3936,7 +4167,9 @@ }, { "type": "object", - "required": ["bacs_bank_debit"], + "required": [ + "bacs_bank_debit" + ], "properties": { "bacs_bank_debit": { "type": "object", @@ -3992,7 +4225,9 @@ }, "BankDebitTypes": { "type": "object", - "required": ["eligible_connectors"], + "required": [ + "eligible_connectors" + ], "properties": { "eligible_connectors": { "type": "array", @@ -4004,7 +4239,10 @@ }, "BankHolderType": { "type": "string", - "enum": ["personal", "business"] + "enum": [ + "personal", + "business" + ] }, "BankNames": { "type": "string", @@ -4160,7 +4398,10 @@ }, "BankRedirectBilling": { "type": "object", - "required": ["billing_name", "email"], + "required": [ + "billing_name", + "email" + ], "properties": { "billing_name": { "type": "string", @@ -4178,7 +4419,9 @@ "oneOf": [ { "type": "object", - "required": ["bancontact_card"], + "required": [ + "bancontact_card" + ], "properties": { "bancontact_card": { "type": "object", @@ -4223,7 +4466,9 @@ }, { "type": "object", - "required": ["bizum"], + "required": [ + "bizum" + ], "properties": { "bizum": { "type": "object" @@ -4232,7 +4477,9 @@ }, { "type": "object", - "required": ["blik"], + "required": [ + "blik" + ], "properties": { "blik": { "type": "object", @@ -4247,11 +4494,16 @@ }, { "type": "object", - "required": ["eps"], + "required": [ + "eps" + ], "properties": { "eps": { "type": "object", - "required": ["bank_name", "country"], + "required": [ + "bank_name", + "country" + ], "properties": { "billing_details": { "allOf": [ @@ -4273,11 +4525,15 @@ }, { "type": "object", - "required": ["giropay"], + "required": [ + "giropay" + ], "properties": { "giropay": { "type": "object", - "required": ["country"], + "required": [ + "country" + ], "properties": { "billing_details": { "allOf": [ @@ -4306,11 +4562,16 @@ }, { "type": "object", - "required": ["ideal"], + "required": [ + "ideal" + ], "properties": { "ideal": { "type": "object", - "required": ["bank_name", "country"], + "required": [ + "bank_name", + "country" + ], "properties": { "billing_details": { "allOf": [ @@ -4332,7 +4593,9 @@ }, { "type": "object", - "required": ["interac"], + "required": [ + "interac" + ], "properties": { "interac": { "type": "object", @@ -4356,11 +4619,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" @@ -4371,7 +4638,9 @@ }, { "type": "object", - "required": ["online_banking_finland"], + "required": [ + "online_banking_finland" + ], "properties": { "online_banking_finland": { "type": "object", @@ -4386,11 +4655,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" @@ -4401,11 +4674,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" @@ -4416,11 +4693,16 @@ }, { "type": "object", - "required": ["open_banking_uk"], + "required": [ + "open_banking_uk" + ], "properties": { "open_banking_uk": { "type": "object", - "required": ["issuer", "country"], + "required": [ + "issuer", + "country" + ], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4434,7 +4716,9 @@ }, { "type": "object", - "required": ["przelewy24"], + "required": [ + "przelewy24" + ], "properties": { "przelewy24": { "type": "object", @@ -4461,11 +4745,15 @@ }, { "type": "object", - "required": ["sofort"], + "required": [ + "sofort" + ], "properties": { "sofort": { "type": "object", - "required": ["country"], + "required": [ + "country" + ], "properties": { "billing_details": { "allOf": [ @@ -4490,11 +4778,15 @@ }, { "type": "object", - "required": ["trustly"], + "required": [ + "trustly" + ], "properties": { "trustly": { "type": "object", - "required": ["country"], + "required": [ + "country" + ], "properties": { "country": { "$ref": "#/components/schemas/CountryAlpha2" @@ -4505,11 +4797,15 @@ }, { "type": "object", - "required": ["online_banking_fpx"], + "required": [ + "online_banking_fpx" + ], "properties": { "online_banking_fpx": { "type": "object", - "required": ["issuer"], + "required": [ + "issuer" + ], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4520,11 +4816,15 @@ }, { "type": "object", - "required": ["online_banking_thailand"], + "required": [ + "online_banking_thailand" + ], "properties": { "online_banking_thailand": { "type": "object", - "required": ["issuer"], + "required": [ + "issuer" + ], "properties": { "issuer": { "$ref": "#/components/schemas/BankNames" @@ -4535,7 +4835,9 @@ }, { "type": "object", - "required": ["local_bank_redirect"], + "required": [ + "local_bank_redirect" + ], "properties": { "local_bank_redirect": { "type": "object" @@ -4548,7 +4850,9 @@ "oneOf": [ { "type": "object", - "required": ["BancontactCard"], + "required": [ + "BancontactCard" + ], "properties": { "BancontactCard": { "$ref": "#/components/schemas/BancontactBankRedirectAdditionalData" @@ -4557,7 +4861,9 @@ }, { "type": "object", - "required": ["Blik"], + "required": [ + "Blik" + ], "properties": { "Blik": { "$ref": "#/components/schemas/BlikBankRedirectAdditionalData" @@ -4566,7 +4872,9 @@ }, { "type": "object", - "required": ["Giropay"], + "required": [ + "Giropay" + ], "properties": { "Giropay": { "$ref": "#/components/schemas/GiropayBankRedirectAdditionalData" @@ -4604,7 +4912,9 @@ "oneOf": [ { "type": "object", - "required": ["ach"], + "required": [ + "ach" + ], "properties": { "ach": { "type": "object" @@ -4613,7 +4923,9 @@ }, { "type": "object", - "required": ["sepa"], + "required": [ + "sepa" + ], "properties": { "sepa": { "type": "object" @@ -4622,7 +4934,9 @@ }, { "type": "object", - "required": ["bacs"], + "required": [ + "bacs" + ], "properties": { "bacs": { "type": "object" @@ -4631,7 +4945,9 @@ }, { "type": "object", - "required": ["multibanco"], + "required": [ + "multibanco" + ], "properties": { "multibanco": { "type": "object" @@ -4640,7 +4956,9 @@ }, { "type": "object", - "required": ["permata"], + "required": [ + "permata" + ], "properties": { "permata": { "type": "object" @@ -4649,7 +4967,9 @@ }, { "type": "object", - "required": ["bca"], + "required": [ + "bca" + ], "properties": { "bca": { "type": "object" @@ -4658,7 +4978,9 @@ }, { "type": "object", - "required": ["bni_va"], + "required": [ + "bni_va" + ], "properties": { "bni_va": { "type": "object" @@ -4667,7 +4989,9 @@ }, { "type": "object", - "required": ["bri_va"], + "required": [ + "bri_va" + ], "properties": { "bri_va": { "type": "object" @@ -4676,7 +5000,9 @@ }, { "type": "object", - "required": ["cimb_va"], + "required": [ + "cimb_va" + ], "properties": { "cimb_va": { "type": "object" @@ -4685,7 +5011,9 @@ }, { "type": "object", - "required": ["danamon_va"], + "required": [ + "danamon_va" + ], "properties": { "danamon_va": { "type": "object" @@ -4694,7 +5022,9 @@ }, { "type": "object", - "required": ["mandiri_va"], + "required": [ + "mandiri_va" + ], "properties": { "mandiri_va": { "type": "object" @@ -4703,8 +5033,10 @@ }, { "type": "object", - "required": ["pix"], - "properties": { + "required": [ + "pix" + ], + "properties": { "pix": { "$ref": "#/components/schemas/PixBankTransferAdditionalData" } @@ -4712,7 +5044,9 @@ }, { "type": "object", - "required": ["pse"], + "required": [ + "pse" + ], "properties": { "pse": { "type": "object" @@ -4721,7 +5055,9 @@ }, { "type": "object", - "required": ["local_bank_transfer"], + "required": [ + "local_bank_transfer" + ], "properties": { "local_bank_transfer": { "$ref": "#/components/schemas/LocalBankTransferAdditionalData" @@ -4734,7 +5070,9 @@ "oneOf": [ { "type": "object", - "required": ["ach_bank_transfer"], + "required": [ + "ach_bank_transfer" + ], "properties": { "ach_bank_transfer": { "type": "object", @@ -4753,11 +5091,15 @@ }, { "type": "object", - "required": ["sepa_bank_transfer"], + "required": [ + "sepa_bank_transfer" + ], "properties": { "sepa_bank_transfer": { "type": "object", - "required": ["country"], + "required": [ + "country" + ], "properties": { "billing_details": { "allOf": [ @@ -4776,7 +5118,9 @@ }, { "type": "object", - "required": ["bacs_bank_transfer"], + "required": [ + "bacs_bank_transfer" + ], "properties": { "bacs_bank_transfer": { "type": "object", @@ -4795,7 +5139,9 @@ }, { "type": "object", - "required": ["multibanco_bank_transfer"], + "required": [ + "multibanco_bank_transfer" + ], "properties": { "multibanco_bank_transfer": { "type": "object", @@ -4814,7 +5160,9 @@ }, { "type": "object", - "required": ["permata_bank_transfer"], + "required": [ + "permata_bank_transfer" + ], "properties": { "permata_bank_transfer": { "type": "object", @@ -4833,7 +5181,9 @@ }, { "type": "object", - "required": ["bca_bank_transfer"], + "required": [ + "bca_bank_transfer" + ], "properties": { "bca_bank_transfer": { "type": "object", @@ -4852,7 +5202,9 @@ }, { "type": "object", - "required": ["bni_va_bank_transfer"], + "required": [ + "bni_va_bank_transfer" + ], "properties": { "bni_va_bank_transfer": { "type": "object", @@ -4871,7 +5223,9 @@ }, { "type": "object", - "required": ["bri_va_bank_transfer"], + "required": [ + "bri_va_bank_transfer" + ], "properties": { "bri_va_bank_transfer": { "type": "object", @@ -4890,7 +5244,9 @@ }, { "type": "object", - "required": ["cimb_va_bank_transfer"], + "required": [ + "cimb_va_bank_transfer" + ], "properties": { "cimb_va_bank_transfer": { "type": "object", @@ -4909,7 +5265,9 @@ }, { "type": "object", - "required": ["danamon_va_bank_transfer"], + "required": [ + "danamon_va_bank_transfer" + ], "properties": { "danamon_va_bank_transfer": { "type": "object", @@ -4928,7 +5286,9 @@ }, { "type": "object", - "required": ["mandiri_va_bank_transfer"], + "required": [ + "mandiri_va_bank_transfer" + ], "properties": { "mandiri_va_bank_transfer": { "type": "object", @@ -4947,7 +5307,9 @@ }, { "type": "object", - "required": ["pix"], + "required": [ + "pix" + ], "properties": { "pix": { "type": "object", @@ -4976,7 +5338,9 @@ }, { "type": "object", - "required": ["pse"], + "required": [ + "pse" + ], "properties": { "pse": { "type": "object" @@ -4985,7 +5349,9 @@ }, { "type": "object", - "required": ["local_bank_transfer"], + "required": [ + "local_bank_transfer" + ], "properties": { "local_bank_transfer": { "type": "object", @@ -5004,7 +5370,9 @@ "oneOf": [ { "type": "object", - "required": ["doku_bank_transfer_instructions"], + "required": [ + "doku_bank_transfer_instructions" + ], "properties": { "doku_bank_transfer_instructions": { "$ref": "#/components/schemas/DokuBankTransferInstructions" @@ -5013,7 +5381,9 @@ }, { "type": "object", - "required": ["ach_credit_transfer"], + "required": [ + "ach_credit_transfer" + ], "properties": { "ach_credit_transfer": { "$ref": "#/components/schemas/AchTransfer" @@ -5022,7 +5392,9 @@ }, { "type": "object", - "required": ["sepa_bank_instructions"], + "required": [ + "sepa_bank_instructions" + ], "properties": { "sepa_bank_instructions": { "$ref": "#/components/schemas/SepaBankTransferInstructions" @@ -5031,7 +5403,9 @@ }, { "type": "object", - "required": ["bacs_bank_instructions"], + "required": [ + "bacs_bank_instructions" + ], "properties": { "bacs_bank_instructions": { "$ref": "#/components/schemas/BacsBankTransferInstructions" @@ -5040,7 +5414,9 @@ }, { "type": "object", - "required": ["multibanco"], + "required": [ + "multibanco" + ], "properties": { "multibanco": { "$ref": "#/components/schemas/MultibancoTransferInstructions" @@ -5086,7 +5462,9 @@ }, "BankTransferTypes": { "type": "object", - "required": ["eligible_connectors"], + "required": [ + "eligible_connectors" + ], "properties": { "eligible_connectors": { "type": "array", @@ -5094,17 +5472,26 @@ "type": "string" }, "description": "The list of eligible connectors for a given payment experience", - "example": ["stripe", "adyen"] + "example": [ + "stripe", + "adyen" + ] } } }, "BankType": { "type": "string", - "enum": ["checking", "savings"] + "enum": [ + "checking", + "savings" + ] }, "BecsBankDebitAdditionalData": { "type": "object", - "required": ["account_number", "bsb_number"], + "required": [ + "account_number", + "bsb_number" + ], "properties": { "account_number": { "type": "string", @@ -5136,17 +5523,26 @@ }, "BlocklistDataKind": { "type": "string", - "enum": ["payment_method", "card_bin", "extended_card_bin"] + "enum": [ + "payment_method", + "card_bin", + "extended_card_bin" + ] }, "BlocklistRequest": { "oneOf": [ { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["card_bin"] + "enum": [ + "card_bin" + ] }, "data": { "type": "string" @@ -5155,11 +5551,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["fingerprint"] + "enum": [ + "fingerprint" + ] }, "data": { "type": "string" @@ -5168,11 +5569,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["extended_card_bin"] + "enum": [ + "extended_card_bin" + ] }, "data": { "type": "string" @@ -5186,7 +5592,11 @@ }, "BlocklistResponse": { "type": "object", - "required": ["fingerprint_id", "data_kind", "created_at"], + "required": [ + "fingerprint_id", + "data_kind", + "created_at" + ], "properties": { "fingerprint_id": { "type": "string" @@ -5296,7 +5706,9 @@ }, { "type": "object", - "required": ["enabled_payment_methods"], + "required": [ + "enabled_payment_methods" + ], "properties": { "enabled_payment_methods": { "type": "array", @@ -5317,7 +5729,9 @@ }, { "type": "object", - "required": ["allowed_domains"], + "required": [ + "allowed_domains" + ], "properties": { "domain_name": { "type": "string", @@ -5486,7 +5900,12 @@ }, "CaptureStatus": { "type": "string", - "enum": ["started", "charged", "pending", "failed"] + "enum": [ + "started", + "charged", + "pending", + "failed" + ] }, "Card": { "type": "object", @@ -5563,7 +5982,11 @@ "CardAdditionalData": { "type": "object", "description": "Masked payout method details for card payout method", - "required": ["card_exp_month", "card_exp_year", "card_holder_name"], + "required": [ + "card_exp_month", + "card_exp_year", + "card_holder_name" + ], "properties": { "card_issuer": { "type": "string", @@ -5690,7 +6113,9 @@ }, "CardDetailFromLocker": { "type": "object", - "required": ["saved_to_locker"], + "required": [ + "saved_to_locker" + ], "properties": { "issuer_country": { "allOf": [ @@ -5751,7 +6176,9 @@ }, "CardDetailUpdate": { "type": "object", - "required": ["card_holder_name"], + "required": [ + "card_holder_name" + ], "properties": { "card_holder_name": { "type": "string", @@ -5786,7 +6213,9 @@ }, "CardNetworkTypes": { "type": "object", - "required": ["eligible_connectors"], + "required": [ + "eligible_connectors" + ], "properties": { "card_network": { "allOf": [ @@ -5810,7 +6239,10 @@ "type": "string" }, "description": "The list of eligible connectors for a given card network", - "example": ["stripe", "adyen"] + "example": [ + "stripe", + "adyen" + ] } } }, @@ -5847,7 +6279,9 @@ "oneOf": [ { "type": "object", - "required": ["knet"], + "required": [ + "knet" + ], "properties": { "knet": { "type": "object" @@ -5856,7 +6290,9 @@ }, { "type": "object", - "required": ["benefit"], + "required": [ + "benefit" + ], "properties": { "benefit": { "type": "object" @@ -5865,7 +6301,9 @@ }, { "type": "object", - "required": ["momo_atm"], + "required": [ + "momo_atm" + ], "properties": { "momo_atm": { "type": "object" @@ -5874,7 +6312,9 @@ }, { "type": "object", - "required": ["card_redirect"], + "required": [ + "card_redirect" + ], "properties": { "card_redirect": { "type": "object" @@ -5955,7 +6395,9 @@ }, "CardToken": { "type": "object", - "required": ["card_holder_name"], + "required": [ + "card_holder_name" + ], "properties": { "card_holder_name": { "type": "string", @@ -5971,7 +6413,9 @@ }, "CardTokenAdditionalData": { "type": "object", - "required": ["card_holder_name"], + "required": [ + "card_holder_name" + ], "properties": { "card_holder_name": { "type": "string", @@ -5997,7 +6441,10 @@ }, "CardType": { "type": "string", - "enum": ["credit", "debit"] + "enum": [ + "credit", + "debit" + ] }, "CashappQr": { "type": "object" @@ -6005,7 +6452,9 @@ "ChargeRefunds": { "type": "object", "description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.", - "required": ["charge_id"], + "required": [ + "charge_id" + ], "properties": { "charge_id": { "type": "string", @@ -6093,7 +6542,12 @@ "Comparison": { "type": "object", "description": "Represents a single comparison condition.", - "required": ["lhs", "comparison", "value", "metadata"], + "required": [ + "lhs", + "comparison", + "value", + "metadata" + ], "properties": { "lhs": { "type": "string", @@ -6215,7 +6669,10 @@ }, "ConnectorFeatureMatrixResponse": { "type": "object", - "required": ["name", "supported_payment_methods"], + "required": [ + "name", + "supported_payment_methods" + ], "properties": { "name": { "type": "string" @@ -6281,11 +6738,16 @@ "oneOf": [ { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["priority"] + "enum": [ + "priority" + ] }, "data": { "type": "array", @@ -6297,11 +6759,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["volume_split"] + "enum": [ + "volume_split" + ] }, "data": { "type": "array", @@ -6318,7 +6785,10 @@ }, "ConnectorStatus": { "type": "string", - "enum": ["inactive", "active"] + "enum": [ + "inactive", + "active" + ] }, "ConnectorType": { "type": "string", @@ -6339,7 +6809,10 @@ }, "ConnectorVolumeSplit": { "type": "object", - "required": ["connector", "split"], + "required": [ + "connector", + "split" + ], "properties": { "connector": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -6634,7 +7107,10 @@ "CreateApiKeyRequest": { "type": "object", "description": "The request body for creating an API Key.", - "required": ["name", "expiration"], + "required": [ + "name", + "expiration" + ], "properties": { "name": { "type": "string", @@ -6927,7 +7403,9 @@ "CustomerAcceptance": { "type": "object", "description": "This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.", - "required": ["acceptance_type"], + "required": [ + "acceptance_type" + ], "properties": { "acceptance_type": { "$ref": "#/components/schemas/AcceptanceType" @@ -6993,7 +7471,9 @@ "CustomerDetails": { "type": "object", "description": "Passing this object creates a new customer or attaches an existing customer to the payment", - "required": ["id"], + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -7179,7 +7659,9 @@ }, "CustomerPaymentMethodsListResponse": { "type": "object", - "required": ["customer_payment_methods"], + "required": [ + "customer_payment_methods" + ], "properties": { "customer_payment_methods": { "type": "array", @@ -7198,7 +7680,10 @@ "CustomerRequest": { "type": "object", "description": "The customer details", - "required": ["name", "email"], + "required": [ + "name", + "email" + ], "properties": { "merchant_reference_id": { "type": "string", @@ -7267,7 +7752,11 @@ }, "CustomerResponse": { "type": "object", - "required": ["id", "merchant_reference_id", "created_at"], + "required": [ + "id", + "merchant_reference_id", + "created_at" + ], "properties": { "id": { "type": "string", @@ -7356,7 +7845,10 @@ }, "CustomerUpdateRequest": { "type": "object", - "required": ["name", "email"], + "required": [ + "name", + "email" + ], "properties": { "merchant_reference_id": { "type": "string", @@ -7431,16 +7923,26 @@ }, "DecoupledAuthenticationType": { "type": "string", - "enum": ["challenge", "frictionless"] + "enum": [ + "challenge", + "frictionless" + ] }, "DeviceChannel": { "type": "string", "description": "Device Channel indicating whether request is coming from App or Browser", - "enum": ["APP", "BRW"] + "enum": [ + "APP", + "BRW" + ] }, "DisplayAmountOnSdk": { "type": "object", - "required": ["net_amount", "order_tax_amount", "shipping_cost"], + "required": [ + "net_amount", + "order_tax_amount", + "shipping_cost" + ], "properties": { "net_amount": { "type": "string", @@ -7621,7 +8123,11 @@ "DisputeStage": { "type": "string", "description": "Stage of the dispute", - "enum": ["pre_dispute", "dispute", "pre_arbitration"] + "enum": [ + "pre_dispute", + "dispute", + "pre_arbitration" + ] }, "DisputeStatus": { "type": "string", @@ -7638,7 +8144,11 @@ }, "DokuBankTransferInstructions": { "type": "object", - "required": ["expires_at", "reference", "instructions_url"], + "required": [ + "expires_at", + "reference", + "instructions_url" + ], "properties": { "expires_at": { "type": "string", @@ -7694,7 +8204,9 @@ "oneOf": [ { "type": "object", - "required": ["Variants"], + "required": [ + "Variants" + ], "properties": { "Variants": { "$ref": "#/components/schemas/SizeVariants" @@ -7703,7 +8215,9 @@ }, { "type": "object", - "required": ["Percentage"], + "required": [ + "Percentage" + ], "properties": { "Percentage": { "type": "integer", @@ -7714,7 +8228,9 @@ }, { "type": "object", - "required": ["Pixels"], + "required": [ + "Pixels" + ], "properties": { "Pixels": { "type": "integer", @@ -7728,12 +8244,18 @@ "EnablePaymentLinkRequest": { "type": "string", "description": "Whether payment link is requested to be enabled or not for this transaction", - "enum": ["Enable", "Skip"] + "enum": [ + "Enable", + "Skip" + ] }, "EnabledPaymentMethod": { "type": "object", "description": "Object for EnabledPaymentMethod", - "required": ["payment_method", "payment_method_types"], + "required": [ + "payment_method", + "payment_method_types" + ], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -7751,7 +8273,12 @@ "EphemeralKeyCreateResponse": { "type": "object", "description": "ephemeral_key for the customer_id mentioned", - "required": ["customer_id", "created_at", "expires", "secret"], + "required": [ + "customer_id", + "created_at", + "expires", + "secret" + ], "properties": { "customer_id": { "type": "string", @@ -7789,7 +8316,10 @@ "ErrorDetails": { "type": "object", "description": "Error details for the payment", - "required": ["code", "message"], + "required": [ + "code", + "message" + ], "properties": { "code": { "type": "string", @@ -7813,7 +8343,13 @@ }, "EventClass": { "type": "string", - "enum": ["payments", "refunds", "disputes", "mandates", "payouts"] + "enum": [ + "payments", + "refunds", + "disputes", + "mandates", + "payouts" + ] }, "EventListItemResponse": { "type": "object", @@ -7885,7 +8421,10 @@ }, { "type": "object", - "required": ["request", "response"], + "required": [ + "request", + "response" + ], "properties": { "request": { "$ref": "#/components/schemas/OutgoingWebhookRequestContent" @@ -8004,7 +8543,9 @@ }, "ExtendedCardInfoConfig": { "type": "object", - "required": ["public_key"], + "required": [ + "public_key" + ], "properties": { "public_key": { "type": "string", @@ -8022,7 +8563,9 @@ }, "ExtendedCardInfoResponse": { "type": "object", - "required": ["payload"], + "required": [ + "payload" + ], "properties": { "payload": { "type": "string" @@ -8032,12 +8575,17 @@ "External3dsAuthenticationRequest": { "type": "string", "description": "Whether 3ds authentication is requested or not", - "enum": ["Enable", "Skip"] + "enum": [ + "Enable", + "Skip" + ] }, "ExternalAuthenticationDetailsResponse": { "type": "object", "description": "Details of external authentication", - "required": ["status"], + "required": [ + "status" + ], "properties": { "authentication_flow": { "allOf": [ @@ -8079,7 +8627,10 @@ }, "FeatureMatrixListResponse": { "type": "object", - "required": ["connector_count", "connectors"], + "required": [ + "connector_count", + "connectors" + ], "properties": { "connector_count": { "type": "integer", @@ -8139,49 +8690,72 @@ "FeatureStatus": { "type": "string", "description": "The status of the feature", - "enum": ["not_supported", "supported"] + "enum": [ + "not_supported", + "supported" + ] }, "FieldType": { "oneOf": [ { "type": "string", - "enum": ["user_card_number"] + "enum": [ + "user_card_number" + ] }, { "type": "string", - "enum": ["user_card_expiry_month"] + "enum": [ + "user_card_expiry_month" + ] }, { "type": "string", - "enum": ["user_card_expiry_year"] + "enum": [ + "user_card_expiry_year" + ] }, { "type": "string", - "enum": ["user_card_cvc"] + "enum": [ + "user_card_cvc" + ] }, { "type": "string", - "enum": ["user_full_name"] + "enum": [ + "user_full_name" + ] }, { "type": "string", - "enum": ["user_email_address"] + "enum": [ + "user_email_address" + ] }, { "type": "string", - "enum": ["user_phone_number"] + "enum": [ + "user_phone_number" + ] }, { "type": "string", - "enum": ["user_phone_number_country_code"] + "enum": [ + "user_phone_number_country_code" + ] }, { "type": "object", - "required": ["user_country"], + "required": [ + "user_country" + ], "properties": { "user_country": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8195,11 +8769,15 @@ }, { "type": "object", - "required": ["user_currency"], + "required": [ + "user_currency" + ], "properties": { "user_currency": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8213,39 +8791,57 @@ }, { "type": "string", - "enum": ["user_crypto_currency_network"] + "enum": [ + "user_crypto_currency_network" + ] }, { "type": "string", - "enum": ["user_billing_name"] + "enum": [ + "user_billing_name" + ] }, { "type": "string", - "enum": ["user_address_line1"] + "enum": [ + "user_address_line1" + ] }, { "type": "string", - "enum": ["user_address_line2"] + "enum": [ + "user_address_line2" + ] }, { "type": "string", - "enum": ["user_address_city"] + "enum": [ + "user_address_city" + ] }, { "type": "string", - "enum": ["user_address_pincode"] + "enum": [ + "user_address_pincode" + ] }, { "type": "string", - "enum": ["user_address_state"] + "enum": [ + "user_address_state" + ] }, { "type": "object", - "required": ["user_address_country"], + "required": [ + "user_address_country" + ], "properties": { "user_address_country": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8259,35 +8855,51 @@ }, { "type": "string", - "enum": ["user_shipping_name"] + "enum": [ + "user_shipping_name" + ] }, { "type": "string", - "enum": ["user_shipping_address_line1"] + "enum": [ + "user_shipping_address_line1" + ] }, { "type": "string", - "enum": ["user_shipping_address_line2"] + "enum": [ + "user_shipping_address_line2" + ] }, { "type": "string", - "enum": ["user_shipping_address_city"] + "enum": [ + "user_shipping_address_city" + ] }, { "type": "string", - "enum": ["user_shipping_address_pincode"] + "enum": [ + "user_shipping_address_pincode" + ] }, { "type": "string", - "enum": ["user_shipping_address_state"] + "enum": [ + "user_shipping_address_state" + ] }, { "type": "object", - "required": ["user_shipping_address_country"], + "required": [ + "user_shipping_address_country" + ], "properties": { "user_shipping_address_country": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8301,27 +8913,39 @@ }, { "type": "string", - "enum": ["user_blik_code"] + "enum": [ + "user_blik_code" + ] }, { "type": "string", - "enum": ["user_bank"] + "enum": [ + "user_bank" + ] }, { "type": "string", - "enum": ["user_bank_account_number"] + "enum": [ + "user_bank_account_number" + ] }, { "type": "string", - "enum": ["text"] + "enum": [ + "text" + ] }, { "type": "object", - "required": ["drop_down"], + "required": [ + "drop_down" + ], "properties": { "drop_down": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8335,19 +8959,27 @@ }, { "type": "string", - "enum": ["user_date_of_birth"] + "enum": [ + "user_date_of_birth" + ] }, { "type": "string", - "enum": ["user_vpa_id"] + "enum": [ + "user_vpa_id" + ] }, { "type": "object", - "required": ["language_preference"], + "required": [ + "language_preference" + ], "properties": { "language_preference": { "type": "object", - "required": ["options"], + "required": [ + "options" + ], "properties": { "options": { "type": "array", @@ -8361,59 +8993,89 @@ }, { "type": "string", - "enum": ["user_pix_key"] + "enum": [ + "user_pix_key" + ] }, { "type": "string", - "enum": ["user_cpf"] + "enum": [ + "user_cpf" + ] }, { "type": "string", - "enum": ["user_cnpj"] + "enum": [ + "user_cnpj" + ] }, { "type": "string", - "enum": ["user_iban"] + "enum": [ + "user_iban" + ] }, { "type": "string", - "enum": ["user_bsb_number"] + "enum": [ + "user_bsb_number" + ] }, { "type": "string", - "enum": ["user_bank_sort_code"] + "enum": [ + "user_bank_sort_code" + ] }, { "type": "string", - "enum": ["user_bank_routing_number"] + "enum": [ + "user_bank_routing_number" + ] }, { "type": "string", - "enum": ["user_msisdn"] + "enum": [ + "user_msisdn" + ] }, { "type": "string", - "enum": ["user_client_identifier"] + "enum": [ + "user_client_identifier" + ] }, { "type": "string", - "enum": ["order_details_product_name"] + "enum": [ + "order_details_product_name" + ] } ], "description": "Possible field type of required fields in payment_method_data" }, "ForceSync": { "type": "string", - "enum": ["true", "false"] + "enum": [ + "true", + "false" + ] }, "FrmAction": { "type": "string", - "enum": ["cancel_txn", "auto_refund", "manual_review"] + "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": ["gateway", "payment_methods"], + "required": [ + "gateway", + "payment_methods" + ], "properties": { "gateway": { "$ref": "#/components/schemas/ConnectorType" @@ -8431,7 +9093,9 @@ "FrmMessage": { "type": "object", "description": "frm message is an object sent inside the payments response...when frm is invoked, its value is Some(...), else its None", - "required": ["frm_name"], + "required": [ + "frm_name" + ], "properties": { "frm_name": { "type": "string" @@ -8465,7 +9129,9 @@ "FrmPaymentMethod": { "type": "object", "description": "Details of FrmPaymentMethod are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table", - "required": ["payment_method"], + "required": [ + "payment_method" + ], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -8492,7 +9158,12 @@ "FrmPaymentMethodType": { "type": "object", "description": "Details of FrmPaymentMethodType are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table", - "required": ["payment_method_type", "card_networks", "flow", "action"], + "required": [ + "payment_method_type", + "card_networks", + "flow", + "action" + ], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethodType" @@ -8511,12 +9182,18 @@ }, "FrmPreferredFlowTypes": { "type": "string", - "enum": ["pre", "post"] + "enum": [ + "pre", + "post" + ] }, "FutureUsage": { "type": "string", "description": "Indicates that you intend to make future payments with the payment methods used for this Payment. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.\n- On_session - Payment method saved only at hyperswitch when consent is provided by the user. CVV will asked during the returning user payment\n- Off_session - Payment method saved at both hyperswitch and Processor when consent is provided by the user. No input is required during the returning user payment.", - "enum": ["off_session", "on_session"] + "enum": [ + "off_session", + "on_session" + ] }, "GcashRedirection": { "type": "object" @@ -8552,7 +9229,9 @@ "oneOf": [ { "type": "object", - "required": ["givex"], + "required": [ + "givex" + ], "properties": { "givex": { "$ref": "#/components/schemas/GivexGiftCardAdditionalData" @@ -8561,7 +9240,9 @@ }, { "type": "object", - "required": ["pay_safe_card"], + "required": [ + "pay_safe_card" + ], "properties": { "pay_safe_card": { "type": "object" @@ -8574,7 +9255,9 @@ "oneOf": [ { "type": "object", - "required": ["givex"], + "required": [ + "givex" + ], "properties": { "givex": { "$ref": "#/components/schemas/GiftCardDetails" @@ -8583,7 +9266,9 @@ }, { "type": "object", - "required": ["pay_safe_card"], + "required": [ + "pay_safe_card" + ], "properties": { "pay_safe_card": { "type": "object" @@ -8594,7 +9279,10 @@ }, "GiftCardDetails": { "type": "object", - "required": ["number", "cvc"], + "required": [ + "number", + "cvc" + ], "properties": { "number": { "type": "string", @@ -8646,7 +9334,9 @@ }, "GivexGiftCardAdditionalData": { "type": "object", - "required": ["last4"], + "required": [ + "last4" + ], "properties": { "last4": { "type": "string", @@ -8660,7 +9350,10 @@ }, "GooglePayAssuranceDetails": { "type": "object", - "required": ["card_holder_authenticated", "account_verified"], + "required": [ + "card_holder_authenticated", + "account_verified" + ], "properties": { "card_holder_authenticated": { "type": "boolean", @@ -8674,7 +9367,10 @@ }, "GooglePayPaymentMethodInfo": { "type": "object", - "required": ["card_network", "card_details"], + "required": [ + "card_network", + "card_details" + ], "properties": { "card_network": { "type": "string", @@ -8758,7 +9454,11 @@ }, "GooglePayThirdPartySdk": { "type": "object", - "required": ["delayed_session_token", "connector", "sdk_next_action"], + "required": [ + "delayed_session_token", + "connector", + "sdk_next_action" + ], "properties": { "delayed_session_token": { "type": "boolean", @@ -8778,7 +9478,12 @@ }, "GooglePayWalletData": { "type": "object", - "required": ["type", "description", "info", "tokenization_data"], + "required": [ + "type", + "description", + "info", + "tokenization_data" + ], "properties": { "type": { "type": "string", @@ -8798,7 +9503,10 @@ }, "GpayAllowedMethodsParameters": { "type": "object", - "required": ["allowed_auth_methods", "allowed_card_networks"], + "required": [ + "allowed_auth_methods", + "allowed_card_networks" + ], "properties": { "allowed_auth_methods": { "type": "array", @@ -8836,7 +9544,11 @@ }, "GpayAllowedPaymentMethods": { "type": "object", - "required": ["type", "parameters", "tokenization_specification"], + "required": [ + "type", + "parameters", + "tokenization_specification" + ], "properties": { "type": { "type": "string", @@ -8852,11 +9564,17 @@ }, "GpayBillingAddressFormat": { "type": "string", - "enum": ["FULL", "MIN"] + "enum": [ + "FULL", + "MIN" + ] }, "GpayBillingAddressParameters": { "type": "object", - "required": ["phone_number_required", "format"], + "required": [ + "phone_number_required", + "format" + ], "properties": { "phone_number_required": { "type": "boolean", @@ -8869,7 +9587,9 @@ }, "GpayMerchantInfo": { "type": "object", - "required": ["merchant_name"], + "required": [ + "merchant_name" + ], "properties": { "merchant_id": { "type": "string", @@ -8894,7 +9614,9 @@ }, "GpayShippingAddressParameters": { "type": "object", - "required": ["phone_number_required"], + "required": [ + "phone_number_required" + ], "properties": { "phone_number_required": { "type": "boolean", @@ -8904,7 +9626,9 @@ }, "GpayTokenParameters": { "type": "object", - "required": ["gateway"], + "required": [ + "gateway" + ], "properties": { "gateway": { "type": "string", @@ -8927,7 +9651,10 @@ }, "GpayTokenizationData": { "type": "object", - "required": ["type", "token"], + "required": [ + "type", + "token" + ], "properties": { "type": { "type": "string", @@ -8941,7 +9668,10 @@ }, "GpayTokenizationSpecification": { "type": "object", - "required": ["type", "parameters"], + "required": [ + "type", + "parameters" + ], "properties": { "type": { "type": "string", @@ -9048,11 +9778,21 @@ }, "GsmDecision": { "type": "string", - "enum": ["retry", "requeue", "do_default"] + "enum": [ + "retry", + "requeue", + "do_default" + ] }, "GsmDeleteRequest": { "type": "object", - "required": ["connector", "flow", "sub_flow", "code", "message"], + "required": [ + "connector", + "flow", + "sub_flow", + "code", + "message" + ], "properties": { "connector": { "type": "string", @@ -9179,7 +9919,13 @@ }, "GsmRetrieveRequest": { "type": "object", - "required": ["connector", "flow", "sub_flow", "code", "message"], + "required": [ + "connector", + "flow", + "sub_flow", + "code", + "message" + ], "properties": { "connector": { "$ref": "#/components/schemas/Connector" @@ -9204,7 +9950,13 @@ }, "GsmUpdateRequest": { "type": "object", - "required": ["connector", "flow", "sub_flow", "code", "message"], + "required": [ + "connector", + "flow", + "sub_flow", + "code", + "message" + ], "properties": { "connector": { "type": "string", @@ -9272,7 +10024,9 @@ "IfStatement": { "type": "object", "description": "Represents an IF statement with conditions and optional nested IF statements\n\n```text\npayment.method = card {\npayment.method.cardtype = (credit, debit) {\npayment.method.network = (amex, rupay, diners)\n}\n}\n```", - "required": ["condition"], + "required": [ + "condition" + ], "properties": { "condition": { "type": "array", @@ -9409,7 +10163,10 @@ }, "KlarnaSessionTokenResponse": { "type": "object", - "required": ["session_token", "session_id"], + "required": [ + "session_token", + "session_id" + ], "properties": { "session_token": { "type": "string", @@ -9436,7 +10193,9 @@ }, "ListBlocklistQuery": { "type": "object", - "required": ["data_kind"], + "required": [ + "data_kind" + ], "properties": { "data_kind": { "$ref": "#/components/schemas/BlocklistDataKind" @@ -9466,7 +10225,10 @@ }, "MandateAmountData": { "type": "object", - "required": ["amount", "currency"], + "required": [ + "amount", + "currency" + ], "properties": { "amount": { "type": "integer", @@ -9648,7 +10410,10 @@ }, "MandateRevokedResponse": { "type": "object", - "required": ["mandate_id", "status"], + "required": [ + "mandate_id", + "status" + ], "properties": { "mandate_id": { "type": "string", @@ -9674,13 +10439,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" @@ -9689,7 +10461,9 @@ }, { "type": "object", - "required": ["multi_use"], + "required": [ + "multi_use" + ], "properties": { "multi_use": { "allOf": [ @@ -9705,7 +10479,9 @@ }, "MaskedBankDetails": { "type": "object", - "required": ["mask"], + "required": [ + "mask" + ], "properties": { "mask": { "type": "string" @@ -9714,7 +10490,9 @@ }, "MbWayRedirection": { "type": "object", - "required": ["telephone_number"], + "required": [ + "telephone_number" + ], "properties": { "telephone_number": { "type": "string", @@ -9724,7 +10502,9 @@ }, "MerchantAccountCreate": { "type": "object", - "required": ["merchant_name"], + "required": [ + "merchant_name" + ], "properties": { "merchant_name": { "type": "string", @@ -9752,11 +10532,16 @@ "oneOf": [ { "type": "object", - "required": ["iban"], + "required": [ + "iban" + ], "properties": { "iban": { "type": "object", - "required": ["iban", "name"], + "required": [ + "iban", + "name" + ], "properties": { "iban": { "type": "string" @@ -9774,11 +10559,17 @@ }, { "type": "object", - "required": ["bacs"], + "required": [ + "bacs" + ], "properties": { "bacs": { "type": "object", - "required": ["account_number", "sort_code", "name"], + "required": [ + "account_number", + "sort_code", + "name" + ], "properties": { "account_number": { "type": "string" @@ -9801,7 +10592,10 @@ }, "MerchantAccountDeleteResponse": { "type": "object", - "required": ["merchant_id", "deleted"], + "required": [ + "merchant_id", + "deleted" + ], "properties": { "merchant_id": { "type": "string", @@ -9993,7 +10787,11 @@ }, "MerchantConnectorDeleteResponse": { "type": "object", - "required": ["merchant_id", "id", "deleted"], + "required": [ + "merchant_id", + "id", + "deleted" + ], "properties": { "merchant_id": { "type": "string", @@ -10031,7 +10829,9 @@ "MerchantConnectorDetailsWrap": { "type": "object", "description": "Merchant connector details used to make payments.", - "required": ["creds_identifier"], + "required": [ + "creds_identifier" + ], "properties": { "creds_identifier": { "type": "string", @@ -10049,7 +10849,9 @@ }, "MerchantConnectorId": { "type": "object", - "required": ["id"], + "required": [ + "id" + ], "properties": { "id": { "type": "string" @@ -10246,7 +11048,11 @@ "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", "status", "merchant_id"], + "required": [ + "connector_type", + "status", + "merchant_id" + ], "properties": { "connector_type": { "$ref": "#/components/schemas/ConnectorType" @@ -10338,7 +11144,10 @@ }, "MerchantConnectorWebhookDetails": { "type": "object", - "required": ["merchant_secret", "additional_secret"], + "required": [ + "merchant_secret", + "additional_secret" + ], "properties": { "merchant_secret": { "type": "string", @@ -10425,7 +11234,9 @@ "oneOf": [ { "type": "object", - "required": ["connector_recipient_id"], + "required": [ + "connector_recipient_id" + ], "properties": { "connector_recipient_id": { "type": "string", @@ -10435,7 +11246,9 @@ }, { "type": "object", - "required": ["wallet_id"], + "required": [ + "wallet_id" + ], "properties": { "wallet_id": { "type": "string", @@ -10445,7 +11258,9 @@ }, { "type": "object", - "required": ["account_data"], + "required": [ + "account_data" + ], "properties": { "account_data": { "$ref": "#/components/schemas/MerchantAccountData" @@ -10498,7 +11313,10 @@ }, "MetadataValue": { "type": "object", - "required": ["key", "value"], + "required": [ + "key", + "value" + ], "properties": { "key": { "type": "string" @@ -10510,7 +11328,9 @@ }, "MifinityData": { "type": "object", - "required": ["date_of_birth"], + "required": [ + "date_of_birth" + ], "properties": { "date_of_birth": { "type": "string", @@ -10529,24 +11349,35 @@ }, "MitExemptionRequest": { "type": "string", - "enum": ["Apply", "Skip"] + "enum": [ + "Apply", + "Skip" + ] }, "MobilePayRedirection": { "type": "object" }, "MobilePaymentConsent": { "type": "string", - "enum": ["consent_required", "consent_not_required", "consent_optional"] + "enum": [ + "consent_required", + "consent_not_required", + "consent_optional" + ] }, "MobilePaymentData": { "oneOf": [ { "type": "object", - "required": ["direct_carrier_billing"], + "required": [ + "direct_carrier_billing" + ], "properties": { "direct_carrier_billing": { "type": "object", - "required": ["msisdn"], + "required": [ + "msisdn" + ], "properties": { "msisdn": { "type": "string", @@ -10567,7 +11398,9 @@ }, "MobilePaymentNextStepData": { "type": "object", - "required": ["consent_data_required"], + "required": [ + "consent_data_required" + ], "properties": { "consent_data_required": { "$ref": "#/components/schemas/MobilePaymentConsent" @@ -10604,7 +11437,10 @@ }, "MultibancoTransferInstructions": { "type": "object", - "required": ["reference", "entity"], + "required": [ + "reference", + "entity" + ], "properties": { "reference": { "type": "string", @@ -10689,42 +11525,59 @@ }, "NextActionCall": { "type": "string", - "enum": ["post_session_tokens", "confirm", "sync", "complete_authorize"] + "enum": [ + "post_session_tokens", + "confirm", + "sync", + "complete_authorize" + ] }, "NextActionData": { "oneOf": [ { "type": "object", "description": "Contains the url for redirection flow", - "required": ["redirect_to_url", "type"], + "required": [ + "redirect_to_url", + "type" + ], "properties": { "redirect_to_url": { "type": "string" }, "type": { "type": "string", - "enum": ["redirect_to_url"] + "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"], + "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"] + "enum": [ + "display_bank_transfer_information" + ] } } }, { "type": "object", "description": "Contains third party sdk session token response", - "required": ["type"], + "required": [ + "type" + ], "properties": { "session_token": { "allOf": [ @@ -10736,14 +11589,20 @@ }, "type": { "type": "string", - "enum": ["third_party_sdk_session_token"] + "enum": [ + "third_party_sdk_session_token" + ] } } }, { "type": "object", "description": "Contains url for Qr code image, this qr code has to be shown in sdk", - "required": ["image_data_url", "qr_code_url", "type"], + "required": [ + "image_data_url", + "qr_code_url", + "type" + ], "properties": { "image_data_url": { "type": "string", @@ -10760,42 +11619,57 @@ }, "type": { "type": "string", - "enum": ["qr_code_information"] + "enum": [ + "qr_code_information" + ] } } }, { "type": "object", "description": "Contains url to fetch Qr code data", - "required": ["qr_code_fetch_url", "type"], + "required": [ + "qr_code_fetch_url", + "type" + ], "properties": { "qr_code_fetch_url": { "type": "string" }, "type": { "type": "string", - "enum": ["fetch_qr_code_information"] + "enum": [ + "fetch_qr_code_information" + ] } } }, { "type": "object", "description": "Contains the download url and the reference number for transaction", - "required": ["voucher_details", "type"], + "required": [ + "voucher_details", + "type" + ], "properties": { "voucher_details": { "type": "string" }, "type": { "type": "string", - "enum": ["display_voucher_information"] + "enum": [ + "display_voucher_information" + ] } } }, { "type": "object", "description": "Contains duration for displaying a wait screen, wait screen with timer is displayed by sdk", - "required": ["display_from_timestamp", "type"], + "required": [ + "display_from_timestamp", + "type" + ], "properties": { "display_from_timestamp": { "type": "integer" @@ -10806,48 +11680,65 @@ }, "type": { "type": "string", - "enum": ["wait_screen_information"] + "enum": [ + "wait_screen_information" + ] } } }, { "type": "object", "description": "Contains the information regarding three_ds_method_data submission, three_ds authentication, and authorization flows", - "required": ["three_ds_data", "type"], + "required": [ + "three_ds_data", + "type" + ], "properties": { "three_ds_data": { "$ref": "#/components/schemas/ThreeDsData" }, "type": { "type": "string", - "enum": ["three_ds_invoke"] + "enum": [ + "three_ds_invoke" + ] } } }, { "type": "object", - "required": ["next_action_data", "type"], + "required": [ + "next_action_data", + "type" + ], "properties": { "next_action_data": { "$ref": "#/components/schemas/SdkNextActionData" }, "type": { "type": "string", - "enum": ["invoke_sdk_client"] + "enum": [ + "invoke_sdk_client" + ] } } }, { "type": "object", "description": "Contains consent to collect otp for mobile payment", - "required": ["consent_data_required", "type"], + "required": [ + "consent_data_required", + "type" + ], "properties": { "consent_data_required": { "$ref": "#/components/schemas/MobilePaymentConsent" }, "type": { "type": "string", - "enum": ["collect_otp"] + "enum": [ + "collect_otp" + ] } } } @@ -10949,7 +11840,10 @@ "NumberComparison": { "type": "object", "description": "Represents a number comparison for \"NumberComparisonArrayValue\"", - "required": ["comparisonType", "number"], + "required": [ + "comparisonType", + "number" + ], "properties": { "comparisonType": { "$ref": "#/components/schemas/ComparisonType" @@ -10961,7 +11855,10 @@ }, "OnlineMandate": { "type": "object", - "required": ["ip_address", "user_agent"], + "required": [ + "ip_address", + "user_agent" + ], "properties": { "ip_address": { "type": "string", @@ -10979,7 +11876,9 @@ "oneOf": [ { "type": "object", - "required": ["open_banking_pis"], + "required": [ + "open_banking_pis" + ], "properties": { "open_banking_pis": { "type": "object" @@ -11005,7 +11904,9 @@ }, "OpenBankingSessionToken": { "type": "object", - "required": ["open_banking_session_token"], + "required": [ + "open_banking_session_token" + ], "properties": { "open_banking_session_token": { "type": "string", @@ -11015,7 +11916,11 @@ }, "OrderDetailsWithAmount": { "type": "object", - "required": ["product_name", "quantity", "amount"], + "required": [ + "product_name", + "quantity", + "amount" + ], "properties": { "product_name": { "type": "string", @@ -11093,11 +11998,16 @@ }, "OrderFulfillmentTimeOrigin": { "type": "string", - "enum": ["create", "confirm"] + "enum": [ + "create", + "confirm" + ] }, "OrganizationCreateRequest": { "type": "object", - "required": ["organization_name"], + "required": [ + "organization_name" + ], "properties": { "organization_name": { "type": "string", @@ -11118,7 +12028,11 @@ }, "OrganizationResponse": { "type": "object", - "required": ["id", "modified_at", "created_at"], + "required": [ + "id", + "modified_at", + "created_at" + ], "properties": { "id": { "type": "string", @@ -11175,7 +12089,12 @@ }, "OutgoingWebhook": { "type": "object", - "required": ["merchant_id", "event_id", "event_type", "content"], + "required": [ + "merchant_id", + "event_id", + "event_type", + "content" + ], "properties": { "merchant_id": { "type": "string", @@ -11203,11 +12122,16 @@ { "type": "object", "title": "PaymentsResponse", - "required": ["type", "object"], + "required": [ + "type", + "object" + ], "properties": { "type": { "type": "string", - "enum": ["payment_details"] + "enum": [ + "payment_details" + ] }, "object": { "$ref": "#/components/schemas/PaymentsResponse" @@ -11217,11 +12141,16 @@ { "type": "object", "title": "RefundResponse", - "required": ["type", "object"], + "required": [ + "type", + "object" + ], "properties": { "type": { "type": "string", - "enum": ["refund_details"] + "enum": [ + "refund_details" + ] }, "object": { "$ref": "#/components/schemas/RefundResponse" @@ -11231,11 +12160,16 @@ { "type": "object", "title": "DisputeResponse", - "required": ["type", "object"], + "required": [ + "type", + "object" + ], "properties": { "type": { "type": "string", - "enum": ["dispute_details"] + "enum": [ + "dispute_details" + ] }, "object": { "$ref": "#/components/schemas/DisputeResponse" @@ -11245,11 +12179,16 @@ { "type": "object", "title": "MandateResponse", - "required": ["type", "object"], + "required": [ + "type", + "object" + ], "properties": { "type": { "type": "string", - "enum": ["mandate_details"] + "enum": [ + "mandate_details" + ] }, "object": { "$ref": "#/components/schemas/MandateResponse" @@ -11259,11 +12198,16 @@ { "type": "object", "title": "PayoutCreateResponse", - "required": ["type", "object"], + "required": [ + "type", + "object" + ], "properties": { "type": { "type": "string", - "enum": ["payout_details"] + "enum": [ + "payout_details" + ] }, "object": { "$ref": "#/components/schemas/PayoutCreateResponse" @@ -11278,7 +12222,10 @@ "OutgoingWebhookRequestContent": { "type": "object", "description": "The request information (headers and body) sent in the webhook.", - "required": ["body", "headers"], + "required": [ + "body", + "headers" + ], "properties": { "body": { "type": "string", @@ -11301,8 +12248,14 @@ }, "description": "The request headers sent in the webhook.", "example": [ - ["content-type", "application/json"], - ["content-length", "1024"] + [ + "content-type", + "application/json" + ], + [ + "content-length", + "1024" + ] ] } } @@ -11333,8 +12286,14 @@ }, "description": "The response headers received for the webhook sent.", "example": [ - ["content-type", "application/json"], - ["content-length", "1024"] + [ + "content-type", + "application/json" + ], + [ + "content-length", + "1024" + ] ], "nullable": true }, @@ -11358,7 +12317,9 @@ "oneOf": [ { "type": "object", - "required": ["klarna_redirect"], + "required": [ + "klarna_redirect" + ], "properties": { "klarna_redirect": { "type": "object", @@ -11383,12 +12344,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", @@ -11400,7 +12365,9 @@ }, { "type": "object", - "required": ["klarna_checkout"], + "required": [ + "klarna_checkout" + ], "properties": { "klarna_checkout": { "type": "object" @@ -11409,7 +12376,9 @@ }, { "type": "object", - "required": ["affirm_redirect"], + "required": [ + "affirm_redirect" + ], "properties": { "affirm_redirect": { "type": "object", @@ -11419,7 +12388,9 @@ }, { "type": "object", - "required": ["afterpay_clearpay_redirect"], + "required": [ + "afterpay_clearpay_redirect" + ], "properties": { "afterpay_clearpay_redirect": { "type": "object", @@ -11441,7 +12412,9 @@ }, { "type": "object", - "required": ["pay_bright_redirect"], + "required": [ + "pay_bright_redirect" + ], "properties": { "pay_bright_redirect": { "type": "object", @@ -11451,7 +12424,9 @@ }, { "type": "object", - "required": ["walley_redirect"], + "required": [ + "walley_redirect" + ], "properties": { "walley_redirect": { "type": "object", @@ -11461,7 +12436,9 @@ }, { "type": "object", - "required": ["alma_redirect"], + "required": [ + "alma_redirect" + ], "properties": { "alma_redirect": { "type": "object", @@ -11471,7 +12448,9 @@ }, { "type": "object", - "required": ["atome_redirect"], + "required": [ + "atome_redirect" + ], "properties": { "atome_redirect": { "type": "object" @@ -11482,7 +12461,9 @@ }, "PayPalWalletData": { "type": "object", - "required": ["token"], + "required": [ + "token" + ], "properties": { "token": { "type": "string", @@ -11747,8 +12728,10 @@ "oneOf": [ { "type": "object", - "required": ["Stripe"], - "properties": { + "required": [ + "Stripe" + ], + "properties": { "Stripe": { "$ref": "#/components/schemas/StripeChargeType" } @@ -11797,7 +12780,9 @@ }, "PaymentExperienceTypes": { "type": "object", - "required": ["eligible_connectors"], + "required": [ + "eligible_connectors" + ], "properties": { "payment_experience_type": { "allOf": [ @@ -11813,13 +12798,18 @@ "type": "string" }, "description": "The list of eligible connectors for a given payment experience", - "example": ["stripe", "adyen"] + "example": [ + "stripe", + "adyen" + ] } } }, "PaymentLinkBackgroundImageConfig": { "type": "object", - "required": ["url"], + "required": [ + "url" + ], "properties": { "url": { "type": "string", @@ -12026,11 +13016,17 @@ }, "PaymentLinkDetailsLayout": { "type": "string", - "enum": ["layout1", "layout2"] + "enum": [ + "layout1", + "layout2" + ] }, "PaymentLinkInitiateRequest": { "type": "object", - "required": ["merchant_id", "payment_id"], + "required": [ + "merchant_id", + "payment_id" + ], "properties": { "merchant_id": { "type": "string" @@ -12042,7 +13038,10 @@ }, "PaymentLinkResponse": { "type": "object", - "required": ["link", "payment_link_id"], + "required": [ + "link", + "payment_link_id" + ], "properties": { "link": { "type": "string", @@ -12062,11 +13061,17 @@ "PaymentLinkStatus": { "type": "string", "description": "Status Of the Payment Link", - "enum": ["active", "expired"] + "enum": [ + "active", + "expired" + ] }, "PaymentLinkTransactionDetails": { "type": "object", - "required": ["key", "value"], + "required": [ + "key", + "value" + ], "properties": { "key": { "type": "string", @@ -12161,7 +13166,10 @@ }, "PaymentListResponse": { "type": "object", - "required": ["size", "data"], + "required": [ + "size", + "data" + ], "properties": { "size": { "type": "integer", @@ -12209,7 +13217,9 @@ }, { "type": "object", - "required": ["customer_id"], + "required": [ + "customer_id" + ], "properties": { "pm_collect_link_id": { "type": "string", @@ -12256,7 +13266,12 @@ }, { "type": "object", - "required": ["pm_collect_link_id", "customer_id", "expiry", "link"], + "required": [ + "pm_collect_link_id", + "customer_id", + "expiry", + "link" + ], "properties": { "pm_collect_link_id": { "type": "string", @@ -12343,7 +13358,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardDetail" @@ -12357,7 +13374,9 @@ { "type": "object", "title": "Card", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/Card" @@ -12367,7 +13386,9 @@ { "type": "object", "title": "CardRedirect", - "required": ["card_redirect"], + "required": [ + "card_redirect" + ], "properties": { "card_redirect": { "$ref": "#/components/schemas/CardRedirectData" @@ -12377,7 +13398,9 @@ { "type": "object", "title": "Wallet", - "required": ["wallet"], + "required": [ + "wallet" + ], "properties": { "wallet": { "$ref": "#/components/schemas/WalletData" @@ -12387,7 +13410,9 @@ { "type": "object", "title": "PayLater", - "required": ["pay_later"], + "required": [ + "pay_later" + ], "properties": { "pay_later": { "$ref": "#/components/schemas/PayLaterData" @@ -12397,7 +13422,9 @@ { "type": "object", "title": "BankRedirect", - "required": ["bank_redirect"], + "required": [ + "bank_redirect" + ], "properties": { "bank_redirect": { "$ref": "#/components/schemas/BankRedirectData" @@ -12407,7 +13434,9 @@ { "type": "object", "title": "BankDebit", - "required": ["bank_debit"], + "required": [ + "bank_debit" + ], "properties": { "bank_debit": { "$ref": "#/components/schemas/BankDebitData" @@ -12417,7 +13446,9 @@ { "type": "object", "title": "BankTransfer", - "required": ["bank_transfer"], + "required": [ + "bank_transfer" + ], "properties": { "bank_transfer": { "$ref": "#/components/schemas/BankTransferData" @@ -12427,7 +13458,9 @@ { "type": "object", "title": "RealTimePayment", - "required": ["real_time_payment"], + "required": [ + "real_time_payment" + ], "properties": { "real_time_payment": { "$ref": "#/components/schemas/RealTimePaymentData" @@ -12437,7 +13470,9 @@ { "type": "object", "title": "Crypto", - "required": ["crypto"], + "required": [ + "crypto" + ], "properties": { "crypto": { "$ref": "#/components/schemas/CryptoData" @@ -12447,17 +13482,23 @@ { "type": "string", "title": "MandatePayment", - "enum": ["mandate_payment"] + "enum": [ + "mandate_payment" + ] }, { "type": "string", "title": "Reward", - "enum": ["reward"] + "enum": [ + "reward" + ] }, { "type": "object", "title": "Upi", - "required": ["upi"], + "required": [ + "upi" + ], "properties": { "upi": { "$ref": "#/components/schemas/UpiData" @@ -12467,7 +13508,9 @@ { "type": "object", "title": "Voucher", - "required": ["voucher"], + "required": [ + "voucher" + ], "properties": { "voucher": { "$ref": "#/components/schemas/VoucherData" @@ -12477,7 +13520,9 @@ { "type": "object", "title": "GiftCard", - "required": ["gift_card"], + "required": [ + "gift_card" + ], "properties": { "gift_card": { "$ref": "#/components/schemas/GiftCardData" @@ -12487,7 +13532,9 @@ { "type": "object", "title": "CardToken", - "required": ["card_token"], + "required": [ + "card_token" + ], "properties": { "card_token": { "$ref": "#/components/schemas/CardToken" @@ -12497,7 +13544,9 @@ { "type": "object", "title": "OpenBanking", - "required": ["open_banking"], + "required": [ + "open_banking" + ], "properties": { "open_banking": { "$ref": "#/components/schemas/OpenBankingData" @@ -12507,7 +13556,9 @@ { "type": "object", "title": "MobilePayment", - "required": ["mobile_payment"], + "required": [ + "mobile_payment" + ], "properties": { "mobile_payment": { "$ref": "#/components/schemas/MobilePaymentData" @@ -12546,7 +13597,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardResponse" @@ -12555,7 +13608,9 @@ }, { "type": "object", - "required": ["bank_transfer"], + "required": [ + "bank_transfer" + ], "properties": { "bank_transfer": { "$ref": "#/components/schemas/BankTransferResponse" @@ -12564,7 +13619,9 @@ }, { "type": "object", - "required": ["wallet"], + "required": [ + "wallet" + ], "properties": { "wallet": { "$ref": "#/components/schemas/WalletResponse" @@ -12573,7 +13630,9 @@ }, { "type": "object", - "required": ["pay_later"], + "required": [ + "pay_later" + ], "properties": { "pay_later": { "$ref": "#/components/schemas/PaylaterResponse" @@ -12582,7 +13641,9 @@ }, { "type": "object", - "required": ["bank_redirect"], + "required": [ + "bank_redirect" + ], "properties": { "bank_redirect": { "$ref": "#/components/schemas/BankRedirectResponse" @@ -12591,7 +13652,9 @@ }, { "type": "object", - "required": ["crypto"], + "required": [ + "crypto" + ], "properties": { "crypto": { "$ref": "#/components/schemas/CryptoResponse" @@ -12600,7 +13663,9 @@ }, { "type": "object", - "required": ["bank_debit"], + "required": [ + "bank_debit" + ], "properties": { "bank_debit": { "$ref": "#/components/schemas/BankDebitResponse" @@ -12609,7 +13674,9 @@ }, { "type": "object", - "required": ["mandate_payment"], + "required": [ + "mandate_payment" + ], "properties": { "mandate_payment": { "type": "object" @@ -12618,7 +13685,9 @@ }, { "type": "object", - "required": ["reward"], + "required": [ + "reward" + ], "properties": { "reward": { "type": "object" @@ -12627,7 +13696,9 @@ }, { "type": "object", - "required": ["real_time_payment"], + "required": [ + "real_time_payment" + ], "properties": { "real_time_payment": { "$ref": "#/components/schemas/RealTimePaymentDataResponse" @@ -12636,7 +13707,9 @@ }, { "type": "object", - "required": ["upi"], + "required": [ + "upi" + ], "properties": { "upi": { "$ref": "#/components/schemas/UpiResponse" @@ -12645,7 +13718,9 @@ }, { "type": "object", - "required": ["voucher"], + "required": [ + "voucher" + ], "properties": { "voucher": { "$ref": "#/components/schemas/VoucherResponse" @@ -12654,7 +13729,9 @@ }, { "type": "object", - "required": ["gift_card"], + "required": [ + "gift_card" + ], "properties": { "gift_card": { "$ref": "#/components/schemas/GiftCardResponse" @@ -12663,7 +13740,9 @@ }, { "type": "object", - "required": ["card_redirect"], + "required": [ + "card_redirect" + ], "properties": { "card_redirect": { "$ref": "#/components/schemas/CardRedirectResponse" @@ -12672,7 +13751,9 @@ }, { "type": "object", - "required": ["card_token"], + "required": [ + "card_token" + ], "properties": { "card_token": { "$ref": "#/components/schemas/CardTokenResponse" @@ -12681,7 +13762,9 @@ }, { "type": "object", - "required": ["open_banking"], + "required": [ + "open_banking" + ], "properties": { "open_banking": { "$ref": "#/components/schemas/OpenBankingResponse" @@ -12690,7 +13773,9 @@ }, { "type": "object", - "required": ["mobile_payment"], + "required": [ + "mobile_payment" + ], "properties": { "mobile_payment": { "$ref": "#/components/schemas/MobilePaymentResponse" @@ -12726,7 +13811,9 @@ }, "PaymentMethodDeleteResponse": { "type": "object", - "required": ["id"], + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -12765,7 +13852,9 @@ }, "PaymentMethodIntentCreate": { "type": "object", - "required": ["customer_id"], + "required": [ + "customer_id" + ], "properties": { "metadata": { "type": "object", @@ -12809,7 +13898,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardDetailFromLocker" @@ -12818,7 +13909,9 @@ }, { "type": "object", - "required": ["bank"], + "required": [ + "bank" + ], "properties": { "bank": { "$ref": "#/components/schemas/Bank" @@ -12844,7 +13937,11 @@ "$ref": "#/components/schemas/CountryAlpha2" }, "description": "The two-letter ISO currency code", - "example": ["US", "UK", "IN"], + "example": [ + "US", + "UK", + "IN" + ], "nullable": true }, "amount": { @@ -12861,7 +13958,10 @@ "$ref": "#/components/schemas/Currency" }, "description": "The three-letter ISO currency code", - "example": ["USD", "EUR"], + "example": [ + "USD", + "EUR" + ], "nullable": true }, "recurring_enabled": { @@ -12876,7 +13976,10 @@ "$ref": "#/components/schemas/CardNetwork" }, "description": "Indicates whether the payment method is eligible for card netwotks", - "example": ["visa", "mastercard"], + "example": [ + "visa", + "mastercard" + ], "nullable": true }, "limit": { @@ -12891,7 +13994,9 @@ }, "PaymentMethodListResponse": { "type": "object", - "required": ["payment_methods_enabled"], + "required": [ + "payment_methods_enabled" + ], "properties": { "payment_methods_enabled": { "type": "array", @@ -12904,7 +14009,9 @@ }, "PaymentMethodListResponseForPayments": { "type": "object", - "required": ["payment_methods_enabled"], + "required": [ + "payment_methods_enabled" + ], "properties": { "payment_methods_enabled": { "type": "array", @@ -12998,7 +14105,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardDetailFromLocker" @@ -13010,14 +14119,21 @@ "PaymentMethodStatus": { "type": "string", "description": "Payment Method Status", - "enum": ["active", "inactive", "processing", "awaiting_data"] + "enum": [ + "active", + "inactive", + "processing", + "awaiting_data" + ] }, "PaymentMethodSubtypeSpecificData": { "oneOf": [ { "type": "object", "title": "card", - "required": ["card_networks"], + "required": [ + "card_networks" + ], "properties": { "card_networks": { "type": "array", @@ -13030,7 +14146,9 @@ { "type": "object", "title": "bank", - "required": ["bank_names"], + "required": [ + "bank_names" + ], "properties": { "bank_names": { "type": "array", @@ -13145,7 +14263,9 @@ }, "PaymentMethodUpdate": { "type": "object", - "required": ["payment_method_data"], + "required": [ + "payment_method_data" + ], "properties": { "payment_method_data": { "$ref": "#/components/schemas/PaymentMethodUpdateData" @@ -13157,7 +14277,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardDetailUpdate" @@ -13169,7 +14291,9 @@ "PaymentMethodsEnabled": { "type": "object", "description": "Details of all the payment methods enabled for the connector for the given merchant account", - "required": ["payment_method_type"], + "required": [ + "payment_method_type" + ], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" @@ -13209,11 +14333,15 @@ }, { "type": "object", - "required": ["payment_processing_details_at"], + "required": [ + "payment_processing_details_at" + ], "properties": { "payment_processing_details_at": { "type": "string", - "enum": ["Hyperswitch"] + "enum": [ + "Hyperswitch" + ] } } } @@ -13221,11 +14349,15 @@ }, { "type": "object", - "required": ["payment_processing_details_at"], + "required": [ + "payment_processing_details_at" + ], "properties": { "payment_processing_details_at": { "type": "string", - "enum": ["Connector"] + "enum": [ + "Connector" + ] } } } @@ -13267,7 +14399,12 @@ "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.", - "enum": ["normal", "new_mandate", "setup_mandate", "recurring_mandate"] + "enum": [ + "normal", + "new_mandate", + "setup_mandate", + "recurring_mandate" + ] }, "PaymentsCancelRequest": { "type": "object", @@ -13301,7 +14438,9 @@ }, "PaymentsCompleteAuthorizeRequest": { "type": "object", - "required": ["client_secret"], + "required": [ + "client_secret" + ], "properties": { "shipping": { "allOf": [ @@ -13477,7 +14616,10 @@ }, "PaymentsCreateIntentRequest": { "type": "object", - "required": ["amount_details", "customer_id"], + "required": [ + "amount_details", + "customer_id" + ], "properties": { "amount_details": { "$ref": "#/components/schemas/AmountDetails" @@ -14205,7 +15347,11 @@ }, "PaymentsDynamicTaxCalculationRequest": { "type": "object", - "required": ["shipping", "client_secret", "payment_method_type"], + "required": [ + "shipping", + "client_secret", + "payment_method_type" + ], "properties": { "shipping": { "$ref": "#/components/schemas/Address" @@ -14226,7 +15372,11 @@ }, "PaymentsDynamicTaxCalculationResponse": { "type": "object", - "required": ["payment_id", "net_amount", "display_amount"], + "required": [ + "payment_id", + "net_amount", + "display_amount" + ], "properties": { "payment_id": { "type": "string", @@ -14286,7 +15436,10 @@ }, "PaymentsExternalAuthenticationResponse": { "type": "object", - "required": ["trans_status", "three_ds_requestor_url"], + "required": [ + "trans_status", + "three_ds_requestor_url" + ], "properties": { "trans_status": { "$ref": "#/components/schemas/TransactionStatus" @@ -14329,7 +15482,9 @@ }, "PaymentsIncrementalAuthorizationRequest": { "type": "object", - "required": ["amount"], + "required": [ + "amount" + ], "properties": { "amount": { "type": "integer", @@ -15233,7 +16388,10 @@ }, "PaymentsSessionResponse": { "type": "object", - "required": ["payment_id", "session_token"], + "required": [ + "payment_id", + "session_token" + ], "properties": { "payment_id": { "type": "string", @@ -15423,7 +16581,11 @@ }, "PayoutAttemptResponse": { "type": "object", - "required": ["attempt_id", "status", "amount"], + "required": [ + "attempt_id", + "status", + "amount" + ], "properties": { "attempt_id": { "type": "string", @@ -15611,7 +16773,10 @@ "$ref": "#/components/schemas/PayoutConnectors" }, "description": "This field allows the merchant to manually select a connector with which the payout can go through.", - "example": ["wise", "adyen"], + "example": [ + "wise", + "adyen" + ], "nullable": true }, "confirm": { @@ -16051,7 +17216,10 @@ }, "PayoutLinkInitiateRequest": { "type": "object", - "required": ["merchant_id", "payout_id"], + "required": [ + "merchant_id", + "payout_id" + ], "properties": { "merchant_id": { "type": "string" @@ -16063,7 +17231,10 @@ }, "PayoutLinkResponse": { "type": "object", - "required": ["payout_link_id", "link"], + "required": [ + "payout_link_id", + "link" + ], "properties": { "payout_link_id": { "type": "string" @@ -16135,7 +17306,10 @@ }, { "type": "object", - "required": ["currency", "entity_type"], + "required": [ + "currency", + "entity_type" + ], "properties": { "payout_id": { "type": "string", @@ -16175,7 +17349,10 @@ "$ref": "#/components/schemas/PayoutConnectors" }, "description": "The list of connectors to filter payouts list", - "example": ["wise", "adyen"], + "example": [ + "wise", + "adyen" + ], "nullable": true }, "currency": { @@ -16187,7 +17364,10 @@ "$ref": "#/components/schemas/PayoutStatus" }, "description": "The list of payout status to filter payouts list", - "example": ["pending", "failed"], + "example": [ + "pending", + "failed" + ], "nullable": true }, "payout_method": { @@ -16196,7 +17376,10 @@ "$ref": "#/components/schemas/PayoutType" }, "description": "The list of payout methods to filter payouts list", - "example": ["bank", "card"], + "example": [ + "bank", + "card" + ], "nullable": true }, "entity_type": { @@ -16208,7 +17391,10 @@ }, "PayoutListResponse": { "type": "object", - "required": ["size", "data"], + "required": [ + "size", + "data" + ], "properties": { "size": { "type": "integer", @@ -16234,7 +17420,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardPayout" @@ -16243,7 +17431,9 @@ }, { "type": "object", - "required": ["bank"], + "required": [ + "bank" + ], "properties": { "bank": { "$ref": "#/components/schemas/Bank" @@ -16252,7 +17442,9 @@ }, { "type": "object", - "required": ["wallet"], + "required": [ + "wallet" + ], "properties": { "wallet": { "$ref": "#/components/schemas/Wallet" @@ -16266,7 +17458,9 @@ "oneOf": [ { "type": "object", - "required": ["card"], + "required": [ + "card" + ], "properties": { "card": { "$ref": "#/components/schemas/CardAdditionalData" @@ -16275,7 +17469,9 @@ }, { "type": "object", - "required": ["bank"], + "required": [ + "bank" + ], "properties": { "bank": { "$ref": "#/components/schemas/BankAdditionalData" @@ -16284,7 +17480,9 @@ }, { "type": "object", - "required": ["wallet"], + "required": [ + "wallet" + ], "properties": { "wallet": { "$ref": "#/components/schemas/WalletAdditionalData" @@ -16298,7 +17496,9 @@ "oneOf": [ { "type": "object", - "required": ["PayoutActionRequest"], + "required": [ + "PayoutActionRequest" + ], "properties": { "PayoutActionRequest": { "$ref": "#/components/schemas/PayoutActionRequest" @@ -16307,7 +17507,9 @@ }, { "type": "object", - "required": ["PayoutCreateRequest"], + "required": [ + "PayoutCreateRequest" + ], "properties": { "PayoutCreateRequest": { "$ref": "#/components/schemas/PayoutCreateRequest" @@ -16316,7 +17518,9 @@ }, { "type": "object", - "required": ["PayoutRetrieveRequest"], + "required": [ + "PayoutRetrieveRequest" + ], "properties": { "PayoutRetrieveRequest": { "$ref": "#/components/schemas/PayoutRetrieveRequest" @@ -16340,7 +17544,9 @@ }, "PayoutRetrieveRequest": { "type": "object", - "required": ["payout_id"], + "required": [ + "payout_id" + ], "properties": { "payout_id": { "type": "string", @@ -16396,11 +17602,19 @@ "PayoutType": { "type": "string", "description": "The payout_type of the payout request is a mandatory field for confirming the payouts. It should be specified in the Create request. If not provided, it must be updated in the Payout Update request before it can be confirmed.", - "enum": ["card", "bank", "wallet"] + "enum": [ + "card", + "bank", + "wallet" + ] }, "Paypal": { "type": "object", - "required": ["email", "telephone_number", "paypal_id"], + "required": [ + "email", + "telephone_number", + "paypal_id" + ], "properties": { "email": { "type": "string", @@ -16457,7 +17671,11 @@ }, "PaypalSessionTokenResponse": { "type": "object", - "required": ["connector", "session_token", "sdk_next_action"], + "required": [ + "connector", + "session_token", + "sdk_next_action" + ], "properties": { "connector": { "type": "string", @@ -16513,7 +17731,9 @@ }, "PazeWalletData": { "type": "object", - "required": ["complete_response"], + "required": [ + "complete_response" + ], "properties": { "complete_response": { "type": "string" @@ -16539,7 +17759,10 @@ }, "PixBankTransfer": { "type": "object", - "required": ["bank_account_number", "pix_key"], + "required": [ + "bank_account_number", + "pix_key" + ], "properties": { "bank_name": { "type": "string", @@ -16596,7 +17819,11 @@ }, "PollConfigResponse": { "type": "object", - "required": ["poll_id", "delay_in_secs", "frequency"], + "required": [ + "poll_id", + "delay_in_secs", + "frequency" + ], "properties": { "poll_id": { "type": "string", @@ -16616,7 +17843,10 @@ }, "PollResponse": { "type": "object", - "required": ["poll_id", "status"], + "required": [ + "poll_id", + "status" + ], "properties": { "poll_id": { "type": "string", @@ -16629,16 +17859,26 @@ }, "PollStatus": { "type": "string", - "enum": ["pending", "completed", "not_found"] + "enum": [ + "pending", + "completed", + "not_found" + ] }, "PresenceOfCustomerDuringPayment": { "type": "string", "description": "Set to `present` to indicate that the customer is in your checkout flow during this payment, and therefore is able to authenticate. This parameter should be `absent` when merchant's doing merchant initiated payments and customer is not present while doing the payment.", - "enum": ["present", "absent"] + "enum": [ + "present", + "absent" + ] }, "PrimaryBusinessDetails": { "type": "object", - "required": ["country", "business"], + "required": [ + "country", + "business" + ], "properties": { "country": { "$ref": "#/components/schemas/CountryAlpha2" @@ -16653,7 +17893,9 @@ "ProcessorPaymentToken": { "type": "object", "description": "Processor payment token for MIT payments where payment_method_data is not available", - "required": ["processor_payment_token"], + "required": [ + "processor_payment_token" + ], "properties": { "processor_payment_token": { "type": "string" @@ -16677,7 +17919,9 @@ }, "ProfileCreate": { "type": "object", - "required": ["profile_name"], + "required": [ + "profile_name" + ], "properties": { "profile_name": { "type": "string", @@ -16851,7 +18095,10 @@ }, "ProfileDefaultRoutingConfig": { "type": "object", - "required": ["profile_id", "connectors"], + "required": [ + "profile_id", + "connectors" + ], "properties": { "profile_id": { "type": "string" @@ -17072,7 +18319,11 @@ "ProgramConnectorSelection": { "type": "object", "description": "The program, having a default connector selection and\na bunch of rules. Also can hold arbitrary metadata.", - "required": ["defaultSelection", "rules", "metadata"], + "required": [ + "defaultSelection", + "rules", + "metadata" + ], "properties": { "defaultSelection": { "$ref": "#/components/schemas/ConnectorSelection" @@ -17090,7 +18341,9 @@ "oneOf": [ { "type": "object", - "required": ["fps"], + "required": [ + "fps" + ], "properties": { "fps": { "type": "object" @@ -17099,7 +18352,9 @@ }, { "type": "object", - "required": ["duit_now"], + "required": [ + "duit_now" + ], "properties": { "duit_now": { "type": "object" @@ -17108,7 +18363,9 @@ }, { "type": "object", - "required": ["prompt_pay"], + "required": [ + "prompt_pay" + ], "properties": { "prompt_pay": { "type": "object" @@ -17117,7 +18374,9 @@ }, { "type": "object", - "required": ["viet_qr"], + "required": [ + "viet_qr" + ], "properties": { "viet_qr": { "type": "object" @@ -17143,7 +18402,9 @@ }, "ReceiverDetails": { "type": "object", - "required": ["amount_received"], + "required": [ + "amount_received" + ], "properties": { "amount_received": { "type": "integer", @@ -17166,17 +18427,27 @@ }, "ReconStatus": { "type": "string", - "enum": ["not_requested", "requested", "active", "disabled"] + "enum": [ + "not_requested", + "requested", + "active", + "disabled" + ] }, "RecurringDetails": { "oneOf": [ { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["mandate_id"] + "enum": [ + "mandate_id" + ] }, "data": { "type": "string" @@ -17185,11 +18456,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["payment_method_id"] + "enum": [ + "payment_method_id" + ] }, "data": { "type": "string" @@ -17198,11 +18474,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["processor_payment_token"] + "enum": [ + "processor_payment_token" + ] }, "data": { "$ref": "#/components/schemas/ProcessorPaymentToken" @@ -17211,11 +18492,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["network_transaction_id_and_card_details"] + "enum": [ + "network_transaction_id_and_card_details" + ] }, "data": { "$ref": "#/components/schemas/NetworkTransactionIdAndCardDetails" @@ -17230,7 +18516,13 @@ }, "RecurringPaymentIntervalUnit": { "type": "string", - "enum": ["year", "month", "day", "hour", "minute"] + "enum": [ + "year", + "month", + "day", + "hour", + "minute" + ] }, "RedirectResponse": { "type": "object", @@ -17247,7 +18539,10 @@ }, "RefundErrorDetails": { "type": "object", - "required": ["code", "message"], + "required": [ + "code", + "message" + ], "properties": { "code": { "type": "string" @@ -17343,7 +18638,11 @@ }, "RefundListResponse": { "type": "object", - "required": ["count", "total_count", "data"], + "required": [ + "count", + "total_count", + "data" + ], "properties": { "count": { "type": "integer", @@ -17366,7 +18665,9 @@ }, "RefundRequest": { "type": "object", - "required": ["payment_id"], + "required": [ + "payment_id" + ], "properties": { "payment_id": { "type": "string", @@ -17531,12 +18832,20 @@ "RefundStatus": { "type": "string", "description": "The status for refunds", - "enum": ["succeeded", "failed", "pending", "review"] + "enum": [ + "succeeded", + "failed", + "pending", + "review" + ] }, "RefundType": { "type": "string", "description": "To indicate whether to refund needs to be instant or scheduled", - "enum": ["scheduled", "instant"] + "enum": [ + "scheduled", + "instant" + ] }, "RefundUpdateRequest": { "type": "object", @@ -17558,7 +18867,9 @@ }, "RefundsCreateRequest": { "type": "object", - "required": ["payment_id"], + "required": [ + "payment_id" + ], "properties": { "payment_id": { "type": "string", @@ -17609,7 +18920,11 @@ }, "RequestIncrementalAuthorization": { "type": "string", - "enum": ["true", "false", "default"] + "enum": [ + "true", + "false", + "default" + ] }, "RequestPaymentMethodTypes": { "type": "object", @@ -17686,7 +19001,9 @@ "RequestSurchargeDetails": { "type": "object", "description": "Details of surcharge applied on this payment, if applicable", - "required": ["surcharge_amount"], + "required": [ + "surcharge_amount" + ], "properties": { "surcharge_amount": { "type": "integer", @@ -17706,7 +19023,11 @@ "RequiredFieldInfo": { "type": "object", "description": "Required fields info used while listing the payment_method_data", - "required": ["required_field", "display_name", "field_type"], + "required": [ + "required_field", + "display_name", + "field_type" + ], "properties": { "required_field": { "type": "string", @@ -17772,7 +19093,10 @@ }, { "type": "object", - "required": ["payment_method_type", "payment_method_subtype"], + "required": [ + "payment_method_type", + "payment_method_subtype" + ], "properties": { "payment_method_type": { "$ref": "#/components/schemas/PaymentMethod" @@ -17802,7 +19126,10 @@ }, "ResponsePaymentMethodsEnabled": { "type": "object", - "required": ["payment_method", "payment_method_types"], + "required": [ + "payment_method", + "payment_method_types" + ], "properties": { "payment_method": { "$ref": "#/components/schemas/PaymentMethod" @@ -17945,12 +19272,19 @@ "RetryAction": { "type": "string", "description": "Denotes the retry action", - "enum": ["manual_retry", "requeue"] + "enum": [ + "manual_retry", + "requeue" + ] }, "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", @@ -17973,7 +19307,9 @@ }, "RewardData": { "type": "object", - "required": ["merchant_id"], + "required": [ + "merchant_id" + ], "properties": { "merchant_id": { "type": "string", @@ -17983,12 +19319,17 @@ }, "RoutableChoiceKind": { "type": "string", - "enum": ["OnlyConnector", "FullStruct"] + "enum": [ + "OnlyConnector", + "FullStruct" + ] }, "RoutableConnectorChoice": { "type": "object", "description": "Routable Connector chosen for a payment", - "required": ["connector"], + "required": [ + "connector" + ], "properties": { "connector": { "$ref": "#/components/schemas/RoutableConnectors" @@ -18088,11 +19429,16 @@ "oneOf": [ { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["single"] + "enum": [ + "single" + ] }, "data": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -18101,11 +19447,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["priority"] + "enum": [ + "priority" + ] }, "data": { "type": "array", @@ -18117,11 +19468,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["volume_split"] + "enum": [ + "volume_split" + ] }, "data": { "type": "array", @@ -18133,11 +19489,16 @@ }, { "type": "object", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["advanced"] + "enum": [ + "advanced" + ] }, "data": { "$ref": "#/components/schemas/ProgramConnectorSelection" @@ -18152,7 +19513,9 @@ }, "RoutingAlgorithmId": { "type": "object", - "required": ["routing_algorithm_id"], + "required": [ + "routing_algorithm_id" + ], "properties": { "routing_algorithm_id": { "type": "string" @@ -18161,11 +19524,22 @@ }, "RoutingAlgorithmKind": { "type": "string", - "enum": ["single", "priority", "volume_split", "advanced", "dynamic"] + "enum": [ + "single", + "priority", + "volume_split", + "advanced", + "dynamic" + ] }, "RoutingConfigRequest": { "type": "object", - "required": ["name", "description", "algorithm", "profile_id"], + "required": [ + "name", + "description", + "algorithm", + "profile_id" + ], "properties": { "name": { "type": "string" @@ -18183,7 +19557,10 @@ }, "RoutingDictionary": { "type": "object", - "required": ["merchant_id", "records"], + "required": [ + "merchant_id", + "records" + ], "properties": { "merchant_id": { "type": "string" @@ -18275,7 +19652,11 @@ "RuleConnectorSelection": { "type": "object", "description": "Represents a rule\n\n```text\nrule_name: [stripe, adyen, checkout]\n{\npayment.method = card {\npayment.method.cardtype = (credit, debit) {\npayment.method.network = (amex, rupay, diners)\n}\n\npayment.method.cardtype = credit\n}\n}\n```", - "required": ["name", "connectorSelection", "statements"], + "required": [ + "name", + "connectorSelection", + "statements" + ], "properties": { "name": { "type": "string" @@ -18293,7 +19674,11 @@ }, "SamsungPayAmountDetails": { "type": "object", - "required": ["option", "currency_code", "total"], + "required": [ + "option", + "currency_code", + "total" + ], "properties": { "option": { "$ref": "#/components/schemas/SamsungPayAmountFormat" @@ -18310,7 +19695,10 @@ }, "SamsungPayAmountFormat": { "type": "string", - "enum": ["FORMAT_TOTAL_PRICE_ONLY", "FORMAT_TOTAL_ESTIMATED_AMOUNT"] + "enum": [ + "FORMAT_TOTAL_PRICE_ONLY", + "FORMAT_TOTAL_ESTIMATED_AMOUNT" + ] }, "SamsungPayAppWalletData": { "type": "object", @@ -18359,11 +19747,20 @@ }, "SamsungPayCardBrand": { "type": "string", - "enum": ["visa", "mastercard", "amex", "discover", "unknown"] + "enum": [ + "visa", + "mastercard", + "amex", + "discover", + "unknown" + ] }, "SamsungPayMerchantPaymentInformation": { "type": "object", - "required": ["name", "country_code"], + "required": [ + "name", + "country_code" + ], "properties": { "name": { "type": "string", @@ -18381,7 +19778,9 @@ }, "SamsungPayProtocolType": { "type": "string", - "enum": ["PROTOCOL3DS"] + "enum": [ + "PROTOCOL3DS" + ] }, "SamsungPaySessionTokenResponse": { "type": "object", @@ -18427,7 +19826,10 @@ }, "SamsungPayTokenData": { "type": "object", - "required": ["version", "data"], + "required": [ + "version", + "data" + ], "properties": { "type": { "type": "string", @@ -18456,7 +19858,9 @@ }, "SamsungPayWalletData": { "type": "object", - "required": ["payment_credential"], + "required": [ + "payment_credential" + ], "properties": { "payment_credential": { "$ref": "#/components/schemas/SamsungPayWalletCredentials" @@ -18465,7 +19869,11 @@ }, "SamsungPayWebWalletData": { "type": "object", - "required": ["card_brand", "card_last4digits", "3_d_s"], + "required": [ + "card_brand", + "card_last4digits", + "3_d_s" + ], "properties": { "method": { "type": "string", @@ -18492,7 +19900,10 @@ "ScaExemptionType": { "type": "string", "description": "SCA Exemptions types available for authentication", - "enum": ["low_value", "transaction_risk_analysis"] + "enum": [ + "low_value", + "transaction_risk_analysis" + ] }, "SdkInformation": { "type": "object", @@ -18539,7 +19950,9 @@ }, "SdkNextAction": { "type": "object", - "required": ["next_action"], + "required": [ + "next_action" + ], "properties": { "next_action": { "$ref": "#/components/schemas/NextActionCall" @@ -18548,7 +19961,9 @@ }, "SdkNextActionData": { "type": "object", - "required": ["next_action"], + "required": [ + "next_action" + ], "properties": { "next_action": { "$ref": "#/components/schemas/NextActionCall" @@ -18561,7 +19976,10 @@ }, "SecretInfoToInitiateSdk": { "type": "object", - "required": ["display", "payment"], + "required": [ + "display", + "payment" + ], "properties": { "display": { "type": "string" @@ -18590,7 +20008,9 @@ }, "SepaBankDebitAdditionalData": { "type": "object", - "required": ["iban"], + "required": [ + "iban" + ], "properties": { "iban": { "type": "string", @@ -18607,7 +20027,10 @@ }, "SepaBankTransfer": { "type": "object", - "required": ["iban", "bic"], + "required": [ + "iban", + "bic" + ], "properties": { "bank_name": { "type": "string", @@ -18644,7 +20067,9 @@ "SepaBankTransferAdditionalData": { "type": "object", "description": "Masked payout method details for sepa bank transfer payout method", - "required": ["iban"], + "required": [ + "iban" + ], "properties": { "iban": { "type": "string", @@ -18719,11 +20144,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["google_pay"] + "enum": [ + "google_pay" + ] } } } @@ -18736,11 +20165,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["samsung_pay"] + "enum": [ + "samsung_pay" + ] } } } @@ -18753,11 +20186,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["klarna"] + "enum": [ + "klarna" + ] } } } @@ -18770,11 +20207,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["paypal"] + "enum": [ + "paypal" + ] } } } @@ -18787,11 +20228,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["apple_pay"] + "enum": [ + "apple_pay" + ] } } } @@ -18804,11 +20249,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["open_banking"] + "enum": [ + "open_banking" + ] } } } @@ -18821,11 +20270,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["paze"] + "enum": [ + "paze" + ] } } } @@ -18838,11 +20291,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["click_to_pay"] + "enum": [ + "click_to_pay" + ] } } } @@ -18850,11 +20307,15 @@ }, { "type": "object", - "required": ["wallet_name"], + "required": [ + "wallet_name" + ], "properties": { "wallet_name": { "type": "string", - "enum": ["no_session_token_received"] + "enum": [ + "no_session_token_received" + ] } } } @@ -18916,13 +20377,18 @@ }, "SizeVariants": { "type": "string", - "enum": ["cover", "contain"] + "enum": [ + "cover", + "contain" + ] }, "SplitPaymentsRequest": { "oneOf": [ { "type": "object", - "required": ["stripe_split_payment"], + "required": [ + "stripe_split_payment" + ], "properties": { "stripe_split_payment": { "$ref": "#/components/schemas/StripeSplitPaymentRequest" @@ -18936,7 +20402,9 @@ "oneOf": [ { "type": "object", - "required": ["stripe_split_payment"], + "required": [ + "stripe_split_payment" + ], "properties": { "stripe_split_payment": { "$ref": "#/components/schemas/StripeSplitPaymentsResponse" @@ -18949,7 +20417,9 @@ "oneOf": [ { "type": "object", - "required": ["stripe_split_refund"], + "required": [ + "stripe_split_refund" + ], "properties": { "stripe_split_refund": { "$ref": "#/components/schemas/StripeSplitRefundRequest" @@ -18964,11 +20434,16 @@ { "type": "object", "title": "Single", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["single"] + "enum": [ + "single" + ] }, "data": { "$ref": "#/components/schemas/RoutableConnectorChoice" @@ -18978,11 +20453,16 @@ { "type": "object", "title": "Priority", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["priority"] + "enum": [ + "priority" + ] }, "data": { "type": "array", @@ -18995,11 +20475,16 @@ { "type": "object", "title": "VolumeSplit", - "required": ["type", "data"], + "required": [ + "type", + "data" + ], "properties": { "type": { "type": "string", - "enum": ["volume_split"] + "enum": [ + "volume_split" + ] }, "data": { "type": "array", @@ -19016,12 +20501,19 @@ }, "StripeChargeType": { "type": "string", - "enum": ["direct", "destination"] + "enum": [ + "direct", + "destination" + ] }, "StripeSplitPaymentRequest": { "type": "object", "description": "Fee information for Split Payments to be charged on the payment being collected for Stripe", - "required": ["charge_type", "application_fees", "transfer_account_id"], + "required": [ + "charge_type", + "application_fees", + "transfer_account_id" + ], "properties": { "charge_type": { "$ref": "#/components/schemas/PaymentChargeType" @@ -19042,7 +20534,11 @@ "StripeSplitPaymentsResponse": { "type": "object", "description": "Fee information to be charged on the payment being collected", - "required": ["charge_type", "application_fees", "transfer_account_id"], + "required": [ + "charge_type", + "application_fees", + "transfer_account_id" + ], "properties": { "charge_id": { "type": "string", @@ -19129,7 +20625,10 @@ }, "SurchargeCalculationOverride": { "type": "string", - "enum": ["skip", "calculate"] + "enum": [ + "skip", + "calculate" + ] }, "SurchargeDetailsResponse": { "type": "object", @@ -19170,7 +20669,9 @@ }, "SurchargePercentage": { "type": "object", - "required": ["percentage"], + "required": [ + "percentage" + ], "properties": { "percentage": { "type": "number", @@ -19182,11 +20683,16 @@ "oneOf": [ { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["fixed"] + "enum": [ + "fixed" + ] }, "value": { "$ref": "#/components/schemas/MinorUnit" @@ -19195,11 +20701,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["rate"] + "enum": [ + "rate" + ] }, "value": { "$ref": "#/components/schemas/SurchargePercentage" @@ -19216,11 +20727,16 @@ }, "TaxCalculationOverride": { "type": "string", - "enum": ["skip", "calculate"] + "enum": [ + "skip", + "calculate" + ] }, "ThirdPartySdkSessionResponse": { "type": "object", - "required": ["secrets"], + "required": [ + "secrets" + ], "properties": { "secrets": { "$ref": "#/components/schemas/SecretInfoToInitiateSdk" @@ -19229,7 +20745,11 @@ }, "ThreeDsCompletionIndicator": { "type": "string", - "enum": ["Y", "N", "U"] + "enum": [ + "Y", + "N", + "U" + ] }, "ThreeDsData": { "type": "object", @@ -19291,7 +20811,9 @@ }, "three_ds_method_key": { "type": "string", - "enum": ["threeDSMethodData"] + "enum": [ + "threeDSMethodData" + ] } } } @@ -19303,7 +20825,9 @@ "TimeRange": { "type": "object", "description": "A type representing a range of time for filtering, including a mandatory start time and an optional end time.", - "required": ["start_time"], + "required": [ + "start_time" + ], "properties": { "start_time": { "type": "string", @@ -19320,7 +20844,9 @@ }, "ToggleBlocklistResponse": { "type": "object", - "required": ["blocklist_guard_status"], + "required": [ + "blocklist_guard_status" + ], "properties": { "blocklist_guard_status": { "type": "string" @@ -19329,7 +20855,9 @@ }, "ToggleKVRequest": { "type": "object", - "required": ["kv_enabled"], + "required": [ + "kv_enabled" + ], "properties": { "kv_enabled": { "type": "boolean", @@ -19340,7 +20868,10 @@ }, "ToggleKVResponse": { "type": "object", - "required": ["merchant_id", "kv_enabled"], + "required": [ + "merchant_id", + "kv_enabled" + ], "properties": { "merchant_id": { "type": "string", @@ -19387,15 +20918,30 @@ "TransactionStatus": { "type": "string", "description": "Indicates the transaction status", - "enum": ["Y", "N", "U", "A", "R", "C", "D", "I"] + "enum": [ + "Y", + "N", + "U", + "A", + "R", + "C", + "D", + "I" + ] }, "TransactionType": { "type": "string", - "enum": ["payment", "payout"] + "enum": [ + "payment", + "payout" + ] }, "UIWidgetFormLayout": { "type": "string", - "enum": ["tabs", "journey"] + "enum": [ + "tabs", + "journey" + ] }, "UpdateApiKeyRequest": { "type": "object", @@ -19430,7 +20976,9 @@ "oneOf": [ { "type": "object", - "required": ["upi_collect"], + "required": [ + "upi_collect" + ], "properties": { "upi_collect": { "$ref": "#/components/schemas/UpiCollectAdditionalData" @@ -19439,7 +20987,9 @@ }, { "type": "object", - "required": ["upi_intent"], + "required": [ + "upi_intent" + ], "properties": { "upi_intent": { "$ref": "#/components/schemas/UpiIntentData" @@ -19473,7 +21023,9 @@ "oneOf": [ { "type": "object", - "required": ["upi_collect"], + "required": [ + "upi_collect" + ], "properties": { "upi_collect": { "$ref": "#/components/schemas/UpiCollectData" @@ -19482,7 +21034,9 @@ }, { "type": "object", - "required": ["upi_intent"], + "required": [ + "upi_intent" + ], "properties": { "upi_intent": { "$ref": "#/components/schemas/UpiIntentData" @@ -19513,11 +21067,16 @@ "oneOf": [ { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["number"] + "enum": [ + "number" + ] }, "value": { "$ref": "#/components/schemas/MinorUnit" @@ -19526,11 +21085,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["enum_variant"] + "enum": [ + "enum_variant" + ] }, "value": { "type": "string", @@ -19540,11 +21104,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["metadata_variant"] + "enum": [ + "metadata_variant" + ] }, "value": { "$ref": "#/components/schemas/MetadataValue" @@ -19553,11 +21122,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["str_value"] + "enum": [ + "str_value" + ] }, "value": { "type": "string", @@ -19567,11 +21141,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["number_array"] + "enum": [ + "number_array" + ] }, "value": { "type": "array", @@ -19584,11 +21163,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["enum_variant_array"] + "enum": [ + "enum_variant_array" + ] }, "value": { "type": "array", @@ -19601,11 +21185,16 @@ }, { "type": "object", - "required": ["type", "value"], + "required": [ + "type", + "value" + ], "properties": { "type": { "type": "string", - "enum": ["number_comparison_array"] + "enum": [ + "number_comparison_array" + ] }, "value": { "type": "array", @@ -19624,7 +21213,9 @@ }, "Venmo": { "type": "object", - "required": ["telephone_number"], + "required": [ + "telephone_number" + ], "properties": { "telephone_number": { "type": "string", @@ -19649,7 +21240,9 @@ "oneOf": [ { "type": "object", - "required": ["boleto"], + "required": [ + "boleto" + ], "properties": { "boleto": { "$ref": "#/components/schemas/BoletoVoucherData" @@ -19658,23 +21251,33 @@ }, { "type": "string", - "enum": ["efecty"] + "enum": [ + "efecty" + ] }, { "type": "string", - "enum": ["pago_efectivo"] + "enum": [ + "pago_efectivo" + ] }, { "type": "string", - "enum": ["red_compra"] + "enum": [ + "red_compra" + ] }, { "type": "string", - "enum": ["red_pagos"] + "enum": [ + "red_pagos" + ] }, { "type": "object", - "required": ["alfamart"], + "required": [ + "alfamart" + ], "properties": { "alfamart": { "$ref": "#/components/schemas/AlfamartVoucherData" @@ -19683,7 +21286,9 @@ }, { "type": "object", - "required": ["indomaret"], + "required": [ + "indomaret" + ], "properties": { "indomaret": { "$ref": "#/components/schemas/IndomaretVoucherData" @@ -19692,11 +21297,15 @@ }, { "type": "string", - "enum": ["oxxo"] + "enum": [ + "oxxo" + ] }, { "type": "object", - "required": ["seven_eleven"], + "required": [ + "seven_eleven" + ], "properties": { "seven_eleven": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19705,7 +21314,9 @@ }, { "type": "object", - "required": ["lawson"], + "required": [ + "lawson" + ], "properties": { "lawson": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19714,7 +21325,9 @@ }, { "type": "object", - "required": ["mini_stop"], + "required": [ + "mini_stop" + ], "properties": { "mini_stop": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19723,7 +21336,9 @@ }, { "type": "object", - "required": ["family_mart"], + "required": [ + "family_mart" + ], "properties": { "family_mart": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19732,7 +21347,9 @@ }, { "type": "object", - "required": ["seicomart"], + "required": [ + "seicomart" + ], "properties": { "seicomart": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19741,7 +21358,9 @@ }, { "type": "object", - "required": ["pay_easy"], + "required": [ + "pay_easy" + ], "properties": { "pay_easy": { "$ref": "#/components/schemas/JCSVoucherData" @@ -19769,7 +21388,9 @@ "oneOf": [ { "type": "object", - "required": ["paypal"], + "required": [ + "paypal" + ], "properties": { "paypal": { "$ref": "#/components/schemas/Paypal" @@ -19778,7 +21399,9 @@ }, { "type": "object", - "required": ["venmo"], + "required": [ + "venmo" + ], "properties": { "venmo": { "$ref": "#/components/schemas/Venmo" @@ -19800,7 +21423,11 @@ }, "WalletAdditionalDataForCard": { "type": "object", - "required": ["last4", "card_network", "type"], + "required": [ + "last4", + "card_network", + "type" + ], "properties": { "last4": { "type": "string", @@ -19820,7 +21447,9 @@ "oneOf": [ { "type": "object", - "required": ["ali_pay_qr"], + "required": [ + "ali_pay_qr" + ], "properties": { "ali_pay_qr": { "$ref": "#/components/schemas/AliPayQr" @@ -19829,7 +21458,9 @@ }, { "type": "object", - "required": ["ali_pay_redirect"], + "required": [ + "ali_pay_redirect" + ], "properties": { "ali_pay_redirect": { "$ref": "#/components/schemas/AliPayRedirection" @@ -19838,7 +21469,9 @@ }, { "type": "object", - "required": ["ali_pay_hk_redirect"], + "required": [ + "ali_pay_hk_redirect" + ], "properties": { "ali_pay_hk_redirect": { "$ref": "#/components/schemas/AliPayHkRedirection" @@ -19847,7 +21480,9 @@ }, { "type": "object", - "required": ["momo_redirect"], + "required": [ + "momo_redirect" + ], "properties": { "momo_redirect": { "$ref": "#/components/schemas/MomoRedirection" @@ -19856,7 +21491,9 @@ }, { "type": "object", - "required": ["kakao_pay_redirect"], + "required": [ + "kakao_pay_redirect" + ], "properties": { "kakao_pay_redirect": { "$ref": "#/components/schemas/KakaoPayRedirection" @@ -19865,7 +21502,9 @@ }, { "type": "object", - "required": ["go_pay_redirect"], + "required": [ + "go_pay_redirect" + ], "properties": { "go_pay_redirect": { "$ref": "#/components/schemas/GoPayRedirection" @@ -19874,7 +21513,9 @@ }, { "type": "object", - "required": ["gcash_redirect"], + "required": [ + "gcash_redirect" + ], "properties": { "gcash_redirect": { "$ref": "#/components/schemas/GcashRedirection" @@ -19883,7 +21524,9 @@ }, { "type": "object", - "required": ["apple_pay"], + "required": [ + "apple_pay" + ], "properties": { "apple_pay": { "$ref": "#/components/schemas/ApplePayWalletData" @@ -19892,7 +21535,9 @@ }, { "type": "object", - "required": ["apple_pay_redirect"], + "required": [ + "apple_pay_redirect" + ], "properties": { "apple_pay_redirect": { "$ref": "#/components/schemas/ApplePayRedirectData" @@ -19901,7 +21546,9 @@ }, { "type": "object", - "required": ["apple_pay_third_party_sdk"], + "required": [ + "apple_pay_third_party_sdk" + ], "properties": { "apple_pay_third_party_sdk": { "$ref": "#/components/schemas/ApplePayThirdPartySdkData" @@ -19910,7 +21557,9 @@ }, { "type": "object", - "required": ["dana_redirect"], + "required": [ + "dana_redirect" + ], "properties": { "dana_redirect": { "type": "object", @@ -19920,7 +21569,9 @@ }, { "type": "object", - "required": ["google_pay"], + "required": [ + "google_pay" + ], "properties": { "google_pay": { "$ref": "#/components/schemas/GooglePayWalletData" @@ -19929,7 +21580,9 @@ }, { "type": "object", - "required": ["google_pay_redirect"], + "required": [ + "google_pay_redirect" + ], "properties": { "google_pay_redirect": { "$ref": "#/components/schemas/GooglePayRedirectData" @@ -19938,7 +21591,9 @@ }, { "type": "object", - "required": ["google_pay_third_party_sdk"], + "required": [ + "google_pay_third_party_sdk" + ], "properties": { "google_pay_third_party_sdk": { "$ref": "#/components/schemas/GooglePayThirdPartySdkData" @@ -19947,7 +21602,9 @@ }, { "type": "object", - "required": ["mb_way_redirect"], + "required": [ + "mb_way_redirect" + ], "properties": { "mb_way_redirect": { "$ref": "#/components/schemas/MbWayRedirection" @@ -19956,7 +21613,9 @@ }, { "type": "object", - "required": ["mobile_pay_redirect"], + "required": [ + "mobile_pay_redirect" + ], "properties": { "mobile_pay_redirect": { "$ref": "#/components/schemas/MobilePayRedirection" @@ -19965,7 +21624,9 @@ }, { "type": "object", - "required": ["paypal_redirect"], + "required": [ + "paypal_redirect" + ], "properties": { "paypal_redirect": { "$ref": "#/components/schemas/PaypalRedirection" @@ -19974,7 +21635,9 @@ }, { "type": "object", - "required": ["paypal_sdk"], + "required": [ + "paypal_sdk" + ], "properties": { "paypal_sdk": { "$ref": "#/components/schemas/PayPalWalletData" @@ -19983,7 +21646,9 @@ }, { "type": "object", - "required": ["paze"], + "required": [ + "paze" + ], "properties": { "paze": { "$ref": "#/components/schemas/PazeWalletData" @@ -19992,7 +21657,9 @@ }, { "type": "object", - "required": ["samsung_pay"], + "required": [ + "samsung_pay" + ], "properties": { "samsung_pay": { "$ref": "#/components/schemas/SamsungPayWalletData" @@ -20001,7 +21668,9 @@ }, { "type": "object", - "required": ["twint_redirect"], + "required": [ + "twint_redirect" + ], "properties": { "twint_redirect": { "type": "object", @@ -20011,7 +21680,9 @@ }, { "type": "object", - "required": ["vipps_redirect"], + "required": [ + "vipps_redirect" + ], "properties": { "vipps_redirect": { "type": "object", @@ -20021,7 +21692,9 @@ }, { "type": "object", - "required": ["touch_n_go_redirect"], + "required": [ + "touch_n_go_redirect" + ], "properties": { "touch_n_go_redirect": { "$ref": "#/components/schemas/TouchNGoRedirection" @@ -20030,7 +21703,9 @@ }, { "type": "object", - "required": ["we_chat_pay_redirect"], + "required": [ + "we_chat_pay_redirect" + ], "properties": { "we_chat_pay_redirect": { "$ref": "#/components/schemas/WeChatPayRedirection" @@ -20039,7 +21714,9 @@ }, { "type": "object", - "required": ["we_chat_pay_qr"], + "required": [ + "we_chat_pay_qr" + ], "properties": { "we_chat_pay_qr": { "$ref": "#/components/schemas/WeChatPayQr" @@ -20048,7 +21725,9 @@ }, { "type": "object", - "required": ["cashapp_qr"], + "required": [ + "cashapp_qr" + ], "properties": { "cashapp_qr": { "$ref": "#/components/schemas/CashappQr" @@ -20057,7 +21736,9 @@ }, { "type": "object", - "required": ["swish_qr"], + "required": [ + "swish_qr" + ], "properties": { "swish_qr": { "$ref": "#/components/schemas/SwishQrData" @@ -20066,7 +21747,9 @@ }, { "type": "object", - "required": ["mifinity"], + "required": [ + "mifinity" + ], "properties": { "mifinity": { "$ref": "#/components/schemas/MifinityData" @@ -20094,7 +21777,9 @@ "oneOf": [ { "type": "object", - "required": ["apple_pay"], + "required": [ + "apple_pay" + ], "properties": { "apple_pay": { "$ref": "#/components/schemas/WalletAdditionalDataForCard" @@ -20103,7 +21788,9 @@ }, { "type": "object", - "required": ["google_pay"], + "required": [ + "google_pay" + ], "properties": { "google_pay": { "$ref": "#/components/schemas/WalletAdditionalDataForCard" @@ -20124,7 +21811,11 @@ }, "WebhookDeliveryAttempt": { "type": "string", - "enum": ["initial_attempt", "automatic_retry", "manual_retry"] + "enum": [ + "initial_attempt", + "automatic_retry", + "manual_retry" + ] }, "WebhookDetails": { "type": "object", @@ -20263,4 +21954,4 @@ "description": "Manage events" } ] -} +} \ No newline at end of file