Skip to content

Time stamp

涂紳騰(Shen-Teng Tu) edited this page Feb 21, 2018 · 2 revisions

Time stamp

請求參數timeStampexpTimeStamp使用Unix時間戳(秒)。您必須使用Date來符合schema,他們將在通過驗證後自動轉換為Unix Timestamp。根據API規範,在發送請求之前,時間戳必須加上10秒

The request parameters timeStamp & expTimeStamp use Unix Timestamp (seconds).

You must use Date to conform to the schema , they will auto convert into Unix Timestamp after pass the validation.

According to API spec ,The timestamp must plus 10 seconds before send a request

require('dotenv').config();
const {TaiwanEInvoice, InquirerIdentity, CarrierCardType}= require('node-tw-e-invoice');
const {Serial}= require('node-tw-e-invoice').APIUtil;
const EInvoice = new TaiwanEInvoice(process.env.APP_ID,process.env.API_KEY);
const serial = new Serial();

EInvoice.inquirer(process.env.UUID,InquirerIdentity.Common)
.action('qryCarrierAgg',{
  serial:serial.next(),
  cardType: CarrierCardType.Mobile,
  cardNo:'/AB56P5Q',
  timeStamp:new Date(),//valid type is Date
  cardEncrypt:'password'
}).then((values)=>{
  let {path,method,param}  = values;
  param.timeStamp += 10;//must plus 10 seconds berfore send a request
  //start sending a request ...
}).catch((e)=>{console.log(e)});
Clone this wiki locally