Skip to content

Commit

Permalink
Revert "feat: populate payment method details in payments response (#…
Browse files Browse the repository at this point in the history
…5661)"

This reverts commit 32db5dd.
  • Loading branch information
lsampras authored Sep 3, 2024
1 parent 84f079c commit b9807c6
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 1,958 deletions.
606 changes: 11 additions & 595 deletions api-reference-v2/openapi_spec.json

Large diffs are not rendered by default.

606 changes: 11 additions & 595 deletions api-reference/openapi_spec.json

Large diffs are not rendered by default.

105 changes: 45 additions & 60 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
fmt,
num::NonZeroI64,
};
pub mod additional_info;

use cards::CardNumber;
use common_utils::{
consts::default_payments_list_limit,
Expand Down Expand Up @@ -2026,27 +2026,25 @@ pub enum AdditionalPaymentData {
Card(Box<AdditionalCardInfo>),
BankRedirect {
bank_name: Option<common_enums::BankNames>,
#[serde(flatten)]
additional_details: Option<additional_info::BankRedirectDetails>,
},
Wallet {
apple_pay: Option<ApplepayPaymentMethod>,
},
PayLater {
klarna_sdk: Option<KlarnaSdkPaymentMethod>,
},
BankTransfer(additional_info::BankTransferAdditionalData),
Crypto(CryptoData),
BankDebit(additional_info::BankDebitAdditionalData),
BankTransfer {},
Crypto {},
BankDebit {},
MandatePayment {},
Reward {},
RealTimePayment(RealTimePaymentData),
Upi(additional_info::UpiAdditionalData),
GiftCard(additional_info::GiftCardAdditionalData),
Voucher(VoucherData),
CardRedirect(CardRedirectData),
CardToken(additional_info::CardTokenAdditionalData),
OpenBanking(OpenBankingData),
RealTimePayment {},
Upi {},
GiftCard {},
Voucher {},
CardRedirect {},
CardToken {},
OpenBanking {},
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
Expand Down Expand Up @@ -3013,21 +3011,21 @@ where
{
match payment_method_data {
PaymentMethodDataResponse::Reward {} => serializer.serialize_str("reward"),
PaymentMethodDataResponse::BankDebit(_)
| PaymentMethodDataResponse::BankRedirect(_)
PaymentMethodDataResponse::BankDebit {}
| PaymentMethodDataResponse::BankRedirect {}
| PaymentMethodDataResponse::Card(_)
| PaymentMethodDataResponse::CardRedirect(_)
| PaymentMethodDataResponse::CardToken(_)
| PaymentMethodDataResponse::Crypto(_)
| PaymentMethodDataResponse::CardRedirect {}
| PaymentMethodDataResponse::CardToken {}
| PaymentMethodDataResponse::Crypto {}
| PaymentMethodDataResponse::MandatePayment {}
| PaymentMethodDataResponse::GiftCard(_)
| PaymentMethodDataResponse::GiftCard {}
| PaymentMethodDataResponse::PayLater(_)
| PaymentMethodDataResponse::RealTimePayment(_)
| PaymentMethodDataResponse::Upi(_)
| PaymentMethodDataResponse::RealTimePayment {}
| PaymentMethodDataResponse::Upi {}
| PaymentMethodDataResponse::Wallet {}
| PaymentMethodDataResponse::BankTransfer(_)
| PaymentMethodDataResponse::OpenBanking(_)
| PaymentMethodDataResponse::Voucher(_) => {
| PaymentMethodDataResponse::BankTransfer {}
| PaymentMethodDataResponse::OpenBanking {}
| PaymentMethodDataResponse::Voucher {} => {
payment_method_data_response.serialize(serializer)
}
}
Expand All @@ -3043,28 +3041,23 @@ where
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum PaymentMethodDataResponse {
#[serde(rename = "card")]
Card(Box<CardResponse>),
#[schema(value_type = BankTransferAdditionalData)]
BankTransfer(additional_info::BankTransferAdditionalData),
BankTransfer {},
Wallet {},
PayLater(Box<PaylaterResponse>),
#[schema(value_type = BankRedirectAdditionalData)]
BankRedirect(additional_info::BankRedirectAdditionalData),
Crypto(CryptoData),
#[schema(value_type = BankDebitAdditionalData)]
BankDebit(additional_info::BankDebitAdditionalData),
BankRedirect {},
Crypto {},
BankDebit {},
MandatePayment {},
Reward {},
RealTimePayment(RealTimePaymentData),
#[schema(value_type = UpiAdditionalData)]
Upi(additional_info::UpiAdditionalData),
Voucher(VoucherData),
#[schema(value_type = GiftCardAdditionalData)]
GiftCard(additional_info::GiftCardAdditionalData),
CardRedirect(CardRedirectData),
#[schema(value_type = CardTokenAdditionalData)]
CardToken(additional_info::CardTokenAdditionalData),
OpenBanking(OpenBankingData),
RealTimePayment {},
Upi {},
Voucher {},
GiftCard {},
CardRedirect {},
CardToken {},
OpenBanking {},
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
Expand Down Expand Up @@ -4306,27 +4299,19 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
None => Self::PayLater(Box::new(PaylaterResponse { klarna_sdk: None })),
},
AdditionalPaymentData::Wallet { .. } => Self::Wallet {},
AdditionalPaymentData::BankRedirect {
bank_name,
additional_details,
} => Self::BankRedirect(additional_info::BankRedirectAdditionalData {
bank_name,
additional_details,
}),
AdditionalPaymentData::Crypto(crypto) => Self::Crypto(crypto),
AdditionalPaymentData::BankDebit(bank_debit) => Self::BankDebit(bank_debit),
AdditionalPaymentData::BankRedirect { .. } => Self::BankRedirect {},
AdditionalPaymentData::Crypto {} => Self::Crypto {},
AdditionalPaymentData::BankDebit {} => Self::BankDebit {},
AdditionalPaymentData::MandatePayment {} => Self::MandatePayment {},
AdditionalPaymentData::Reward {} => Self::Reward {},
AdditionalPaymentData::RealTimePayment(realtime_payment) => {
Self::RealTimePayment(realtime_payment)
}
AdditionalPaymentData::Upi(upi) => Self::Upi(upi),
AdditionalPaymentData::BankTransfer(bank_transfer) => Self::BankTransfer(bank_transfer),
AdditionalPaymentData::Voucher(voucher) => Self::Voucher(voucher),
AdditionalPaymentData::GiftCard(gift_card) => Self::GiftCard(gift_card),
AdditionalPaymentData::CardRedirect(card_redirect) => Self::CardRedirect(card_redirect),
AdditionalPaymentData::CardToken(card_token) => Self::CardToken(card_token),
AdditionalPaymentData::OpenBanking(open_banking) => Self::OpenBanking(open_banking),
AdditionalPaymentData::RealTimePayment {} => Self::RealTimePayment {},
AdditionalPaymentData::Upi {} => Self::Upi {},
AdditionalPaymentData::BankTransfer {} => Self::BankTransfer {},
AdditionalPaymentData::Voucher {} => Self::Voucher {},
AdditionalPaymentData::GiftCard {} => Self::GiftCard {},
AdditionalPaymentData::CardRedirect {} => Self::CardRedirect {},
AdditionalPaymentData::CardToken {} => Self::CardToken {},
AdditionalPaymentData::OpenBanking {} => Self::OpenBanking {},
}
}
}
Expand Down
220 changes: 0 additions & 220 deletions crates/api_models/src/payments/additional_info.rs

This file was deleted.

Loading

0 comments on commit b9807c6

Please sign in to comment.