feat(router): add api_models and openapi changes for payments create intent api for v2 (#5971)

Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in>
Co-authored-by: Narayan Bhat <narayan.bhat@juspay.in>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2024-09-24 13:49:50 +05:30
committed by GitHub
parent 371ed5de04
commit dc6208c5e5
11 changed files with 914 additions and 13 deletions

View File

@ -116,6 +116,9 @@ Never share your secret api keys. Keep them guarded and secure.
routes::customers::customers_update,
routes::customers::customers_delete,
routes::customers::customers_list,
//Routes for payments
routes::payments::payments_create_intent,
),
components(schemas(
common_utils::types::MinorUnit,
@ -304,6 +307,12 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsCaptureRequest,
api_models::payments::PaymentsSessionRequest,
api_models::payments::PaymentsSessionResponse,
api_models::payments::PaymentsCreateIntentRequest,
api_models::payments::PaymentsCreateIntentResponse,
api_models::payments::AmountDetails,
api_models::payments::TaxDetails,
api_models::payments::DefaultTax,
api_models::payments::PaymentMethodTypeTax,
api_models::payments::SessionToken,
api_models::payments::ApplePaySessionResponse,
api_models::payments::ThirdPartySdkSessionResponse,
@ -440,6 +449,13 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::PayoutStatus,
api_models::enums::PayoutType,
api_models::enums::TransactionType,
api_models::enums::PresenceOfCustomerDuringPayment,
api_models::enums::MitExemptionRequest,
api_models::enums::EnablePaymentLinkRequest,
api_models::enums::RequestIncrementalAuthorization,
api_models::enums::External3dsAuthenticationRequest,
api_models::enums::TaxCalculationOverride,
api_models::enums::SurchargeCalculationOverride,
api_models::payments::FrmMessage,
api_models::webhooks::OutgoingWebhook,
api_models::webhooks::OutgoingWebhookContent,

View File

@ -563,3 +563,32 @@ pub fn payments_complete_authorize() {}
)]
pub fn payments_dynamic_tax_calculation() {}
/// Payments - Create Intent
///
/// **Creates a payment intent object when amount_details are passed.**
///
/// You will require the 'API - Key' from the Hyperswitch dashboard to make the first call, and use the 'client secret' returned in this API along with your 'publishable key' to make subsequent API calls from your client.
#[utoipa::path(
post,
path = "/v2/payments/create-intent",
request_body(
content = PaymentsCreateIntentRequest,
examples(
(
"Create a payment intent with minimal fields" = (
value = json!({"amount_details": {"order_amount": 6540, "currency": "USD"}})
)
),
),
),
responses(
(status = 200, description = "Payment created", body = PaymentsCreateIntentResponse),
(status = 400, description = "Missing Mandatory fields")
),
tag = "Payments",
operation_id = "Create a Payment Intent",
security(("api_key" = [])),
)]
#[cfg(feature = "v2")]
pub fn payments_create_intent() {}