UNPKG

theendsoaper

Version:

Access Untill Tills with SOAP from Node.js and parse the results as objects, some extra useful functions in as well.

27 lines (25 loc) 935 B
const Payment = require('./payment'); module.exports = class Bill { constructor(bill){ this.id = bill['Id']; this.dateTime = bill['DateTime']; this.realDateTime = bill['RealDateTime']; this.computerName = bill['ComputerName']; this.billNumber = bill['BillNumber']; this.userId = bill['UserId']; this.clientName = bill['ClientName']; this.salesAreaId = bill['SalesAreaId']; this.tip = bill['Tip']; var pList = []; if(bill['Payments']['item'].length === undefined){ pList.push(new Payment(bill['Payments']['item'])); } else { for (var i in bill['Payments']['item']){ pList.push(new Payment(bill['Payments']['item'][i])); } } this.payments = pList; this.extra = bill['Extra']; this.clientId = bill['ClientId']; } }