feat(router): add proxy-confirm-intent api for payments in v2 flow (#7215)

Co-authored-by: Nishanth Challa <nishanth.challa@Nishanth-Challa-C0WGKCFHLF.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Aprabhat19 <amishaprabhat@gmail.com>
This commit is contained in:
Aditya Chaurasia
2025-03-05 13:31:21 +05:30
committed by GitHub
parent 629c26c709
commit 30f321bc20
26 changed files with 1246 additions and 97 deletions

View File

@ -55,6 +55,17 @@ pub enum PayoutConnectors {
Wise,
}
#[cfg(feature = "v2")]
/// Whether active attempt is to be set/unset
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub enum UpdateActiveAttempt {
/// Request to set the active attempt id
#[schema(value_type = Option<String>)]
Set(common_utils::id_type::GlobalAttemptId),
/// To unset the active attempt id
Unset,
}
#[cfg(feature = "payouts")]
impl From<PayoutConnectors> for RoutableConnectors {
fn from(value: PayoutConnectors) -> Self {

View File

@ -2661,7 +2661,7 @@ pub struct PaymentMethodSessionResponse {
#[schema(value_type = Option<NextActionData>)]
pub next_action: Option<payments::NextActionData>,
/// The customer authenticaion details for the payment method
/// The customer authentication details for the payment method
/// This refers to either the payment / external authentication details
pub authentication_details: Option<AuthenticationDetails>,

View File

@ -34,6 +34,8 @@ use utoipa::ToSchema;
#[cfg(feature = "v1")]
use crate::ephemeral_key::EphemeralKeyCreateResponse;
#[cfg(feature = "v2")]
use crate::mandates::ProcessorPaymentToken;
#[cfg(feature = "v2")]
use crate::payment_methods;
use crate::{
admin::{self, MerchantConnectorInfo},
@ -422,6 +424,10 @@ pub struct PaymentsUpdateIntentRequest {
#[schema(value_type = Option<External3dsAuthenticationRequest>)]
pub request_external_three_ds_authentication:
Option<common_enums::External3dsAuthenticationRequest>,
#[schema(value_type = Option<UpdateActiveAttempt>)]
/// Whether to set / unset the active attempt id
pub set_active_attempt_id: Option<api_enums::UpdateActiveAttempt>,
}
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
@ -5164,6 +5170,32 @@ pub struct PaymentsConfirmIntentRequest {
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
}
#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct ProxyPaymentsRequest {
/// The URL to which you want the user to be redirected after the completion of the payment operation
/// If this url is not passed, the url configured in the business profile will be used
#[schema(value_type = Option<String>, example = "https://hyperswitch.io")]
pub return_url: Option<common_utils::types::Url>,
pub amount: AmountDetails,
pub recurring_details: ProcessorPaymentToken,
pub shipping: Option<Address>,
/// Additional details required by 3DS 2.0
#[schema(value_type = Option<BrowserInformation>)]
pub browser_info: Option<common_utils::types::BrowserInformation>,
#[schema(example = "stripe")]
pub connector: String,
#[schema(value_type = String)]
pub merchant_connector_id: id_type::MerchantConnectorAccountId,
}
// This struct contains the union of fields in `PaymentsCreateIntentRequest` and
// `PaymentsConfirmIntentRequest`
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
@ -5405,7 +5437,7 @@ pub struct ConnectorTokenDetails {
/// Response for Payment Intent Confirm
/// Few fields should be expandable, we need not return these in the normal response
/// But when explictly requested for expanded objects, these can be returned
/// But when explicitly requested for expanded objects, these can be returned
/// For example
/// shipping, billing, customer, payment_method
#[cfg(feature = "v2")]