@capacitor-community/stripe-terminal 6.4.0 → 6.4.1
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/README.md +16 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt +910 -0
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminalPlugin.kt +205 -0
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/TokenProvider.kt +85 -0
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/MetaData.kt +24 -0
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/TerminalMappers.kt +90 -0
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/models/Executor.kt +22 -0
- package/package.json +1 -1
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.java +0 -872
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminalPlugin.java +0 -193
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/TokenProvider.java +0 -105
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/MetaData.java +0 -28
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/TerminalMappers.java +0 -96
- package/android/src/main/java/com/getcapacitor/community/stripe/terminal/models/Executor.java +0 -33
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminalPlugin.java
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
package com.getcapacitor.community.stripe.terminal;
|
|
2
|
-
|
|
3
|
-
import android.Manifest;
|
|
4
|
-
import android.os.Build;
|
|
5
|
-
import android.util.Log;
|
|
6
|
-
import androidx.annotation.RequiresApi;
|
|
7
|
-
import com.getcapacitor.PermissionState;
|
|
8
|
-
import com.getcapacitor.Plugin;
|
|
9
|
-
import com.getcapacitor.PluginCall;
|
|
10
|
-
import com.getcapacitor.PluginMethod;
|
|
11
|
-
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
12
|
-
import com.getcapacitor.annotation.Permission;
|
|
13
|
-
import com.getcapacitor.annotation.PermissionCallback;
|
|
14
|
-
import com.stripe.stripeterminal.external.models.TerminalException;
|
|
15
|
-
import java.util.Objects;
|
|
16
|
-
|
|
17
|
-
@RequiresApi(api = Build.VERSION_CODES.S)
|
|
18
|
-
@CapacitorPlugin(
|
|
19
|
-
name = "StripeTerminal",
|
|
20
|
-
permissions = {
|
|
21
|
-
@Permission(alias = "location", strings = { Manifest.permission.ACCESS_FINE_LOCATION }),
|
|
22
|
-
@Permission(alias = "bluetooth_old", strings = { Manifest.permission.BLUETOOTH, Manifest.permission.BLUETOOTH_ADMIN }),
|
|
23
|
-
@Permission(
|
|
24
|
-
alias = "bluetooth",
|
|
25
|
-
strings = { Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT, Manifest.permission.BLUETOOTH_ADVERTISE }
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
)
|
|
29
|
-
public class StripeTerminalPlugin extends Plugin {
|
|
30
|
-
|
|
31
|
-
private final StripeTerminal implementation = new StripeTerminal(
|
|
32
|
-
this::getContext,
|
|
33
|
-
this::getActivity,
|
|
34
|
-
this::notifyListeners,
|
|
35
|
-
getLogTag()
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
@PluginMethod
|
|
39
|
-
public void initialize(PluginCall call) throws TerminalException {
|
|
40
|
-
this._initialize(call);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@PluginMethod
|
|
44
|
-
public void setConnectionToken(PluginCall call) {
|
|
45
|
-
this.implementation.setConnectionToken(call);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@PluginMethod
|
|
49
|
-
public void setSimulatorConfiguration(PluginCall call) {
|
|
50
|
-
this.implementation.setSimulatorConfiguration(call);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@PermissionCallback
|
|
54
|
-
private void locationPermsCallback(PluginCall call) throws TerminalException {
|
|
55
|
-
if (getPermissionState("location") == PermissionState.GRANTED) {
|
|
56
|
-
this._initialize(call);
|
|
57
|
-
} else {
|
|
58
|
-
requestPermissionForAlias("location", call, "locationPermsCallback");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@PermissionCallback
|
|
63
|
-
private void bluetoothOldPermsCallback(PluginCall call) throws TerminalException {
|
|
64
|
-
if (getPermissionState("bluetooth_old") == PermissionState.GRANTED) {
|
|
65
|
-
if (Objects.equals(call.getMethodName(), "discoverReaders")) {
|
|
66
|
-
this.discoverReaders(call);
|
|
67
|
-
} else {
|
|
68
|
-
this.connectReader(call);
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
requestPermissionForAlias("bluetooth_old", call, "bluetoothOldPermsCallback");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@PermissionCallback
|
|
76
|
-
private void bluetoothPermsCallback(PluginCall call) throws TerminalException {
|
|
77
|
-
if (getPermissionState("bluetooth") == PermissionState.GRANTED) {
|
|
78
|
-
if (Objects.equals(call.getMethodName(), "discoverReaders")) {
|
|
79
|
-
this.discoverReaders(call);
|
|
80
|
-
} else {
|
|
81
|
-
this.connectReader(call);
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
requestPermissionForAlias("bluetooth", call, "bluetoothPermsCallback");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private void _initialize(PluginCall call) throws TerminalException {
|
|
89
|
-
if (getPermissionState("location") != PermissionState.GRANTED) {
|
|
90
|
-
requestPermissionForAlias("location", call, "locationPermsCallback");
|
|
91
|
-
} else {
|
|
92
|
-
Log.d("Capacitor:permission location", getPermissionState("location").toString());
|
|
93
|
-
this.implementation.initialize(call);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
@PluginMethod(returnType = PluginMethod.RETURN_CALLBACK)
|
|
98
|
-
public void discoverReaders(PluginCall call) {
|
|
99
|
-
if (
|
|
100
|
-
Objects.equals(call.getString("type"), TerminalConnectTypes.Bluetooth.getWebEventName()) ||
|
|
101
|
-
Objects.equals(call.getString("type"), TerminalConnectTypes.Simulated.getWebEventName())
|
|
102
|
-
) {
|
|
103
|
-
Log.d("Capacitor:permission bluetooth_old", getPermissionState("bluetooth_old").toString());
|
|
104
|
-
Log.d("Capacitor:permission bluetooth", getPermissionState("bluetooth").toString());
|
|
105
|
-
if (Build.VERSION.SDK_INT <= 30 && getPermissionState("bluetooth_old") != PermissionState.GRANTED) {
|
|
106
|
-
requestPermissionForAlias("bluetooth_old", call, "bluetoothOldPermsCallback");
|
|
107
|
-
} else if (Build.VERSION.SDK_INT > 30 && getPermissionState("bluetooth") != PermissionState.GRANTED) {
|
|
108
|
-
requestPermissionForAlias("bluetooth", call, "bluetoothPermsCallback");
|
|
109
|
-
} else {
|
|
110
|
-
this.implementation.onDiscoverReaders(call);
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
this.implementation.onDiscoverReaders(call);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@PluginMethod
|
|
118
|
-
public void cancelDiscoverReaders(PluginCall call) {
|
|
119
|
-
this.implementation.cancelDiscoverReaders(call);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@PluginMethod
|
|
123
|
-
public void connectReader(PluginCall call) {
|
|
124
|
-
if (Objects.equals(call.getString("type"), TerminalConnectTypes.Bluetooth.getWebEventName())) {
|
|
125
|
-
Log.d("Capacitor:permission bluetooth_old", getPermissionState("bluetooth_old").toString());
|
|
126
|
-
Log.d("Capacitor:permission bluetooth", getPermissionState("bluetooth").toString());
|
|
127
|
-
if (Build.VERSION.SDK_INT <= 30 && getPermissionState("bluetooth_old") != PermissionState.GRANTED) {
|
|
128
|
-
requestPermissionForAlias("bluetooth_old", call, "bluetoothOldPermsCallback");
|
|
129
|
-
} else if (Build.VERSION.SDK_INT > 30 && getPermissionState("bluetooth") != PermissionState.GRANTED) {
|
|
130
|
-
requestPermissionForAlias("bluetooth", call, "bluetoothPermsCallback");
|
|
131
|
-
} else {
|
|
132
|
-
this.implementation.connectReader(call);
|
|
133
|
-
}
|
|
134
|
-
} else {
|
|
135
|
-
this.implementation.connectReader(call);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
@PluginMethod
|
|
140
|
-
public void getConnectedReader(final PluginCall call) {
|
|
141
|
-
this.implementation.getConnectedReader(call);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@PluginMethod
|
|
145
|
-
public void disconnectReader(final PluginCall call) {
|
|
146
|
-
this.implementation.disconnectReader(call);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
@PluginMethod
|
|
150
|
-
public void collectPaymentMethod(PluginCall call) {
|
|
151
|
-
this.implementation.collectPaymentMethod(call);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@PluginMethod
|
|
155
|
-
public void cancelCollectPaymentMethod(final PluginCall call) {
|
|
156
|
-
this.implementation.cancelCollectPaymentMethod(call);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@PluginMethod
|
|
160
|
-
public void confirmPaymentIntent(PluginCall call) {
|
|
161
|
-
this.implementation.confirmPaymentIntent(call);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
@PluginMethod
|
|
165
|
-
public void installAvailableUpdate(PluginCall call) {
|
|
166
|
-
this.implementation.installAvailableUpdate(call);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
@PluginMethod
|
|
170
|
-
public void cancelInstallUpdate(PluginCall call) {
|
|
171
|
-
this.implementation.cancelInstallUpdate(call);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@PluginMethod
|
|
175
|
-
public void setReaderDisplay(PluginCall call) {
|
|
176
|
-
this.implementation.setReaderDisplay(call);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@PluginMethod
|
|
180
|
-
public void clearReaderDisplay(PluginCall call) {
|
|
181
|
-
this.implementation.clearReaderDisplay(call);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@PluginMethod
|
|
185
|
-
public void rebootReader(PluginCall call) {
|
|
186
|
-
this.implementation.rebootReader(call);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
@PluginMethod
|
|
190
|
-
public void cancelReaderReconnection(PluginCall call) {
|
|
191
|
-
this.implementation.cancelReaderReconnection(call);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
package com.getcapacitor.community.stripe.terminal;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.util.Log;
|
|
5
|
-
import androidx.core.util.Supplier;
|
|
6
|
-
import com.android.volley.Request;
|
|
7
|
-
import com.android.volley.RequestQueue;
|
|
8
|
-
import com.android.volley.Response;
|
|
9
|
-
import com.android.volley.VolleyError;
|
|
10
|
-
import com.android.volley.toolbox.StringRequest;
|
|
11
|
-
import com.android.volley.toolbox.Volley;
|
|
12
|
-
import com.getcapacitor.JSObject;
|
|
13
|
-
import com.getcapacitor.PluginCall;
|
|
14
|
-
import com.google.android.gms.common.util.BiConsumer;
|
|
15
|
-
import com.stripe.stripeterminal.external.callable.ConnectionTokenCallback;
|
|
16
|
-
import com.stripe.stripeterminal.external.callable.ConnectionTokenProvider;
|
|
17
|
-
import com.stripe.stripeterminal.external.models.ConnectionTokenException;
|
|
18
|
-
import java.util.ArrayList;
|
|
19
|
-
import java.util.Objects;
|
|
20
|
-
import org.json.JSONException;
|
|
21
|
-
import org.json.JSONObject;
|
|
22
|
-
|
|
23
|
-
public class TokenProvider implements ConnectionTokenProvider {
|
|
24
|
-
|
|
25
|
-
protected Supplier<Context> contextSupplier;
|
|
26
|
-
protected final String tokenProviderEndpoint;
|
|
27
|
-
protected BiConsumer<String, JSObject> notifyListenersFunction;
|
|
28
|
-
ArrayList<ConnectionTokenCallback> pendingCallback = new ArrayList<>();
|
|
29
|
-
|
|
30
|
-
public TokenProvider(
|
|
31
|
-
Supplier<Context> contextSupplier,
|
|
32
|
-
String tokenProviderEndpoint,
|
|
33
|
-
BiConsumer<String, JSObject> notifyListenersFunction
|
|
34
|
-
) {
|
|
35
|
-
this.contextSupplier = contextSupplier;
|
|
36
|
-
this.tokenProviderEndpoint = tokenProviderEndpoint;
|
|
37
|
-
this.notifyListenersFunction = notifyListenersFunction;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public void setConnectionToken(PluginCall call) {
|
|
41
|
-
String token = call.getString("token", "");
|
|
42
|
-
if (!pendingCallback.isEmpty()) {
|
|
43
|
-
ConnectionTokenCallback pending = pendingCallback.remove(0);
|
|
44
|
-
if (Objects.equals(token, "")) {
|
|
45
|
-
pending.onFailure(new ConnectionTokenException("Missing `token` is empty"));
|
|
46
|
-
call.reject("Missing `token` is empty");
|
|
47
|
-
} else {
|
|
48
|
-
pending.onSuccess(token);
|
|
49
|
-
call.resolve();
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
call.reject("Stripe Terminal do not pending fetchConnectionToken");
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@Override
|
|
57
|
-
public void fetchConnectionToken(ConnectionTokenCallback callback) {
|
|
58
|
-
if (Objects.equals(this.tokenProviderEndpoint, "")) {
|
|
59
|
-
pendingCallback.add(callback);
|
|
60
|
-
this.notifyListeners(TerminalEnumEvent.RequestedConnectionToken.getWebEventName(), new JSObject());
|
|
61
|
-
} else {
|
|
62
|
-
try {
|
|
63
|
-
RequestQueue queue = Volley.newRequestQueue(this.contextSupplier.get());
|
|
64
|
-
StringRequest postRequest = new StringRequest(
|
|
65
|
-
Request.Method.POST,
|
|
66
|
-
this.tokenProviderEndpoint,
|
|
67
|
-
new Response.Listener<String>() {
|
|
68
|
-
@Override
|
|
69
|
-
public void onResponse(String response) {
|
|
70
|
-
try {
|
|
71
|
-
JSONObject jsonObject = new JSONObject(response);
|
|
72
|
-
Log.d("TokenProvider", jsonObject.getString("secret"));
|
|
73
|
-
callback.onSuccess(jsonObject.getString("secret"));
|
|
74
|
-
} catch (JSONException e) {
|
|
75
|
-
callback.onFailure(new ConnectionTokenException(Objects.requireNonNull(e.getLocalizedMessage())));
|
|
76
|
-
throw new RuntimeException(e);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
new Response.ErrorListener() {
|
|
81
|
-
@Override
|
|
82
|
-
public void onErrorResponse(VolleyError e) {
|
|
83
|
-
throw new RuntimeException(e);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
) {
|
|
87
|
-
// @Override
|
|
88
|
-
// protected Map<String,String> getParams(){
|
|
89
|
-
// Map<String,String> params = new HashMap<>();
|
|
90
|
-
// params.put("word","test");
|
|
91
|
-
// return params;
|
|
92
|
-
// }
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
queue.add(postRequest);
|
|
96
|
-
} catch (Exception e) {
|
|
97
|
-
callback.onFailure(new ConnectionTokenException("Failed to fetch connection token", e));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
protected void notifyListeners(String eventName, JSObject data) {
|
|
103
|
-
notifyListenersFunction.accept(eventName, data);
|
|
104
|
-
}
|
|
105
|
-
}
|
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/MetaData.java
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.getcapacitor.community.stripe.terminal.helper;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.content.pm.ApplicationInfo;
|
|
5
|
-
import android.content.pm.PackageManager;
|
|
6
|
-
import androidx.core.util.Supplier;
|
|
7
|
-
import com.getcapacitor.Logger;
|
|
8
|
-
|
|
9
|
-
public class MetaData {
|
|
10
|
-
|
|
11
|
-
protected Supplier<Context> contextSupplier;
|
|
12
|
-
|
|
13
|
-
public boolean enableIdentifier;
|
|
14
|
-
|
|
15
|
-
public MetaData(Supplier<Context> contextSupplier) {
|
|
16
|
-
this.contextSupplier = contextSupplier;
|
|
17
|
-
try {
|
|
18
|
-
ApplicationInfo appInfo = contextSupplier
|
|
19
|
-
.get()
|
|
20
|
-
.getPackageManager()
|
|
21
|
-
.getApplicationInfo(contextSupplier.get().getPackageName(), PackageManager.GET_META_DATA);
|
|
22
|
-
|
|
23
|
-
enableIdentifier = appInfo.metaData.getBoolean("com.getcapacitor.community.stripe.enableIdentifier");
|
|
24
|
-
} catch (Exception ignored) {
|
|
25
|
-
Logger.info("MetaData didn't be prepare fore Google Pay.");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/helper/TerminalMappers.java
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
package com.getcapacitor.community.stripe.terminal.helper;
|
|
2
|
-
|
|
3
|
-
import com.getcapacitor.JSObject;
|
|
4
|
-
import com.stripe.stripeterminal.external.models.DeviceType;
|
|
5
|
-
import com.stripe.stripeterminal.external.models.Location;
|
|
6
|
-
import com.stripe.stripeterminal.external.models.LocationStatus;
|
|
7
|
-
import com.stripe.stripeterminal.external.models.Reader;
|
|
8
|
-
import com.stripe.stripeterminal.external.models.ReaderSoftwareUpdate;
|
|
9
|
-
|
|
10
|
-
public class TerminalMappers {
|
|
11
|
-
|
|
12
|
-
public JSObject mapFromLocation(Location location) {
|
|
13
|
-
if (location == null) {
|
|
14
|
-
return new JSObject();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
JSObject address = new JSObject();
|
|
18
|
-
|
|
19
|
-
if (location.getAddress() != null) {
|
|
20
|
-
address
|
|
21
|
-
.put("country", location.getAddress().getCountry())
|
|
22
|
-
.put("city", location.getAddress().getCity())
|
|
23
|
-
.put("postalCode", location.getAddress().getPostalCode())
|
|
24
|
-
.put("line1", location.getAddress().getLine1())
|
|
25
|
-
.put("line2", location.getAddress().getLine2())
|
|
26
|
-
.put("state", location.getAddress().getState());
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return new JSObject()
|
|
30
|
-
.put("id", location.getId())
|
|
31
|
-
.put("displayName", location.getDisplayName())
|
|
32
|
-
.put("address", address)
|
|
33
|
-
.put("livemode", location.getLivemode());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public JSObject mapFromReaderSoftwareUpdate(ReaderSoftwareUpdate update) {
|
|
37
|
-
if (update == null) {
|
|
38
|
-
return new JSObject();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return new JSObject()
|
|
42
|
-
.put("deviceSoftwareVersion", update.getVersion())
|
|
43
|
-
.put("estimatedUpdateTime", update.getDurationEstimate().toString())
|
|
44
|
-
.put("requiredAt", update.getRequiredAtMs());
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public String mapFromLocationStatus(LocationStatus status) {
|
|
48
|
-
if (status == null) {
|
|
49
|
-
return "UNKNOWN";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return switch (status) {
|
|
53
|
-
case NOT_SET -> "NOT_SET";
|
|
54
|
-
case SET -> "SET";
|
|
55
|
-
case UNKNOWN -> "UNKNOWN";
|
|
56
|
-
default -> "UNKNOWN";
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
public String mapFromNetworkStatus(Reader.NetworkStatus status) {
|
|
61
|
-
if (status == null) {
|
|
62
|
-
return "unknown";
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return switch (status) {
|
|
66
|
-
case OFFLINE -> "OFFLINE";
|
|
67
|
-
case ONLINE -> "ONLINE";
|
|
68
|
-
default -> "UNKNOWN";
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public String mapFromDeviceType(DeviceType type) {
|
|
73
|
-
return switch (type) {
|
|
74
|
-
case CHIPPER_1X -> "chipper1X";
|
|
75
|
-
case CHIPPER_2X -> "chipper2X";
|
|
76
|
-
case TAP_TO_PAY_DEVICE -> "tapToPayDevice";
|
|
77
|
-
case ETNA -> "etna";
|
|
78
|
-
case STRIPE_M2 -> "stripeM2";
|
|
79
|
-
case STRIPE_S700 -> "stripeS700";
|
|
80
|
-
case STRIPE_S700_DEVKIT -> "stripeS700Devkit";
|
|
81
|
-
// React Native has this model. deprecated?
|
|
82
|
-
// case STRIPE_S710:
|
|
83
|
-
// return "stripeS710";
|
|
84
|
-
// case STRIPE_S710_DEVKIT:
|
|
85
|
-
// return "stripeS710Devkit";
|
|
86
|
-
case UNKNOWN -> "unknown";
|
|
87
|
-
case VERIFONE_P400 -> "verifoneP400";
|
|
88
|
-
case WISECUBE -> "wiseCube";
|
|
89
|
-
case WISEPAD_3 -> "wisePad3";
|
|
90
|
-
case WISEPAD_3S -> "wisePad3s";
|
|
91
|
-
case WISEPOS_E -> "wisePosE";
|
|
92
|
-
case WISEPOS_E_DEVKIT -> "wisePosEDevkit";
|
|
93
|
-
default -> throw new IllegalArgumentException("Unknown DeviceType: " + type);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
package/android/src/main/java/com/getcapacitor/community/stripe/terminal/models/Executor.java
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
package com.getcapacitor.community.stripe.terminal.models;
|
|
2
|
-
|
|
3
|
-
import android.app.Activity;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
import androidx.core.util.Supplier;
|
|
6
|
-
import com.getcapacitor.JSObject;
|
|
7
|
-
import com.google.android.gms.common.util.BiConsumer;
|
|
8
|
-
|
|
9
|
-
public abstract class Executor {
|
|
10
|
-
|
|
11
|
-
protected Supplier<Context> contextSupplier;
|
|
12
|
-
protected final Supplier<Activity> activitySupplier;
|
|
13
|
-
protected BiConsumer<String, JSObject> notifyListenersFunction;
|
|
14
|
-
protected final String logTag;
|
|
15
|
-
|
|
16
|
-
// Eventually we can change the notification directly here!
|
|
17
|
-
protected void notifyListeners(String eventName, JSObject data) {
|
|
18
|
-
notifyListenersFunction.accept(eventName, data);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public Executor(
|
|
22
|
-
Supplier<Context> contextSupplier,
|
|
23
|
-
Supplier<Activity> activitySupplier,
|
|
24
|
-
BiConsumer<String, JSObject> notifyListenersFunction,
|
|
25
|
-
String pluginLogTag,
|
|
26
|
-
String executorTag
|
|
27
|
-
) {
|
|
28
|
-
this.contextSupplier = contextSupplier;
|
|
29
|
-
this.activitySupplier = activitySupplier;
|
|
30
|
-
this.notifyListenersFunction = notifyListenersFunction;
|
|
31
|
-
this.logTag = pluginLogTag + "|" + executorTag;
|
|
32
|
-
}
|
|
33
|
-
}
|