BASE: Initialize Localization.
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:customer/models/user_model.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:customer/utils/preferences.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_paypal/flutter_paypal.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
@@ -327,7 +328,7 @@ class CartController extends GetxController {
|
||||
if (double.parse(userModel.value.walletAmount.toString()) >= totalAmount.value) {
|
||||
setOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("You don't have sufficient wallet balance to place order".tr);
|
||||
ShowToastDialog.showToast("You don't have sufficient wallet balance to place order".tr());
|
||||
}
|
||||
} else {
|
||||
setOrder();
|
||||
@@ -335,13 +336,13 @@ class CartController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> setOrder() async {
|
||||
ShowToastDialog.showLoader("Please wait...".tr);
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
|
||||
if ((Constant.isSubscriptionModelApplied == true || Constant.sectionConstantModel?.adminCommision?.isEnabled == true) && vendorModel.value.subscriptionPlan != null) {
|
||||
await FireStoreUtils.getVendorById(vendorModel.value.id!).then((vender) async {
|
||||
if (vender?.subscriptionTotalOrders == '0' || vender?.subscriptionTotalOrders == null) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("This vendor has reached their maximum order capacity. Please select a different vendor or try again later.".tr);
|
||||
ShowToastDialog.showToast("This vendor has reached their maximum order capacity. Please select a different vendor or try again later.".tr());
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -402,8 +403,8 @@ class CartController extends GetxController {
|
||||
userId: FireStoreUtils.getCurrentUid(),
|
||||
isTopup: false,
|
||||
orderId: orderModel.id,
|
||||
note: "Order Amount debited".tr,
|
||||
paymentStatus: "success".tr,
|
||||
note: "Order Amount debited".tr(),
|
||||
paymentStatus: "success".tr(),
|
||||
);
|
||||
|
||||
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
|
||||
@@ -540,7 +541,7 @@ class CartController 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(
|
||||
@@ -564,7 +565,7 @@ class CartController 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) {
|
||||
@@ -630,10 +631,10 @@ class CartController 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 {
|
||||
@@ -665,15 +666,15 @@ class CartController 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());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -697,14 +698,14 @@ class CartController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -734,10 +735,10 @@ class CartController 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 {
|
||||
@@ -765,11 +766,11 @@ class CartController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -874,7 +875,7 @@ class CartController 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);
|
||||
}
|
||||
@@ -906,18 +907,18 @@ class CartController extends GetxController {
|
||||
}
|
||||
|
||||
void handlePaymentSuccess(PaymentSuccessResponse response) {
|
||||
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) {
|
||||
@@ -932,10 +933,10 @@ class CartController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -960,7 +961,7 @@ class CartController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -985,13 +986,13 @@ class CartController extends GetxController {
|
||||
if (paymentURL.toString() != '') {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,7 +1015,7 @@ class CartController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -1051,7 +1052,7 @@ class CartController extends GetxController {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1070,11 +1071,11 @@ class CartController 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