playttm 0.0.6 → 0.0.7
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.d.ts +3 -0
- package/dist/lib.js +172 -10
- package/package.json +1 -1
- package/src/lib.ts +177 -12
package/dist/lib.d.ts
CHANGED
|
@@ -94,6 +94,9 @@ export declare class ThaiTicketMajor {
|
|
|
94
94
|
/**
|
|
95
95
|
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer header for API requests only.
|
|
96
96
|
*/
|
|
97
|
+
/**
|
|
98
|
+
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer headers accurately for each endpoint.
|
|
99
|
+
*/
|
|
97
100
|
static setupExtensionRules(): Promise<void>;
|
|
98
101
|
syncCookies(domainUrl?: string): Promise<void>;
|
|
99
102
|
private emitProgress;
|
package/dist/lib.js
CHANGED
|
@@ -177,45 +177,169 @@ class ThaiTicketMajor {
|
|
|
177
177
|
/**
|
|
178
178
|
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer header for API requests only.
|
|
179
179
|
*/
|
|
180
|
+
/**
|
|
181
|
+
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer headers accurately for each endpoint.
|
|
182
|
+
*/
|
|
180
183
|
static setupExtensionRules() {
|
|
181
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
185
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
183
186
|
if (typeof chrome === "undefined" || !((_a = chrome === null || chrome === void 0 ? void 0 : chrome.declarativeNetRequest) === null || _a === void 0 ? void 0 : _a.updateSessionRules)) {
|
|
184
187
|
return;
|
|
185
188
|
}
|
|
186
189
|
try {
|
|
190
|
+
const ruleIdsToRemove = [1001, 1002, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019];
|
|
187
191
|
yield chrome.declarativeNetRequest.updateSessionRules({
|
|
188
|
-
removeRuleIds:
|
|
192
|
+
removeRuleIds: ruleIdsToRemove,
|
|
189
193
|
addRules: [
|
|
190
194
|
{
|
|
191
|
-
id:
|
|
192
|
-
priority:
|
|
195
|
+
id: 1010,
|
|
196
|
+
priority: 20,
|
|
193
197
|
action: {
|
|
194
198
|
type: ((_b = chrome.declarativeNetRequest.RuleActionType) === null || _b === void 0 ? void 0 : _b.MODIFY_HEADERS) || "modifyHeaders",
|
|
195
199
|
requestHeaders: [
|
|
196
200
|
{
|
|
197
201
|
header: "Referer",
|
|
198
202
|
operation: ((_c = chrome.declarativeNetRequest.HeaderOperation) === null || _c === void 0 ? void 0 : _c.SET) || "set",
|
|
199
|
-
value: "https://booking.thaiticketmajor.com",
|
|
203
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
200
204
|
},
|
|
201
205
|
],
|
|
202
206
|
},
|
|
203
207
|
condition: {
|
|
204
|
-
urlFilter: "
|
|
208
|
+
urlFilter: "getkbankqr.php",
|
|
205
209
|
resourceTypes: [
|
|
206
210
|
((_d = chrome.declarativeNetRequest.ResourceType) === null || _d === void 0 ? void 0 : _d.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
207
211
|
],
|
|
208
212
|
},
|
|
209
213
|
},
|
|
210
214
|
{
|
|
211
|
-
id:
|
|
212
|
-
priority:
|
|
215
|
+
id: 1011,
|
|
216
|
+
priority: 20,
|
|
213
217
|
action: {
|
|
214
218
|
type: ((_e = chrome.declarativeNetRequest.RuleActionType) === null || _e === void 0 ? void 0 : _e.MODIFY_HEADERS) || "modifyHeaders",
|
|
215
219
|
requestHeaders: [
|
|
216
220
|
{
|
|
217
221
|
header: "Referer",
|
|
218
222
|
operation: ((_f = chrome.declarativeNetRequest.HeaderOperation) === null || _f === void 0 ? void 0 : _f.SET) || "set",
|
|
223
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
condition: {
|
|
228
|
+
urlFilter: "payment_kbankqr.php",
|
|
229
|
+
resourceTypes: [
|
|
230
|
+
((_g = chrome.declarativeNetRequest.ResourceType) === null || _g === void 0 ? void 0 : _g.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: 1012,
|
|
236
|
+
priority: 20,
|
|
237
|
+
action: {
|
|
238
|
+
type: ((_h = chrome.declarativeNetRequest.RuleActionType) === null || _h === void 0 ? void 0 : _h.MODIFY_HEADERS) || "modifyHeaders",
|
|
239
|
+
requestHeaders: [
|
|
240
|
+
{
|
|
241
|
+
header: "Referer",
|
|
242
|
+
operation: ((_j = chrome.declarativeNetRequest.HeaderOperation) === null || _j === void 0 ? void 0 : _j.SET) || "set",
|
|
243
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/paycfmall.php",
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
condition: {
|
|
248
|
+
urlFilter: "orderenc_kbankqr.php",
|
|
249
|
+
resourceTypes: [
|
|
250
|
+
((_k = chrome.declarativeNetRequest.ResourceType) === null || _k === void 0 ? void 0 : _k.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: 1013,
|
|
256
|
+
priority: 20,
|
|
257
|
+
action: {
|
|
258
|
+
type: ((_l = chrome.declarativeNetRequest.RuleActionType) === null || _l === void 0 ? void 0 : _l.MODIFY_HEADERS) || "modifyHeaders",
|
|
259
|
+
requestHeaders: [
|
|
260
|
+
{
|
|
261
|
+
header: "Referer",
|
|
262
|
+
operation: ((_m = chrome.declarativeNetRequest.HeaderOperation) === null || _m === void 0 ? void 0 : _m.SET) || "set",
|
|
263
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/paymentall.php",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
},
|
|
267
|
+
condition: {
|
|
268
|
+
urlFilter: "paycfmall.php",
|
|
269
|
+
resourceTypes: [
|
|
270
|
+
((_o = chrome.declarativeNetRequest.ResourceType) === null || _o === void 0 ? void 0 : _o.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: 1014,
|
|
276
|
+
priority: 20,
|
|
277
|
+
action: {
|
|
278
|
+
type: ((_p = chrome.declarativeNetRequest.RuleActionType) === null || _p === void 0 ? void 0 : _p.MODIFY_HEADERS) || "modifyHeaders",
|
|
279
|
+
requestHeaders: [
|
|
280
|
+
{
|
|
281
|
+
header: "Referer",
|
|
282
|
+
operation: ((_q = chrome.declarativeNetRequest.HeaderOperation) === null || _q === void 0 ? void 0 : _q.SET) || "set",
|
|
283
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
},
|
|
287
|
+
condition: {
|
|
288
|
+
urlFilter: "paymentall.php",
|
|
289
|
+
resourceTypes: [
|
|
290
|
+
((_r = chrome.declarativeNetRequest.ResourceType) === null || _r === void 0 ? void 0 : _r.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 1015,
|
|
296
|
+
priority: 20,
|
|
297
|
+
action: {
|
|
298
|
+
type: ((_s = chrome.declarativeNetRequest.RuleActionType) === null || _s === void 0 ? void 0 : _s.MODIFY_HEADERS) || "modifyHeaders",
|
|
299
|
+
requestHeaders: [
|
|
300
|
+
{
|
|
301
|
+
header: "Referer",
|
|
302
|
+
operation: ((_t = chrome.declarativeNetRequest.HeaderOperation) === null || _t === void 0 ? void 0 : _t.SET) || "set",
|
|
303
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
condition: {
|
|
308
|
+
urlFilter: "enroll",
|
|
309
|
+
resourceTypes: [
|
|
310
|
+
((_u = chrome.declarativeNetRequest.ResourceType) === null || _u === void 0 ? void 0 : _u.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: 1018,
|
|
316
|
+
priority: 20,
|
|
317
|
+
action: {
|
|
318
|
+
type: ((_v = chrome.declarativeNetRequest.RuleActionType) === null || _v === void 0 ? void 0 : _v.MODIFY_HEADERS) || "modifyHeaders",
|
|
319
|
+
requestHeaders: [
|
|
320
|
+
{
|
|
321
|
+
header: "Referer",
|
|
322
|
+
operation: ((_w = chrome.declarativeNetRequest.HeaderOperation) === null || _w === void 0 ? void 0 : _w.SET) || "set",
|
|
323
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/zones.php",
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
},
|
|
327
|
+
condition: {
|
|
328
|
+
urlFilter: "zonesavail.php",
|
|
329
|
+
resourceTypes: [
|
|
330
|
+
((_x = chrome.declarativeNetRequest.ResourceType) === null || _x === void 0 ? void 0 : _x.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
331
|
+
],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
id: 1002,
|
|
336
|
+
priority: 20,
|
|
337
|
+
action: {
|
|
338
|
+
type: ((_y = chrome.declarativeNetRequest.RuleActionType) === null || _y === void 0 ? void 0 : _y.MODIFY_HEADERS) || "modifyHeaders",
|
|
339
|
+
requestHeaders: [
|
|
340
|
+
{
|
|
341
|
+
header: "Referer",
|
|
342
|
+
operation: ((_z = chrome.declarativeNetRequest.HeaderOperation) === null || _z === void 0 ? void 0 : _z.SET) || "set",
|
|
219
343
|
value: "https://kpaymentgateway.kasikornbank.com/",
|
|
220
344
|
},
|
|
221
345
|
],
|
|
@@ -223,7 +347,27 @@ class ThaiTicketMajor {
|
|
|
223
347
|
condition: {
|
|
224
348
|
urlFilter: "kasikornbank.com",
|
|
225
349
|
resourceTypes: [
|
|
226
|
-
((
|
|
350
|
+
((_0 = chrome.declarativeNetRequest.ResourceType) === null || _0 === void 0 ? void 0 : _0.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
id: 1001,
|
|
356
|
+
priority: 1,
|
|
357
|
+
action: {
|
|
358
|
+
type: ((_1 = chrome.declarativeNetRequest.RuleActionType) === null || _1 === void 0 ? void 0 : _1.MODIFY_HEADERS) || "modifyHeaders",
|
|
359
|
+
requestHeaders: [
|
|
360
|
+
{
|
|
361
|
+
header: "Referer",
|
|
362
|
+
operation: ((_2 = chrome.declarativeNetRequest.HeaderOperation) === null || _2 === void 0 ? void 0 : _2.SET) || "set",
|
|
363
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/",
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
},
|
|
367
|
+
condition: {
|
|
368
|
+
urlFilter: "thaiticketmajor.com",
|
|
369
|
+
resourceTypes: [
|
|
370
|
+
((_3 = chrome.declarativeNetRequest.ResourceType) === null || _3 === void 0 ? void 0 : _3.XMLHTTPREQUEST) || "xmlhttprequest",
|
|
227
371
|
],
|
|
228
372
|
},
|
|
229
373
|
},
|
|
@@ -738,6 +882,12 @@ class ThaiTicketMajor {
|
|
|
738
882
|
const response = yield this.client.post(`${this.endpoint}/orderenc_kbankqr.php`, formData.toString(), {
|
|
739
883
|
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}` }),
|
|
740
884
|
});
|
|
885
|
+
this.emitProgress("ORDER_ENC_KBANK_RES", `Received orderenc_kbankqr.php response`, {
|
|
886
|
+
url: `${this.endpoint}/orderenc_kbankqr.php`,
|
|
887
|
+
requestPayload: payCfmData,
|
|
888
|
+
responseStatus: response.status,
|
|
889
|
+
responseData: response.data,
|
|
890
|
+
});
|
|
741
891
|
const $ = cheerio.load(response.data);
|
|
742
892
|
const kbankqrData = {};
|
|
743
893
|
$("#kbankqr input[type='hidden']").each((_, el) => {
|
|
@@ -761,6 +911,12 @@ class ThaiTicketMajor {
|
|
|
761
911
|
const response = yield this.client.post(`${this.endpoint}/getkbankqr.php`, formData.toString(), {
|
|
762
912
|
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` }),
|
|
763
913
|
});
|
|
914
|
+
this.emitProgress("GET_KBANK_QR_RES", `Received getkbankqr.php response`, {
|
|
915
|
+
url: `${this.endpoint}/getkbankqr.php`,
|
|
916
|
+
requestPayload: orderEncData,
|
|
917
|
+
responseStatus: response.status,
|
|
918
|
+
responseData: response.data,
|
|
919
|
+
});
|
|
764
920
|
return response.data;
|
|
765
921
|
});
|
|
766
922
|
}
|
|
@@ -771,11 +927,17 @@ class ThaiTicketMajor {
|
|
|
771
927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
772
928
|
var _a, _b;
|
|
773
929
|
this.emitProgress("PAYMENT_KBANK_QR", `Extracting KBank OrderID and API Key`);
|
|
774
|
-
const preparePayload = Object.assign(Object.assign({}, orderEncData), { reasoncode: kbankPayload.reasoncode, eventname: kbankPayload.eventname, rounddetail: kbankPayload.rounddetail, totalamount: kbankPayload.totalamount, orderstatus: kbankPayload.orderstatus, kbankqr_txExpiry: kbankPayload.kbankqr_txExpiry });
|
|
930
|
+
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 });
|
|
775
931
|
const formData = new URLSearchParams(preparePayload);
|
|
776
932
|
const response = yield this.client.post(`${this.endpoint}/payment_kbankqr.php`, formData.toString(), {
|
|
777
933
|
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` }),
|
|
778
934
|
});
|
|
935
|
+
this.emitProgress("PAYMENT_KBANK_QR_RES", `Received payment_kbankqr.php response`, {
|
|
936
|
+
url: `${this.endpoint}/payment_kbankqr.php`,
|
|
937
|
+
requestPayload: preparePayload,
|
|
938
|
+
responseStatus: response.status,
|
|
939
|
+
responseData: response.data,
|
|
940
|
+
});
|
|
779
941
|
const $ = cheerio.load(response.data);
|
|
780
942
|
const script = $("#kbankpost script[data-order-id]");
|
|
781
943
|
const orderId = (_a = script.attr("data-order-id")) !== null && _a !== void 0 ? _a : "";
|
package/package.json
CHANGED
package/src/lib.ts
CHANGED
|
@@ -261,30 +261,154 @@ export class ThaiTicketMajor {
|
|
|
261
261
|
/**
|
|
262
262
|
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer header for API requests only.
|
|
263
263
|
*/
|
|
264
|
+
/**
|
|
265
|
+
* Setup declarativeNetRequest session rules in Chrome Extension to set Referer headers accurately for each endpoint.
|
|
266
|
+
*/
|
|
264
267
|
public static async setupExtensionRules(): Promise<void> {
|
|
265
268
|
if (typeof chrome === "undefined" || !chrome?.declarativeNetRequest?.updateSessionRules) {
|
|
266
269
|
return;
|
|
267
270
|
}
|
|
268
271
|
|
|
269
272
|
try {
|
|
273
|
+
const ruleIdsToRemove = [1001, 1002, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019];
|
|
270
274
|
await chrome.declarativeNetRequest.updateSessionRules({
|
|
271
|
-
removeRuleIds:
|
|
275
|
+
removeRuleIds: ruleIdsToRemove,
|
|
272
276
|
addRules: [
|
|
273
277
|
{
|
|
274
|
-
id:
|
|
275
|
-
priority:
|
|
278
|
+
id: 1010,
|
|
279
|
+
priority: 20,
|
|
276
280
|
action: {
|
|
277
281
|
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
278
282
|
requestHeaders: [
|
|
279
283
|
{
|
|
280
284
|
header: "Referer",
|
|
281
285
|
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
282
|
-
value: "https://booking.thaiticketmajor.com",
|
|
286
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
283
287
|
},
|
|
284
288
|
],
|
|
285
289
|
},
|
|
286
290
|
condition: {
|
|
287
|
-
urlFilter: "
|
|
291
|
+
urlFilter: "getkbankqr.php",
|
|
292
|
+
resourceTypes: [
|
|
293
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
id: 1011,
|
|
299
|
+
priority: 20,
|
|
300
|
+
action: {
|
|
301
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
302
|
+
requestHeaders: [
|
|
303
|
+
{
|
|
304
|
+
header: "Referer",
|
|
305
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
306
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/orderenc_kbankqr.php",
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
},
|
|
310
|
+
condition: {
|
|
311
|
+
urlFilter: "payment_kbankqr.php",
|
|
312
|
+
resourceTypes: [
|
|
313
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: 1012,
|
|
319
|
+
priority: 20,
|
|
320
|
+
action: {
|
|
321
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
322
|
+
requestHeaders: [
|
|
323
|
+
{
|
|
324
|
+
header: "Referer",
|
|
325
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
326
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/paycfmall.php",
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
condition: {
|
|
331
|
+
urlFilter: "orderenc_kbankqr.php",
|
|
332
|
+
resourceTypes: [
|
|
333
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: 1013,
|
|
339
|
+
priority: 20,
|
|
340
|
+
action: {
|
|
341
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
342
|
+
requestHeaders: [
|
|
343
|
+
{
|
|
344
|
+
header: "Referer",
|
|
345
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
346
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/paymentall.php",
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
},
|
|
350
|
+
condition: {
|
|
351
|
+
urlFilter: "paycfmall.php",
|
|
352
|
+
resourceTypes: [
|
|
353
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
354
|
+
],
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: 1014,
|
|
359
|
+
priority: 20,
|
|
360
|
+
action: {
|
|
361
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
362
|
+
requestHeaders: [
|
|
363
|
+
{
|
|
364
|
+
header: "Referer",
|
|
365
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
366
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
367
|
+
},
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
condition: {
|
|
371
|
+
urlFilter: "paymentall.php",
|
|
372
|
+
resourceTypes: [
|
|
373
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: 1015,
|
|
379
|
+
priority: 20,
|
|
380
|
+
action: {
|
|
381
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
382
|
+
requestHeaders: [
|
|
383
|
+
{
|
|
384
|
+
header: "Referer",
|
|
385
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
386
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/fixed.php",
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
condition: {
|
|
391
|
+
urlFilter: "enroll",
|
|
392
|
+
resourceTypes: [
|
|
393
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
id: 1018,
|
|
399
|
+
priority: 20,
|
|
400
|
+
action: {
|
|
401
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
402
|
+
requestHeaders: [
|
|
403
|
+
{
|
|
404
|
+
header: "Referer",
|
|
405
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
406
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/zones.php",
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
},
|
|
410
|
+
condition: {
|
|
411
|
+
urlFilter: "zonesavail.php",
|
|
288
412
|
resourceTypes: [
|
|
289
413
|
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
290
414
|
],
|
|
@@ -292,7 +416,7 @@ export class ThaiTicketMajor {
|
|
|
292
416
|
},
|
|
293
417
|
{
|
|
294
418
|
id: 1002,
|
|
295
|
-
priority:
|
|
419
|
+
priority: 20,
|
|
296
420
|
action: {
|
|
297
421
|
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
298
422
|
requestHeaders: [
|
|
@@ -310,6 +434,26 @@ export class ThaiTicketMajor {
|
|
|
310
434
|
],
|
|
311
435
|
},
|
|
312
436
|
},
|
|
437
|
+
{
|
|
438
|
+
id: 1001,
|
|
439
|
+
priority: 1,
|
|
440
|
+
action: {
|
|
441
|
+
type: chrome.declarativeNetRequest.RuleActionType?.MODIFY_HEADERS || "modifyHeaders",
|
|
442
|
+
requestHeaders: [
|
|
443
|
+
{
|
|
444
|
+
header: "Referer",
|
|
445
|
+
operation: chrome.declarativeNetRequest.HeaderOperation?.SET || "set",
|
|
446
|
+
value: "https://booking.thaiticketmajor.com/booking/3m/",
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
condition: {
|
|
451
|
+
urlFilter: "thaiticketmajor.com",
|
|
452
|
+
resourceTypes: [
|
|
453
|
+
chrome.declarativeNetRequest.ResourceType?.XMLHTTPREQUEST || "xmlhttprequest",
|
|
454
|
+
],
|
|
455
|
+
},
|
|
456
|
+
},
|
|
313
457
|
],
|
|
314
458
|
});
|
|
315
459
|
} catch (err) {
|
|
@@ -998,6 +1142,13 @@ export class ThaiTicketMajor {
|
|
|
998
1142
|
},
|
|
999
1143
|
});
|
|
1000
1144
|
|
|
1145
|
+
this.emitProgress("ORDER_ENC_KBANK_RES", `Received orderenc_kbankqr.php response`, {
|
|
1146
|
+
url: `${this.endpoint}/orderenc_kbankqr.php`,
|
|
1147
|
+
requestPayload: payCfmData,
|
|
1148
|
+
responseStatus: response.status,
|
|
1149
|
+
responseData: response.data,
|
|
1150
|
+
});
|
|
1151
|
+
|
|
1001
1152
|
const $ = cheerio.load(response.data);
|
|
1002
1153
|
const kbankqrData: Record<string, string> = {};
|
|
1003
1154
|
|
|
@@ -1029,6 +1180,13 @@ export class ThaiTicketMajor {
|
|
|
1029
1180
|
},
|
|
1030
1181
|
});
|
|
1031
1182
|
|
|
1183
|
+
this.emitProgress("GET_KBANK_QR_RES", `Received getkbankqr.php response`, {
|
|
1184
|
+
url: `${this.endpoint}/getkbankqr.php`,
|
|
1185
|
+
requestPayload: orderEncData,
|
|
1186
|
+
responseStatus: response.status,
|
|
1187
|
+
responseData: response.data,
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1032
1190
|
return response.data;
|
|
1033
1191
|
}
|
|
1034
1192
|
|
|
@@ -1043,12 +1201,12 @@ export class ThaiTicketMajor {
|
|
|
1043
1201
|
|
|
1044
1202
|
const preparePayload = {
|
|
1045
1203
|
...orderEncData,
|
|
1046
|
-
reasoncode: kbankPayload
|
|
1047
|
-
eventname: kbankPayload
|
|
1048
|
-
rounddetail: kbankPayload
|
|
1049
|
-
totalamount: kbankPayload
|
|
1050
|
-
orderstatus: kbankPayload
|
|
1051
|
-
kbankqr_txExpiry: kbankPayload
|
|
1204
|
+
reasoncode: kbankPayload?.reasoncode,
|
|
1205
|
+
eventname: kbankPayload?.eventname,
|
|
1206
|
+
rounddetail: kbankPayload?.rounddetail,
|
|
1207
|
+
totalamount: kbankPayload?.totalamount,
|
|
1208
|
+
orderstatus: kbankPayload?.orderstatus,
|
|
1209
|
+
kbankqr_txExpiry: kbankPayload?.kbankqr_txExpiry,
|
|
1052
1210
|
};
|
|
1053
1211
|
|
|
1054
1212
|
const formData = new URLSearchParams(preparePayload);
|
|
@@ -1062,6 +1220,13 @@ export class ThaiTicketMajor {
|
|
|
1062
1220
|
},
|
|
1063
1221
|
});
|
|
1064
1222
|
|
|
1223
|
+
this.emitProgress("PAYMENT_KBANK_QR_RES", `Received payment_kbankqr.php response`, {
|
|
1224
|
+
url: `${this.endpoint}/payment_kbankqr.php`,
|
|
1225
|
+
requestPayload: preparePayload,
|
|
1226
|
+
responseStatus: response.status,
|
|
1227
|
+
responseData: response.data,
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1065
1230
|
const $ = cheerio.load(response.data);
|
|
1066
1231
|
const script = $("#kbankpost script[data-order-id]");
|
|
1067
1232
|
|