ui commit and debug fix
parent
23774d69dc
commit
e0c4ade930
|
|
@ -67,8 +67,8 @@ android {
|
||||||
buildConfigField ("String[]", "SUPPORTED_DEVICES", collectSupportedDevicesToArray())
|
buildConfigField ("String[]", "SUPPORTED_DEVICES", collectSupportedDevicesToArray())
|
||||||
}
|
}
|
||||||
debug {
|
debug {
|
||||||
applicationIdSuffix ".debug"
|
//applicationIdSuffix ".debug"
|
||||||
versionNameSuffix "-debug"
|
//versionNameSuffix "-debug"
|
||||||
//resValue "string", "app_name", "Aman Kassa (debug)"
|
//resValue "string", "app_name", "Aman Kassa (debug)"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
|
|
|
||||||
|
|
@ -99,24 +99,39 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
||||||
public void onDeviceToUseSelectionRequested(List<Reader> deviceList) {
|
public void onDeviceToUseSelectionRequested(List<Reader> deviceList) {
|
||||||
System.out.println("----->---->---->onDeviceToUseSelectionRequested");
|
System.out.println("----->---->---->onDeviceToUseSelectionRequested");
|
||||||
plugin.getActivity().runOnUiThread(() -> {
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(plugin.getActivity());
|
// AlertDialog.Builder builder = new AlertDialog.Builder(plugin.getActivity());
|
||||||
builder.setTitle("Choose device");
|
// builder.setTitle("Choose device");
|
||||||
|
//
|
||||||
|
// Spinner deviceListSpinner = new Spinner(plugin.getActivity());
|
||||||
|
// ArrayAdapter<Reader> adapter = new ArrayAdapter<>(plugin.getActivity(), android.R.layout.simple_spinner_item, new ArrayList<>(deviceList));
|
||||||
|
// adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
// deviceListSpinner.setAdapter(adapter);
|
||||||
|
//
|
||||||
|
// builder.setPositiveButton("OK", (dialog, which) -> {
|
||||||
|
// plugin.getClientInterface()
|
||||||
|
// .getTransactionManager()
|
||||||
|
// .setCardReaderToUse((Reader) deviceListSpinner.getSelectedItem());
|
||||||
|
// dialog.dismiss();
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// builder.setView(deviceListSpinner);
|
||||||
|
// builder.create().show();
|
||||||
|
|
||||||
Spinner deviceListSpinner = new Spinner(plugin.getActivity());
|
if (deviceList != null && !deviceList.isEmpty()) {
|
||||||
ArrayAdapter<Reader> adapter = new ArrayAdapter<>(plugin.getActivity(), android.R.layout.simple_spinner_item, new ArrayList<>(deviceList));
|
for (Reader reader : deviceList) {
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
String name = reader.toString();
|
||||||
deviceListSpinner.setAdapter(adapter);
|
System.out.println("name: " + name);
|
||||||
|
if (name.contains("SOFT")) {
|
||||||
builder.setPositiveButton("OK", (dialog, which) -> {
|
plugin.getClientInterface()
|
||||||
plugin.getClientInterface()
|
.getTransactionManager()
|
||||||
.getTransactionManager()
|
.setCardReaderToUse(reader);
|
||||||
.setCardReaderToUse((Reader) deviceListSpinner.getSelectedItem());
|
break;
|
||||||
dialog.dismiss();
|
}
|
||||||
});
|
}
|
||||||
|
}
|
||||||
builder.setView(deviceListSpinner);
|
|
||||||
builder.create().show();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -250,7 +265,7 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
||||||
plugin.getActivity().runOnUiThread(() -> {
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
this.callbackResult.success("success");
|
this.callbackResult.success("success");
|
||||||
Toast.makeText(plugin.getActivity(), "Transaction data has been received", Toast.LENGTH_LONG)
|
Toast.makeText(plugin.getActivity(), "Transaction data has been received", Toast.LENGTH_LONG)
|
||||||
.show();
|
.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -430,7 +445,6 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePinPadButtons() {
|
public void onCreatePinPadButtons() {
|
||||||
System.out.println("----->---->---->onCreatePinPadButtons");
|
System.out.println("----->---->---->onCreatePinPadButtons");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
package kz.com.aman.kassa.handler;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import kz.com.aman.kassa.bank.M4BankActivity;
|
||||||
|
import kz.com.aman.kassa.plugins.BankNfcPlugins;
|
||||||
|
import ru.m4bank.mpos.library.external.transactions.GetTransactionDetailsCallbackHandler;
|
||||||
|
import ru.m4bank.mpos.library.external.transactions.GetTransactionsListCallbackHandler;
|
||||||
|
import ru.m4bank.mpos.service.data.dynamic.objects.Transaction;
|
||||||
|
import ru.m4bank.mpos.service.result.Result;
|
||||||
|
|
||||||
|
public class TransactionDetailsHandlerImpl implements GetTransactionDetailsCallbackHandler<Result>, GetTransactionsListCallbackHandler<Result> {
|
||||||
|
private final BankNfcPlugins plugin;
|
||||||
|
|
||||||
|
public TransactionDetailsHandlerImpl(BankNfcPlugins plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransactionDetailsReceived(Transaction transaction) {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
|
System.out.println("getCheck:"+ transaction.getCheck());
|
||||||
|
System.out.println("getCheckNumber:"+ transaction.getCheckNumber());
|
||||||
|
Toast.makeText(plugin.getActivity(), "Transaction details received: " + transaction, Toast.LENGTH_SHORT)
|
||||||
|
.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccessStatusTransaction(Transaction transaction) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onErrorStatusTransaction() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTransactionsListReceived(List<Transaction> transactionList) {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(plugin.getActivity());
|
||||||
|
builder.setTitle("Choose transaction");
|
||||||
|
|
||||||
|
Spinner transactionListSpinner = new Spinner(plugin.getActivity());
|
||||||
|
ArrayAdapter<Transaction> adapter = new ArrayAdapter<>(plugin.getActivity(), android.R.layout.simple_spinner_item, new ArrayList<>(transactionList));
|
||||||
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
transactionListSpinner.setAdapter(adapter);
|
||||||
|
|
||||||
|
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||||
|
Transaction transaction = (Transaction) transactionListSpinner.getSelectedItem();
|
||||||
|
plugin.getClientInterface()
|
||||||
|
.getTransactionManager()
|
||||||
|
.getTransactionDetails(this, transaction.getOperationalDayNumber(), transaction
|
||||||
|
.getTransactionNumber(), transaction.getMobileTerminalId());
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setView(transactionListSpinner);
|
||||||
|
builder.create().show();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notAuthorized() {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> Toast.makeText(plugin.getActivity(), "Not authorized", Toast.LENGTH_SHORT).show());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCompleted(Result result) {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> Toast.makeText(plugin.getActivity(), result.getResultType() + " " + (result.getDescription() == null ? "" : result.getDescription()), Toast.LENGTH_SHORT)
|
||||||
|
.show());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWrongApiCalled() {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> Toast.makeText(plugin.getActivity(), "Wrong method has been called", Toast.LENGTH_SHORT).show());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRepeat(int attemptNumber) {
|
||||||
|
plugin.getActivity().runOnUiThread(() -> Toast.makeText(plugin.getActivity(), "Repeat attempt number " + attemptNumber, Toast.LENGTH_SHORT).show());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,14 +19,17 @@ import kz.com.aman.kassa.bank.permissions.PermissionsManagerImpl;
|
||||||
import kz.com.aman.kassa.handler.AuthorizationHandlerImpl;
|
import kz.com.aman.kassa.handler.AuthorizationHandlerImpl;
|
||||||
import kz.com.aman.kassa.handler.CardPaymentHandlerImpl;
|
import kz.com.aman.kassa.handler.CardPaymentHandlerImpl;
|
||||||
import kz.com.aman.kassa.handler.ConnectionCheckHandlerImpl;
|
import kz.com.aman.kassa.handler.ConnectionCheckHandlerImpl;
|
||||||
|
import kz.com.aman.kassa.handler.TransactionDetailsHandlerImpl;
|
||||||
import ru.m4bank.mpos.library.M4BankMposClient;
|
import ru.m4bank.mpos.library.M4BankMposClient;
|
||||||
import ru.m4bank.mpos.library.M4BankMposClientInterfaceFacade;
|
import ru.m4bank.mpos.library.M4BankMposClientInterfaceFacade;
|
||||||
import ru.m4bank.mpos.library.M4BankMposParameters;
|
import ru.m4bank.mpos.library.M4BankMposParameters;
|
||||||
import ru.m4bank.mpos.library.external.authorization.AuthorizationCallbackHandler;
|
import ru.m4bank.mpos.library.external.authorization.AuthorizationCallbackHandler;
|
||||||
|
import ru.m4bank.mpos.library.external.transactions.GetTransactionsListCallbackHandler;
|
||||||
import ru.m4bank.mpos.service.authorization.network.AuthorizationResponse;
|
import ru.m4bank.mpos.service.authorization.network.AuthorizationResponse;
|
||||||
import ru.m4bank.mpos.service.commons.data.ConfigurationSettings;
|
import ru.m4bank.mpos.service.commons.data.ConfigurationSettings;
|
||||||
import ru.m4bank.mpos.service.commons.data.NetworkConfiguration;
|
import ru.m4bank.mpos.service.commons.data.NetworkConfiguration;
|
||||||
import ru.m4bank.mpos.service.commons.data.TerminalConfiguration;
|
import ru.m4bank.mpos.service.commons.data.TerminalConfiguration;
|
||||||
|
import ru.m4bank.mpos.service.data.dynamic.objects.GetOperationType;
|
||||||
import ru.m4bank.mpos.service.hardware.external.cardreaderlib.data.enums.TransactionTypeConv;
|
import ru.m4bank.mpos.service.hardware.external.cardreaderlib.data.enums.TransactionTypeConv;
|
||||||
import ru.m4bank.mpos.service.network.Format;
|
import ru.m4bank.mpos.service.network.Format;
|
||||||
import ru.m4bank.mpos.service.network.ServerChoose;
|
import ru.m4bank.mpos.service.network.ServerChoose;
|
||||||
|
|
@ -74,12 +77,12 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
case "shutdown":
|
case "shutdown":
|
||||||
shutdown(call, result);
|
shutdown(call, result);
|
||||||
break;
|
break;
|
||||||
|
case "transaction":
|
||||||
|
showTransaction(call, result);
|
||||||
|
break;
|
||||||
case "version":
|
case "version":
|
||||||
|
|
||||||
result.success("version: "+ Build.VERSION.SDK_INT);
|
result.success("version: "+ Build.VERSION.SDK_INT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case "get":
|
case "get":
|
||||||
final List<Object> json = new ArrayList<>();
|
final List<Object> json = new ArrayList<>();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
|
|
@ -178,10 +181,19 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showTransaction(MethodCall call, Result result){
|
||||||
|
clientInterface.getTransactionManager()
|
||||||
|
.getTransactionsList(
|
||||||
|
new TransactionDetailsHandlerImpl(this),
|
||||||
|
20, 0,
|
||||||
|
GetOperationType.SHOW,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
private void cancel(MethodCall call, Result result) {
|
private void cancel(MethodCall call, Result result) {
|
||||||
try {
|
try {
|
||||||
clientInterface.cancel();
|
clientInterface.cancel();
|
||||||
result.success("canceled");
|
result.success("success");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("=============>ERROR:"+e.getMessage());
|
System.out.println("=============>ERROR:"+e.getMessage());
|
||||||
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
||||||
|
|
@ -191,7 +203,7 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
private void shutdown(MethodCall call, Result result) {
|
private void shutdown(MethodCall call, Result result) {
|
||||||
try {
|
try {
|
||||||
clientInterface.shutdown();
|
clientInterface.shutdown();
|
||||||
result.success("canceled");
|
result.success("success");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("=============>ERROR:"+e.getMessage());
|
System.out.println("=============>ERROR:"+e.getMessage());
|
||||||
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
||||||
|
|
@ -200,6 +212,7 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
|
|
||||||
//terminal config
|
//terminal config
|
||||||
private TerminalConfiguration createTerminalConfiguration() {
|
private TerminalConfiguration createTerminalConfiguration() {
|
||||||
|
System.out.println("=============>createTerminalConfiguration:"+new DeviceTypeDefiner().define());
|
||||||
return new TerminalConfiguration.Builder()
|
return new TerminalConfiguration.Builder()
|
||||||
.energySaverModeTime(150)
|
.energySaverModeTime(150)
|
||||||
.pinLengthsArray(new byte[]{4, 6})
|
.pinLengthsArray(new byte[]{4, 6})
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,8 @@ buildscript {
|
||||||
|
|
||||||
//TODO: 20.09.2019 for future refactoring: add gradle properties parameter to set supported device remotely
|
//TODO: 20.09.2019 for future refactoring: add gradle properties parameter to set supported device remotely
|
||||||
if (ext.buildType.buildType == 'NFC') {
|
if (ext.buildType.buildType == 'NFC') {
|
||||||
ext.supportedDevicesapp = ['SoftPos', 'Shtrih', 'Atol']
|
//ext.supportedDevicesapp = ['SoftPos', 'Shtrih', 'Atol']
|
||||||
|
ext.supportedDevicesapp = ['SoftPos']
|
||||||
} else {
|
} else {
|
||||||
ext.supportedDevicesapp = ['Deftun', 'Singular', 'CctRed', 'RoamData', 'Rp350n', 'WisePad', 'RoamPad',
|
ext.supportedDevicesapp = ['Deftun', 'Singular', 'CctRed', 'RoamData', 'Rp350n', 'WisePad', 'RoamPad',
|
||||||
'Qpos', 'Icmp', 'Spire', 'D200', 'RoamPadNfc', 'IcmpUpos', 'WangPos',
|
'Qpos', 'Icmp', 'Spire', 'D200', 'RoamPadNfc', 'IcmpUpos', 'WangPos',
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class _BankViewState extends State<BankView> {
|
||||||
String cancelValue;
|
String cancelValue;
|
||||||
String shutdownValue;
|
String shutdownValue;
|
||||||
String versionValue;
|
String versionValue;
|
||||||
|
String transactionValue;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -44,6 +45,13 @@ class _BankViewState extends State<BankView> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transaction() async {
|
||||||
|
String result = await _channel.invokeMethod('transaction');
|
||||||
|
setState(() {
|
||||||
|
transactionValue = result ?? 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
connect() async {
|
connect() async {
|
||||||
String result = await _channel.invokeMethod("connection");
|
String result = await _channel.invokeMethod("connection");
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -163,6 +171,13 @@ class _BankViewState extends State<BankView> {
|
||||||
Text('shutdown: $shutdownValue'),
|
Text('shutdown: $shutdownValue'),
|
||||||
RaisedButton(child: Text('Shutdown'), onPressed: shutdown),
|
RaisedButton(child: Text('Shutdown'), onPressed: shutdown),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Text('transaction: $transactionValue'),
|
||||||
|
RaisedButton(child: Text('Transaction'), onPressed: transaction),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text('pay: $payValue'),
|
Text('pay: $payValue'),
|
||||||
RaisedButton(child: Text('Payment'), onPressed: pay),
|
RaisedButton(child: Text('Payment'), onPressed: pay),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue