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