ui commit and debug fix
parent
23774d69dc
commit
e0c4ade930
|
|
@ -67,8 +67,8 @@ android {
|
|||
buildConfigField ("String[]", "SUPPORTED_DEVICES", collectSupportedDevicesToArray())
|
||||
}
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-debug"
|
||||
//applicationIdSuffix ".debug"
|
||||
//versionNameSuffix "-debug"
|
||||
//resValue "string", "app_name", "Aman Kassa (debug)"
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
|
|
|
|||
|
|
@ -99,24 +99,39 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
|||
public void onDeviceToUseSelectionRequested(List<Reader> deviceList) {
|
||||
System.out.println("----->---->---->onDeviceToUseSelectionRequested");
|
||||
plugin.getActivity().runOnUiThread(() -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(plugin.getActivity());
|
||||
builder.setTitle("Choose device");
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(plugin.getActivity());
|
||||
// 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());
|
||||
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) -> {
|
||||
if (deviceList != null && !deviceList.isEmpty()) {
|
||||
for (Reader reader : deviceList) {
|
||||
String name = reader.toString();
|
||||
System.out.println("name: " + name);
|
||||
if (name.contains("SOFT")) {
|
||||
plugin.getClientInterface()
|
||||
.getTransactionManager()
|
||||
.setCardReaderToUse((Reader) deviceListSpinner.getSelectedItem());
|
||||
dialog.dismiss();
|
||||
.setCardReaderToUse(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
builder.setView(deviceListSpinner);
|
||||
builder.create().show();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -430,7 +445,6 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void 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.CardPaymentHandlerImpl;
|
||||
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.M4BankMposClientInterfaceFacade;
|
||||
import ru.m4bank.mpos.library.M4BankMposParameters;
|
||||
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.commons.data.ConfigurationSettings;
|
||||
import ru.m4bank.mpos.service.commons.data.NetworkConfiguration;
|
||||
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.network.Format;
|
||||
import ru.m4bank.mpos.service.network.ServerChoose;
|
||||
|
|
@ -74,12 +77,12 @@ public class BankNfcPlugins implements MethodCallHandler {
|
|||
case "shutdown":
|
||||
shutdown(call, result);
|
||||
break;
|
||||
case "transaction":
|
||||
showTransaction(call, result);
|
||||
break;
|
||||
case "version":
|
||||
|
||||
result.success("version: "+ Build.VERSION.SDK_INT);
|
||||
break;
|
||||
|
||||
|
||||
case "get":
|
||||
final List<Object> json = new ArrayList<>();
|
||||
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) {
|
||||
try {
|
||||
clientInterface.cancel();
|
||||
result.success("canceled");
|
||||
result.success("success");
|
||||
} catch (Exception e) {
|
||||
System.out.println("=============>ERROR:"+e.getMessage());
|
||||
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
||||
|
|
@ -191,7 +203,7 @@ public class BankNfcPlugins implements MethodCallHandler {
|
|||
private void shutdown(MethodCall call, Result result) {
|
||||
try {
|
||||
clientInterface.shutdown();
|
||||
result.success("canceled");
|
||||
result.success("success");
|
||||
} catch (Exception e) {
|
||||
System.out.println("=============>ERROR:"+e.getMessage());
|
||||
result.error("2", e.getMessage(), e.getLocalizedMessage());
|
||||
|
|
@ -200,6 +212,7 @@ public class BankNfcPlugins implements MethodCallHandler {
|
|||
|
||||
//terminal config
|
||||
private TerminalConfiguration createTerminalConfiguration() {
|
||||
System.out.println("=============>createTerminalConfiguration:"+new DeviceTypeDefiner().define());
|
||||
return new TerminalConfiguration.Builder()
|
||||
.energySaverModeTime(150)
|
||||
.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
|
||||
if (ext.buildType.buildType == 'NFC') {
|
||||
ext.supportedDevicesapp = ['SoftPos', 'Shtrih', 'Atol']
|
||||
//ext.supportedDevicesapp = ['SoftPos', 'Shtrih', 'Atol']
|
||||
ext.supportedDevicesapp = ['SoftPos']
|
||||
} else {
|
||||
ext.supportedDevicesapp = ['Deftun', 'Singular', 'CctRed', 'RoamData', 'Rp350n', 'WisePad', 'RoamPad',
|
||||
'Qpos', 'Icmp', 'Spire', 'D200', 'RoamPadNfc', 'IcmpUpos', 'WangPos',
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class _BankViewState extends State<BankView> {
|
|||
String cancelValue;
|
||||
String shutdownValue;
|
||||
String versionValue;
|
||||
String transactionValue;
|
||||
bool loading = false;
|
||||
|
||||
@override
|
||||
|
|
@ -44,6 +45,13 @@ class _BankViewState extends State<BankView> {
|
|||
});
|
||||
}
|
||||
|
||||
transaction() async {
|
||||
String result = await _channel.invokeMethod('transaction');
|
||||
setState(() {
|
||||
transactionValue = result ?? 'none';
|
||||
});
|
||||
}
|
||||
|
||||
connect() async {
|
||||
String result = await _channel.invokeMethod("connection");
|
||||
setState(() {
|
||||
|
|
@ -163,6 +171,13 @@ class _BankViewState extends State<BankView> {
|
|||
Text('shutdown: $shutdownValue'),
|
||||
RaisedButton(child: Text('Shutdown'), onPressed: shutdown),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Text('transaction: $transactionValue'),
|
||||
RaisedButton(child: Text('Transaction'), onPressed: transaction),
|
||||
],
|
||||
),
|
||||
Text('pay: $payValue'),
|
||||
RaisedButton(child: Text('Payment'), onPressed: pay),
|
||||
|
|
|
|||
Loading…
Reference in New Issue