@getenginex/sdk-igaming 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1162,6 +1162,7 @@ function createClubRoutes(options = {}) {
1162
1162
  };
1163
1163
  }
1164
1164
  var POINT_VALUE_CENTS = 5;
1165
+ var MIN_REDEMPTION = 100;
1165
1166
  function createLoyaltyRoutes() {
1166
1167
  const state = { total: 5200, current: 1500, redeemed: 3700 };
1167
1168
  return {
@@ -1174,7 +1175,13 @@ function createLoyaltyRoutes() {
1174
1175
  lifetime_wagered: 125e4,
1175
1176
  lifetime_deposited: 8e5,
1176
1177
  tier_benefits_json: JSON.stringify({ cashback_percent: 5, perks: ["vip_support"] }),
1177
- tier_expires_at: "2027-01-01T00:00:00Z"
1178
+ tier_expires_at: "2027-01-01T00:00:00Z",
1179
+ available: true,
1180
+ program_active: true,
1181
+ history_available: true,
1182
+ min_redemption: MIN_REDEMPTION,
1183
+ point_value_cents: POINT_VALUE_CENTS,
1184
+ ...state.current >= MIN_REDEMPTION ? { can_redeem: true, redemption_currency: "BRL", redemption_decimal_places: 2 } : { can_redeem: false }
1178
1185
  }),
1179
1186
  "POST /api/v1/loyalty/redeem": (req) => {
1180
1187
  const body = req.body ?? {};
@@ -1184,6 +1191,7 @@ function createLoyaltyRoutes() {
1184
1191
  if (typeof body.redemption_type !== "string" || body.redemption_type === "")
1185
1192
  return fail(400, "INVALID_ARGUMENT", "redemption_type is required");
1186
1193
  if (points > state.current) return fail(422, "INSUFFICIENT_BALANCE", "insufficient loyalty points");
1194
+ if (points < MIN_REDEMPTION) return fail(422, "FAILED_PRECONDITION", "below the minimum redemption");
1187
1195
  state.current -= points;
1188
1196
  state.redeemed += points;
1189
1197
  const bonus = body.redemption_type === "bonus";
@@ -1191,7 +1199,9 @@ function createLoyaltyRoutes() {
1191
1199
  success: true,
1192
1200
  redeemed_points: points,
1193
1201
  value: points * POINT_VALUE_CENTS,
1202
+ value_minor: String(points * POINT_VALUE_CENTS),
1194
1203
  currency: "BRL",
1204
+ currency_decimal_places: 2,
1195
1205
  ...bonus ? { bonus_id: `mock-loyalty-bonus-${state.redeemed}` } : {}
1196
1206
  });
1197
1207
  }
@@ -1265,6 +1275,43 @@ var USER_MISSIONS = [
1265
1275
  completed_at: "2026-10-02T15:30:00Z"
1266
1276
  }
1267
1277
  ];
1278
+ var HISTORY_FIELDS = {
1279
+ "mock-mission-1": { description: "Descri\xE7\xE3o da miss\xE3o 1", mission_type: "daily", objective_type: "wager" },
1280
+ "mock-mission-4": { description: "Descri\xE7\xE3o da miss\xE3o 4", mission_type: "permanent", objective_type: "deposit" }
1281
+ };
1282
+ var PAST_MISSION = {
1283
+ id: "mock-user-mission-0",
1284
+ mission_id: "mock-mission-0",
1285
+ mission_name: "Semana de boas-vindas",
1286
+ current_progress: 3,
1287
+ target_value: 3,
1288
+ progress_percentage: 100,
1289
+ status: "claimed",
1290
+ reward_type: "points",
1291
+ reward_value: 200,
1292
+ completed_at: "2026-09-20T18:00:00Z",
1293
+ claimed_at: "2026-09-20T18:00:05Z",
1294
+ offer_active: false,
1295
+ target_game_category: "",
1296
+ description: "Fa\xE7a 3 dep\xF3sitos na semana",
1297
+ mission_type: "weekly",
1298
+ objective_type: "deposit"
1299
+ };
1300
+ function myMissions(req) {
1301
+ if (req.url.searchParams.get("include_history") !== "true") return ok({ missions: USER_MISSIONS });
1302
+ const missions = USER_MISSIONS.map((row) => ({
1303
+ ...row,
1304
+ offer_active: true,
1305
+ target_game_category: "",
1306
+ ...HISTORY_FIELDS[row.mission_id]
1307
+ }));
1308
+ return ok({
1309
+ missions: [...missions, PAST_MISSION],
1310
+ available: true,
1311
+ offers_available: true,
1312
+ history_available: true
1313
+ });
1314
+ }
1268
1315
  function json2(body) {
1269
1316
  return new Response(JSON.stringify(body), { status: 200, headers: { "content-type": "application/json" } });
1270
1317
  }
@@ -1282,7 +1329,7 @@ function listMissions(req) {
1282
1329
  function createMissionsRoutes() {
1283
1330
  return {
1284
1331
  "GET /api/v1/missions": listMissions,
1285
- "GET /api/v1/my/missions": () => ok({ missions: USER_MISSIONS })
1332
+ "GET /api/v1/my/missions": myMissions
1286
1333
  };
1287
1334
  }
1288
1335
  var money = (minor) => ({ minor_units: String(minor), currency: "BRL" });