feat(core): Add payments update-intent API for v2 (#6490)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Anurag Thakur
2024-12-09 12:50:07 +05:30
committed by GitHub
parent 079379e729
commit 19f810aed8
23 changed files with 1449 additions and 515 deletions

View File

@ -124,6 +124,7 @@ Never share your secret api keys. Keep them guarded and secure.
//Routes for payments
routes::payments::payments_create_intent,
routes::payments::payments_get_intent,
routes::payments::payments_update_intent,
routes::payments::payments_confirm_intent,
routes::payments::payment_status,
@ -353,9 +354,11 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::PaymentsSessionRequest,
api_models::payments::PaymentsSessionResponse,
api_models::payments::PaymentsCreateIntentRequest,
api_models::payments::PaymentsUpdateIntentRequest,
api_models::payments::PaymentsIntentResponse,
api_models::payments::PazeWalletData,
api_models::payments::AmountDetails,
api_models::payments::AmountDetailsUpdate,
api_models::payments::SessionToken,
api_models::payments::ApplePaySessionResponse,
api_models::payments::ThirdPartySdkSessionResponse,

View File

@ -646,6 +646,43 @@ pub fn payments_create_intent() {}
)]
#[cfg(feature = "v2")]
pub fn payments_get_intent() {}
/// Payments - Update Intent
///
/// **Update a payment intent object**
///
/// You will require the 'API - Key' from the Hyperswitch dashboard to make the call.
#[utoipa::path(
put,
path = "/v2/payments/{id}/update-intent",
params (("id" = String, Path, description = "The unique identifier for the Payment Intent"),
(
"X-Profile-Id" = String, Header,
description = "Profile ID associated to the payment intent",
example = json!({"X-Profile-Id": "pro_abcdefghijklmnop"})
),
),
request_body(
content = PaymentsUpdateIntentRequest,
examples(
(
"Update a payment intent with minimal fields" = (
value = json!({"amount_details": {"order_amount": 6540, "currency": "USD"}})
)
),
),
),
responses(
(status = 200, description = "Payment Intent Updated", body = PaymentsIntentResponse),
(status = 404, description = "Payment Intent Not Found")
),
tag = "Payments",
operation_id = "Update a Payment Intent",
security(("api_key" = [])),
)]
#[cfg(feature = "v2")]
pub fn payments_update_intent() {}
/// Payments - Confirm Intent
///
/// **Confirms a payment intent object with the payment method data**