diff --git a/Braintree.podspec b/Braintree.podspec index f4637421ac..c6cf2d33e7 100644 --- a/Braintree.podspec +++ b/Braintree.podspec @@ -69,7 +69,7 @@ Pod::Spec.new do |s| s.source_files = "Sources/BraintreePayPalNativeCheckout/*.swift" s.dependency "Braintree/Core" s.dependency "Braintree/PayPal" - s.dependency "PayPalCheckout", '1.1.0' + s.dependency "PayPalCheckout", '1.2.0' end s.subspec "ThreeDSecure" do |s| diff --git a/Braintree.xcodeproj/project.pbxproj b/Braintree.xcodeproj/project.pbxproj index 25b889de03..fea1a24ec8 100644 --- a/Braintree.xcodeproj/project.pbxproj +++ b/Braintree.xcodeproj/project.pbxproj @@ -6134,7 +6134,7 @@ repositoryURL = "https://github.com/paypal/paypalcheckout-ios/"; requirement = { kind = exactVersion; - version = 1.1.0; + version = 1.2.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/Braintree.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Braintree.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 41be16ca0b..e4751385cf 100644 --- a/Braintree.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Braintree.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/paypal/paypalcheckout-ios/", "state" : { - "revision" : "7c6750e1316c6a3d656e90497271de68c63219f1", - "version" : "1.1.0" + "revision" : "f477176da4c6780c8586b493c604f0ab74d9be49", + "version" : "1.2.0" } } ], diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d86d3a493..32667222c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ * Fix bug where defaults for `BTThreeDSecureRequest.accountType`, `BTThreeDSecureRequest.requestedExemptionType`, and `BTThreeDSecureRequest.dfReferenceID` were improperly returning an error if not passed into the request * BraintreeCard * Deprecate unused `BTCardRequest` class +* BraintreePayPalNativeCheckout + * Update PayPalCheckout from 1.1.0 to 1.2.0. + * Add `userAuthenticationEmail` to `BTPayPalNativeCheckoutRequest` ## 5.24.0 (2023-10-30) * BraintreePayPalDataCollector diff --git a/Cartfile b/Cartfile index 9555900abd..08524de5b3 100644 --- a/Cartfile +++ b/Cartfile @@ -1,3 +1,3 @@ binary "https://assets.braintreegateway.com/mobile/ios/carthage-frameworks/cardinal-mobile/CardinalMobile.json" == 2.2.5-6 binary "https://assets.braintreegateway.com/mobile/ios/carthage-frameworks/pp-risk-magnes/PPRiskMagnes.json" == 5.4.1 -binary "https://github.com/paypal/paypalcheckout-ios/raw/main/Carthage/PayPalCheckout.json" == 1.1.0 +binary "https://github.com/paypal/paypalcheckout-ios/raw/main/Carthage/PayPalCheckout.json" == 1.2.0 diff --git a/Package.swift b/Package.swift index 6f0b244062..943be5df74 100644 --- a/Package.swift +++ b/Package.swift @@ -90,8 +90,8 @@ let package = Package( ), .binaryTarget( name: "PayPalCheckout", - url: "https://github.com/paypal/paypalcheckout-ios/releases/download/1.1.0/PayPalCheckout.xcframework.zip", - checksum: "e9e8d7ed4c48de1323bed5be81ddbc4fc82107506a6d23edc55689214f75f7ea" + url: "https://github.com/paypal/paypalcheckout-ios/releases/download/1.2.0/PayPalCheckout.xcframework.zip", + checksum: "de177ea050cfd342aa1bbfe0d9ed7faf8262270a0291a5862b6ee3c7f85cc1ff" ), .target( name: "BraintreeSEPADirectDebit", diff --git a/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutClient.swift b/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutClient.swift index 97369e6a57..4073fd81c1 100644 --- a/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutClient.swift +++ b/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutClient.swift @@ -41,7 +41,7 @@ import PayPalCheckout _ request: BTPayPalNativeCheckoutRequest, completion: @escaping (BTPayPalNativeCheckoutAccountNonce?, Error?) -> Void ) { - tokenize(request: request, completion: completion) + tokenize(request: request, userAuthenticationEmail: request.userAuthenticationEmail, completion: completion) } /// Tokenize a PayPal request to be used with the PayPal Native Checkout flow. @@ -107,6 +107,7 @@ import PayPalCheckout private func tokenize( request: BTPayPalRequest, + userAuthenticationEmail: String? = nil, completion: @escaping (BTPayPalNativeCheckoutAccountNonce?, Error?) -> Void ) { clientMetadataID = request.riskCorrelationID ?? State.correlationIDs.riskCorrelationID @@ -156,7 +157,7 @@ import PayPalCheckout }, environment: order.environment ) - + payPalNativeConfig.authConfig.userEmail = userAuthenticationEmail PayPalCheckout.Checkout.showsExitAlert = false PayPalCheckout.Checkout.set(config: payPalNativeConfig) diff --git a/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutRequest.swift b/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutRequest.swift index b7b562e104..bd78ba097e 100644 --- a/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutRequest.swift +++ b/Sources/BraintreePayPalNativeCheckout/BTPayPalNativeCheckoutRequest.swift @@ -10,6 +10,11 @@ import BraintreePayPal /// Options for the PayPal Checkout flow. @objcMembers public class BTPayPalNativeCheckoutRequest: BTPayPalCheckoutRequest { + + // MARK: - Public Properties + + /// Optional: User email to initiate a quicker authentication flow in cases where the user has a PayPal Account with the same email. + public var userAuthenticationEmail: String? // MARK: - Initializer @@ -24,13 +29,15 @@ import BraintreePayPal /// - requestBillingAgreement: Optional: If set to `true`, this enables the Checkout with Vault flow, where the customer will be prompted to consent to a billing agreement during checkout. /// - billingAgreementDescription: Optional: Display a custom description to the user for a billing agreement. For Checkout with Vault flows, you must also /// set `requestBillingAgreement` to `true` on your `BTPayPalNativeVaultRequest`. + /// - userAuthenticationEmail: Optional: User email to initiate a quicker authentication flow in cases where the user has a PayPal Account with the same email. public init( amount: String, intent: BTPayPalRequestIntent = .authorize, offerPayLater: Bool = false, currencyCode: String? = nil, requestBillingAgreement: Bool = false, - billingAgreementDescription: String? = nil + billingAgreementDescription: String? = nil, + userAuthenticationEmail: String? = nil ) { super.init( amount: amount, @@ -46,5 +53,6 @@ import BraintreePayPal self.currencyCode = currencyCode self.requestBillingAgreement = requestBillingAgreement self.billingAgreementDescription = billingAgreementDescription + self.userAuthenticationEmail = userAuthenticationEmail } } diff --git a/UnitTests/BraintreePayPalNativeCheckoutTests/BTPayPalNativeCheckoutRequest_Tests.swift b/UnitTests/BraintreePayPalNativeCheckoutTests/BTPayPalNativeCheckoutRequest_Tests.swift index 6c29e4a19c..8e2f48c5f2 100644 --- a/UnitTests/BraintreePayPalNativeCheckoutTests/BTPayPalNativeCheckoutRequest_Tests.swift +++ b/UnitTests/BraintreePayPalNativeCheckoutTests/BTPayPalNativeCheckoutRequest_Tests.swift @@ -28,6 +28,16 @@ class BTPayPalNativeCheckoutRequest_Tests: XCTestCase { XCTAssertEqual(checkoutRequest.hermesPath, "v1/paypal_hermes/create_payment_resource") } + func testUserAuthenticationEmailReturnsNil() { + let request = BTPayPalNativeCheckoutRequest(amount: "10.00") + XCTAssertNil(request.userAuthenticationEmail) + } + + func testUserAuthenticationEmailReturnsEmail() { + let request = BTPayPalNativeCheckoutRequest(amount: "10.00", userAuthenticationEmail: "user@example.com") + XCTAssertEqual(request.userAuthenticationEmail, "user@example.com") + } + func testIntentStringReturnsCorrectValue() { let checkoutRequest = BTPayPalNativeCheckoutRequest(amount: "10.00") checkoutRequest.intent = .authorize