mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 11:24:45 +08:00
feat(payment_method_session): implement payment methods session confirm (#7248)
Co-authored-by: Sanchith Hegde <sanchith.hegde@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Anurag Thakur <anurag.thakur@juspay.in> Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com> Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Co-authored-by: Sai Harsha Vardhan <56996463+sai-harsha-vardhan@users.noreply.github.com> Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: Debarati Ghatak <88573135+cookieg13@users.noreply.github.com> Co-authored-by: awasthi21 <107559116+awasthi21@users.noreply.github.com> Co-authored-by: Gnanasundari24 <118818938+Gnanasundari24@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Arindam Sahoo <88739246+arindam-sahoo@users.noreply.github.com> Co-authored-by: Arindam Sahoo <arindam.sahoo@Arindam-Sahoo-F565040VFJ.local> Co-authored-by: Sakil Mostak <73734619+Sakilmostak@users.noreply.github.com> Co-authored-by: AkshayaFoiger <131388445+AkshayaFoiger@users.noreply.github.com> Co-authored-by: Riddhiagrawal001 <50551695+Riddhiagrawal001@users.noreply.github.com> Co-authored-by: Suman Maji <77887221+sumanmaji4@users.noreply.github.com> Co-authored-by: Sandeep Kumar <83278309+tsdk02@users.noreply.github.com> Co-authored-by: Debarshi Gupta <debarshigupta47@gmail.com> Co-authored-by: Debarshi Gupta <debarshi.gupta@Debarshi-Gupta-CM92YWDXFD.local> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com> Co-authored-by: Swangi Kumari <85639103+swangi-kumari@users.noreply.github.com> Co-authored-by: pranav-arjunan <pranav.arjunan@juspay.in> Co-authored-by: Kashif <kashif.dev@protonmail.com> Co-authored-by: Sagnik Mitra <83326850+ImSagnik007@users.noreply.github.com> Co-authored-by: sweta-kumari-sharma <77436883+Sweta-Kumari-Sharma@users.noreply.github.com> Co-authored-by: shivansh.mathur <shivansh.mathur@juspay.in>
This commit is contained in:
@ -143,6 +143,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
routes::payment_method::payment_method_session_retrieve,
|
||||
routes::payment_method::payment_method_session_list_payment_methods,
|
||||
routes::payment_method::payment_method_session_update_saved_payment_method,
|
||||
routes::payment_method::payment_method_session_confirm,
|
||||
|
||||
//Routes for refunds
|
||||
routes::refunds::refunds_create,
|
||||
@ -504,7 +505,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::ExternalAuthenticationDetailsResponse,
|
||||
api_models::payments::ExtendedCardInfo,
|
||||
api_models::payments::PaymentsConfirmIntentRequest,
|
||||
api_models::payments::PaymentsConfirmIntentResponse,
|
||||
api_models::payments::AmountDetailsResponse,
|
||||
api_models::payments::BankCodeResponse,
|
||||
api_models::payments::Order,
|
||||
@ -521,8 +521,8 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payment_methods::PaymentMethodCollectLinkResponse,
|
||||
api_models::payment_methods::PaymentMethodSubtypeSpecificData,
|
||||
api_models::payment_methods::PaymentMethodSessionRequest,
|
||||
api_models::payment_methods::PaymentMethodsSessionResponse,
|
||||
api_models::payments::PaymentsRetrieveResponse,
|
||||
api_models::payment_methods::PaymentMethodSessionResponse,
|
||||
api_models::payment_methods::PaymentMethodsSessionUpdateRequest,
|
||||
api_models::refunds::RefundListRequest,
|
||||
api_models::refunds::RefundListResponse,
|
||||
api_models::payments::AmountFilter,
|
||||
@ -689,6 +689,8 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::enums::TokenizationType,
|
||||
api_models::enums::NetworkTokenizationToggle,
|
||||
api_models::payments::PaymentAmountDetailsResponse,
|
||||
api_models::payment_methods::PaymentMethodSessionConfirmRequest,
|
||||
api_models::payment_methods::PaymentMethodSessionResponse,
|
||||
routes::payments::ForceSync,
|
||||
)),
|
||||
modifiers(&SecurityAddon)
|
||||
|
||||
@ -360,7 +360,7 @@ pub async fn list_customer_payment_method_api() {}
|
||||
)))
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Create the payment method session", body = PaymentMethodsSessionResponse),
|
||||
(status = 200, description = "Create the payment method session", body = PaymentMethodSessionResponse),
|
||||
(status = 400, description = "The request is invalid")
|
||||
),
|
||||
tag = "Payment Method Session",
|
||||
@ -380,7 +380,7 @@ pub fn payment_method_session_create() {}
|
||||
("id" = String, Path, description = "The unique identifier for the Payment Method Session"),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "The payment method session is retrieved successfully", body = PaymentMethodsSessionResponse),
|
||||
(status = 200, description = "The payment method session is retrieved successfully", body = PaymentMethodSessionResponse),
|
||||
(status = 404, description = "The request is invalid")
|
||||
),
|
||||
tag = "Payment Method Session",
|
||||
@ -443,3 +443,48 @@ pub fn payment_method_session_list_payment_methods() {}
|
||||
security(("ephemeral_key" = []))
|
||||
)]
|
||||
pub fn payment_method_session_update_saved_payment_method() {}
|
||||
|
||||
/// Payment Method Session - Confirm a payment method session
|
||||
///
|
||||
/// **Confirms a payment method session object with the payment method data**
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v2/payment-method-session/:id/confirm",
|
||||
params (("id" = String, Path, description = "The unique identifier for the Payment Method Session"),
|
||||
(
|
||||
"X-Profile-Id" = String, Header,
|
||||
description = "Profile ID associated to the payment intent",
|
||||
example = "pro_abcdefghijklmnop"
|
||||
)
|
||||
),
|
||||
request_body(
|
||||
content = PaymentMethodSessionConfirmRequest,
|
||||
examples(
|
||||
(
|
||||
"Confirm the payment method session with card details" = (
|
||||
value = json!({
|
||||
"payment_method_type": "card",
|
||||
"payment_method_subtype": "credit",
|
||||
"payment_method_data": {
|
||||
"card": {
|
||||
"card_number": "4242424242424242",
|
||||
"card_exp_month": "10",
|
||||
"card_exp_year": "25",
|
||||
"card_cvc": "123"
|
||||
}
|
||||
},
|
||||
})
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment Method created", body = PaymentMethodResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
),
|
||||
tag = "Payment Method Session",
|
||||
operation_id = "Confirm the payment method session",
|
||||
security(("publishable_key" = [])),
|
||||
)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub fn payment_method_session_confirm() {}
|
||||
|
||||
@ -727,7 +727,7 @@ pub fn payments_update_intent() {}
|
||||
),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment created", body = PaymentsConfirmIntentResponse),
|
||||
(status = 200, description = "Payment created", body = PaymentsResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
),
|
||||
tag = "Payments",
|
||||
@ -748,7 +748,7 @@ pub fn payments_confirm_intent() {}
|
||||
("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 = 200, description = "Gets the payment with final status", body = PaymentsResponse),
|
||||
(status = 404, description = "No payment found with the given id")
|
||||
),
|
||||
tag = "Payments",
|
||||
|
||||
Reference in New Issue
Block a user