mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor: make NextAction as enum (#1234)
This commit is contained in:
committed by
GitHub
parent
48e537568d
commit
a359b76d09
@ -1067,21 +1067,20 @@ pub enum NextActionType {
|
||||
TriggerApi,
|
||||
DisplayBankTransferInformation,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, ToSchema)]
|
||||
pub struct NextAction {
|
||||
/// Specifying the action type to be performed next
|
||||
#[serde(rename = "type")]
|
||||
pub next_action_type: NextActionType,
|
||||
//TODO: Make an enum having redirect_to_url and bank_transfer_steps_and_charges_details and use here
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum NextActionData {
|
||||
/// Contains the url for redirection flow
|
||||
#[schema(example = "https://router.juspay.io/redirect/fakushdfjlksdfasklhdfj")]
|
||||
pub redirect_to_url: Option<String>,
|
||||
RedirectToUrl { redirect_to_url: String },
|
||||
/// Informs the next steps for bank transfer and also contains the charges details (ex: amount received, amount charged etc)
|
||||
pub bank_transfer_steps_and_charges_details: Option<NextStepsRequirements>,
|
||||
DisplayBankTransferInformation {
|
||||
bank_transfer_steps_and_charges_details: BankTransferNextStepsData,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct NextStepsRequirements {
|
||||
pub struct BankTransferNextStepsData {
|
||||
#[serde(flatten)]
|
||||
pub bank_transfer_instructions: BankTransferInstructions,
|
||||
pub receiver: ReceiverDetails,
|
||||
@ -1268,7 +1267,7 @@ pub struct PaymentsResponse {
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
|
||||
/// Additional information required for redirection
|
||||
pub next_action: Option<NextAction>,
|
||||
pub next_action: Option<NextActionData>,
|
||||
|
||||
/// If the payment was cancelled the reason provided here
|
||||
pub cancellation_reason: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user