updating sequence of flows

This commit is contained in:
2025-11-02 19:49:25 +02:00
parent 087a9aa4bc
commit 895925d32f
9 changed files with 149 additions and 179 deletions

View File

@@ -7,8 +7,7 @@ import 'package:qpay/screens/gateway/gateway_controller.dart';
import 'package:webview_flutter/webview_flutter.dart';
class GatewayScreen extends StatefulWidget {
final String url;
const GatewayScreen({super.key, required this.url});
const GatewayScreen({super.key});
@override
State<GatewayScreen> createState() => _GatewayScreenState();
@@ -17,20 +16,22 @@ class GatewayScreen extends StatefulWidget {
class _GatewayScreenState extends State<GatewayScreen> {
late WebViewController _webViewController;
late GatewayController controller;
late String url;
bool integrationStarted = false;
@override
void initState() {
super.initState();
_initWebView(widget.url);
controller = GatewayController(context);
url = controller.transactionController.model.receiptData?['targetUrl'];
_initWebView(url);
bool simulate = bool.parse(dotenv.env['SIMULATE_PAYMENT_SUCCESS']!);
if(simulate) {
sleep(Duration(seconds: 10));
String url = widget.url.replaceAll("/pay/", "/receipt/");
_webViewController.loadRequest(Uri.parse(url));
String targetUrl = url.replaceAll("/pay/", "/receipt/");
_webViewController.loadRequest(Uri.parse(targetUrl));
}
}
@@ -71,7 +72,6 @@ class _GatewayScreenState extends State<GatewayScreen> {
setState(() {
integrationStarted = true;
});
await controller.poll(controller.transactionController.model.receiptData?['id']);
WidgetsBinding.instance.addPostFrameCallback((_) {
context.go('/integration');