mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 12:15:40 +08:00
feat(stripe): eps, giropay and ideal using stripe (#529)
Co-authored-by: Sangamesh <sangamesh.kulkarni@juspay.in>
This commit is contained in:
@ -295,10 +295,10 @@ pub struct PaymentConnectorCreate {
|
||||
pub struct PaymentMethods {
|
||||
/// Type of payment method.
|
||||
#[schema(value_type = PaymentMethodType,example = "card")]
|
||||
pub payment_method: api_enums::PaymentMethodType,
|
||||
pub payment_method: api_enums::PaymentMethod,
|
||||
/// Subtype of payment method
|
||||
#[schema(value_type = Option<Vec<PaymentMethodSubType>>,example = json!(["credit"]))]
|
||||
pub payment_method_types: Option<Vec<api_enums::PaymentMethodSubType>>,
|
||||
pub payment_method_types: Option<Vec<api_enums::PaymentMethodType>>,
|
||||
/// List of payment method issuers to be enabled for this payment method
|
||||
#[schema(example = json!(["HDFC"]))]
|
||||
pub payment_method_issuers: Option<Vec<String>>,
|
||||
|
||||
@ -420,13 +420,19 @@ pub enum PaymentExperience {
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PaymentMethodSubType {
|
||||
pub enum PaymentMethodType {
|
||||
Credit,
|
||||
Debit,
|
||||
UpiIntent,
|
||||
UpiCollect,
|
||||
CreditCardInstallments,
|
||||
PayLaterInstallments,
|
||||
Giropay,
|
||||
Ideal,
|
||||
Sofort,
|
||||
Eps,
|
||||
Klarna,
|
||||
Affirm,
|
||||
AfterpayClearpay,
|
||||
GooglePay,
|
||||
ApplePay,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -446,20 +452,12 @@ pub enum PaymentMethodSubType {
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PaymentMethodType {
|
||||
Card,
|
||||
PaymentContainer,
|
||||
pub enum PaymentMethod {
|
||||
#[default]
|
||||
BankTransfer,
|
||||
BankDebit,
|
||||
Card,
|
||||
PayLater,
|
||||
Netbanking,
|
||||
Upi,
|
||||
OpenBanking,
|
||||
ConsumerFinance,
|
||||
Wallet,
|
||||
Klarna,
|
||||
Paypal,
|
||||
BankRedirect,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -647,6 +645,79 @@ pub enum SupportedWallets {
|
||||
Gpay,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BankNames {
|
||||
AmericanExpress,
|
||||
BankOfAmerica,
|
||||
Barclays,
|
||||
CapitalOne,
|
||||
Chase,
|
||||
Citi,
|
||||
Discover,
|
||||
NavyFederalCreditUnion,
|
||||
PentagonFederalCreditUnion,
|
||||
SynchronyBank,
|
||||
WellsFargo,
|
||||
AbnAmro,
|
||||
AsnBank,
|
||||
Bunq,
|
||||
Handelsbanken,
|
||||
Ing,
|
||||
Knab,
|
||||
Moneyou,
|
||||
Rabobank,
|
||||
Regiobank,
|
||||
Revolut,
|
||||
SnsBank,
|
||||
TriodosBank,
|
||||
VanLanschot,
|
||||
ArzteUndApothekerBank,
|
||||
AustrianAnadiBankAg,
|
||||
BankAustria,
|
||||
Bank99Ag,
|
||||
BankhausCarlSpangler,
|
||||
BankhausSchelhammerUndSchatteraAg,
|
||||
BawagPskAg,
|
||||
BksBankAg,
|
||||
BrullKallmusBankAg,
|
||||
BtvVierLanderBank,
|
||||
CapitalBankGraweGruppeAg,
|
||||
Dolomitenbank,
|
||||
EasybankAg,
|
||||
ErsteBankUndSparkassen,
|
||||
HypoAlpeadriabankInternationalAg,
|
||||
HypoNoeLbFurNiederosterreichUWien,
|
||||
HypoOberosterreichSalzburgSteiermark,
|
||||
HypoTirolBankAg,
|
||||
HypoVorarlbergBankAg,
|
||||
HypoBankBurgenlandAktiengesellschaft,
|
||||
MarchfelderBank,
|
||||
OberbankAg,
|
||||
OsterreichischeArzteUndApothekerbank,
|
||||
PosojilnicaBankEGen,
|
||||
RaiffeisenBankengruppeOsterreich,
|
||||
SchelhammerCapitalBankAg,
|
||||
SchoellerbankAg,
|
||||
SpardaBankWien,
|
||||
VolksbankGruppe,
|
||||
VolkskreditbankAg,
|
||||
VrBankBraunau,
|
||||
}
|
||||
|
||||
impl From<AttemptStatus> for IntentStatus {
|
||||
fn from(s: AttemptStatus) -> Self {
|
||||
match s {
|
||||
|
||||
@ -11,11 +11,11 @@ use crate::{admin, enums as api_enums};
|
||||
pub struct CreatePaymentMethod {
|
||||
/// The type of payment method use for the payment.
|
||||
#[schema(value_type = PaymentMethodType,example = "card")]
|
||||
pub payment_method: api_enums::PaymentMethodType,
|
||||
pub payment_method: api_enums::PaymentMethod,
|
||||
|
||||
/// This is a sub-category of payment method.
|
||||
#[schema(value_type = Option<PaymentMethodSubType>,example = "credit_card")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodSubType>,
|
||||
#[schema(value_type = Option<PaymentMethodType>,example = "credit")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
|
||||
/// The name of the bank/ provider issuing the payment method to the end user
|
||||
#[schema(example = "Citibank")]
|
||||
@ -94,11 +94,11 @@ pub struct PaymentMethodResponse {
|
||||
|
||||
/// The type of payment method use for the payment.
|
||||
#[schema(value_type = PaymentMethodType,example = "card")]
|
||||
pub payment_method: api_enums::PaymentMethodType,
|
||||
pub payment_method: api_enums::PaymentMethod,
|
||||
|
||||
/// This is a sub-category of payment method.
|
||||
#[schema(value_type = Option<PaymentMethodSubType>,example = "credit_card")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodSubType>,
|
||||
#[schema(value_type = Option<PaymentMethodType>,example = "credit")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
|
||||
/// The name of the bank/ provider issuing the payment method to the end user
|
||||
#[schema(example = "Citibank")]
|
||||
@ -303,11 +303,11 @@ pub struct ListPaymentMethodResponse {
|
||||
pub struct ListPaymentMethod {
|
||||
/// The type of payment method use for the payment.
|
||||
#[schema(value_type = PaymentMethodType,example = "card")]
|
||||
pub payment_method: api_enums::PaymentMethodType,
|
||||
pub payment_method: api_enums::PaymentMethod,
|
||||
|
||||
/// This is a sub-category of payment method.
|
||||
#[schema(value_type = Option<Vec<PaymentMethodSubType>>,example = json!(["credit_card"]))]
|
||||
pub payment_method_types: Option<Vec<api_enums::PaymentMethodSubType>>,
|
||||
pub payment_method_types: Option<Vec<api_enums::PaymentMethodType>>,
|
||||
|
||||
/// The name of the bank/ provider issuing the payment method to the end user
|
||||
#[schema(example = json!(["Citibank"]))]
|
||||
@ -380,7 +380,7 @@ impl serde::Serialize for ListPaymentMethod {
|
||||
state.serialize_field("payment_experience", &self.payment_experience)?;
|
||||
state.serialize_field("eligible_connectors", &self.eligible_connectors)?;
|
||||
match self.payment_method {
|
||||
api_enums::PaymentMethodType::Wallet | api_enums::PaymentMethodType::PayLater => {
|
||||
api_enums::PaymentMethod::Wallet | api_enums::PaymentMethod::PayLater => {
|
||||
state.serialize_field("payment_method_issuers", &self.payment_method_issuers)?;
|
||||
}
|
||||
_ => {
|
||||
@ -437,11 +437,11 @@ pub struct CustomerPaymentMethod {
|
||||
|
||||
/// The type of payment method use for the payment.
|
||||
#[schema(value_type = PaymentMethodType,example = "card")]
|
||||
pub payment_method: api_enums::PaymentMethodType,
|
||||
pub payment_method: api_enums::PaymentMethod,
|
||||
|
||||
/// This is a sub-category of payment method.
|
||||
#[schema(value_type = Option<PaymentMethodSubType>,example = "credit_card")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodSubType>,
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
|
||||
/// The name of the bank/ provider issuing the payment method to the end user
|
||||
#[schema(example = "Citibank")]
|
||||
|
||||
@ -6,7 +6,10 @@ use router_derive::Setter;
|
||||
use time::PrimitiveDateTime;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use crate::{enums as api_enums, refunds};
|
||||
use crate::{
|
||||
enums::{self as api_enums},
|
||||
refunds,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum PaymentOp {
|
||||
@ -28,97 +31,126 @@ pub struct PaymentsRequest {
|
||||
)]
|
||||
#[serde(default, deserialize_with = "payment_id_type::deserialize_option")]
|
||||
pub payment_id: Option<PaymentIdType>,
|
||||
|
||||
/// This is an identifier for the merchant account. This is inferred from the API key
|
||||
/// provided during the request
|
||||
#[schema(max_length = 255, example = "merchant_1668273825")]
|
||||
pub merchant_id: Option<String>,
|
||||
|
||||
/// The payment amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
|
||||
#[schema(value_type = Option<u64>, example = 6540)]
|
||||
#[serde(default, deserialize_with = "amount::deserialize_option")]
|
||||
pub amount: Option<Amount>,
|
||||
|
||||
/// This allows the merchant to manually select a connector with which the payment can go through
|
||||
#[schema(value_type = Option<Connector>, max_length = 255, example = "stripe")]
|
||||
pub connector: Option<Vec<api_enums::Connector>>,
|
||||
/// The currency of the payment request can be specified here
|
||||
#[schema(value_type = Option<Currency>, example = "USD")]
|
||||
pub currency: Option<api_enums::Currency>,
|
||||
|
||||
/// This is the instruction for capture/ debit the money from the users' card. On the other hand authorization refers to blocking the amount on the users' payment method.
|
||||
#[schema(value_type = Option<CaptureMethod>, example = "PaymentProcessor")]
|
||||
pub capture_method: Option<api_enums::CaptureMethod>,
|
||||
|
||||
/// The Amount to be captured/ debited from the users payment method. It shall be in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
|
||||
/// If not provided, the default amount_to_capture will be the payment amount.
|
||||
#[schema(example = 6540)]
|
||||
pub amount_to_capture: Option<i64>,
|
||||
|
||||
/// A timestamp (ISO 8601 code) that determines when the payment should be captured.
|
||||
/// Providing this field will automatically set `capture` to true
|
||||
#[schema(example = "2022-09-10T10:11:12Z")]
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub capture_on: Option<PrimitiveDateTime>,
|
||||
|
||||
/// Whether to confirm the payment (if applicable)
|
||||
#[schema(default = false, example = true)]
|
||||
pub confirm: Option<bool>,
|
||||
|
||||
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
|
||||
#[schema(max_length = 255, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub customer_id: Option<String>,
|
||||
|
||||
/// description: The customer's email address
|
||||
#[schema(max_length = 255, value_type = Option<String>, example = "johntest@test.com")]
|
||||
pub email: Option<Secret<String, pii::Email>>,
|
||||
|
||||
/// description: The customer's name
|
||||
#[schema(value_type = Option<String>, max_length = 255, example = "John Test")]
|
||||
pub name: Option<Secret<String>>,
|
||||
|
||||
/// The customer's phone number
|
||||
#[schema(value_type = Option<String>, max_length = 255, example = "3141592653")]
|
||||
pub phone: Option<Secret<String>>,
|
||||
|
||||
/// The country code for the customer phone number
|
||||
#[schema(max_length = 255, example = "+1")]
|
||||
pub phone_country_code: Option<String>,
|
||||
|
||||
/// Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with `confirm: true`.
|
||||
#[schema(example = true)]
|
||||
pub off_session: Option<bool>,
|
||||
|
||||
/// A description of the payment
|
||||
#[schema(example = "It's my first payment request")]
|
||||
pub description: Option<String>,
|
||||
|
||||
/// The URL to redirect after the completion of the operation
|
||||
#[schema(example = "https://hyperswitch.io")]
|
||||
pub return_url: Option<url::Url>,
|
||||
/// Indicates that you intend to make future payments with this Payment’s payment method. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
|
||||
#[schema(value_type = Option<FutureUsage>, example = "off_session")]
|
||||
pub setup_future_usage: Option<api_enums::FutureUsage>,
|
||||
|
||||
/// The transaction authentication can be set to undergo payer authentication.
|
||||
#[schema(value_type = Option<AuthenticationType>, example = "no_three_ds", default = "three_ds")]
|
||||
pub authentication_type: Option<api_enums::AuthenticationType>,
|
||||
|
||||
/// The payment method information provided for making a payment
|
||||
#[schema(example = "bank_transfer")]
|
||||
pub payment_method_data: Option<PaymentMethod>,
|
||||
pub payment_method_data: Option<PaymentMethodData>,
|
||||
|
||||
/// The payment method that is to be used
|
||||
#[schema(value_type = Option<PaymentMethodType>, example = "bank_transfer")]
|
||||
pub payment_method: Option<api_enums::PaymentMethodType>,
|
||||
pub payment_method: Option<api_enums::PaymentMethod>,
|
||||
|
||||
/// Provide a reference to a stored payment method
|
||||
#[schema(example = "187282ab-40ef-47a9-9206-5099ba31e432")]
|
||||
pub payment_token: Option<String>,
|
||||
|
||||
/// This is used when payment is to be confirmed and the card is not saved
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub card_cvc: Option<Secret<String>>,
|
||||
|
||||
/// The shipping address for the payment
|
||||
pub shipping: Option<Address>,
|
||||
|
||||
/// The billing address for the payment
|
||||
pub billing: Option<Address>,
|
||||
|
||||
/// For non-card charges, you can use this value as the complete description that appears on your customers’ statements. Must contain at least one letter, maximum 22 characters.
|
||||
#[schema(max_length = 255, example = "Juspay Router")]
|
||||
pub statement_descriptor_name: Option<String>,
|
||||
|
||||
/// Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor.
|
||||
#[schema(max_length = 255, example = "Payment for shoes purchase")]
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
|
||||
/// You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
|
||||
pub metadata: Option<Metadata>,
|
||||
|
||||
/// It's a token used for client side verification.
|
||||
#[schema(example = "pay_U42c409qyHwOkWo3vK60_secret_el9ksDkiB8hi6j9N78yo")]
|
||||
pub client_secret: Option<String>,
|
||||
|
||||
/// Provide mandate information for creating a mandate
|
||||
pub mandate_data: Option<MandateData>,
|
||||
|
||||
/// A unique identifier to link the payment to a mandate, can be use instead of payment_method_data
|
||||
#[schema(max_length = 255, example = "mandate_iwer89rnjef349dni3")]
|
||||
pub mandate_id: Option<String>,
|
||||
|
||||
/// Additional details required by 3DS 2.0
|
||||
#[schema(value_type = Option<Object>, example = r#"{
|
||||
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
|
||||
@ -132,12 +164,14 @@ pub struct PaymentsRequest {
|
||||
"java_script_enabled":true
|
||||
}"#)]
|
||||
pub browser_info: Option<serde_json::Value>,
|
||||
/// Payment Issuser for the current payment
|
||||
#[schema(value_type = Option<PaymentIssuer>, example = "klarna")]
|
||||
pub payment_issuer: Option<api_enums::PaymentIssuer>,
|
||||
/// Payment Experience, works in tandem with payment_issuer
|
||||
|
||||
/// Payment Experience for the current payment
|
||||
#[schema(value_type = Option<PaymentExperience>, example = "redirect_to_url")]
|
||||
pub payment_experience: Option<api_enums::PaymentExperience>,
|
||||
|
||||
/// Payment Method Type
|
||||
#[schema(value_type = Option<PaymentMethodSubType>, example = "gpay")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, Copy, PartialEq, Eq)]
|
||||
@ -182,8 +216,8 @@ pub struct VerifyRequest {
|
||||
pub name: Option<Secret<String>>,
|
||||
pub phone: Option<Secret<String>>,
|
||||
pub phone_country_code: Option<String>,
|
||||
pub payment_method: Option<api_enums::PaymentMethodType>,
|
||||
pub payment_method_data: Option<PaymentMethod>,
|
||||
pub payment_method: Option<api_enums::PaymentMethod>,
|
||||
pub payment_method_data: Option<PaymentMethodData>,
|
||||
pub payment_token: Option<String>,
|
||||
pub mandate_data: Option<MandateData>,
|
||||
pub setup_future_usage: Option<api_enums::FutureUsage>,
|
||||
@ -323,24 +357,8 @@ pub struct Card {
|
||||
/// The CVC number for the card
|
||||
#[schema(value_type = String, example = "242")]
|
||||
pub card_cvc: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum KlarnaIssuer {
|
||||
Klarna,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AffirmIssuer {
|
||||
Affirm,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AfterpayClearpayIssuer {
|
||||
AfterpayClearpay,
|
||||
pub card_issuer: Option<String>,
|
||||
pub card_network: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@ -372,15 +390,89 @@ pub enum PayLaterData {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, Default, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PaymentMethod {
|
||||
pub enum PaymentMethodData {
|
||||
Card(Card),
|
||||
#[default]
|
||||
BankTransfer,
|
||||
Wallet(WalletData),
|
||||
PayLater(PayLaterData),
|
||||
Paypal,
|
||||
BankRedirect(BankRedirectData),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AdditionalPaymentData {
|
||||
Card {
|
||||
card_issuer: Option<String>,
|
||||
card_network: Option<String>,
|
||||
},
|
||||
BankRedirect {
|
||||
bank_name: Option<api_enums::BankNames>,
|
||||
},
|
||||
Wallet {},
|
||||
PayLater {},
|
||||
}
|
||||
|
||||
impl From<&PaymentMethodData> for AdditionalPaymentData {
|
||||
fn from(pm_data: &PaymentMethodData) -> Self {
|
||||
match pm_data {
|
||||
PaymentMethodData::Card(card_data) => Self::Card {
|
||||
card_issuer: card_data.card_issuer.to_owned(),
|
||||
card_network: card_data.card_network.to_owned(),
|
||||
},
|
||||
PaymentMethodData::BankRedirect(bank_redirect_data) => match bank_redirect_data {
|
||||
BankRedirectData::Eps { bank_name, .. } => Self::BankRedirect {
|
||||
bank_name: Some(bank_name.to_owned()),
|
||||
},
|
||||
BankRedirectData::Ideal { bank_name, .. } => Self::BankRedirect {
|
||||
bank_name: Some(bank_name.to_owned()),
|
||||
},
|
||||
_ => Self::BankRedirect { bank_name: None },
|
||||
},
|
||||
PaymentMethodData::Wallet(_) => Self::Wallet {},
|
||||
PaymentMethodData::PayLater(_) => Self::PayLater {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BankRedirectData {
|
||||
Eps {
|
||||
/// The billing details for bank redirection
|
||||
billing_details: BankRedirectBilling,
|
||||
bank_name: api_enums::BankNames,
|
||||
},
|
||||
Giropay {
|
||||
/// The billing details for bank redirection
|
||||
billing_details: BankRedirectBilling,
|
||||
},
|
||||
Ideal {
|
||||
/// The billing details for bank redirection
|
||||
billing_details: BankRedirectBilling,
|
||||
bank_name: api_enums::BankNames,
|
||||
},
|
||||
Sofort {
|
||||
/// The country for bank payment
|
||||
country: String,
|
||||
/// The preferred language
|
||||
preferred_language: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct SofortBilling {
|
||||
/// The country associated with the billing
|
||||
pub billing_country: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BankRedirectionRequest {}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct BankRedirectBilling {
|
||||
/// The name for which billing is issued
|
||||
pub billing_name: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
@ -408,6 +500,7 @@ pub enum PaymentMethodDataResponse {
|
||||
Wallet(WalletData),
|
||||
PayLater(PayLaterData),
|
||||
Paypal,
|
||||
BankRedirect(BankRedirectData),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -642,7 +735,7 @@ pub struct PaymentsResponse {
|
||||
/// The payment method that is to be used
|
||||
#[schema(value_type = PaymentMethodType, example = "bank_transfer")]
|
||||
#[auth_based]
|
||||
pub payment_method: Option<api_enums::PaymentMethodType>,
|
||||
pub payment_method: Option<api_enums::PaymentMethod>,
|
||||
/// The payment method information provided for making a payment
|
||||
#[schema(value_type = Option<PaymentMethod>, example = "bank_transfer")]
|
||||
#[auth_based]
|
||||
@ -688,6 +781,12 @@ pub struct PaymentsResponse {
|
||||
/// If there was an error while calling the connector the error message is received here
|
||||
#[schema(example = "Failed while verifying the card")]
|
||||
pub error_message: Option<String>,
|
||||
/// Payment Experience for the current payment
|
||||
#[schema(value_type = Option<PaymentExperience>, example = "redirect_to_url")]
|
||||
pub payment_experience: Option<api_enums::PaymentExperience>,
|
||||
/// Payment Method Type
|
||||
#[schema(value_type = Option<PaymentMethodSubType>, example = "gpay")]
|
||||
pub payment_method_type: Option<api_enums::PaymentMethodType>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, ToSchema)]
|
||||
@ -743,7 +842,7 @@ pub struct VerifyResponse {
|
||||
pub phone: Option<Secret<String>>,
|
||||
pub mandate_id: Option<String>,
|
||||
#[auth_based]
|
||||
pub payment_method: Option<api_enums::PaymentMethodType>,
|
||||
pub payment_method: Option<api_enums::PaymentMethod>,
|
||||
#[auth_based]
|
||||
pub payment_method_data: Option<PaymentMethodDataResponse>,
|
||||
pub payment_token: Option<String>,
|
||||
@ -846,14 +945,15 @@ impl From<Card> for CardResponse {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PaymentMethod> for PaymentMethodDataResponse {
|
||||
fn from(payment_method_data: PaymentMethod) -> Self {
|
||||
impl From<PaymentMethodData> for PaymentMethodDataResponse {
|
||||
fn from(payment_method_data: PaymentMethodData) -> Self {
|
||||
match payment_method_data {
|
||||
PaymentMethod::Card(card) => Self::Card(CardResponse::from(card)),
|
||||
PaymentMethod::BankTransfer => Self::BankTransfer,
|
||||
PaymentMethod::PayLater(pay_later_data) => Self::PayLater(pay_later_data),
|
||||
PaymentMethod::Wallet(wallet_data) => Self::Wallet(wallet_data),
|
||||
PaymentMethod::Paypal => Self::Paypal,
|
||||
PaymentMethodData::Card(card) => Self::Card(CardResponse::from(card)),
|
||||
PaymentMethodData::PayLater(pay_later_data) => Self::PayLater(pay_later_data),
|
||||
PaymentMethodData::Wallet(wallet_data) => Self::Wallet(wallet_data),
|
||||
PaymentMethodData::BankRedirect(bank_redirect_data) => {
|
||||
Self::BankRedirect(bank_redirect_data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user