ssb.js
14.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
module.exports.getProfileType = async (req, res) => {
console.log('===== GET ProfileType =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
let response = {
"resultCode": "20000",
"developerMessage": "Success",
"detail": {
"networkType":"3PE",
"spName": "ais",
"brandId": "5",
"language": "tha",
"state": "active",
"chargeMode": "prepaid",
"customerCategory": "residential",
"customerSubCategory": "thaiCitizen",
"customerSegment": "classic",
"customerId": "662571977736387",
"serviceProfileId": "6",
"contactNumber": "66614593898",
"profileType": "Prepaid RTBS",
"ivrLanguage": "tha",
"smsLanguage": "tha",
"ussdLanguage": "tha",
"emailLanguage": "tha"
}
}
res.send(response)
}
module.exports.queryHistoryPackage = async (req, res) => {
console.log('===== POST QueryHistoryPackage =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"resultCode": "20000",
"developerMessage": "Success",
"subscriberPackage":{
"mobileNo": "0923029000",
"profileType":"Prepaid RTBS",
"packageList":[
{
"promotionName": "M NBA Free Trial 1M 199Baht Monthly",
"promotionCode": "7400110",
"startDate": "2018-05-31 14:23:03",
"status":"A"
},
{
"promotionName": "M HOOQ Package Free 12 Months",
"promotionCode": "7400115",
"startDate": "2018-05-31 15:15:59",
"status":"A"
},
{
"promotionName": "NG Cartoons 5Baht Daily",
"promotionCode": "7400121",
"startDate": "2018-05-31 16:15:59",
"status":"H"
}
]
}
}
res.send(response)
}
module.exports.queryCurrentPackage = async (req, res) => {
console.log('===== POST QueryCurrentPackage =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"subscriberPackage": {
"profileType": "NON AIS",
"mobileNo": "0990621789",
"packageList": [
{
"promotionName": "INS_NF NG PLAY PREMIUM IAP APPLE TV 99M",
"promotionCode": "4007",
"startDate": "2020-08-01 11:00:13",
"status": "A",
"packageDescEN": null,
"promotionSeq": "4007",
"packageNameTH": null,
"endDate": "2028-10-31 23:59:59",
"integrationName": null,
"packageDescTH": null,
"packageNameEN": null,
"packageType": null,
"packageID": null
}
]
},
"developerMessage": "Success",
"responseMessage": "Success",
"subscriberPackage":{
"mobileNo": "0923029000",
"profileType":"Prepaid INS",
"packageList":[
{
"promotionName": "NG New PLAY PREMIUM 199B Monthly|NG_PLAY PREMIUM_In199B_99Months",
"packageNameEN":"xxxxxxxxx",
"packageNameTH":"xxxxxxxxx",
"startDate": "2018-05-31 14:23:03",
"endDate": "2018-05-31 14:23:03",
"promotionCode": "P200128067",
"packageType":"Main",
"integrationName":"INS_3G 1000B 60Days Net 4Mbps SWifi UL",
"packageDescEN":"xxxxxxxxx",
"packageDescTH":"xxxxxxxxx",
"promotionSeq":"1002"
},
{
"promotionName": "M NBA Free Trial 1M 199Baht Monthly",
"packageNameEN":"xxxxxxxxx",
"packageNameTH":"xxxxxxxxx",
"promotionCode": "P2007229612",
"startDate": "2018-05-31 14:23:03",
"endDate": "2018-05-31 14:23:03",
"integrationName":"INS_3G 1000B 60Days Net 4Mbps SWifi UL1",
"packageType":"Ontop Extra",
"packageDescEN":"xxxxxxxxx",
"packageDescTH":"xxxxxxxxx",
"promotionSeq":"1003"
}
]
}
}
res.send(response)
}
module.exports.applyPack = async (req, res) => {
console.log('===== POST applyPack =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"resultCode": "20000",
"developerMessage": "Success",
"ussdMessage": "ระบบกำลังตรวจสอบข้อมูล กรุณารอรับข้อความแจ้งสิทธิ์ของท่านค่ะ",
"responseMessage": "success"
}
// let response = {"responseMessage":"ขออภัยค่ะ ไม่สามารถทำรายการได้ในขณะนี้ กรุณาใช้บริการใหม่ภายหลังค่ะ","resultCode":"40400","developerMessage":"Url not found"}
res.status(200).send(response)
}
module.exports.deletePackage = async (req, res) => {
console.log('===== POST deletePackage =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"resultCode": "SSBPKG-009010202",
"developerMessage": "TUXEDO Error",
"ussdMessage": "Please wait for confirmation SMS shortly.",
"responseMessage": "Thank you, your package has been deleted."
}
res.status(500).send(response)
}
module.exports.createNewRegistration = async (req, res) => {
console.log('===== POST createNewRegistration =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', JSON.stringify(req.body));
let response
if(req.body.ExecuteService.sffRequest.Event == 'evESQueryPersonalInformation') {
response = {
"resultCode": "20000",
"developerMessage": "Success",
"data": {
"ExecuteServiceResponse": {
"return": {
"ErrorMessage": "",
"ParameterList": {
"ParameterType": "",
"Parameter": [
{
"Name": "remainCounterMain",
"Value": 0
},
{
"Name": "remainCounterOntop",
"Value": 0
},
{
"Name": "maxCounterMain",
"Value": 1
},
{
"Name": "maxCounterOntop",
"Value": 1
}
],
"ParameterList": {
"ParameterType": "",
"Parameter": [
{
"Name": "paymentMode",
"Value": "Pre-paid"
},
{
"Name": "productPkg",
"Value": "Pre Voice Main"
},
{
"Name": "descEng",
"Value": "You will get the rate 49 satang per minute from 5 AM to 5 PM. For other period, you will get the rate of 99 satang per minute for all networks. SMS is 2 baht per message MMS is 6 baht per message. Internet is 1.50 baht per megabyte. All rates exclude VAT."
},
{
"Name": "crmFlg",
"Value": "N"
},
{
"Name": "priceExclVat",
"Value": ""
},
{
"Name": "productClass",
"Value": "Main"
},
{
"Name": "integrationName",
"Value": "[BOS]โปรติดลม [05-17: 0.52B, 17-05: 1.06B] Inc.VAT"
},
{
"Name": "productCd",
"Value": "P13080053"
},
{
"Name": "shortNameEng",
"Value": "5AM-5PM 49st. Other 99st. Other Pro *777 in 30days"
},
{
"Name": "promotionName",
"Value": "[BOS]โปรติดลม [05-17: 0.52B, 17-05: 1.06B] Inc.VAT"
},
{
"Name": "startDt",
"Value": "27/11/2017 17:55:45"
},
{
"Name": "inStatementEng",
"Value": ""
},
{
"Name": "descThai",
"Value": "อัตราค่าโทรตี 5 ถึง 5 โมงเย็น นาทีละ 49 สต. นอกช่วงเวลา นาทีละ 99 สต. ทุกเครือข่าย SMS ข้อความละ 2 บาท MMS ข้อความละ 6 บาท Internet เมกะไบท์ละ 1.50 บาท\nอัตราค่าโทรและค่าบริการเสริมยังไม่รวมภาษีมูลค่าเพิ่ม"
},
{
"Name": "shortNameThai",
"Value": "5-17น.49สต/นาที นอกเวลา99สต/นาทีโปรอื่น*777ใน30วัน"
},
{
"Name": "productSeq",
"Value": 300000028391
},
{
"Name": "inStatementThai",
"Value": ""
},
{
"Name": "endDt",
"Value": "16/02/20361 00:00:00"
},
{
"Name": "bosId",
"Value": 150319
},
{
"Name": "nextBillCycle",
"Value": ""
},
{
"Name": "priceType",
"Value": "Usage"
},
{
"Name": "monthlyFee",
"Value": ""
},
{
"Name": "produuctGroup",
"Value": "Mass Promotion"
},
{
"Name": "bvPoint",
"Value": ""
},
{
"Name": "billCycle",
"Value": ""
},
{
"Name": "bvDescription",
"Value": ""
},
{
"Name": "deviceContractFlg",
"Value": "N"
},
{
"Name": "netFlexiFlg",
"Value": "Y"
},
{
"Name": "pro5gFlg",
"Value": "Y"
},
{
"Name": "prorateFlg",
"Value": "Y"
},
{
"Name": "phxProductId",
"Value": "O2005P13080053"
}
]
}
}
}
}
}
}
} else if(req.body.ExecuteService.sffRequest.Event == 'evOMCreateNewRegistration') {
response = {
"resultCode": "20000",
"developerMessage": "Success",
"data": {
"ExecuteServiceResponse": {
"return": {
"ParameterList": {
"Parameter": [
{
"Name": "returnMessage",
"Value": "Error Order Creation: EB0183 : SIM Serial No. : 2014143597539 status can not register"
}, {
"Name": "mobileNo",
"Value": "0911234567"
}
]
}
}
}
}
}
} else {
response = {
"resultCode": "50000",
"developerMessage": "System error"
}
}
res.status(200).send(response)
}