This commit is contained in:
Hamza Aleghwairyeen
2024-04-22 14:19:38 +03:00
parent 3a0ca74961
commit b9c9a8a12f
10 changed files with 113 additions and 60 deletions

View File

@@ -197,16 +197,16 @@ class FirebaseMessagesController extends GetxController {
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
'tone1');
Get.find<MapPassengerController>().tripFinishedFromDriver();
if (Get.find<PaymentController>().isCashChecked == false &&
Get.find<PaymentController>().isWalletChecked == true) {
driverFinishTripDialoge(driverList);
} else {
Get.to(() => RateDriverFromPassenger(), arguments: {
'driverId': driverList[0].toString(),
'rideId': driverList[1].toString(),
'price': driverList[3].toString()
});
}
// if (Get.find<PaymentController>().isCashChecked == false &&
// Get.find<PaymentController>().isWalletChecked == true) {
// // driverFinishTripDialoge(driverList);
// } else {
Get.to(() => RateDriverFromPassenger(), arguments: {
'driverId': driverList[0].toString(),
'rideId': driverList[1].toString(),
'price': driverList[3].toString()
});
// }
} else if (message.notification!.title! == 'Call Income') {
try {
var myListString = message.data['passengerList'];
@@ -254,7 +254,7 @@ class FirebaseMessagesController extends GetxController {
'Driver Cancel Your Trip'.tr,
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
.tr,
'order');
'cancel');
}
Get.find<MapPassengerController>().restCounter();

View File

@@ -241,10 +241,14 @@ class HomeCaptainController extends GetxController {
var res = await CRUD().get(
link: AppLink.getDriverpaymentToday,
payload: {'driverID': box.read(BoxName.driverID).toString()});
data = jsonDecode(res);
totalMoneyToday = data['message'][0]['todayAmount'];
if (res != 'failure') {
data = jsonDecode(res);
totalMoneyToday = data['message'][0]['todayAmount'];
update();
update();
} else {
print(res);
}
}
getKazanPercent() async {

View File

@@ -1074,7 +1074,8 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId);
// print(res);
// var decod = jsonDecode(res);
print(' 0000000000000000000000000000000000000000000000000');
print(
' 000000000000000000delayAndFetchRideStatus0000000000000000000000000000000');
print(res);
if (res.toString() == 'Apply') {
// getUpdatedRideForDriverApply(rideId);
@@ -1107,7 +1108,7 @@ class MapPassengerController extends GetxController {
var res = await getRideStatus(rideId);
print(res);
// var decod = jsonDecode(res);
// print(' 0000000000000000000000000000000000000000000000000');
print('--------delayAndFetchRideStatusForAllDriverAvailable----');
// print(decod['data']);
if (res.toString() == 'Apply') {
getUpdatedRideForDriverApply(rideId);
@@ -1256,6 +1257,7 @@ class MapPassengerController extends GetxController {
),
);
driversToken.add(json['token']);
// driversToken = json['token'];
} else {
carLocationsModels[i] = model;
markers[i] = Marker(
@@ -1267,7 +1269,8 @@ class MapPassengerController extends GetxController {
rotation: double.parse(json['heading']),
icon: carIcon,
);
driversToken[i] = json['token'];
// driversToken = json['token'];
driversToken.add(json['token']);
}
}
@@ -1411,8 +1414,6 @@ class MapPassengerController extends GetxController {
"order_id": rideId.toString(), // Convert to String
"status": 'Cancel'
});
FirebaseMessagesController().sendNotificationToDriverMAP(
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
}
rideConfirm = false;
shouldFetch = false;
@@ -2507,7 +2508,8 @@ class MapPassengerController extends GetxController {
link: AppLink.getPassengerRate,
payload: {'passenger_id': box.read(BoxName.passengerID)});
if (res != 'failure') {
passengerRate = double.parse(jsonDecode(res)['message']['rating']) ?? 5;
print(jsonDecode(res)['message']['rating']);
passengerRate = jsonDecode(res)['message']['rating'];
}
}

View File

@@ -254,8 +254,8 @@ class PaymentController extends GetxController {
MaterialPageRoute(
builder: (BuildContext context) => UsePaypal(
sandboxMode: true,
clientId: AK.payPalClientIdLive,
secretKey: AK.payPalSecretLive,
clientId: AK.payPalClientId,
secretKey: AK.payPalSecret,
returnURL: AppInformation.website,
cancelURL: "${AppInformation.website}/cancel",
transactions: [
@@ -636,10 +636,10 @@ class PaymentController extends GetxController {
billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) {
print('Success: ${response.success}');
print('Transaction ID: ${response.transactionID}');
print('Response Code: ${response.responseCode}');
print('Message: ${response.message}');
// print('Success: ${response.success}');
// print('Transaction ID: ${response.transactionID}');
// print('Response Code: ${response.responseCode}');
// print('Message: ${response.message}');
// print(box.read(BoxName.passengerWalletTotal));//
// print(box.read(BoxName.name));

View File

@@ -30,7 +30,7 @@ class PaymobResponseWallet {
class PaymobPaymentWallet {
static PaymobPaymentWallet instance = PaymobPaymentWallet();
bool _isInitialized = false;
bool _isInitializedWallet = false;
final Dio _dio = Dio();
final _baseURL = 'https://accept.paymob.com/api/';
@@ -55,7 +55,7 @@ class PaymobPaymentWallet {
/// The expiration time of this payment token in seconds. (The maximum is 3600 seconds which is an hour)
int userTokenExpiration = 300,
}) async {
if (_isInitialized) {
if (_isInitializedWallet) {
return true;
}
_dio.options.baseUrl = _baseURL;
@@ -65,9 +65,9 @@ class PaymobPaymentWallet {
_iFrameID = iFrameID;
_iFrameURL =
'https://accept.paymobsolutions.com/api/acceptance/iframes/$_iFrameID?payment_token=';
_isInitialized = true;
_isInitializedWallet = true;
_userTokenExpiration = userTokenExpiration;
return _isInitialized;
return _isInitializedWallet;
}
/// Get authentication token, which is valid for one hour from the creation time.
@@ -196,7 +196,7 @@ class PaymobPaymentWallet {
/// The billing data related to the customer related to this payment.
PaymobBillingDataWallet? billingData}) async {
if (!_isInitialized) {
if (!_isInitializedWallet) {
throw Exception(
'PaymobPayment is not initialized call:`PaymobPayment.instance.initialize`');
}