From d16fc9271f60f06c151322965db806e5bb056d26 Mon Sep 17 00:00:00 2001 From: Shankar Singh C Date: Thu, 19 Oct 2023 20:22:50 +0530 Subject: [PATCH] address failing ci checks --- crates/api_models/src/admin.rs | 4 +- crates/api_models/src/enums.rs | 1 + crates/api_models/src/payouts.rs | 2 +- crates/router/src/openapi.rs | 2 + openapi/openapi_spec.json | 86 +++++++++++++++++++++++++++++++- 5 files changed, 91 insertions(+), 4 deletions(-) diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index d8124cf9fe7e..42cc3c6dc97b 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -443,9 +443,10 @@ pub mod payout_routing_algorithm { } } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)] #[serde(tag = "type", content = "data", rename_all = "snake_case")] pub enum RoutingAlgorithm { + #[schema(value_type = RoutableConnectors)] Single(api_enums::RoutableConnectors), } @@ -458,6 +459,7 @@ pub enum RoutingAlgorithm { into = "StraightThroughAlgorithmSerde" )] pub enum StraightThroughAlgorithm { + #[schema(value_type = RoutableConnectors)] Single(api_enums::RoutableConnectors), } diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs index 8edebab817c4..dc614e660e6c 100644 --- a/crates/api_models/src/enums.rs +++ b/crates/api_models/src/enums.rs @@ -133,6 +133,7 @@ impl Connector { strum::EnumString, strum::EnumIter, strum::EnumVariantNames, + ToSchema )] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs index 5cc5e5118166..1d36f6e30cd6 100644 --- a/crates/api_models/src/payouts.rs +++ b/crates/api_models/src/payouts.rs @@ -44,7 +44,7 @@ pub struct PayoutCreateRequest { pub currency: Option, /// Specifies routing algorithm for selecting a connector - #[schema(value_type = Option, example = json!({ + #[schema(value_type = Option, example = json!({ "type": "single", "data": "adyen" }))] diff --git a/crates/router/src/openapi.rs b/crates/router/src/openapi.rs index b67461276efa..488679326745 100644 --- a/crates/router/src/openapi.rs +++ b/crates/router/src/openapi.rs @@ -170,6 +170,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::enums::AttemptStatus, api_models::enums::CaptureStatus, api_models::enums::ReconStatus, + api_models::enums::RoutableConnectors, api_models::admin::MerchantConnectorCreate, api_models::admin::MerchantConnectorUpdate, api_models::admin::PrimaryBusinessDetails, @@ -182,6 +183,7 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::MerchantConnectorWebhookDetails, api_models::admin::PaymentLinkConfig, api_models::admin::PaymentLinkColorSchema, + api_models::admin::RoutingAlgorithm, api_models::disputes::DisputeResponse, api_models::disputes::DisputeResponsePaymentsRetrieve, api_models::payments::AddressDetails, diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index ee58909c671f..8a97d472668d 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -9973,7 +9973,7 @@ "routing": { "allOf": [ { - "$ref": "#/components/schemas/RoutingAlgorithm" + "$ref": "#/components/schemas/StraightThroughAlgorithm" } ], "nullable": true @@ -10946,6 +10946,88 @@ } } }, + "RoutableConnectors": { + "type": "string", + "enum": [ + "phonypay", + "fauxpay", + "pretendpay", + "stripe_test", + "adyen_test", + "checkout_test", + "paypal_test", + "aci", + "adyen", + "airwallex", + "authorizedotnet", + "bitpay", + "bambora", + "bluesnap", + "boku", + "braintree", + "cashtocode", + "checkout", + "coinbase", + "cryptopay", + "cybersource", + "dlocal", + "fiserv", + "forte", + "globalpay", + "globepay", + "gocardless", + "helcim", + "iatapay", + "klarna", + "mollie", + "multisafepay", + "nexinets", + "nmi", + "noon", + "nuvei", + "opennode", + "payme", + "paypal", + "payu", + "powertranz", + "rapyd", + "shift4", + "square", + "stax", + "stripe", + "trustpay", + "tsys", + "wise", + "worldline", + "worldpay", + "zen" + ] + }, + "RoutingAlgorithm": { + "oneOf": [ + { + "type": "object", + "required": [ + "type", + "data" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "single" + ] + }, + "data": { + "$ref": "#/components/schemas/RoutableConnectors" + } + } + } + ], + "discriminator": { + "propertyName": "type" + } + }, "SamsungPayWalletData": { "type": "object", "required": [ @@ -11216,7 +11298,7 @@ ] }, "data": { - "$ref": "#/components/schemas/api_enums.RoutableConnectors" + "$ref": "#/components/schemas/RoutableConnectors" } } }