Skip to content

Commit

Permalink
feat: Mapped more exception codecs: Android (`collectInputsUnsupporte…
Browse files Browse the repository at this point in the history
…d`), IOS (`readerConnectionOfflineNeedsUpdate`, `encryptionKeyFailure`, `encryptionKeyStillInitializing`)

feat: Allow to customize tipping on `Terminal.collectPaymentMethod` method
feat: Allow to update payment intent on `Terminal.collectPaymentMethod` method
feat: Beta: Allow customer-initiated cancellation for PaymentIntent, SetupIntent, and Refund payment method collection with internet readers. See customerCancellationEnabled: on collectPaymentMethod, collectSetupIntentPaymentMethod, and collectRefundPaymentMethod Terminal methods. Note: This feature requires reader software version 2.17 or later to be installed on your internet reader. Please contact us if you want to support customer-initiated cancellation.
fix(android): Fixes TapToPay error "Must have a country code to connect to reader" [#29](#29)
feat: Bumped [Android](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#310---2023-10-10) and [IOS](https://github.com/stripe/stripe-terminal-ios/blob/master/CHANGELOG.md#310-2023-10-10) sdks versions to `3.1.0`
  • Loading branch information
BreX900 committed Oct 10, 2023
1 parent da0e438 commit f4d7c70
Show file tree
Hide file tree
Showing 28 changed files with 387 additions and 173 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/stripe_terminal_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
working-directory: stripe_terminal


jobs:
integration:
runs-on: ubuntu-latest
timeout-minutes: 5

defaults:
run:
working-directory: stripe_terminal

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
Expand All @@ -34,3 +36,31 @@ jobs:
- name: Analyze code
run: flutter analyze --no-fatal-infos

integration-example:
runs-on: macos-latest
timeout-minutes: 5

defaults:
run:
working-directory: stripe_terminal/example

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.13.x'

- name: Resolve dependencies
run: flutter pub get --enforce-lockfile
timeout-minutes: 2

- name: Check code formatting
run: >-
dart format --line-length 100 --set-exit-if-changed --output none
$(find . ! -path "./.dart_tool/**" ! -path "./build/**" -name "*.dart" ! -name "*.g.dart")
- name: Analyze code
run: flutter analyze --no-fatal-infos

- run: pod install --deployment --project-directory=ios
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class DartApiCodes extends ApiCodecs {
if (type is VoidType) throw StateError('Void type no supported');

final questionOrEmpty = type.isNullable ? '?' : '';
final exclamationOrEmpty = varAccess.contains('.') ? '!' : '';

if (type.isPrimitive) return varAccess;
if (type.isDartCoreList) {
Expand All @@ -75,13 +76,15 @@ class DartApiCodes extends ApiCodecs {
if (!type.isNullable || codec.hasNullSafeSerialization) {
return codec.encodeSerialization(this, type, varAccess);
} else {
return '$varAccess != null ? ${codec.encodeSerialization(this, type, '$varAccess!')} : null';
return '$varAccess != null '
'? ${codec.encodeSerialization(this, type, '$varAccess$exclamationOrEmpty')} '
': null';
}
}

final serializer = '_\$serialize${type.displayName}';
return type.isNullable
? '$varAccess != null ? $serializer($varAccess!) : null'
? '$varAccess != null ? $serializer($varAccess$exclamationOrEmpty) : null'
: '$serializer($varAccess)';
}
}
12 changes: 11 additions & 1 deletion stripe_terminal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@


## 3.0.1
## 3.1.0
- feat: Mapped more exception codecs: Android (`collectInputsUnsupported`), IOS (`readerConnectionOfflineNeedsUpdate`,
`encryptionKeyFailure`, `encryptionKeyStillInitializing`)
- feat: Allow to customize tipping on `Terminal.collectPaymentMethod` method
- feat: Allow to update payment intent on `Terminal.collectPaymentMethod` method
- feat: Beta: Allow customer-initiated cancellation for PaymentIntent, SetupIntent, and Refund payment method collection
with internet readers. See customerCancellationEnabled: on collectPaymentMethod, collectSetupIntentPaymentMethod, and
collectRefundPaymentMethod Terminal methods. Note: This feature requires reader software version 2.17 or later to be
installed on your internet reader. Please contact us if you want to support customer-initiated cancellation.
- fix(android): Fixes TapToPay error "Must have a country code to connect to reader" [#29](https://github.com/BreX900/mek-packages/issues/29)
- feat: Bumped [Android](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#310---2023-10-10)
and [IOS](https://github.com/stripe/stripe-terminal-ios/blob/master/CHANGELOG.md#310-2023-10-10) sdks versions to `3.1.0`

## 3.0.0
- fix: Attached the delegate reader before trying the connection
Expand Down
4 changes: 2 additions & 2 deletions stripe_terminal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ more simply by supporting streams instead of callbacks for listeners
## Features

All features of android and ios sdk are supported (Also the TapToPay feature)
- [Android sdk](https://github.com/stripe/stripe-terminal-android) version: 3.0.0
- [IOS sdk](https://github.com/stripe/stripe-terminal-ios) version: 3.0.0
- [Android sdk](https://github.com/stripe/stripe-terminal-android) version: 3.1.0
- [IOS sdk](https://github.com/stripe/stripe-terminal-ios) version: 3.1.0

> Offline mode is not supported
Expand Down
64 changes: 16 additions & 48 deletions stripe_terminal/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,35 @@
#### Ready
- Update [README.md](./README.md)
# ROADMAP

#### Done
- https://github.com/BreX900/mek-packages/issues/11
- *Backlog*: No plans to add support, try opening an issue.
- *Ready*: They will be implemented as soon as possible.
- *In progress*: They are being implemented
- *Done*: Implemented, you will find them in the next release

# Android

## 3.0.0 - 2023-09-08

### Done
- Update: `Terminal.processPayment` has been renamed to [`Terminal.confirmPaymentIntent`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/confirm-payment-intent.html).
- Update: `Terminal.processRefund` has been renamed to [`Terminal.confirmRefund`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/confirm-refund.html).
- Update: The `minSdkVersion` has been updated to 26. This means that the SDK will no longer support devices running Android 7.1.2 (Nougat) or earlier. Older devices can continue to use the 2.x versions of the SDK while on the maintenance schedule.
- Update: [`TerminalListener.onUnexpectedReaderDisconnect()`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.callable/-terminal-listener/on-unexpected-reader-disconnect.html) will be invoked if a command cannot be sent to an internet reader. Previously, this callback was only invoked when a periodic status check failed.
- Update: [`Terminal.collectPaymentMethod`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/collect-payment-method.html) now takes an optional non-null [`CollectConfiguration`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-collect-configuration/index.html) parameter.
- Update: [`Terminal.collectSetupIntentPaymentMethod`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/collect-setup-intent-payment-method.html) now takes an optional non-null [`SetupIntentConfiguration`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-setup-intent-configuration/index.html) parameter.
- Update: For readers that require updates to be installed upon connecting, [`TerminalListener.onConnectionStatusChange()`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.callable/-terminal-listener/on-connection-status-change.html) will now be called with [`CONNECTED`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-connection-status/-c-o-n-n-e-c-t-e-d/index.html) _after_ the updates complete successfully, not before.
- Update: Deprecated classes and members have been replaced or removed:
- `CardDetails.fingerprint` and `CardPresentDetails.fingerprint` have been removed from mobile SDKs. You will still be able to access the fingerprint server-side.
- `TerminalApplicationDelegate.onTrimMemory()` has been removed. It is automatically managed by the SDK.
- The `locationId` parameter from the [`HandoffConnectionConfiguration`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-connection-configuration/-handoff-connection-configuration/-handoff-connection-configuration.html) constructor has been removed.
- `EmvBlob` has been marked as an internal class.
- `ConnectConfiguration.registerToLocation` has been removed and replaced with [`ConnectConfiguration.locationId`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-connection-configuration/location-id.html).
- `Reader.registeredLocation` has been removed and replaced with [`Reader.location`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-reader/location.html).
- The `CollectConfiguration` constructor has been removed. Use [`CollectConfiguration.Builder`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-collect-configuration/-builder/index.html) instead.
- [`CollectConfiguration.moto`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-collect-configuration/moto.html) is no longer mutable.
- `CaptureMethod.getManual()` has been removed. Use [`CaptureMethod.MANUAL`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-capture-method/-companion/-manual.html) instead.
- Update: `Terminal.readReusableCard` has been removed. This functionality is replaced by [Setup Intents](https://stripe.com/docs/terminal/features/saving-cards/save-cards-directly?terminal-sdk-platform=android).
- Update: [`DiscoveryConfiguration`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-discovery-configuration/index.html) has been converted to a sealed type, instead of relying on the `DiscoveryMethod` enum to disambiguate different discovery methods.

### In progress

### Ready
- Update: The [`PaymentIntent::id`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-payment-intent/id.html) is now nullable to support creating Payment Intents while offline. This feature is in an invite-only beta. See [Collect payments while offline](https://stripe.com/docs/terminal/features/operate-offline/collect-payments) for details.
## Android

### Backlog
- Update: The [`PaymentIntent::id`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-payment-intent/id.html) is now nullable to support creating Payment Intents while offline. This feature is in an invite-only beta. See [Collect payments while offline](https://stripe.com/docs/terminal/features/operate-offline/collect-payments) for details.
- Update: Runtime permission checks have been moved from [`Terminal.initTerminal()`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/-companion/init-terminal.html) to [`Terminal.discoverReaders()`](https://stripe.dev/stripe-terminal-android/core/com.stripe.stripeterminal/-terminal/discover-readers.html).
- Bluetooth permissions are now only required when discovering readers via [`BluetoothDiscoveryConfiguration`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-discovery-configuration/-bluetooth-discovery-configuration/index.html).
- Location permissions will continue to be required for all [`DiscoveryConfigurations`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-discovery-configuration/index.html). Location services will also need to be enabled on the device at the time of discovery.
- `BluetoothReaderListener` and `UsbReaderListener` have been removed and replaced with [`ReaderListener`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.callable/-reader-listener/index.html).
- (Not exist on ios) `Reader.device` has been removed and replaced with [`Reader.bluetoothDevice`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-reader/bluetooth-device.html) and [`Reader.usbDevice`](https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-reader/usb-device.html).

# Ios
### Ready

### In progress

### Done

## Ios

### Backlog
* Update: Canceling `discoverReaders` now completes with an `SCPErrorCanceled` error. Previously no error was provided when canceled.
* Update: `SCPPaymentIntent.stripeId` is now nullable to support offline payments.
* New: Private beta support for offline payments.
* See [Collect payments while offline](https://stripe.com/docs/terminal/features/operate-offline/collect-payments) for details.

### Ready
* Update: `SCPPaymentIntent.stripeId` is now nullable to support offline payments.
* Update: Removed the `SCPErrorBusy` error. The SDK will now queue incoming commands if another command is already running.

### In progress

### Done
* Update: Configuration and parameter classes are now immutable and need to be built with builders. Example: To create `SCPPaymentIntentParameters` use `SCPPaymentIntentParametersBuilder` which has setters for all the parameters and a `build:` method to create the `SCPPaymentIntentParameters` instance.
* Update: `DiscoveryConfiguration` is now a protocol with concrete classes for each discovery method: `BluetoothScanDiscoveryConfiguration`, `BluetoothProximityDiscoveryConfiguration`, `InternetDiscoveryConfiguration`, and `LocalMobileDiscoveryConfiguration`. Each class has a `Builder` exposing only the configuration values that apply to that discovery method.
* Update: Removed `SCPErrorCannotConnectToUndiscoveredReader` and `SCPErrorMustBeDiscoveringToConnect` errors. The SDK now supports connecting to an `SCPReader` instance that was previously discovered without needing to restart discovery.
* Update: Removed `Terminal.readReusableCard`. This functionality is replaced by [SetupIntents](https://stripe.com/docs/terminal/features/saving-cards/save-cards-directly?terminal-sdk-platform=ios).
* Update: `ReconnectionDelegate` methods now provide the instance of the `Reader` that is being reconnected to instead of the `Terminal` instance.
* Update: Minimum deployment target updated from iOS 11.0 to iOS 13.0.
* Update: `Terminal.processPayment` has been renamed to `Terminal.confirmPaymentIntent`.
* Update: `Terminal.processRefund` has been renamed to `Terminal.confirmRefund`.
* Update: `discoverReaders` is now completed when `connectReader` is called. This is a behavior change from 2.x where `discoverReaders` would continue running until connect succeeded. If connect fails you can retry connecting to a previously discovered `SCPReader` or restart `discoverReaders`.
* Update: Removed `CardDetails.fingerprint` and `CardPresentDetails.fingerprint`. You will still be able to access the fingerprint server-side using [Stripe server-side SDKs](https://stripe.com/docs/libraries#server-side-libraries).

Loading

0 comments on commit f4d7c70

Please sign in to comment.