Skip to content

Commit

Permalink
3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bric-stripe committed Mar 4, 2024
1 parent 1a2ba83 commit ab325c6
Show file tree
Hide file tree
Showing 674 changed files with 362,780 additions and 75,284 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ If you are using CocoaPods, update your Podfile:
```
pod 'StripeTerminal', '~> 3.0'
```
# 3.4.0 2024-03-04
* New: For Tap to Pay on iPhone, added `autoReconnectOnUnexpectedDisconnect` and `autoReconnectionDelegate` to the [`SCPLocalMobileConnectionConfiguration`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPLocalMobileConnectionConfiguration.html). When `autoReconnectOnUnexpectedDisconnect` is enabled, the SDK will attempt to restore connection upon any unexpected disconnect to your local mobile reader. See [Stripe documentation](https://stripe.com/docs/terminal/payments/connect-reader?terminal-sdk-platform=ios&reader-type=tap-to-pay#handle-disconnects) for details.
* Update: Formatting on certain fields exposed in `SCPOfflineCardPresentDetails` is now consistent with `SCPCardPresentDetails`
* `expYear` is a four-digit number
* `receiptDetails.accountType` is no longer a number, and is one of `default`, `savings`, `checking`, or `credit`
* Update: The SDK now requires that a `NSBluetoothAlwaysUsageDescription` key be present in your app's Info.plist instead of a `NSBluetoothPeripheralUsageDescription` key.
* Update: Allow `SCPCollectConfiguration.updatePaymentIntent` to be true for offline enabled readers when `SCPCreateConfiguration` has `offlineBehavior` set to `SCPOfflineBehaviorRequireOnline`.
* Update: Added new `SCPErrorReaderMissingEncryptionKeys`. Returned in a rare condition where the reader is missing the required keys to encrypt payment method data. The reader will disconnect if this error is hit. Reconnecting to the reader should re-install the keys.
* Update: More descriptive error messages in `SCPErrorKeyMessage` for operations that fail due to network-related errors.
* Fixes a bug where `SCPPaymentIntent.stripeId` was not `nil` in the response to `confirmPaymentIntent` when operating offline with a smart reader.
* Fixes a rare bug where Bluetooth readers could get into a state where they would no longer accept payments and needed to be replaced.

# 3.3.1 2024-02-07
* Built with Xcode 15.2, Swift version 5.9.
* Fixes [#282](https://github.com/stripe/stripe-terminal-ios/issues/282): Fixes a crash when connecting to Stripe Reader M2 or BBPOS Chipper 2X devices that are running older configs.
Expand Down
32 changes: 16 additions & 16 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
025BEC162A8EC86400955C73 /* OfflinePaymentsLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025BEC142A8EC86300955C73 /* OfflinePaymentsLogViewController.swift */; };
025BEC182A8EC8CA00955C73 /* OfflineUIHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025BEC172A8EC8CA00955C73 /* OfflineUIHandler.swift */; };
025BEC1A2A8EC94400955C73 /* LabelOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025BEC192A8EC94400955C73 /* LabelOverlayView.swift */; };
0282EC6D9925713130E38548 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 632FD914F6C71AABF19250E3 /* Pods_Example.framework */; };
028DC8572A9D28B40069E4BE /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 028DC8562A9D28B40069E4BE /* Color.swift */; };
02A6BF5624CB1C4D0054ADFF /* StripeTerminal.xcframework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 022FB25A245868EF00F4C321 /* StripeTerminal.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
02DA8E3A24532E4900235921 /* DelegateAnnouncer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02DA8E3924532E4900235921 /* DelegateAnnouncer.swift */; };
Expand All @@ -34,6 +33,7 @@
395970602A8D85830015F0F3 /* LocationStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3959705F2A8D85830015F0F3 /* LocationStub.swift */; };
50225C402B4DACB300757FC6 /* StartReaderSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50225C3F2B4DACB300757FC6 /* StartReaderSettingsViewController.swift */; };
50225C5E2B508DFB00757FC6 /* Error+StripeTerminal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50225C5D2B508DFB00757FC6 /* Error+StripeTerminal.swift */; };
69092AD1CCEBF84170CD7D63 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 535CA1E41E7360156543924B /* Pods_Example.framework */; };
6F8BE0922177B403009511E5 /* DiscoveryMethodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F8BE0912177B403009511E5 /* DiscoveryMethodViewController.swift */; };
A40E7CF027F64191005879C7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C16F40A72094F07C009CE87C /* Assets.xcassets */; };
A63E8431260D073B006CB90C /* CreateLocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63E8430260D073B006CB90C /* CreateLocationViewController.swift */; };
Expand Down Expand Up @@ -98,14 +98,14 @@
3959705F2A8D85830015F0F3 /* LocationStub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationStub.swift; sourceTree = "<group>"; };
50225C3F2B4DACB300757FC6 /* StartReaderSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartReaderSettingsViewController.swift; sourceTree = "<group>"; };
50225C5D2B508DFB00757FC6 /* Error+StripeTerminal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+StripeTerminal.swift"; sourceTree = "<group>"; };
632FD914F6C71AABF19250E3 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
69796745DA58CFAD5D4EB2B7 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
535CA1E41E7360156543924B /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6F8BE0912177B403009511E5 /* DiscoveryMethodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoveryMethodViewController.swift; sourceTree = "<group>"; };
77BA081A763A9A1DDBD3F5ED /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
A63E8430260D073B006CB90C /* CreateLocationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLocationViewController.swift; sourceTree = "<group>"; };
A63E8434260D0A0D006CB90C /* SelectLocationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectLocationViewController.swift; sourceTree = "<group>"; };
A63E8456260D23C9006CB90C /* StripeCountries.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StripeCountries.swift; sourceTree = "<group>"; };
A7096A00C8A1B7ED617D5F92 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
AA568CD02A9D413900B9605C /* StartSetupIntentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StartSetupIntentViewController.swift; sourceTree = "<group>"; };
AE36D4A64F68E1F598854908 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
B3C24C6B23285BF6003271BD /* ifaddrs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ifaddrs.swift; sourceTree = "<group>"; };
B3C53B8B23286DA9003A707B /* Example-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Example-Bridging-Header.h"; sourceTree = "<group>"; };
C151C7A521605B6200FC206F /* UpdateReaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateReaderViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -135,18 +135,18 @@
buildActionMask = 2147483647;
files = (
022FB25B245868EF00F4C321 /* StripeTerminal.xcframework in Frameworks */,
0282EC6D9925713130E38548 /* Pods_Example.framework in Frameworks */,
69092AD1CCEBF84170CD7D63 /* Pods_Example.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
184738A2124946625CE854A8 /* Pods */ = {
7D14F5909F6B4B3C4C7ADB51 /* Pods */ = {
isa = PBXGroup;
children = (
69796745DA58CFAD5D4EB2B7 /* Pods-Example.debug.xcconfig */,
77BA081A763A9A1DDBD3F5ED /* Pods-Example.release.xcconfig */,
AE36D4A64F68E1F598854908 /* Pods-Example.debug.xcconfig */,
A7096A00C8A1B7ED617D5F92 /* Pods-Example.release.xcconfig */,
);
name = Pods;
path = Pods;
Expand All @@ -158,7 +158,7 @@
C16F409F2094F07B009CE87C /* Example */,
EE087B524FD387212EBE036B /* Frameworks */,
C16F409E2094F07B009CE87C /* Products */,
184738A2124946625CE854A8 /* Pods */,
7D14F5909F6B4B3C4C7ADB51 /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -230,7 +230,7 @@
isa = PBXGroup;
children = (
022FB25A245868EF00F4C321 /* StripeTerminal.xcframework */,
632FD914F6C71AABF19250E3 /* Pods_Example.framework */,
535CA1E41E7360156543924B /* Pods_Example.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -242,12 +242,12 @@
isa = PBXNativeTarget;
buildConfigurationList = C16F40AF2094F07C009CE87C /* Build configuration list for PBXNativeTarget "Example" */;
buildPhases = (
85A26DBB6F15A3D09C05CBC1 /* [CP] Check Pods Manifest.lock */,
20FDBDABF850DEA46881F7E4 /* [CP] Check Pods Manifest.lock */,
C16F40992094F07B009CE87C /* Sources */,
C16F409B2094F07B009CE87C /* Resources */,
0DE2ACED4D7F3843500B5F14 /* Frameworks */,
02A6BF5524CB1C3D0054ADFF /* CopyFiles */,
AD6F75BA554EE43F0303469E /* [CP] Embed Pods Frameworks */,
7E30A310E73EC72D2DA01740 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -308,7 +308,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
85A26DBB6F15A3D09C05CBC1 /* [CP] Check Pods Manifest.lock */ = {
20FDBDABF850DEA46881F7E4 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -330,7 +330,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
AD6F75BA554EE43F0303469E /* [CP] Embed Pods Frameworks */ = {
7E30A310E73EC72D2DA01740 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -546,7 +546,7 @@
};
C16F40B02094F07C009CE87C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 69796745DA58CFAD5D4EB2B7 /* Pods-Example.debug.xcconfig */;
baseConfigurationReference = AE36D4A64F68E1F598854908 /* Pods-Example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
Expand Down Expand Up @@ -578,7 +578,7 @@
};
C16F40B12094F07C009CE87C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 77BA081A763A9A1DDBD3F5ED /* Pods-Example.release.xcconfig */;
baseConfigurationReference = A7096A00C8A1B7ED617D5F92 /* Pods-Example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
Expand Down
3 changes: 3 additions & 0 deletions Example/Example/ReaderDiscoveryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ class ReaderDiscoveryViewController: TableViewController, CancelableViewControll
let connectionConfig = try LocalMobileConnectionConfigurationBuilder(locationId: presentLocationId)
.setMerchantDisplayName(nil) // use the location name
.setOnBehalfOf(useOBO ? onBehalfOfTextField.textField.text : nil)
.setAutoReconnectOnUnexpectedDisconnect(self.autoReconnectOnUnexpectedDisconnect)
.setAutoReconnectionDelegate(ReconnectionDelegateAnnouncer.shared)
.build()
return Terminal.shared.connectLocalMobileReader(reader, delegate: LocalMobileReaderDelegateAnnouncer.shared, connectionConfig: connectionConfig, completion: connectCompletion)
} else {
Expand Down Expand Up @@ -301,6 +303,7 @@ class ReaderDiscoveryViewController: TableViewController, CancelableViewControll
let commonRows = [
Row(text: "Enable Auto-Reconnect", accessory: .switchToggle(value: autoReconnectOnUnexpectedDisconnect, { [unowned self] _ in
self.autoReconnectOnUnexpectedDisconnect.toggle()
self.updateContent()
})),
]

Expand Down
13 changes: 13 additions & 0 deletions Example/Example/StartPaymentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class StartPaymentViewController: TableViewController, CancelingViewController {
private var recollectAfterCardBrandDecline = false
private let isSposReader: Bool
private var updatePaymentIntent = false
private var requestDcc = false

private var connectedAccountId: String {
connectedAccountTextField.textField.text ?? ""
Expand Down Expand Up @@ -190,6 +191,7 @@ class StartPaymentViewController: TableViewController, CancelingViewController {
.setSkipTipping(self.skipTipping)
.setUpdatePaymentIntent(updatePaymentIntent)
.setEnableCustomerCancellation(self.enableCustomerCancellation)
.setRequestDynamicCurrencyConversion(self.requestDcc)

do {
if let eligibleAmount = Int(tipEligibleAmountTextField.textField.text ?? "none") {
Expand Down Expand Up @@ -437,6 +439,16 @@ class StartPaymentViewController: TableViewController, CancelingViewController {
return Section(header: "OFFLINE BEHAVIOR", rows: rows)
}

/// Makes the "DCC" section.
private func makeRequestDcc() -> Section {
let rows: [Row] = [
Row(text: "Request Dynamic Currency Conversion", accessory: .switchToggle(value: self.requestDcc) { [unowned self] _ in
self.requestDcc.toggle()
})
]
return Section(header: "Request Dynamic Currency Conversion", rows: rows)
}

private func updateContent() {

let sections: [Section?] = [
Expand All @@ -453,6 +465,7 @@ class StartPaymentViewController: TableViewController, CancelingViewController {
self.makeOfflineStoredTransactionLimitSection(),
self.makeOfflineBehaviorSection(),
self.makeSetupFutureUsageSection(),
self.makeRequestDcc(),
self.startSection
]

Expand Down
10 changes: 5 additions & 5 deletions Example/StripeTerminal.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>StripeTerminal.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>StripeTerminal.framework/StripeTerminal</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>StripeTerminal.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ NS_SWIFT_NAME(CollectConfiguration)
*/
@property (nonatomic, assign, readonly) BOOL enableCustomerCancellation;

/**
Request Dynamic Currency Conversion for the presented payment method if available.
`updatePaymentIntent` must be set to true for dynamic currency conversion to be enabled.
Defaults to NO.
*/
@property (nonatomic, assign, readonly) BOOL requestDynamicCurrencyConversion;

/**
Use `SCPCollectConfigurationBuilder`.
*/
Expand Down Expand Up @@ -88,6 +97,9 @@ NS_SWIFT_NAME(CollectConfigurationBuilder)
/// Set the enableCustomerCancellation property for the `CollectConfiguration` object that will be built.
- (SCPCollectConfigurationBuilder *)setEnableCustomerCancellation:(BOOL)enableCustomerCancellation;

/// Set the enableCustomerCancellation property for the `CollectConfiguration` object that will be built.
- (SCPCollectConfigurationBuilder *)setRequestDynamicCurrencyConversion:(BOOL)requestDynamicCurrencyConversion;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,10 @@
#import <Foundation/Foundation.h>

#import <StripeTerminal/SCPBuilder.h>
#import <StripeTerminal/SCPOfflineBehavior.h>

NS_ASSUME_NONNULL_BEGIN

/**
The available operating modes that define how payment intents respond to changes in network connectivity.
*/
typedef NS_ENUM(NSInteger, SCPOfflineBehavior) {
/**
When network connectivity is available, this PaymentIntent will be transacted online. When network connectivity is unavailable, the PaymentIntent will be transacted offline.
*/
SCPOfflineBehaviorPreferOnline,
/**
The PaymentIntent will only be transacted when network connectivity is available.
*/
SCPOfflineBehaviorRequireOnline,
/**
The PaymentIntent will only be transacted offline, regardless of network connectivity.
*/
SCPOfflineBehaviorForceOffline
} NS_SWIFT_NAME(OfflineBehavior);

/**
The `CreateConfiguration` contains configuration relevant to creating a payment intent.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ typedef NS_ERROR_ENUM(SCPErrorDomain, SCPError){
*/
SCPErrorReaderConnectionConfigurationInvalid = 1940,

/**
Error reported when calling collectPaymentMethod with request dynamic currency conversion
and a CollectConfiguration with updatePaymentIntent set to false.
*/
SCPErrorRequestDynamicCurrencyConversionRequiresUpdatePaymentIntent = 1941,

/**
Dynamic Currency Conversion is not currently available.
*/
SCPErrorDynamicCurrencyConversionNotAvailable = 1942,

/**
An invalid usage of `eligibleAmount` or `skipTipping` was passed into `collect`.
*/
Expand Down Expand Up @@ -309,6 +320,12 @@ typedef NS_ERROR_ENUM(SCPErrorDomain, SCPError){
*/
SCPErrorReaderConnectionOfflineNeedsUpdate = 2872,

/**
Connecting to unseen readers offline is disabled. You must connect to this
reader at this location while online before it can be used for offline payments.
*/
SCPErrorReaderConnectionOfflinePairingUnseenDisabled = 2873,

/**
The SDK has not activated a reader online yet, meaning there is no account
with which the SDK can associate offline operations.
Expand Down Expand Up @@ -526,6 +543,12 @@ typedef NS_ERROR_ENUM(SCPErrorDomain, SCPError){
*/
SCPErrorAppleBuiltInReaderAccountDeactivated = 3970,

/**
The reader is missing encryption keys required for taking payments and has disconnected. Reconnect to the reader
to attempt to re-install the keys. If the error persists, contact support.
*/
SCPErrorReaderMissingEncryptionKeys = 3980,

/*
UNEXPECTED ERRORS
*/
Expand Down
Loading

0 comments on commit ab325c6

Please sign in to comment.