Commit 6485aa180b06a03f30b3a2c79537b1fc97b7e352

Authored by Nattapon W
1 parent 70cc6838
Exists in master and in 1 other branch develop

update api for project true cms

Showing 3 changed files with 127 additions and 11 deletions   Show diff stats
app.js
... ... @@ -394,6 +394,10 @@ app.post('/v1/MVP/enq/getMobileOfferInventory/', require('./true').getMobileOffe
394 394  
395 395 app.post('/api/v1/LG-API/notifySubscription', require('./lg').notifySubscription);
396 396  
  397 +app.post('/goapi/profile/assetDetail', require('./ccbs').assetDetail);
  398 +app.post('/goapi/profile/churnscore/offerlist', require('./ccbs').churnScoreOfferList);
  399 +
  400 +
397 401 app.get('/api/callback', require('./line').callback);
398 402  
399 403 app.get('/api/random/leader', function (req, res) {
... ...
apple.js
... ... @@ -21,44 +21,38 @@ module.exports.verifyReceipt = async (req, res) => {
21 21 "is_in_intro_offer_period":"false",
22 22 "original_purchase_date_ms":"1592456484000",
23 23 "purchase_date_pst":"2020-07-13 21:50:22 America/Los_Angeles",
24   - "expires_date":"2020-07-14 04:55:01 Etc/GMT",
25 24 "cancellation_date_pst":null,
26 25 "is_trial_period":"false",
27 26 "original_purchase_date_pst":"2020-06-17 22:01:24 America/Los_Angeles",
28 27 "cancellation_reason":null,
29 28 "promotional_offer_id":null,
30   - "expires_date_pst":"2020-07-13 21:55:22 America/Los_Angeles",
31 29 "cancellation_date":null,
32 30 "original_purchase_date":"2020-06-18 05:01:24 Etc/GMT",
33   - "expires_date_ms":"1594702522000",
34 31 "purchase_date_ms":"1594702222000",
35 32 "is_upgraded":null,
36   - "product_id":"AllEnglishMonthly",
37   - "purchase_date":"2020-07-14 04:50:22 Etc/GMT",
  33 + "product_id":"PLAY_PREMIUM",
  34 + "purchase_date":"2020-08-31 04:50:22 Etc/GMT",
38 35 "web_order_line_item_id":"1000000054018869"
39 36 },{
40 37 "cancellation_date_ms":null,
41   - "transaction_id":"1000000692439725",
  38 + "transaction_id":"1000000692439726",
42 39 "original_transaction_id":"1000000681025499",
43 40 "quantity":"1",
44 41 "subscription_group_identifier":"20548189",
45 42 "is_in_intro_offer_period":"false",
46 43 "original_purchase_date_ms":"1592456484000",
47 44 "purchase_date_pst":"2020-07-13 21:50:22 America/Los_Angeles",
48   - "expires_date":"2020-07-14 04:55:02 Etc/GMT",
49 45 "cancellation_date_pst":null,
50 46 "is_trial_period":"false",
51 47 "original_purchase_date_pst":"2020-06-17 22:01:24 America/Los_Angeles",
52 48 "cancellation_reason":null,
53 49 "promotional_offer_id":null,
54   - "expires_date_pst":"2020-07-13 21:55:22 America/Los_Angeles",
55 50 "cancellation_date":null,
56 51 "original_purchase_date":"2020-06-18 05:01:24 Etc/GMT",
57   - "expires_date_ms":"1594702522000",
58 52 "purchase_date_ms":"1594702222000",
59 53 "is_upgraded":null,
60   - "product_id":"AllEnglishMonthly",
61   - "purchase_date":"2020-07-14 04:50:22 Etc/GMT",
  54 + "product_id":"PLAY_PREMIUM",
  55 + "purchase_date":"2020-07-14 04:50:23 Etc/GMT",
62 56 "web_order_line_item_id":"1000000054018869"
63 57 },{
64 58 "cancellation_date_ms":null,
... ...
ccbs.js 0 โ†’ 100644
... ... @@ -0,0 +1,118 @@
  1 +module.exports.assetDetail = async (req, res) => {
  2 + console.log('===== POST assetDetail =====')
  3 + console.log('url', req.originalUrl);
  4 + console.log('headers', req.headers);
  5 + console.log('query', req.query);
  6 + console.log('params', req.params);
  7 + console.log('body', req.body);
  8 +
  9 + let responseErr = {
  10 + "code" : "5000",
  11 + "message" : "Error bind json to model"
  12 + }
  13 +
  14 + let response = {
  15 + "outstandingBalance": 0,
  16 + "currentBillBalance": 1.61,
  17 + "dueDate": "21/11/2020",
  18 + "subStatus": {
  19 + "FullSusMsg": "No",
  20 + "status": "Active",
  21 + "detail": [{
  22 + "reason": "(SYSREQ)System Request",
  23 + "since": "05/10/2018 17:54:36"
  24 + }
  25 + ]
  26 + },
  27 + "assetRowId": "1-2CN6IWH0",
  28 + "serviceId": "0952543411",
  29 + "productLine": "True Mobile",
  30 + "startDate": "16/07/2015",
  31 + "assetLifetime": "5 years, 4 months, 9 days",
  32 + "preferredLanguage": "Thai",
  33 + "productType": "Postpay",
  34 + "currentBillCycle": "28/27",
  35 + "lastPPEffectiveDate": "28/10/2019",
  36 + "lastFullSuspension": "No",
  37 + "credit": {
  38 + "limit": 2500,
  39 + "available": 2459.5,
  40 + "defaultCredit": "1000",
  41 + "temporary": "0",
  42 + "permanent": "2500",
  43 + "expiryDate": "",
  44 + "status": "Permanent",
  45 + "totalObligation": 40.5
  46 + },
  47 + "discount": {
  48 + "discountList": [{
  49 + "name": "CVG012",
  50 + "description": "True Smart Choice Discount 499",
  51 + "startDate": "05/10/2018",
  52 + "endDate": "06/10/2018"
  53 + }
  54 + ],
  55 + "discountIndicator": "Yes"
  56 + },
  57 + "contract": {
  58 + "contractIndicator": "No",
  59 + "list": [{
  60 + "propositionCode": "CVG000000000052",
  61 + "propositionDescription": "TrueSmartChoice Regu 4G No Limit",
  62 + "term": "12",
  63 + "fee": 0,
  64 + "startDate": "04/10/2019",
  65 + "expireDate": "05/10/2019",
  66 + "contractIndicator": "No",
  67 + "offerCode": "12534317",
  68 + "contractNumber": "-",
  69 + "offerInstanceId": "162918628",
  70 + "terminationDate": ""
  71 + }
  72 + ]
  73 + },
  74 + "installAddress": {}
  75 + }
  76 +
  77 + res.status(200).send(response)
  78 +}
  79 +
  80 +module.exports.churnScoreOfferList = async (req, res) => {
  81 + console.log('===== POST churnScoreOfferList =====')
  82 + console.log('url', req.originalUrl);
  83 + console.log('headers', req.headers);
  84 + console.log('query', req.query);
  85 + console.log('params', req.params);
  86 + console.log('body', req.body);
  87 +
  88 + let responseErr = {
  89 + "code" : "404",
  90 + "message" : "Not found"
  91 + }
  92 +
  93 + let response = {
  94 + "campTransID": "5c0a746b-ae69-447d-84b0-b0bdaa4b6add",
  95 + "campID": "0007",
  96 + "campCode": "PRPTOL000001",
  97 + "campName": "PRP TOL CAMPAIGN",
  98 + "callScript": "",
  99 + "offerList": [
  100 + {
  101 + "productName": "True Online",
  102 + "offerCode": "VASUP121MOCJA01",
  103 + "offerName": "1000/500Mbps.",
  104 + "offerType": "VAS",
  105 + "offerTypeText": "VAS",
  106 + "offerDescTH": "VASUP121MOCJA01 : 1000/500Mbps.",
  107 + "offerDescEN": "VASUP121MOCJA01 : 1000/500Mbps.",
  108 + "serviceType": "85",
  109 + "autoAssign": "N",
  110 + "appointmentFlag": true
  111 + }
  112 + ]
  113 + }
  114 +
  115 + res.status(200).send(response)
  116 +}
  117 +
  118 +
... ...