ccp.js 6.39 KB
module.exports.userProfile = async (req, res) => {
  console.log('===== POST userProfile =====')
  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 = `<?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope
   xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
    <ns2:processQueryUserProfileResponse
     xmlns:ns2="http://queryuserprofile.ws.ccpgw.trueinfo.th/">
     <queryUserProfileRes>
      <authReqM>
       <cpid>TRUCRM</cpid>
       <appid>0001</appid>
       <cpTransactionId>8f11f2a5-99be-4a19-b662-b75d9ae76fba</cpTransactionId>
       <gwTransactionId>GWTRUCRM000121081714S200863DC9</gwTransactionId>
      </authReqM>
      <resultResM>
       <result>0</result>
       <resultDesc>success</resultDesc>
      </resultResM>
      <queryUserProfileResM>
       <msisdn>66877157090</msisdn>
       <acntStopDate>2018-03-13</acntStopDate>
       <completedDate>2018-03-13 07-21-11</completedDate>
       <gPRSChargeFlag>1</gPRSChargeFlag>
       <certType></certType>
       <certNo></certNo>
       <customerName>66877157090</customerName>
       <address>Real Move|</address>
       <defLang>1</defLang>
       <custType>A</custType>
       <productCode>PreRB</productCode>
       <productName>PreRB</productName>
       <pricePlanCode>R18NSB123</pricePlanCode>
       <imsi>520002071474784</imsi>
       <iccid>18031300000043669279</iccid>
       <pricePlanDtoList>
        <pricePlanDto>
         <pricePlanCode>R18NSB123</pricePlanCode>
         <pricePlanName>R18NSB123</pricePlanName>
         <createdDate>2018-03-13 07-21-11</createdDate>
         <effDate>2018-03-13 07-21-11</effDate>
         <expDate></expDate>
         <pricePlanAttrDtoList/>
        </pricePlanDto>
       </pricePlanDtoList>
       <fellowISDNDtoList/>
       <state>A</state>
       <stateSet>00000000000000</stateSet>
       <balDtoList>
        <balDto>
         <acctResName>Calling_Bonus</acctResName>
         <acctResCode>2</acctResCode>
         <balance>0</balance>
         <effDate>2018-03-13 07-21-06</effDate>
         <expDate>2050-12-31 07-21-06</expDate>
         <reservedBalance>0</reservedBalance>
        </balDto>
        <balDto>
         <acctResName>Main Balance</acctResName>
         <acctResCode>0</acctResCode>
         <balance>278.165</balance>
         <effDate>2018-03-13 00-00-00</effDate>
         <expDate>2021-10-05 17-48-08</expDate>
         <reservedBalance>0</reservedBalance>
        </balDto>
       </balDtoList>
       <activeStopDate>2021-10-04</activeStopDate>
       <suspendStopDate>2021-11-03</suspendStopDate>
       <disableStopDate>2021-11-18</disableStopDate>
       <serviceStopDate>2117-03-12</serviceStopDate>
       <refillTempErrorTimes>0</refillTempErrorTimes>
       <refillErrorTimes>0</refillErrorTimes>
       <routingID>42</routingID>
       <lowerThreshold>20</lowerThreshold>
       <maxPerRefill>50000000</maxPerRefill>
       <refillAble>Y</refillAble>
      </queryUserProfileResM>
      <extResM/>
     </queryUserProfileRes>
    </ns2:processQueryUserProfileResponse>
   </S:Body>
  </S:Envelope>
  `

  res.status(200).send(response)
}

module.exports.balance = async (req, res) => {
  console.log('===== POST balance =====')
  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 = `<?xml version='1.0' encoding='UTF-8'?>
  <S:Envelope
   xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
    <ns2:processQryBalanceListResponse
     xmlns:ns2="http://qrybalancelist.ws.ccpgw.trueinfo.th/">
     <qryBalanceListRes>
      <authReqM>
       <cpid>TRUCRM</cpid>
       <appid>0001</appid>
       <cpTransactionId>8f11f2a5-99be-4a19-b662-b75d9ae76fba</cpTransactionId>
       <gwTransactionId>GWTRUCRM000121081714S100863E5F</gwTransactionId>
      </authReqM>
      <resultResM>
       <result>0</result>
       <resultDesc>success</resultDesc>
      </resultResM>
      <qryBalanceListResM>
       <balDtoList>
        <balDto>
         <acctResName>Calling_Bonus</acctResName>
         <balanceID>8667338666</balanceID>
         <acctResCode>2</acctResCode>
         <balance>1000</balance>
         <effDate>2018-03-13 07-21-06</effDate>
         <expDate>2050-12-31 07-21-06</expDate>
         <updateDate>2018-12-27 17-29-19</updateDate>
         <reservedBalance>0</reservedBalance>
         <comments>Baht</comments>
        </balDto>
        <balDto>
         <acctResName>Main Balance</acctResName>
         <balanceID>8667320378</balanceID>
         <acctResCode>0</acctResCode>
         <balance>278.165</balance>
         <effDate>2018-03-13 00-00-00</effDate>
         <expDate>2021-10-05 17-48-08</expDate>
         <updateDate>2021-05-25 20-10-01</updateDate>
         <reservedBalance>0</reservedBalance>
         <comments>Baht</comments>
        </balDto>
        <balDto>
         <acctResName>DB_OC_V_TVS</acctResName>
         <balanceID>8667320378</balanceID>
         <acctResCode>0</acctResCode>
         <balance>10248252</balance>
         <effDate>2018-03-13 00-00-00</effDate>
         <expDate>2021-10-05 17-48-08</expDate>
         <updateDate>2021-05-25 20-10-01</updateDate>
         <reservedBalance>0</reservedBalance>
         <comments>mb</comments>
        </balDto>
        <balDto>
         <acctResName>VB_OC_IPK_IDD_ASIAN</acctResName>
         <balanceID>8667320378</balanceID>
         <acctResCode>0</acctResCode>
         <balance>3600</balance>
         <effDate>2018-03-13 00-00-00</effDate>
         <expDate>2021-10-05 17-48-08</expDate>
         <updateDate>2021-05-25 20-10-01</updateDate>
         <reservedBalance>0</reservedBalance>
         <comments>hr</comments>
        </balDto>
        <balDto>
         <acctResName>AAAA</acctResName>
         <balanceID>8667320378</balanceID>
         <acctResCode>0</acctResCode>
         <balance>125</balance>
         <effDate>2018-03-13 00-00-00</effDate>
         <expDate>2021-10-05 17-48-08</expDate>
         <updateDate>2021-05-25 20-10-01</updateDate>
         <reservedBalance>0</reservedBalance>
         <comments>umit</comments>
        </balDto>
       </balDtoList>
      </qryBalanceListResM>
      <extResM/>
     </qryBalanceListRes>
    </ns2:processQryBalanceListResponse>
   </S:Body>
  </S:Envelope>`

  res.status(200).send(response)
}