playttm 0.0.7 → 0.0.8
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.
- package/dist/lib.js +671 -297
- package/package.json +1 -1
- package/src/lib.ts +746 -387
package/dist/lib.js
CHANGED
|
@@ -399,36 +399,57 @@ class ThaiTicketMajor {
|
|
|
399
399
|
*/
|
|
400
400
|
getRounds(eventUrl) {
|
|
401
401
|
return __awaiter(this, void 0, void 0, function* () {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
var _a, _b;
|
|
403
|
+
this.emitProgress("GET_ROUNDS", `Fetching rounds from ${eventUrl}`, {
|
|
404
|
+
url: eventUrl,
|
|
405
|
+
requestPayload: null,
|
|
405
406
|
});
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
var _a, _b, _c, _d;
|
|
410
|
-
const link = $(el);
|
|
411
|
-
const href = (_a = link.attr("href")) !== null && _a !== void 0 ? _a : "";
|
|
412
|
-
const onclick = (_b = link.attr("onclick")) !== null && _b !== void 0 ? _b : "";
|
|
413
|
-
const dataUrl = (_c = link.attr("data-url")) !== null && _c !== void 0 ? _c : "";
|
|
414
|
-
const dataHref = (_d = link.attr("data-href")) !== null && _d !== void 0 ? _d : "";
|
|
415
|
-
const allLinkAttrs = `${href} ${onclick} ${dataUrl} ${dataHref}`;
|
|
416
|
-
const queryMatch = allLinkAttrs.match(/query=([0-9a-zA-Z_-]+)/);
|
|
417
|
-
const query = queryMatch ? queryMatch[1] : "";
|
|
418
|
-
const time = link.find(".item-show").text().trim();
|
|
419
|
-
const date = link.closest(".row").find(".date").text().trim();
|
|
420
|
-
const isDisabled = link.is(":disabled") || link.attr("disabled") !== undefined || !query;
|
|
421
|
-
rounds.push({
|
|
422
|
-
id: query || link.attr("data-button") || "",
|
|
423
|
-
label: `${date} ${time}`.trim(),
|
|
424
|
-
date,
|
|
425
|
-
time,
|
|
426
|
-
url: href,
|
|
427
|
-
query,
|
|
428
|
-
isDisabled,
|
|
407
|
+
try {
|
|
408
|
+
const response = yield this.client.get(eventUrl, {
|
|
409
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { referer: "https://www.thaiticketmajor.com/all-event/" }),
|
|
429
410
|
});
|
|
430
|
-
|
|
431
|
-
|
|
411
|
+
const $ = cheerio.load(response.data);
|
|
412
|
+
const rounds = [];
|
|
413
|
+
$("a[data-button]").each((_, el) => {
|
|
414
|
+
var _a, _b, _c, _d;
|
|
415
|
+
const link = $(el);
|
|
416
|
+
const href = (_a = link.attr("href")) !== null && _a !== void 0 ? _a : "";
|
|
417
|
+
const onclick = (_b = link.attr("onclick")) !== null && _b !== void 0 ? _b : "";
|
|
418
|
+
const dataUrl = (_c = link.attr("data-url")) !== null && _c !== void 0 ? _c : "";
|
|
419
|
+
const dataHref = (_d = link.attr("data-href")) !== null && _d !== void 0 ? _d : "";
|
|
420
|
+
const allLinkAttrs = `${href} ${onclick} ${dataUrl} ${dataHref}`;
|
|
421
|
+
const queryMatch = allLinkAttrs.match(/query=([0-9a-zA-Z_-]+)/);
|
|
422
|
+
const query = queryMatch ? queryMatch[1] : "";
|
|
423
|
+
const time = link.find(".item-show").text().trim();
|
|
424
|
+
const date = link.closest(".row").find(".date").text().trim();
|
|
425
|
+
const isDisabled = link.is(":disabled") || link.attr("disabled") !== undefined || !query;
|
|
426
|
+
rounds.push({
|
|
427
|
+
id: query || link.attr("data-button") || "",
|
|
428
|
+
label: `${date} ${time}`.trim(),
|
|
429
|
+
date,
|
|
430
|
+
time,
|
|
431
|
+
url: href,
|
|
432
|
+
query,
|
|
433
|
+
isDisabled,
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
this.emitProgress("GET_ROUNDS_RES", `Found ${rounds.length} rounds`, {
|
|
437
|
+
url: eventUrl,
|
|
438
|
+
requestPayload: null,
|
|
439
|
+
responseStatus: response.status,
|
|
440
|
+
responseData: rounds,
|
|
441
|
+
});
|
|
442
|
+
return rounds;
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
this.emitProgress("GET_ROUNDS_ERR", `Failed to fetch rounds: ${err.message}`, {
|
|
446
|
+
url: eventUrl,
|
|
447
|
+
requestPayload: null,
|
|
448
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
449
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
450
|
+
});
|
|
451
|
+
throw err;
|
|
452
|
+
}
|
|
432
453
|
});
|
|
433
454
|
}
|
|
434
455
|
/**
|
|
@@ -436,17 +457,40 @@ class ThaiTicketMajor {
|
|
|
436
457
|
*/
|
|
437
458
|
verifyCheckCondition(query) {
|
|
438
459
|
return __awaiter(this, void 0, void 0, function* () {
|
|
460
|
+
var _a, _b, _c;
|
|
439
461
|
if (!query) {
|
|
440
462
|
throw new Error("Query ID is missing. The selected round might be disabled or not open for sale yet.");
|
|
441
463
|
}
|
|
442
|
-
|
|
443
|
-
const
|
|
464
|
+
const url = `${this.endpoint}/verify_checkcondition.php`;
|
|
465
|
+
const payload = {
|
|
444
466
|
rdagree: "1",
|
|
445
467
|
rdId: "",
|
|
446
468
|
autopopup: "",
|
|
447
469
|
query: query,
|
|
448
|
-
}
|
|
449
|
-
|
|
470
|
+
};
|
|
471
|
+
this.emitProgress("VERIFY_CONDITION", `Verifying condition for query ${query}`, {
|
|
472
|
+
url,
|
|
473
|
+
requestPayload: payload,
|
|
474
|
+
});
|
|
475
|
+
try {
|
|
476
|
+
const response = yield this.client.post(url, new URLSearchParams(payload), { headers: this.defaultHeaders });
|
|
477
|
+
this.emitProgress("VERIFY_CONDITION_RES", `Condition check: ${((_a = response.data) === null || _a === void 0 ? void 0 : _a.result) ? "PASS" : "FAIL"}`, {
|
|
478
|
+
url,
|
|
479
|
+
requestPayload: payload,
|
|
480
|
+
responseStatus: response.status,
|
|
481
|
+
responseData: response.data,
|
|
482
|
+
});
|
|
483
|
+
return response.data;
|
|
484
|
+
}
|
|
485
|
+
catch (err) {
|
|
486
|
+
this.emitProgress("VERIFY_CONDITION_ERR", `Condition check error: ${err.message}`, {
|
|
487
|
+
url,
|
|
488
|
+
requestPayload: payload,
|
|
489
|
+
responseStatus: (_b = err.response) === null || _b === void 0 ? void 0 : _b.status,
|
|
490
|
+
responseData: ((_c = err.response) === null || _c === void 0 ? void 0 : _c.data) || err.message,
|
|
491
|
+
});
|
|
492
|
+
throw err;
|
|
493
|
+
}
|
|
450
494
|
});
|
|
451
495
|
}
|
|
452
496
|
/**
|
|
@@ -454,38 +498,61 @@ class ThaiTicketMajor {
|
|
|
454
498
|
*/
|
|
455
499
|
getZones(query) {
|
|
456
500
|
return __awaiter(this, void 0, void 0, function* () {
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const rawInputs = {};
|
|
463
|
-
$("#frm input[type='hidden']").each((_, el) => {
|
|
464
|
-
var _a;
|
|
465
|
-
const name = $(el).attr("name");
|
|
466
|
-
const value = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
467
|
-
if (name) {
|
|
468
|
-
rawInputs[name] = value;
|
|
469
|
-
}
|
|
501
|
+
var _a, _b;
|
|
502
|
+
const url = `${this.endpoint}/zones.php?query=${query}`;
|
|
503
|
+
this.emitProgress("GET_ZONES", `Fetching zone data and tokens for query ${query}`, {
|
|
504
|
+
url,
|
|
505
|
+
requestPayload: { query },
|
|
470
506
|
});
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
507
|
+
try {
|
|
508
|
+
const response = yield this.client.get(url, {
|
|
509
|
+
headers: this.defaultHeaders,
|
|
510
|
+
});
|
|
511
|
+
const $ = cheerio.load(response.data);
|
|
512
|
+
const rawInputs = {};
|
|
513
|
+
$("#frm input[type='hidden']").each((_, el) => {
|
|
514
|
+
var _a;
|
|
515
|
+
const name = $(el).attr("name");
|
|
516
|
+
const value = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
517
|
+
if (name) {
|
|
518
|
+
rawInputs[name] = value;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
const rounds = $("#rdId option")
|
|
522
|
+
.filter((_, el) => !!$(el).attr("value"))
|
|
523
|
+
.map((_, el) => {
|
|
524
|
+
var _a;
|
|
525
|
+
const opt = $(el);
|
|
526
|
+
return {
|
|
527
|
+
id: (_a = opt.attr("value")) !== null && _a !== void 0 ? _a : "",
|
|
528
|
+
label: opt.text().trim(),
|
|
529
|
+
};
|
|
530
|
+
})
|
|
531
|
+
.get();
|
|
532
|
+
const result = {
|
|
533
|
+
k: rawInputs["k"] || "",
|
|
534
|
+
tk: rawInputs["tk"] || "",
|
|
535
|
+
query,
|
|
536
|
+
rounds,
|
|
537
|
+
rawInputs,
|
|
479
538
|
};
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
539
|
+
this.emitProgress("GET_ZONES_RES", `Extracted tokens k=${result.k ? result.k.slice(0, 10) + '...' : 'none'} and ${rounds.length} rounds`, {
|
|
540
|
+
url,
|
|
541
|
+
requestPayload: { query },
|
|
542
|
+
responseStatus: response.status,
|
|
543
|
+
responseData: result,
|
|
544
|
+
});
|
|
545
|
+
return result;
|
|
546
|
+
}
|
|
547
|
+
catch (err) {
|
|
548
|
+
this.emitProgress("GET_ZONES_ERR", `Failed to get zones: ${err.message}`, {
|
|
549
|
+
url,
|
|
550
|
+
requestPayload: { query },
|
|
551
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
552
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
553
|
+
});
|
|
554
|
+
throw err;
|
|
555
|
+
}
|
|
489
556
|
});
|
|
490
557
|
}
|
|
491
558
|
/**
|
|
@@ -493,43 +560,65 @@ class ThaiTicketMajor {
|
|
|
493
560
|
*/
|
|
494
561
|
getZoneAvailability(roundId, tk, k, query) {
|
|
495
562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
|
|
563
|
+
var _a, _b;
|
|
564
|
+
const url = `${this.endpoint}/zonesavail.php?round=${roundId}&tk=${tk}`;
|
|
565
|
+
this.emitProgress("GET_ZONE_AVAIL", `Checking zone availability for round ${roundId}`, {
|
|
566
|
+
url,
|
|
567
|
+
requestPayload: { roundId, tk, query },
|
|
499
568
|
});
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
if (!Number.isNaN(num) && num > 0) {
|
|
520
|
-
available = num;
|
|
569
|
+
try {
|
|
570
|
+
const response = yield this.client.get(url, {
|
|
571
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { referer: `${this.endpoint}/zones.php?query=${query}` }),
|
|
572
|
+
});
|
|
573
|
+
const $ = cheerio.load(response.data);
|
|
574
|
+
const zones = [];
|
|
575
|
+
$(".table tbody tr").each((_, el) => {
|
|
576
|
+
var _a, _b, _c, _d;
|
|
577
|
+
const row = $(el);
|
|
578
|
+
const zoneId = (_a = row.find("td:nth-child(1) a").attr("id")) !== null && _a !== void 0 ? _a : "";
|
|
579
|
+
const onclick = (_b = row.attr("onclick")) !== null && _b !== void 0 ? _b : "";
|
|
580
|
+
const match = onclick.match(/gonextstep\('([^']+)','([^']+)'/);
|
|
581
|
+
const page = ((_c = match === null || match === void 0 ? void 0 : match[1]) !== null && _c !== void 0 ? _c : "");
|
|
582
|
+
const zoneValue = (_d = match === null || match === void 0 ? void 0 : match[2]) !== null && _d !== void 0 ? _d : "";
|
|
583
|
+
const statusText = row.find("td:nth-child(2) a").text().trim();
|
|
584
|
+
let available = 0;
|
|
585
|
+
let isAvailable = false;
|
|
586
|
+
if (statusText.toLowerCase() === "available") {
|
|
587
|
+
available = 1;
|
|
521
588
|
isAvailable = true;
|
|
522
589
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
590
|
+
else {
|
|
591
|
+
const num = Number(statusText);
|
|
592
|
+
if (!Number.isNaN(num) && num > 0) {
|
|
593
|
+
available = num;
|
|
594
|
+
isAvailable = true;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
zones.push({
|
|
598
|
+
id: zoneId,
|
|
599
|
+
value: zoneValue,
|
|
600
|
+
available,
|
|
601
|
+
page,
|
|
602
|
+
isAvailable,
|
|
603
|
+
});
|
|
530
604
|
});
|
|
531
|
-
|
|
532
|
-
|
|
605
|
+
this.emitProgress("GET_ZONE_AVAIL_RES", `Found ${zones.length} zones (${zones.filter(z => z.isAvailable).length} available)`, {
|
|
606
|
+
url,
|
|
607
|
+
requestPayload: { roundId, tk, query },
|
|
608
|
+
responseStatus: response.status,
|
|
609
|
+
responseData: zones,
|
|
610
|
+
});
|
|
611
|
+
return zones;
|
|
612
|
+
}
|
|
613
|
+
catch (err) {
|
|
614
|
+
this.emitProgress("GET_ZONE_AVAIL_ERR", `Failed to check zone availability: ${err.message}`, {
|
|
615
|
+
url,
|
|
616
|
+
requestPayload: { roundId, tk, query },
|
|
617
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
618
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
619
|
+
});
|
|
620
|
+
throw err;
|
|
621
|
+
}
|
|
533
622
|
});
|
|
534
623
|
}
|
|
535
624
|
// --- Flow บัตรนั่ง (Fixed Seats) ---
|
|
@@ -538,31 +627,57 @@ class ThaiTicketMajor {
|
|
|
538
627
|
*/
|
|
539
628
|
getFixedSeats(k, zone, roundId) {
|
|
540
629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
541
|
-
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const seats = $("#tableseats .seatuncheck")
|
|
547
|
-
.map((_, el) => {
|
|
548
|
-
var _a, _b, _c;
|
|
549
|
-
const seat = $(el);
|
|
550
|
-
return {
|
|
551
|
-
id: (_a = seat.attr("id")) !== null && _a !== void 0 ? _a : "",
|
|
552
|
-
seat: (_b = seat.attr("data-seat")) !== null && _b !== void 0 ? _b : "",
|
|
553
|
-
seatk: (_c = seat.attr("data-seatk")) !== null && _c !== void 0 ? _c : "",
|
|
554
|
-
};
|
|
555
|
-
})
|
|
556
|
-
.get();
|
|
557
|
-
const form = {};
|
|
558
|
-
$("#frmPayment input").each((_, el) => {
|
|
559
|
-
var _a;
|
|
560
|
-
const name = $(el).attr("name");
|
|
561
|
-
if (name) {
|
|
562
|
-
form[name] = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
563
|
-
}
|
|
630
|
+
var _a, _b;
|
|
631
|
+
const url = `${this.endpoint}/fixed.php?k=${k}&zone=${zone}&round=${roundId}`;
|
|
632
|
+
this.emitProgress("GET_FIXED_SEATS", `Fetching seat layout for zone ${zone}`, {
|
|
633
|
+
url,
|
|
634
|
+
requestPayload: { k, zone, roundId },
|
|
564
635
|
});
|
|
565
|
-
|
|
636
|
+
try {
|
|
637
|
+
const response = yield this.client.get(url, {
|
|
638
|
+
headers: this.defaultHeaders,
|
|
639
|
+
});
|
|
640
|
+
const $ = cheerio.load(response.data);
|
|
641
|
+
const seats = $("#tableseats .seatuncheck")
|
|
642
|
+
.map((_, el) => {
|
|
643
|
+
var _a, _b, _c;
|
|
644
|
+
const seat = $(el);
|
|
645
|
+
return {
|
|
646
|
+
id: (_a = seat.attr("id")) !== null && _a !== void 0 ? _a : "",
|
|
647
|
+
seat: (_b = seat.attr("data-seat")) !== null && _b !== void 0 ? _b : "",
|
|
648
|
+
seatk: (_c = seat.attr("data-seatk")) !== null && _c !== void 0 ? _c : "",
|
|
649
|
+
};
|
|
650
|
+
})
|
|
651
|
+
.get();
|
|
652
|
+
const form = {};
|
|
653
|
+
$("#frmPayment input").each((_, el) => {
|
|
654
|
+
var _a;
|
|
655
|
+
const name = $(el).attr("name");
|
|
656
|
+
if (name) {
|
|
657
|
+
form[name] = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
this.emitProgress("GET_FIXED_SEATS_RES", `Found ${seats.length} available seats in zone ${zone}`, {
|
|
661
|
+
url,
|
|
662
|
+
requestPayload: { k, zone, roundId },
|
|
663
|
+
responseStatus: response.status,
|
|
664
|
+
responseData: {
|
|
665
|
+
seatsCount: seats.length,
|
|
666
|
+
seatsSample: seats.slice(0, 10),
|
|
667
|
+
form,
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
return { seats, form };
|
|
671
|
+
}
|
|
672
|
+
catch (err) {
|
|
673
|
+
this.emitProgress("GET_FIXED_SEATS_ERR", `Failed to get fixed seats: ${err.message}`, {
|
|
674
|
+
url,
|
|
675
|
+
requestPayload: { k, zone, roundId },
|
|
676
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
677
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
678
|
+
});
|
|
679
|
+
throw err;
|
|
680
|
+
}
|
|
566
681
|
});
|
|
567
682
|
}
|
|
568
683
|
/**
|
|
@@ -570,7 +685,8 @@ class ThaiTicketMajor {
|
|
|
570
685
|
*/
|
|
571
686
|
validateFixedSeats(k_1, zone_1, payload_1, chkSeats_1) {
|
|
572
687
|
return __awaiter(this, arguments, void 0, function* (k, zone, payload, chkSeats, bookType = "fix") {
|
|
573
|
-
var _a, _b
|
|
688
|
+
var _a, _b;
|
|
689
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
574
690
|
this.emitProgress("VALIDATE_FIXED_SEATS", `Validating ${chkSeats.length} fixed seats`);
|
|
575
691
|
let lastResponse = null;
|
|
576
692
|
const accumulatedSeats = [];
|
|
@@ -583,27 +699,27 @@ class ThaiTicketMajor {
|
|
|
583
699
|
for (const seat of accumulatedSeats) {
|
|
584
700
|
formData.append("chkSeats[]", seat);
|
|
585
701
|
}
|
|
586
|
-
formData.append("ehId", (
|
|
587
|
-
formData.append("curentdate", (
|
|
588
|
-
formData.append("max_payment", (
|
|
589
|
-
formData.append("payment_cnt", (
|
|
590
|
-
formData.append("paytype", (
|
|
591
|
-
formData.append("performance", (
|
|
702
|
+
formData.append("ehId", (_c = payload.ehId) !== null && _c !== void 0 ? _c : "");
|
|
703
|
+
formData.append("curentdate", (_d = payload.curentdate) !== null && _d !== void 0 ? _d : "");
|
|
704
|
+
formData.append("max_payment", (_e = payload.max_payment) !== null && _e !== void 0 ? _e : "6");
|
|
705
|
+
formData.append("payment_cnt", (_f = payload.payment_cnt) !== null && _f !== void 0 ? _f : "0");
|
|
706
|
+
formData.append("paytype", (_g = payload.paytype) !== null && _g !== void 0 ? _g : "BOAI");
|
|
707
|
+
formData.append("performance", (_h = payload.performance) !== null && _h !== void 0 ? _h : "");
|
|
592
708
|
formData.append("pricelist", "");
|
|
593
|
-
formData.append("rdId", (
|
|
709
|
+
formData.append("rdId", (_j = payload.rdId) !== null && _j !== void 0 ? _j : "");
|
|
594
710
|
formData.append("seatlist", "");
|
|
595
|
-
formData.append("showdate", (
|
|
596
|
-
formData.append("showtime", (
|
|
597
|
-
formData.append("venue", (
|
|
598
|
-
formData.append("zone", (
|
|
599
|
-
formData.append("zoneDesc", (
|
|
711
|
+
formData.append("showdate", (_k = payload.showdate) !== null && _k !== void 0 ? _k : "");
|
|
712
|
+
formData.append("showtime", (_l = payload.showtime) !== null && _l !== void 0 ? _l : "");
|
|
713
|
+
formData.append("venue", (_m = payload.venue) !== null && _m !== void 0 ? _m : "");
|
|
714
|
+
formData.append("zone", (_o = payload.zone) !== null && _o !== void 0 ? _o : "");
|
|
715
|
+
formData.append("zoneDesc", (_p = payload.zoneDesc) !== null && _p !== void 0 ? _p : "");
|
|
600
716
|
formData.append("travelChild1", "");
|
|
601
717
|
formData.append("travelChild2", "");
|
|
602
718
|
formData.append("travelChild2", "");
|
|
603
|
-
formData.append("enroll_val", (
|
|
604
|
-
formData.append("dval", (
|
|
605
|
-
formData.append("companyid", (
|
|
606
|
-
formData.append("ks", (
|
|
719
|
+
formData.append("enroll_val", (_q = payload.enroll_val) !== null && _q !== void 0 ? _q : "");
|
|
720
|
+
formData.append("dval", (_r = payload.dval) !== null && _r !== void 0 ? _r : "");
|
|
721
|
+
formData.append("companyid", (_s = payload.companyid) !== null && _s !== void 0 ? _s : "");
|
|
722
|
+
formData.append("ks", (_t = payload.ks) !== null && _t !== void 0 ? _t : "");
|
|
607
723
|
formData.append("inclvat", "");
|
|
608
724
|
const seatParts = currentSeat.seat.split("-");
|
|
609
725
|
const row = seatParts[0];
|
|
@@ -611,12 +727,31 @@ class ThaiTicketMajor {
|
|
|
611
727
|
formData.append("row", row);
|
|
612
728
|
formData.append("seat", seatNo);
|
|
613
729
|
formData.append("book_type", bookType);
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
730
|
+
const url = `${this.endpoint}/validateseat.php?k=${k}&zw=${zone}`;
|
|
731
|
+
const reqPayloadObj = Object.fromEntries(formData.entries());
|
|
732
|
+
try {
|
|
733
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
734
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/fixed.php?k=${k}&zone=${payload.zone}&round=${payload.rdId}` }),
|
|
735
|
+
});
|
|
736
|
+
lastResponse = response.data;
|
|
737
|
+
this.emitProgress("VALIDATE_FIXED_SEATS_RES", `Seat validated (${currentSeat.seat}): ${(lastResponse === null || lastResponse === void 0 ? void 0 : lastResponse.result) ? "SUCCESS" : "FAIL"}`, {
|
|
738
|
+
url,
|
|
739
|
+
requestPayload: reqPayloadObj,
|
|
740
|
+
responseStatus: response.status,
|
|
741
|
+
responseData: lastResponse,
|
|
742
|
+
});
|
|
743
|
+
if (!lastResponse.result) {
|
|
744
|
+
throw new Error(`Validate seat failed (${currentSeat.seat}): ${lastResponse.message || "Unknown error"}`);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
catch (err) {
|
|
748
|
+
this.emitProgress("VALIDATE_FIXED_SEATS_ERR", `Validate seat failed (${currentSeat.seat}): ${err.message}`, {
|
|
749
|
+
url,
|
|
750
|
+
requestPayload: reqPayloadObj,
|
|
751
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
752
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
753
|
+
});
|
|
754
|
+
throw err;
|
|
620
755
|
}
|
|
621
756
|
}
|
|
622
757
|
return lastResponse;
|
|
@@ -627,6 +762,7 @@ class ThaiTicketMajor {
|
|
|
627
762
|
*/
|
|
628
763
|
bookFixedSeats(k, payload, seats) {
|
|
629
764
|
return __awaiter(this, void 0, void 0, function* () {
|
|
765
|
+
var _a, _b;
|
|
630
766
|
this.emitProgress("BOOK_FIXED_SEATS", `Booking fixed seats`);
|
|
631
767
|
let pricelistvalue = "";
|
|
632
768
|
let seatlistvalue = "";
|
|
@@ -661,13 +797,32 @@ class ThaiTicketMajor {
|
|
|
661
797
|
bodyParams.set("ks", "");
|
|
662
798
|
bodyParams.set("inclvat", "");
|
|
663
799
|
bodyParams.set("seatklist", seatklistvalue);
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
800
|
+
const url = `${this.endpoint}/bookingseats.php?k=${k}`;
|
|
801
|
+
const reqPayloadObj = Object.fromEntries(bodyParams.entries());
|
|
802
|
+
try {
|
|
803
|
+
const response = yield this.client.post(url, bodyParams.toString(), {
|
|
804
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { accept: "application/json, text/javascript, */*; q=0.01", "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/fixed.php?k=${k}&zone=${payload.zone}&round=${payload.rdId}`, origin: "https://booking.thaiticketmajor.com" }),
|
|
805
|
+
});
|
|
806
|
+
this.emitProgress("BOOK_FIXED_SEATS_RES", `Book fixed seats completed`, {
|
|
807
|
+
url,
|
|
808
|
+
requestPayload: reqPayloadObj,
|
|
809
|
+
responseStatus: response.status,
|
|
810
|
+
responseData: response.data,
|
|
811
|
+
});
|
|
812
|
+
return {
|
|
813
|
+
data: response.data,
|
|
814
|
+
nextPayload: bodyParams,
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
catch (err) {
|
|
818
|
+
this.emitProgress("BOOK_FIXED_SEATS_ERR", `Booking seats error: ${err.message}`, {
|
|
819
|
+
url,
|
|
820
|
+
requestPayload: reqPayloadObj,
|
|
821
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
822
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
823
|
+
});
|
|
824
|
+
throw err;
|
|
825
|
+
}
|
|
671
826
|
});
|
|
672
827
|
}
|
|
673
828
|
// --- Flow บัตรยืน (Festival / Standing) ---
|
|
@@ -676,20 +831,42 @@ class ThaiTicketMajor {
|
|
|
676
831
|
*/
|
|
677
832
|
getFestival(k, tk, query, zone, roundId) {
|
|
678
833
|
return __awaiter(this, void 0, void 0, function* () {
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const formData = {};
|
|
685
|
-
$("#frm input").each((_, el) => {
|
|
686
|
-
var _a;
|
|
687
|
-
const name = $(el).attr("name");
|
|
688
|
-
if (name) {
|
|
689
|
-
formData[name] = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
690
|
-
}
|
|
834
|
+
var _a, _b;
|
|
835
|
+
const url = `${this.endpoint}/festival.php?k=${k}&zone=${zone}&round=${roundId}`;
|
|
836
|
+
this.emitProgress("GET_FESTIVAL", `Fetching festival zone ${zone}`, {
|
|
837
|
+
url,
|
|
838
|
+
requestPayload: { k, tk, query, zone, roundId },
|
|
691
839
|
});
|
|
692
|
-
|
|
840
|
+
try {
|
|
841
|
+
const response = yield this.client.get(url, {
|
|
842
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { referer: `${this.endpoint}/zones.php?rdId=${roundId}&k=${k}&tk=${tk}&query=${query}` }),
|
|
843
|
+
});
|
|
844
|
+
const $ = cheerio.load(response.data);
|
|
845
|
+
const formData = {};
|
|
846
|
+
$("#frm input").each((_, el) => {
|
|
847
|
+
var _a;
|
|
848
|
+
const name = $(el).attr("name");
|
|
849
|
+
if (name) {
|
|
850
|
+
formData[name] = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
this.emitProgress("GET_FESTIVAL_RES", `Loaded festival form (${Object.keys(formData).length} fields)`, {
|
|
854
|
+
url,
|
|
855
|
+
requestPayload: { k, tk, query, zone, roundId },
|
|
856
|
+
responseStatus: response.status,
|
|
857
|
+
responseData: formData,
|
|
858
|
+
});
|
|
859
|
+
return formData;
|
|
860
|
+
}
|
|
861
|
+
catch (err) {
|
|
862
|
+
this.emitProgress("GET_FESTIVAL_ERR", `Failed to get festival page: ${err.message}`, {
|
|
863
|
+
url,
|
|
864
|
+
requestPayload: { k, tk, query, zone, roundId },
|
|
865
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
866
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
867
|
+
});
|
|
868
|
+
throw err;
|
|
869
|
+
}
|
|
693
870
|
});
|
|
694
871
|
}
|
|
695
872
|
/**
|
|
@@ -697,13 +874,32 @@ class ThaiTicketMajor {
|
|
|
697
874
|
*/
|
|
698
875
|
validateFestivalSeats(k, payload, ticketCount) {
|
|
699
876
|
return __awaiter(this, void 0, void 0, function* () {
|
|
877
|
+
var _a, _b, _c;
|
|
700
878
|
this.emitProgress("VALIDATE_FESTIVAL", `Validating ${ticketCount} festival tickets`);
|
|
701
879
|
const preparePayload = Object.assign(Object.assign({}, payload), { book_cnt: ticketCount.toString(), book_type: "fest" });
|
|
702
880
|
const formData = new URLSearchParams(preparePayload);
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
881
|
+
const url = `${this.endpoint}/validateseat.php?k=${k}&zw=${payload.zone}`;
|
|
882
|
+
try {
|
|
883
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
884
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/festival.php?k=${k}&zone=${payload.zone}&round=${payload.rdId}` }),
|
|
885
|
+
});
|
|
886
|
+
this.emitProgress("VALIDATE_FESTIVAL_RES", `Validate festival tickets: ${((_a = response.data) === null || _a === void 0 ? void 0 : _a.result) ? "SUCCESS" : "FAIL"}`, {
|
|
887
|
+
url,
|
|
888
|
+
requestPayload: preparePayload,
|
|
889
|
+
responseStatus: response.status,
|
|
890
|
+
responseData: response.data,
|
|
891
|
+
});
|
|
892
|
+
return response.data;
|
|
893
|
+
}
|
|
894
|
+
catch (err) {
|
|
895
|
+
this.emitProgress("VALIDATE_FESTIVAL_ERR", `Validate festival error: ${err.message}`, {
|
|
896
|
+
url,
|
|
897
|
+
requestPayload: preparePayload,
|
|
898
|
+
responseStatus: (_b = err.response) === null || _b === void 0 ? void 0 : _b.status,
|
|
899
|
+
responseData: ((_c = err.response) === null || _c === void 0 ? void 0 : _c.data) || err.message,
|
|
900
|
+
});
|
|
901
|
+
throw err;
|
|
902
|
+
}
|
|
707
903
|
});
|
|
708
904
|
}
|
|
709
905
|
/**
|
|
@@ -711,13 +907,32 @@ class ThaiTicketMajor {
|
|
|
711
907
|
*/
|
|
712
908
|
bookFestivalSeats(k, payload, ticketCount) {
|
|
713
909
|
return __awaiter(this, void 0, void 0, function* () {
|
|
910
|
+
var _a, _b;
|
|
714
911
|
this.emitProgress("BOOK_FESTIVAL", `Booking ${ticketCount} festival tickets`);
|
|
715
912
|
const preparePayload = Object.assign(Object.assign({}, payload), { book_cnt: ticketCount.toString() });
|
|
716
913
|
const formData = new URLSearchParams(preparePayload);
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
914
|
+
const url = `${this.endpoint}/bookingfestival.php?k=${k}`;
|
|
915
|
+
try {
|
|
916
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
917
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/festival.php?k=${k}&zone=${payload.zone}&round=${payload.rdId}` }),
|
|
918
|
+
});
|
|
919
|
+
this.emitProgress("BOOK_FESTIVAL_RES", `Book festival tickets completed`, {
|
|
920
|
+
url,
|
|
921
|
+
requestPayload: preparePayload,
|
|
922
|
+
responseStatus: response.status,
|
|
923
|
+
responseData: response.data,
|
|
924
|
+
});
|
|
925
|
+
return response.data;
|
|
926
|
+
}
|
|
927
|
+
catch (err) {
|
|
928
|
+
this.emitProgress("BOOK_FESTIVAL_ERR", `Book festival error: ${err.message}`, {
|
|
929
|
+
url,
|
|
930
|
+
requestPayload: preparePayload,
|
|
931
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
932
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
933
|
+
});
|
|
934
|
+
throw err;
|
|
935
|
+
}
|
|
721
936
|
});
|
|
722
937
|
}
|
|
723
938
|
// --- Flow การลงทะเบียนผู้เข้าชม (Enrollment) ---
|
|
@@ -726,20 +941,42 @@ class ThaiTicketMajor {
|
|
|
726
941
|
*/
|
|
727
942
|
enroll(k, zone, roundId, payload) {
|
|
728
943
|
return __awaiter(this, void 0, void 0, function* () {
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const formData = {};
|
|
735
|
-
$("#form input, #form select").each((_, el) => {
|
|
736
|
-
var _a, _b;
|
|
737
|
-
const name = $(el).attr("name");
|
|
738
|
-
if (name) {
|
|
739
|
-
formData[name] = (_b = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : $(el).find("option:selected").attr("value")) !== null && _b !== void 0 ? _b : "";
|
|
740
|
-
}
|
|
944
|
+
var _a, _b;
|
|
945
|
+
const url = `${this.endpoint}/enroll.php?k=${k}&zone=${zone}&round=${roundId}`;
|
|
946
|
+
this.emitProgress("GET_ENROLL", `Fetching enrollment form`, {
|
|
947
|
+
url,
|
|
948
|
+
requestPayload: payload.toString(),
|
|
741
949
|
});
|
|
742
|
-
|
|
950
|
+
try {
|
|
951
|
+
const response = yield this.client.post(url, payload.toString(), {
|
|
952
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { referer: `${this.endpoint}/fixed.php?k=${k}&zone=${zone}&round=${roundId}` }),
|
|
953
|
+
});
|
|
954
|
+
const $ = cheerio.load(response.data);
|
|
955
|
+
const formData = {};
|
|
956
|
+
$("#form input, #form select").each((_, el) => {
|
|
957
|
+
var _a, _b;
|
|
958
|
+
const name = $(el).attr("name");
|
|
959
|
+
if (name) {
|
|
960
|
+
formData[name] = (_b = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : $(el).find("option:selected").attr("value")) !== null && _b !== void 0 ? _b : "";
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
this.emitProgress("GET_ENROLL_RES", `Loaded enrollment form (${Object.keys(formData).length} fields)`, {
|
|
964
|
+
url,
|
|
965
|
+
requestPayload: payload.toString(),
|
|
966
|
+
responseStatus: response.status,
|
|
967
|
+
responseData: formData,
|
|
968
|
+
});
|
|
969
|
+
return formData;
|
|
970
|
+
}
|
|
971
|
+
catch (err) {
|
|
972
|
+
this.emitProgress("GET_ENROLL_ERR", `Enroll form error: ${err.message}`, {
|
|
973
|
+
url,
|
|
974
|
+
requestPayload: payload.toString(),
|
|
975
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
976
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
977
|
+
});
|
|
978
|
+
throw err;
|
|
979
|
+
}
|
|
743
980
|
});
|
|
744
981
|
}
|
|
745
982
|
/**
|
|
@@ -747,8 +984,13 @@ class ThaiTicketMajor {
|
|
|
747
984
|
*/
|
|
748
985
|
enrollProcess(k, payload, attendees) {
|
|
749
986
|
return __awaiter(this, void 0, void 0, function* () {
|
|
750
|
-
var _a;
|
|
751
|
-
|
|
987
|
+
var _a, _b;
|
|
988
|
+
var _c;
|
|
989
|
+
const url = `${this.endpoint}/enroll_process.php?k=${k}`;
|
|
990
|
+
this.emitProgress("ENROLL_PROCESS", `Submitting info for ${attendees.length} attendees`, {
|
|
991
|
+
url,
|
|
992
|
+
requestPayload: { attendeesCount: attendees.length, attendees },
|
|
993
|
+
});
|
|
752
994
|
const formData = new URLSearchParams();
|
|
753
995
|
for (const user of attendees) {
|
|
754
996
|
formData.append("txt_fullname[]", user.fullname || "");
|
|
@@ -757,7 +999,7 @@ class ThaiTicketMajor {
|
|
|
757
999
|
formData.append("txt_lastname[]", user.lastname || "");
|
|
758
1000
|
formData.append("txt_phone[]", user.phone || "");
|
|
759
1001
|
formData.append("sel_options[]", user.options || "");
|
|
760
|
-
formData.append("zones[]", (
|
|
1002
|
+
formData.append("zones[]", (_c = payload.zone) !== null && _c !== void 0 ? _c : "");
|
|
761
1003
|
}
|
|
762
1004
|
const excludedKeys = new Set([
|
|
763
1005
|
"txt_fullname[]",
|
|
@@ -773,13 +1015,31 @@ class ThaiTicketMajor {
|
|
|
773
1015
|
formData.append(key, value !== undefined && value !== null ? String(value) : "");
|
|
774
1016
|
}
|
|
775
1017
|
}
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1018
|
+
const reqPayloadObj = Object.fromEntries(formData.entries());
|
|
1019
|
+
try {
|
|
1020
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
1021
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/enroll.php?k=${k}&zone=${payload.zone}&round=${payload.rdId}` }),
|
|
1022
|
+
});
|
|
1023
|
+
this.emitProgress("ENROLL_PROCESS_RES", `Enrollment processed successfully`, {
|
|
1024
|
+
url,
|
|
1025
|
+
requestPayload: reqPayloadObj,
|
|
1026
|
+
responseStatus: response.status,
|
|
1027
|
+
responseData: response.data,
|
|
1028
|
+
});
|
|
1029
|
+
return {
|
|
1030
|
+
data: response.data,
|
|
1031
|
+
nextPayload: formData,
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
catch (err) {
|
|
1035
|
+
this.emitProgress("ENROLL_PROCESS_ERR", `Enrollment error: ${err.message}`, {
|
|
1036
|
+
url,
|
|
1037
|
+
requestPayload: reqPayloadObj,
|
|
1038
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1039
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1040
|
+
});
|
|
1041
|
+
throw err;
|
|
1042
|
+
}
|
|
783
1043
|
});
|
|
784
1044
|
}
|
|
785
1045
|
// --- Flow การชำระเงิน (Payment) ---
|
|
@@ -788,51 +1048,73 @@ class ThaiTicketMajor {
|
|
|
788
1048
|
*/
|
|
789
1049
|
getPaymentDetails(k_1, formData_1, zone_1, roundId_1) {
|
|
790
1050
|
return __awaiter(this, arguments, void 0, function* (k, formData, zone, roundId, delayMs = 1000) {
|
|
791
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
792
|
-
var
|
|
793
|
-
|
|
1051
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1052
|
+
var _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
1053
|
+
const url = `${this.endpoint}/paymentall.php?k=${k}`;
|
|
794
1054
|
const body = formData instanceof URLSearchParams ? formData.toString() : new URLSearchParams(formData).toString();
|
|
795
|
-
const
|
|
796
|
-
|
|
1055
|
+
const reqPayloadObj = formData instanceof URLSearchParams ? Object.fromEntries(formData.entries()) : formData;
|
|
1056
|
+
this.emitProgress("GET_PAYMENT_DETAILS", `Loading payment confirmation page`, {
|
|
1057
|
+
url,
|
|
1058
|
+
requestPayload: reqPayloadObj,
|
|
797
1059
|
});
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
|
|
1060
|
+
try {
|
|
1061
|
+
const response = yield this.client.post(url, body, {
|
|
1062
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/enroll.php?k=${k}&zone=${zone}&round=${roundId}` }),
|
|
1063
|
+
});
|
|
1064
|
+
const $ = cheerio.load(response.data);
|
|
1065
|
+
const hiddenInputs = {};
|
|
1066
|
+
$("#frm-confirm input").each((_, el) => {
|
|
1067
|
+
var _a;
|
|
1068
|
+
var _b, _c;
|
|
1069
|
+
const key = (_b = $(el).attr("name")) !== null && _b !== void 0 ? _b : $(el).attr("id");
|
|
1070
|
+
if (key) {
|
|
1071
|
+
hiddenInputs[key] = (_c = (_a = $(el).val()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _c !== void 0 ? _c : "";
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
const addressForm = $("#frm-address");
|
|
1075
|
+
if (addressForm.length > 0) {
|
|
1076
|
+
const fname = (_m = (_a = addressForm.find("input[name='c_fname_m']").val()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _m !== void 0 ? _m : "";
|
|
1077
|
+
const lname = (_o = (_b = addressForm.find("input[name='c_lname_m']").val()) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _o !== void 0 ? _o : "";
|
|
1078
|
+
const address = (_p = (_c = addressForm.find("textarea[name='c_address_m']").val()) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _p !== void 0 ? _p : "";
|
|
1079
|
+
const ctId = (_q = (_d = addressForm.find("select[name='c_ctCode'] option:selected").val()) === null || _d === void 0 ? void 0 : _d.toString()) !== null && _q !== void 0 ? _q : "";
|
|
1080
|
+
const pvId = (_r = (_e = addressForm.find("select[name='c_pvId'] option:selected").val()) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _r !== void 0 ? _r : "";
|
|
1081
|
+
const amId = (_s = (_f = addressForm.find("select[name='c_amId'] option:selected").val()) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _s !== void 0 ? _s : "";
|
|
1082
|
+
const zipcode = (_t = (_g = addressForm.find("input[name='c_PostCode']").val()) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _t !== void 0 ? _t : "";
|
|
1083
|
+
let rawPhone = (_u = (_h = addressForm.find("input[name='c_ContactRecipient']").val()) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _u !== void 0 ? _u : "";
|
|
1084
|
+
if (rawPhone.startsWith("66")) {
|
|
1085
|
+
rawPhone = rawPhone.slice(2);
|
|
1086
|
+
}
|
|
1087
|
+
const phoneArea = (_v = (_j = addressForm.find("input[name='telephoneArea']").val()) === null || _j === void 0 ? void 0 : _j.toString()) !== null && _v !== void 0 ? _v : "66";
|
|
1088
|
+
hiddenInputs["adr_fname"] = fname;
|
|
1089
|
+
hiddenInputs["adr_lname"] = lname;
|
|
1090
|
+
hiddenInputs["adr_address"] = address;
|
|
1091
|
+
hiddenInputs["adr_ctId"] = ctId;
|
|
1092
|
+
hiddenInputs["adr_pvId"] = pvId;
|
|
1093
|
+
hiddenInputs["adr_amId"] = amId;
|
|
1094
|
+
hiddenInputs["adr_zipcode"] = zipcode;
|
|
1095
|
+
hiddenInputs["adr_mobile"] = rawPhone.replace(/(\d{2})(\d{3})(\d{4})/, "$1 $2 $3");
|
|
1096
|
+
hiddenInputs["adr_mobilearea"] = phoneArea;
|
|
806
1097
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
const amId = (_q = (_f = addressForm.find("select[name='c_amId'] option:selected").val()) === null || _f === void 0 ? void 0 : _f.toString()) !== null && _q !== void 0 ? _q : "";
|
|
816
|
-
const zipcode = (_r = (_g = addressForm.find("input[name='c_PostCode']").val()) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _r !== void 0 ? _r : "";
|
|
817
|
-
let rawPhone = (_s = (_h = addressForm.find("input[name='c_ContactRecipient']").val()) === null || _h === void 0 ? void 0 : _h.toString()) !== null && _s !== void 0 ? _s : "";
|
|
818
|
-
if (rawPhone.startsWith("66")) {
|
|
819
|
-
rawPhone = rawPhone.slice(2);
|
|
1098
|
+
this.emitProgress("GET_PAYMENT_DETAILS_RES", `Loaded payment confirmation details (${Object.keys(hiddenInputs).length} fields)`, {
|
|
1099
|
+
url,
|
|
1100
|
+
requestPayload: reqPayloadObj,
|
|
1101
|
+
responseStatus: response.status,
|
|
1102
|
+
responseData: hiddenInputs,
|
|
1103
|
+
});
|
|
1104
|
+
if (delayMs > 0) {
|
|
1105
|
+
yield new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
820
1106
|
}
|
|
821
|
-
|
|
822
|
-
hiddenInputs["adr_fname"] = fname;
|
|
823
|
-
hiddenInputs["adr_lname"] = lname;
|
|
824
|
-
hiddenInputs["adr_address"] = address;
|
|
825
|
-
hiddenInputs["adr_ctId"] = ctId;
|
|
826
|
-
hiddenInputs["adr_pvId"] = pvId;
|
|
827
|
-
hiddenInputs["adr_amId"] = amId;
|
|
828
|
-
hiddenInputs["adr_zipcode"] = zipcode;
|
|
829
|
-
hiddenInputs["adr_mobile"] = rawPhone.replace(/(\d{2})(\d{3})(\d{4})/, "$1 $2 $3");
|
|
830
|
-
hiddenInputs["adr_mobilearea"] = phoneArea;
|
|
1107
|
+
return hiddenInputs;
|
|
831
1108
|
}
|
|
832
|
-
|
|
833
|
-
|
|
1109
|
+
catch (err) {
|
|
1110
|
+
this.emitProgress("GET_PAYMENT_DETAILS_ERR", `Payment details error: ${err.message}`, {
|
|
1111
|
+
url,
|
|
1112
|
+
requestPayload: reqPayloadObj,
|
|
1113
|
+
responseStatus: (_k = err.response) === null || _k === void 0 ? void 0 : _k.status,
|
|
1114
|
+
responseData: ((_l = err.response) === null || _l === void 0 ? void 0 : _l.data) || err.message,
|
|
1115
|
+
});
|
|
1116
|
+
throw err;
|
|
834
1117
|
}
|
|
835
|
-
return hiddenInputs;
|
|
836
1118
|
});
|
|
837
1119
|
}
|
|
838
1120
|
/**
|
|
@@ -840,7 +1122,8 @@ class ThaiTicketMajor {
|
|
|
840
1122
|
*/
|
|
841
1123
|
confirmPayment(k_1, payload_1) {
|
|
842
1124
|
return __awaiter(this, arguments, void 0, function* (k, payload, deliver = "1", payType = "KBQR") {
|
|
843
|
-
|
|
1125
|
+
var _a, _b;
|
|
1126
|
+
const url = `${this.endpoint}/paycfmall.php?k=${k}`;
|
|
844
1127
|
const cntTicket = parseInt(payload.cal_cntticket || "0", 10);
|
|
845
1128
|
const amountCode = parseFloat(payload.amountcode || "0");
|
|
846
1129
|
const deliverFee = parseFloat(payload.cal_deliverfee || payload.val_deliverfee || "80");
|
|
@@ -850,26 +1133,47 @@ class ThaiTicketMajor {
|
|
|
850
1133
|
const ticketFee = cntTicket * 191; // Ticket Fee 191 THB per ticket
|
|
851
1134
|
const totalAmount = amountCode + deliverFee + ticketFee + addCharge - discount - voucher;
|
|
852
1135
|
const computedPayload = Object.assign(Object.assign({}, payload), { paytype: payType, deliver: deliver, cal_ticketfee: ticketFee.toString(), cal_totalamount: Math.round(totalAmount).toString() });
|
|
1136
|
+
this.emitProgress("CONFIRM_PAYMENT", `Calculating total and confirming payment (${payType})`, {
|
|
1137
|
+
url,
|
|
1138
|
+
requestPayload: computedPayload,
|
|
1139
|
+
});
|
|
853
1140
|
const formData = new URLSearchParams();
|
|
854
1141
|
for (const [key, value] of Object.entries(computedPayload)) {
|
|
855
1142
|
if (key !== "check-protect") {
|
|
856
1143
|
formData.append(key, value !== undefined && value !== null ? String(value) : "");
|
|
857
1144
|
}
|
|
858
1145
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1146
|
+
try {
|
|
1147
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
1148
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/paymentall.php?k=${k}` }),
|
|
1149
|
+
});
|
|
1150
|
+
const $ = cheerio.load(response.data);
|
|
1151
|
+
const nextJsonData = {};
|
|
1152
|
+
$("#payallfrm input[type='hidden']").each((_, el) => {
|
|
1153
|
+
var _a;
|
|
1154
|
+
const name = $(el).attr("name");
|
|
1155
|
+
const value = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
1156
|
+
if (name) {
|
|
1157
|
+
nextJsonData[name] = value;
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1160
|
+
this.emitProgress("CONFIRM_PAYMENT_RES", `Confirmed payment (Total: ฿${computedPayload.cal_totalamount})`, {
|
|
1161
|
+
url,
|
|
1162
|
+
requestPayload: computedPayload,
|
|
1163
|
+
responseStatus: response.status,
|
|
1164
|
+
responseData: nextJsonData,
|
|
1165
|
+
});
|
|
1166
|
+
return nextJsonData;
|
|
1167
|
+
}
|
|
1168
|
+
catch (err) {
|
|
1169
|
+
this.emitProgress("CONFIRM_PAYMENT_ERR", `Payment confirmation error: ${err.message}`, {
|
|
1170
|
+
url,
|
|
1171
|
+
requestPayload: computedPayload,
|
|
1172
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1173
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1174
|
+
});
|
|
1175
|
+
throw err;
|
|
1176
|
+
}
|
|
873
1177
|
});
|
|
874
1178
|
}
|
|
875
1179
|
/**
|
|
@@ -877,28 +1181,44 @@ class ThaiTicketMajor {
|
|
|
877
1181
|
*/
|
|
878
1182
|
orderEncKBankQR(k, payCfmData) {
|
|
879
1183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
});
|
|
885
|
-
this.emitProgress("ORDER_ENC_KBANK_RES", `Received orderenc_kbankqr.php response`, {
|
|
886
|
-
url: `${this.endpoint}/orderenc_kbankqr.php`,
|
|
1184
|
+
var _a, _b;
|
|
1185
|
+
const url = `${this.endpoint}/orderenc_kbankqr.php`;
|
|
1186
|
+
this.emitProgress("ORDER_ENC_KBANK", `Encrypting order payload for KBank`, {
|
|
1187
|
+
url,
|
|
887
1188
|
requestPayload: payCfmData,
|
|
888
|
-
responseStatus: response.status,
|
|
889
|
-
responseData: response.data,
|
|
890
|
-
});
|
|
891
|
-
const $ = cheerio.load(response.data);
|
|
892
|
-
const kbankqrData = {};
|
|
893
|
-
$("#kbankqr input[type='hidden']").each((_, el) => {
|
|
894
|
-
var _a;
|
|
895
|
-
const name = $(el).attr("name");
|
|
896
|
-
const value = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
897
|
-
if (name) {
|
|
898
|
-
kbankqrData[name] = value;
|
|
899
|
-
}
|
|
900
1189
|
});
|
|
901
|
-
|
|
1190
|
+
const formData = new URLSearchParams(payCfmData);
|
|
1191
|
+
try {
|
|
1192
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
1193
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/paycfmall.php?k=${k}` }),
|
|
1194
|
+
});
|
|
1195
|
+
const $ = cheerio.load(response.data);
|
|
1196
|
+
const kbankqrData = {};
|
|
1197
|
+
$("#kbankqr input[type='hidden']").each((_, el) => {
|
|
1198
|
+
var _a;
|
|
1199
|
+
const name = $(el).attr("name");
|
|
1200
|
+
const value = (_a = $(el).attr("value")) !== null && _a !== void 0 ? _a : "";
|
|
1201
|
+
if (name) {
|
|
1202
|
+
kbankqrData[name] = value;
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
this.emitProgress("ORDER_ENC_KBANK_RES", `Received orderenc_kbankqr.php response`, {
|
|
1206
|
+
url,
|
|
1207
|
+
requestPayload: payCfmData,
|
|
1208
|
+
responseStatus: response.status,
|
|
1209
|
+
responseData: Object.keys(kbankqrData).length > 0 ? kbankqrData : response.data,
|
|
1210
|
+
});
|
|
1211
|
+
return kbankqrData;
|
|
1212
|
+
}
|
|
1213
|
+
catch (err) {
|
|
1214
|
+
this.emitProgress("ORDER_ENC_KBANK_ERR", `Order encrypt error: ${err.message}`, {
|
|
1215
|
+
url,
|
|
1216
|
+
requestPayload: payCfmData,
|
|
1217
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1218
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1219
|
+
});
|
|
1220
|
+
throw err;
|
|
1221
|
+
}
|
|
902
1222
|
});
|
|
903
1223
|
}
|
|
904
1224
|
/**
|
|
@@ -906,18 +1226,34 @@ class ThaiTicketMajor {
|
|
|
906
1226
|
*/
|
|
907
1227
|
getKBankQR(orderEncData) {
|
|
908
1228
|
return __awaiter(this, void 0, void 0, function* () {
|
|
909
|
-
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
});
|
|
914
|
-
this.emitProgress("GET_KBANK_QR_RES", `Received getkbankqr.php response`, {
|
|
915
|
-
url: `${this.endpoint}/getkbankqr.php`,
|
|
1229
|
+
var _a, _b;
|
|
1230
|
+
const url = `${this.endpoint}/getkbankqr.php`;
|
|
1231
|
+
this.emitProgress("GET_KBANK_QR", `Calling KBank Gateway info`, {
|
|
1232
|
+
url,
|
|
916
1233
|
requestPayload: orderEncData,
|
|
917
|
-
responseStatus: response.status,
|
|
918
|
-
responseData: response.data,
|
|
919
1234
|
});
|
|
920
|
-
|
|
1235
|
+
const formData = new URLSearchParams(orderEncData);
|
|
1236
|
+
try {
|
|
1237
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
1238
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/orderenc_kbankqr.php` }),
|
|
1239
|
+
});
|
|
1240
|
+
this.emitProgress("GET_KBANK_QR_RES", `Received getkbankqr.php response`, {
|
|
1241
|
+
url,
|
|
1242
|
+
requestPayload: orderEncData,
|
|
1243
|
+
responseStatus: response.status,
|
|
1244
|
+
responseData: response.data,
|
|
1245
|
+
});
|
|
1246
|
+
return response.data;
|
|
1247
|
+
}
|
|
1248
|
+
catch (err) {
|
|
1249
|
+
this.emitProgress("GET_KBANK_QR_ERR", `Get KBank QR error: ${err.message}`, {
|
|
1250
|
+
url,
|
|
1251
|
+
requestPayload: orderEncData,
|
|
1252
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1253
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1254
|
+
});
|
|
1255
|
+
throw err;
|
|
1256
|
+
}
|
|
921
1257
|
});
|
|
922
1258
|
}
|
|
923
1259
|
/**
|
|
@@ -926,26 +1262,42 @@ class ThaiTicketMajor {
|
|
|
926
1262
|
paymentKBankQR(orderEncData, kbankPayload) {
|
|
927
1263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
928
1264
|
var _a, _b;
|
|
929
|
-
|
|
1265
|
+
var _c, _d;
|
|
930
1266
|
const preparePayload = Object.assign(Object.assign({}, orderEncData), { reasoncode: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.reasoncode, eventname: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.eventname, rounddetail: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.rounddetail, totalamount: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.totalamount, orderstatus: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.orderstatus, kbankqr_txExpiry: kbankPayload === null || kbankPayload === void 0 ? void 0 : kbankPayload.kbankqr_txExpiry });
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
});
|
|
935
|
-
this.emitProgress("PAYMENT_KBANK_QR_RES", `Received payment_kbankqr.php response`, {
|
|
936
|
-
url: `${this.endpoint}/payment_kbankqr.php`,
|
|
1267
|
+
const url = `${this.endpoint}/payment_kbankqr.php`;
|
|
1268
|
+
this.emitProgress("PAYMENT_KBANK_QR", `Extracting KBank OrderID and API Key`, {
|
|
1269
|
+
url,
|
|
937
1270
|
requestPayload: preparePayload,
|
|
938
|
-
responseStatus: response.status,
|
|
939
|
-
responseData: response.data,
|
|
940
1271
|
});
|
|
941
|
-
const
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1272
|
+
const formData = new URLSearchParams(preparePayload);
|
|
1273
|
+
try {
|
|
1274
|
+
const response = yield this.client.post(url, formData.toString(), {
|
|
1275
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "x-requested-with": "XMLHttpRequest", referer: `${this.endpoint}/orderenc_kbankqr.php` }),
|
|
1276
|
+
});
|
|
1277
|
+
const $ = cheerio.load(response.data);
|
|
1278
|
+
const script = $("#kbankpost script[data-order-id]");
|
|
1279
|
+
const orderId = (_c = script.attr("data-order-id")) !== null && _c !== void 0 ? _c : "";
|
|
1280
|
+
const apiKey = (_d = script.attr("data-apikey")) !== null && _d !== void 0 ? _d : "";
|
|
1281
|
+
this.emitProgress("PAYMENT_KBANK_QR_RES", `Received payment_kbankqr.php response (OrderID: ${orderId || "N/A"})`, {
|
|
1282
|
+
url,
|
|
1283
|
+
requestPayload: preparePayload,
|
|
1284
|
+
responseStatus: response.status,
|
|
1285
|
+
responseData: orderId && apiKey ? { orderId, apiKey, htmlSnippet: $("#kbankpost").html() } : response.data,
|
|
1286
|
+
});
|
|
1287
|
+
if (!orderId || !apiKey) {
|
|
1288
|
+
throw new Error("Unable to extract KBank orderId or apiKey from response");
|
|
1289
|
+
}
|
|
1290
|
+
return { orderId, apiKey };
|
|
1291
|
+
}
|
|
1292
|
+
catch (err) {
|
|
1293
|
+
this.emitProgress("PAYMENT_KBANK_QR_ERR", `Payment KBank QR error: ${err.message}`, {
|
|
1294
|
+
url,
|
|
1295
|
+
requestPayload: preparePayload,
|
|
1296
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1297
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1298
|
+
});
|
|
1299
|
+
throw err;
|
|
947
1300
|
}
|
|
948
|
-
return { orderId, apiKey };
|
|
949
1301
|
});
|
|
950
1302
|
}
|
|
951
1303
|
/**
|
|
@@ -953,7 +1305,8 @@ class ThaiTicketMajor {
|
|
|
953
1305
|
*/
|
|
954
1306
|
generateThaiQR(orderId, apiKey, amount) {
|
|
955
1307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
956
|
-
|
|
1308
|
+
var _a, _b;
|
|
1309
|
+
const url = "https://kpaymentgateway-services.kasikornbank.com/qr/v2/qr";
|
|
957
1310
|
const payload = {
|
|
958
1311
|
amount: amount,
|
|
959
1312
|
currency: "THB",
|
|
@@ -961,10 +1314,31 @@ class ThaiTicketMajor {
|
|
|
961
1314
|
order_id: orderId,
|
|
962
1315
|
sof: "ThaiQR",
|
|
963
1316
|
};
|
|
964
|
-
|
|
965
|
-
|
|
1317
|
+
this.emitProgress("GENERATE_THAI_QR", `Requesting ThaiQR code from Kasikorn Bank`, {
|
|
1318
|
+
url,
|
|
1319
|
+
requestPayload: payload,
|
|
966
1320
|
});
|
|
967
|
-
|
|
1321
|
+
try {
|
|
1322
|
+
const response = yield this.client.post(url, payload, {
|
|
1323
|
+
headers: Object.assign(Object.assign({}, this.defaultHeaders), { referer: "https://kpaymentgateway.kasikornbank.com/", "x-api-key": apiKey }),
|
|
1324
|
+
});
|
|
1325
|
+
this.emitProgress("GENERATE_THAI_QR_RES", `Received ThaiQR from Kasikorn Bank`, {
|
|
1326
|
+
url,
|
|
1327
|
+
requestPayload: payload,
|
|
1328
|
+
responseStatus: response.status,
|
|
1329
|
+
responseData: response.data,
|
|
1330
|
+
});
|
|
1331
|
+
return response.data;
|
|
1332
|
+
}
|
|
1333
|
+
catch (err) {
|
|
1334
|
+
this.emitProgress("GENERATE_THAI_QR_ERR", `Kasikorn ThaiQR error: ${err.message}`, {
|
|
1335
|
+
url,
|
|
1336
|
+
requestPayload: payload,
|
|
1337
|
+
responseStatus: (_a = err.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
1338
|
+
responseData: ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err.message,
|
|
1339
|
+
});
|
|
1340
|
+
throw err;
|
|
1341
|
+
}
|
|
968
1342
|
});
|
|
969
1343
|
}
|
|
970
1344
|
// ==========================================
|