parent
34dc1cb8a2
commit
e06d192dcb
|
|
@ -242,7 +242,7 @@ public class CardPaymentHandlerImpl implements CardPaymentCallbackHandler<Result
|
||||||
dao.setSuccess(false);
|
dao.setSuccess(false);
|
||||||
dao.setMsg(String.format("%s", errorHandler.getFinalDescription()));
|
dao.setMsg(String.format("%s", errorHandler.getFinalDescription()));
|
||||||
this.result.success(gson.toJson(dao));
|
this.result.success(gson.toJson(dao));
|
||||||
Toast.makeText(plugin.getActivity(), String.format("onError: %s, description: %s", ((AllError) errorHandler).name(), errorHandler.getFinalDescription()), Toast.LENGTH_LONG).show();
|
//Toast.makeText(plugin.getActivity(), String.format("onError: %s, description: %s", ((AllError) errorHandler).name(), errorHandler.getFinalDescription()), Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ 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.CurrencyDataHolder;
|
||||||
|
import ru.m4bank.mpos.service.data.dynamic.objects.Currency;
|
||||||
import ru.m4bank.mpos.service.data.dynamic.objects.GetOperationType;
|
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;
|
||||||
|
|
@ -76,6 +78,9 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
case "connection":
|
case "connection":
|
||||||
connection(result);
|
connection(result);
|
||||||
break;
|
break;
|
||||||
|
case "currency":
|
||||||
|
currency(result);
|
||||||
|
break;
|
||||||
case "auth":
|
case "auth":
|
||||||
authentication(call, result);
|
authentication(call, result);
|
||||||
break;
|
break;
|
||||||
|
|
@ -189,6 +194,43 @@ public class BankNfcPlugins implements MethodCallHandler {
|
||||||
.checkConnection(
|
.checkConnection(
|
||||||
new ConnectionCheckHandlerImpl(this.activity, result));
|
new ConnectionCheckHandlerImpl(this.activity, result));
|
||||||
}
|
}
|
||||||
|
private void currency(Result result) {
|
||||||
|
CurrencyDataHolder dataHolder = clientInterface.getConfigurationManager()
|
||||||
|
.getCurrencyDataHolder();
|
||||||
|
Currency currentCurrency = dataHolder.getCurrency();
|
||||||
|
if(currentCurrency!=null){
|
||||||
|
System.out.println(currentCurrency.getName());
|
||||||
|
System.out.println(currentCurrency.getCurrency3DigitCode());
|
||||||
|
} else {
|
||||||
|
System.out.println("currentCurrency is null");
|
||||||
|
}
|
||||||
|
System.out.println("===========================");
|
||||||
|
if(currentCurrency == null || !"398".equalsIgnoreCase(currentCurrency.getCurrency3DigitCode()) ){
|
||||||
|
List<Currency> currencies = dataHolder.getCurrencyList();
|
||||||
|
boolean changed = false;
|
||||||
|
for(Currency currency : currencies ){
|
||||||
|
System.out.println(currency.getName());
|
||||||
|
System.out.println(currency.getLetterCode());
|
||||||
|
System.out.println(currency.getCurrency3DigitCode());
|
||||||
|
if("398".equalsIgnoreCase(currency.getCurrency3DigitCode())){
|
||||||
|
dataHolder.setCurrency(currency);
|
||||||
|
changed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AmanDao<String> dao = new AmanDao<>();
|
||||||
|
dao.setSuccess(changed);
|
||||||
|
dao.setMsg("current currency " + (currentCurrency!=null ? currentCurrency.getLetterCode() : "NULL"));
|
||||||
|
result.success(gson.toJson(dao));
|
||||||
|
} else {
|
||||||
|
AmanDao<String> dao = new AmanDao<>();
|
||||||
|
dao.setSuccess(true);
|
||||||
|
dao.setMsg("exist");
|
||||||
|
result.success(gson.toJson(dao));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void authentication(MethodCall call, Result result) {
|
private void authentication(MethodCall call, Result result) {
|
||||||
String login = call.argument("login");
|
String login = call.argument("login");
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,18 @@ class BankService extends BaseService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> currency() async {
|
||||||
|
try {
|
||||||
|
String response = await _channel.invokeMethod("currency");
|
||||||
|
AmanDao dao = AmanDao.fromJson(json.decode(response));
|
||||||
|
log.i('${dao.success} - ${dao.msg}');
|
||||||
|
return dao.success;
|
||||||
|
} catch (e, stack) {
|
||||||
|
log.e("BankService", e, stack);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> permissions() async {
|
Future<bool> permissions() async {
|
||||||
try {
|
try {
|
||||||
String response = await _channel.invokeMethod("permissions");
|
String response = await _channel.invokeMethod("permissions");
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
TextEditingController _passwordController;
|
TextEditingController _passwordController;
|
||||||
final BankService _bankService = locator<BankService>();
|
final BankService _bankService = locator<BankService>();
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
String _platformImei = 'Unknown';
|
|
||||||
String _bankImei = 'Unknown';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -32,10 +30,10 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
BankState state = Redux.store.state.bankState;
|
BankState state = Redux.store.state.bankState;
|
||||||
_emailController = new TextEditingController(text: state.login);
|
_emailController = new TextEditingController(text: state.login);
|
||||||
_passwordController = new TextEditingController(text: state.password);
|
_passwordController = new TextEditingController(text: state.password);
|
||||||
initBankImeiState();
|
permissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initBankImeiState() async {
|
Future<void> permissions() async {
|
||||||
try {
|
try {
|
||||||
await _bankService.permissions();
|
await _bankService.permissions();
|
||||||
} on PlatformException {
|
} on PlatformException {
|
||||||
|
|
@ -74,8 +72,6 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
style: TextStyle(fontSize: 15.0),
|
style: TextStyle(fontSize: 15.0),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
Text('Ваш IMEI-код:$_platformImei'),
|
|
||||||
Text('Ваш IMEI-код:$_bankImei'),
|
|
||||||
verticalSpaceTiny,
|
verticalSpaceTiny,
|
||||||
TextField(
|
TextField(
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
|
|
@ -85,6 +81,7 @@ class _BankSettingViewState extends State<BankSettingView> {
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
|
obscureText: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Пароль', hintText: "Введите пароль"),
|
labelText: 'Пароль', hintText: "Введите пароль"),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ class _PopupMenuState extends State<PopupMenu> {
|
||||||
|
|
||||||
List<Choice> _choices = <Choice>[
|
List<Choice> _choices = <Choice>[
|
||||||
const Choice(title: 'Информация о ККМ', icon: Icons.info_outline, command: 'infokkm'),
|
const Choice(title: 'Информация о ККМ', icon: Icons.info_outline, command: 'infokkm'),
|
||||||
if (version >= 24 )
|
//if (version >= 24 )
|
||||||
const Choice(title: 'Bank', icon: Icons.text_fields, command: 'bank'),
|
// const Choice(title: 'Bank', icon: Icons.text_fields, command: 'bank'),
|
||||||
if (version >= 24 )
|
if (version >= 24 )
|
||||||
const Choice(title: 'Настройка Tap2Phone', icon: MdiIcons.nfc, command: 'tap2phone'),
|
const Choice(title: 'Настройка Tap2Phone', icon: MdiIcons.nfc, command: 'tap2phone'),
|
||||||
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
const Choice(title: 'Выйти', icon: Icons.exit_to_app, command: 'exit')
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class _PaymentNfcViewState extends State<PaymentNfcView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() async {
|
void start() async {
|
||||||
//Инициализация
|
//права доступа
|
||||||
bool success = await _bankService.permissions();
|
bool success = await _bankService.permissions();
|
||||||
log.i(success);
|
log.i(success);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
@ -82,6 +82,9 @@ class _PaymentNfcViewState extends State<PaymentNfcView> {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Проверка связи
|
//Проверка связи
|
||||||
bool connected = await _bankService.connect();
|
bool connected = await _bankService.connect();
|
||||||
log.i(connected);
|
log.i(connected);
|
||||||
|
|
@ -107,6 +110,16 @@ class _PaymentNfcViewState extends State<PaymentNfcView> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //валюта
|
||||||
|
// bool currency = await _bankService.currency();
|
||||||
|
// log.i(currency);
|
||||||
|
// if (!currency) {
|
||||||
|
// setState(() {
|
||||||
|
// status = 4;
|
||||||
|
// });
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
pay();
|
pay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue