mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat: apple pay through adyen (#62)
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
committed by
GitHub
parent
bbe30403ed
commit
cd39dd4a99
@ -141,6 +141,7 @@ pub enum AdyenPaymentMethod {
|
||||
AdyenCard(AdyenCard),
|
||||
AdyenPaypal(AdyenPaypal),
|
||||
Gpay(AdyenGPay),
|
||||
ApplePay(AdyenApplePay),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -185,6 +186,14 @@ pub struct AdyenGPay {
|
||||
google_pay_token: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AdyenApplePay {
|
||||
#[serde(rename = "type")]
|
||||
payment_type: String,
|
||||
#[serde(rename = "applePayToken")]
|
||||
apple_pay_token: String,
|
||||
}
|
||||
|
||||
// Refunds Request and Response
|
||||
#[derive(Default, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@ -314,9 +323,17 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AdyenPaymentRequest {
|
||||
};
|
||||
Ok(AdyenPaymentMethod::Gpay(gpay_data))
|
||||
}
|
||||
_ => Err(errors::ConnectorError::NotImplemented(
|
||||
"ApplePay".to_string(),
|
||||
)),
|
||||
enums::WalletIssuer::ApplePay => {
|
||||
let apple_pay_data = AdyenApplePay {
|
||||
payment_type,
|
||||
apple_pay_token: wallet_data
|
||||
.get_required_value("token")
|
||||
.change_context(errors::ConnectorError::RequestEncodingFailed)?
|
||||
.token
|
||||
.to_string(),
|
||||
};
|
||||
Ok(AdyenPaymentMethod::ApplePay(apple_pay_data))
|
||||
}
|
||||
},
|
||||
enums::PaymentMethodType::Paypal => {
|
||||
let wallet = AdyenPaypal { payment_type };
|
||||
|
||||
Reference in New Issue
Block a user