diff --git a/lib/entities/payitems.js b/lib/entities/payitems.js index c425194e..b6204545 100644 --- a/lib/entities/payitems.js +++ b/lib/entities/payitems.js @@ -1,55 +1,55 @@ -var _ = require('lodash') - , Entity = require('./entity') - , logger = require('../logger') +var _ = require('lodash'), + Entity = require('./entity'), + logger = require('../logger') var EarningTypeSchema = new Entity.SchemaObject({ - EarningsType: {type: String}, - ExpenseAccountCode: {type: String}, - EarningsCategory: {type: String}, - RateType: {type: String}, - TypeOfUnits: {type: String}, - EarningRateID: {type: String}, - Multiple: {type: Number}, - DoNotAccrueTimeOff: { type: Boolean}, - IsSupplemental: { type: Boolean}, - Amount: { type: Number} + EarningsType: { type: String }, + ExpenseAccountCode: { type: String }, + EarningsCategory: { type: String }, + RateType: { type: String }, + TypeOfUnits: { type: String }, + EarningRateID: { type: String }, + Multiple: { type: Number }, + DoNotAccrueTimeOff: { type: Boolean }, + IsSupplemental: { type: Boolean }, + Amount: { type: Number } }); var BenefitTypeSchema = new Entity.SchemaObject({ - BenefitType: {type: String}, - BenefitCategory: {type: String}, - LiabilityAccountCode: {type: String}, - ExpenseAccountCode: {type: String}, - BenefitTypeID: {type: String}, - StandardAmount: {type: Number}, - CompanyMax: { type: Number}, - Percentage: { type: Number}, - ShowBalanceOnPaystub: { type: Boolean} + BenefitType: { type: String }, + BenefitCategory: { type: String }, + LiabilityAccountCode: { type: String }, + ExpenseAccountCode: { type: String }, + BenefitTypeID: { type: String }, + StandardAmount: { type: Number }, + CompanyMax: { type: Number }, + Percentage: { type: Number }, + ShowBalanceOnPaystub: { type: Boolean } }); var DeductionTypeSchema = new Entity.SchemaObject({ - DeductionType: {type: String}, - DeductionCategory: {type: String}, - CalculationType: {type: String}, - LiabilityAccountCode: {type: String}, - DeductionTypeID: {type: String}, - StandardAmount: {type: Number}, - CompanyMax: { type: Number} + DeductionType: { type: String }, + DeductionCategory: { type: String }, + CalculationType: { type: String }, + LiabilityAccountCode: { type: String }, + DeductionTypeID: { type: String }, + StandardAmount: { type: Number }, + CompanyMax: { type: Number } }); var ReimbursementTypeSchema = new Entity.SchemaObject({ - DeductionType: {type: String}, - ExpenseOfLiabilityAccountCode: {type: String}, - ReimbursementTypeID: {type: String} + DeductionType: { type: String }, + ExpenseOfLiabilityAccountCode: { type: String }, + ReimbursementTypeID: { type: String } }); var TimeOffTypeSchema = new Entity.SchemaObject({ - TimeOffType: {type: String}, - TimeOffCategory: {type: String}, - LiabilityAccountCode: {type: String}, - ExpenseAccountCode: {type: String}, - TimeOffTypeID: {type: String}, - ShowBalanceToEmployee: { type: Boolean} + TimeOffType: { type: String }, + TimeOffCategory: { type: String }, + LiabilityAccountCode: { type: String }, + ExpenseAccountCode: { type: String }, + TimeOffTypeID: { type: String }, + ShowBalanceToEmployee: { type: Boolean } }); var PayItemsSchema = new Entity.SchemaObject({ @@ -63,26 +63,20 @@ var PayItemsSchema = new Entity.SchemaObject({ var PayItems = Entity.extend(PayItemsSchema, { - constructor: function (application, data, options) - { + constructor: function(application, data, options) { logger.debug('PayItems::constructor'); this.Entity.apply(this, arguments); }, - initialize: function (data, options) - { - }, - changes: function (options) - { + initialize: function(data, options) {}, + changes: function(options) { return this._super(options); }, - _toObject: function (options) - { + _toObject: function(options) { return this._super(options); }, - fromXmlObj: function (obj) - { + fromXmlObj: function(obj) { var self = this; - _.extend(self, _.omit(obj, 'BenefitTypes','EarningsTypes', 'ReimbursementTypes', 'DeductionTypes','TimeOffTypes')); + _.extend(self, _.omit(obj, 'BenefitTypes', 'EarningsTypes', 'ReimbursementTypes', 'DeductionTypes', 'TimeOffTypes')); if (obj.BenefitTypes) { this.extractArray(obj.BenefitTypes.BenefitType, this.BenefitTypes); } @@ -102,11 +96,10 @@ var PayItems = Entity.extend(PayItemsSchema, { return this; }, - toXml: function () - { + toXml: function() { } }); -module.exports = PayItems; +module.exports = PayItems; \ No newline at end of file diff --git a/lib/entities/taxrate.js b/lib/entities/taxrate.js index 6b42fdcf..aa37bfaa 100644 --- a/lib/entities/taxrate.js +++ b/lib/entities/taxrate.js @@ -18,7 +18,7 @@ var TaxRateSchema = new Entity.SchemaObject({ var TaxComponentSchema = new Entity.SchemaObject({ Name: { type: String, toObject: 'always' }, - Rate: { type: Number, toObject: 'always' }, + Rate: { type: String, toObject: 'always' }, IsCompound: { type: Boolean, toObject: 'always' } }); @@ -31,6 +31,10 @@ var TaxRate = Entity.extend(TaxRateSchema, { fromXmlObj: function(obj) { var self = this; _.extend(self, _.omit(obj, 'TaxComponents')); + if (obj.TaxComponents) { + this.extractArray(obj.TaxComponents.TaxComponent, this.TaxComponents); + } + return this; }, }); diff --git a/test/accountingtests.js b/test/accountingtests.js index 325d0f59..61308349 100644 --- a/test/accountingtests.js +++ b/test/accountingtests.js @@ -13,7 +13,7 @@ process.on('uncaughtException', function(err) { var currentApp; var organisationCountry = ""; -var APPTYPE = "PARTNER"; +var APPTYPE = "PRIVATE"; var privateConfigFile = "../private_app_config.json"; var publicConfigFile = "../public_app_config.json"; var partnerConfigFile = "../partner_app_config.json"; @@ -250,7 +250,7 @@ describe('regression tests', function() { _.each(taxRate.TaxComponents, function(taxComponent) { expect(taxComponent.Name).to.not.equal(""); expect(taxComponent.Name).to.not.equal(undefined); - expect(taxComponent.Rate).to.be.a('Number'); + expect(taxComponent.Rate).to.be.a('String'); expect(taxComponent.IsCompound).to.be.oneOf([true, false]); }); });