feat: add payment

This commit is contained in:
2026-07-05 16:03:15 +03:30
parent c2356b3242
commit 5017e9a613
30 changed files with 470 additions and 65 deletions
@@ -19,12 +19,16 @@ class ShopApiProvider {
required String kind,
required String productId,
required String token,
String purchaseData = '',
String signature = '',
}) =>
_api.post('/shop/purchase', body: {
'store': store,
'kind': kind,
'product_id': productId,
'token': token,
'purchase_data': purchaseData,
'signature': signature,
});
Future<Response> adReward(String token) =>
@@ -9,6 +9,7 @@ class ShopMapper {
vipDays: (j['vip_days'] ?? 0) as int,
priceToman: (j['price_toman'] ?? 0) as int,
bonusPct: (j['bonus_pct'] ?? 0) as int,
sku: (j['sku'] ?? '') as String,
);
static TicketPackage ticket(Map<String, dynamic> j) => TicketPackage(
@@ -16,6 +17,7 @@ class ShopMapper {
title: j['title'] as String,
tickets: (j['tickets'] ?? 0) as int,
priceToman: (j['price_toman'] ?? 0) as int,
sku: (j['sku'] ?? '') as String,
);
static CardSkin card(Map<String, dynamic> j) => CardSkin(
@@ -30,6 +32,7 @@ class ShopMapper {
multiplier: (j['multiplier'] ?? 1) as int,
hours: (j['hours'] ?? 0) as int,
priceToman: (j['price_toman'] ?? 0) as int,
sku: (j['sku'] ?? '') as String,
);
static VipPackage vip(Map<String, dynamic> j) => VipPackage(
@@ -37,6 +40,7 @@ class ShopMapper {
title: j['title'] as String,
months: (j['months'] ?? 1) as int,
priceToman: (j['price_toman'] ?? 0) as int,
sku: (j['sku'] ?? '') as String,
);
static ShopData shopData(Map<String, dynamic> j) {
@@ -43,6 +43,8 @@ class ShopRepositoryImpl extends ShopRepository {
kind: params.kind,
productId: params.productId,
token: params.token,
purchaseData: params.purchaseData,
signature: params.signature,
);
if (res.statusCode == 200) return const DataSuccess('خرید با موفقیت انجام شد');
return DataError(errorConvertor(res.statusCode, _msg(res)));