reversal release

backend_nfc
suvaissov 2021-06-08 16:23:27 +06:00
parent f4ce7b85b9
commit b23c505fc5
5 changed files with 26 additions and 2 deletions

View File

@ -11,6 +11,8 @@ class CloseDayData {
final int paymentCount;
final num refundAmount;
final int refundCount;
final num cancelAmount;
final int cancelCount;
final List<TransactionBean> items;
CloseDayData({
@ -18,7 +20,8 @@ class CloseDayData {
this.items,
this.totalAmount, this.totalCount,
this.paymentAmount, this.paymentCount,
this.refundAmount, this.refundCount
this.refundAmount, this.refundCount,
this.cancelAmount, this.cancelCount
});
static CloseDayData fromJson(Map<String, dynamic> json) {
@ -30,6 +33,8 @@ class CloseDayData {
paymentCount: json['paymentCount'],
refundAmount: json['refundAmount'],
refundCount: json['refundCount'],
cancelAmount: json['cancelAmount'],
cancelCount: json['cancelCount'],
items: (json['items'] as List).map((e) => TransactionBean.fromMap(e)).toList(),
);
}
@ -42,6 +47,8 @@ class CloseDayData {
'paymentCount': paymentCount,
'refundAmount': refundAmount,
'refundCount': refundCount,
'cancelAmount': cancelAmount,
'cancelCount': cancelCount,
'items': items.map((e) => e.toJson()).toList(),
};
}

View File

@ -109,6 +109,8 @@ class BankService extends BaseService {
int paymentCount = 0;
num refundAmount = 0;
int refundCount = 0;
num cancelAmount = 0;
int cancelCount = 0;
for(Cd.TransactionBean item in items) {
if(item.type == 'PAYMENT') {
@ -119,6 +121,10 @@ class BankService extends BaseService {
refundCount++;
refundAmount += ( item.amount / 100 );
totalAmount -= ( item.amount / 100 );
} else if(item.type == 'REVERSAL') {
cancelCount++;
cancelAmount += ( item.amount / 100 );
totalAmount -= ( item.amount / 100 );
}
totalCount++;
}
@ -129,6 +135,7 @@ class BankService extends BaseService {
totalAmount: totalAmount, totalCount: totalCount,
paymentAmount: paymentAmount, paymentCount: paymentCount,
refundAmount: refundAmount, refundCount: refundCount,
cancelAmount: cancelAmount, cancelCount: cancelCount,
);
return closeDayData;
}

View File

@ -143,7 +143,9 @@ class DataService extends BaseService {
CheckData checkData,
CardData cardData}) async {
try {
checkData.cardData = cardData;
var json = cardData.toJson();
json['transactionType'] = VoucherTypeReturnPay;
checkData.cardData = CardData.fromJson(json);
String data = jsonEncode(checkData.toJson());
log.i('token: $token');

View File

@ -187,8 +187,11 @@ class _MyFloatingActionButtonState extends State<MyFloatingActionButton> {
double sheetHeight = 260;
@override
Widget build(BuildContext context) {
//print(widget.data.cardData.transactionType);
if (showFab) {
return Column(
mainAxisAlignment: MainAxisAlignment.end,

View File

@ -32,6 +32,11 @@ class CloseDayShowContainer extends StatelessWidget {
TableCell(child: Text('${data.paymentCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.paymentAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
TableRow(children: [
TableCell(child: Text('Отмен:', style: productTextStyle,)),
TableCell(child: Text('${data.cancelCount}', textAlign: TextAlign.center, style: productTextStyle)),
TableCell(child: Text('${data.cancelAmount} T', textAlign: TextAlign.end, style: productTextStyle)),
]),
TableRow(children: [
TableCell(child: Text('Возвратов:', style: productTextStyle,)),
TableCell(child: Text('${data.refundCount}', textAlign: TextAlign.center, style: productTextStyle)),