25-1/4/1
This commit is contained in:
3
.env
3
.env
@@ -17,7 +17,8 @@ llamaKey=RR-EuyoFDUvfRDBj46fZKAtKJ3voM8Mt768cPeJV7GNdAkPTKdY8Odm9n4ggGqI5GyoXrXl
|
|||||||
serverPHP=https://api.sefer.live/sefer
|
serverPHP=https://api.sefer.live/sefer
|
||||||
seferAlexandriaServer=https://seferalexandria.site/sefer
|
seferAlexandriaServer=https://seferalexandria.site/sefer
|
||||||
seferPaymentServer=https://seferpw.shop/sefer
|
seferPaymentServer=https://seferpw.shop/sefer
|
||||||
seferCairoServer=https://sefer.click/sefer
|
# seferCairoServer=https://sefer.click/sefer
|
||||||
|
seferCairoServer=https://server.sefer.live/sefer.click/sefer
|
||||||
seferGizaServer=https://gizasefer.online/sefer
|
seferGizaServer=https://gizasefer.online/sefer
|
||||||
anthropicAIkeySeferNewHamzaayedpython=zg-qbc-qvo39-vCB-WnzEwFNArO0YlTapvfhtmguKWsXJSKqg_NZSjHBYVXMZK1yUK88SobdckV0KuPaBh0c_WHtGsRO_439PBk-e2QqgkQQXrXlBl
|
anthropicAIkeySeferNewHamzaayedpython=zg-qbc-qvo39-vCB-WnzEwFNArO0YlTapvfhtmguKWsXJSKqg_NZSjHBYVXMZK1yUK88SobdckV0KuPaBh0c_WHtGsRO_439PBk-e2QqgkQQXrXlBl
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,27 @@ import '../main.dart';
|
|||||||
import 'box_name.dart';
|
import 'box_name.dart';
|
||||||
|
|
||||||
class AppLink {
|
class AppLink {
|
||||||
static final String seferPaymentServer0 = Env.seferPaymentServer;
|
static String serverPHP = box.read('serverPHP');
|
||||||
static final String seferPaymentServer = '${Env.seferPaymentServer}/ride';
|
static String seferCairoServer = box.read('seferCairoServer');
|
||||||
static final String seferAlexandriaServer = Env.seferAlexandriaServer;
|
static String seferGizaServer = box.read('seferGizaServer');
|
||||||
static final String seferCairoServer = Env.seferCairoServer;
|
static String seferAlexandriaServer = box.read('seferAlexandriaServer');
|
||||||
static const String seferGizaServer = 'https://gizasefer.online/sefer';
|
static String seferPaymentServer = box.read('seferPaymentServer');
|
||||||
|
static String seferPaymentServer0 = box.read('seferPaymentServer');
|
||||||
|
// static final String seferPaymentServer0 = Env.seferPaymentServer;
|
||||||
|
// static final String seferPaymentServer = '${Env.seferPaymentServer}/ride';
|
||||||
|
// static final String seferAlexandriaServer = Env.seferAlexandriaServer;
|
||||||
|
// static final String seferCairoServer = Env.seferCairoServer;
|
||||||
|
// static final String seferCairoServer =
|
||||||
|
// 'https://server.sefer.live/sefer.click/sefer';
|
||||||
|
// static final String seferGizaServer = Env.seferCairoServer;
|
||||||
|
// static final String seferAlexandriaServer = Env.seferCairoServer;
|
||||||
|
// static final String seferPaymentServer = '${Env.seferCairoServer}/ride';
|
||||||
|
// static final String seferPaymentServer0 = Env.seferCairoServer;
|
||||||
|
// static const String seferGizaServer = 'https://gizasefer.online/sefer';
|
||||||
// static final String seferGizaServer = Env.seferGizaServer;
|
// static final String seferGizaServer = Env.seferGizaServer;
|
||||||
|
static final String endPoint = box.read(BoxName.serverChosen);
|
||||||
|
static final String server = endPoint;
|
||||||
|
|
||||||
static final String endPoint =
|
|
||||||
box.read(BoxName.serverChosen) ?? Env.seferCairoServer;
|
|
||||||
static final String server = seferCairoServer;
|
|
||||||
// static final String server = Env.serverPHP;
|
// static final String server = Env.serverPHP;
|
||||||
|
|
||||||
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
|
||||||
@@ -34,8 +45,8 @@ class AppLink {
|
|||||||
static String addTokensDriver = "$server/ride/firebase/addDriver.php";
|
static String addTokensDriver = "$server/ride/firebase/addDriver.php";
|
||||||
|
|
||||||
//=======================Wallet===================
|
//=======================Wallet===================
|
||||||
static String wallet = '$seferPaymentServer/passengerWallet';
|
static String wallet = '$seferPaymentServer/ride/passengerWallet';
|
||||||
static String walletDriver = '$seferPaymentServer/driverWallet';
|
static String walletDriver = '$seferPaymentServer/ride/driverWallet';
|
||||||
static String getAllPassengerTransaction =
|
static String getAllPassengerTransaction =
|
||||||
"$wallet/getAllPassengerTransaction.php";
|
"$wallet/getAllPassengerTransaction.php";
|
||||||
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
|
static String getWalletByPassenger = "$wallet/getWalletByPassenger.php";
|
||||||
@@ -81,6 +92,8 @@ class AppLink {
|
|||||||
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
|
||||||
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||||
static String getapiKey = "$ride/apiKey/get.php";
|
static String getapiKey = "$ride/apiKey/get.php";
|
||||||
|
static String getapiKeySefer =
|
||||||
|
"https://api.sefer.live/sefer/ride/apiKey/get.php";
|
||||||
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
static String getRideStatusBegin = "$ride/rides/getRideStatusBegin.php";
|
||||||
static String getRideStatusFromStartApp =
|
static String getRideStatusFromStartApp =
|
||||||
"$ride/rides/getRideStatusFromStartApp.php";
|
"$ride/rides/getRideStatusFromStartApp.php";
|
||||||
@@ -99,26 +112,27 @@ class AppLink {
|
|||||||
static String addKazanPercent = "$ride/kazan/add.php";
|
static String addKazanPercent = "$ride/kazan/add.php";
|
||||||
|
|
||||||
////-----------------DriverPayment------------------
|
////-----------------DriverPayment------------------
|
||||||
static String addDrivePayment = "$seferPaymentServer/payment/add.php";
|
static String addDrivePayment = "$seferPaymentServer/ride/payment/add.php";
|
||||||
static String updatePaymetToPaid =
|
static String updatePaymetToPaid =
|
||||||
"$seferPaymentServer/payment/updatePaymetToPaid.php";
|
"$seferPaymentServer/ride/payment/updatePaymetToPaid.php";
|
||||||
|
|
||||||
static String addSeferWallet = "$seferPaymentServer/seferWallet/add.php";
|
static String addSeferWallet = "$seferPaymentServer/ride/seferWallet/add.php";
|
||||||
static String getSeferWallet = "$seferPaymentServer/seferWallet/get.php";
|
static String getSeferWallet = "$seferPaymentServer/ride/seferWallet/get.php";
|
||||||
static String addDriverPaymentPoints =
|
static String addDriverPaymentPoints =
|
||||||
"$seferPaymentServer/driverPayment/add.php";
|
"$seferPaymentServer/ride/driverPayment/add.php";
|
||||||
static String addPaymentTokenDriver =
|
static String addPaymentTokenDriver =
|
||||||
"$seferPaymentServer/driverWallet/addPaymentToken.php"; //driverWallet/addPaymentToken.php
|
"$seferPaymentServer/ride/driverWallet/addPaymentToken.php"; //driverWallet/addPaymentToken.php
|
||||||
static String addPaymentTokenPassenger =
|
static String addPaymentTokenPassenger =
|
||||||
"$seferPaymentServer/passengerWallet/addPaymentTokenPassenger.php";
|
"$seferPaymentServer/ride/passengerWallet/addPaymentTokenPassenger.php";
|
||||||
static String getDriverPaymentPoints =
|
static String getDriverPaymentPoints =
|
||||||
"$seferPaymentServer/driverWallet/get.php";
|
"$seferPaymentServer/ride/driverWallet/get.php";
|
||||||
static String getDriverPaymentToday = "$seferPaymentServer/payment/get.php";
|
static String getDriverPaymentToday =
|
||||||
|
"$seferPaymentServer/ride/payment/get.php";
|
||||||
static String getCountRide = "$server/ride/payment/getCountRide.php";
|
static String getCountRide = "$server/ride/payment/getCountRide.php";
|
||||||
static String getAllPaymentFromRide =
|
static String getAllPaymentFromRide =
|
||||||
"$seferPaymentServer/payment/getAllPayment.php";
|
"$seferPaymentServer/ride/payment/getAllPayment.php";
|
||||||
static String getAllPaymentVisa =
|
static String getAllPaymentVisa =
|
||||||
"$seferPaymentServer/payment/getAllPaymentVisa.php";
|
"$seferPaymentServer/ride/payment/getAllPaymentVisa.php";
|
||||||
|
|
||||||
//-----------------Passenger NotificationCaptain------------------
|
//-----------------Passenger NotificationCaptain------------------
|
||||||
static String addNotificationPassenger =
|
static String addNotificationPassenger =
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ class CRUD {
|
|||||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Log.print('request: ${response.request}');
|
|
||||||
Log.print('response: ${response.body}');
|
|
||||||
// if (response.statusCode == 200) {
|
// if (response.statusCode == 200) {
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (jsonData['status'] == 'success') {
|
if (jsonData['status'] == 'success') {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
|
||||||
|
import '../../constant/links.dart';
|
||||||
|
import '../../main.dart';
|
||||||
|
import 'crud.dart';
|
||||||
|
|
||||||
class SecureStorage {
|
class SecureStorage {
|
||||||
final FlutterSecureStorage _storage = const FlutterSecureStorage();
|
final FlutterSecureStorage _storage = const FlutterSecureStorage();
|
||||||
|
|
||||||
@@ -12,3 +18,45 @@ class SecureStorage {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const List<String> keysToFetch = [
|
||||||
|
'serverPHP',
|
||||||
|
'seferAlexandriaServer',
|
||||||
|
'seferPaymentServer',
|
||||||
|
'seferCairoServer',
|
||||||
|
'seferGizaServer',
|
||||||
|
];
|
||||||
|
|
||||||
|
class AppInitializer {
|
||||||
|
// final FlutterSecureStorage _storage = const FlutterSecureStorage();
|
||||||
|
|
||||||
|
Future<void> initializeApp() async {
|
||||||
|
// Check if app is running for the first time
|
||||||
|
|
||||||
|
// Loop through the keys and fetch their values
|
||||||
|
for (String key in keysToFetch) {
|
||||||
|
try {
|
||||||
|
String? value = await getKey(key); // Fetch from server
|
||||||
|
if (value != null) {
|
||||||
|
await box.write(key, value); // Save securely
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error fetching or saving key $key: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String?> getKey(String key) async {
|
||||||
|
var res =
|
||||||
|
await CRUD().get(link: AppLink.getapiKey, payload: {"keyName": key});
|
||||||
|
if (res != 'failure') {
|
||||||
|
try {
|
||||||
|
var data = jsonDecode(res)['message'];
|
||||||
|
return data[key]?.toString();
|
||||||
|
} catch (e) {
|
||||||
|
print('Error parsing response for $key: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -630,72 +630,80 @@ class MapDriverController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void finishRideFromDriver1() async {
|
void finishRideFromDriver1() async {
|
||||||
// if (carType != 'Comfort' || carType != 'Free Ride') {
|
|
||||||
|
|
||||||
isRideFinished = true;
|
isRideFinished = true;
|
||||||
isRideStarted = false;
|
isRideStarted = false;
|
||||||
isPriceWindow = false;
|
isPriceWindow = false;
|
||||||
box.write(BoxName.rideStatus, 'Finished');
|
box.write(BoxName.rideStatus, 'Finished');
|
||||||
// Get.find<HomeCaptainController>().changeToAppliedRide('Finished');
|
|
||||||
// Get.find<HomeCaptainController>().update();
|
// Calculate totalCost more concisely
|
||||||
totalCost = price < 20
|
if (price < 20) {
|
||||||
? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
|
totalCost = (carType == 'Comfort' ||
|
||||||
? '20'
|
carType == 'Mishwar Vip' ||
|
||||||
: '30'
|
carType == 'Lady')
|
||||||
: price < double.parse(totalPricePassenger)
|
? '30'
|
||||||
? totalPricePassenger
|
: '20';
|
||||||
: carType != 'Comfort' &&
|
} else if (price < double.parse(totalPricePassenger)) {
|
||||||
carType != 'Mishwar Vip' &&
|
totalCost = totalPricePassenger;
|
||||||
carType != 'Lady'
|
} else {
|
||||||
? totalPricePassenger
|
totalCost = (carType == 'Comfort' ||
|
||||||
: price.toStringAsFixed(2);
|
carType == 'Mishwar Vip' ||
|
||||||
|
carType == 'Lady')
|
||||||
|
? price.toStringAsFixed(2)
|
||||||
|
: totalPricePassenger;
|
||||||
|
}
|
||||||
paymentAmount = totalCost;
|
paymentAmount = totalCost;
|
||||||
box.write(BoxName.statusDriverLocation, 'off');
|
box.write(BoxName.statusDriverLocation, 'off');
|
||||||
// changeRideToBeginToPassenger();
|
|
||||||
await CRUD().post(
|
// Prepare data for API calls
|
||||||
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
final nowString = DateTime.now().toString();
|
||||||
payload: {
|
final basePayload = {
|
||||||
'id': rideId,
|
'id': rideId,
|
||||||
'rideTimeFinish': DateTime.now().toString(),
|
'rideTimeFinish': nowString,
|
||||||
'status': 'Finished',
|
'status': 'Finished',
|
||||||
'price': totalCost,
|
'price': totalCost,
|
||||||
});
|
};
|
||||||
CRUD().post(
|
final driverOrderPayload = {
|
||||||
link: "${AppLink.seferCairoServer}/ride/driver_order/update.php",
|
'order_id': rideId.toString(),
|
||||||
payload: {
|
'status': 'Finished'
|
||||||
// 'driver_id': box.read(BoxName.driverID).toString(),
|
};
|
||||||
'order_id': rideId.toString(),
|
|
||||||
'status': 'Finished'
|
// List to hold all asynchronous operations
|
||||||
});
|
List<Future<dynamic>> futures = [];
|
||||||
|
|
||||||
|
// API calls that can run in parallel
|
||||||
|
futures.add(CRUD().post(
|
||||||
|
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||||
|
payload: basePayload,
|
||||||
|
));
|
||||||
|
futures.add(CRUD().post(
|
||||||
|
link: "${AppLink.seferCairoServer}/ride/driver_order/update.php",
|
||||||
|
payload: driverOrderPayload,
|
||||||
|
));
|
||||||
|
|
||||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
CRUD().post(
|
futures.add(CRUD().post(
|
||||||
link: "${AppLink.endPoint}/ride/rides/update.php",
|
link: "${AppLink.endPoint}/ride/rides/update.php",
|
||||||
payload: {
|
payload: basePayload,
|
||||||
'id': rideId,
|
));
|
||||||
'rideTimeFinish': DateTime.now().toString(),
|
futures.add(CRUD().post(
|
||||||
'status': 'Finished',
|
link: "${AppLink.endPoint}/ride/driver_order/update.php",
|
||||||
'price': totalCost,
|
payload: driverOrderPayload,
|
||||||
},
|
));
|
||||||
);
|
|
||||||
CRUD().post(
|
|
||||||
link: "${AppLink.endPoint}/ride/driver_order/update.php",
|
|
||||||
payload: {
|
|
||||||
// 'driver_id': box.read(BoxName.driverID).toString(),
|
|
||||||
'order_id': rideId.toString(),
|
|
||||||
'status': 'Finished'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wallet transactions (can potentially be parallelized if independent)
|
||||||
if (walletChecked == 'true') {
|
if (walletChecked == 'true') {
|
||||||
paymentToken = await generateTokenPassenger(
|
paymentToken = await generateTokenPassenger(
|
||||||
((-1) * double.parse(paymentAmount)).toString());
|
((-1) * double.parse(paymentAmount)).toString());
|
||||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
futures.add(CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
'passenger_id': passengerId,
|
'passenger_id': passengerId,
|
||||||
'balance': ((-1) * double.parse(paymentAmount)).toString(),
|
'balance': ((-1) * double.parse(paymentAmount)).toString(),
|
||||||
'token': paymentToken,
|
'token': paymentToken,
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
paymentToken = await generateTokenDriver(paymentAmount.toString());
|
paymentToken = await generateTokenDriver(paymentAmount.toString());
|
||||||
await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
futures.add(CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||||
'rideId': rideId,
|
'rideId': rideId,
|
||||||
'amount': paymentAmount,
|
'amount': paymentAmount,
|
||||||
'payment_method':
|
'payment_method':
|
||||||
@@ -703,31 +711,33 @@ class MapDriverController extends GetxController {
|
|||||||
'passengerID': passengerId,
|
'passengerID': passengerId,
|
||||||
'token': paymentToken,
|
'token': paymentToken,
|
||||||
'driverID': box.read(BoxName.driverID).toString(),
|
'driverID': box.read(BoxName.driverID).toString(),
|
||||||
});
|
}));
|
||||||
|
|
||||||
if (double.parse(passengerWalletBurc) < 0) {
|
if (double.parse(passengerWalletBurc) < 0) {
|
||||||
// for zero passenger
|
final paymentToken1 = await generateTokenPassenger(
|
||||||
var paymentToken1 = await generateTokenPassenger(
|
|
||||||
((-1) * double.parse(passengerWalletBurc)).toString());
|
((-1) * double.parse(passengerWalletBurc)).toString());
|
||||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
futures.add(CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
'passenger_id': passengerId,
|
'passenger_id': passengerId,
|
||||||
'token': paymentToken1,
|
'token': paymentToken1,
|
||||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
double pointsSubtraction = 0;
|
double pointsSubtraction = double.parse(paymentAmount) * (-1) * 0.08;
|
||||||
pointsSubtraction =
|
final paymentToken2 =
|
||||||
double.parse(paymentAmount) * (-1) * .08; //for 300 from 3000
|
|
||||||
var paymentToken2 =
|
|
||||||
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
|
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
|
||||||
var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
futures.add(CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||||
'paymentID': 'rideId$rideId',
|
'paymentID': 'rideId$rideId',
|
||||||
'amount': (pointsSubtraction).toStringAsFixed(0),
|
'amount': (pointsSubtraction).toStringAsFixed(0),
|
||||||
'paymentMethod': paymentMethod,
|
'paymentMethod': paymentMethod,
|
||||||
'token': paymentToken2,
|
'token': paymentToken2,
|
||||||
'driverID': box.read(BoxName.driverID).toString(),
|
'driverID': box.read(BoxName.driverID).toString(),
|
||||||
});
|
}));
|
||||||
Future.delayed(const Duration(milliseconds: 300));
|
|
||||||
|
// Wait for all independent API calls to complete
|
||||||
|
await Future.wait(futures);
|
||||||
|
|
||||||
|
// Send notification (this likely depends on previous steps)
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
"Driver Finish Trip".tr,
|
"Driver Finish Trip".tr,
|
||||||
'${'you will pay to Driver'.tr} $paymentAmount \$',
|
'${'you will pay to Driver'.tr} $paymentAmount \$',
|
||||||
@@ -736,20 +746,139 @@ class MapDriverController extends GetxController {
|
|||||||
box.read(BoxName.driverID),
|
box.read(BoxName.driverID),
|
||||||
rideId,
|
rideId,
|
||||||
box.read(BoxName.tokenDriver),
|
box.read(BoxName.tokenDriver),
|
||||||
// carType == 'Comfort' || carType == 'Mishwar Vip'
|
|
||||||
// ? price.toStringAsFixed(2)
|
|
||||||
// : totalPassenger
|
|
||||||
paymentAmount.toString()
|
paymentAmount.toString()
|
||||||
],
|
],
|
||||||
'ding.wav');
|
'ding.wav');
|
||||||
|
|
||||||
|
// Navigate to the next screen (likely depends on previous steps being done)
|
||||||
Get.to(() => RatePassenger(), arguments: {
|
Get.to(() => RatePassenger(), arguments: {
|
||||||
'passengerId': passengerId,
|
'passengerId': passengerId,
|
||||||
'rideId': rideId,
|
'rideId': rideId,
|
||||||
'price': paymentAmount.toString(), //price
|
'price': paymentAmount.toString(),
|
||||||
'walletChecked': walletChecked
|
'walletChecked': walletChecked
|
||||||
});
|
});
|
||||||
// Get.back();
|
|
||||||
}
|
}
|
||||||
|
// void finishRideFromDriver1() async {
|
||||||
|
// // if (carType != 'Comfort' || carType != 'Free Ride') {
|
||||||
|
|
||||||
|
// isRideFinished = true;
|
||||||
|
// isRideStarted = false;
|
||||||
|
// isPriceWindow = false;
|
||||||
|
// box.write(BoxName.rideStatus, 'Finished');
|
||||||
|
// // Get.find<HomeCaptainController>().changeToAppliedRide('Finished');
|
||||||
|
// // Get.find<HomeCaptainController>().update();
|
||||||
|
// totalCost = price < 20
|
||||||
|
// ? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
|
||||||
|
// ? '20'
|
||||||
|
// : '30'
|
||||||
|
// : price < double.parse(totalPricePassenger)
|
||||||
|
// ? totalPricePassenger
|
||||||
|
// : carType != 'Comfort' &&
|
||||||
|
// carType != 'Mishwar Vip' &&
|
||||||
|
// carType != 'Lady'
|
||||||
|
// ? totalPricePassenger
|
||||||
|
// : price.toStringAsFixed(2);
|
||||||
|
// paymentAmount = totalCost;
|
||||||
|
// box.write(BoxName.statusDriverLocation, 'off');
|
||||||
|
// // changeRideToBeginToPassenger();
|
||||||
|
// await CRUD().post(
|
||||||
|
// link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||||
|
// payload: {
|
||||||
|
// 'id': rideId,
|
||||||
|
// 'rideTimeFinish': DateTime.now().toString(),
|
||||||
|
// 'status': 'Finished',
|
||||||
|
// 'price': totalCost,
|
||||||
|
// });
|
||||||
|
// CRUD().post(
|
||||||
|
// link: "${AppLink.seferCairoServer}/ride/driver_order/update.php",
|
||||||
|
// payload: {
|
||||||
|
// // 'driver_id': box.read(BoxName.driverID).toString(),
|
||||||
|
// 'order_id': rideId.toString(),
|
||||||
|
// 'status': 'Finished'
|
||||||
|
// });
|
||||||
|
// if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
|
// CRUD().post(
|
||||||
|
// link: "${AppLink.endPoint}/ride/rides/update.php",
|
||||||
|
// payload: {
|
||||||
|
// 'id': rideId,
|
||||||
|
// 'rideTimeFinish': DateTime.now().toString(),
|
||||||
|
// 'status': 'Finished',
|
||||||
|
// 'price': totalCost,
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// CRUD().post(
|
||||||
|
// link: "${AppLink.endPoint}/ride/driver_order/update.php",
|
||||||
|
// payload: {
|
||||||
|
// // 'driver_id': box.read(BoxName.driverID).toString(),
|
||||||
|
// 'order_id': rideId.toString(),
|
||||||
|
// 'status': 'Finished'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// if (walletChecked == 'true') {
|
||||||
|
// paymentToken = await generateTokenPassenger(
|
||||||
|
// ((-1) * double.parse(paymentAmount)).toString());
|
||||||
|
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
// 'passenger_id': passengerId,
|
||||||
|
// 'balance': ((-1) * double.parse(paymentAmount)).toString(),
|
||||||
|
// 'token': paymentToken,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// paymentToken = await generateTokenDriver(paymentAmount.toString());
|
||||||
|
// await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||||
|
// 'rideId': rideId,
|
||||||
|
// 'amount': paymentAmount,
|
||||||
|
// 'payment_method':
|
||||||
|
// walletChecked == 'true' ? "${paymentMethod}Ride" : paymentMethod,
|
||||||
|
// 'passengerID': passengerId,
|
||||||
|
// 'token': paymentToken,
|
||||||
|
// 'driverID': box.read(BoxName.driverID).toString(),
|
||||||
|
// });
|
||||||
|
// if (double.parse(passengerWalletBurc) < 0) {
|
||||||
|
// // for zero passenger
|
||||||
|
// var paymentToken1 = await generateTokenPassenger(
|
||||||
|
// ((-1) * double.parse(passengerWalletBurc)).toString());
|
||||||
|
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||||
|
// 'passenger_id': passengerId,
|
||||||
|
// 'token': paymentToken1,
|
||||||
|
// 'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// double pointsSubtraction = 0;
|
||||||
|
// pointsSubtraction =
|
||||||
|
// double.parse(paymentAmount) * (-1) * .08; //for 300 from 3000
|
||||||
|
// var paymentToken2 =
|
||||||
|
// await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
|
||||||
|
// var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||||
|
// 'paymentID': 'rideId$rideId',
|
||||||
|
// 'amount': (pointsSubtraction).toStringAsFixed(0),
|
||||||
|
// 'paymentMethod': paymentMethod,
|
||||||
|
// 'token': paymentToken2,
|
||||||
|
// 'driverID': box.read(BoxName.driverID).toString(),
|
||||||
|
// });
|
||||||
|
// Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
// FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
|
// "Driver Finish Trip".tr,
|
||||||
|
// '${'you will pay to Driver'.tr} $paymentAmount \$',
|
||||||
|
// tokenPassenger,
|
||||||
|
// [
|
||||||
|
// box.read(BoxName.driverID),
|
||||||
|
// rideId,
|
||||||
|
// box.read(BoxName.tokenDriver),
|
||||||
|
// // carType == 'Comfort' || carType == 'Mishwar Vip'
|
||||||
|
// // ? price.toStringAsFixed(2)
|
||||||
|
// // : totalPassenger
|
||||||
|
// paymentAmount.toString()
|
||||||
|
// ],
|
||||||
|
// 'ding.wav');
|
||||||
|
// Get.to(() => RatePassenger(), arguments: {
|
||||||
|
// 'passengerId': passengerId,
|
||||||
|
// 'rideId': rideId,
|
||||||
|
// 'price': paymentAmount.toString(), //price
|
||||||
|
// 'walletChecked': walletChecked
|
||||||
|
// });
|
||||||
|
// // Get.back();
|
||||||
|
// }
|
||||||
|
|
||||||
void cancelCheckRideFromPassenger() async {
|
void cancelCheckRideFromPassenger() async {
|
||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import 'constant/notification.dart';
|
|||||||
import 'controller/firebase/firbase_messge.dart';
|
import 'controller/firebase/firbase_messge.dart';
|
||||||
import 'controller/firebase/local_notification.dart';
|
import 'controller/firebase/local_notification.dart';
|
||||||
import 'controller/functions/location_controller.dart';
|
import 'controller/functions/location_controller.dart';
|
||||||
|
import 'controller/functions/secure_storage.dart';
|
||||||
import 'controller/local/local_controller.dart';
|
import 'controller/local/local_controller.dart';
|
||||||
import 'controller/local/translations.dart';
|
import 'controller/local/translations.dart';
|
||||||
import 'controller/payment/paymob/paymob_wallet.dart';
|
import 'controller/payment/paymob/paymob_wallet.dart';
|
||||||
@@ -182,7 +183,8 @@ void main() async {
|
|||||||
userTokenExpiration: 200,
|
userTokenExpiration: 200,
|
||||||
iFrameID: 837992,
|
iFrameID: 837992,
|
||||||
);
|
);
|
||||||
|
final AppInitializer initializer = AppInitializer();
|
||||||
|
await initializer.initializeApp();
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -194,9 +194,9 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
_buildPromoCard(
|
_buildPromoCard(
|
||||||
title: 'Morning Promo'.tr,
|
title: 'Morning Promo'.tr,
|
||||||
timePromo: 'Morning Promo',
|
timePromo: 'Morning Promo',
|
||||||
count: captainWalletController
|
count: int.parse(captainWalletController
|
||||||
.walletDate['message'][0]
|
.walletDate['message'][0]
|
||||||
['morning_count'],
|
['morning_count']),
|
||||||
maxCount: 5,
|
maxCount: 5,
|
||||||
description:
|
description:
|
||||||
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
"this is count of your all trips in the morning promo today from 7:00am-10:00am"
|
||||||
@@ -207,9 +207,9 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
_buildPromoCard(
|
_buildPromoCard(
|
||||||
timePromo: 'Afternoon Promo',
|
timePromo: 'Afternoon Promo',
|
||||||
title: 'Afternoon Promo'.tr,
|
title: 'Afternoon Promo'.tr,
|
||||||
count: captainWalletController
|
count: int.parse(captainWalletController
|
||||||
.walletDate['message'][0]
|
.walletDate['message'][0]
|
||||||
['afternoon_count'],
|
['afternoon_count']),
|
||||||
maxCount: 5,
|
maxCount: 5,
|
||||||
description:
|
description:
|
||||||
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
"this is count of your all trips in the Afternoon promo today from 3:00pm-6:00 pm"
|
||||||
|
|||||||
Reference in New Issue
Block a user