Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed Venmo fallbacktoWeb #1434

Merged
merged 30 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b92fa87
Removed Venmo `fallbacktoWeb`
stechiu Oct 15, 2024
3384428
Addressed PR comment
stechiu Oct 16, 2024
1a24560
Updated CHANGELOG
stechiu Oct 16, 2024
438dfc7
Merge branch 'v7' of https://github.com/braintree/braintree_ios into …
stechiu Oct 17, 2024
45f21bc
Merge branch 'main' of https://github.com/braintree/braintree_ios int…
stechiu Oct 17, 2024
47a89a5
Revert "Merge branch 'v7' of https://github.com/braintree/braintree_i…
stechiu Oct 17, 2024
bf49d4f
Merge branch 'v7-venmo-universal-link' of https://github.com/braintre…
stechiu Oct 17, 2024
3e5842f
Removed `LinkType` and `urlSchemeURL()`
stechiu Oct 23, 2024
73575a0
Fixed failing unit tests
stechiu Oct 23, 2024
0d5916b
Updated CHANGELOG
stechiu Oct 23, 2024
398c20d
Update CHANGELOG.md
stechiu Oct 24, 2024
9a6759f
Added link type back to PayPal
stechiu Oct 24, 2024
a4e6d8b
Addressed PR comments
stechiu Oct 24, 2024
c058621
Merge branch 'v7' of https://github.com/braintree/braintree_ios into …
stechiu Oct 24, 2024
cd51766
Fixed `linkType` error
stechiu Oct 24, 2024
50aaa40
Added missing `linkType` parameter
stechiu Oct 24, 2024
e2c7a67
Fixed failing tests
stechiu Oct 25, 2024
d4af84a
Removed Venmo UI tests. Updated docstrings
stechiu Oct 28, 2024
c710d4d
Merge branch 'v7' of https://github.com/braintree/braintree_ios into …
stechiu Oct 28, 2024
c3225a1
Updated CHANGELOG
stechiu Oct 28, 2024
2d0d7e0
Revert "Merge branch 'v7' of https://github.com/braintree/braintree_i…
stechiu Oct 28, 2024
b265b69
Revert "Revert "Merge branch 'v7' of https://github.com/braintree/bra…
stechiu Oct 28, 2024
0d6f01e
Merge branch 'v7' of https://github.com/braintree/braintree_ios into …
stechiu Oct 28, 2024
cb531ad
Reset v7 files
stechiu Oct 28, 2024
5b536c3
Removed duplicate LinkType file
stechiu Oct 29, 2024
ab02597
Removed unused `return`
stechiu Oct 30, 2024
dae4473
Merge branch 'v7' of https://github.com/braintree/braintree_ios into …
stechiu Nov 12, 2024
c7b615b
Reverted cocoapods version
stechiu Nov 12, 2024
7a19f68
Updated migration guide. Added `TODO`
stechiu Nov 12, 2024
5fb49c3
Merge branch 'v7-venmo-universal-link' of https://github.com/braintre…
stechiu Nov 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Braintree.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.author = { "Braintree" => "team-bt-sdk@paypal.com" }
s.source = { :git => "https://github.com/braintree/braintree_ios.git", :tag => s.version.to_s }

s.platform = :ios, "16.0"
s.platform = :ios, "14.0"
stechiu marked this conversation as resolved.
Show resolved Hide resolved
s.compiler_flags = "-Wall -Werror -Wextra"
s.swift_version = "5.9"

Expand Down
120 changes: 60 additions & 60 deletions Braintree.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Bump minimum supported deployment target to iOS 16+
* BraintreeVenmo
* Update `BTVenmoRequest` to make all properties accessible on the initializer only vs via the dot syntax.
* Remove `fallbacktoWeb` property from the `verifyAppSwitch` method; all Venmo flows will now use universal links to switch to the Venmo app or fallback to the web flow if the Venmo app is not installed
stechiu marked this conversation as resolved.
Show resolved Hide resolved
* BraintreeSEPADirectDebit
* Update `BTSEPADirectDebitRequest` to make all properties accessible on the initializer only vs via the dot syntax.

Expand Down
7 changes: 2 additions & 5 deletions Demo/Application/Features/VenmoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class VenmoViewController: PaymentButtonBaseViewController {
// swiftlint:disable:next implicitly_unwrapped_optional
var venmoClient: BTVenmoClient!

let webFallbackToggle = Toggle(title: "Enable Web Fallback")
let vaultToggle = Toggle(title: "Vault")

override func viewDidLoad() {
Expand All @@ -18,7 +17,7 @@ class VenmoViewController: PaymentButtonBaseViewController {
override func createPaymentButton() -> UIView {
let venmoButton = createButton(title: "Venmo", action: #selector(tappedVenmo))

let stackView = UIStackView(arrangedSubviews: [webFallbackToggle, vaultToggle, venmoButton])
let stackView = UIStackView(arrangedSubviews: [vaultToggle, venmoButton])
stackView.axis = .vertical
stackView.spacing = 15
stackView.alignment = .fill
Expand All @@ -31,12 +30,10 @@ class VenmoViewController: PaymentButtonBaseViewController {
@objc func tappedVenmo() {
self.progressBlock("Tapped Venmo - initiating Venmo auth")

let isWebFallbackEnabled = webFallbackToggle.isOn
let isVaultingEnabled = vaultToggle.isOn
let venmoRequest = BTVenmoRequest(
paymentMethodUsage: .multiUse,
vault: isVaultingEnabled,
fallbackToWeb: isWebFallbackEnabled
vault: isVaultingEnabled
)

Task {
Expand Down
16 changes: 8 additions & 8 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 43253H4X22;
INFOPLIST_FILE = MockVenmo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -798,7 +798,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 43253H4X22;
INFOPLIST_FILE = MockVenmo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -863,7 +863,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -918,7 +918,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -942,7 +942,7 @@
"$(PROJECT_DIR)/../Frameworks/**",
);
INFOPLIST_FILE = "$(SRCROOT)/Application/Supporting Files/Braintree-Demo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -971,7 +971,7 @@
"$(PROJECT_DIR)/../Frameworks/**",
);
INFOPLIST_FILE = "$(SRCROOT)/Application/Supporting Files/Braintree-Demo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -991,7 +991,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 43253H4X22;
INFOPLIST_FILE = "$(SRCROOT)/UI Tests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1015,7 +1015,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 43253H4X22;
INFOPLIST_FILE = "$(SRCROOT)/UI Tests/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription

let package = Package(
name: "Braintree",
platforms: [.iOS(.v16)],
platforms: [.iOS(.v14)],
products: [
.library(
name: "BraintreeAmericanExpress",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Welcome to Braintree's iOS SDK. This library will help you accept card and alter

- v6 is the latest major version of Braintree iOS. To update from v5, see the [v6 migration guide](https://github.com/braintree/braintree_ios/blob/main/V6_MIGRATION.md). If you have not yet migrated to v5, see the [v5 migration guide](https://github.com/braintree/braintree_ios/blob/5.x/V5_MIGRATION.md)

**The Braintree iOS SDK permits a deployment target of iOS 16.0 or higher**. It requires Xcode 15.0+ and Swift 5.9+.
**The Braintree iOS SDK permits a deployment target of iOS 14.0 or higher**. It requires Xcode 15.0+ and Swift 5.9+.

## Supported Payment Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -347,7 +347,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -368,7 +368,7 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = CarthageTest/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -390,7 +390,7 @@
"$(PROJECT_DIR)",
);
INFOPLIST_FILE = CarthageTest/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
4 changes: 2 additions & 2 deletions SampleApps/SPMTest/SPMTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -337,7 +337,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
7 changes: 7 additions & 0 deletions Sources/BraintreeCore/Analytics/LinkType
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// Used to describe the link type for analytics
/// :nodoc: This class is exposed for internal Braintree use only. Do not use. It is not covered by Semantic Versioning and may change or be removed at any time.
@_documentation(visibility: private)
public enum LinkType: String {
case universal
case deeplink
}
2 changes: 1 addition & 1 deletion Sources/BraintreeCore/BTHTTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BTHTTP: NSObject, URLSessionTaskDelegate {
}

var acceptLanguageString: String {
"\(Locale.current.language.languageCode?.identifier ?? "en")-\(Locale.current.region?.identifier ?? "US")"
"\(Locale.current.languageCode ?? "en")-\(Locale.current.regionCode ?? "US")"
stechiu marked this conversation as resolved.
Show resolved Hide resolved
}

// MARK: - Internal Initializers
Expand Down
7 changes: 0 additions & 7 deletions Sources/BraintreeVenmo/BTVenmoAppSwitchRedirectURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ struct BTVenmoAppSwitchRedirectURL {
return urlComponent.url
}

func urlSchemeURL() -> URL? {
var components = BTVenmoAppSwitchRedirectURL.appSwitchBaseURLComponents()
components.percentEncodedQuery = BTURLUtils.queryString(from: queryParameters as NSDictionary)

return components.url
}

// MARK: - Private Helper Methods

private func constructRedirectURL(with scheme: String, result: String) -> URL? {
Expand Down
51 changes: 11 additions & 40 deletions Sources/BraintreeVenmo/BTVenmoClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ import BraintreeCore
@objc(tokenizeWithVenmoRequest:completion:)
// swiftlint:disable:next function_body_length cyclomatic_complexity
public func tokenize(_ request: BTVenmoRequest, completion: @escaping (BTVenmoAccountNonce?, Error?) -> Void) {
linkType = request.fallbackToWeb ? .universal : .deeplink
apiClient.sendAnalyticsEvent(BTVenmoAnalytics.tokenizeStarted, isVaultRequest: shouldVault, linkType: linkType)
apiClient.sendAnalyticsEvent(BTVenmoAnalytics.tokenizeStarted, isVaultRequest: shouldVault)
let returnURLScheme = BTAppContextSwitcher.sharedInstance.returnURLScheme

if returnURLScheme.isEmpty {
Expand Down Expand Up @@ -100,7 +99,7 @@ import BraintreeCore
}

do {
_ = try self.verifyAppSwitch(with: configuration, fallbackToWeb: request.fallbackToWeb)
_ = try self.verifyAppSwitch(with: configuration)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does verifyAppSwitch need to bother with returning any value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed it would still need to return true since verifyAppSwitch checks if Venmo is enabled and if Venmo app is installed. Let me know if you think it's ok to remove the Bool return otherwise

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If verifyAppSwitch is only being used here I think it should be safe. I think the function will just throw an error if not enabled, and the returned value isn't being used.

} catch {
self.notifyFailure(with: error, completion: completion)
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will want to add back this return, my guess is that this is why these tests are failing:

	BTVenmoClient_Tests.testTokenize_whenVenmoRequest_setsVaultAnalyticsTag()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationDisabled_callsBackWithError()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationDisabled_callsBackWithError()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationDisabled_callsBackWithError()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationMissing_callsBackWithError()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationMissing_callsBackWithError()
	BTVenmoClient_Tests.testTokenizeVenmoAccount_whenVenmoConfigurationMissing_callsBackWithError()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added it back and tested locally. Seems like removing return was the cause of the failed tests

Expand Down Expand Up @@ -160,24 +159,15 @@ import BraintreeCore
environment: configuration.venmoEnvironment
)

if request.fallbackToWeb {
guard let universalLinksURL = appSwitchURL.universalLinksURL() else {
self.notifyFailure(
with: BTVenmoError.invalidReturnURL("Universal links URL cannot be nil"),
completion: completion
)
return
}

self.startVenmoFlow(with: universalLinksURL, shouldVault: request.vault, completion: completion)
} else {
guard let urlSchemeURL = appSwitchURL.urlSchemeURL() else {
self.notifyFailure(with: BTVenmoError.invalidReturnURL("App switch URL cannot be nil"), completion: completion)
return
}

self.startVenmoFlow(with: urlSchemeURL, shouldVault: request.vault, completion: completion)
guard let universalLinksURL = appSwitchURL.universalLinksURL() else {
self.notifyFailure(
with: BTVenmoError.invalidReturnURL("Universal links URL cannot be nil"),
completion: completion
)
return
}

self.startVenmoFlow(with: universalLinksURL, shouldVault: request.vault, completion: completion)
} catch {
self.notifyFailure(with: error, completion: completion)
return
Expand All @@ -202,15 +192,6 @@ import BraintreeCore
}
}

/// Returns true if the proper Venmo app is installed and configured correctly, returns false otherwise.
@objc public func isVenmoAppInstalled() -> Bool {
guard let appSwitchURL = BTVenmoAppSwitchRedirectURL.baseAppSwitchURL else {
return false
}

return application.canOpenURL(appSwitchURL)
}

/// Switches to the App Store to download the Venmo application.
@objc public func openVenmoAppPageInAppStore() {
application.open(appStoreURL, completionHandler: nil)
Expand Down Expand Up @@ -291,7 +272,6 @@ import BraintreeCore
apiClient.sendAnalyticsEvent(
BTVenmoAnalytics.handleReturnStarted,
isVaultRequest: shouldVault,
linkType: linkType,
payPalContextID: payPalContextID
)
guard let cleanedURL = URL(string: url.absoluteString.replacingOccurrences(of: "#", with: "?")) else {
Expand Down Expand Up @@ -394,7 +374,6 @@ import BraintreeCore
apiClient.sendAnalyticsEvent(
BTVenmoAnalytics.appSwitchSucceeded,
isVaultRequest: shouldVault,
linkType: linkType,
payPalContextID: payPalContextID,
appSwitchURL: appSwitchURL
)
Expand Down Expand Up @@ -444,16 +423,11 @@ import BraintreeCore

// MARK: - App Switch Methods

func verifyAppSwitch(with configuration: BTConfiguration, fallbackToWeb: Bool) throws -> Bool {
func verifyAppSwitch(with configuration: BTConfiguration) throws -> Bool {
if !configuration.isVenmoEnabled {
throw BTVenmoError.disabled
}


if !fallbackToWeb && !isVenmoAppInstalled() {
throw BTVenmoError.appNotAvailable
}

guard bundle.object(forInfoDictionaryKey: "CFBundleDisplayName") != nil else {
throw BTVenmoError.bundleDisplayNameMissing
}
Expand All @@ -470,7 +444,6 @@ import BraintreeCore
apiClient.sendAnalyticsEvent(
BTVenmoAnalytics.tokenizeSucceeded,
isVaultRequest: shouldVault,
linkType: linkType,
payPalContextID: payPalContextID
)
completion(result, nil)
Expand All @@ -481,7 +454,6 @@ import BraintreeCore
BTVenmoAnalytics.tokenizeFailed,
errorDescription: error.localizedDescription,
isVaultRequest: shouldVault,
linkType: linkType,
payPalContextID: payPalContextID
)
completion(nil, error)
Expand All @@ -491,7 +463,6 @@ import BraintreeCore
apiClient.sendAnalyticsEvent(
BTVenmoAnalytics.appSwitchCanceled,
isVaultRequest: shouldVault,
linkType: linkType,
payPalContextID: payPalContextID
)
completion(nil, BTVenmoError.canceled)
Expand Down
8 changes: 2 additions & 6 deletions Sources/BraintreeVenmo/BTVenmoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import Foundation
var shippingAmount: String?
var totalAmount: String?
var lineItems: [BTVenmoLineItem]?
var fallbackToWeb: Bool = false

// MARK: - Initializer

Expand All @@ -57,9 +56,8 @@ import Foundation
/// - shippingAmount: The shipping amount for the transaction to be displayed on the paysheet. If this value is set, `totalAmount` must also be set.
/// - totalAmount: The grand total amount on the transaction that should be displayed on the paysheet.
/// - lineItems: The line items for this transaction. It can include up to 249 line items. If this value is set, `totalAmount` must also be set.
/// - fallbackToWeb: Used to determine if the customer should fallback to the web flow if Venmo app is not installed. Defaults to `false`
@objc(initWithPaymentMethodUsage:profileID:vault:displayName:collectCustomerBillingAddress:collectCustomerShippingAddress:
isFinalAmount:subTotalAmount:discountAmount:taxAmount:shippingAmount:totalAmount:lineItems:fallbackToWeb:)
isFinalAmount:subTotalAmount:discountAmount:taxAmount:shippingAmount:totalAmount:lineItems:)
public init(
paymentMethodUsage: BTVenmoPaymentMethodUsage,
profileID: String? = nil,
Expand All @@ -73,8 +71,7 @@ import Foundation
taxAmount: String? = nil,
shippingAmount: String? = nil,
totalAmount: String? = nil,
lineItems: [BTVenmoLineItem]? = [],
fallbackToWeb: Bool = false
lineItems: [BTVenmoLineItem]? = []
) {
self.paymentMethodUsage = paymentMethodUsage
self.profileID = profileID
Expand All @@ -89,6 +86,5 @@ import Foundation
self.shippingAmount = shippingAmount
self.totalAmount = totalAmount
self.lineItems = lineItems
self.fallbackToWeb = fallbackToWeb
}
}
2 changes: 1 addition & 1 deletion UnitTests/BraintreeCoreTests/BTHTTP_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ final class BTHTTP_Tests: XCTestCase {
let requestHeaders = httpRequest.allHTTPHeaderFields
let locale = Locale.current
let countryCode = (locale as NSLocale).object(forKey: .countryCode) as? String
let expectedLanguageString = "\(locale.language.languageCode?.identifier ?? "")-\(countryCode ?? "")"
let expectedLanguageString = "\(locale.languageCode ?? "")-\(countryCode ?? "")"
XCTAssertEqual(requestHeaders?["Accept-Language"], expectedLanguageString)
}
}
Expand Down
Loading
Loading