From f5d3a45bad49e78c65b9a23e6c1f3b149fc725da Mon Sep 17 00:00:00 2001 From: Victoria Park Date: Mon, 1 Jul 2024 07:47:36 -0700 Subject: [PATCH] MXO Deprecation Annotations (#278) * MXO Deprecation Lines * CHANGELOG entry * fix lint errors * Jax PR feedback --- CHANGELOG.md | 5 +++++ Demo/Demo/SwiftUIComponents/SwiftUINativeCheckoutDemo.swift | 2 ++ Demo/Demo/ViewModels/PayPalViewModel.swift | 3 +++ Sources/PayPalNativePayments/NativeCheckoutProvider.swift | 1 + Sources/PayPalNativePayments/NativeCheckoutStartable.swift | 1 + .../PayPalNativePayments/PayPalNativeCheckoutClient.swift | 3 +++ .../PayPalNativePayments/PayPalNativeCheckoutDelegate.swift | 2 ++ .../PayPalNativePayments/PayPalNativeCheckoutRequest.swift | 1 + .../PayPalNativePayments/PayPalNativeCheckoutResult.swift | 3 ++- .../PayPalNativePayments/PayPalNativePaysheetActions.swift | 1 + .../PayPalNativePayments/PayPalNativeShippingAddress.swift | 1 + .../PayPalNativePayments/PayPalNativeShippingMethod.swift | 4 +++- 12 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83314c6fd..26ee05b71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # PayPal iOS SDK Release Notes +## unreleased +* PayPalNativePayments (DEPRECATED) + * **Note:** This module is deprecated and will be removed in a future version of the SDK + * Add deprecated warning message to all public classes and methods + ## 1.3.2 (2024-05-23) * PaymentButtons * Add black boundary around white buttons diff --git a/Demo/Demo/SwiftUIComponents/SwiftUINativeCheckoutDemo.swift b/Demo/Demo/SwiftUIComponents/SwiftUINativeCheckoutDemo.swift index b7fea6e94..dd3c7e4d0 100644 --- a/Demo/Demo/SwiftUIComponents/SwiftUINativeCheckoutDemo.swift +++ b/Demo/Demo/SwiftUIComponents/SwiftUINativeCheckoutDemo.swift @@ -2,6 +2,7 @@ import Foundation import SwiftUI import PaymentButtons +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") struct SwiftUINativeCheckoutDemo: View { @StateObject var viewModel = PayPalViewModel() @@ -103,6 +104,7 @@ struct SwiftUINativeCheckoutDemo: View { } } +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") struct SwiftUINativeCheckoutDemo_Preview: PreviewProvider { static var previews: some View { diff --git a/Demo/Demo/ViewModels/PayPalViewModel.swift b/Demo/Demo/ViewModels/PayPalViewModel.swift index 1b16f03ef..f004a97bf 100644 --- a/Demo/Demo/ViewModels/PayPalViewModel.swift +++ b/Demo/Demo/ViewModels/PayPalViewModel.swift @@ -2,6 +2,7 @@ import Foundation import PayPalNativePayments import CorePayments +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") class PayPalViewModel: ObservableObject { enum State { @@ -85,6 +86,7 @@ class PayPalViewModel: ObservableObject { } } +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") extension PayPalViewModel: PayPalNativeCheckoutDelegate { func paypal(_ payPalClient: PayPalNativeCheckoutClient, didFinishWithResult result: PayPalNativeCheckoutResult) { @@ -104,6 +106,7 @@ extension PayPalViewModel: PayPalNativeCheckoutDelegate { } } +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") extension PayPalViewModel: PayPalNativeShippingDelegate { func paypal( diff --git a/Sources/PayPalNativePayments/NativeCheckoutProvider.swift b/Sources/PayPalNativePayments/NativeCheckoutProvider.swift index d18c123b8..9938f6b80 100644 --- a/Sources/PayPalNativePayments/NativeCheckoutProvider.swift +++ b/Sources/PayPalNativePayments/NativeCheckoutProvider.swift @@ -5,6 +5,7 @@ import PayPalCheckout import CorePayments #endif +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") class NativeCheckoutProvider: NativeCheckoutStartable { /// Used in POST body for FPTI analytics. diff --git a/Sources/PayPalNativePayments/NativeCheckoutStartable.swift b/Sources/PayPalNativePayments/NativeCheckoutStartable.swift index 4d5b8b1b1..9e68d2e9b 100644 --- a/Sources/PayPalNativePayments/NativeCheckoutStartable.swift +++ b/Sources/PayPalNativePayments/NativeCheckoutStartable.swift @@ -5,6 +5,7 @@ import PayPalCheckout import CorePayments #endif +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") protocol NativeCheckoutStartable { /// Used in POST body for FPTI analytics. diff --git a/Sources/PayPalNativePayments/PayPalNativeCheckoutClient.swift b/Sources/PayPalNativePayments/PayPalNativeCheckoutClient.swift index 92279bae0..29aa37fbb 100644 --- a/Sources/PayPalNativePayments/PayPalNativeCheckoutClient.swift +++ b/Sources/PayPalNativePayments/PayPalNativeCheckoutClient.swift @@ -6,6 +6,7 @@ import CorePayments /// PayPal Paysheet to handle PayPal transaction /// encapsulates instance to communicate with nxo +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public class PayPalNativeCheckoutClient { public weak var delegate: PayPalNativeCheckoutDelegate? @@ -21,6 +22,7 @@ public class PayPalNativeCheckoutClient { /// Initialize a PayPalNativeCheckoutClient to process PayPal transaction /// - Parameters: /// - config: The CoreConfig object + @available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public convenience init(config: CoreConfig) { self.init( config: config, @@ -40,6 +42,7 @@ public class PayPalNativeCheckoutClient { /// - Parameters: /// - request: The PayPalNativeCheckoutRequest for the transaction /// - presentingViewController: the ViewController to present PayPalPaysheet on, if not provided, the Paysheet will be presented on your top-most ViewController + @available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public func start( request: PayPalNativeCheckoutRequest, presentingViewController: UIViewController? = nil diff --git a/Sources/PayPalNativePayments/PayPalNativeCheckoutDelegate.swift b/Sources/PayPalNativePayments/PayPalNativeCheckoutDelegate.swift index 41b102d5a..ae0636ca8 100644 --- a/Sources/PayPalNativePayments/PayPalNativeCheckoutDelegate.swift +++ b/Sources/PayPalNativePayments/PayPalNativeCheckoutDelegate.swift @@ -5,6 +5,7 @@ import CorePayments import PayPalCheckout /// A required delegate to handle events from `PayPalNativeCheckoutClient.start()` +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public protocol PayPalNativeCheckoutDelegate: AnyObject { /// Notify that the PayPal flow finished with a successful result @@ -31,6 +32,7 @@ public protocol PayPalNativeCheckoutDelegate: AnyObject { /// A delegate to receive notifications if the user changes their shipping information. /// /// This is **only required** if the order ID was created with `shipping_preferences = GET_FROM_FILE`. [See Orders V2 documentation](https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context). If the order ID was created with `shipping_preferences = NO_SHIPPING` or `SET_PROVIDED_ADDRESS`, don't implement this protocol. +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public protocol PayPalNativeShippingDelegate: AnyObject { /// Notify when the users selected shipping address changes. Use `PayPalNativeShippingActions.approve` diff --git a/Sources/PayPalNativePayments/PayPalNativeCheckoutRequest.swift b/Sources/PayPalNativePayments/PayPalNativeCheckoutRequest.swift index 93fc2a083..c7dd4caa9 100644 --- a/Sources/PayPalNativePayments/PayPalNativeCheckoutRequest.swift +++ b/Sources/PayPalNativePayments/PayPalNativeCheckoutRequest.swift @@ -1,6 +1,7 @@ import Foundation /// Used to configure options for approving a PayPal native order +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public struct PayPalNativeCheckoutRequest { /// The order ID associated with the request. diff --git a/Sources/PayPalNativePayments/PayPalNativeCheckoutResult.swift b/Sources/PayPalNativePayments/PayPalNativeCheckoutResult.swift index 3ea27fb5e..e6e1c35a6 100644 --- a/Sources/PayPalNativePayments/PayPalNativeCheckoutResult.swift +++ b/Sources/PayPalNativePayments/PayPalNativeCheckoutResult.swift @@ -1,8 +1,9 @@ import Foundation /// The result of a PayPal native payment flow. +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public struct PayPalNativeCheckoutResult { - + /// The order ID associated with the transaction. public let orderID: String diff --git a/Sources/PayPalNativePayments/PayPalNativePaysheetActions.swift b/Sources/PayPalNativePayments/PayPalNativePaysheetActions.swift index 9e359ad3d..c4f491822 100644 --- a/Sources/PayPalNativePayments/PayPalNativePaysheetActions.swift +++ b/Sources/PayPalNativePayments/PayPalNativePaysheetActions.swift @@ -1,6 +1,7 @@ import PayPalCheckout /// The actions that can be used to update the Paysheet UI after `PayPalNativeShippingDelegate` methods are invoked. +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public class PayPalNativePaysheetActions { private let shippingActions: ShippingActionsProtocol diff --git a/Sources/PayPalNativePayments/PayPalNativeShippingAddress.swift b/Sources/PayPalNativePayments/PayPalNativeShippingAddress.swift index 7e18b6f49..fab0cd5e4 100644 --- a/Sources/PayPalNativePayments/PayPalNativeShippingAddress.swift +++ b/Sources/PayPalNativePayments/PayPalNativeShippingAddress.swift @@ -6,6 +6,7 @@ import PayPalCheckout /// If you want to show shipping options in the PayPal Native Paysheet, /// provide `purchase_units[].shipping.options` when creating an orderID with /// the [`orders/v2` API](https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit) on your server. Otherwise, our Paysheet won't display any shipping options. +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public struct PayPalNativeShippingAddress { /// The ID of the shipping address diff --git a/Sources/PayPalNativePayments/PayPalNativeShippingMethod.swift b/Sources/PayPalNativePayments/PayPalNativeShippingMethod.swift index 4c6cba78c..003945db1 100644 --- a/Sources/PayPalNativePayments/PayPalNativeShippingMethod.swift +++ b/Sources/PayPalNativePayments/PayPalNativeShippingMethod.swift @@ -6,8 +6,9 @@ import PayPalCheckout /// If you want to show shipping options in the PayPal Native Paysheet, /// provide `purchase_units[].shipping.options` when creating an orderID with /// the [`orders/v2` API](https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit) on your server. Otherwise, our Paysheet won't display any shipping options. +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") public struct PayPalNativeShippingMethod { - + /// The method by which the payer wants to get their items. public enum DeliveryType: Int, CaseIterable, Codable { @@ -79,6 +80,7 @@ public struct PayPalNativeShippingMethod { } } +@available(*, deprecated, message: "PayPalNativePayments Module is deprecated, use PayPalWebPayments Module instead") extension PayPalCheckout.ShippingType { func toMerchantFacingShippingType() -> PayPalNativeShippingMethod.DeliveryType {