capacitor-stripe-terminal 3.0.0-beta.2 → 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.
- package/CapacitorStripeTerminal.podspec +1 -1
- package/android/build.gradle +12 -12
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/io/event1/capacitorstripeterminal/StripeTerminal.java +64 -32
- package/android/src/main/java/io/event1/capacitorstripeterminal/TerminalUtils.java +50 -0
- package/dist/esm/definitions.d.ts +107 -17
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/plugin.d.ts +32 -7
- package/dist/esm/plugin.js +110 -45
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/web.d.ts +1 -6
- package/dist/esm/web.js +33 -14
- package/dist/esm/web.js.map +1 -1
- package/ios/Plugin/Plugin.swift +123 -4
- package/ios/Plugin/TerminalUtils.swift +34 -3
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +8 -8
- package/package.json +6 -4
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.2
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
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:
|
|
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 :
|
|
21
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
22
22
|
defaultConfig {
|
|
23
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
24
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
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.
|
|
40
|
-
targetCompatibility JavaVersion.
|
|
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.
|
|
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.
|
|
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
|
}
|
|
@@ -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;
|
|
@@ -256,27 +257,25 @@ export interface ConnectionConfiguration {
|
|
|
256
257
|
* @see https://stripe.com/docs/terminal/readers/fleet-management#bbpos-wisepad3-discovery
|
|
257
258
|
*/
|
|
258
259
|
locationId: string;
|
|
259
|
-
/**
|
|
260
|
-
* 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.
|
|
261
|
-
* @default false
|
|
262
|
-
*/
|
|
263
|
-
failIfInUse?: boolean;
|
|
264
260
|
}
|
|
265
261
|
/**
|
|
266
262
|
* @category Reader
|
|
267
263
|
*/
|
|
268
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;
|
|
269
273
|
}
|
|
270
274
|
/**
|
|
271
275
|
* @category Reader
|
|
272
276
|
*/
|
|
273
277
|
export interface UsbConnectionConfiguration extends ConnectionConfiguration {
|
|
274
278
|
}
|
|
275
|
-
/**
|
|
276
|
-
* @category Reader
|
|
277
|
-
*/
|
|
278
|
-
export interface EmbeddedConnectionConfiguration extends ConnectionConfiguration {
|
|
279
|
-
}
|
|
280
279
|
/**
|
|
281
280
|
* @category Reader
|
|
282
281
|
*/
|
|
@@ -286,15 +285,39 @@ export interface HandoffConnectionConfiguration extends ConnectionConfiguration
|
|
|
286
285
|
* @category Reader
|
|
287
286
|
*/
|
|
288
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;
|
|
289
306
|
}
|
|
290
307
|
/**
|
|
291
308
|
* @category Reader
|
|
292
309
|
*/
|
|
293
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;
|
|
294
317
|
/**
|
|
295
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.
|
|
296
319
|
*
|
|
297
|
-
* 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.
|
|
298
321
|
*
|
|
299
322
|
* @default false
|
|
300
323
|
*/
|
|
@@ -491,11 +514,62 @@ export declare enum PaymentIntentStatus {
|
|
|
491
514
|
* @see https://stripe.com/docs/api/payment_intents
|
|
492
515
|
*/
|
|
493
516
|
export interface PaymentIntent {
|
|
517
|
+
/**
|
|
518
|
+
* The unique identifier for the intent.
|
|
519
|
+
*/
|
|
494
520
|
stripeId: string;
|
|
521
|
+
/**
|
|
522
|
+
* When the intent was created.
|
|
523
|
+
*/
|
|
495
524
|
created: number;
|
|
525
|
+
/**
|
|
526
|
+
* The status of the PaymentIntent.
|
|
527
|
+
*/
|
|
496
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
|
+
*/
|
|
497
534
|
amount: number;
|
|
535
|
+
/**
|
|
536
|
+
* The currency of the payment.
|
|
537
|
+
*/
|
|
498
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;
|
|
499
573
|
}
|
|
500
574
|
/**
|
|
501
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.
|
|
@@ -680,8 +754,24 @@ export interface TippingConfig {
|
|
|
680
754
|
eligibleAmount?: number | null;
|
|
681
755
|
}
|
|
682
756
|
export interface CollectConfig {
|
|
757
|
+
/**
|
|
758
|
+
* Bypass tipping selection if it would have otherwise been shown.
|
|
759
|
+
*
|
|
760
|
+
* @default false
|
|
761
|
+
*/
|
|
683
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
|
+
*/
|
|
684
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;
|
|
685
775
|
}
|
|
686
776
|
/**
|
|
687
777
|
* @ignore
|
|
@@ -696,6 +786,7 @@ export interface StripeTerminalInterface {
|
|
|
696
786
|
connectBluetoothReader(options: {
|
|
697
787
|
serialNumber: string;
|
|
698
788
|
locationId: string;
|
|
789
|
+
autoReconnectOnUnexpectedDisconnect?: boolean;
|
|
699
790
|
}): Promise<{
|
|
700
791
|
reader: Reader | null;
|
|
701
792
|
}>;
|
|
@@ -716,12 +807,9 @@ export interface StripeTerminalInterface {
|
|
|
716
807
|
connectLocalMobileReader(options: {
|
|
717
808
|
serialNumber: string;
|
|
718
809
|
locationId: string;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
connectEmbeddedReader(options: {
|
|
723
|
-
serialNumber: string;
|
|
724
|
-
locationId: string;
|
|
810
|
+
onBehalfOf?: string;
|
|
811
|
+
merchantDisplayName?: string;
|
|
812
|
+
tosAcceptancePermitted?: boolean;
|
|
725
813
|
}): Promise<{
|
|
726
814
|
reader: Reader | null;
|
|
727
815
|
}>;
|
|
@@ -765,6 +853,7 @@ export interface StripeTerminalInterface {
|
|
|
765
853
|
}>;
|
|
766
854
|
getSimulatorConfiguration(): Promise<SimulatorConfiguration>;
|
|
767
855
|
setSimulatorConfiguration(config: SimulatorConfiguration): Promise<SimulatorConfiguration>;
|
|
856
|
+
cancelAutoReconnect(): Promise<void>;
|
|
768
857
|
/**
|
|
769
858
|
* @deprecated use requestPermissions and checkPermissions
|
|
770
859
|
*/
|
|
@@ -784,5 +873,6 @@ export interface StripeTerminalInterface {
|
|
|
784
873
|
update?: ReaderSoftwareUpdate;
|
|
785
874
|
error?: string;
|
|
786
875
|
}) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
876
|
+
addListener(eventName: 'didStartReaderReconnect' | 'didSucceedReaderReconnect' | 'didFailReaderReconnect', listenerFunc: (data: null) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
787
877
|
addListener(eventName: string, listenerFunc: Function): Promise<PluginListenerHandle> & PluginListenerHandle;
|
|
788
878
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAQA;;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,UAsDX;AAtDD,WAAY,UAAU;IACp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AA;IACR,mEAAS,CAAA;IACT,6DAAM,CAAA;IACN,4EAAa,CAAA;IACb,wDAAG,CAAA;IACH,kEAAQ,CAAA;IACR,gEAAO,CAAA;IACP,8EAAc,CAAA;IACd,gHAA+B,CAAA;IAC/B,8FAAsB,CAAA;IACtB,kGAAwB,CAAA;IACxB,oGAAyB,CAAA;IACzB,4GAA6B,CAAA;IAC7B,0EAAY,CAAA;AACd,CAAC,EAtBW,iBAAiB,KAAjB,iBAAiB,QAsB5B;AAED,MAAM,CAAN,IAAY,oBAWX;AAXD,WAAY,oBAAoB;IAC9B,0FAA0F;IAC1F,yEAAS,CAAA;IACT,2BAA2B;IAC3B,+DAAI,CAAA;IACJ,yNAAyN;IACzN,uEAAQ,CAAA;IACR,2JAA2J;IAC3J,2EAAU,CAAA;IACV,sFAAsF;IACtF,mEAAM,CAAA;AACR,CAAC,EAXW,oBAAoB,KAApB,oBAAoB,QAW/B;AAED,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,qDAAQ,CAAA;IACR,uDAAS,CAAA;AACX,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
|
package/dist/esm/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluginListenerHandle } from '@capacitor/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { StripeTerminalConfig, DiscoveryConfiguration, InternetConnectionConfiguration, BluetoothConnectionConfiguration, UsbConnectionConfiguration,
|
|
3
|
+
import { StripeTerminalConfig, DiscoveryConfiguration, InternetConnectionConfiguration, BluetoothConnectionConfiguration, UsbConnectionConfiguration, HandoffConnectionConfiguration, LocalMobileConnectionConfiguration, Reader, ConnectionStatus, PaymentStatus, ReaderDisplayMessage, ReaderInputOptions, PaymentIntent, Cart, ListLocationsParameters, SimulatorConfiguration, DeviceType, DeviceStyle, PermissionStatus, ReaderSoftwareUpdate, CollectConfig } from './definitions';
|
|
4
4
|
export declare class StripeTerminalPlugin {
|
|
5
5
|
isInitialized: boolean;
|
|
6
6
|
private stripeTerminalWeb?;
|
|
@@ -57,6 +57,9 @@ export declare class StripeTerminalPlugin {
|
|
|
57
57
|
static create(options: StripeTerminalConfig): Promise<StripeTerminalPlugin>;
|
|
58
58
|
cancelDiscoverReaders(): Promise<void>;
|
|
59
59
|
private normalizeReader;
|
|
60
|
+
private snakeCaseRecursively;
|
|
61
|
+
private parseJson;
|
|
62
|
+
private normalizePaymentIntent;
|
|
60
63
|
discoverReaders(options: DiscoveryConfiguration): Observable<Reader[]>;
|
|
61
64
|
/**
|
|
62
65
|
* Attempts to connect to the given bluetooth reader.
|
|
@@ -70,12 +73,6 @@ export declare class StripeTerminalPlugin {
|
|
|
70
73
|
* @returns Reader
|
|
71
74
|
*/
|
|
72
75
|
connectUsbReader(reader: Reader, config: UsbConnectionConfiguration): Promise<Reader | null>;
|
|
73
|
-
/**
|
|
74
|
-
* Attempts to connect to the Reader upon which the Application is currently running.
|
|
75
|
-
*
|
|
76
|
-
* @returns Reader
|
|
77
|
-
*/
|
|
78
|
-
connectEmbeddedReader(reader: Reader, config: EmbeddedConnectionConfiguration): Promise<Reader | null>;
|
|
79
76
|
/**
|
|
80
77
|
* Attempts to connect to the given reader in handoff mode.
|
|
81
78
|
*
|
|
@@ -132,6 +129,34 @@ export declare class StripeTerminalPlugin {
|
|
|
132
129
|
private simulatedCardTypeStringToEnum;
|
|
133
130
|
getSimulatorConfiguration(): Promise<SimulatorConfiguration | null>;
|
|
134
131
|
setSimulatorConfiguration(config: SimulatorConfiguration): Promise<SimulatorConfiguration | null>;
|
|
132
|
+
/**
|
|
133
|
+
* The reader has lost Bluetooth connection to the SDK and reconnection attempts have been started.
|
|
134
|
+
*
|
|
135
|
+
* In your implementation of this method, you should notify your user that the reader disconnected and that reconnection attempts are being made.
|
|
136
|
+
*
|
|
137
|
+
* Requires `autoReconnectOnUnexpectedDisconnect` is set to true in the `BluetoothConnectionConfiguration`
|
|
138
|
+
*/
|
|
139
|
+
didStartReaderReconnect(): Observable<void>;
|
|
140
|
+
/**
|
|
141
|
+
* The SDK was able to reconnect to the previously connected Bluetooth reader.
|
|
142
|
+
*
|
|
143
|
+
* In your implementation of this method, you should notify your user that reader connection has been re-established.
|
|
144
|
+
*
|
|
145
|
+
* Requires `autoReconnectOnUnexpectedDisconnect` is set to true in the `BluetoothConnectionConfiguration`
|
|
146
|
+
*/
|
|
147
|
+
didSucceedReaderReconnect(): Observable<void>;
|
|
148
|
+
/**
|
|
149
|
+
* The SDK was not able to reconnect to the previously connected bluetooth reader. The SDK is now disconnected from any readers.
|
|
150
|
+
*
|
|
151
|
+
* In your implementation of this method, you should notify your user that the reader has disconnected.
|
|
152
|
+
*
|
|
153
|
+
* Requires `autoReconnectOnUnexpectedDisconnect` is set to true in the `BluetoothConnectionConfiguration`
|
|
154
|
+
*/
|
|
155
|
+
didFailReaderReconnect(): Observable<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Cancel auto-reconnection
|
|
158
|
+
*/
|
|
159
|
+
cancelAutoReconnect(): Promise<void>;
|
|
135
160
|
getDeviceStyleFromDeviceType(type: DeviceType): DeviceStyle;
|
|
136
161
|
static getDeviceStyleFromDeviceType(type: DeviceType): DeviceStyle;
|
|
137
162
|
/**
|