feat(openapi): add payment get to openapi (#6539)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
This commit is contained in:
Narayan Bhat
2024-11-13 15:23:40 +05:30
committed by GitHub
parent b82e7429e2
commit 600cf44684
14 changed files with 541 additions and 95 deletions

View File

@ -125,6 +125,7 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payments::payments_create_intent,
routes::payments::payments_get_intent,
routes::payments::payments_confirm_intent,
routes::payments::payment_status,
//Routes for refunds
routes::refunds::refunds_create,
@ -431,6 +432,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::payments::PaymentsRetrieveResponse,
api_models::refunds::RefundListRequest,
api_models::refunds::RefundListResponse,
api_models::payments::AmountFilter,
@ -587,6 +589,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::ErrorDetails,
common_utils::types::BrowserInformation,
api_models::payments::ConfirmIntentAmountDetailsResponse,
routes::payments::ForceSync,
)),
modifiers(&SecurityAddon)
)]

View File

@ -691,3 +691,33 @@ pub fn payments_get_intent() {}
)]
#[cfg(feature = "v2")]
pub fn payments_confirm_intent() {}
/// Payments - Get
///
/// 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
#[utoipa::path(
get,
path = "/v2/payments/{id}",
params(
("id" = String, Path, description = "The global payment id"),
("force_sync" = ForceSync, Query, description = "A boolean to indicate whether to force sync the payment status. Value can be true or false")
),
responses(
(status = 200, description = "Gets the payment with final status", body = PaymentsRetrieveResponse),
(status = 404, description = "No payment found with the given id")
),
tag = "Payments",
operation_id = "Retrieve a Payment",
security(("api_key" = []))
)]
#[cfg(feature = "v2")]
pub fn payment_status() {}
#[derive(utoipa::ToSchema)]
#[schema(rename_all = "lowercase")]
pub(crate) enum ForceSync {
/// Force sync with the connector / processor to update the status
True,
/// Do not force sync with the connector / processor. Get the status which is available in the database
False,
}