diff --git a/server/src/Hokm.Server/Profiles/ProfileService.cs b/server/src/Hokm.Server/Profiles/ProfileService.cs index c458c24..3122d85 100644 --- a/server/src/Hokm.Server/Profiles/ProfileService.cs +++ b/server/src/Hokm.Server/Profiles/ProfileService.cs @@ -11,10 +11,12 @@ public class ProfileService public static readonly CoinPackDto[] Packs = { - new() { Id = "p1", Coins = 5000, Bonus = 0, PriceToman = 99000, Tag = "starter" }, - new() { Id = "p2", Coins = 11000, Bonus = 1000, PriceToman = 199000, Tag = "popular" }, - new() { Id = "p3", Coins = 24000, Bonus = 4000, PriceToman = 399000, Tag = "best" }, - new() { Id = "p4", Coins = 50000, Bonus = 15000, PriceToman = 799000 }, + // Id == Cafe Bazaar / Myket SKU (in-app product id). The store is the + // source of truth for price; PriceToman here is only for display. + new() { Id = "Coin5K", Coins = 5000, Bonus = 0, PriceToman = 99000, Tag = "starter" }, + new() { Id = "Coin12K", Coins = 11000, Bonus = 1000, PriceToman = 199000, Tag = "popular" }, + new() { Id = "Coin28K", Coins = 24000, Bonus = 4000, PriceToman = 399000, Tag = "best" }, + new() { Id = "Coin65K", Coins = 50000, Bonus = 15000, PriceToman = 799000 }, }; private static ProfileDto Default(string userId, string? name) => new() diff --git a/src/lib/online/mock-service.ts b/src/lib/online/mock-service.ts index b6299a0..c9d60c3 100644 --- a/src/lib/online/mock-service.ts +++ b/src/lib/online/mock-service.ts @@ -988,10 +988,11 @@ export class MockOnlineService implements OnlineService { async getCoinPacks(): Promise { return [ - { id: "p1", coins: 5000, bonus: 0, priceToman: 99000, tag: "starter" }, - { id: "p2", coins: 11000, bonus: 1000, priceToman: 199000, tag: "popular" }, - { id: "p3", coins: 24000, bonus: 4000, priceToman: 399000, tag: "best" }, - { id: "p4", coins: 50000, bonus: 15000, priceToman: 799000 }, + // id == Cafe Bazaar / Myket SKU (in-app product id). + { id: "Coin5K", coins: 5000, bonus: 0, priceToman: 99000, tag: "starter" }, + { id: "Coin12K", coins: 11000, bonus: 1000, priceToman: 199000, tag: "popular" }, + { id: "Coin28K", coins: 24000, bonus: 4000, priceToman: 399000, tag: "best" }, + { id: "Coin65K", coins: 50000, bonus: 15000, priceToman: 799000 }, ]; } diff --git a/src/lib/storeBilling.ts b/src/lib/storeBilling.ts index 06ac7e0..2b2cb8a 100644 --- a/src/lib/storeBilling.ts +++ b/src/lib/storeBilling.ts @@ -28,11 +28,20 @@ interface MyketBridge { declare global { interface Window { MyketBilling?: MyketBridge; + Capacitor?: { isNativePlatform?: () => boolean; getPlatform?: () => string }; } } export function getStore(): StoreId { - if (typeof window !== "undefined" && window.MyketBilling?.available) return "myket"; + if (typeof window === "undefined") return ENV_STORE; + // Myket's native bridge wins when present (a Myket-flavored build). + if (window.MyketBilling?.available) return "myket"; + // Honor an explicit build flavor. + if (ENV_STORE !== "web") return ENV_STORE; + // Otherwise, inside the Android app shell (Capacitor) default to Cafe Bazaar + // IAB — the APK ships to Bazaar, which requires its own billing. The web build + // stays on the web (ZarinPal) gateway. + if (window.Capacitor?.isNativePlatform?.()) return "bazaar"; return ENV_STORE; }