Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/braintree/braintree_ios int…
Browse files Browse the repository at this point in the history
…o v7-venmo-universal-link

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
stechiu committed Oct 17, 2024
2 parents 438dfc7 + 16a1b2f commit 45f21bc
Show file tree
Hide file tree
Showing 18 changed files with 525 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Braintree.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Braintree"
s.version = "6.23.5"
s.version = "6.24.0"
s.summary = "Braintree iOS SDK: Helps you accept card and alternative payments in your iOS app."
s.description = <<-DESC
Braintree is a full-stack payments platform for developers
Expand Down
30 changes: 29 additions & 1 deletion Braintree.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
6298A1992B91010600E46EDF /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 6298A1982B91010600E46EDF /* PrivacyInfo.xcprivacy */; };
62A659A42B98CB23008DFD67 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 62A659A32B98CB23008DFD67 /* PrivacyInfo.xcprivacy */; };
62A746412B9255AC003D32FF /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 62A746402B9255AC003D32FF /* PrivacyInfo.xcprivacy */; };
62B811882CC002470024A688 /* BTPayPalPhoneNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62B811872CC002470024A688 /* BTPayPalPhoneNumber.swift */; };
62D5EC502B9F6E9D00D09C5D /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 62D5EC4F2B9F6E9D00D09C5D /* PrivacyInfo.xcprivacy */; };
62DE8FBF2B9656BF00F08F53 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 62DE8FBE2B9656BF00F08F53 /* PrivacyInfo.xcprivacy */; };
62EA90492B63071800DD79BC /* BTEligiblePaymentMethods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62EA90482B63071800DD79BC /* BTEligiblePaymentMethods.swift */; };
Expand Down Expand Up @@ -118,6 +119,10 @@
80581B1D2553319C00006F53 /* BTGraphQLHTTP_SSLPinning_IntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80581B1C2553319C00006F53 /* BTGraphQLHTTP_SSLPinning_IntegrationTests.swift */; };
806C85632B90EBED00A2754C /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 806C85622B90EBED00A2754C /* PrivacyInfo.xcprivacy */; };
8075CBEE2B1B735200CA6265 /* BTAPIRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8075CBED2B1B735200CA6265 /* BTAPIRequest.swift */; };
807D22EE2C29A918009FFEA4 /* BTPayPalRecurringBillingDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807D22ED2C29A918009FFEA4 /* BTPayPalRecurringBillingDetails.swift */; };
807D22F02C29A93A009FFEA4 /* BTPayPalBillingCycle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807D22EF2C29A93A009FFEA4 /* BTPayPalBillingCycle.swift */; };
807D22F22C29A972009FFEA4 /* BTPayPalBillingPricing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807D22F12C29A972009FFEA4 /* BTPayPalBillingPricing.swift */; };
807D22F52C29ADE2009FFEA4 /* BTPayPalRecurringBillingPlanType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 807D22F42C29ADE2009FFEA4 /* BTPayPalRecurringBillingPlanType.swift */; };
80842DA72B8E49EF00A5CD92 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 80842DA62B8E49EF00A5CD92 /* PrivacyInfo.xcprivacy */; };
8087C10F2BFBACCA0020FC2E /* TokenizationKey_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8087C10E2BFBACCA0020FC2E /* TokenizationKey_Tests.swift */; };
808E4A162C581CD40006A737 /* AnalyticsSendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 808E4A152C581CD40006A737 /* AnalyticsSendable.swift */; };
Expand Down Expand Up @@ -825,6 +830,7 @@
6298A1982B91010600E46EDF /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
62A659A32B98CB23008DFD67 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
62A746402B9255AC003D32FF /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
62B811872CC002470024A688 /* BTPayPalPhoneNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalPhoneNumber.swift; sourceTree = "<group>"; };
62D5EC4F2B9F6E9D00D09C5D /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
62DE8FBE2B9656BF00F08F53 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
62EA90482B63071800DD79BC /* BTEligiblePaymentMethods.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTEligiblePaymentMethods.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -858,6 +864,10 @@
8064F3962B1E63800059C4CB /* BTShopperInsightsRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTShopperInsightsRequest.swift; sourceTree = "<group>"; };
806C85622B90EBED00A2754C /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
8075CBED2B1B735200CA6265 /* BTAPIRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTAPIRequest.swift; sourceTree = "<group>"; };
807D22ED2C29A918009FFEA4 /* BTPayPalRecurringBillingDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalRecurringBillingDetails.swift; sourceTree = "<group>"; };
807D22EF2C29A93A009FFEA4 /* BTPayPalBillingCycle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalBillingCycle.swift; sourceTree = "<group>"; };
807D22F12C29A972009FFEA4 /* BTPayPalBillingPricing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalBillingPricing.swift; sourceTree = "<group>"; };
807D22F42C29ADE2009FFEA4 /* BTPayPalRecurringBillingPlanType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BTPayPalRecurringBillingPlanType.swift; sourceTree = "<group>"; };
80842DA62B8E49EF00A5CD92 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
8087C10E2BFBACCA0020FC2E /* TokenizationKey_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenizationKey_Tests.swift; sourceTree = "<group>"; };
808E4A152C581CD40006A737 /* AnalyticsSendable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsSendable.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1380,7 +1390,6 @@
57544F572952298900DEB7B0 /* BTPayPalAccountNonce.swift */,
3B7A261029C0CAA40087059D /* BTPayPalAnalytics.swift */,
8014221B2BAE935B009F9999 /* BTPayPalApprovalURLParser.swift */,
BE6BC22D2BA9CFFC00C3E321 /* BTPayPalReturnURL.swift */,
BE8E5CEE294B6937001BF017 /* BTPayPalCheckoutRequest.swift */,
57544F5929524E4D00DEB7B0 /* BTPayPalClient.swift */,
5754481F294A2EBE00DEB7B0 /* BTPayPalCreditFinancing.swift */,
Expand All @@ -1389,9 +1398,12 @@
BEF5D2E5294A18B300FFD56D /* BTPayPalLineItem.swift */,
57D9436D2968A8080079EAB1 /* BTPayPalLocaleCode.swift */,
BE349112294B798300D2CF68 /* BTPayPalRequest.swift */,
BE6BC22D2BA9CFFC00C3E321 /* BTPayPalReturnURL.swift */,
BE6BC22B2BA9C67600C3E321 /* BTPayPalVaultBaseRequest.swift */,
BE349110294B77E100D2CF68 /* BTPayPalVaultRequest.swift */,
62A659A32B98CB23008DFD67 /* PrivacyInfo.xcprivacy */,
807D22F32C29ADA8009FFEA4 /* RecurringBillingMetadata */,
62B811872CC002470024A688 /* BTPayPalPhoneNumber.swift */,
);
path = BraintreePayPal;
sourceTree = "<group>";
Expand Down Expand Up @@ -1536,6 +1548,17 @@
path = Analytics;
sourceTree = "<group>";
};
807D22F32C29ADA8009FFEA4 /* RecurringBillingMetadata */ = {
isa = PBXGroup;
children = (
807D22ED2C29A918009FFEA4 /* BTPayPalRecurringBillingDetails.swift */,
807D22F42C29ADE2009FFEA4 /* BTPayPalRecurringBillingPlanType.swift */,
807D22EF2C29A93A009FFEA4 /* BTPayPalBillingCycle.swift */,
807D22F12C29A972009FFEA4 /* BTPayPalBillingPricing.swift */,
);
path = RecurringBillingMetadata;
sourceTree = "<group>";
};
80824659252C19F5000AD8FF /* Sources */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3259,13 +3282,18 @@
BE549F122BF5449E00B6F441 /* BTPayPalVaultBaseRequest.swift in Sources */,
3B7A261129C0CAA40087059D /* BTPayPalAnalytics.swift in Sources */,
BE8E5CEF294B6937001BF017 /* BTPayPalCheckoutRequest.swift in Sources */,
807D22F02C29A93A009FFEA4 /* BTPayPalBillingCycle.swift in Sources */,
5754481E294A2A1D00DEB7B0 /* BTPayPalCreditFinancingAmount.swift in Sources */,
57D9436E2968A8080079EAB1 /* BTPayPalLocaleCode.swift in Sources */,
57544F582952298900DEB7B0 /* BTPayPalAccountNonce.swift in Sources */,
8014221C2BAE935B009F9999 /* BTPayPalApprovalURLParser.swift in Sources */,
BE349111294B77E100D2CF68 /* BTPayPalVaultRequest.swift in Sources */,
62B811882CC002470024A688 /* BTPayPalPhoneNumber.swift in Sources */,
807D22F52C29ADE2009FFEA4 /* BTPayPalRecurringBillingPlanType.swift in Sources */,
57544820294A2EBE00DEB7B0 /* BTPayPalCreditFinancing.swift in Sources */,
807D22EE2C29A918009FFEA4 /* BTPayPalRecurringBillingDetails.swift in Sources */,
57544F5A29524E4D00DEB7B0 /* BTPayPalClient.swift in Sources */,
807D22F22C29A972009FFEA4 /* BTPayPalBillingPricing.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Braintree iOS SDK Release Notes

## unreleased 7.0
## unreleased
* BraintreePayPal
* Add `BTPayPalRequest.userPhoneNumber` optional property
* BraintreeVenmo
* Remove `fallbacktoWeb` property from the `verifyAppSwitch` method

## 6.24.0 (2024-10-15)
* BraintreePayPal
* Add `BTPayPalRecurringBillingDetails` and `BTPayPalRecurringBillingPlanType` opt-in request objects. Including these details will provide transparency to users on their billing schedule, dates, and amounts, as well as launch a modernized checkout UI.

## 6.23.5 (2024-10-09)
* BraintreeCore
Expand Down
17 changes: 14 additions & 3 deletions Demo/Application/Base/ContainmentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,21 @@ class ContainmentViewController: UIViewController {
}
}

// TODO: Remove this once ModXO goes GA
case .newPayPalCheckoutTokenizationKey:
updateStatus("Fetching new checkout token...")
let newPayPalCheckoutTokenizationKey = "sandbox_rz48bqvw_jcyycfw6f9j4nj9c"
currentViewController = instantiateViewController(with: newPayPalCheckoutTokenizationKey)
updateStatus("Fetching modXO (origami) checkout token...")

var tokenizationKey: String = ""
switch BraintreeDemoSettings.currentEnvironment {
case .sandbox:
tokenizationKey = "sandbox_rz48bqvw_jcyycfw6f9j4nj9c"
case .production:
tokenizationKey = "production_t2wns2y2_dfy45jdj3dxkmz5m"
default:
tokenizationKey = "development_testing_integration_merchant_id"
}

currentViewController = instantiateViewController(with: tokenizationKey)

case .mockedPayPalTokenizationKey:
let tokenizationKey = "sandbox_q7v35n9n_555d2htrfsnnmfb3"
Expand Down
92 changes: 88 additions & 4 deletions Demo/Application/Features/PayPalWebCheckoutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
return textField
}()

lazy var countryCodeLabel: UILabel = {
let label = UILabel()
label.text = "Country Code:"
return label
}()

lazy var countryCodeTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "1"
textField.backgroundColor = .systemBackground
textField.keyboardType = .phonePad
return textField
}()

lazy var nationalNumberLabel: UILabel = {
let label = UILabel()
label.text = "National Number:"
return label
}()

lazy var nationalNumberTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "000-000-000"
textField.backgroundColor = .systemBackground
textField.keyboardType = .phonePad
return textField
}()

lazy var payLaterToggleLabel: UILabel = {
let label = UILabel()
label.text = "Offer Pay Later"
Expand All @@ -41,26 +69,41 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
}()

let newPayPalCheckoutToggle = UISwitch()

lazy var rbaDataToggleLabel: UILabel = {
let label = UILabel()
label.text = "Recurring Billing (RBA) Data"
label.font = .preferredFont(forTextStyle: .footnote)
return label
}()

let rbaDataToggle = UISwitch()

override func viewDidLoad() {
super.heightConstraint = 300
super.heightConstraint = 350
super.viewDidLoad()
}

override func createPaymentButton() -> UIView {
let payPalCheckoutButton = createButton(title: "PayPal Checkout", action: #selector(tappedPayPalCheckout))
let payPalVaultButton = createButton(title: "PayPal Vault", action: #selector(tappedPayPalVault))
let payPalAppSwitchButton = createButton(title: "PayPal App Switch", action: #selector(tappedPayPalAppSwitch))

let oneTimeCheckoutStackView = buttonsStackView(label: "1-Time Checkout", views: [
UIStackView(arrangedSubviews: [payLaterToggleLabel, payLaterToggle]),
UIStackView(arrangedSubviews: [newPayPalCheckoutToggleLabel, newPayPalCheckoutToggle]),
payPalCheckoutButton
])
let vaultStackView = buttonsStackView(label: "Vault", views: [payPalVaultButton, payPalAppSwitchButton])

let vaultStackView = buttonsStackView(label: "Vault", views: [
UIStackView(arrangedSubviews: [rbaDataToggleLabel, rbaDataToggle]),
payPalVaultButton,
payPalAppSwitchButton
])

let stackView = UIStackView(arrangedSubviews: [
UIStackView(arrangedSubviews: [emailLabel, emailTextField]),
UIStackView(arrangedSubviews: [countryCodeLabel, countryCodeTextField]),
UIStackView(arrangedSubviews: [nationalNumberLabel, nationalNumberTextField]),
oneTimeCheckoutStackView,
vaultStackView
])
Expand Down Expand Up @@ -91,6 +134,10 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {

let request = BTPayPalCheckoutRequest(amount: "5.00")
request.userAuthenticationEmail = emailTextField.text
request.userPhoneNumber = BTPayPalPhoneNumber(
countryCode: countryCodeTextField.text ?? "",
nationalNumber: nationalNumberTextField.text ?? ""
)

let lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "5.00", name: "item one 1234567", kind: .debit)
lineItem.upcCode = "123456789"
Expand Down Expand Up @@ -120,8 +167,45 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
sender.setTitle("Processing...", for: .disabled)
sender.isEnabled = false

let request = BTPayPalVaultRequest()
var request = BTPayPalVaultRequest()
request.userAuthenticationEmail = emailTextField.text
request.userPhoneNumber = BTPayPalPhoneNumber(
countryCode: countryCodeTextField.text ?? "",
nationalNumber: nationalNumberTextField.text ?? ""
)

if rbaDataToggle.isOn {
let billingPricing = BTPayPalBillingPricing(
pricingModel: .fixed,
amount: "9.99",
reloadThresholdAmount: "99.99"
)

let billingCycle = BTPayPalBillingCycle(
isTrial: true,
numberOfExecutions: 1,
interval: .month,
intervalCount: 1,
sequence: 1,
startDate: "2024-08-01",
pricing: billingPricing
)

let recurringBillingDetails = BTPayPalRecurringBillingDetails(
billingCycles: [billingCycle],
currencyISOCode: "USD",
totalAmount: "32.56",
productName: "Vogue Magazine Subscription",
productDescription: "Home delivery to Chicago, IL",
productQuantity: 1,
oneTimeFeeAmount: "9.99",
shippingAmount: "1.99",
productAmount: "19.99",
taxAmount: "0.59"
)

request = BTPayPalVaultRequest(recurringBillingDetails: recurringBillingDetails, recurringBillingPlanType: .subscription)
}

payPalClient.tokenize(request) { nonce, error in
sender.isEnabled = true
Expand Down
4 changes: 2 additions & 2 deletions Demo/Application/Supporting Files/Braintree-Demo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>6.23.5</string>
<string>6.24.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -56,7 +56,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>6.23.5</string>
<string>6.24.0</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.braintreepayments.Demo.payments</string>
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraintreeCore/BTCoreConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
@objcMembers public class BTCoreConstants: NSObject {

/// :nodoc: This property 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.
public static var braintreeSDKVersion: String = "6.23.5"
public static var braintreeSDKVersion: String = "6.24.0"

/// :nodoc: This property 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.
public static let callbackURLScheme: String = "sdk.ios.braintree"
Expand Down
2 changes: 1 addition & 1 deletion Sources/BraintreeCore/Encodable+Dictionary.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

// TODO: - To be removed once entire SDK is formatting POST bodies using Encodable
extension Encodable {
public extension Encodable {

/// Converts to dictionary `[String: Any]` type.
///
Expand Down
4 changes: 2 additions & 2 deletions Sources/BraintreeCore/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.23.5</string>
<string>6.24.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6.23.5</string>
<string>6.24.0</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
21 changes: 21 additions & 0 deletions Sources/BraintreePayPal/BTPayPalPhoneNumber.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation

public struct BTPayPalPhoneNumber: Encodable {

private let countryCode: String
private let nationalNumber: String

private enum CodingKeys: String, CodingKey {
case countryCode = "country_code"
case nationalNumber = "national_number"
}

/// Intialize a `BTPayPalPhoneNumber`
/// - Parameters:
/// - countryCode: The international country code for the shopper's phone number i.e. "1" for US
/// - nationalNumber: The national segment of the shopper's phone number
public init(countryCode: String, nationalNumber: String) {
self.countryCode = countryCode
self.nationalNumber = nationalNumber
}
}
Loading

0 comments on commit 45f21bc

Please sign in to comment.