mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
feat(documentation): add polymorphic generate_schema macro (#1183)
Co-authored-by: pixincreate@work <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
@ -205,6 +205,7 @@ pub struct CurrencyCountryFlowFilter {
|
||||
pub country: Option<HashSet<api_models::enums::CountryAlpha2>>,
|
||||
pub not_available_flows: Option<NotAvailableFlows>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Copy, Clone, Default)]
|
||||
#[serde(default)]
|
||||
pub struct NotAvailableFlows {
|
||||
|
||||
@ -29,7 +29,7 @@ Use the following base URLs when making requests to the APIs:
|
||||
| Environment | Base URL |
|
||||
|---------------|------------------------------------|
|
||||
| Sandbox | <https://sandbox.hyperswitch.io> |
|
||||
| Production | Coming Soon! |
|
||||
| Production | <https://api.hyperswitch.io> |
|
||||
|
||||
## Authentication
|
||||
|
||||
@ -38,10 +38,10 @@ account, you are given a secret key (also referred as api-key) and a publishable
|
||||
You may authenticate all API requests with Hyperswitch server by providing the appropriate key in
|
||||
the request Authorization header.
|
||||
|
||||
| Key | Description |
|
||||
|---------------|-----------------------------------------------------------------------------------------------|
|
||||
| Sandbox | Private key. Used to authenticate all API requests from your merchant server |
|
||||
| Production | Unique identifier for your account. Used to authenticate API requests from your app's client |
|
||||
| Key | Description |
|
||||
|-----------------|-----------------------------------------------------------------------------------------------|
|
||||
| api-key | Private key. Used to authenticate all API requests from your merchant server |
|
||||
| publishable key | Unique identifier for your account. Used to authenticate API requests from your app's client |
|
||||
|
||||
Never share your secret api keys. Keep them guarded and secure.
|
||||
"#,
|
||||
@ -65,15 +65,16 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
crate::routes::refunds::refunds_retrieve,
|
||||
crate::routes::refunds::refunds_update,
|
||||
crate::routes::refunds::refunds_list,
|
||||
crate::routes::admin::merchant_account_create,
|
||||
crate::routes::admin::retrieve_merchant_account,
|
||||
crate::routes::admin::update_merchant_account,
|
||||
crate::routes::admin::delete_merchant_account,
|
||||
crate::routes::admin::payment_connector_create,
|
||||
crate::routes::admin::payment_connector_retrieve,
|
||||
crate::routes::admin::payment_connector_list,
|
||||
crate::routes::admin::payment_connector_update,
|
||||
crate::routes::admin::payment_connector_delete,
|
||||
// Commenting this out as these are admin apis and not to be used by the merchant
|
||||
// crate::routes::admin::merchant_account_create,
|
||||
// crate::routes::admin::retrieve_merchant_account,
|
||||
// crate::routes::admin::update_merchant_account,
|
||||
// crate::routes::admin::delete_merchant_account,
|
||||
// crate::routes::admin::payment_connector_create,
|
||||
// crate::routes::admin::payment_connector_retrieve,
|
||||
// crate::routes::admin::payment_connector_list,
|
||||
// crate::routes::admin::payment_connector_update,
|
||||
// crate::routes::admin::payment_connector_delete,
|
||||
crate::routes::mandates::get_mandate,
|
||||
crate::routes::mandates::revoke_mandate,
|
||||
crate::routes::payments::payments_create,
|
||||
@ -114,6 +115,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
crate::types::api::admin::MerchantAccountUpdate,
|
||||
crate::types::api::admin::MerchantAccountDeleteResponse,
|
||||
crate::types::api::admin::MerchantConnectorDeleteResponse,
|
||||
crate::types::api::admin::MerchantConnectorResponse,
|
||||
crate::types::api::customers::CustomerRequest,
|
||||
crate::types::api::customers::CustomerDeleteResponse,
|
||||
crate::types::api::payment_methods::PaymentMethodCreate,
|
||||
@ -148,10 +150,25 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::enums::DisputeStage,
|
||||
api_models::enums::DisputeStatus,
|
||||
api_models::enums::CountryAlpha2,
|
||||
api_models::enums::FrmAction,
|
||||
api_models::enums::FrmPreferredFlowTypes,
|
||||
api_models::admin::MerchantConnectorCreate,
|
||||
api_models::admin::MerchantConnectorUpdate,
|
||||
api_models::admin::PrimaryBusinessDetails,
|
||||
api_models::admin::FrmConfigs,
|
||||
api_models::admin::PaymentMethodsEnabled,
|
||||
api_models::admin::MerchantConnectorDetailsWrap,
|
||||
api_models::admin::MerchantConnectorDetails,
|
||||
api_models::disputes::DisputeResponse,
|
||||
api_models::disputes::DisputeResponsePaymentsRetrieve,
|
||||
api_models::payments::AddressDetails,
|
||||
api_models::payments::BankDebitData,
|
||||
api_models::payments::AliPayRedirection,
|
||||
api_models::payments::MbWayRedirection,
|
||||
api_models::payments::MobilePayRedirection,
|
||||
api_models::payments::WeChatPayRedirection,
|
||||
api_models::payments::BankDebitBilling,
|
||||
api_models::payments::CryptoData,
|
||||
api_models::payments::Address,
|
||||
api_models::payments::BankRedirectData,
|
||||
api_models::payments::BankRedirectBilling,
|
||||
@ -172,6 +189,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::Card,
|
||||
api_models::payments::CustomerAcceptance,
|
||||
api_models::payments::PaymentsRequest,
|
||||
api_models::payments::PaymentsCreateRequest,
|
||||
api_models::payments::PaymentsResponse,
|
||||
api_models::payments::PaymentsStartRequest,
|
||||
api_models::payments::PaymentRetrieveBody,
|
||||
|
||||
@ -158,9 +158,9 @@ pub async fn delete_merchant_account(
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/accounts/{account_id}/connectors",
|
||||
request_body = MerchantConnector,
|
||||
request_body = MerchantConnectorCreate,
|
||||
responses(
|
||||
(status = 200, description = "Merchant Connector Created", body = MerchantConnector),
|
||||
(status = 200, description = "Merchant Connector Created", body = MerchantConnectorResponse),
|
||||
(status = 400, description = "Missing Mandatory fields"),
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
@ -198,7 +198,7 @@ pub async fn payment_connector_create(
|
||||
("connector_id" = i32, Path, description = "The unique identifier for the Merchant Connector")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Merchant Connector retrieved successfully", body = MerchantConnector),
|
||||
(status = 200, description = "Merchant Connector retrieved successfully", body = MerchantConnectorResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
@ -242,7 +242,7 @@ pub async fn payment_connector_retrieve(
|
||||
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Merchant Connector list retrieved successfully", body = Vec<MerchantConnector>),
|
||||
(status = 200, description = "Merchant Connector list retrieved successfully", body = Vec<MerchantConnectorResponse>),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
@ -275,13 +275,13 @@ pub async fn payment_connector_list(
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/accounts/{account_id}/connectors/{connector_id}",
|
||||
request_body = MerchantConnector,
|
||||
request_body = MerchantConnectorUpdate,
|
||||
params(
|
||||
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
|
||||
("connector_id" = i32, Path, description = "The unique identifier for the Merchant Connector")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Merchant Connector Updated", body = MerchantConnector),
|
||||
(status = 200, description = "Merchant Connector Updated", body = MerchantConnectorResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
|
||||
@ -11,7 +11,7 @@ use crate::{
|
||||
types::api::disputes as dispute_types,
|
||||
};
|
||||
|
||||
/// Diputes - Retrieve Dispute
|
||||
/// Disputes - Retrieve Dispute
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/disputes/{dispute_id}",
|
||||
@ -47,7 +47,7 @@ pub async fn retrieve_dispute(
|
||||
.await
|
||||
}
|
||||
|
||||
/// Diputes - List Disputes
|
||||
/// Disputes - List Disputes
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/disputes/list",
|
||||
@ -90,7 +90,7 @@ pub async fn retrieve_disputes_list(
|
||||
.await
|
||||
}
|
||||
|
||||
/// Diputes - Accept Dispute
|
||||
/// Disputes - Accept Dispute
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/disputes/accept/{dispute_id}",
|
||||
@ -126,7 +126,7 @@ pub async fn accept_dispute(
|
||||
.await
|
||||
}
|
||||
|
||||
/// Diputes - Submit Dispute Evidence
|
||||
/// Disputes - Submit Dispute Evidence
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/disputes/evidence",
|
||||
|
||||
@ -48,7 +48,7 @@ pub async fn create_payment_method_api(
|
||||
/// To filter and list the applicable payment methods for a particular Merchant ID
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/payment_methods/{account_id}",
|
||||
path = "/account/payment_methods",
|
||||
params (
|
||||
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
|
||||
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
|
||||
@ -96,7 +96,7 @@ pub async fn list_payment_method_api(
|
||||
/// To filter and list the applicable payment methods for a particular Customer ID
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/payment_methods/{customer_id}",
|
||||
path = "/customer/{customer_id}/payment_methods",
|
||||
params (
|
||||
("customer_id" = String, Path, description = "The unique identifier for the customer account"),
|
||||
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
|
||||
|
||||
@ -18,7 +18,7 @@ use crate::{
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/payments",
|
||||
request_body=PaymentsRequest,
|
||||
request_body=PaymentsCreateRequest,
|
||||
responses(
|
||||
(status = 200, description = "Payment created", body = PaymentsResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
pub use api_models::admin::{
|
||||
MerchantAccountCreate, MerchantAccountDeleteResponse, MerchantAccountResponse,
|
||||
MerchantAccountUpdate, MerchantConnectorCreate, MerchantConnectorDeleteResponse,
|
||||
MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId, MerchantDetails,
|
||||
MerchantId, PaymentMethodsEnabled, RoutingAlgorithm, StraightThroughAlgorithm, ToggleKVRequest,
|
||||
ToggleKVResponse, WebhookDetails,
|
||||
MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId,
|
||||
MerchantConnectorResponse, MerchantDetails, MerchantId, PaymentMethodsEnabled,
|
||||
RoutingAlgorithm, StraightThroughAlgorithm, ToggleKVRequest, ToggleKVResponse, WebhookDetails,
|
||||
};
|
||||
use common_utils::ext_traits::ValueExt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user