feat: integrate enakgame and voucher
Build & Deploy iOS to TestFlight / build-and-deploy (push) Canceled after 0s

This commit is contained in:
efrilm
2026-10-10 02:33:16 +07:00
parent e5515d5871
commit 38850b281f
104 changed files with 7122 additions and 8063 deletions
@@ -0,0 +1,72 @@
part of '../wallet.dart';
/// Voucher di katalog yang bisa ditukar dengan EnakPoint sekarang (§9.1).
@freezed
abstract class Voucher with _$Voucher {
const Voucher._();
const factory Voucher({
required String id,
required String name,
String? description,
String? imageUrl,
required VoucherType type,
/// Nilai voucher dalam rupiah.
required int faceValue,
/// EnakPoint yang dipotong saat ditukar.
required int pointCost,
/// Batas tukar per customer; `null` berarti tanpa batas.
int? maxPerCustomer,
DateTime? validUntil,
/// Sisa stok; `null` berarti stok tidak dihitung.
int? available,
}) = _Voucher;
bool get isOutOfStock => available != null && available! <= 0;
}
/// Voucher hasil tukar milik customer (§9.3).
@freezed
abstract class VoucherRedemption with _$VoucherRedemption {
const factory VoucherRedemption({
required String id,
required String voucherId,
required String voucherName,
String? voucherImageUrl,
required VoucherType voucherType,
required VoucherRedemptionStatus status,
required int faceValue,
required int pointCost,
/// `null` bila voucher tidak memakai kode; customer menunjukkan layar
/// voucher ke kasir.
String? code,
DateTime? codeExpiresAt,
DateTime? completedAt,
DateTime? createdAt,
}) = _VoucherRedemption;
}
@freezed
abstract class VoucherRedemptionPage with _$VoucherRedemptionPage {
const factory VoucherRedemptionPage({
required List<VoucherRedemption> items,
required int page,
required int totalPages,
}) = _VoucherRedemptionPage;
}
@freezed
abstract class VoucherRedeemResult with _$VoucherRedeemResult {
const factory VoucherRedeemResult({
required VoucherRedemption redemption,
/// Saldo EnakPoint setelah ditukar.
required int pointBalance,
required bool replayed,
}) = _VoucherRedeemResult;
}