mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
feat: add paypal as payment method type (#22)
This commit is contained in:
committed by
GitHub
parent
d41159591e
commit
fd504baac6
@ -56,6 +56,7 @@ pub enum PaymentDetails {
|
||||
BankAccount(BankDetails),
|
||||
Wallet,
|
||||
Klarna,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Serialize)]
|
||||
@ -112,6 +113,7 @@ impl TryFrom<&types::PaymentsRouterData> for AciPaymentsRequest {
|
||||
}),
|
||||
api::PaymentMethod::PayLater(_) => PaymentDetails::Klarna,
|
||||
api::PaymentMethod::Wallet => PaymentDetails::Wallet,
|
||||
api::PaymentMethod::Paypal => PaymentDetails::Paypal,
|
||||
};
|
||||
|
||||
let auth = AciAuthType::try_from(&item.connector_auth_type)?;
|
||||
|
||||
@ -209,6 +209,7 @@ impl TryFrom<&types::PaymentsRouterData> for AdyenPaymentRequest {
|
||||
api::PaymentMethod::BankTransfer => None,
|
||||
api::PaymentMethod::Wallet => None,
|
||||
api::PaymentMethod::PayLater(_) => None,
|
||||
api::PaymentMethod::Paypal => None,
|
||||
};
|
||||
|
||||
let shopper_interaction = match item.request.off_session {
|
||||
|
||||
@ -59,6 +59,7 @@ enum PaymentDetails {
|
||||
BankAccount(BankAccountDetails),
|
||||
Wallet,
|
||||
Klarna,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(Serialize, PartialEq)]
|
||||
@ -146,6 +147,7 @@ impl TryFrom<&types::PaymentsRouterData> for CreateTransactionRequest {
|
||||
}),
|
||||
api::PaymentMethod::PayLater(_) => PaymentDetails::Klarna,
|
||||
api::PaymentMethod::Wallet => PaymentDetails::Wallet,
|
||||
api::PaymentMethod::Paypal => PaymentDetails::Paypal,
|
||||
};
|
||||
let authorization_indicator_type =
|
||||
item.request.capture_method.map(|c| AuthorizationIndicator {
|
||||
@ -350,6 +352,7 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for CreateRefundRequest {
|
||||
}),
|
||||
api::PaymentMethod::PayLater(_) => PaymentDetails::Klarna,
|
||||
api::PaymentMethod::Wallet => PaymentDetails::Wallet,
|
||||
api::PaymentMethod::Paypal => PaymentDetails::Paypal,
|
||||
};
|
||||
|
||||
merchant_authentication = MerchantAuthentication::try_from(&item.connector_auth_type)?;
|
||||
|
||||
@ -75,6 +75,7 @@ impl TryFrom<&types::PaymentsRouterData> for PaymentsRequest {
|
||||
api::PaymentMethod::BankTransfer => None,
|
||||
api::PaymentMethod::Wallet => None,
|
||||
api::PaymentMethod::PayLater(_) => None,
|
||||
api::PaymentMethod::Paypal => None,
|
||||
};
|
||||
|
||||
let three_ds = match item.auth_type {
|
||||
|
||||
@ -123,6 +123,7 @@ pub enum StripePaymentMethodData {
|
||||
Klarna(StripeKlarnaData),
|
||||
Bank,
|
||||
Wallet,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
impl TryFrom<&types::PaymentsRouterData> for PaymentIntentRequest {
|
||||
@ -160,6 +161,7 @@ impl TryFrom<&types::PaymentsRouterData> for PaymentIntentRequest {
|
||||
})
|
||||
}
|
||||
api::PaymentMethod::Wallet => StripePaymentMethodData::Wallet,
|
||||
api::PaymentMethod::Paypal => StripePaymentMethodData::Paypal,
|
||||
};
|
||||
let shipping_address = match item.address.shipping.clone() {
|
||||
Some(mut shipping) => Address {
|
||||
|
||||
@ -153,6 +153,8 @@ pub enum PaymentMethod {
|
||||
Wallet,
|
||||
#[serde(rename(deserialize = "pay_later"))]
|
||||
PayLater(PayLaterData),
|
||||
#[serde(rename(deserialize = "paypal"))]
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize)]
|
||||
@ -170,6 +172,7 @@ pub enum PaymentMethodDataResponse {
|
||||
BankTransfer,
|
||||
Wallet,
|
||||
PayLater(PayLaterData),
|
||||
Paypal,
|
||||
}
|
||||
|
||||
impl Default for PaymentMethod {
|
||||
@ -541,6 +544,7 @@ impl From<PaymentMethod> for PaymentMethodDataResponse {
|
||||
PaymentMethodDataResponse::PayLater(pay_later_data)
|
||||
}
|
||||
PaymentMethod::Wallet => PaymentMethodDataResponse::Wallet,
|
||||
PaymentMethod::Paypal => PaymentMethodDataResponse::Paypal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -470,6 +470,7 @@ pub enum PaymentMethodType {
|
||||
ConsumerFinance,
|
||||
Wallet,
|
||||
Klarna,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
Reference in New Issue
Block a user