Skip to content

Commit

Permalink
feat(connector): [Adyen] Add support for PIX Payment Method (#3236)
Browse files Browse the repository at this point in the history
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
  • Loading branch information
swangi-kumari and hyperswitch-bot[bot] authored Jan 25, 2024
1 parent 3507ad6 commit fc6e68f
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 106 deletions.
27 changes: 26 additions & 1 deletion crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,12 @@ pub enum NextActionData {
/// Contains url for Qr code image, this qr code has to be shown in sdk
QrCodeInformation {
#[schema(value_type = String)]
image_data_url: Url,
/// Hyperswitch generated image data source url
image_data_url: Option<Url>,
display_to_timestamp: Option<i64>,
#[schema(value_type = String)]
/// The url for Qr code given by the connector
qr_code_url: Option<Url>,
},
/// Contains the download url and the reference number for transaction
DisplayVoucherInformation {
Expand All @@ -1907,6 +1911,26 @@ pub enum NextActionData {
},
}

#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
// the enum order shouldn't be changed as this is being used during serialization and deserialization
pub enum QrCodeInformation {
QrCodeUrl {
image_data_url: Url,
qr_code_url: Url,
display_to_timestamp: Option<i64>,
},
QrDataUrl {
image_data_url: Url,
display_to_timestamp: Option<i64>,
},
QrCodeImageUrl {
qr_code_url: Url,
display_to_timestamp: Option<i64>,
},
}

#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct BankTransferNextStepsData {
/// The instructions for performing a bank transfer
Expand All @@ -1932,6 +1956,7 @@ pub struct VoucherNextStepData {
pub struct QrCodeNextStepsInstruction {
pub image_data_url: Url,
pub display_to_timestamp: Option<i64>,
pub qr_code_url: Option<Url>,
}

#[derive(Clone, Debug, serde::Deserialize)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,9 @@ pub enum StripeNextAction {
session_token: Option<payments::SessionToken>,
},
QrCodeInformation {
image_data_url: url::Url,
image_data_url: Option<url::Url>,
display_to_timestamp: Option<i64>,
qr_code_url: Option<url::Url>,
},
DisplayVoucherInformation {
voucher_details: payments::VoucherNextStepData,
Expand Down Expand Up @@ -830,9 +831,11 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
} => StripeNextAction::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
},
payments::NextActionData::DisplayVoucherInformation { voucher_details } => {
StripeNextAction::DisplayVoucherInformation { voucher_details }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,9 @@ pub enum StripeNextAction {
session_token: Option<payments::SessionToken>,
},
QrCodeInformation {
image_data_url: url::Url,
image_data_url: Option<url::Url>,
display_to_timestamp: Option<i64>,
qr_code_url: Option<url::Url>,
},
DisplayVoucherInformation {
voucher_details: payments::VoucherNextStepData,
Expand Down Expand Up @@ -420,9 +421,11 @@ pub(crate) fn into_stripe_next_action(
payments::NextActionData::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
} => StripeNextAction::QrCodeInformation {
image_data_url,
display_to_timestamp,
qr_code_url,
},
payments::NextActionData::DisplayVoucherInformation { voucher_details } => {
StripeNextAction::DisplayVoucherInformation { voucher_details }
Expand Down
Loading

0 comments on commit fc6e68f

Please sign in to comment.