BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:customer/constant/constant.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class MercadoPagoScreen extends StatefulWidget {
|
||||
@@ -36,10 +36,17 @@ class _MercadoPagoScreenState extends State<MercadoPagoScreen> {
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest navigation) async {
|
||||
debugPrint("--->2 ${navigation.url}");
|
||||
if (navigation.url.contains("${Constant.globalUrl}payment/success")) {
|
||||
if (navigation.url.contains(
|
||||
"${Constant.globalUrl}payment/success",
|
||||
)) {
|
||||
Get.back(result: true);
|
||||
}
|
||||
if (navigation.url.contains("${Constant.globalUrl}payment/failure") || navigation.url.contains("${Constant.globalUrl}payment/pending")) {
|
||||
if (navigation.url.contains(
|
||||
"${Constant.globalUrl}payment/failure",
|
||||
) ||
|
||||
navigation.url.contains(
|
||||
"${Constant.globalUrl}payment/pending",
|
||||
)) {
|
||||
Get.back(result: false);
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
@@ -82,14 +89,20 @@ class _MercadoPagoScreenState extends State<MercadoPagoScreen> {
|
||||
content: SingleChildScrollView(child: Text("Cancel Payment?".tr())),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Cancel'.tr(), style: const TextStyle(color: Colors.red)),
|
||||
child: Text(
|
||||
'Cancel'.tr(),
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Get.back(result: false);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Continue'.tr(), style: const TextStyle(color: Colors.green)),
|
||||
child: Text(
|
||||
'Continue'.tr(),
|
||||
style: const TextStyle(color: Colors.green),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
||||
@@ -6,14 +6,18 @@ import 'package:customer/models/payment_model/pay_fast_model.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class PayFastScreen extends StatefulWidget {
|
||||
final String htmlData;
|
||||
final PayFastModel payFastSettingData;
|
||||
|
||||
const PayFastScreen({super.key, required this.htmlData, required this.payFastSettingData});
|
||||
const PayFastScreen({
|
||||
super.key,
|
||||
required this.htmlData,
|
||||
required this.payFastSettingData,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PayFastScreen> createState() => _PayFastScreenState();
|
||||
@@ -45,9 +49,11 @@ class _PayFastScreenState extends State<PayFastScreen> {
|
||||
}
|
||||
if (navigation.url == widget.payFastSettingData.returnUrl) {
|
||||
Get.back(result: true);
|
||||
} else if (navigation.url == widget.payFastSettingData.notifyUrl) {
|
||||
} else if (navigation.url ==
|
||||
widget.payFastSettingData.notifyUrl) {
|
||||
Get.back(result: false);
|
||||
} else if (navigation.url == widget.payFastSettingData.cancelUrl) {
|
||||
} else if (navigation.url ==
|
||||
widget.payFastSettingData.cancelUrl) {
|
||||
_showMyDialog();
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
@@ -95,7 +101,10 @@ class _PayFastScreenState extends State<PayFastScreen> {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Continue Payment'.tr(), style: TextStyle(color: Colors.green)),
|
||||
child: Text(
|
||||
'Continue Payment'.tr(),
|
||||
style: TextStyle(color: Colors.green),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class MidtransScreen extends StatefulWidget {
|
||||
@@ -48,7 +48,10 @@ class _MidtransScreenState extends State<MidtransScreen> {
|
||||
Get.back(result: false);
|
||||
}
|
||||
} else {
|
||||
String? orderId = Uri.parse(navigation.url).queryParameters['merchant_order_id'];
|
||||
String? orderId =
|
||||
Uri.parse(
|
||||
navigation.url,
|
||||
).queryParameters['merchant_order_id'];
|
||||
if (orderId != null) {
|
||||
Get.back(result: true);
|
||||
} else {
|
||||
@@ -81,7 +84,16 @@ class _MidtransScreenState extends State<MidtransScreen> {
|
||||
child: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
),
|
||||
body: Stack(alignment: Alignment.center, children: [WebViewWidget(controller: controller), Visibility(visible: isLoading, child: const Center(child: CircularProgressIndicator()))]),
|
||||
body: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
WebViewWidget(controller: controller),
|
||||
Visibility(
|
||||
visible: isLoading,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -96,14 +108,20 @@ class _MidtransScreenState extends State<MidtransScreen> {
|
||||
content: SingleChildScrollView(child: Text("Cancel Payment?".tr())),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Cancel'.tr(), style: const TextStyle(color: Colors.red)),
|
||||
child: Text(
|
||||
'Cancel'.tr(),
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back(result: false);
|
||||
Get.back(result: false);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Continue'.tr(), style: const TextStyle(color: Colors.green)),
|
||||
child: Text(
|
||||
'Continue'.tr(),
|
||||
style: const TextStyle(color: Colors.green),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back(result: false);
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'dart:convert';
|
||||
import 'package:customer/models/payment_model/orange_money.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
@@ -17,7 +17,15 @@ class OrangeMoneyScreen extends StatefulWidget {
|
||||
String orderId = '';
|
||||
String amount = '';
|
||||
|
||||
OrangeMoneyScreen({super.key, required this.initialURl, required this.orangePay, required this.accessToken, required this.payToken, required this.orderId, required this.amount});
|
||||
OrangeMoneyScreen({
|
||||
super.key,
|
||||
required this.initialURl,
|
||||
required this.orangePay,
|
||||
required this.accessToken,
|
||||
required this.payToken,
|
||||
required this.orderId,
|
||||
required this.amount,
|
||||
});
|
||||
|
||||
@override
|
||||
State<OrangeMoneyScreen> createState() => _OrangeMoneyScreenState();
|
||||
@@ -41,7 +49,12 @@ class _OrangeMoneyScreenState extends State<OrangeMoneyScreen> {
|
||||
timer = Timer.periodic(const Duration(seconds: 3), (Timer t) async {
|
||||
if (!mounted) return;
|
||||
|
||||
String status = await transactionStatus(accessToken: widget.accessToken, amount: widget.amount, orderId: widget.orderId, payToken: widget.payToken);
|
||||
String status = await transactionStatus(
|
||||
accessToken: widget.accessToken,
|
||||
amount: widget.amount,
|
||||
orderId: widget.orderId,
|
||||
payToken: widget.payToken,
|
||||
);
|
||||
|
||||
if (status == 'SUCCESS') {
|
||||
timer?.cancel();
|
||||
@@ -72,15 +85,31 @@ class _OrangeMoneyScreenState extends State<OrangeMoneyScreen> {
|
||||
..loadRequest(Uri.parse(widget.initialURl));
|
||||
}
|
||||
|
||||
Future<String> transactionStatus({required String orderId, required String amount, required String payToken, required String accessToken}) async {
|
||||
String apiUrl = widget.orangePay.isSandbox == true ? 'https://api.orange.com/orange-money-webpay/dev/v1/transactionstatus' : 'https://api.orange.com/orange-money-webpay/cm/v1/transactionstatus';
|
||||
Future<String> transactionStatus({
|
||||
required String orderId,
|
||||
required String amount,
|
||||
required String payToken,
|
||||
required String accessToken,
|
||||
}) async {
|
||||
String apiUrl =
|
||||
widget.orangePay.isSandbox == true
|
||||
? 'https://api.orange.com/orange-money-webpay/dev/v1/transactionstatus'
|
||||
: 'https://api.orange.com/orange-money-webpay/cm/v1/transactionstatus';
|
||||
|
||||
Map<String, String> requestBody = {"order_id": orderId, "amount": amount, "pay_token": payToken};
|
||||
Map<String, String> requestBody = {
|
||||
"order_id": orderId,
|
||||
"amount": amount,
|
||||
"pay_token": payToken,
|
||||
};
|
||||
|
||||
try {
|
||||
var response = await http.post(
|
||||
Uri.parse(apiUrl),
|
||||
headers: {'Authorization': 'Bearer $accessToken', 'Content-Type': 'application/json', 'Accept': 'application/json'},
|
||||
headers: {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: json.encode(requestBody),
|
||||
);
|
||||
|
||||
@@ -107,10 +136,16 @@ class _OrangeMoneyScreenState extends State<OrangeMoneyScreen> {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(icon: const Icon(Icons.arrow_back, color: Colors.white), onPressed: _showCancelDialog),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: _showCancelDialog,
|
||||
),
|
||||
title: Text('Orange Money Payment'.tr()),
|
||||
),
|
||||
body: isLoading ? const Center(child: CircularProgressIndicator()) : WebViewWidget(controller: controller),
|
||||
body:
|
||||
isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: WebViewWidget(controller: controller),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -124,9 +159,12 @@ class _OrangeMoneyScreenState extends State<OrangeMoneyScreen> {
|
||||
title: Text('Cancel Payment'.tr()),
|
||||
content: Text('Are you sure you want to cancel this payment?'.tr()),
|
||||
actions: [
|
||||
TextButton(child: Text('No', style: TextStyle(color: Colors.green)), onPressed: () => Get.back()),
|
||||
TextButton(
|
||||
child: Text('Yes'.tr(), style: TextStyle(color: Colors.red)),
|
||||
child: Text('No', style: TextStyle(color: Colors.green)),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Yes'.tr(), style: TextStyle(color: Colors.red)),
|
||||
onPressed: () {
|
||||
timer?.cancel();
|
||||
Get.back(); // close dialog
|
||||
@@ -152,8 +190,7 @@ class _OrangeMoneyScreenState extends State<OrangeMoneyScreen> {
|
||||
// import 'dart:convert';
|
||||
// import 'package:customer/models/payment_model/orange_money.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:http/http.dart' as http;
|
||||
// import 'package:get/get.dart' hide Trans;// import 'package:http/http.dart' as http;
|
||||
// import 'package:webview_flutter/webview_flutter.dart';
|
||||
//
|
||||
// class OrangeMoneyScreen extends StatefulWidget {
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:customer/payment/paystack/paystack_url_genrater.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class PayStackScreen extends StatefulWidget {
|
||||
@@ -14,7 +14,14 @@ class PayStackScreen extends StatefulWidget {
|
||||
final String secretKey;
|
||||
final String callBackUrl;
|
||||
|
||||
const PayStackScreen({super.key, required this.initialURl, required this.reference, required this.amount, required this.secretKey, required this.callBackUrl});
|
||||
const PayStackScreen({
|
||||
super.key,
|
||||
required this.initialURl,
|
||||
required this.reference,
|
||||
required this.amount,
|
||||
required this.secretKey,
|
||||
required this.callBackUrl,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PayStackScreen> createState() => _PayStackScreenState();
|
||||
@@ -30,37 +37,52 @@ class _PayStackScreenState extends State<PayStackScreen> {
|
||||
}
|
||||
|
||||
void initController() {
|
||||
controller = WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor(const Color(0x00000000))
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {
|
||||
// Update loading bar.
|
||||
},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {},
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest navigation) async {
|
||||
debugPrint("--->2${navigation.url}");
|
||||
debugPrint("--->2" "${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}");
|
||||
if (navigation.url == 'https://foodieweb.siswebapp.com/success?trxref=${widget.reference}&reference=${widget.reference}' ||
|
||||
navigation.url == '${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}') {
|
||||
final isDone = await PayStackURLGen.verifyTransaction(secretKey: widget.secretKey, reference: widget.reference, amount: widget.amount);
|
||||
Get.back(result: isDone);
|
||||
}
|
||||
if ((navigation.url == '${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}') ||
|
||||
(navigation.url == "https://hello.pstk.xyz/callback") ||
|
||||
(navigation.url == 'https://standard.paystack.co/close') ||
|
||||
(navigation.url == 'https://talazo.app/login')) {
|
||||
final isDone = await PayStackURLGen.verifyTransaction(secretKey: widget.secretKey, reference: widget.reference, amount: widget.amount);
|
||||
Get.back(result: isDone);
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(widget.initialURl));
|
||||
controller =
|
||||
WebViewController()
|
||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
||||
..setBackgroundColor(const Color(0x00000000))
|
||||
..setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {
|
||||
// Update loading bar.
|
||||
},
|
||||
onPageStarted: (String url) {},
|
||||
onPageFinished: (String url) {},
|
||||
onWebResourceError: (WebResourceError error) {},
|
||||
onNavigationRequest: (NavigationRequest navigation) async {
|
||||
debugPrint("--->2${navigation.url}");
|
||||
debugPrint(
|
||||
"--->2"
|
||||
"${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}",
|
||||
);
|
||||
if (navigation.url ==
|
||||
'https://foodieweb.siswebapp.com/success?trxref=${widget.reference}&reference=${widget.reference}' ||
|
||||
navigation.url ==
|
||||
'${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}') {
|
||||
final isDone = await PayStackURLGen.verifyTransaction(
|
||||
secretKey: widget.secretKey,
|
||||
reference: widget.reference,
|
||||
amount: widget.amount,
|
||||
);
|
||||
Get.back(result: isDone);
|
||||
}
|
||||
if ((navigation.url ==
|
||||
'${widget.callBackUrl}?trxref=${widget.reference}&reference=${widget.reference}') ||
|
||||
(navigation.url == "https://hello.pstk.xyz/callback") ||
|
||||
(navigation.url == 'https://standard.paystack.co/close') ||
|
||||
(navigation.url == 'https://talazo.app/login')) {
|
||||
final isDone = await PayStackURLGen.verifyTransaction(
|
||||
secretKey: widget.secretKey,
|
||||
reference: widget.reference,
|
||||
amount: widget.amount,
|
||||
);
|
||||
Get.back(result: isDone);
|
||||
}
|
||||
return NavigationDecision.navigate;
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(widget.initialURl));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -72,17 +94,16 @@ class _PayStackScreenState extends State<PayStackScreen> {
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppThemeData.grey50,
|
||||
title: Text("Payment".tr()),
|
||||
centerTitle: false,
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
_showMyDialog();
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.arrow_back,
|
||||
),
|
||||
)),
|
||||
backgroundColor: AppThemeData.grey50,
|
||||
title: Text("Payment".tr()),
|
||||
centerTitle: false,
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
_showMyDialog();
|
||||
},
|
||||
child: const Icon(Icons.arrow_back),
|
||||
),
|
||||
),
|
||||
body: WebViewWidget(controller: controller),
|
||||
),
|
||||
);
|
||||
@@ -95,15 +116,10 @@ class _PayStackScreenState extends State<PayStackScreen> {
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Cancel Payment'),
|
||||
content: const SingleChildScrollView(
|
||||
child: Text("cancelPayment?"),
|
||||
),
|
||||
content: const SingleChildScrollView(child: Text("cancelPayment?")),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Cancel',
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
child: const Text('Cancel', style: TextStyle(color: Colors.red)),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop(false);
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'dart:developer';
|
||||
import 'package:customer/payment/xenditModel.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
@@ -14,7 +14,12 @@ class XenditScreen extends StatefulWidget {
|
||||
final String transId;
|
||||
final String apiKey;
|
||||
|
||||
const XenditScreen({super.key, required this.initialURl, required this.transId, required this.apiKey});
|
||||
const XenditScreen({
|
||||
super.key,
|
||||
required this.initialURl,
|
||||
required this.transId,
|
||||
required this.apiKey,
|
||||
});
|
||||
|
||||
@override
|
||||
State<XenditScreen> createState() => _XenditScreenState();
|
||||
@@ -102,7 +107,16 @@ class _XenditScreenState extends State<XenditScreen> {
|
||||
child: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
),
|
||||
body: Stack(alignment: Alignment.center, children: [WebViewWidget(controller: controller), Visibility(visible: isLoading, child: const Center(child: CircularProgressIndicator()))]),
|
||||
body: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
WebViewWidget(controller: controller),
|
||||
Visibility(
|
||||
visible: isLoading,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -117,14 +131,20 @@ class _XenditScreenState extends State<XenditScreen> {
|
||||
content: SingleChildScrollView(child: Text("Cancel Payment?".tr())),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Cancel'.tr(), style: const TextStyle(color: Colors.red)),
|
||||
child: Text(
|
||||
'Cancel'.tr(),
|
||||
style: const TextStyle(color: Colors.red),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('Continue'.tr(), style: const TextStyle(color: Colors.green)),
|
||||
child: Text(
|
||||
'Continue'.tr(),
|
||||
style: const TextStyle(color: Colors.green),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
@@ -140,7 +160,10 @@ class _XenditScreenState extends State<XenditScreen> {
|
||||
var url = Uri.parse('https://api.xendit.co/v2/invoices/$paymentId');
|
||||
|
||||
// Headers
|
||||
var headers = {'Content-Type': 'application/json', 'Authorization': generateBasicAuthHeader(widget.apiKey.toString())};
|
||||
var headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': generateBasicAuthHeader(widget.apiKey.toString()),
|
||||
};
|
||||
|
||||
// Making the POST request
|
||||
var response = await http.get(url, headers: headers);
|
||||
|
||||
Reference in New Issue
Block a user