feat(documentation): add polymorphic generate_schema macro (#1183)

Co-authored-by: pixincreate@work <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2023-05-19 16:37:54 +05:30
committed by GitHub
parent bd0069e2a8
commit 53aa5ac92d
14 changed files with 2568 additions and 1218 deletions

View File

@ -321,7 +321,9 @@ impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct PrimaryBusinessDetails {
#[schema(value_type = CountryAlpha2)]
pub country: api_enums::CountryAlpha2,
#[schema(example = "food")]
pub business: String,
}
@ -452,10 +454,12 @@ pub struct MerchantConnectorCreate {
pub frm_configs: Option<FrmConfigs>,
/// Business Country of the connector
#[schema(value_type = CountryAlpha2, example = "US")]
#[cfg(feature = "multiple_mca")]
#[schema(value_type = CountryAlpha2, example = "US")]
pub business_country: api_enums::CountryAlpha2,
#[cfg(not(feature = "multiple_mca"))]
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub business_country: Option<api_enums::CountryAlpha2>,
///Business Type of the merchant
@ -633,7 +637,11 @@ pub struct FrmConfigs {
pub frm_enabled_pms: Option<Vec<String>>,
pub frm_enabled_pm_types: Option<Vec<String>>,
pub frm_enabled_gateways: Option<Vec<String>>,
pub frm_action: api_enums::FrmAction, //What should be the action if FRM declines the txn (autorefund/cancel txn/manual review)
/// What should be the action if FRM declines the txn (autorefund/cancel txn/manual review)
#[schema(value_type = FrmAction)]
pub frm_action: api_enums::FrmAction,
/// Whether to make a call to the FRM before or after the payment
#[schema(value_type = FrmPreferredFlowTypes)]
pub frm_preferred_flow_type: api_enums::FrmPreferredFlowTypes,
}
/// Details of all the payment methods enabled for the connector for the given merchant account
@ -657,7 +665,9 @@ pub struct PaymentMethodsEnabled {
rename_all = "snake_case"
)]
pub enum AcceptedCurrencies {
#[schema(value_type = Vec<Currency>)]
EnableOnly(Vec<api_enums::Currency>),
#[schema(value_type = Vec<Currency>)]
DisableOnly(Vec<api_enums::Currency>),
AllAccepted,
}
@ -670,7 +680,9 @@ pub enum AcceptedCurrencies {
rename_all = "snake_case"
)]
pub enum AcceptedCountries {
#[schema(value_type = Vec<CountryAlpha2>)]
EnableOnly(Vec<api_enums::CountryAlpha2>),
#[schema(value_type = Vec<CountryAlpha2>)]
DisableOnly(Vec<api_enums::CountryAlpha2>),
AllAccepted,
}