mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(payments_v2): add payment_confirm_intent api endpoint (#6263)
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: sai-harsha-vardhan <harsha111hero@gmail.com> Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Co-authored-by: spritianeja03 <146620839+spritianeja03@users.noreply.github.com> Co-authored-by: Spriti Aneja <spriti.aneja@juspay.in>
This commit is contained in:
@ -16,8 +16,8 @@ common_utils = { version = "0.1.0", path = "../common_utils", features = ["logs"
|
||||
router_env = { version = "0.1.0", path = "../router_env" }
|
||||
|
||||
[features]
|
||||
v2 = ["api_models/v2", "api_models/customer_v2"]
|
||||
v1 = ["api_models/v1"]
|
||||
v2 = ["api_models/v2", "api_models/customer_v2", "common_utils/v2"]
|
||||
v1 = ["api_models/v1", "common_utils/v1"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@ -6,6 +6,9 @@ mod routes;
|
||||
|
||||
#[allow(clippy::print_stdout)] // Using a logger is not necessary here
|
||||
fn main() {
|
||||
#[cfg(all(feature = "v1", feature = "v2"))]
|
||||
compile_error!("features v1 and v2 are mutually exclusive, please enable only one of them");
|
||||
|
||||
#[cfg(feature = "v1")]
|
||||
let relative_file_path = "api-reference/openapi_spec.json";
|
||||
|
||||
|
||||
@ -123,6 +123,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
|
||||
//Routes for payments
|
||||
routes::payments::payments_create_intent,
|
||||
routes::payments::payments_confirm_intent,
|
||||
|
||||
//Routes for refunds
|
||||
routes::refunds::refunds_create,
|
||||
@ -130,6 +131,7 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
components(schemas(
|
||||
common_utils::types::MinorUnit,
|
||||
common_utils::types::TimeRange,
|
||||
common_utils::types::BrowserInformation,
|
||||
common_utils::link_utils::GenericLinkUiConfig,
|
||||
common_utils::link_utils::EnabledPaymentMethod,
|
||||
common_utils::payout_method_utils::AdditionalPayoutMethodData,
|
||||
@ -315,10 +317,6 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::CardRedirectData,
|
||||
api_models::payments::CardToken,
|
||||
api_models::payments::CustomerAcceptance,
|
||||
api_models::payments::PaymentsRequest,
|
||||
api_models::payments::PaymentsCreateRequest,
|
||||
api_models::payments::PaymentsUpdateRequest,
|
||||
api_models::payments::PaymentsConfirmRequest,
|
||||
api_models::payments::PaymentsResponse,
|
||||
api_models::payments::PaymentsCreateResponseOpenApi,
|
||||
api_models::payments::PaymentRetrieveBody,
|
||||
@ -415,13 +413,15 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::ThreeDsCompletionIndicator,
|
||||
api_models::payments::MifinityData,
|
||||
api_models::enums::TransactionStatus,
|
||||
api_models::payments::BrowserInformation,
|
||||
api_models::payments::PaymentCreatePaymentLinkConfig,
|
||||
api_models::payments::ThreeDsData,
|
||||
api_models::payments::ThreeDsMethodData,
|
||||
api_models::payments::PollConfigResponse,
|
||||
api_models::payments::ExternalAuthenticationDetailsResponse,
|
||||
api_models::payments::ExtendedCardInfo,
|
||||
api_models::payments::PaymentsConfirmIntentRequest,
|
||||
api_models::payments::PaymentsConfirmIntentResponse,
|
||||
api_models::payments::AmountDetailsResponse,
|
||||
api_models::payment_methods::RequiredFieldInfo,
|
||||
api_models::payment_methods::DefaultPaymentMethod,
|
||||
api_models::payment_methods::MaskedBankDetails,
|
||||
@ -584,6 +584,9 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::payments::PaymentsDynamicTaxCalculationRequest,
|
||||
api_models::payments::PaymentsDynamicTaxCalculationResponse,
|
||||
api_models::payments::DisplayAmountOnSdk,
|
||||
api_models::payments::ErrorDetails,
|
||||
common_utils::types::BrowserInformation,
|
||||
api_models::payments::ConfirmIntentAmountDetailsResponse,
|
||||
)),
|
||||
modifiers(&SecurityAddon)
|
||||
)]
|
||||
|
||||
@ -405,7 +405,7 @@ pub fn payments_connector_session() {}
|
||||
/// Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v2/payments/{payment_id}/create_external_sdk_tokens",
|
||||
path = "/v2/payments/{payment_id}/create-external-sdk-tokens",
|
||||
request_body=PaymentsSessionRequest,
|
||||
responses(
|
||||
(status = 200, description = "Payment session object created or session token was retrieved from wallets", body = PaymentsSessionResponse),
|
||||
@ -629,3 +629,43 @@ pub fn payments_post_session_tokens() {}
|
||||
)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub fn payments_create_intent() {}
|
||||
|
||||
/// Payments - Confirm Intent
|
||||
///
|
||||
/// **Confirms a payment intent object with the payment method data**
|
||||
///
|
||||
/// .
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v2/payments/{id}/confirm-intent",
|
||||
request_body(
|
||||
content = PaymentsConfirmIntentRequest,
|
||||
examples(
|
||||
(
|
||||
"Confirm the payment intent with card details" = (
|
||||
value = json!({
|
||||
"payment_method_type": "card",
|
||||
"payment_method_data": {
|
||||
"card": {
|
||||
"card_number": "4242424242424242",
|
||||
"card_exp_month": "10",
|
||||
"card_exp_year": "25",
|
||||
"card_holder_name": "joseph Doe",
|
||||
"card_cvc": "123"
|
||||
}
|
||||
},
|
||||
})
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Payment created", body = PaymentsConfirmIntentResponse),
|
||||
(status = 400, description = "Missing Mandatory fields")
|
||||
),
|
||||
tag = "Payments",
|
||||
operation_id = "Confirm Payment Intent",
|
||||
security(("publisable_key" = [])),
|
||||
)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub fn payments_confirm_intent() {}
|
||||
|
||||
Reference in New Issue
Block a user