imrpoving tran flow
This commit is contained in:
@@ -36,8 +36,8 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
gatewayController = GatewayController(context);
|
||||
receiptController = ReceiptController(context);
|
||||
gatewayController = GatewayController(context);
|
||||
|
||||
receiptController.getReceiptData(
|
||||
transactionController.model.receiptData?["id"],
|
||||
@@ -85,20 +85,28 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
|
||||
_retry() async {
|
||||
receiptController.setLoading(true);
|
||||
await gatewayController.pollTransaction(receiptController.model.receiptData?["id"]);
|
||||
if(gatewayController.model.status == "SUCCESS"){
|
||||
await receiptController.doIntegration(receiptController.model.receiptData?["id"]);
|
||||
if(receiptController.model.status == "SUCCESS"){
|
||||
receiptController.getReceiptData(transactionController.model.receiptData?["id"]);
|
||||
}
|
||||
receiptController.setLoading(false);
|
||||
}
|
||||
|
||||
_check() async {
|
||||
receiptController.setLoading(true);
|
||||
await gatewayController.poll(receiptController.model.receiptData?["id"]);
|
||||
if(gatewayController.model.status == "SUCCESS"){
|
||||
await _retry();
|
||||
}
|
||||
receiptController.setLoading(false);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
_tabController.dispose();
|
||||
gatewayController.dispose();
|
||||
receiptController.dispose();
|
||||
}
|
||||
|
||||
@@ -376,7 +384,7 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
if(receiptController.model.receiptData?["integrationStatus"] == "PENDING" &&
|
||||
if(receiptController.model.receiptData?["integrationStatus"] != "SUCCESS" &&
|
||||
receiptController.model.receiptData?["paymentStatus"] == "SUCCESS")
|
||||
Column(
|
||||
children: [
|
||||
@@ -418,6 +426,47 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
if(receiptController.model.receiptData?["pollingStatus"] != "SUCCESS")
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
_check();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.price_check,
|
||||
color:
|
||||
Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
"Check status",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -479,6 +528,7 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
Skeletonizer(
|
||||
enabled:
|
||||
receiptController
|
||||
@@ -553,6 +603,44 @@ class _ReceiptScreenState extends State<ReceiptScreen>
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if(receiptController.model.receiptData?["integrationStatus"] != "SUCCESS" &&
|
||||
receiptController.model.receiptData?["paymentStatus"] == "SUCCESS")
|
||||
Skeletonizer(
|
||||
enabled:
|
||||
receiptController
|
||||
.model
|
||||
.isLoading,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment
|
||||
.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Additional action",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight:
|
||||
FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text("Billing account update failed, please tap on retry to try again",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.primary,
|
||||
),
|
||||
textAlign: TextAlign.end,
|
||||
softWrap: true,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10,),
|
||||
|
||||
Skeletonizer(
|
||||
enabled:
|
||||
receiptController
|
||||
|
||||
Reference in New Issue
Block a user