BASE: Initialize Localization.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../models/onprovider_order_model.dart';
|
||||
@@ -72,7 +73,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
Future<void> placeOrder() async {
|
||||
if (!isExtra) {
|
||||
// Normal Order
|
||||
ShowToastDialog.showLoader("Please wait...".tr);
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
|
||||
onDemandOrderModel.value?.payment_method = selectedPaymentMethod.value;
|
||||
onDemandOrderModel.value?.paymentStatus = onDemandOrderModel.value?.provider.priceUnit == "Fixed" && selectedPaymentMethod.value == "cod" ? false : true;
|
||||
@@ -90,7 +91,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
await SendNotification.sendFcmMessage(Constant.bookingPlaced, providerUser.fcmToken ?? '', payLoad);
|
||||
}
|
||||
|
||||
ShowToastDialog.showToast("OnDemand Service successfully booked".tr);
|
||||
ShowToastDialog.showToast("OnDemand Service successfully booked".tr());
|
||||
}
|
||||
if (selectedPaymentMethod.value == PaymentGateway.wallet.name) {
|
||||
WalletTransactionModel transactionModel = WalletTransactionModel(
|
||||
@@ -102,8 +103,8 @@ class OnDemandPaymentController extends GetxController {
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
isTopup: false,
|
||||
orderId: onDemandOrderModel.value!.id,
|
||||
note: "Booking Amount debited".tr,
|
||||
paymentStatus: "success".tr,
|
||||
note: "Booking Amount debited".tr(),
|
||||
paymentStatus: "success".tr(),
|
||||
);
|
||||
|
||||
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
|
||||
@@ -133,7 +134,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
isTopup: false,
|
||||
orderId: onDemandOrderModel.value!.id,
|
||||
note: "Booking Extra charge debited",
|
||||
paymentStatus: "success".tr,
|
||||
paymentStatus: "success".tr(),
|
||||
);
|
||||
|
||||
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
|
||||
@@ -156,7 +157,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
isTopup: true,
|
||||
orderId: onDemandOrderModel.value?.id,
|
||||
note: 'Extra Charge Amount Credited',
|
||||
paymentStatus: "success".tr,
|
||||
paymentStatus: "success".tr(),
|
||||
);
|
||||
|
||||
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
|
||||
@@ -252,7 +253,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
log("stripe Responce====>$paymentIntentData");
|
||||
if (paymentIntentData!.containsKey("error")) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
} else {
|
||||
await Stripe.instance.initPaymentSheet(
|
||||
paymentSheetParameters: SetupPaymentSheetParameters(
|
||||
@@ -276,7 +277,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
Future<void> displayStripePaymentSheet({required String amount}) async {
|
||||
try {
|
||||
await Stripe.instance.presentPaymentSheet().then((value) {
|
||||
ShowToastDialog.showToast("Payment successfully".tr);
|
||||
ShowToastDialog.showToast("Payment successfully".tr());
|
||||
placeOrder();
|
||||
});
|
||||
} on StripeException catch (e) {
|
||||
@@ -342,10 +343,10 @@ class OnDemandPaymentController extends GetxController {
|
||||
final data = jsonDecode(response.body);
|
||||
Get.to(MercadoPagoScreen(initialURl: data['init_point']))!.then((value) {
|
||||
if (value) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -377,15 +378,15 @@ class OnDemandPaymentController extends GetxController {
|
||||
note: "Contact us for any questions on your order.",
|
||||
onSuccess: (Map params) async {
|
||||
placeOrder();
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
},
|
||||
onError: (error) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
},
|
||||
onCancel: (params) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -412,14 +413,14 @@ class OnDemandPaymentController extends GetxController {
|
||||
),
|
||||
)!.then((value) {
|
||||
if (value) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -445,10 +446,10 @@ class OnDemandPaymentController extends GetxController {
|
||||
final data = jsonDecode(response.body);
|
||||
Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then((value) {
|
||||
if (value) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -476,11 +477,11 @@ class OnDemandPaymentController extends GetxController {
|
||||
bool isDone = await Get.to(PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value));
|
||||
if (isDone) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment successfully".tr);
|
||||
ShowToastDialog.showToast("Payment successfully".tr());
|
||||
placeOrder();
|
||||
} else {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Failed".tr);
|
||||
ShowToastDialog.showToast("Payment Failed".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -585,7 +586,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
final data = jsonDecode(response.body);
|
||||
if (data["body"]["txnToken"] == null || data["body"]["txnToken"].toString().isEmpty) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("something went wrong, please contact admin.".tr());
|
||||
}
|
||||
return GetPaymentTxtTokenModel.fromJson(data);
|
||||
}
|
||||
@@ -618,18 +619,18 @@ class OnDemandPaymentController extends GetxController {
|
||||
|
||||
void handlePaymentSuccess(PaymentSuccessResponse response) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
}
|
||||
|
||||
void handleExternalWaller(ExternalWalletResponse response) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Processing!! via".tr);
|
||||
ShowToastDialog.showToast("Payment Processing!! via".tr());
|
||||
}
|
||||
|
||||
void handlePaymentError(PaymentFailureResponse response) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Failed!!".tr);
|
||||
ShowToastDialog.showToast("Payment Failed!!".tr());
|
||||
}
|
||||
|
||||
bool isCurrentDateInRange(DateTime startDate, DateTime endDate) {
|
||||
@@ -644,10 +645,10 @@ class OnDemandPaymentController extends GetxController {
|
||||
if (url != '') {
|
||||
Get.to(() => MidtransScreen(initialURl: url))!.then((value) {
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -672,7 +673,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
final responseData = jsonDecode(response.body);
|
||||
return responseData['payment_url'];
|
||||
} else {
|
||||
ShowToastDialog.showToast("something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -702,12 +703,12 @@ class OnDemandPaymentController extends GetxController {
|
||||
if (paymentURL.toString().isNotEmpty) {
|
||||
Get.to(() => OrangeMoneyScreen(initialURl: paymentURL, accessToken: accessToken, amount: amount, orangePay: orangeMoneyModel.value, orderId: orderId, payToken: payToken))!.then((value) {
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,13 +727,13 @@ class OnDemandPaymentController extends GetxController {
|
||||
|
||||
accessToken = responseData['access_token'] ?? '';
|
||||
if (accessToken.isEmpty) {
|
||||
ShowToastDialog.showToast("Failed to get access token".tr);
|
||||
ShowToastDialog.showToast("Failed to get access token".tr());
|
||||
return '';
|
||||
}
|
||||
|
||||
return await webpayment(context: context, amountData: amount, currency: currency, orderIdData: orderId);
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -773,7 +774,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -800,13 +801,13 @@ class OnDemandPaymentController extends GetxController {
|
||||
// () => OrangeMoneyScreen(initialURl: paymentURL, accessToken: accessToken, amount: amount, orangePay: orangeMoneyModel.value, orderId: orderId, payToken: payToken),
|
||||
// )!.then((value) {
|
||||
// if (value == true) {
|
||||
// ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
// ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
// placeOrder();
|
||||
// ();
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
// ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@@ -829,7 +830,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
// // ignore: use_build_context_synchronously
|
||||
// return await webpayment(context: context, amountData: amount, currency: currency, orderIdData: orderId);
|
||||
// } else {
|
||||
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
// return '';
|
||||
// }
|
||||
// }
|
||||
@@ -870,7 +871,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
// return '';
|
||||
// }
|
||||
// } else {
|
||||
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
// return '';
|
||||
// }
|
||||
// }
|
||||
@@ -889,11 +890,11 @@ class OnDemandPaymentController extends GetxController {
|
||||
if (model.id != null) {
|
||||
Get.to(() => XenditScreen(initialURl: model.invoiceUrl ?? '', transId: model.id ?? '', apiKey: xenditModel.value.apiKey!.toString()))!.then((value) {
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
placeOrder();
|
||||
();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user