Проведение покупки, проверка деактивированного токена, подтверждение логаута, функциональная маска на сканере, кнопка назад в faq
This commit is contained in:
@@ -27,7 +27,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
}
|
||||
|
||||
Map user;
|
||||
String card;
|
||||
String card = '';
|
||||
String integerPart = '', fractionalPart = '';
|
||||
String loyality = '';
|
||||
|
||||
@@ -40,7 +40,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
getValueWithTitle('Вознаграждение', loyality),
|
||||
getHintLabel(),
|
||||
getDecoratedTextWidget(),
|
||||
buildButton(new EdgeInsets.only(top: 36.0, left: buttonVerticalMargin, right: buttonVerticalMargin), buildRaisedButton(context, 'ЗАВЕРШИТЬ ПОКУПКУ', () => _purchase(context))),
|
||||
buildButton(new EdgeInsets.only(top: 36.0, left: buttonVerticalMargin, right: buttonVerticalMargin), buildRaisedButton(context, 'ЗАВЕРШИТЬ ПОКУПКУ', () => onPurchaseClick(context))),
|
||||
buildButton(new EdgeInsets.only(top: 24.0, left: buttonVerticalMargin, right: buttonVerticalMargin), buildFlatButton(context, 'СКАНИРОВАТЬ', primaryColor))])
|
||||
].reversed.toList()));
|
||||
}
|
||||
@@ -123,7 +123,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
return temporaryInteger + '.' + temporaryFractional;
|
||||
}
|
||||
|
||||
_purchase(BuildContext context) {
|
||||
onPurchaseClick(BuildContext context) {
|
||||
String val = _buildSum();
|
||||
print(val);
|
||||
showDialog(context: context, child: new AlertDialog(
|
||||
@@ -139,10 +139,39 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
new FlatButton(
|
||||
child: new Text('Да'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
pushRoute(context, new PurchaseSuccessScreen(val, user['first_name']));
|
||||
purchase(val);
|
||||
},
|
||||
)
|
||||
]));
|
||||
}
|
||||
|
||||
purchase(String sum_total) {
|
||||
|
||||
platform.invokeMethod('getDocID').then((result) {
|
||||
|
||||
String url = user['purchases_url'];
|
||||
|
||||
var body = {
|
||||
'doc_id': result,
|
||||
'curr_iso_code': '643',
|
||||
'commit': 'true',
|
||||
'sum_total': sum_total
|
||||
};
|
||||
|
||||
var headers = {
|
||||
'DM-Authorization': 'dmapptoken 9fec83cdca38c357e6b65dbb17514cdd36bf2a08',
|
||||
'Authorization': 'dmtoken ${token}'
|
||||
};
|
||||
|
||||
httpClient.post(url, body: body, headers: headers).then((response) {
|
||||
|
||||
print(response.body);
|
||||
Navigator.of(context).pop();
|
||||
pushRoute(context, new PurchaseSuccessScreen(sum_total, user['first_name']));
|
||||
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user