Skip to content

Commit

Permalink
2.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mindy-stripe committed Apr 3, 2023
1 parent 28370e9 commit 4154a8e
Show file tree
Hide file tree
Showing 432 changed files with 138,837 additions and 1,029 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ If you are using CocoaPods, update your Podfile:
```
pod 'StripeTerminal', '~> 2.0'
```
# 2.19.0 2023-04-03
* New: Cancel `PaymentIntent` and `SetupIntent` via the SDK when connected to an internet reader by calling [`cancelPaymentIntent`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPTerminal.html#/c:objc(cs)SCPTerminal(im)cancelPaymentIntent:completion:) or [`cancelSetupIntent`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPTerminal.html#/c:objc(cs)SCPTerminal(im)cancelSetupIntent:completion:) instead of using your backend.
* _Note: This feature requires version `2.11.0.24` or later to be installed on your internet reader._
* Added [`authorizationCode`](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-receipt-authorization_code) to [`SCPReceiptDetails`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPReceiptDetails.html).
* Added support for simulating an on-reader tip amount to the [`SCPSimulatorConfiguration`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPSimulatorConfiguration.html) when collecting and processing a payment using a simulated reader.
* Add two new simulated test cards: `.eftposAuVisaDebit` & `.eftposAuDebitMastercard` to [ `SCPSimulatedCardType`](https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPSimulatedCardType.html)
* Added [`captureMethod`](https://stripe.dev/stripe-terminal-ios/docs/Classes/SCPPaymentIntent.html#/c:objc(cs)SCPPaymentIntent(py)captureMethod) property to `SCPPaymentIntent`.

# 2.18.1 2023-03-15
* Fixes an issue where the SDK may report a failure during `processPayment` when using a WisePad 3 and the reader times out waiting for the /confirm response from the Stripe API. The SDK will now will report success if the PaymentIntent status moved to `requires_capture` or `succeeded`.

Expand Down
46 changes: 23 additions & 23 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
A63E8431260D073B006CB90C /* CreateLocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63E8430260D073B006CB90C /* CreateLocationViewController.swift */; };
A63E8435260D0A0D006CB90C /* SelectLocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63E8434260D0A0D006CB90C /* SelectLocationViewController.swift */; };
A63E8457260D23C9006CB90C /* StripeCountries.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63E8456260D23C9006CB90C /* StripeCountries.swift */; };
B1BFECBE2C293B7F6F43934E /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BBCA8B8D89E2A5CA481D1CB /* Pods_Example.framework */; };
B3C24C6C23285BF6003271BD /* ifaddrs.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3C24C6B23285BF6003271BD /* ifaddrs.swift */; };
C151C7A621605B6200FC206F /* UpdateReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C151C7A521605B6200FC206F /* UpdateReaderViewController.swift */; };
C152F7782149ECA30078BD07 /* ReadReusableCardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C152F7772149ECA20078BD07 /* ReadReusableCardViewController.swift */; };
Expand All @@ -45,6 +44,7 @@
C1DE30D721438E9900A3026F /* UIViewController+UIAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1DE30D121438E9800A3026F /* UIViewController+UIAlertController.swift */; };
C1DE30D821438E9900A3026F /* UIView+Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1DE30D221438E9800A3026F /* UIView+Layout.swift */; };
C1F78BDB2144F0830094BE37 /* CustomViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F78BDA2144F0830094BE37 /* CustomViews.swift */; };
ECCE943A29850596A074425C /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11924A618586BB3FB4FBCAE3 /* Pods_Example.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -65,6 +65,7 @@
022FB25A245868EF00F4C321 /* StripeTerminal.xcframework */ = {isa = PBXFileReference; explicitFileType = wrapper.xcframework; path = StripeTerminal.xcframework; sourceTree = SOURCE_ROOT; };
02370F5C244C94D00056D896 /* CancelableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CancelableViewController.swift; sourceTree = "<group>"; };
02DA8E3924532E4900235921 /* DelegateAnnouncer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DelegateAnnouncer.swift; sourceTree = "<group>"; };
11924A618586BB3FB4FBCAE3 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
199A008C245A2D6F00E89BE9 /* TableViewController+StripeTerminal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TableViewController+StripeTerminal.swift"; sourceTree = "<group>"; };
241B90F8249027DE0083C908 /* ReaderRegistrationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderRegistrationViewController.swift; sourceTree = "<group>"; };
2446E3EE25AF499B00FB4510 /* SetupIntentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupIntentViewController.swift; sourceTree = "<group>"; };
Expand All @@ -74,8 +75,7 @@
259FDFDE2485AF0F0097686C /* EventDisplayingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventDisplayingViewController.swift; sourceTree = "<group>"; };
25CB2CF624941F8D0018535C /* StartSetReaderDisplayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartSetReaderDisplayViewController.swift; sourceTree = "<group>"; };
3936853D28860BDE0026A906 /* CaptureMethod+String.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CaptureMethod+String.swift"; sourceTree = "<group>"; };
4BBCA8B8D89E2A5CA481D1CB /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
68C3367A0CD4F7DB1427ADF0 /* 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>"; };
3D9C64B5A8713739F84D3678 /* 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>"; };
6F8BE0912177B403009511E5 /* DiscoveryMethodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscoveryMethodViewController.swift; 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>"; };
Expand All @@ -102,7 +102,7 @@
C1DE30D121438E9800A3026F /* UIViewController+UIAlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+UIAlertController.swift"; sourceTree = "<group>"; };
C1DE30D221438E9800A3026F /* UIView+Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Layout.swift"; sourceTree = "<group>"; };
C1F78BDA2144F0830094BE37 /* CustomViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomViews.swift; sourceTree = "<group>"; };
CFF56A7DB13F7A64B11032A5 /* 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>"; };
FEA2646D56C58E3761266395 /* 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>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -111,20 +111,30 @@
buildActionMask = 2147483647;
files = (
022FB25B245868EF00F4C321 /* StripeTerminal.xcframework in Frameworks */,
B1BFECBE2C293B7F6F43934E /* Pods_Example.framework in Frameworks */,
ECCE943A29850596A074425C /* Pods_Example.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
2E7D0EB729C613630A281CC8 /* Pods */ = {
isa = PBXGroup;
children = (
3D9C64B5A8713739F84D3678 /* Pods-Example.debug.xcconfig */,
FEA2646D56C58E3761266395 /* Pods-Example.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
C16F40942094F07B009CE87C = {
isa = PBXGroup;
children = (
C16F409F2094F07B009CE87C /* Example */,
EE087B524FD387212EBE036B /* Frameworks */,
C16F409E2094F07B009CE87C /* Products */,
EE4E22BFCA386A160DB7646C /* Pods */,
2E7D0EB729C613630A281CC8 /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -184,34 +194,24 @@
isa = PBXGroup;
children = (
022FB25A245868EF00F4C321 /* StripeTerminal.xcframework */,
4BBCA8B8D89E2A5CA481D1CB /* Pods_Example.framework */,
11924A618586BB3FB4FBCAE3 /* Pods_Example.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
EE4E22BFCA386A160DB7646C /* Pods */ = {
isa = PBXGroup;
children = (
CFF56A7DB13F7A64B11032A5 /* Pods-Example.debug.xcconfig */,
68C3367A0CD4F7DB1427ADF0 /* Pods-Example.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
C16F409C2094F07B009CE87C /* Example */ = {
isa = PBXNativeTarget;
buildConfigurationList = C16F40AF2094F07C009CE87C /* Build configuration list for PBXNativeTarget "Example" */;
buildPhases = (
BEA0810E7A3021C03D51A737 /* [CP] Check Pods Manifest.lock */,
9AC2578999BB2376F5D3C8BC /* [CP] Check Pods Manifest.lock */,
C16F40992094F07B009CE87C /* Sources */,
C16F409B2094F07B009CE87C /* Resources */,
0DE2ACED4D7F3843500B5F14 /* Frameworks */,
02A6BF5524CB1C3D0054ADFF /* CopyFiles */,
6313EA52CD77D422FE0AE313 /* [CP] Embed Pods Frameworks */,
31AA7CB5AB7CCD316C49262D /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -271,7 +271,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
6313EA52CD77D422FE0AE313 /* [CP] Embed Pods Frameworks */ = {
31AA7CB5AB7CCD316C49262D /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -291,7 +291,7 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BEA0810E7A3021C03D51A737 /* [CP] Check Pods Manifest.lock */ = {
9AC2578999BB2376F5D3C8BC /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -494,7 +494,7 @@
};
C16F40B02094F07C009CE87C /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CFF56A7DB13F7A64B11032A5 /* Pods-Example.debug.xcconfig */;
baseConfigurationReference = 3D9C64B5A8713739F84D3678 /* Pods-Example.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
Expand All @@ -520,7 +520,7 @@
};
C16F40B12094F07C009CE87C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 68C3367A0CD4F7DB1427ADF0 /* Pods-Example.release.xcconfig */;
baseConfigurationReference = FEA2646D56C58E3761266395 /* Pods-Example.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
Expand Down
2 changes: 2 additions & 0 deletions Example/Example/CustomViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ class TestCardPickerView: TextFieldView, UIPickerViewDelegate, UIPickerViewDataS
.unionPay,
.interac,
.eftposAuDebit,
.eftposAuVisaDebit,
.eftposAuDebitMastercard,
.onlinePinCvm,
.onlinePinScaRetry,
.offlinePinCvm,
Expand Down
1 change: 0 additions & 1 deletion Example/Example/EventDisplayingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class EventDisplayingViewController: TableViewController, CancelableViewControll
event.object = .error(error as NSError)
} else {
event.result = .succeeded
self.dismiss(animated: true, completion: nil)
}
self.events.append(event)
}
Expand Down
16 changes: 16 additions & 0 deletions Example/Example/LogEventViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ struct LogEvent: CustomStringConvertible, Event {
case backendCreateSetupIntent = "backend.createSetupIntent"
case retrieveSetupIntent = "backend.retrieveSetupIntent"
case captureSetupIntent = "backend.captuteSetupIntent"
case cancelPaymentIntent = "terminal.cancelPaymentIntent"
case cancelSetupIntent = "terminal.cancelSetupIntent"
}

enum AssociatedObject {
Expand Down Expand Up @@ -234,6 +236,20 @@ struct LogEvent: CustomStringConvertible, Event {
case .errored: string = "Capture SetupIntent Failed"
case .message(let message): string = message
}
case .cancelPaymentIntent:
switch result {
case .started: string = "Cancel PaymentIntent"
case .succeeded: string = "Canceled PaymentIntent"
case .errored: string = "Cancel PaymentIntent Failed"
case .message(let message): string = message
}
case .cancelSetupIntent:
switch result {
case .started: string = "Cancel SetupIntent"
case .succeeded: string = "Canceled SetupIntent"
case .errored: string = "Cancel SetupIntent Failed"
case .message(let message): string = message
}
}
return string
}
Expand Down
25 changes: 23 additions & 2 deletions Example/Example/PaymentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ class PaymentViewController: EventDisplayingViewController {
collectEvent.result = .errored
collectEvent.object = .error(error as NSError)
self.events.append(collectEvent)
self.complete()
if (error as NSError).code == ErrorCode.canceled.rawValue {
self.cancelPaymentIntent(intent: intent)
} else {
self.complete()
}
} else if let intent = intentWithPaymentMethod {
// Before proceeding check if the card brand provided matches the brand chosen to reject
if let declineCardBrand = self.declineCardBrand,
Expand Down Expand Up @@ -141,7 +145,7 @@ class PaymentViewController: EventDisplayingViewController {
cancelEvent.object = .paymentIntent(intent)
}
self.events.append(cancelEvent)
self.complete()
self.cancelPaymentIntent(intent: intent)
}
}
return
Expand All @@ -157,6 +161,23 @@ class PaymentViewController: EventDisplayingViewController {
}
}

private func cancelPaymentIntent(intent: PaymentIntent) {
var cancelEvent = LogEvent(method: .cancelPaymentIntent)
self.events.append(cancelEvent)
Terminal.shared.cancelPaymentIntent(intent) { canceledPaymentIntent, cancelError in
if let error = cancelError {
cancelEvent.result = .errored
cancelEvent.object = .error(error as NSError)
self.events.append(cancelEvent)
} else if let intent = canceledPaymentIntent {
cancelEvent.result = .succeeded
cancelEvent.object = .paymentIntent(intent)
self.events.append(cancelEvent)
}
self.complete()
}
}

private func confirmPaymentIntent(intent: PaymentIntent) {
var processEvent = LogEvent(method: .processPayment)
self.events.append(processEvent)
Expand Down
23 changes: 22 additions & 1 deletion Example/Example/SetupIntentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ class SetupIntentViewController: EventDisplayingViewController {
collectEvent.result = .errored
collectEvent.object = .error(error as NSError)
self.events.append(collectEvent)
self.complete()
if (error as NSError).code == ErrorCode.canceled.rawValue {
self.cancelSetupIntent(intent: intent)
} else {
self.complete()
}
} else if let intent = collectedSetupIntent {
collectEvent.result = .succeeded
collectEvent.object = .setupIntent(intent)
Expand All @@ -66,6 +70,23 @@ class SetupIntentViewController: EventDisplayingViewController {
}
}

private func cancelSetupIntent(intent: SetupIntent) {
var cancelEvent = LogEvent(method: .cancelSetupIntent)
self.events.append(cancelEvent)
Terminal.shared.cancelSetupIntent(intent) { canceledSetupIntent, cancelError in
if let error = cancelError {
cancelEvent.result = .errored
cancelEvent.object = .error(error as NSError)
self.events.append(cancelEvent)
} else if let intent = canceledSetupIntent {
cancelEvent.result = .succeeded
cancelEvent.object = .setupIntent(intent)
self.events.append(cancelEvent)
}
self.complete()
}
}

private func confirmSetupIntent(_ intent: SetupIntent) {
var processEvent = LogEvent(method: .confirmSetupIntent)
self.events.append(processEvent)
Expand Down
Loading

0 comments on commit 4154a8e

Please sign in to comment.