@capacitor-community/stripe-terminal 8.0.1 → 8.1.0
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/CapacitorCommunityStripeTerminal.podspec +1 -1
- package/Package.swift +1 -1
- package/README.md +65 -1
- package/android/build.gradle +4 -4
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt +82 -17
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminalPlugin.kt +5 -5
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/TerminalMappers.kt +0 -1
- package/dist/docs.json +166 -6
- package/dist/esm/definitions.d.ts +68 -0
- package/dist/esm/definitions.js +9 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/stripe.enum.d.ts +0 -2
- package/dist/esm/stripe.enum.js +0 -2
- package/dist/esm/stripe.enum.js.map +1 -1
- package/dist/esm/terminal-mappers.d.ts +2 -1
- package/dist/esm/terminal-mappers.js +3 -2
- package/dist/esm/terminal-mappers.js.map +1 -1
- package/dist/esm/web.d.ts +2 -3
- package/dist/esm/web.js +3 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +16 -6
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +16 -6
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift +7 -7
- package/ios/Sources/StripeTerminalPlugin/StripeTerminalPlugin.swift +6 -2
- package/ios/Sources/StripeTerminalPlugin/TerminalMappers.swift +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'StripeTerminal', '~>
|
|
16
|
+
s.dependency 'StripeTerminal', '~> 5.3.0'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/Package.swift
CHANGED
|
@@ -11,7 +11,7 @@ let package = Package(
|
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
|
14
|
-
.package(url: "https://github.com/stripe/stripe-terminal-ios.git", .upToNextMinor(from: "
|
|
14
|
+
.package(url: "https://github.com/stripe/stripe-terminal-ios.git", .upToNextMinor(from: "5.3.0"))
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
|
17
17
|
.target(
|
package/README.md
CHANGED
|
@@ -222,6 +222,7 @@ await StripeTerminal.setSimulatorConfiguration({ update: SimulateReaderUpdate.Up
|
|
|
222
222
|
* [`clearReaderDisplay()`](#clearreaderdisplay)
|
|
223
223
|
* [`rebootReader()`](#rebootreader)
|
|
224
224
|
* [`cancelReaderReconnection()`](#cancelreaderreconnection)
|
|
225
|
+
* [`setTapToPayUxConfiguration(...)`](#settaptopayuxconfiguration)
|
|
225
226
|
* [`addListener(TerminalEventsEnum.Loaded, ...)`](#addlistenerterminaleventsenumloaded-)
|
|
226
227
|
* [`addListener(TerminalEventsEnum.RequestedConnectionToken, ...)`](#addlistenerterminaleventsenumrequestedconnectiontoken-)
|
|
227
228
|
* [`addListener(TerminalEventsEnum.DiscoveredReaders, ...)`](#addlistenerterminaleventsenumdiscoveredreaders-)
|
|
@@ -441,6 +442,23 @@ cancelReaderReconnection() => Promise<void>
|
|
|
441
442
|
--------------------
|
|
442
443
|
|
|
443
444
|
|
|
445
|
+
### setTapToPayUxConfiguration(...)
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
setTapToPayUxConfiguration(options: TapToPayUxConfiguration) => Promise<void>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Configure the Tap to Pay UX appearance (Android only).
|
|
452
|
+
Call this after initialize() but before connectReader().
|
|
453
|
+
Has no effect on iOS or web platforms.
|
|
454
|
+
|
|
455
|
+
| Param | Type |
|
|
456
|
+
| ------------- | --------------------------------------------------------------------------- |
|
|
457
|
+
| **`options`** | <code><a href="#taptopayuxconfiguration">TapToPayUxConfiguration</a></code> |
|
|
458
|
+
|
|
459
|
+
--------------------
|
|
460
|
+
|
|
461
|
+
|
|
444
462
|
### addListener(TerminalEventsEnum.Loaded, ...)
|
|
445
463
|
|
|
446
464
|
```typescript
|
|
@@ -922,6 +940,28 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: (
|
|
|
922
940
|
| **`bluetoothScanWaitTime`** | <code>number</code> | Only applies to Bluetooth scan discovery (iOS only). During discovery, readers are reported via DiscoveryDelegate.didUpdateDiscoveredReaders. This timeout controls how long to wait before resolving the `discoverReaders` method with the current list. If this setting is not specified or is set to 0, the initial scan results will be returned. |
|
|
923
941
|
|
|
924
942
|
|
|
943
|
+
#### TapToPayUxConfiguration
|
|
944
|
+
|
|
945
|
+
Configuration for the Tap to Pay UX (Android only).
|
|
946
|
+
|
|
947
|
+
| Prop | Type | Description |
|
|
948
|
+
| -------------- | ------------------------------------------------------------------- | -------------------------------------- |
|
|
949
|
+
| **`colors`** | <code><a href="#taptopaycolorscheme">TapToPayColorScheme</a></code> | Color scheme for the Tap to Pay screen |
|
|
950
|
+
| **`darkMode`** | <code><a href="#taptopaydarkmode">TapToPayDarkMode</a></code> | Dark mode setting |
|
|
951
|
+
| **`tapZone`** | <code><a href="#taptopaytapzone">TapToPayTapZone</a></code> | Tap zone position configuration |
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
#### TapToPayColorScheme
|
|
955
|
+
|
|
956
|
+
Color scheme for the Tap to Pay screen.
|
|
957
|
+
|
|
958
|
+
| Prop | Type | Description |
|
|
959
|
+
| ------------- | ------------------------------------------------------- | ------------------------------------------------------------ |
|
|
960
|
+
| **`primary`** | <code><a href="#taptopaycolor">TapToPayColor</a></code> | Primary color (tap zone indicator). Hex string or 'default'. |
|
|
961
|
+
| **`success`** | <code><a href="#taptopaycolor">TapToPayColor</a></code> | Success state color. Hex string or 'default'. |
|
|
962
|
+
| **`error`** | <code><a href="#taptopaycolor">TapToPayColor</a></code> | Error state color. Hex string or 'default'. |
|
|
963
|
+
|
|
964
|
+
|
|
925
965
|
#### PluginListenerHandle
|
|
926
966
|
|
|
927
967
|
| Prop | Type |
|
|
@@ -962,6 +1002,22 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: (
|
|
|
962
1002
|
<code>{ displayName: string; quantity: number; amount: number; }</code>
|
|
963
1003
|
|
|
964
1004
|
|
|
1005
|
+
#### TapToPayColor
|
|
1006
|
+
|
|
1007
|
+
Color value for <a href="#taptopayuxconfiguration">TapToPayUxConfiguration</a>.
|
|
1008
|
+
Use 'default' to use Stripe's default color, or a hex string like '#965D35'.
|
|
1009
|
+
|
|
1010
|
+
<code>'default' | string</code>
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
#### TapToPayTapZone
|
|
1014
|
+
|
|
1015
|
+
Tap zone position configuration.
|
|
1016
|
+
Controls where the tap indicator appears on screen.
|
|
1017
|
+
|
|
1018
|
+
<code>{ type: 'default' } | { type: 'front'; xBias: number; yBias: number } | { type: 'behind'; xBias: number; yBias: number } | { type: 'above'; bias?: number } | { type: 'below'; bias?: number } | { type: 'left'; bias?: number } | { type: 'right'; bias?: number }</code>
|
|
1019
|
+
|
|
1020
|
+
|
|
965
1021
|
### Enums
|
|
966
1022
|
|
|
967
1023
|
|
|
@@ -1016,7 +1072,6 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: (
|
|
|
1016
1072
|
| **`stripeM2`** | <code>'stripeM2'</code> |
|
|
1017
1073
|
| **`stripeS700`** | <code>'stripeS700'</code> |
|
|
1018
1074
|
| **`stripeS700DevKit`** | <code>'stripeS700Devkit'</code> |
|
|
1019
|
-
| **`verifoneP400`** | <code>'verifoneP400'</code> |
|
|
1020
1075
|
| **`wiseCube`** | <code>'wiseCube'</code> |
|
|
1021
1076
|
| **`wisePad3`** | <code>'wisePad3'</code> |
|
|
1022
1077
|
| **`wisePosE`** | <code>'wisePosE'</code> |
|
|
@@ -1082,6 +1137,15 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: (
|
|
|
1082
1137
|
| **`OnlinePinSCARetry`** | <code>'ONLINE_PIN_SCA_RETRY'</code> |
|
|
1083
1138
|
|
|
1084
1139
|
|
|
1140
|
+
#### TapToPayDarkMode
|
|
1141
|
+
|
|
1142
|
+
| Members | Value |
|
|
1143
|
+
| ------------ | --------------------- |
|
|
1144
|
+
| **`System`** | <code>'SYSTEM'</code> |
|
|
1145
|
+
| **`Dark`** | <code>'DARK'</code> |
|
|
1146
|
+
| **`Light`** | <code>'LIGHT'</code> |
|
|
1147
|
+
|
|
1148
|
+
|
|
1085
1149
|
#### TerminalEventsEnum
|
|
1086
1150
|
|
|
1087
1151
|
| Members | Value |
|
package/android/build.gradle
CHANGED
|
@@ -6,9 +6,9 @@ ext {
|
|
|
6
6
|
|
|
7
7
|
playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+'
|
|
8
8
|
volleyVersion = project.hasProperty('volleyVersion') ? rootProject.ext.volleyVersion : '1.2.1'
|
|
9
|
-
stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '
|
|
10
|
-
stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '
|
|
11
|
-
|
|
9
|
+
stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '5.3.+'
|
|
10
|
+
stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '5.3.+'
|
|
11
|
+
stripeterminalAppOnDevicesVersion = project.hasProperty('stripeterminalAppOnDevicesVersion') ? rootProject.ext.stripeterminalAppOnDevicesVersion : '5.3.+'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
buildscript {
|
|
@@ -72,7 +72,7 @@ dependencies {
|
|
|
72
72
|
|
|
73
73
|
implementation "com.stripe:stripeterminal-core:$stripeterminalCoreVersion"
|
|
74
74
|
implementation "com.stripe:stripeterminal-taptopay:$stripeterminalTapToPayVersion"
|
|
75
|
-
implementation "com.stripe:stripeterminal-
|
|
75
|
+
implementation "com.stripe:stripeterminal-appsondevices:$stripeterminalAppOnDevicesVersion"
|
|
76
76
|
implementation "com.android.volley:volley:$volleyVersion"
|
|
77
77
|
implementation "com.google.android.gms:play-services-wallet:$playServicesWalletVersion"
|
|
78
78
|
}
|
|
@@ -6,6 +6,7 @@ import android.app.Application
|
|
|
6
6
|
import android.bluetooth.BluetoothAdapter
|
|
7
7
|
import android.content.Context
|
|
8
8
|
import android.content.pm.PackageManager
|
|
9
|
+
import android.graphics.Color
|
|
9
10
|
import android.os.Build
|
|
10
11
|
import android.util.Log
|
|
11
12
|
import androidx.core.app.ActivityCompat
|
|
@@ -17,7 +18,7 @@ import com.getcapacitor.community.stripe.terminal.helper.TerminalMappers
|
|
|
17
18
|
import com.getcapacitor.community.stripe.terminal.models.Executor
|
|
18
19
|
import com.google.android.gms.common.util.BiConsumer
|
|
19
20
|
import com.stripe.stripeterminal.Terminal
|
|
20
|
-
import com.stripe.stripeterminal.Terminal.Companion.
|
|
21
|
+
import com.stripe.stripeterminal.Terminal.Companion.init
|
|
21
22
|
import com.stripe.stripeterminal.Terminal.Companion.isInitialized
|
|
22
23
|
import com.stripe.stripeterminal.TerminalApplicationDelegate.onCreate
|
|
23
24
|
import com.stripe.stripeterminal.external.callable.Callback
|
|
@@ -29,12 +30,12 @@ import com.stripe.stripeterminal.external.callable.PaymentIntentCallback
|
|
|
29
30
|
import com.stripe.stripeterminal.external.callable.ReaderCallback
|
|
30
31
|
import com.stripe.stripeterminal.external.callable.TapToPayReaderListener
|
|
31
32
|
import com.stripe.stripeterminal.external.callable.TerminalListener
|
|
32
|
-
import com.stripe.stripeterminal.external.callable.
|
|
33
|
+
import com.stripe.stripeterminal.external.callable.AppsOnDevicesListener
|
|
33
34
|
import com.stripe.stripeterminal.external.models.BatteryStatus
|
|
34
35
|
import com.stripe.stripeterminal.external.models.CardPresentDetails
|
|
35
36
|
import com.stripe.stripeterminal.external.models.Cart
|
|
36
37
|
import com.stripe.stripeterminal.external.models.CartLineItem
|
|
37
|
-
import com.stripe.stripeterminal.external.models.
|
|
38
|
+
import com.stripe.stripeterminal.external.models.CollectPaymentIntentConfiguration
|
|
38
39
|
import com.stripe.stripeterminal.external.models.ConnectionConfiguration
|
|
39
40
|
import com.stripe.stripeterminal.external.models.ConnectionStatus
|
|
40
41
|
import com.stripe.stripeterminal.external.models.DisconnectReason
|
|
@@ -49,6 +50,7 @@ import com.stripe.stripeterminal.external.models.ReaderSoftwareUpdate
|
|
|
49
50
|
import com.stripe.stripeterminal.external.models.SimulateReaderUpdate
|
|
50
51
|
import com.stripe.stripeterminal.external.models.SimulatedCard
|
|
51
52
|
import com.stripe.stripeterminal.external.models.SimulatorConfiguration
|
|
53
|
+
import com.stripe.stripeterminal.external.models.TapToPayUxConfiguration
|
|
52
54
|
import com.stripe.stripeterminal.external.models.TerminalException
|
|
53
55
|
import com.stripe.stripeterminal.log.LogLevel
|
|
54
56
|
import org.json.JSONException
|
|
@@ -128,11 +130,12 @@ class StripeTerminal(
|
|
|
128
130
|
this.notifyListenersFunction
|
|
129
131
|
)
|
|
130
132
|
if (!isInitialized()) {
|
|
131
|
-
|
|
133
|
+
init(
|
|
132
134
|
contextSupplier.get().applicationContext,
|
|
133
135
|
logLevel,
|
|
134
136
|
this.tokenProvider!!,
|
|
135
|
-
listener
|
|
137
|
+
listener,
|
|
138
|
+
null // OfflineListener - not used in this implementation
|
|
136
139
|
)
|
|
137
140
|
}
|
|
138
141
|
Terminal.getInstance()
|
|
@@ -196,18 +199,13 @@ class StripeTerminal(
|
|
|
196
199
|
config = DiscoveryConfiguration.BluetoothDiscoveryConfiguration(0, this.isTest!!)
|
|
197
200
|
this.terminalConnectType = TerminalConnectTypes.Bluetooth
|
|
198
201
|
} else if (call.getString("type") == TerminalConnectTypes.HandOff.webEventName) {
|
|
199
|
-
config = DiscoveryConfiguration.
|
|
202
|
+
config = DiscoveryConfiguration.AppsOnDevicesDiscoveryConfiguration()
|
|
200
203
|
this.terminalConnectType = TerminalConnectTypes.HandOff
|
|
201
204
|
} else {
|
|
202
205
|
call.unimplemented(call.getString("type") + " is not support now")
|
|
203
206
|
return
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
notifyListeners(
|
|
207
|
-
TerminalEnumEvent.DiscoveringReaders.webEventName,
|
|
208
|
-
emptyObject
|
|
209
|
-
)
|
|
210
|
-
|
|
211
209
|
discoveryCancelable = Terminal.getInstance()
|
|
212
210
|
.discoverReaders(
|
|
213
211
|
config,
|
|
@@ -399,8 +397,8 @@ class StripeTerminal(
|
|
|
399
397
|
|
|
400
398
|
val config: ConnectionConfiguration.InternetConnectionConfiguration =
|
|
401
399
|
ConnectionConfiguration.InternetConnectionConfiguration(
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
this.internetReaderListener,
|
|
401
|
+
true
|
|
404
402
|
)
|
|
405
403
|
Terminal.getInstance().connectReader(foundReader, config, this.readerCallback(call))
|
|
406
404
|
}
|
|
@@ -461,14 +459,14 @@ class StripeTerminal(
|
|
|
461
459
|
return
|
|
462
460
|
}
|
|
463
461
|
|
|
464
|
-
val config: ConnectionConfiguration.
|
|
462
|
+
val config: ConnectionConfiguration.AppsOnDevicesConnectionConfiguration = ConnectionConfiguration.AppsOnDevicesConnectionConfiguration(
|
|
465
463
|
this.handoffReaderListener
|
|
466
464
|
)
|
|
467
465
|
|
|
468
466
|
Terminal.getInstance().connectReader(foundReader, config, this.readerCallback(call))
|
|
469
467
|
}
|
|
470
468
|
|
|
471
|
-
var handoffReaderListener:
|
|
469
|
+
var handoffReaderListener: AppsOnDevicesListener = object : AppsOnDevicesListener {
|
|
472
470
|
override fun onDisconnect(reason: DisconnectReason) {
|
|
473
471
|
notifyListeners(
|
|
474
472
|
TerminalEnumEvent.DisconnectedReader.webEventName,
|
|
@@ -539,8 +537,8 @@ class StripeTerminal(
|
|
|
539
537
|
private val createPaymentIntentCallback: PaymentIntentCallback =
|
|
540
538
|
object : PaymentIntentCallback {
|
|
541
539
|
override fun onSuccess(paymentIntent: PaymentIntent) {
|
|
542
|
-
val collectConfig:
|
|
543
|
-
|
|
540
|
+
val collectConfig: CollectPaymentIntentConfiguration =
|
|
541
|
+
CollectPaymentIntentConfiguration.Builder().updatePaymentIntent(true).build()
|
|
544
542
|
collectCancelable = Terminal.getInstance().collectPaymentMethod(
|
|
545
543
|
paymentIntent,
|
|
546
544
|
collectPaymentMethodCallback,
|
|
@@ -902,6 +900,73 @@ class StripeTerminal(
|
|
|
902
900
|
}
|
|
903
901
|
}
|
|
904
902
|
|
|
903
|
+
fun setTapToPayUxConfiguration(call: PluginCall) {
|
|
904
|
+
try {
|
|
905
|
+
val builder = TapToPayUxConfiguration.Builder()
|
|
906
|
+
|
|
907
|
+
// Parse colors
|
|
908
|
+
call.getObject("colors")?.let { colorsObj ->
|
|
909
|
+
val colorSchemeBuilder = TapToPayUxConfiguration.ColorScheme.Builder()
|
|
910
|
+
colorsObj.getString("primary")?.let { colorSchemeBuilder.primary(parseColor(it)) }
|
|
911
|
+
colorsObj.getString("success")?.let { colorSchemeBuilder.success(parseColor(it)) }
|
|
912
|
+
colorsObj.getString("error")?.let { colorSchemeBuilder.error(parseColor(it)) }
|
|
913
|
+
builder.colors(colorSchemeBuilder.build())
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// Parse dark mode
|
|
917
|
+
call.getString("darkMode")?.let { darkModeStr ->
|
|
918
|
+
val darkMode = when (darkModeStr) {
|
|
919
|
+
"DARK" -> TapToPayUxConfiguration.DarkMode.DARK
|
|
920
|
+
"LIGHT" -> TapToPayUxConfiguration.DarkMode.LIGHT
|
|
921
|
+
else -> TapToPayUxConfiguration.DarkMode.SYSTEM
|
|
922
|
+
}
|
|
923
|
+
builder.darkMode(darkMode)
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// TODO: Tap zone support requires Stripe Terminal SDK v5+
|
|
927
|
+
// Uncomment when upgrading from v4.7 to v5+
|
|
928
|
+
// call.getObject("tapZone")?.let { tapZoneObj ->
|
|
929
|
+
// val tapZone = when (tapZoneObj.getString("type")) {
|
|
930
|
+
// "front" -> TapToPayUxConfiguration.TapZone.Front(
|
|
931
|
+
// tapZoneObj.getDouble("xBias")?.toFloat() ?: 0.5f,
|
|
932
|
+
// tapZoneObj.getDouble("yBias")?.toFloat() ?: 0.5f
|
|
933
|
+
// )
|
|
934
|
+
// "behind" -> TapToPayUxConfiguration.TapZone.Behind(
|
|
935
|
+
// tapZoneObj.getDouble("xBias")?.toFloat() ?: 0.5f,
|
|
936
|
+
// tapZoneObj.getDouble("yBias")?.toFloat() ?: 0.5f
|
|
937
|
+
// )
|
|
938
|
+
// "above" -> TapToPayUxConfiguration.TapZone.Above(
|
|
939
|
+
// tapZoneObj.getDouble("bias")?.toFloat() ?: 0.5f
|
|
940
|
+
// )
|
|
941
|
+
// "below" -> TapToPayUxConfiguration.TapZone.Below(
|
|
942
|
+
// tapZoneObj.getDouble("bias")?.toFloat() ?: 0.5f
|
|
943
|
+
// )
|
|
944
|
+
// "left" -> TapToPayUxConfiguration.TapZone.Left(
|
|
945
|
+
// tapZoneObj.getDouble("bias")?.toFloat() ?: 0.5f
|
|
946
|
+
// )
|
|
947
|
+
// "right" -> TapToPayUxConfiguration.TapZone.Right(
|
|
948
|
+
// tapZoneObj.getDouble("bias")?.toFloat() ?: 0.5f
|
|
949
|
+
// )
|
|
950
|
+
// else -> TapToPayUxConfiguration.TapZone.Default
|
|
951
|
+
// }
|
|
952
|
+
// builder.tapZone(tapZone)
|
|
953
|
+
// }
|
|
954
|
+
|
|
955
|
+
Terminal.getInstance().setTapToPayUxConfiguration(builder.build())
|
|
956
|
+
call.resolve()
|
|
957
|
+
} catch (ex: Exception) {
|
|
958
|
+
call.reject(ex.message)
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
private fun parseColor(colorStr: String): TapToPayUxConfiguration.Color {
|
|
963
|
+
return if (colorStr == "default") {
|
|
964
|
+
TapToPayUxConfiguration.Color.Default
|
|
965
|
+
} else {
|
|
966
|
+
TapToPayUxConfiguration.Color.Value(Color.parseColor(colorStr))
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
905
970
|
private fun convertReaderInterface(reader: Reader?): JSObject {
|
|
906
971
|
return JSObject()
|
|
907
972
|
.put("label", reader!!.label)
|
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminalPlugin.kt
CHANGED
|
@@ -106,11 +106,6 @@ class StripeTerminalPlugin : Plugin() {
|
|
|
106
106
|
"type"
|
|
107
107
|
) == TerminalConnectTypes.Simulated.webEventName
|
|
108
108
|
) {
|
|
109
|
-
Log.d(
|
|
110
|
-
"Capacitor:permission bluetooth_old",
|
|
111
|
-
getPermissionState("bluetooth_old").toString()
|
|
112
|
-
)
|
|
113
|
-
Log.d("Capacitor:permission bluetooth", getPermissionState("bluetooth").toString())
|
|
114
109
|
if (Build.VERSION.SDK_INT <= 30 && getPermissionState("bluetooth_old") != PermissionState.GRANTED) {
|
|
115
110
|
requestPermissionForAlias("bluetooth_old", call, "bluetoothOldPermsCallback")
|
|
116
111
|
} else if (Build.VERSION.SDK_INT > 30 && getPermissionState("bluetooth") != PermissionState.GRANTED) {
|
|
@@ -202,4 +197,9 @@ class StripeTerminalPlugin : Plugin() {
|
|
|
202
197
|
fun cancelReaderReconnection(call: PluginCall) {
|
|
203
198
|
implementation.cancelReaderReconnection(call)
|
|
204
199
|
}
|
|
200
|
+
|
|
201
|
+
@PluginMethod
|
|
202
|
+
fun setTapToPayUxConfiguration(call: PluginCall) {
|
|
203
|
+
implementation.setTapToPayUxConfiguration(call)
|
|
204
|
+
}
|
|
205
205
|
}
|
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/TerminalMappers.kt
CHANGED
|
@@ -78,7 +78,6 @@ class TerminalMappers {
|
|
|
78
78
|
DeviceType.STRIPE_S700 -> "stripeS700"
|
|
79
79
|
DeviceType.STRIPE_S700_DEVKIT -> "stripeS700Devkit"
|
|
80
80
|
DeviceType.UNKNOWN -> "unknown"
|
|
81
|
-
DeviceType.VERIFONE_P400 -> "verifoneP400"
|
|
82
81
|
DeviceType.WISECUBE -> "wiseCube"
|
|
83
82
|
DeviceType.WISEPAD_3 -> "wisePad3"
|
|
84
83
|
DeviceType.WISEPAD_3S -> "wisePad3s"
|
package/dist/docs.json
CHANGED
|
@@ -235,6 +235,24 @@
|
|
|
235
235
|
"complexTypes": [],
|
|
236
236
|
"slug": "cancelreaderreconnection"
|
|
237
237
|
},
|
|
238
|
+
{
|
|
239
|
+
"name": "setTapToPayUxConfiguration",
|
|
240
|
+
"signature": "(options: TapToPayUxConfiguration) => Promise<void>",
|
|
241
|
+
"parameters": [
|
|
242
|
+
{
|
|
243
|
+
"name": "options",
|
|
244
|
+
"docs": "",
|
|
245
|
+
"type": "TapToPayUxConfiguration"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"returns": "Promise<void>",
|
|
249
|
+
"tags": [],
|
|
250
|
+
"docs": "Configure the Tap to Pay UX appearance (Android only).\nCall this after initialize() but before connectReader().\nHas no effect on iOS or web platforms.",
|
|
251
|
+
"complexTypes": [
|
|
252
|
+
"TapToPayUxConfiguration"
|
|
253
|
+
],
|
|
254
|
+
"slug": "settaptopayuxconfiguration"
|
|
255
|
+
},
|
|
238
256
|
{
|
|
239
257
|
"name": "addListener",
|
|
240
258
|
"signature": "(eventName: TerminalEventsEnum.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>",
|
|
@@ -839,6 +857,80 @@
|
|
|
839
857
|
}
|
|
840
858
|
]
|
|
841
859
|
},
|
|
860
|
+
{
|
|
861
|
+
"name": "TapToPayUxConfiguration",
|
|
862
|
+
"slug": "taptopayuxconfiguration",
|
|
863
|
+
"docs": "Configuration for the Tap to Pay UX (Android only).",
|
|
864
|
+
"tags": [],
|
|
865
|
+
"extends": [],
|
|
866
|
+
"methods": [],
|
|
867
|
+
"properties": [
|
|
868
|
+
{
|
|
869
|
+
"name": "colors",
|
|
870
|
+
"tags": [],
|
|
871
|
+
"docs": "Color scheme for the Tap to Pay screen",
|
|
872
|
+
"complexTypes": [
|
|
873
|
+
"TapToPayColorScheme"
|
|
874
|
+
],
|
|
875
|
+
"type": "TapToPayColorScheme"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"name": "darkMode",
|
|
879
|
+
"tags": [],
|
|
880
|
+
"docs": "Dark mode setting",
|
|
881
|
+
"complexTypes": [
|
|
882
|
+
"TapToPayDarkMode"
|
|
883
|
+
],
|
|
884
|
+
"type": "TapToPayDarkMode"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"name": "tapZone",
|
|
888
|
+
"tags": [],
|
|
889
|
+
"docs": "Tap zone position configuration",
|
|
890
|
+
"complexTypes": [
|
|
891
|
+
"TapToPayTapZone"
|
|
892
|
+
],
|
|
893
|
+
"type": "TapToPayTapZone"
|
|
894
|
+
}
|
|
895
|
+
]
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"name": "TapToPayColorScheme",
|
|
899
|
+
"slug": "taptopaycolorscheme",
|
|
900
|
+
"docs": "Color scheme for the Tap to Pay screen.",
|
|
901
|
+
"tags": [],
|
|
902
|
+
"extends": [],
|
|
903
|
+
"methods": [],
|
|
904
|
+
"properties": [
|
|
905
|
+
{
|
|
906
|
+
"name": "primary",
|
|
907
|
+
"tags": [],
|
|
908
|
+
"docs": "Primary color (tap zone indicator). Hex string or 'default'.",
|
|
909
|
+
"complexTypes": [
|
|
910
|
+
"TapToPayColor"
|
|
911
|
+
],
|
|
912
|
+
"type": "TapToPayColor"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"name": "success",
|
|
916
|
+
"tags": [],
|
|
917
|
+
"docs": "Success state color. Hex string or 'default'.",
|
|
918
|
+
"complexTypes": [
|
|
919
|
+
"TapToPayColor"
|
|
920
|
+
],
|
|
921
|
+
"type": "TapToPayColor"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"name": "error",
|
|
925
|
+
"tags": [],
|
|
926
|
+
"docs": "Error state color. Hex string or 'default'.",
|
|
927
|
+
"complexTypes": [
|
|
928
|
+
"TapToPayColor"
|
|
929
|
+
],
|
|
930
|
+
"type": "TapToPayColor"
|
|
931
|
+
}
|
|
932
|
+
]
|
|
933
|
+
},
|
|
842
934
|
{
|
|
843
935
|
"name": "PluginListenerHandle",
|
|
844
936
|
"slug": "pluginlistenerhandle",
|
|
@@ -1024,12 +1116,6 @@
|
|
|
1024
1116
|
"tags": [],
|
|
1025
1117
|
"docs": ""
|
|
1026
1118
|
},
|
|
1027
|
-
{
|
|
1028
|
-
"name": "verifoneP400",
|
|
1029
|
-
"value": "'verifoneP400'",
|
|
1030
|
-
"tags": [],
|
|
1031
|
-
"docs": ""
|
|
1032
|
-
},
|
|
1033
1119
|
{
|
|
1034
1120
|
"name": "wiseCube",
|
|
1035
1121
|
"value": "'wiseCube'",
|
|
@@ -1320,6 +1406,30 @@
|
|
|
1320
1406
|
}
|
|
1321
1407
|
]
|
|
1322
1408
|
},
|
|
1409
|
+
{
|
|
1410
|
+
"name": "TapToPayDarkMode",
|
|
1411
|
+
"slug": "taptopaydarkmode",
|
|
1412
|
+
"members": [
|
|
1413
|
+
{
|
|
1414
|
+
"name": "System",
|
|
1415
|
+
"value": "'SYSTEM'",
|
|
1416
|
+
"tags": [],
|
|
1417
|
+
"docs": ""
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
"name": "Dark",
|
|
1421
|
+
"value": "'DARK'",
|
|
1422
|
+
"tags": [],
|
|
1423
|
+
"docs": ""
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
"name": "Light",
|
|
1427
|
+
"value": "'LIGHT'",
|
|
1428
|
+
"tags": [],
|
|
1429
|
+
"docs": ""
|
|
1430
|
+
}
|
|
1431
|
+
]
|
|
1432
|
+
},
|
|
1323
1433
|
{
|
|
1324
1434
|
"name": "TerminalEventsEnum",
|
|
1325
1435
|
"slug": "terminaleventsenum",
|
|
@@ -1796,6 +1906,56 @@
|
|
|
1796
1906
|
"complexTypes": []
|
|
1797
1907
|
}
|
|
1798
1908
|
]
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
"name": "TapToPayColor",
|
|
1912
|
+
"slug": "taptopaycolor",
|
|
1913
|
+
"docs": "Color value for TapToPayUxConfiguration.\nUse 'default' to use Stripe's default color, or a hex string like '#965D35'.",
|
|
1914
|
+
"types": [
|
|
1915
|
+
{
|
|
1916
|
+
"text": "'default'",
|
|
1917
|
+
"complexTypes": []
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
"text": "string",
|
|
1921
|
+
"complexTypes": []
|
|
1922
|
+
}
|
|
1923
|
+
]
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"name": "TapToPayTapZone",
|
|
1927
|
+
"slug": "taptopaytapzone",
|
|
1928
|
+
"docs": "Tap zone position configuration.\nControls where the tap indicator appears on screen.",
|
|
1929
|
+
"types": [
|
|
1930
|
+
{
|
|
1931
|
+
"text": "{ type: 'default' }",
|
|
1932
|
+
"complexTypes": []
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
"text": "{ type: 'front'; xBias: number; yBias: number }",
|
|
1936
|
+
"complexTypes": []
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
"text": "{ type: 'behind'; xBias: number; yBias: number }",
|
|
1940
|
+
"complexTypes": []
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
"text": "{ type: 'above'; bias?: number }",
|
|
1944
|
+
"complexTypes": []
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"text": "{ type: 'below'; bias?: number }",
|
|
1948
|
+
"complexTypes": []
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
"text": "{ type: 'left'; bias?: number }",
|
|
1952
|
+
"complexTypes": []
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
"text": "{ type: 'right'; bias?: number }",
|
|
1956
|
+
"complexTypes": []
|
|
1957
|
+
}
|
|
1958
|
+
]
|
|
1799
1959
|
}
|
|
1800
1960
|
],
|
|
1801
1961
|
"pluginConfigs": []
|
|
@@ -67,6 +67,68 @@ export type Cart = {
|
|
|
67
67
|
total: number;
|
|
68
68
|
lineItems: CartLineItem[];
|
|
69
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* Color value for TapToPayUxConfiguration.
|
|
72
|
+
* Use 'default' to use Stripe's default color, or a hex string like '#965D35'.
|
|
73
|
+
*/
|
|
74
|
+
export type TapToPayColor = 'default' | string;
|
|
75
|
+
/**
|
|
76
|
+
* Dark mode setting for Tap to Pay UX.
|
|
77
|
+
*/
|
|
78
|
+
export declare enum TapToPayDarkMode {
|
|
79
|
+
System = "SYSTEM",
|
|
80
|
+
Dark = "DARK",
|
|
81
|
+
Light = "LIGHT"
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Color scheme for the Tap to Pay screen.
|
|
85
|
+
*/
|
|
86
|
+
export interface TapToPayColorScheme {
|
|
87
|
+
/** Primary color (tap zone indicator). Hex string or 'default'. */
|
|
88
|
+
primary?: TapToPayColor;
|
|
89
|
+
/** Success state color. Hex string or 'default'. */
|
|
90
|
+
success?: TapToPayColor;
|
|
91
|
+
/** Error state color. Hex string or 'default'. */
|
|
92
|
+
error?: TapToPayColor;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Tap zone position configuration.
|
|
96
|
+
* Controls where the tap indicator appears on screen.
|
|
97
|
+
*/
|
|
98
|
+
export type TapToPayTapZone = {
|
|
99
|
+
type: 'default';
|
|
100
|
+
} | {
|
|
101
|
+
type: 'front';
|
|
102
|
+
xBias: number;
|
|
103
|
+
yBias: number;
|
|
104
|
+
} | {
|
|
105
|
+
type: 'behind';
|
|
106
|
+
xBias: number;
|
|
107
|
+
yBias: number;
|
|
108
|
+
} | {
|
|
109
|
+
type: 'above';
|
|
110
|
+
bias?: number;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'below';
|
|
113
|
+
bias?: number;
|
|
114
|
+
} | {
|
|
115
|
+
type: 'left';
|
|
116
|
+
bias?: number;
|
|
117
|
+
} | {
|
|
118
|
+
type: 'right';
|
|
119
|
+
bias?: number;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Configuration for the Tap to Pay UX (Android only).
|
|
123
|
+
*/
|
|
124
|
+
export interface TapToPayUxConfiguration {
|
|
125
|
+
/** Color scheme for the Tap to Pay screen */
|
|
126
|
+
colors?: TapToPayColorScheme;
|
|
127
|
+
/** Dark mode setting */
|
|
128
|
+
darkMode?: TapToPayDarkMode;
|
|
129
|
+
/** Tap zone position configuration */
|
|
130
|
+
tapZone?: TapToPayTapZone;
|
|
131
|
+
}
|
|
70
132
|
export interface DiscoverReadersOptions {
|
|
71
133
|
type: TerminalConnectTypes;
|
|
72
134
|
locationId?: string;
|
|
@@ -132,6 +194,12 @@ export interface StripeTerminalPlugin {
|
|
|
132
194
|
clearReaderDisplay(): Promise<void>;
|
|
133
195
|
rebootReader(): Promise<void>;
|
|
134
196
|
cancelReaderReconnection(): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Configure the Tap to Pay UX appearance (Android only).
|
|
199
|
+
* Call this after initialize() but before connectReader().
|
|
200
|
+
* Has no effect on iOS or web platforms.
|
|
201
|
+
*/
|
|
202
|
+
setTapToPayUxConfiguration(options: TapToPayUxConfiguration): Promise<void>;
|
|
135
203
|
addListener(eventName: TerminalEventsEnum.Loaded, listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
136
204
|
addListener(eventName: TerminalEventsEnum.RequestedConnectionToken, listenerFunc: () => void): Promise<PluginListenerHandle>;
|
|
137
205
|
/**
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dark mode setting for Tap to Pay UX.
|
|
3
|
+
*/
|
|
4
|
+
export var TapToPayDarkMode;
|
|
5
|
+
(function (TapToPayDarkMode) {
|
|
6
|
+
TapToPayDarkMode["System"] = "SYSTEM";
|
|
7
|
+
TapToPayDarkMode["Dark"] = "DARK";
|
|
8
|
+
TapToPayDarkMode["Light"] = "LIGHT";
|
|
9
|
+
})(TapToPayDarkMode || (TapToPayDarkMode = {}));
|
|
1
10
|
export * from './events.enum';
|
|
2
11
|
export * from './stripe.enum';
|
|
3
12
|
//# sourceMappingURL=definitions.js.map
|