54 lines
1.3 KiB
Dart
54 lines
1.3 KiB
Dart
import 'package:siro_driver/constant/box_name.dart';
|
|
import 'package:siro_driver/main.dart';
|
|
|
|
class RechargeTier {
|
|
final double amount;
|
|
final double bonus;
|
|
const RechargeTier(this.amount, this.bonus);
|
|
|
|
double get total => amount + bonus;
|
|
}
|
|
|
|
class RechargeConfig {
|
|
final String currencyCode;
|
|
final List<RechargeTier> tiers;
|
|
const RechargeConfig({required this.currencyCode, required this.tiers});
|
|
|
|
static const Map<String, RechargeConfig> _configs = {
|
|
'Jordan': RechargeConfig(
|
|
currencyCode: 'JOD',
|
|
tiers: [
|
|
RechargeTier(5, 0),
|
|
RechargeTier(10, 0),
|
|
RechargeTier(20, 0),
|
|
RechargeTier(50, 0),
|
|
],
|
|
),
|
|
'Egypt': RechargeConfig(
|
|
currencyCode: 'EGP',
|
|
tiers: [
|
|
RechargeTier(100, 0),
|
|
RechargeTier(200, 0),
|
|
RechargeTier(400, 0),
|
|
RechargeTier(1000, 0),
|
|
],
|
|
),
|
|
'Syria': RechargeConfig(
|
|
currencyCode: 'SYP',
|
|
tiers: [
|
|
RechargeTier(100, 0),
|
|
RechargeTier(200, 0),
|
|
RechargeTier(400, 0),
|
|
RechargeTier(1000, 0),
|
|
],
|
|
),
|
|
};
|
|
|
|
static RechargeConfig get current {
|
|
final country = box.read(BoxName.countryCode) ?? 'Jordan';
|
|
return _configs[country] ?? _configs['Jordan']!;
|
|
}
|
|
|
|
static List<RechargeTier> get currentTiers => current.tiers;
|
|
}
|