capacitor-stripe-terminal 3.0.0-beta.1 → 3.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  s.author = 'eventOne Labs <opensource@event1.io>'
9
9
  s.source = { :git => 'https://github.com/eventOneHQ/capacitor-stripe-terminal', :tag => s.version.to_s }
10
10
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
11
- s.ios.deployment_target = '12.0'
11
+ s.ios.deployment_target = '13.0'
12
12
  s.dependency 'Capacitor'
13
- s.dependency 'StripeTerminal', '2.11.0'
13
+ s.dependency 'StripeTerminal', '2.17.1'
14
14
  end
@@ -1,8 +1,8 @@
1
1
  ext {
2
- junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2.0'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0'
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
6
  }
7
7
 
8
8
  buildscript {
@@ -11,17 +11,17 @@ buildscript {
11
11
  mavenCentral()
12
12
  }
13
13
  dependencies {
14
- classpath 'com.android.tools.build:gradle:4.2.1'
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
15
  }
16
16
  }
17
17
 
18
18
  apply plugin: 'com.android.library'
19
19
 
20
20
  android {
21
- compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 31
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
22
  defaultConfig {
23
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
25
  versionCode 1
26
26
  versionName "1.0"
27
27
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -36,14 +36,13 @@ android {
36
36
  abortOnError false
37
37
  }
38
38
  compileOptions {
39
- sourceCompatibility JavaVersion.VERSION_1_8
40
- targetCompatibility JavaVersion.VERSION_1_8
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
41
  }
42
42
  }
43
43
 
44
44
  repositories {
45
45
  google()
46
- jcenter()
47
46
  mavenCentral()
48
47
  }
49
48
 
@@ -55,6 +54,7 @@ dependencies {
55
54
  testImplementation "junit:junit:$junitVersion"
56
55
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
56
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
- implementation "com.stripe:stripeterminal:2.12.0"
57
+ implementation "com.stripe:stripeterminal:2.17.1"
58
+ implementation("com.squareup.moshi:moshi:1.14.0")
59
59
  implementation "com.google.code.gson:gson:2.8.8"
60
60
  }
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
3
  zipStoreBase=GRADLE_USER_HOME
4
4
  zipStorePath=wrapper/dists
5
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
@@ -15,6 +15,7 @@ import com.getcapacitor.annotation.Permission;
15
15
  import com.getcapacitor.annotation.PermissionCallback;
16
16
  import com.stripe.stripeterminal.Terminal;
17
17
  import com.stripe.stripeterminal.external.callable.BluetoothReaderListener;
18
+ import com.stripe.stripeterminal.external.callable.BluetoothReaderReconnectionListener;
18
19
  import com.stripe.stripeterminal.external.callable.Callback;
19
20
  import com.stripe.stripeterminal.external.callable.Cancelable;
20
21
  import com.stripe.stripeterminal.external.callable.ConnectionTokenCallback;
@@ -29,8 +30,8 @@ import com.stripe.stripeterminal.external.callable.UsbReaderListener;
29
30
  import com.stripe.stripeterminal.external.models.BatteryStatus;
30
31
  import com.stripe.stripeterminal.external.models.Cart;
31
32
  import com.stripe.stripeterminal.external.models.CartLineItem;
33
+ import com.stripe.stripeterminal.external.models.CollectConfiguration;
32
34
  import com.stripe.stripeterminal.external.models.ConnectionConfiguration.BluetoothConnectionConfiguration;
33
- import com.stripe.stripeterminal.external.models.ConnectionConfiguration.EmbeddedConnectionConfiguration;
34
35
  import com.stripe.stripeterminal.external.models.ConnectionConfiguration.HandoffConnectionConfiguration;
35
36
  import com.stripe.stripeterminal.external.models.ConnectionConfiguration.InternetConnectionConfiguration;
36
37
  import com.stripe.stripeterminal.external.models.ConnectionConfiguration.LocalMobileConnectionConfiguration;
@@ -83,7 +84,8 @@ public class StripeTerminal
83
84
  DiscoveryListener,
84
85
  UsbReaderListener,
85
86
  HandoffReaderListener,
86
- BluetoothReaderListener {
87
+ BluetoothReaderListener,
88
+ BluetoothReaderReconnectionListener {
87
89
 
88
90
  Cancelable pendingDiscoverReaders = null;
89
91
  Cancelable pendingCollectPaymentMethod = null;
@@ -95,6 +97,7 @@ public class StripeTerminal
95
97
  ReaderEvent lastReaderEvent = ReaderEvent.CARD_REMOVED;
96
98
  List<? extends Reader> discoveredReadersList = null;
97
99
  Cancelable pendingInstallUpdate = null;
100
+ Cancelable pendingReaderAutoReconnect = null;
98
101
 
99
102
  @PluginMethod
100
103
  public void getPermissions(PluginCall call) {
@@ -385,8 +388,15 @@ public class StripeTerminal
385
388
  return;
386
389
  }
387
390
 
391
+ Boolean autoReconnectOnUnexpectedDisconnect = call.getBoolean(
392
+ "autoReconnectOnUnexpectedDisconnect",
393
+ false
394
+ );
395
+
388
396
  BluetoothConnectionConfiguration connectionConfig = new BluetoothConnectionConfiguration(
389
- locationId
397
+ locationId,
398
+ autoReconnectOnUnexpectedDisconnect,
399
+ this
390
400
  );
391
401
 
392
402
  Terminal
@@ -456,34 +466,6 @@ public class StripeTerminal
456
466
  );
457
467
  }
458
468
 
459
- @PluginMethod
460
- public void connectEmbeddedReader(final PluginCall call) {
461
- Reader reader = getReaderFromDiscovered(call);
462
-
463
- if (reader == null) {
464
- return;
465
- }
466
-
467
- String locationId = call.getString("locationId");
468
-
469
- if (locationId == null) {
470
- call.reject("Must provide a location ID");
471
- return;
472
- }
473
-
474
- EmbeddedConnectionConfiguration connectionConfig = new EmbeddedConnectionConfiguration(
475
- locationId
476
- );
477
-
478
- Terminal
479
- .getInstance()
480
- .connectEmbeddedReader(
481
- reader,
482
- connectionConfig,
483
- this.createReaderCallback(call)
484
- );
485
- }
486
-
487
469
  @PluginMethod
488
470
  public void connectHandoffReader(final PluginCall call) {
489
471
  Reader reader = getReaderFromDiscovered(call);
@@ -610,6 +592,12 @@ public class StripeTerminal
610
592
 
611
593
  @PluginMethod
612
594
  public void collectPaymentMethod(final PluginCall call) {
595
+ Boolean updatePaymentIntent = call.getBoolean("updatePaymentIntent", false);
596
+
597
+ CollectConfiguration collectConfig = new CollectConfiguration.Builder()
598
+ .updatePaymentIntent(updatePaymentIntent)
599
+ .build();
600
+
613
601
  if (currentPaymentIntent != null) {
614
602
  pendingCollectPaymentMethod =
615
603
  Terminal
@@ -643,7 +631,8 @@ public class StripeTerminal
643
631
  e
644
632
  );
645
633
  }
646
- }
634
+ },
635
+ collectConfig
647
636
  );
648
637
  } else {
649
638
  call.reject(
@@ -922,6 +911,31 @@ public class StripeTerminal
922
911
  getSimulatorConfiguration(call);
923
912
  }
924
913
 
914
+ @PluginMethod
915
+ public void cancelAutoReconnect(final PluginCall call) {
916
+ if (
917
+ pendingReaderAutoReconnect != null &&
918
+ !pendingReaderAutoReconnect.isCompleted()
919
+ ) {
920
+ pendingReaderAutoReconnect.cancel(
921
+ new Callback() {
922
+ @Override
923
+ public void onSuccess() {
924
+ pendingReaderAutoReconnect = null;
925
+ call.resolve();
926
+ }
927
+
928
+ @Override
929
+ public void onFailure(@NonNull TerminalException e) {
930
+ call.reject(e.getErrorMessage(), e);
931
+ }
932
+ }
933
+ );
934
+ } else {
935
+ call.resolve();
936
+ }
937
+ }
938
+
925
939
  @Override
926
940
  public void fetchConnectionToken(
927
941
  @NonNull ConnectionTokenCallback connectionTokenCallback
@@ -1079,4 +1093,22 @@ public class StripeTerminal
1079
1093
  ret.put("update", TerminalUtils.serializeUpdate(readerSoftwareUpdate));
1080
1094
  notifyListeners("didStartInstallingUpdate", ret);
1081
1095
  }
1096
+
1097
+ @Override
1098
+ public void onReaderReconnectStarted(@NonNull Cancelable cancelReconnect) {
1099
+ pendingReaderAutoReconnect = cancelReconnect;
1100
+ notifyListeners("didStartReaderReconnect", null);
1101
+ }
1102
+
1103
+ @Override
1104
+ public void onReaderReconnectSucceeded() {
1105
+ pendingReaderAutoReconnect = null;
1106
+ notifyListeners("didSucceedReaderReconnect", null);
1107
+ }
1108
+
1109
+ @Override
1110
+ public void onReaderReconnectFailed(@NonNull Reader reader) {
1111
+ pendingReaderAutoReconnect = null;
1112
+ notifyListeners("didFailReaderReconnect", null);
1113
+ }
1082
1114
  }
@@ -1,13 +1,21 @@
1
1
  package io.event1.capacitorstripeterminal;
2
2
 
3
+ import com.getcapacitor.JSArray;
3
4
  import com.getcapacitor.JSObject;
5
+ import com.squareup.moshi.Moshi;
4
6
  import com.stripe.stripeterminal.external.models.Address;
7
+ import com.stripe.stripeterminal.external.models.AmountDetails;
8
+ import com.stripe.stripeterminal.external.models.AmountDetailsJsonAdapter;
9
+ import com.stripe.stripeterminal.external.models.Charge;
10
+ import com.stripe.stripeterminal.external.models.ChargeJsonAdapter;
5
11
  import com.stripe.stripeterminal.external.models.ConnectionStatus;
6
12
  import com.stripe.stripeterminal.external.models.DeviceType;
7
13
  import com.stripe.stripeterminal.external.models.DiscoveryMethod;
8
14
  import com.stripe.stripeterminal.external.models.Location;
9
15
  import com.stripe.stripeterminal.external.models.PaymentIntent;
10
16
  import com.stripe.stripeterminal.external.models.PaymentIntentStatus;
17
+ import com.stripe.stripeterminal.external.models.PaymentMethod;
18
+ import com.stripe.stripeterminal.external.models.PaymentMethodJsonAdapter;
11
19
  import com.stripe.stripeterminal.external.models.PaymentStatus;
12
20
  import com.stripe.stripeterminal.external.models.Reader;
13
21
  import com.stripe.stripeterminal.external.models.ReaderDisplayMessage;
@@ -101,6 +109,41 @@ public class TerminalUtils {
101
109
  );
102
110
  object.put("amount", paymentIntent.getAmount());
103
111
  object.put("currency", currency);
112
+ object.put("amountTip", paymentIntent.getAmountTip());
113
+ object.put("statementDescriptor", paymentIntent.getStatementDescriptor());
114
+ object.put(
115
+ "statementDescriptorSuffix",
116
+ paymentIntent.getStatementDescriptorSuffix()
117
+ );
118
+
119
+ Moshi moshi = new Moshi.Builder().build();
120
+
121
+ PaymentMethod paymentMethod = paymentIntent.getPaymentMethod();
122
+ AmountDetails amountDetails = paymentIntent.getAmountDetails();
123
+
124
+ if (amountDetails != null) {
125
+ AmountDetailsJsonAdapter adapter = new AmountDetailsJsonAdapter(moshi);
126
+ String amountDetailsString = adapter.toJson(amountDetails);
127
+ object.put("amountDetails", amountDetailsString);
128
+ }
129
+
130
+ if (paymentMethod != null) {
131
+ PaymentMethodJsonAdapter paymentMethodAdapter = new PaymentMethodJsonAdapter(
132
+ moshi
133
+ );
134
+ String paymentMethodString = paymentMethodAdapter.toJson(paymentMethod);
135
+ object.put("paymentMethod", paymentMethodString);
136
+ }
137
+
138
+ JSArray charges = new JSArray();
139
+ if (paymentIntent.getCharges() != null) {
140
+ ChargeJsonAdapter adapter = new ChargeJsonAdapter(moshi);
141
+
142
+ for (Charge charge : paymentIntent.getCharges()) {
143
+ charges.put(adapter.toJson(charge));
144
+ }
145
+ }
146
+ object.put("charges", charges);
104
147
 
105
148
  JSObject metaData = new JSObject();
106
149
  if (paymentIntent.getMetadata() != null) {
@@ -151,6 +194,13 @@ public class TerminalUtils {
151
194
  if (address != null) {
152
195
  object.put("address", serializeAddress(address));
153
196
  }
197
+ JSObject metaData = new JSObject();
198
+ if (location.getMetadata() != null) {
199
+ for (String key : location.getMetadata().keySet()) {
200
+ metaData.put(key, String.valueOf(location.getMetadata().get(key)));
201
+ }
202
+ }
203
+ object.put("metadata", metaData);
154
204
 
155
205
  return object;
156
206
  }
@@ -215,8 +265,10 @@ public class TerminalUtils {
215
265
  return 2;
216
266
  } else if (type == DeviceType.WISEPOS_E.ordinal()) {
217
267
  return 4;
268
+ } else if (type == DeviceType.STRIPE_S700.ordinal()) {
269
+ return 9;
218
270
  } else {
219
- return 5;
271
+ return 6;
220
272
  }
221
273
  }
222
274
 
@@ -1,4 +1,5 @@
1
1
  import type { PluginListenerHandle, PermissionState } from '@capacitor/core';
2
+ import { Stripe } from 'stripe';
2
3
  export interface PermissionStatus {
3
4
  location: PermissionState;
4
5
  bluetooth: PermissionState;
@@ -63,26 +64,36 @@ export declare enum DeviceType {
63
64
  /**
64
65
  * The BBPOS WisePad 3 mobile reader.
65
66
  *
66
- * Support for this reader is currently in beta.
67
- *
68
67
  * @see https://stripe.com/docs/terminal/readers/bbpos-wisepad3
69
68
  */
70
69
  WisePad3 = 2,
71
70
  /**
72
71
  * The Stripe Reader M2 mobile reader.
73
72
  *
74
- * Support for this reader is currently in beta.
73
+ * @see https://stripe.com/docs/terminal/readers/stripe-m2
75
74
  */
76
75
  StripeM2 = 3,
77
76
  /**
78
77
  * The BBPOS WisePOS E countertop reader.
79
78
  *
80
- * Support for this reader is currently in beta.
81
- *
82
79
  * @see https://stripe.com/docs/terminal/readers/bbpos-wisepos-e
83
80
  */
84
81
  WisePosE = 4,
85
- Unknown = 5
82
+ /**
83
+ * The BBPOS WisePOS E DevKit countertop reader.
84
+ *
85
+ * @see https://stripe.com/docs/terminal/readers/bbpos-wisepos-e
86
+ */
87
+ WisePosEDevKit = 5,
88
+ Unknown = 6,
89
+ /**
90
+ * The Stripe S7 countertop reader.
91
+ */
92
+ StripeS700 = 9,
93
+ /**
94
+ * Apple Built-In reader.
95
+ */
96
+ AppleBuiltIn = 10
86
97
  }
87
98
  /**
88
99
  * The possible methods for discovering a reader.
@@ -246,27 +257,25 @@ export interface ConnectionConfiguration {
246
257
  * @see https://stripe.com/docs/terminal/readers/fleet-management#bbpos-wisepad3-discovery
247
258
  */
248
259
  locationId: string;
249
- /**
250
- * When set to true, the connection will automatically error if the reader is already connected to a device and collecting payment. When set to false, this will allow you to connect to a reader already connected to another device, and will break the existing reader-to-SDK connection on the other device when it attempts to collect payment.
251
- * @default false
252
- */
253
- failIfInUse?: boolean;
254
260
  }
255
261
  /**
256
262
  * @category Reader
257
263
  */
258
264
  export interface BluetoothConnectionConfiguration extends ConnectionConfiguration {
265
+ /**
266
+ * When set to true, the Terminal SDK will attempt a Bluetooth auto-reconnection on any unexpected disconnect.
267
+ *
268
+ * When set to false, we will immediately surface any disconnection through TerminalDelegate.
269
+ *
270
+ * @default false
271
+ */
272
+ autoReconnectOnUnexpectedDisconnect?: boolean;
259
273
  }
260
274
  /**
261
275
  * @category Reader
262
276
  */
263
277
  export interface UsbConnectionConfiguration extends ConnectionConfiguration {
264
278
  }
265
- /**
266
- * @category Reader
267
- */
268
- export interface EmbeddedConnectionConfiguration extends ConnectionConfiguration {
269
- }
270
279
  /**
271
280
  * @category Reader
272
281
  */
@@ -276,15 +285,39 @@ export interface HandoffConnectionConfiguration extends ConnectionConfiguration
276
285
  * @category Reader
277
286
  */
278
287
  export interface LocalMobileConnectionConfiguration extends ConnectionConfiguration {
288
+ /**
289
+ * If your integration is creating destination charges and using `on_behalf_of`, you must provide the `connected_account_id` in the `onBehalfOf` parameter as part of the `LocalMobileConnectionConfiguration`. Unlike other reader types which require this information on a per-transaction basis, the Apple Built-In reader requires this on a per-connection basis as well in order to establish a reader connection.
290
+ *
291
+ * @see https://stripe.com/docs/terminal/features/connect#destination-payment-intents
292
+ */
293
+ onBehalfOf?: string;
294
+ /**
295
+ * Optional cardholder facing merchant display name that will be used in the prompt for the cardholder to present their card. If this value is not provided, the merchant display name will be taken from the Terminal `Location.display_name` associated with the connection.
296
+ */
297
+ merchantDisplayName?: string;
298
+ /**
299
+ * In order to connect to a reader, merchant-specific terms of service may need to be accepted. Presenting the flow requires iCloud sign-in and an authorized individual. This attribute determines how the connection process should proceed if this situation is encountered.
300
+ * - If YES, the terms the terms of service should be presented during connection. If accepted successfully, the connection process will resume. If not accepted successfully, the connection will fail with an error.
301
+ * - If NO, the terms of service will not be presented and the connection will fail with an error.
302
+ *
303
+ * @default false
304
+ */
305
+ tosAcceptancePermitted?: boolean;
279
306
  }
280
307
  /**
281
308
  * @category Reader
282
309
  */
283
310
  export interface InternetConnectionConfiguration extends ConnectionConfiguration {
311
+ /**
312
+ * When set to true, the connection will automatically error if the reader is already connected to a device and collecting payment. When set to false, this will allow you to connect to a reader already connected to another device, and will break the existing reader-to-SDK connection on the other device when it attempts to collect payment.
313
+ *
314
+ * @default false
315
+ */
316
+ failIfInUse?: boolean;
284
317
  /**
285
318
  * If set to true, the customer will be able to press the red X button on the Verifone P400 to cancel a `collectPaymentMethod`, `collectReusableCard`, or `collectRefundPaymentMethod` command.
286
319
  *
287
- * This behavior is part of a private beta. Setting this property will have no effect if you are not part of the allowCustomerCancel beta program.
320
+ * @note This behavior is part of a private beta. Setting this property will have no effect if you are not part of the allowCustomerCancel beta program.
288
321
  *
289
322
  * @default false
290
323
  */
@@ -481,11 +514,62 @@ export declare enum PaymentIntentStatus {
481
514
  * @see https://stripe.com/docs/api/payment_intents
482
515
  */
483
516
  export interface PaymentIntent {
517
+ /**
518
+ * The unique identifier for the intent.
519
+ */
484
520
  stripeId: string;
521
+ /**
522
+ * When the intent was created.
523
+ */
485
524
  created: number;
525
+ /**
526
+ * The status of the PaymentIntent.
527
+ */
486
528
  status: PaymentIntentStatus;
529
+ /**
530
+ * The amount to be collected by this PaymentIntent, provided in the currency’s smallest unit.
531
+ *
532
+ * @see https://stripe.com/docs/currencies#zero-decimal
533
+ */
487
534
  amount: number;
535
+ /**
536
+ * The currency of the payment.
537
+ */
488
538
  currency: string;
539
+ /**
540
+ * Set of key-value pairs attached to the object.
541
+ *
542
+ * @see https://stripe.com/docs/api#metadata
543
+ */
544
+ metadata: {
545
+ [key: string]: string;
546
+ };
547
+ /**
548
+ * Charges that were created by this `PaymentIntent`, if any.
549
+ */
550
+ charges: Stripe.Charge[];
551
+ /**
552
+ * The payment method to be used in this `PaymentIntent`. Only valid in the intent returned during `collectPaymentMethod` when using the `updatePaymentIntent` option in the `CollectConfig`.
553
+ */
554
+ paymentMethod: Stripe.PaymentMethod | null;
555
+ /**
556
+ * Details about items included in the amount after confirmation.
557
+ */
558
+ amountDetails?: Stripe.PaymentIntent.AmountDetails;
559
+ /**
560
+ * Indicates how much the user intends to tip in addition to the amount by at confirmation time. This is only non-null in the `PaymentIntent` instance returned during collect when using `updatePaymentIntent` set to true in the `CollectConfig`.
561
+ *
562
+ * After `processPaymentIntent` the amount will have this tip `amount` added to it and the `amountDetails` will contain the breakdown of how much of the `amount` was a tip.
563
+ */
564
+ amountTip?: number;
565
+ /**
566
+ * Extra information about a PaymentIntent. This will appear on your customer’s statement when this PaymentIntent succeeds in creating a charge.
567
+ */
568
+ statementDescriptor?: string;
569
+ /**
570
+ * Extra dynamic information about a PaymentIntent. This will appear concatenated with the statementDescriptor on your customer’s statement when this PaymentIntent succeeds in creating a charge.
571
+ */
572
+ statementDescriptorSuffix?: string;
489
573
  }
490
574
  /**
491
575
  * An `Cart` object contains information about what line items are included in the current transaction. A cart object should be created and then passed into `setReaderDisplay()`, which will display the cart's contents on the reader's screen.
@@ -666,6 +750,29 @@ export declare enum DeviceStyle {
666
750
  Internet = 0,
667
751
  Bluetooth = 1
668
752
  }
753
+ export interface TippingConfig {
754
+ eligibleAmount?: number | null;
755
+ }
756
+ export interface CollectConfig {
757
+ /**
758
+ * Bypass tipping selection if it would have otherwise been shown.
759
+ *
760
+ * @default false
761
+ */
762
+ skipTipping?: boolean;
763
+ /**
764
+ * The tipping configuration for this payment collection.
765
+ *
766
+ * @see https://stripe.com/docs/terminal/features/collecting-tips/on-reader#tip-eligible
767
+ */
768
+ tipping?: TippingConfig | null;
769
+ /**
770
+ * Whether or not to update the PaymentIntent server side during collectPaymentMethod.
771
+ *
772
+ * @default false
773
+ */
774
+ updatePaymentIntent?: boolean;
775
+ }
669
776
  /**
670
777
  * @ignore
671
778
  */
@@ -679,6 +786,7 @@ export interface StripeTerminalInterface {
679
786
  connectBluetoothReader(options: {
680
787
  serialNumber: string;
681
788
  locationId: string;
789
+ autoReconnectOnUnexpectedDisconnect?: boolean;
682
790
  }): Promise<{
683
791
  reader: Reader | null;
684
792
  }>;
@@ -699,12 +807,9 @@ export interface StripeTerminalInterface {
699
807
  connectLocalMobileReader(options: {
700
808
  serialNumber: string;
701
809
  locationId: string;
702
- }): Promise<{
703
- reader: Reader | null;
704
- }>;
705
- connectEmbeddedReader(options: {
706
- serialNumber: string;
707
- locationId: string;
810
+ onBehalfOf?: string;
811
+ merchantDisplayName?: string;
812
+ tosAcceptancePermitted?: boolean;
708
813
  }): Promise<{
709
814
  reader: Reader | null;
710
815
  }>;
@@ -732,7 +837,7 @@ export interface StripeTerminalInterface {
732
837
  }): Promise<{
733
838
  intent: PaymentIntent | null;
734
839
  }>;
735
- collectPaymentMethod(): Promise<{
840
+ collectPaymentMethod(configOverride?: CollectConfig): Promise<{
736
841
  intent: PaymentIntent;
737
842
  }>;
738
843
  cancelCollectPaymentMethod(): Promise<void>;
@@ -748,6 +853,7 @@ export interface StripeTerminalInterface {
748
853
  }>;
749
854
  getSimulatorConfiguration(): Promise<SimulatorConfiguration>;
750
855
  setSimulatorConfiguration(config: SimulatorConfiguration): Promise<SimulatorConfiguration>;
856
+ cancelAutoReconnect(): Promise<void>;
751
857
  /**
752
858
  * @deprecated use requestPermissions and checkPermissions
753
859
  */
@@ -767,5 +873,6 @@ export interface StripeTerminalInterface {
767
873
  update?: ReaderSoftwareUpdate;
768
874
  error?: string;
769
875
  }) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
876
+ addListener(eventName: 'didStartReaderReconnect' | 'didSucceedReaderReconnect' | 'didFailReaderReconnect', listenerFunc: (data: null) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
770
877
  addListener(eventName: string, listenerFunc: Function): Promise<PluginListenerHandle> & PluginListenerHandle;
771
878
  }
@@ -61,26 +61,36 @@ export var DeviceType;
61
61
  /**
62
62
  * The BBPOS WisePad 3 mobile reader.
63
63
  *
64
- * Support for this reader is currently in beta.
65
- *
66
64
  * @see https://stripe.com/docs/terminal/readers/bbpos-wisepad3
67
65
  */
68
66
  DeviceType[DeviceType["WisePad3"] = 2] = "WisePad3";
69
67
  /**
70
68
  * The Stripe Reader M2 mobile reader.
71
69
  *
72
- * Support for this reader is currently in beta.
70
+ * @see https://stripe.com/docs/terminal/readers/stripe-m2
73
71
  */
74
72
  DeviceType[DeviceType["StripeM2"] = 3] = "StripeM2";
75
73
  /**
76
74
  * The BBPOS WisePOS E countertop reader.
77
75
  *
78
- * Support for this reader is currently in beta.
79
- *
80
76
  * @see https://stripe.com/docs/terminal/readers/bbpos-wisepos-e
81
77
  */
82
78
  DeviceType[DeviceType["WisePosE"] = 4] = "WisePosE";
83
- DeviceType[DeviceType["Unknown"] = 5] = "Unknown";
79
+ /**
80
+ * The BBPOS WisePOS E DevKit countertop reader.
81
+ *
82
+ * @see https://stripe.com/docs/terminal/readers/bbpos-wisepos-e
83
+ */
84
+ DeviceType[DeviceType["WisePosEDevKit"] = 5] = "WisePosEDevKit";
85
+ DeviceType[DeviceType["Unknown"] = 6] = "Unknown";
86
+ /**
87
+ * The Stripe S7 countertop reader.
88
+ */
89
+ DeviceType[DeviceType["StripeS700"] = 9] = "StripeS700";
90
+ /**
91
+ * Apple Built-In reader.
92
+ */
93
+ DeviceType[DeviceType["AppleBuiltIn"] = 10] = "AppleBuiltIn";
84
94
  })(DeviceType || (DeviceType = {}));
85
95
  /**
86
96
  * The possible methods for discovering a reader.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,uEAAgB,CAAA;IAChB;;OAEG;IACH,iEAAa,CAAA;IACb;;OAEG;IACH,mEAAc,CAAA;AAChB,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAiBX;AAjBD,WAAY,aAAa;IACvB;;OAEG;IACH,yDAAY,CAAA;IACZ;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,uEAAmB,CAAA;IACnB;;OAEG;IACH,6DAAc,CAAA;AAChB,CAAC,EAjBW,aAAa,KAAb,aAAa,QAiBxB;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,UAyCX;AAzCD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qDAAS,CAAA;IAET;;;;OAIG;IACH,2DAAY,CAAA;IAEZ;;;;;;OAMG;IACH,mDAAQ,CAAA;IAER;;;;OAIG;IACH,mDAAQ,CAAA;IAER;;;;;;OAMG;IACH,mDAAQ,CAAA;IAER,iDAAO,CAAA;AACT,CAAC,EAzCW,UAAU,KAAV,UAAU,QAyCrB;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eAsDX;AAtDD,WAAY,eAAe;IACzB;;OAEG;IACH,uEAA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