BASE: Initialize Localization.
This commit is contained in:
@@ -17,6 +17,7 @@ import 'package:customer/models/payment_model/xendit.dart';
|
||||
import 'package:customer/models/user_model.dart';
|
||||
import 'package:customer/models/wallet_transaction_model.dart';
|
||||
import 'package:customer/themes/app_them_data.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter_paypal/flutter_paypal.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:razorpay_flutter/razorpay_flutter.dart';
|
||||
@@ -131,7 +132,7 @@ class WalletController extends GetxController {
|
||||
}
|
||||
});
|
||||
|
||||
ShowToastDialog.showToast("Amount Top-up successfully".tr);
|
||||
ShowToastDialog.showToast("Amount Top-up successfully".tr());
|
||||
}
|
||||
|
||||
// Strip
|
||||
@@ -142,7 +143,7 @@ class WalletController 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(
|
||||
@@ -166,7 +167,7 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
});
|
||||
} on StripeException catch (e) {
|
||||
@@ -231,14 +232,14 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something want wrong please contact administrator".tr);
|
||||
ShowToastDialog.showToast("Something want wrong please contact administrator".tr());
|
||||
print('Error creating preference: ${response.body}');
|
||||
return null;
|
||||
}
|
||||
@@ -266,15 +267,15 @@ class WalletController extends GetxController {
|
||||
note: "Contact us for any questions on your order.",
|
||||
onSuccess: (Map params) async {
|
||||
walletTopUp();
|
||||
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());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -298,14 +299,14 @@ class WalletController extends GetxController {
|
||||
),
|
||||
)!.then((value) {
|
||||
if (value) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
walletTopUp();
|
||||
} 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -335,10 +336,10 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -366,11 +367,11 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
} else {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Failed".tr);
|
||||
ShowToastDialog.showToast("Payment Failed".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -402,18 +403,18 @@ class WalletController extends GetxController {
|
||||
}
|
||||
|
||||
void handlePaymentSuccess(PaymentSuccessResponse response) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
walletTopUp();
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
//Midtrans payment
|
||||
@@ -423,10 +424,10 @@ class WalletController extends GetxController {
|
||||
if (url != '') {
|
||||
Get.to(() => MidtransScreen(initialURl: url))!.then((value) {
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
walletTopUp();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -451,7 +452,7 @@ class WalletController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -476,12 +477,12 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +502,7 @@ class WalletController extends GetxController {
|
||||
accessToken = responseData['access_token'];
|
||||
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 '';
|
||||
}
|
||||
}
|
||||
@@ -540,7 +541,7 @@ class WalletController extends GetxController {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -559,10 +560,10 @@ class WalletController 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());
|
||||
walletTopUp();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user