mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(payment_methods): add support to pass apple pay recurring details to obtain apple pay merchant token (#6770)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -6227,6 +6227,57 @@ pub struct ApplePayPaymentRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
/// The required shipping contacht fields for connector
|
||||
pub required_shipping_contact_fields: Option<ApplePayShippingContactFields>,
|
||||
/// Recurring payment request for apple pay Merchant Token
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub recurring_payment_request: Option<ApplePayRecurringPaymentRequest>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct ApplePayRecurringPaymentRequest {
|
||||
/// A description of the recurring payment that Apple Pay displays to the user in the payment sheet
|
||||
pub payment_description: String,
|
||||
/// The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count
|
||||
pub regular_billing: ApplePayRegularBillingRequest,
|
||||
/// A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub billing_agreement: Option<String>,
|
||||
/// A URL to a web page where the user can update or delete the payment method for the recurring payment
|
||||
#[schema(value_type = String, example = "https://hyperswitch.io")]
|
||||
pub management_url: common_utils::types::Url,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct ApplePayRegularBillingRequest {
|
||||
/// The amount of the recurring payment
|
||||
#[schema(value_type = String, example = "38.02")]
|
||||
pub amount: StringMajorUnit,
|
||||
/// The label that Apple Pay displays to the user in the payment sheet with the recurring details
|
||||
pub label: String,
|
||||
/// The time that the payment occurs as part of a successful transaction
|
||||
pub payment_timing: ApplePayPaymentTiming,
|
||||
/// The date of the first payment
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub recurring_payment_start_date: Option<PrimitiveDateTime>,
|
||||
/// The date of the final payment
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub recurring_payment_end_date: Option<PrimitiveDateTime>,
|
||||
/// The amount of time — in calendar units, such as day, month, or year — that represents a fraction of the total payment interval
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub recurring_payment_interval_unit: Option<RecurringPaymentIntervalUnit>,
|
||||
/// The number of interval units that make up the total payment interval
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub recurring_payment_interval_count: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ApplePayPaymentTiming {
|
||||
/// A value that specifies that the payment occurs when the transaction is complete
|
||||
Immediate,
|
||||
/// A value that specifies that the payment occurs on a regular basis
|
||||
Recurring,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema, serde::Deserialize)]
|
||||
@ -6504,6 +6555,49 @@ pub struct FeatureMetadata {
|
||||
/// Additional tags to be used for global search
|
||||
#[schema(value_type = Option<Vec<String>>)]
|
||||
pub search_tags: Option<Vec<HashedString<WithType>>>,
|
||||
/// Recurring payment details required for apple pay Merchant Token
|
||||
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct ApplePayRecurringDetails {
|
||||
/// A description of the recurring payment that Apple Pay displays to the user in the payment sheet
|
||||
pub payment_description: String,
|
||||
/// The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count
|
||||
pub regular_billing: ApplePayRegularBillingDetails,
|
||||
/// A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment
|
||||
pub billing_agreement: Option<String>,
|
||||
/// A URL to a web page where the user can update or delete the payment method for the recurring payment
|
||||
#[schema(value_type = String, example = "https://hyperswitch.io")]
|
||||
pub management_url: common_utils::types::Url,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct ApplePayRegularBillingDetails {
|
||||
/// The label that Apple Pay displays to the user in the payment sheet with the recurring details
|
||||
pub label: String,
|
||||
/// The date of the first payment
|
||||
#[schema(example = "2023-09-10T23:59:59Z")]
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub recurring_payment_start_date: Option<PrimitiveDateTime>,
|
||||
/// The date of the final payment
|
||||
#[schema(example = "2023-09-10T23:59:59Z")]
|
||||
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
|
||||
pub recurring_payment_end_date: Option<PrimitiveDateTime>,
|
||||
/// The amount of time — in calendar units, such as day, month, or year — that represents a fraction of the total payment interval
|
||||
pub recurring_payment_interval_unit: Option<RecurringPaymentIntervalUnit>,
|
||||
/// The number of interval units that make up the total payment interval
|
||||
pub recurring_payment_interval_count: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RecurringPaymentIntervalUnit {
|
||||
Year,
|
||||
Month,
|
||||
Day,
|
||||
Hour,
|
||||
Minute,
|
||||
}
|
||||
|
||||
///frm message is an object sent inside the payments response...when frm is invoked, its value is Some(...), else its None
|
||||
|
||||
Reference in New Issue
Block a user