mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
feat(router): add start_redirection api for three_ds flow in v2 (#6470)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0389ae74e1
commit
6f24bb4ee3
@ -2,8 +2,8 @@ use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
use super::{
|
||||
PaymentsConfirmIntentResponse, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
|
||||
PaymentsIntentResponse,
|
||||
PaymentStartRedirectionRequest, PaymentsConfirmIntentResponse, PaymentsCreateIntentRequest,
|
||||
PaymentsGetIntentRequest, PaymentsIntentResponse,
|
||||
};
|
||||
#[cfg(all(
|
||||
any(feature = "v2", feature = "v1"),
|
||||
@ -365,3 +365,12 @@ impl ApiEventMetric for PaymentsSessionResponse {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
impl ApiEventMetric for PaymentStartRedirectionRequest {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Payment {
|
||||
payment_id: self.id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -3876,9 +3876,16 @@ pub enum NextActionType {
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum NextActionData {
|
||||
/// Contains the url for redirection flow
|
||||
#[cfg(feature = "v1")]
|
||||
RedirectToUrl {
|
||||
redirect_to_url: String,
|
||||
},
|
||||
/// Contains the url for redirection flow
|
||||
#[cfg(feature = "v2")]
|
||||
RedirectToUrl {
|
||||
#[schema(value_type = String)]
|
||||
redirect_to_url: Url,
|
||||
},
|
||||
/// Informs the next steps for bank transfer and also contains the charges details (ex: amount received, amount charged etc)
|
||||
DisplayBankTransferInformation {
|
||||
bank_transfer_steps_and_charges_details: BankTransferNextStepsData,
|
||||
@ -4538,6 +4545,9 @@ pub struct PaymentsConfirmIntentResponse {
|
||||
#[schema(value_type = PaymentMethodType, example = "apple_pay")]
|
||||
pub payment_method_subtype: api_enums::PaymentMethodType,
|
||||
|
||||
/// Additional information required for redirection
|
||||
pub next_action: Option<NextActionData>,
|
||||
|
||||
/// A unique identifier for a payment provided by the connector
|
||||
#[schema(value_type = Option<String>, example = "993672945374576J")]
|
||||
pub connector_transaction_id: Option<String>,
|
||||
@ -4558,6 +4568,22 @@ pub struct PaymentsConfirmIntentResponse {
|
||||
pub error: Option<ErrorDetails>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub struct PaymentStartRedirectionRequest {
|
||||
/// Global Payment ID
|
||||
pub id: id_type::GlobalPaymentId,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
|
||||
#[cfg(feature = "v2")]
|
||||
pub struct PaymentStartRedirectionParams {
|
||||
/// The identifier for the Merchant Account.
|
||||
pub publishable_key: String,
|
||||
/// The identifier for business profile
|
||||
pub profile_id: id_type::ProfileId,
|
||||
}
|
||||
|
||||
/// Fee information to be charged on the payment being collected
|
||||
#[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize, ToSchema)]
|
||||
pub struct PaymentChargeResponse {
|
||||
|
||||
Reference in New Issue
Block a user