mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
fix(openapi): correct schema references and semantics for v1 openApi spec (#8127)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -269,7 +269,9 @@ async fn create_applepay_session_token(
|
||||
let delayed_response = is_session_response_delayed(state, connector);
|
||||
if delayed_response {
|
||||
let delayed_response_apple_pay_session =
|
||||
Some(payment_types::ApplePaySessionResponse::NoSessionResponse);
|
||||
Some(payment_types::ApplePaySessionResponse::NoSessionResponse(
|
||||
api_models::payments::NullObject,
|
||||
));
|
||||
create_apple_pay_session_response(
|
||||
router_data,
|
||||
delayed_response_apple_pay_session,
|
||||
|
||||
@ -563,22 +563,6 @@ pub async fn connector_create(
|
||||
///
|
||||
/// Retrieve Merchant Connector Details
|
||||
#[cfg(feature = "v1")]
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/accounts/{account_id}/connectors/{connector_id}",
|
||||
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 retrieved successfully", body = MerchantConnectorResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "Retrieve a Merchant Connector",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsRetrieve))]
|
||||
pub async fn connector_retrieve(
|
||||
state: web::Data<AppState>,
|
||||
@ -701,21 +685,6 @@ pub async fn connector_list(
|
||||
/// Merchant Connector - List
|
||||
///
|
||||
/// List Merchant Connector Details for the merchant
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/accounts/{account_id}/connectors",
|
||||
params(
|
||||
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
|
||||
),
|
||||
responses(
|
||||
(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")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "List all Merchant Connectors Admin",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsList))]
|
||||
pub async fn connector_list(
|
||||
@ -749,21 +718,6 @@ pub async fn connector_list(
|
||||
/// Merchant Connector - List
|
||||
///
|
||||
/// List Merchant Connector Details for the merchant
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/accounts/{account_id}/profile/connectors",
|
||||
params(
|
||||
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
|
||||
),
|
||||
responses(
|
||||
(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")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "List all Merchant Connectors for The given Profile",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsList))]
|
||||
pub async fn connector_list_profile(
|
||||
state: web::Data<AppState>,
|
||||
@ -802,23 +756,6 @@ pub async fn connector_list_profile(
|
||||
///
|
||||
/// To update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc.
|
||||
#[cfg(feature = "v1")]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/accounts/{account_id}/connectors/{connector_id}",
|
||||
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 = MerchantConnectorResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "Update a Merchant Connector",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsUpdate))]
|
||||
pub async fn connector_update(
|
||||
state: web::Data<AppState>,
|
||||
@ -863,22 +800,6 @@ pub async fn connector_update(
|
||||
///
|
||||
/// To update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc.
|
||||
#[cfg(feature = "v2")]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/connector_accounts/{id}",
|
||||
request_body = MerchantConnectorUpdate,
|
||||
params(
|
||||
("id" = i32, Path, description = "The unique identifier for the Merchant Connector")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Merchant Connector Updated", body = MerchantConnectorResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "Update a Merchant Connector",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsUpdate))]
|
||||
pub async fn connector_update(
|
||||
state: web::Data<AppState>,
|
||||
@ -913,22 +834,6 @@ pub async fn connector_update(
|
||||
///
|
||||
/// Delete or Detach a Merchant Connector from Merchant Account
|
||||
#[cfg(feature = "v1")]
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/accounts/{account_id}/connectors/{connector_id}",
|
||||
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 Deleted", body = MerchantConnectorDeleteResponse),
|
||||
(status = 404, description = "Merchant Connector does not exist in records"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Merchant Connector Account",
|
||||
operation_id = "Delete a Merchant Connector",
|
||||
security(("admin_api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsDelete))]
|
||||
pub async fn connector_delete(
|
||||
state: web::Data<AppState>,
|
||||
|
||||
@ -11,20 +11,6 @@ use crate::{
|
||||
/// Mandates - Retrieve Mandate
|
||||
///
|
||||
/// Retrieves a mandate created using the Payments/Create API
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/mandates/{mandate_id}",
|
||||
params(
|
||||
("mandate_id" = String, Path, description = "The identifier for mandate")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "The mandate was retrieved successfully", body = MandateResponse),
|
||||
(status = 404, description = "Mandate does not exist in our records")
|
||||
),
|
||||
tag = "Mandates",
|
||||
operation_id = "Retrieve a Mandate",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MandatesRetrieve))]
|
||||
// #[get("/{id}")]
|
||||
pub async fn get_mandate(
|
||||
@ -87,28 +73,6 @@ pub async fn revoke_mandate(
|
||||
.await
|
||||
}
|
||||
/// Mandates - List Mandates
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/mandates/list",
|
||||
params(
|
||||
("limit" = Option<i64>, Query, description = "The maximum number of Mandate Objects to include in the response"),
|
||||
("mandate_status" = Option<MandateStatus>, Query, description = "The status of mandate"),
|
||||
("connector" = Option<String>, Query, description = "The connector linked to mandate"),
|
||||
("created_time" = Option<PrimitiveDateTime>, Query, description = "The time at which mandate is created"),
|
||||
("created_time.lt" = Option<PrimitiveDateTime>, Query, description = "Time less than the mandate created time"),
|
||||
("created_time.gt" = Option<PrimitiveDateTime>, Query, description = "Time greater than the mandate created time"),
|
||||
("created_time.lte" = Option<PrimitiveDateTime>, Query, description = "Time less than or equals to the mandate created time"),
|
||||
("created_time.gte" = Option<PrimitiveDateTime>, Query, description = "Time greater than or equals to the mandate created time"),
|
||||
("offset" = Option<i64>, Query, description = "The number of Mandate Objects to skip when retrieving the list Mandates."),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "The mandate list was retrieved successfully", body = Vec<MandateResponse>),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Mandates",
|
||||
operation_id = "List Mandates",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::MandatesList))]
|
||||
pub async fn retrieve_mandates_list(
|
||||
state: web::Data<AppState>,
|
||||
|
||||
@ -11,21 +11,6 @@ use crate::{
|
||||
/// Payments Link - Retrieve
|
||||
///
|
||||
/// To retrieve the properties of a Payment Link. This may be used to get the status of a previously initiated payment or next action for an ongoing payment
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/payment_link/{payment_link_id}",
|
||||
params(
|
||||
("payment_link_id" = String, Path, description = "The identifier for payment link")
|
||||
),
|
||||
request_body=RetrievePaymentLinkRequest,
|
||||
responses(
|
||||
(status = 200, description = "Gets details regarding payment link", body = RetrievePaymentLinkResponse),
|
||||
(status = 404, description = "No payment link found")
|
||||
),
|
||||
tag = "Payments",
|
||||
operation_id = "Retrieve a Payment Link",
|
||||
security(("api_key" = []), ("publishable_key" = []))
|
||||
)]
|
||||
#[instrument(skip(state, req), fields(flow = ?Flow::PaymentLinkRetrieve))]
|
||||
pub async fn payment_link_retrieve(
|
||||
state: web::Data<AppState>,
|
||||
@ -133,26 +118,6 @@ pub async fn initiate_secure_payment_link(
|
||||
/// Payment Link - List
|
||||
///
|
||||
/// To list the payment links
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/payment_link/list",
|
||||
params(
|
||||
("limit" = Option<i64>, Query, description = "The maximum number of payment_link Objects to include in the response"),
|
||||
("connector" = Option<String>, Query, description = "The connector linked to payment_link"),
|
||||
("created_time" = Option<PrimitiveDateTime>, Query, description = "The time at which payment_link is created"),
|
||||
("created_time.lt" = Option<PrimitiveDateTime>, Query, description = "Time less than the payment_link created time"),
|
||||
("created_time.gt" = Option<PrimitiveDateTime>, Query, description = "Time greater than the payment_link created time"),
|
||||
("created_time.lte" = Option<PrimitiveDateTime>, Query, description = "Time less than or equals to the payment_link created time"),
|
||||
("created_time.gte" = Option<PrimitiveDateTime>, Query, description = "Time greater than or equals to the payment_link created time"),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "The payment link list was retrieved successfully"),
|
||||
(status = 401, description = "Unauthorized request")
|
||||
),
|
||||
tag = "Payment Link",
|
||||
operation_id = "List all Payment links",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::PaymentLinkList))]
|
||||
pub async fn payments_link_list(
|
||||
state: web::Data<AppState>,
|
||||
|
||||
@ -469,26 +469,6 @@ pub async fn list_payment_method_api(
|
||||
/// List payment methods for a Customer
|
||||
///
|
||||
/// To filter and list the applicable payment methods for a particular Customer ID
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/customers/{customer_id}/payment_methods",
|
||||
params (
|
||||
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
|
||||
("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
|
||||
("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
|
||||
("maximum_amount" = i64, Query, description = "The maximum amount amount accepted for processing by the particular payment method."),
|
||||
("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
|
||||
("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
|
||||
),
|
||||
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" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
|
||||
pub async fn list_customer_payment_method_api(
|
||||
state: web::Data<AppState>,
|
||||
@ -532,27 +512,6 @@ pub async fn list_customer_payment_method_api(
|
||||
/// List payment methods for a Customer
|
||||
///
|
||||
/// To filter and list the applicable payment methods for a particular Customer ID
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/customers/payment_methods",
|
||||
params (
|
||||
("client-secret" = String, Path, description = "A secret known only to your application and the authorization server"),
|
||||
("accepted_country" = Vec<String>, Query, description = "The two-letter ISO currency code"),
|
||||
("accepted_currency" = Vec<Currency>, Path, description = "The three-letter ISO currency code"),
|
||||
("minimum_amount" = i64, Query, description = "The minimum amount accepted for processing by the particular payment method."),
|
||||
("maximum_amount" = i64, Query, description = "The maximum amount amount accepted for processing by the particular payment method."),
|
||||
("recurring_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for recurring payments"),
|
||||
("installment_payment_enabled" = bool, Query, description = "Indicates whether the payment method is eligible for installment payments"),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment Methods retrieved for customer tied to its respective client-secret passed in the param", 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" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))]
|
||||
pub async fn list_customer_payment_method_api_client(
|
||||
state: web::Data<AppState>,
|
||||
|
||||
@ -48,18 +48,6 @@ mod internal_payload_types {
|
||||
///
|
||||
/// To create a refund against an already processed payment
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "refunds_v2")))]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/refunds",
|
||||
request_body=RefundRequest,
|
||||
responses(
|
||||
(status = 200, description = "Refund created", body = RefundResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "Create a Refund",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsCreate))]
|
||||
// #[post("")]
|
||||
pub async fn refunds_create(
|
||||
@ -150,20 +138,6 @@ pub async fn refunds_create(
|
||||
/// Refunds - Retrieve (GET)
|
||||
///
|
||||
/// To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/refunds/{refund_id}",
|
||||
params(
|
||||
("refund_id" = String, Path, description = "The identifier for refund")
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Refund retrieved", body = RefundResponse),
|
||||
(status = 404, description = "Refund does not exist in our records")
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "Retrieve a Refund",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow))]
|
||||
// #[get("/{id}")]
|
||||
pub async fn refunds_retrieve(
|
||||
@ -270,17 +244,6 @@ pub async fn refunds_retrieve(
|
||||
/// Refunds - Retrieve (POST)
|
||||
///
|
||||
/// To retrieve the properties of a Refund. This may be used to get the status of a previously initiated payment or next action for an ongoing payment
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/refunds/sync",
|
||||
responses(
|
||||
(status = 200, description = "Refund retrieved", body = RefundResponse),
|
||||
(status = 404, description = "Refund does not exist in our records")
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "Retrieve a Refund",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow))]
|
||||
// #[post("/sync")]
|
||||
pub async fn refunds_retrieve_with_body(
|
||||
@ -325,21 +288,6 @@ pub async fn refunds_retrieve_with_body(
|
||||
/// Refunds - Update
|
||||
///
|
||||
/// To update the properties of a Refund object. This may include attaching a reason for the refund or metadata fields
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/refunds/{refund_id}",
|
||||
params(
|
||||
("refund_id" = String, Path, description = "The identifier for refund")
|
||||
),
|
||||
request_body=RefundUpdateRequest,
|
||||
responses(
|
||||
(status = 200, description = "Refund updated", body = RefundResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "Update a Refund",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsUpdate))]
|
||||
// #[post("/{id}")]
|
||||
pub async fn refunds_update(
|
||||
@ -418,17 +366,6 @@ pub async fn refunds_metadata_update(
|
||||
/// Refunds - List
|
||||
///
|
||||
/// To list the refunds associated with a payment_id or with the merchant, if payment_id is not provided
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/refunds/list",
|
||||
request_body=RefundListRequest,
|
||||
responses(
|
||||
(status = 200, description = "List of refunds", body = RefundListResponse),
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all Refunds",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsList))]
|
||||
pub async fn refunds_list(
|
||||
state: web::Data<AppState>,
|
||||
@ -501,17 +438,6 @@ pub async fn refunds_list(
|
||||
/// Refunds - List at profile level
|
||||
///
|
||||
/// To list the refunds associated with a payment_id or with the merchant, if payment_id is not provided
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/refunds/profile/list",
|
||||
request_body=RefundListRequest,
|
||||
responses(
|
||||
(status = 200, description = "List of refunds", body = RefundListResponse),
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all Refunds",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsList))]
|
||||
pub async fn refunds_list_profile(
|
||||
state: web::Data<AppState>,
|
||||
@ -558,17 +484,6 @@ pub async fn refunds_list_profile(
|
||||
/// Refunds - Filter
|
||||
///
|
||||
/// To list the refunds filters associated with list of connectors, currencies and payment statuses
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/refunds/filter",
|
||||
request_body=TimeRange,
|
||||
responses(
|
||||
(status = 200, description = "List of filters", body = RefundListMetaData),
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all filters for Refunds",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsList))]
|
||||
pub async fn refunds_filter_list(
|
||||
state: web::Data<AppState>,
|
||||
@ -610,16 +525,6 @@ pub async fn refunds_filter_list(
|
||||
/// Refunds - Filter V2
|
||||
///
|
||||
/// To list the refunds filters associated with list of connectors, currencies and payment statuses
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/refunds/v2/filter",
|
||||
responses(
|
||||
(status = 200, description = "List of static filters", body = RefundListFilters),
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all filters for Refunds",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsFilters))]
|
||||
pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse {
|
||||
let flow = Flow::RefundsFilters;
|
||||
@ -657,16 +562,6 @@ pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -
|
||||
/// Refunds - Filter V2 at profile level
|
||||
///
|
||||
/// To list the refunds filters associated with list of connectors, currencies and payment statuses
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/refunds/v2/profile/filter",
|
||||
responses(
|
||||
(status = 200, description = "List of static filters", body = RefundListFilters),
|
||||
),
|
||||
tag = "Refunds",
|
||||
operation_id = "List all filters for Refunds",
|
||||
security(("api_key" = []))
|
||||
)]
|
||||
#[instrument(skip_all, fields(flow = ?Flow::RefundsFilters))]
|
||||
pub async fn get_refunds_filters_profile(
|
||||
state: web::Data<AppState>,
|
||||
|
||||
Reference in New Issue
Block a user