minor fixes on status responses

This commit is contained in:
Prince
2026-06-17 21:35:15 +02:00
parent 64eaa38079
commit f3ae5ca791
3 changed files with 8 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ class GatewayController extends ChangeNotifier {
dynamic response = workflowResponse['body']; dynamic response = workflowResponse['body'];
model.status = response['status']; model.status = response['pollingStatus'];
transactionController.model.paymentStatus = response['paymentStatus']; transactionController.model.paymentStatus = response['paymentStatus'];
finishLoading(); finishLoading();
@@ -83,7 +83,7 @@ class GatewayController extends ChangeNotifier {
} }
Future<ApiResponse<Map<String, dynamic>>> pollTransaction(String uid) async { Future<ApiResponse<Map<String, dynamic>>> pollTransaction(String uid) async {
// poll up to 30 times (~5 minutes at 10-second intervals) // poll up to 15 times (~45 seconds at 3-second intervals)
int maxAttempts = 15; int maxAttempts = 15;
int attempt = 0; int attempt = 0;
@@ -100,12 +100,12 @@ class GatewayController extends ChangeNotifier {
return result; return result;
} }
await Future.delayed(const Duration(seconds: 10)); await Future.delayed(const Duration(seconds: 3));
if (model.isCancelled) break; if (model.isCancelled) break;
// Otherwise (e.g. PENDING), continue polling // Otherwise (e.g. PENDING), continue polling
} else { } else {
await Future.delayed(const Duration(seconds: 10)); await Future.delayed(const Duration(seconds: 3));
if (model.isCancelled) break; if (model.isCancelled) break;
// Network error — show failure UI and stop // Network error — show failure UI and stop

View File

@@ -141,9 +141,7 @@ class BatchController extends ChangeNotifier {
if (!_disposed) notifyListeners(); if (!_disposed) notifyListeners();
try { try {
final raw = await http.get( final raw = await http.get('/public/providers/$providerId/products');
'/public/providers/$providerId/products',
);
final response = _unwrap(raw); final response = _unwrap(raw);
final List<dynamic> list = response is List final List<dynamic> list = response is List
? response ? response
@@ -562,7 +560,7 @@ class BatchController extends ChangeNotifier {
); );
model.isActing = false; model.isActing = false;
if (!_disposed) notifyListeners(); if (!_disposed) notifyListeners();
if (response['status'] != 'FAILED') { if (batchTransaction.pollingStatus == 'SUCCESS') {
return ApiResponse.success(batchTransaction); return ApiResponse.success(batchTransaction);
} else { } else {
return ApiResponse.failure( return ApiResponse.failure(

View File

@@ -245,7 +245,7 @@ class _BatchCreateScreenState extends State<BatchCreateScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
flex: 2, flex: 1,
child: TextFormField( child: TextFormField(
controller: _amountController, controller: _amountController,
readOnly: providerController readOnly: providerController
@@ -279,6 +279,7 @@ class _BatchCreateScreenState extends State<BatchCreateScreen> {
), ),
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
flex: 1,
child: TextFormField( child: TextFormField(
controller: _debitPhoneController, controller: _debitPhoneController,
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,