4/17/1
This commit is contained in:
@@ -517,6 +517,14 @@ class MyTranslation extends Translations {
|
|||||||
'اربح 300 جنيه ! كل 300 نقطة تمنحك 300 جنيه. اذهب واستفد من نقاطك!',
|
'اربح 300 جنيه ! كل 300 نقطة تمنحك 300 جنيه. اذهب واستفد من نقاطك!',
|
||||||
'the 300 points equal 300 L.E':
|
'the 300 points equal 300 L.E':
|
||||||
'الـ 300 نقطة تساوي 30 جنيه بالنسبة لك ',
|
'الـ 300 نقطة تساوي 30 جنيه بالنسبة لك ',
|
||||||
|
'The payment was not approved. Please try again.':
|
||||||
|
'لم يتم الموافقة على الدفع. الرجاء المحاولة مرة أخرى.',
|
||||||
|
'Payment Failed': 'فشل الدفع',
|
||||||
|
'Error': 'خطأ',
|
||||||
|
'An error occurred during the payment process.':
|
||||||
|
'حدث خطأ أثناء عملية الدفع.',
|
||||||
|
'The payment was approved.': 'تمت الموافقة على الدفع.',
|
||||||
|
'Payment Successful': 'نجح الدفع',
|
||||||
'No ride found yet': 'لا يوجد طلبات متوفرة حاليا',
|
'No ride found yet': 'لا يوجد طلبات متوفرة حاليا',
|
||||||
'Accept Order': "اقبل الطلب",
|
'Accept Order': "اقبل الطلب",
|
||||||
'reject your order.': "رفض طلبك.",
|
'reject your order.': "رفض طلبك.",
|
||||||
@@ -609,7 +617,7 @@ class MyTranslation extends Translations {
|
|||||||
'insert amount': "إدراج المبلغ",
|
'insert amount': "إدراج المبلغ",
|
||||||
'You can buy Points to let you online\nby this list below':
|
'You can buy Points to let you online\nby this list below':
|
||||||
"يمكنك شراء النقاط للبقاء على وضع الاتصال\nمن خلال القائمة أدناه",
|
"يمكنك شراء النقاط للبقاء على وضع الاتصال\nمن خلال القائمة أدناه",
|
||||||
'Create Wallet to recive your money': "إنشاء محفظة لاستلام أموالك",
|
'Create Wallet to receive your money': "إنشاء محفظة لاستلام أموالك",
|
||||||
'Enter your feedback here': "أدخل تعليقاتك هنا",
|
'Enter your feedback here': "أدخل تعليقاتك هنا",
|
||||||
'Please enter your feedback.': "الرجاء إدخال تعليقاتك.",
|
'Please enter your feedback.': "الرجاء إدخال تعليقاتك.",
|
||||||
'Feedback': "تعليق",
|
'Feedback': "تعليق",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class PassengerWalletHistoryController extends GetxController {
|
|||||||
print(archive);
|
print(archive);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
update();
|
update();
|
||||||
} else {}
|
} else {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
title: 'No wallet record found'.tr,
|
title: 'No wallet record found'.tr,
|
||||||
@@ -36,6 +36,7 @@ class PassengerWalletHistoryController extends GetxController {
|
|||||||
Get.back();
|
Get.back();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:SEFER/constant/api_key.dart';
|
import 'package:SEFER/constant/api_key.dart';
|
||||||
|
import 'package:SEFER/constant/style.dart';
|
||||||
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_paypal/flutter_paypal.dart';
|
import 'package:flutter_paypal/flutter_paypal.dart';
|
||||||
@@ -260,7 +262,9 @@ class PaymentController extends GetxController {
|
|||||||
"amount": {
|
"amount": {
|
||||||
//sb-opsju26682403@personal.example.com
|
//sb-opsju26682403@personal.example.com
|
||||||
"total": '$selectedAmount',
|
"total": '$selectedAmount',
|
||||||
"currency": "USD",
|
"currency": box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 'EGP'
|
||||||
|
: "JOD",
|
||||||
"details": {
|
"details": {
|
||||||
"subtotal": '$selectedAmount',
|
"subtotal": '$selectedAmount',
|
||||||
"shipping": '0',
|
"shipping": '0',
|
||||||
@@ -459,12 +463,20 @@ class PaymentController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> payWithPayMob(
|
Future<void> payWithPayMob(
|
||||||
BuildContext context, String amount, currency) async {
|
BuildContext context, String amount, currency, Function method) async {
|
||||||
|
String newAmount = (double.parse(amount) * 100).toStringAsFixed(2);
|
||||||
try {
|
try {
|
||||||
|
bool isAvailable = await LocalAuthentication().isDeviceSupported();
|
||||||
|
if (isAvailable) {
|
||||||
|
// Authenticate the user
|
||||||
|
bool didAuthenticate = await LocalAuthentication().authenticate(
|
||||||
|
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||||
|
);
|
||||||
|
if (didAuthenticate) {
|
||||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||||
context: context,
|
context: context,
|
||||||
currency: currency, //"EGP",
|
currency: currency, //"EGP",
|
||||||
amountInCents: amount, // 19.00 EGP
|
amountInCents: newAmount, // 19.00 EGP
|
||||||
onPayment: (PaymobResponse response) {
|
onPayment: (PaymobResponse response) {
|
||||||
print('Success: ${response.success}');
|
print('Success: ${response.success}');
|
||||||
print('Transaction ID: ${response.transactionID}');
|
print('Transaction ID: ${response.transactionID}');
|
||||||
@@ -475,20 +487,101 @@ class PaymentController extends GetxController {
|
|||||||
|
|
||||||
if (response!.responseCode == 'APPROVED') {
|
if (response!.responseCode == 'APPROVED') {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'Payment Successful',
|
barrierDismissible: false,
|
||||||
content: const Text('The payment was approved.'),
|
title: 'Payment Successful'.tr,
|
||||||
|
titleStyle: AppStyle.title,
|
||||||
|
content: Text(
|
||||||
|
'The payment was approved.'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
Get.back();
|
||||||
|
method();
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'Payment Failed',
|
barrierDismissible: false,
|
||||||
content:
|
// backgroundColor: AppColor.redColor,
|
||||||
const Text('The payment was not approved. Please try again.'),
|
title: 'Payment Failed'.tr,
|
||||||
|
content: Text(
|
||||||
|
'The payment was not approved. Please try again.'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
kolor: AppColor.redColor,
|
||||||
|
onPressed: () async {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Authentication failed, handle accordingly
|
||||||
|
print('Authentication failed');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||||
|
context: context,
|
||||||
|
currency: currency, //"EGP",
|
||||||
|
amountInCents: newAmount, // 19.00 EGP
|
||||||
|
onPayment: (PaymobResponse response) {
|
||||||
|
// print('Success: ${response.success}');
|
||||||
|
// print('Transaction ID: ${response.transactionID}');
|
||||||
|
// print('Response Code: ${response.responseCode}');
|
||||||
|
// print('Message: ${response.message}');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response!.responseCode == 'APPROVED') {
|
||||||
|
Get.defaultDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
title: 'Payment Successful'.tr,
|
||||||
|
titleStyle: AppStyle.title,
|
||||||
|
content: Text(
|
||||||
|
'The payment was approved.'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
onPressed: () async {
|
||||||
|
Get.back();
|
||||||
|
method();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Get.defaultDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
// backgroundColor: AppColor.redColor,
|
||||||
|
title: 'Payment Failed'.tr,
|
||||||
|
content: Text(
|
||||||
|
'The payment was not approved. Please try again.'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
kolor: AppColor.redColor,
|
||||||
|
onPressed: () async {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'Error',
|
title: 'Error'.tr,
|
||||||
content: const Text('An error occurred during the payment process.'),
|
content: Text(
|
||||||
|
'An error occurred during the payment process.'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
|||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// await PaymobManager().payWithPayMob(100, 'EGP');
|
// await PaymobManager().payWithPayMob(100, 'EGP');
|
||||||
await Get.find<PaymentController>()
|
// await Get.find<PaymentController>()
|
||||||
.payWithPayMob(context, '11', 'EGP');
|
// .payWithPayMob(context, '1100', 'EGP');
|
||||||
// Initiates a payment with a card using the FlutterPaymob instance
|
// Initiates a payment with a card using the FlutterPaymob instance
|
||||||
|
|
||||||
// NotificationController()
|
// NotificationController()
|
||||||
@@ -150,8 +150,8 @@ class PaymobPackage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Get.find<PaymentController>()
|
// await Get.find<PaymentController>()
|
||||||
.payWithPayMob(context, '11', 'EGP');
|
// .payWithPayMob(context, '11', 'EGP');
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 50,
|
width: 50,
|
||||||
|
|||||||
@@ -53,14 +53,18 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(
|
Radio(
|
||||||
value: 10,
|
value: box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 100
|
||||||
|
: 10,
|
||||||
groupValue: controller.selectedAmount,
|
groupValue: controller.selectedAmount,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller.updateSelectedAmount(value as int);
|
controller.updateSelectedAmount(value as int);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'10\$ and get 3% discount'.tr,
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? '100 ${'LE'.tr}'.tr
|
||||||
|
: '10\$ and get 3% discount',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -73,7 +77,10 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(
|
Radio(
|
||||||
value: 20,
|
value:
|
||||||
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 200
|
||||||
|
: 20,
|
||||||
groupValue: controller.selectedAmount,
|
groupValue: controller.selectedAmount,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller
|
controller
|
||||||
@@ -81,7 +88,9 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'20\$ and get 4% discount'.tr,
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? '200 ${'LE'.tr} '.tr
|
||||||
|
: '20 ${'JOD'.tr}'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -93,7 +102,10 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(
|
Radio(
|
||||||
value: 40,
|
value:
|
||||||
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 400
|
||||||
|
: 40,
|
||||||
groupValue: controller.selectedAmount,
|
groupValue: controller.selectedAmount,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller
|
controller
|
||||||
@@ -101,7 +113,9 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'40\$ and get 6% discount'.tr,
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? '400 ${'LE'.tr} '.tr
|
||||||
|
: '40 ${'JOD'.tr}'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -113,7 +127,10 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Radio(
|
Radio(
|
||||||
value: 100,
|
value:
|
||||||
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 1000
|
||||||
|
: 50,
|
||||||
groupValue: controller.selectedAmount,
|
groupValue: controller.selectedAmount,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
controller
|
controller
|
||||||
@@ -121,7 +138,9 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'100\$ and get 9% discount'.tr,
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? '1000 ${'LE'.tr} '.tr
|
||||||
|
: '50 ${'JOD'.tr}'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -141,14 +160,37 @@ class PassengerWalletDialoge extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
MyElevatedButton(
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? MyElevatedButton(
|
||||||
|
title: 'Pay with Credit Card'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
if (controller.selectedAmount != 0) {
|
||||||
|
controller.payWithPayMob(
|
||||||
|
context,
|
||||||
|
controller.selectedAmount
|
||||||
|
.toString(), // Convert int to double
|
||||||
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? 'EGP'
|
||||||
|
: 'JOD', () async {
|
||||||
|
await controller.addPassengerWallet();
|
||||||
|
controller.changePromoSheetDialogue();
|
||||||
|
await controller.getPassengerWallet();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Toast.show(
|
||||||
|
context,
|
||||||
|
'You will choose one of above !'.tr,
|
||||||
|
AppColor.redColor);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: MyElevatedButton(
|
||||||
title: 'Pay with Credit Card'.tr,
|
title: 'Pay with Credit Card'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (controller.selectedAmount != 0) {
|
if (controller.selectedAmount != 0) {
|
||||||
controller.makePaymentStripe(
|
controller.makePaymentStripe(
|
||||||
controller.selectedAmount!
|
controller.selectedAmount!
|
||||||
.toDouble(), // Convert int to double
|
.toDouble(), // Convert int to double
|
||||||
box.read(BoxName.countryCode) != 'Egypt'.tr
|
box.read(BoxName.countryCode) != 'Egypt'
|
||||||
? 'EGP'
|
? 'EGP'
|
||||||
: 'USD', () {
|
: 'USD', () {
|
||||||
controller.addPassengerWallet();
|
controller.addPassengerWallet();
|
||||||
|
|||||||
@@ -27,11 +27,25 @@ class PointsCaptain extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await paymentController.makePaymentStripe(pricePoint,
|
box.read(BoxName.countryCode) == 'Egypt'
|
||||||
|
? await paymentController.payWithPayMob(
|
||||||
|
context,
|
||||||
|
pricePoint.toStringAsFixed(2),
|
||||||
|
box.read(BoxName.countryCode) == 'Egypt' ? 'EGP' : 'JOD',
|
||||||
|
() async {
|
||||||
|
await captainWalletController.addDriverPayment(
|
||||||
|
'visa', pricePoint);
|
||||||
|
await captainWalletController.addDriverWallet(
|
||||||
|
'visa', countPoint);
|
||||||
|
await captainWalletController.getCaptainWalletFromBuyPoints();
|
||||||
|
})
|
||||||
|
: await paymentController.makePaymentStripe(pricePoint,
|
||||||
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
|
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
|
||||||
() async {
|
() async {
|
||||||
await captainWalletController.addDriverPayment('visa', pricePoint);
|
await captainWalletController.addDriverPayment(
|
||||||
await captainWalletController.addDriverWallet('visa', countPoint);
|
'visa', pricePoint);
|
||||||
|
await captainWalletController.addDriverWallet(
|
||||||
|
'visa', countPoint);
|
||||||
await captainWalletController.getCaptainWalletFromBuyPoints();
|
await captainWalletController.getCaptainWalletFromBuyPoints();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
MyElevatedButton(
|
MyElevatedButton(
|
||||||
title:
|
title:
|
||||||
'Create Wallet to recive your money',
|
'Create Wallet to receive your money',
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
PaymentController paymentController =
|
PaymentController paymentController =
|
||||||
Get.find<PaymentController>();
|
Get.find<PaymentController>();
|
||||||
|
|||||||
Reference in New Issue
Block a user