fortenew commit test
parent
9ab70203ac
commit
a050407beb
|
|
@ -30,8 +30,7 @@
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:windowSoftInputMode="adjustResize"
|
android:windowSoftInputMode="adjustResize">
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<meta-data
|
<meta-data
|
||||||
|
|
|
||||||
|
|
@ -69,14 +69,10 @@ class MainActivity : FlutterActivity() {
|
||||||
if (call.argument<Long>("amount") != null) {
|
if (call.argument<Long>("amount") != null) {
|
||||||
amount = call.argument<Long>("amount")!!.toLong()
|
amount = call.argument<Long>("amount")!!.toLong()
|
||||||
}
|
}
|
||||||
val packageName = call.argument<String>("packageName").toString()
|
|
||||||
val operationParameters = createOperationParameters(token)
|
val operationParameters = createOperationParameters(token)
|
||||||
val body = JsonForExternalCall.getRefundCardJson(operationParameters.authToken, terminalId, operDay, transNum, amount)
|
val packageName = call.argument<String>("packageName").toString()
|
||||||
startOperation(
|
|
||||||
OperationType.REFUND,
|
startOperation(OperationType.PAYMENT, JsonForExternalCall.getPaymentCardJson(operationParameters.authToken, amount.toString()), packageName)
|
||||||
body,
|
|
||||||
packageName
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun operationRefund(call: MethodCall) {
|
private fun operationRefund(call: MethodCall) {
|
||||||
|
|
@ -129,7 +125,8 @@ class MainActivity : FlutterActivity() {
|
||||||
private fun startOperation(
|
private fun startOperation(
|
||||||
operationType: OperationType,
|
operationType: OperationType,
|
||||||
inputJsonData: String?,
|
inputJsonData: String?,
|
||||||
packageName: String) {
|
packageName: String
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.component = ComponentName(packageName, "ru.m4bank.feature.externalapplication.ExternalApplicationActivity")
|
intent.component = ComponentName(packageName, "ru.m4bank.feature.externalapplication.ExternalApplicationActivity")
|
||||||
|
|
@ -146,7 +143,6 @@ class MainActivity : FlutterActivity() {
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
_result.error("008", "Не удалось найти подходящее приложение", "aaa")
|
_result.error("008", "Не удалось найти подходящее приложение", "aaa")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -18,6 +19,7 @@ allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations.all {
|
configurations.all {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class FortePosSession {
|
class FortePosSession {
|
||||||
const FortePosSession(
|
const FortePosSession({
|
||||||
{this.login,
|
this.login,
|
||||||
this.token,
|
this.token,
|
||||||
this.serverTime,
|
this.serverTime,
|
||||||
this.tokenTimeout,
|
this.tokenTimeout,
|
||||||
this.result});
|
this.result,
|
||||||
|
});
|
||||||
|
|
||||||
final String? login;
|
final String? login;
|
||||||
final String? token;
|
final String? token;
|
||||||
|
|
@ -15,61 +16,64 @@ class FortePosSession {
|
||||||
final ResultBean? result;
|
final ResultBean? result;
|
||||||
|
|
||||||
static FortePosSession fromJson(Map<String, dynamic> data) => FortePosSession(
|
static FortePosSession fromJson(Map<String, dynamic> data) => FortePosSession(
|
||||||
login: data['login'],
|
login: data['login'] as String?,
|
||||||
token: data['token'],
|
token: data['token'] as String?,
|
||||||
result: ResultBean.fromMap(data['result']),
|
result: data['result'] != null ? ResultBean.fromMap(data['result'] as Map<String, dynamic>) : null,
|
||||||
serverTime: data['ServerTime'] != null
|
serverTime: data['ServerTime'] != null
|
||||||
? new DateFormat("dd.MM.yyyy HH:mm:ss ZZZ").parse(data['ServerTime'])
|
? DateFormat("dd.MM.yyyy HH:mm:ss ZZZ").parse(data['ServerTime'])
|
||||||
: null,
|
: null,
|
||||||
tokenTimeout: data['TokenTimeout']);
|
tokenTimeout: data['TokenTimeout'] as int?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"login": login,
|
||||||
|
"token": token,
|
||||||
|
"ServerTime": serverTime != null
|
||||||
|
? DateFormat("dd.MM.yyyy HH:mm:ss ZZZ").format(serverTime!)
|
||||||
|
: null,
|
||||||
|
"TokenTimeout": tokenTimeout,
|
||||||
|
"result": result?.toJson(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ServerTime : "25.06.2021 13:18:00 GMT+06:00"
|
|
||||||
/// ResultCode : "040"
|
|
||||||
/// ResultStr : "Unknown operator login. Check the correctness of the data or contact support."
|
|
||||||
/// Response : {"Code":"040","Description":"Unknown operator login. Check the correctness of the data or contact support."}
|
|
||||||
|
|
||||||
class ResultBean {
|
class ResultBean {
|
||||||
String? ServerTime;
|
late String ServerTime;
|
||||||
String? ResultCode;
|
late String ResultCode;
|
||||||
String? ResultStr;
|
late String ResultStr;
|
||||||
ResponseBean? Response;
|
late ResponseBean? Response;
|
||||||
|
|
||||||
static ResultBean? fromMap(Map<String, dynamic>? map) {
|
static ResultBean? fromMap(Map<String, dynamic>? map) {
|
||||||
if (map == null) return null;
|
if (map == null) return null;
|
||||||
ResultBean resultBean = ResultBean();
|
ResultBean resultBean = ResultBean();
|
||||||
resultBean.ServerTime = map['ServerTime'];
|
resultBean.ServerTime = map['ServerTime'] as String? ?? '';
|
||||||
resultBean.ResultCode = map['ResultCode'];
|
resultBean.ResultCode = map['ResultCode'] as String? ?? '';
|
||||||
resultBean.ResultStr = map['ResultStr'];
|
resultBean.ResultStr = map['ResultStr'] as String? ?? '';
|
||||||
resultBean.Response = ResponseBean.fromMap(map['Response']);
|
resultBean.Response = map['Response'] != null ? ResponseBean.fromMap(map['Response'] as Map<String, dynamic>) : null;
|
||||||
return resultBean;
|
return resultBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"ServerTime": ServerTime,
|
"ServerTime": ServerTime,
|
||||||
"ResultCode": ResultCode,
|
"ResultCode": ResultCode,
|
||||||
"ResultStr": ResultStr,
|
"ResultStr": ResultStr,
|
||||||
"Response": Response,
|
"Response": Response?.toJson(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Code : "040"
|
|
||||||
/// Description : "Unknown operator login. Check the correctness of the data or contact support."
|
|
||||||
|
|
||||||
class ResponseBean {
|
class ResponseBean {
|
||||||
String? Code;
|
late String Code;
|
||||||
String? Description;
|
late String Description;
|
||||||
|
|
||||||
static ResponseBean? fromMap(Map<String, dynamic>? map) {
|
static ResponseBean? fromMap(Map<String, dynamic>? map) {
|
||||||
if (map == null) return null;
|
if (map == null) return null;
|
||||||
ResponseBean responseBean = ResponseBean();
|
ResponseBean responseBean = ResponseBean();
|
||||||
responseBean.Code = map['Code'];
|
responseBean.Code = map['Code'] as String? ?? '';
|
||||||
responseBean.Description = map['Description'];
|
responseBean.Description = map['Description'] as String? ?? '';
|
||||||
return responseBean;
|
return responseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"Code": Code,
|
"Code": Code,
|
||||||
"Description": Description,
|
"Description": Description,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
import 'package:aman_kassa_flutter/core/models/halyk/halyk_post_session.dart';
|
import 'package:aman_kassa_flutter/core/models/halyk/halyk_post_session.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/models/forte/forte_post_session.dart';
|
||||||
import 'package:aman_kassa_flutter/redux/state/bank_state.dart';
|
import 'package:aman_kassa_flutter/redux/state/bank_state.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
import 'package:redux_thunk/redux_thunk.dart';
|
import 'package:redux_thunk/redux_thunk.dart';
|
||||||
|
|
||||||
import '../../core/models/forte/forte_post_session.dart';
|
|
||||||
import '../store.dart';
|
import '../store.dart';
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
|
|
@ -60,6 +60,12 @@ ThunkAction<AppState> saveData(String login, String password, {String? sessionTy
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
store.dispatch(SetBankStateAction(BankState(
|
||||||
|
login: login,
|
||||||
|
password: password,
|
||||||
|
session: session,
|
||||||
|
sessionType: sessionType,
|
||||||
|
)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import 'package:aman_kassa_flutter/core/models/product_dao.dart';
|
||||||
import 'package:aman_kassa_flutter/core/models/response.dart';
|
import 'package:aman_kassa_flutter/core/models/response.dart';
|
||||||
import 'package:aman_kassa_flutter/core/route_names.dart';
|
import 'package:aman_kassa_flutter/core/route_names.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/BankService.dart';
|
import 'package:aman_kassa_flutter/core/services/BankService.dart';
|
||||||
|
import 'package:aman_kassa_flutter/core/services/ForteService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/DataService.dart';
|
import 'package:aman_kassa_flutter/core/services/DataService.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
import 'package:aman_kassa_flutter/core/services/dialog_service.dart';
|
||||||
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
import 'package:aman_kassa_flutter/core/services/navigator_service.dart';
|
||||||
|
|
@ -37,6 +38,7 @@ import 'package:aman_kassa_flutter/views/payment/halyk_pos_service.dart';
|
||||||
import '../../core/models/aman_dao.dart';
|
import '../../core/models/aman_dao.dart';
|
||||||
import '../../core/models/card_data.dart';
|
import '../../core/models/card_data.dart';
|
||||||
import '../../core/models/card_data.dart';
|
import '../../core/models/card_data.dart';
|
||||||
|
import 'forte_pos_service.dart';
|
||||||
|
|
||||||
class PaymentView extends StatefulWidget {
|
class PaymentView extends StatefulWidget {
|
||||||
final PaymentModel model;
|
final PaymentModel model;
|
||||||
|
|
@ -51,7 +53,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
final GlobalKey<State> _keyLoader = new GlobalKey<State>();
|
final GlobalKey<State> _keyLoader = new GlobalKey<State>();
|
||||||
final DataService _dataService = locator<DataService>();
|
final DataService _dataService = locator<DataService>();
|
||||||
final DialogService _dialogService = locator<DialogService>();
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
BankService _bankService = locator<BankService>();
|
dynamic _bankService;
|
||||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||||
final TextEditingController _iinController = new TextEditingController();
|
final TextEditingController _iinController = new TextEditingController();
|
||||||
late bool isBusy;
|
late bool isBusy;
|
||||||
|
|
@ -74,12 +76,25 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
_bankInit() async {
|
_bankInit() async {
|
||||||
int version = await _bankService.version();
|
BankState? state = Redux.store?.state.bankState;
|
||||||
if (version >= _bankService.sdkVersion) {
|
|
||||||
|
print(state?.toJson());
|
||||||
|
|
||||||
|
if (state?.sessionType == 'Halyk' && state?.session != null) {
|
||||||
|
_bankService = locator<BankService>();
|
||||||
|
} else if (state?.sessionType == 'Forte' && state?.session != null) {
|
||||||
|
_bankService = locator<ForteService>();
|
||||||
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
isBankApiAccess = true;
|
isBankApiAccess = false;
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int version = await _bankService.version();
|
||||||
|
setState(() {
|
||||||
|
isBankApiAccess = version >= _bankService.sdkVersion;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -247,6 +262,15 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
state.password!.length < 1 || state.login!.length < 1) {
|
state.password!.length < 1 || state.login!.length < 1) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
final bool isForteSessionActive = state.sessionType == 'Forte';
|
||||||
|
|
||||||
|
final String imageAsset = isForteSessionActive
|
||||||
|
? 'assets/images/fortepos.png'
|
||||||
|
: 'assets/images/halykpos.png';
|
||||||
|
final Color sessionColor = isForteSessionActive ? forteColor : halykColor;
|
||||||
|
final Future<AmanDao<CardData>> Function(double) paymentMethod =
|
||||||
|
isForteSessionActive ? paymentFortePos : paymentHalykPos;
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: isBusy ?
|
onTap: isBusy ?
|
||||||
() {} :
|
() {} :
|
||||||
|
|
@ -268,7 +292,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Redux.store!.dispatch(changePinSkipFromSetting(true));
|
await Redux.store!.dispatch(changePinSkipFromSetting(true));
|
||||||
AmanDao<CardData> data = await paymentHalykPos(_total);
|
AmanDao<CardData> data = await paymentMethod(_total);
|
||||||
if (data.success == true) {
|
if (data.success == true) {
|
||||||
pressPayment('card', data.data);
|
pressPayment('card', data.data);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -293,7 +317,7 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
border: Border.all(color: Colors.white),
|
border: Border.all(color: Colors.white),
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('assets/images/halykpos.png'),
|
image: AssetImage(imageAsset),
|
||||||
fit: BoxFit.fitWidth
|
fit: BoxFit.fitWidth
|
||||||
),
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ packages:
|
||||||
name: barcode_scan2
|
name: barcode_scan2
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.1"
|
version: "4.2.4"
|
||||||
bluetooth_print:
|
bluetooth_print:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: aman_kassa_flutter
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.4.0+42
|
version: 1.4.0+42
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.15.0 <3.0.0'
|
sdk: '>=2.15.0 <4.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue