feat: integrate enakgame and voucher
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s
This commit is contained in:
@@ -13,29 +13,47 @@ enum WalletCurrency {
|
||||
value == coin.apiValue ? coin : point;
|
||||
}
|
||||
|
||||
enum WalletTransactionType {
|
||||
earn('EARN', 'Dari belanja'),
|
||||
earnReversal('EARN_REVERSAL', 'Dibatalkan (order di-void/refund)'),
|
||||
payment('PAYMENT', 'Bayar pesanan'),
|
||||
paymentRefund('PAYMENT_REFUND', 'Pengembalian pembayaran'),
|
||||
exchangeOut('EXCHANGE_OUT', 'Ditukar ke EnakPoint'),
|
||||
exchangeIn('EXCHANGE_IN', 'Hasil tukar EnakCoin'),
|
||||
transferOut('TRANSFER_OUT', 'Transfer keluar'),
|
||||
transferIn('TRANSFER_IN', 'Transfer masuk'),
|
||||
gameSpend('GAME_SPEND', 'Main game'),
|
||||
expire('EXPIRE', 'Kedaluwarsa'),
|
||||
adjustment('ADJUSTMENT', 'Koreksi'),
|
||||
migration('MIGRATION', 'Saldo awal'),
|
||||
unknown('', 'Transaksi');
|
||||
const _bothCurrencies = [WalletCurrency.point, WalletCurrency.coin];
|
||||
|
||||
const WalletTransactionType(this.apiValue, this.label);
|
||||
enum WalletTransactionType {
|
||||
earn('EARN', 'Dari belanja', _bothCurrencies),
|
||||
earnReversal(
|
||||
'EARN_REVERSAL',
|
||||
'Dibatalkan (order di-void/refund)',
|
||||
_bothCurrencies,
|
||||
),
|
||||
exchangeOut('EXCHANGE_OUT', 'Ditukar ke EnakPoint', [WalletCurrency.coin]),
|
||||
exchangeIn('EXCHANGE_IN', 'Hasil tukar EnakCoin', [WalletCurrency.point]),
|
||||
transferOut('TRANSFER_OUT', 'Transfer keluar', _bothCurrencies),
|
||||
transferIn('TRANSFER_IN', 'Transfer masuk', _bothCurrencies),
|
||||
gameSpend('GAME_SPEND', 'Main game', [WalletCurrency.coin]),
|
||||
gameSpendRefund('GAME_SPEND_REFUND', 'Biaya main dikembalikan', [
|
||||
WalletCurrency.coin,
|
||||
]),
|
||||
gameReward('GAME_REWARD', 'Hadiah game', [WalletCurrency.coin]),
|
||||
rewardRedeem('REWARD_REDEEM', 'Ditukar ke voucher', [WalletCurrency.point]),
|
||||
rewardRedeemRefund('REWARD_REDEEM_REFUND', 'Penukaran voucher dibatalkan', [
|
||||
WalletCurrency.point,
|
||||
]),
|
||||
expire('EXPIRE', 'Kedaluwarsa', _bothCurrencies),
|
||||
adjustment('ADJUSTMENT', 'Koreksi', _bothCurrencies),
|
||||
migration('MIGRATION', 'Saldo awal', _bothCurrencies),
|
||||
|
||||
/// Tipe baru dari backend yang belum dikenal app: tampilkan `description`
|
||||
/// tanpa label.
|
||||
unknown('', '', []);
|
||||
|
||||
const WalletTransactionType(this.apiValue, this.label, this.currencies);
|
||||
|
||||
final String apiValue;
|
||||
final String label;
|
||||
|
||||
/// Tipe yang bisa dipilih di filter riwayat.
|
||||
static List<WalletTransactionType> get filterable =>
|
||||
values.where((e) => e != unknown).toList();
|
||||
/// Mata uang yang bisa memiliki tipe ini.
|
||||
final List<WalletCurrency> currencies;
|
||||
|
||||
/// Tipe yang bisa dipilih di filter riwayat untuk tab [currency].
|
||||
static List<WalletTransactionType> filterableFor(WalletCurrency currency) =>
|
||||
values.where((e) => e.currencies.contains(currency)).toList();
|
||||
|
||||
static WalletTransactionType fromApi(String? value) =>
|
||||
values.firstWhere((e) => e.apiValue == value, orElse: () => unknown);
|
||||
@@ -49,3 +67,36 @@ enum PinOtpPurpose {
|
||||
|
||||
final String apiValue;
|
||||
}
|
||||
|
||||
enum VoucherType {
|
||||
fixedValue('FIXED_VALUE'),
|
||||
percentage('PERCENTAGE'),
|
||||
freeItem('FREE_ITEM'),
|
||||
merchantBenefit('MERCHANT_BENEFIT'),
|
||||
unknown('');
|
||||
|
||||
const VoucherType(this.apiValue);
|
||||
|
||||
final String apiValue;
|
||||
|
||||
static VoucherType fromApi(String? value) =>
|
||||
values.firstWhere((e) => e.apiValue == value, orElse: () => unknown);
|
||||
}
|
||||
|
||||
enum VoucherRedemptionStatus {
|
||||
completed('COMPLETED'),
|
||||
|
||||
/// Sedang diproses penyedia luar; EnakPoint sudah terpotong.
|
||||
pending('PENDING'),
|
||||
|
||||
/// Gagal; EnakPoint dikembalikan otomatis (`REWARD_REDEEM_REFUND`).
|
||||
failed('FAILED'),
|
||||
unknown('');
|
||||
|
||||
const VoucherRedemptionStatus(this.apiValue);
|
||||
|
||||
final String apiValue;
|
||||
|
||||
static VoucherRedemptionStatus fromApi(String? value) =>
|
||||
values.firstWhere((e) => e.apiValue == value, orElse: () => unknown);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user