Update: 2026-06-25 02:28:33
This commit is contained in:
@@ -12,7 +12,7 @@ class AC {
|
||||
gAK() async {
|
||||
if (box.read(BoxName.apiKeyRun).toString() != 'run') {
|
||||
var res = await CRUD().get(link: AppLink.getApiKey, payload: {});
|
||||
var decod = jsonDecode(res);
|
||||
var decod = res;
|
||||
Log.print(decod);
|
||||
Map<String, dynamic> jsonData = {};
|
||||
for (var i = 0; i < decod['message'].length; i++) {
|
||||
|
||||
66
siro_rider/lib/constant/payment_tiers.dart
Normal file
66
siro_rider/lib/constant/payment_tiers.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_rider/constant/box_name.dart';
|
||||
import 'package:siro_rider/main.dart';
|
||||
|
||||
class PaymentTier {
|
||||
final double amount;
|
||||
final double bonus;
|
||||
const PaymentTier(this.amount, this.bonus);
|
||||
}
|
||||
|
||||
class PaymentTierConfig {
|
||||
final String currencyCode;
|
||||
final List<PaymentTier> tiers;
|
||||
const PaymentTierConfig({required this.currencyCode, required this.tiers});
|
||||
|
||||
static const Map<String, PaymentTierConfig> _configs = {
|
||||
'Jordan': PaymentTierConfig(
|
||||
currencyCode: 'JOD',
|
||||
tiers: [
|
||||
PaymentTier(5, 0),
|
||||
PaymentTier(10, 0.5),
|
||||
PaymentTier(20, 1),
|
||||
PaymentTier(50, 3),
|
||||
],
|
||||
),
|
||||
'Egypt': PaymentTierConfig(
|
||||
currencyCode: 'EGP',
|
||||
tiers: [
|
||||
PaymentTier(100, 0),
|
||||
PaymentTier(200, 10),
|
||||
PaymentTier(400, 20),
|
||||
PaymentTier(1000, 50),
|
||||
],
|
||||
),
|
||||
'Syria': PaymentTierConfig(
|
||||
currencyCode: 'SYP',
|
||||
tiers: [
|
||||
PaymentTier(100, 0),
|
||||
PaymentTier(200, 10),
|
||||
PaymentTier(400, 20),
|
||||
PaymentTier(1000, 50),
|
||||
],
|
||||
),
|
||||
};
|
||||
|
||||
static PaymentTierConfig get current {
|
||||
final country = box.read(BoxName.countryCode) ?? 'Jordan';
|
||||
return _configs[country] ?? _configs['Jordan']!;
|
||||
}
|
||||
|
||||
static List<PaymentTier> get currentTiers => current.tiers;
|
||||
static String get currentCurrency => current.currencyCode;
|
||||
|
||||
static String formatAmount(double v) {
|
||||
return v == v.roundToDouble() ? v.toInt().toString() : v.toStringAsFixed(1);
|
||||
}
|
||||
|
||||
static String tierLabel(int index) {
|
||||
final t = currentTiers[index];
|
||||
final cur = currentCurrency;
|
||||
if (t.bonus > 0) {
|
||||
return '${'Pay'.tr} ${formatAmount(t.amount)} $cur, ${'Get'.tr} ${formatAmount(t.amount + t.bonus)} $cur';
|
||||
}
|
||||
return '${formatAmount(t.amount)} $cur';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user