BASE: Switch From EasyLocalization To GetX Localization.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:customer/utils/app_router.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../models/onprovider_order_model.dart';
|
||||
import '../models/wallet_transaction_model.dart';
|
||||
@@ -75,7 +76,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 =
|
||||
@@ -111,7 +112,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
);
|
||||
}
|
||||
|
||||
ShowToastDialog.showToast("OnDemand Service successfully booked".tr());
|
||||
ShowToastDialog.showToast("OnDemand Service successfully booked".tr);
|
||||
}
|
||||
if (selectedPaymentMethod.value == PaymentGateway.wallet.name) {
|
||||
WalletTransactionModel transactionModel = WalletTransactionModel(
|
||||
@@ -123,8 +124,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((
|
||||
@@ -161,7 +162,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((
|
||||
@@ -189,7 +190,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((
|
||||
@@ -321,7 +322,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
if (paymentIntentData!.containsKey("error")) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin.".tr(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
} else {
|
||||
await Stripe.instance.initPaymentSheet(
|
||||
@@ -354,7 +355,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) {
|
||||
@@ -437,10 +438,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 {
|
||||
@@ -472,15 +473,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);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -507,15 +508,15 @@ 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(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -557,10 +558,10 @@ class OnDemandPaymentController extends GetxController {
|
||||
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 {
|
||||
@@ -594,11 +595,11 @@ class OnDemandPaymentController extends GetxController {
|
||||
);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -743,7 +744,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
data["body"]["txnToken"].toString().isEmpty) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast(
|
||||
"something went wrong, please contact admin.".tr(),
|
||||
"something went wrong, please contact admin.".tr,
|
||||
);
|
||||
}
|
||||
return GetPaymentTxtTokenModel.fromJson(data);
|
||||
@@ -780,18 +781,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) {
|
||||
@@ -809,10 +810,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -853,7 +854,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
return responseData['payment_url'];
|
||||
} else {
|
||||
ShowToastDialog.showToast(
|
||||
"something went wrong, please contact admin.".tr(),
|
||||
"something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -901,12 +902,12 @@ class OnDemandPaymentController extends GetxController {
|
||||
),
|
||||
)!.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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -934,7 +935,7 @@ 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 '';
|
||||
}
|
||||
|
||||
@@ -946,7 +947,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
);
|
||||
} else {
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin.".tr(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -1001,7 +1002,7 @@ class OnDemandPaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin.".tr(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -1029,13 +1030,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);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@@ -1058,7 +1059,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 '';
|
||||
// }
|
||||
// }
|
||||
@@ -1099,7 +1100,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 '';
|
||||
// }
|
||||
// }
|
||||
@@ -1124,11 +1125,11 @@ class OnDemandPaymentController extends GetxController {
|
||||
),
|
||||
)!.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