This commit is contained in:
Hamza Aleghwairyeen
2024-04-17 00:54:01 +03:00
parent 24b3804045
commit d450ad0f93
7 changed files with 236 additions and 78 deletions

View File

@@ -114,8 +114,8 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
child: IconButton(
onPressed: () async {
// await PaymobManager().payWithPayMob(100, 'EGP');
await Get.find<PaymentController>()
.payWithPayMob(context, '11', 'EGP');
// await Get.find<PaymentController>()
// .payWithPayMob(context, '1100', 'EGP');
// Initiates a payment with a card using the FlutterPaymob instance
// NotificationController()
@@ -150,8 +150,8 @@ class PaymobPackage extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
await Get.find<PaymentController>()
.payWithPayMob(context, '11', 'EGP');
// await Get.find<PaymentController>()
// .payWithPayMob(context, '11', 'EGP');
},
child: Container(
width: 50,

View File

@@ -53,14 +53,18 @@ class PassengerWalletDialoge extends StatelessWidget {
child: Row(
children: [
Radio(
value: 10,
value: box.read(BoxName.countryCode) == 'Egypt'
? 100
: 10,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller.updateSelectedAmount(value as int);
},
),
Text(
'10\$ and get 3% discount'.tr,
box.read(BoxName.countryCode) == 'Egypt'
? '100 ${'LE'.tr}'.tr
: '10\$ and get 3% discount',
style: AppStyle.title,
),
],
@@ -73,7 +77,10 @@ class PassengerWalletDialoge extends StatelessWidget {
child: Row(
children: [
Radio(
value: 20,
value:
box.read(BoxName.countryCode) == 'Egypt'
? 200
: 20,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
@@ -81,7 +88,9 @@ class PassengerWalletDialoge extends StatelessWidget {
},
),
Text(
'20\$ and get 4% discount'.tr,
box.read(BoxName.countryCode) == 'Egypt'
? '200 ${'LE'.tr} '.tr
: '20 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
@@ -93,7 +102,10 @@ class PassengerWalletDialoge extends StatelessWidget {
child: Row(
children: [
Radio(
value: 40,
value:
box.read(BoxName.countryCode) == 'Egypt'
? 400
: 40,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
@@ -101,7 +113,9 @@ class PassengerWalletDialoge extends StatelessWidget {
},
),
Text(
'40\$ and get 6% discount'.tr,
box.read(BoxName.countryCode) == 'Egypt'
? '400 ${'LE'.tr} '.tr
: '40 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
@@ -113,7 +127,10 @@ class PassengerWalletDialoge extends StatelessWidget {
child: Row(
children: [
Radio(
value: 100,
value:
box.read(BoxName.countryCode) == 'Egypt'
? 1000
: 50,
groupValue: controller.selectedAmount,
onChanged: (value) {
controller
@@ -121,7 +138,9 @@ class PassengerWalletDialoge extends StatelessWidget {
},
),
Text(
'100\$ and get 9% discount'.tr,
box.read(BoxName.countryCode) == 'Egypt'
? '1000 ${'LE'.tr} '.tr
: '50 ${'JOD'.tr}'.tr,
style: AppStyle.title,
),
],
@@ -141,27 +160,50 @@ class PassengerWalletDialoge extends StatelessWidget {
}
},
),
MyElevatedButton(
title: 'Pay with Credit Card'.tr,
onPressed: () {
if (controller.selectedAmount != 0) {
controller.makePaymentStripe(
controller.selectedAmount!
.toDouble(), // Convert int to double
box.read(BoxName.countryCode) != 'Egypt'.tr
? 'EGP'
: 'USD', () {
controller.addPassengerWallet();
controller.changePromoSheetDialogue();
controller.getPassengerWallet();
});
} else {
Toast.show(
context,
'You will choose one of above !'.tr,
AppColor.redColor);
}
}),
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,
onPressed: () {
if (controller.selectedAmount != 0) {
controller.makePaymentStripe(
controller.selectedAmount!
.toDouble(), // Convert int to double
box.read(BoxName.countryCode) != 'Egypt'
? 'EGP'
: 'USD', () {
controller.addPassengerWallet();
controller.changePromoSheetDialogue();
controller.getPassengerWallet();
});
} else {
Toast.show(
context,
'You will choose one of above !'.tr,
AppColor.redColor);
}
}),
MyElevatedButton(
title: 'Cancel'.tr,
kolor: AppColor.redColor,

View File

@@ -27,13 +27,27 @@ class PointsCaptain extends StatelessWidget {
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
await paymentController.makePaymentStripe(pricePoint,
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
() async {
await captainWalletController.addDriverPayment('visa', pricePoint);
await captainWalletController.addDriverWallet('visa', countPoint);
await captainWalletController.getCaptainWalletFromBuyPoints();
});
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',
() async {
await captainWalletController.addDriverPayment(
'visa', pricePoint);
await captainWalletController.addDriverWallet(
'visa', countPoint);
await captainWalletController.getCaptainWalletFromBuyPoints();
});
},
child: Container(
width: Get.width * .22,

View File

@@ -350,7 +350,7 @@ class WalletCaptain extends StatelessWidget {
children: [
MyElevatedButton(
title:
'Create Wallet to recive your money',
'Create Wallet to receive your money',
onPressed: () async {
PaymentController paymentController =
Get.find<PaymentController>();