Skip to content

Commit e1227fd

Browse files
jpsimcgrindel
andauthored
chore(deps): update dependency stripe-ios to v23.27.0 (#1009)
Required syncing the `PaymentSheet` files with the latest upstream version. That's the bulk of the line of code changes in this PR. Demonstrates the "dependency checking of directories is unsound" warning: ```console $ cd examples/stripe_example $ bazel build //... --action_env=BAZEL_FORCE_REBUILD="$(date)" WARNING: PaymentSheetExample/BUILD.bazel:36:16: input 'Stripe3DS2/Stripe3DS2/Resources/Stripe3DS2.xcassets' to //PaymentSheet/PaymentSheetExample:iosapp is a directory; dependency checking of directories is unsound WARNING: PaymentSheetExample/BUILD.bazel:36:16: input 'StripeUICore/StripeUICore/Resources/StripeUICore.xcassets' to //PaymentSheet/PaymentSheetExample:iosapp is a directory; dependency checking of directories is unsound WARNING: PaymentSheetExample/BUILD.bazel:36:16: input 'StripePaymentsUI/StripePaymentsUI/Resources/StripePaymentsUI.xcassets' to //PaymentSheet/PaymentSheetExample:iosapp is a directory; dependency checking of directories is unsound WARNING: PaymentSheetExample/BUILD.bazel:36:16: input 'StripePaymentSheet/StripePaymentSheet/Resources/StripePaymentSheet.xcassets' to //PaymentSheet/PaymentSheetExample:iosapp is a directory; dependency checking of directories is unsound ``` --------- Co-authored-by: Chuck Grindel <[email protected]>
1 parent ca22c0a commit e1227fd

36 files changed

+1742
-2109
lines changed

.github/actions/set_up_macos/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ runs:
2222
if [[ "${{ inputs.test_target }}" = "@@//examples:lottie_ios_example_test_bazel_.bazelversion" ]] ||
2323
[[ "${{ inputs.test_target }}" = "@@//examples:messagekit_example_test_bazel_.bazelversion" ]] ||
2424
[[ "${{ inputs.test_target }}" = "@@//examples:resources_example_test_bazel_.bazelversion" ]] ||
25-
[[ "${{ inputs.test_target }}" = "@@//examples:shake_ios_example_test_bazel_.bazelversion" ]] ||
26-
[[ "${{ inputs.test_target }}" = "@@//examples:stripe_example_test_bazel_.bazelversion" ]]; then
25+
[[ "${{ inputs.test_target }}" = "@@//examples:shake_ios_example_test_bazel_.bazelversion" ]]; then
2726
sudo xcode-select -s /Applications/Xcode_14.3.1.app/Contents/Developer
2827
fi
28+
# TODO: Migrate all CI jobs to Xcode 15.2
29+
if [[ "${{ inputs.test_target }}" = "@@//examples:stripe_example_test_bazel_.bazelversion" ]]; then
30+
sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
31+
fi
2932
- name: Confirm Xcode Version
3033
shell: bash
3134
run: |

examples/stripe_example/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/stripe_example/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let package = Package(
77
dependencies: [
88
.package(
99
url: "https://github.com/stripe/stripe-ios",
10-
from: "23.22.1"
10+
from: "23.27.0"
1111
),
1212
]
1313
)

examples/stripe_example/PaymentSheet/PaymentSheetExample/AppDelegate.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2828

2929
// Delete cookies before running UI tests
3030
PaymentSheet.resetCustomer()
31+
PlaygroundController.resetCustomer()
3132
}
3233
#endif
3334

@@ -36,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3637

3738
// MARK: UISceneSession Lifecycle
3839

39-
@available(iOS 13.0, *)
4040
func application(
4141
_ application: UIApplication,
4242
configurationForConnecting connectingSceneSession: UISceneSession,
@@ -48,7 +48,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4848
name: "Default Configuration", sessionRole: connectingSceneSession.role)
4949
}
5050

51-
@available(iOS 13.0, *)
5251
func application(
5352
_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>
5453
) {

examples/stripe_example/PaymentSheet/PaymentSheetExample/AppearancePlaygroundView.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ struct AppearancePlaygroundView: View {
127127
set: { self.appearance.primaryButton.backgroundColor = UIColor($0) }
128128
)
129129

130+
let primaryButtonSuccessColorBinding = Binding(
131+
get: { Color(self.appearance.primaryButton.successBackgroundColor) },
132+
set: { self.appearance.primaryButton.successBackgroundColor = UIColor($0) }
133+
)
134+
135+
let primaryButtonSuccessTextColorBinding = Binding(
136+
get: { Color(self.appearance.primaryButton.successTextColor ?? self.appearance.primaryButton.textColor ?? .white) },
137+
set: { self.appearance.primaryButton.successTextColor = UIColor($0) }
138+
)
139+
130140
let primaryButtonTextColorBinding = Binding(
131141
get: { Color(self.appearance.primaryButton.textColor ?? UIColor.white) },
132142
set: { self.appearance.primaryButton.textColor = UIColor($0) }
@@ -252,6 +262,8 @@ struct AppearancePlaygroundView: View {
252262
Section(header: Text("Primary Button")) {
253263
DisclosureGroup {
254264
ColorPicker("backgroundColor", selection: primaryButtonBackgroundColorBinding)
265+
ColorPicker("successBackgroundColor", selection: primaryButtonSuccessColorBinding)
266+
ColorPicker("successTextColor", selection: primaryButtonSuccessTextColorBinding)
255267
ColorPicker("textColor", selection: primaryButtonTextColorBinding)
256268
ColorPicker("borderColor", selection: primaryButtonBorderColorBinding)
257269
Stepper("borderWidth: \(Int(appearance.primaryButton.borderWidth))", value: primaryButtonCornerBorderWidth, in: 0...30)

examples/stripe_example/PaymentSheet/PaymentSheetExample/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ swift_library(
1616
"ExampleCustomDeferredCheckoutViewController.swift",
1717
"ExampleLinkPaymentCheckoutViewController.swift",
1818
"ExampleSwiftUICustomPaymentFlow.swift",
19+
"ExampleSwiftUICustomPaymentFlowCVCRecollection.swift",
20+
"ExampleSwiftUICustomerSheet.swift",
1921
"ExampleSwiftUIPaymentSheet.swift",
2022
"ExampleSwiftUIViews.swift",
2123
"PaymentSheetTestPlayground.swift",
2224
"PaymentSheetTestPlaygroundSettings.swift",
2325
"PlaygroundController.swift",
26+
"QRView.swift",
2427
"SceneDelegate.swift",
2528
"ViewController.swift",
2629
],

examples/stripe_example/PaymentSheet/PaymentSheetExample/CustomerSheetTestPlayground.swift

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
//
55
// ⚠️🏗 This is a playground for internal Stripe engineers to help us test things, and isn't
66
// an example of what you should do in a real app!
7-
// Note: Do not import Stripe using `@_spi(STP)` or @_spi(PrivateBetaCustomerSheet) in production.
7+
// Note: Do not import Stripe using `@_spi(STP)` in production.
88
// This exposes internal functionality which may cause unexpected behavior if used directly.
99

1010
import Contacts
1111
import Foundation
1212
import PassKit
13-
@_spi(PrivateBetaCustomerSheet) import StripePaymentSheet
13+
import StripePaymentSheet
1414
import SwiftUI
1515
import UIKit
1616

@@ -38,6 +38,7 @@ struct CustomerSheetTestPlayground: View {
3838
}.buttonStyle(.bordered)
3939
}
4040
SettingView(setting: $playgroundController.settings.customerMode)
41+
SettingView(setting: customerKeyTypeBinding)
4142
TextField("CustomerId", text: customerIdBinding)
4243
}
4344
Group {
@@ -50,11 +51,24 @@ struct CustomerSheetTestPlayground: View {
5051
Text("Appearance").font(.callout.smallCaps())
5152
}.buttonStyle(.bordered)
5253
}
53-
SettingView(setting: $playgroundController.settings.paymentMethodMode)
54+
SettingPickerView(setting: merchantCountryBinding)
55+
SettingView(setting: paymentMethodModeBinding)
5456
SettingView(setting: $playgroundController.settings.applePay)
5557
SettingView(setting: $playgroundController.settings.defaultBillingAddress)
58+
SettingView(setting: $playgroundController.settings.preferredNetworksEnabled)
5659
SettingView(setting: $playgroundController.settings.autoreload)
5760
TextField("headerTextForSelectionScreen", text: headerTextForSelectionScreenBinding)
61+
SettingView(setting: $playgroundController.settings.allowsRemovalOfLastSavedPaymentMethod)
62+
HStack {
63+
Text("Macros").font(.headline)
64+
Spacer()
65+
Button {
66+
playgroundController.didTapSetToUnsupported()
67+
} label: {
68+
Text("SetPMLink")
69+
.font(.callout.smallCaps())
70+
}.buttonStyle(.bordered)
71+
}
5872
}
5973
Divider()
6074
Group {
@@ -77,6 +91,39 @@ struct CustomerSheetTestPlayground: View {
7791
.environmentObject(playgroundController)
7892
}
7993
}
94+
var customerKeyTypeBinding: Binding<CustomerSheetTestPlaygroundSettings.CustomerKeyType> {
95+
Binding<CustomerSheetTestPlaygroundSettings.CustomerKeyType> {
96+
return playgroundController.settings.customerKeyType
97+
} set: { newKeyType in
98+
// If switching to customerSession preselect setupIntent
99+
if playgroundController.settings.customerKeyType.rawValue != newKeyType.rawValue && newKeyType == .customerSession {
100+
playgroundController.settings.paymentMethodMode = .setupIntent
101+
}
102+
playgroundController.settings.customerKeyType = newKeyType
103+
}
104+
}
105+
var paymentMethodModeBinding: Binding<CustomerSheetTestPlaygroundSettings.PaymentMethodMode> {
106+
Binding<CustomerSheetTestPlaygroundSettings.PaymentMethodMode> {
107+
return playgroundController.settings.paymentMethodMode
108+
} set: { newPaymentMethodMode in
109+
// If switching to createAndAttach, ensure using legacy customer ephemeralKey
110+
if playgroundController.settings.paymentMethodMode.rawValue != newPaymentMethodMode.rawValue && newPaymentMethodMode == .createAndAttach {
111+
playgroundController.settings.customerKeyType = .legacy
112+
}
113+
playgroundController.settings.paymentMethodMode = newPaymentMethodMode
114+
}
115+
}
116+
var merchantCountryBinding: Binding<CustomerSheetTestPlaygroundSettings.MerchantCountry> {
117+
Binding<CustomerSheetTestPlaygroundSettings.MerchantCountry> {
118+
return playgroundController.settings.merchantCountryCode
119+
} set: { newCountry in
120+
// Reset customer id if country changes
121+
if playgroundController.settings.merchantCountryCode.rawValue != newCountry.rawValue {
122+
playgroundController.settings.customerMode = .new
123+
}
124+
playgroundController.settings.merchantCountryCode = newCountry
125+
}
126+
}
80127

81128
var customerIdBinding: Binding<String> {
82129
Binding<String> {
@@ -170,6 +217,7 @@ struct CustomerSheetPaymentOptionView: View {
170217
.foregroundColor(.black)
171218
Text(paymentOptionDisplayData?.displayData().label ?? "None")
172219
.accessibility(identifier: "Payment method")
220+
.foregroundColor(.primary)
173221
}.padding()
174222
.foregroundColor(.black)
175223
.cornerRadius(6)

0 commit comments

Comments
 (0)