Skip to content

Commit

Permalink
Major release (#46)
Browse files Browse the repository at this point in the history
Removing request-promise/native, replace with node-fetch
Bump up node version support to 12
Bump up dependencies versions #47 #48
Fix mutual exclusive for serial number and lot number in Item detail
Add APPYMT support, refactor ApPaymentRequest to ApPayment
Add ApPaymentRequestDecline to dist folder #44
Fix negative clause for InArray and InString
Add sessionTimestamp and sessionTimeout to ClientConfig
Add Timesheet approve, decline, update #31
  • Loading branch information
intacctcoleenho authored Dec 18, 2020
1 parent 28aa6b8 commit b76ddae
Show file tree
Hide file tree
Showing 92 changed files with 4,219 additions and 2,342 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
language: node_js
node_js:
- 6
- 8
- 10
- 12
- 14

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## System Requirements

* You must have an active Sage Intacct Web Services Developer license
* Node.js >= 6.17.0. The SDK is written in TypeScript and targets ES2015.
* Node.js >= 12.18.1. The SDK is written in TypeScript and targets ES2015.

[intacct]: http://www.intacct.com
[ia-developer]: https://developer.intacct.com/
Expand Down
3,383 changes: 1,556 additions & 1,827 deletions package-lock.json

Large diffs are not rendered by default.

62 changes: 29 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@intacct/intacct-sdk",
"version": "1.3.0",
"version": "2.0.0",
"description": "Sage Intacct SDK for JavaScript",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"url": "https://github.com/intacct/intacct-sdk-js/issues"
},
"engines": {
"node": ">=6.17.0"
"node": ">=12.18.1"
},
"files": [
"/dist"
Expand All @@ -47,42 +47,38 @@
"postversion": "git push && git push --tags"
},
"devDependencies": {
"@types/chai": "~4.1.3",
"@types/dateformat": "^1.0.1",
"@types/ini": "^1.3.29",
"@types/lodash": "^4.14.109",
"@types/mocha": "^2.2.48",
"@types/mock-fs": "^3.6.30",
"@types/nock": "^8.2.1",
"@types/node": "7.10.2",
"@types/request": "^2.48.1",
"@types/request-promise-native": "^1.0.14",
"@types/uuid": "^3.4.2",
"@types/winston": "^2.3.9",
"@types/xml2js": "^0.4.2",
"@types/chai": "~4.2.14",
"@types/dateformat": "^3.0.1",
"@types/ini": "^1.3.30",
"@types/lodash": "^4.14.165",
"@types/mocha": "^8.2.0",
"@types/mock-fs": "^4.13.0",
"@types/node": "^14.14.14",
"@types/uuid": "^8.3.0",
"@types/winston": "^2.4.4",
"@types/xml2js": "^0.4.7",
"@types/xmlbuilder": "^0.0.32",
"chai": "~4.2.0",
"mocha": "^6.1.4",
"mock-fs": "^4.8.0",
"nock": "^9.2.6",
"nyc": "^14.1.1",
"rimraf": "^2.6.2",
"ts-node": "^4.1.0",
"tslint": "^5.12.1",
"typedoc": "^0.14.2",
"typedoc-plugin-external-module-name": "^2.1.0",
"typescript": "^2.8.4"
"mocha": "^8.2.1",
"mock-fs": "^4.13.0",
"nock": "^13.0.5",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"ts-node": "^9.1.1",
"tslint": "^5.20.1",
"typedoc": "^0.17.8",
"typedoc-plugin-external-module-name": "^4.0.4",
"typescript": "^4.1.3"
},
"dependencies": {
"content-type": "^1.0.4",
"dateformat": "^3.0.3",
"ini": "^1.3.4",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"dateformat": "^4.3.1",
"ini": "^1.3.8",
"node-fetch": "^2.6.1",
"striptags": "^3.1.1",
"uuid": "^3.3.2",
"winston": "^2.4.2",
"xml2js": "^0.4.19",
"xmlbuilder": "^9.0.7"
"uuid": "^8.3.2",
"winston": "^3.3.3",
"xml2js": "^0.4.23",
"xmlbuilder": "^12.0.1"
}
}
8 changes: 6 additions & 2 deletions src/ClientConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* permissions and limitations under the License.
*/

import {LoggerInstance} from "winston";
import {Logger} from "winston";
import ICredentials from "./Credentials/ICredentials";
import MessageFormatter from "./Logging/MessageFormatter";

Expand All @@ -35,6 +35,10 @@ export default class ClientConfig {

public sessionId: string;

public sessionTimestamp: string;

public sessionTimeout: string;

public companyId: string;

public entityId: string;
Expand All @@ -45,7 +49,7 @@ export default class ClientConfig {

public credentials: ICredentials;

public logger: LoggerInstance;
public logger: Logger;

public logLevel: string;

Expand Down
4 changes: 2 additions & 2 deletions src/Functions/AbstractFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* permissions and limitations under the License.
*/

import * as uuid from "uuid/v4";
import { v4 as uuidv4 } from "uuid";
import IaXmlWriter from "../Xml/IaXmlWriter";
import IFunction from "./IFunction";

Expand All @@ -30,7 +30,7 @@ export default abstract class AbstractFunction implements IFunction {
}
set controlId(controlId: string) {
if (controlId == null || controlId === "") {
controlId = uuid();
controlId = uuidv4();
}
if (controlId.length < 1 || controlId.length > 256) {
throw new Error("Function control ID must be between 1 and 256 characters in length.");
Expand Down
47 changes: 47 additions & 0 deletions src/Functions/AccountsPayable/AbstractApPaymentDetailCredit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @module Intacct/SDK/Functions/AccountsPayable
*/

/**
* Copyright 2020 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import IaXmlWriter from "../../Xml/IaXmlWriter";

export default abstract class AbstractApPaymentDetailCredit {

public static readonly DEBIT_MEMO = "debit memo";

public static readonly NEGATIVE_BILL = "negative bill";

public static readonly ADVANCE = "advance";

public recordNo: number;

public lineRecordNo: number;

public transactionAmount: number;

public writeXml(xml: IaXmlWriter): void {
xml.writeElement(this.getKeyType(), this.recordNo, true);
xml.writeElement(this.getEntryKeyType(), this.lineRecordNo);
xml.writeElement(this.getTransactionType(), this.transactionAmount);
}

protected abstract getKeyType(): string;

protected abstract getEntryKeyType(): string;

protected abstract getTransactionType(): string;
}
96 changes: 96 additions & 0 deletions src/Functions/AccountsPayable/AbstractApPaymentFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* @module Intacct/SDK/Functions/AccountsPayable
*/

/**
* Copyright 2020 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import IntacctException from "../../Exceptions/IntacctException";
import IaXmlWriter from "../../Xml/IaXmlWriter";
import AbstractFunction from "../AbstractFunction";

export default abstract class AbstractApPaymentFunction extends AbstractFunction {

public static readonly DELETE = "delete";

public static readonly DECLINE = "decline_appaymentrequest";

public static readonly CONFIRM = "confirm_appaymentrequest";

public static readonly APPROVE = "approve_appaymentrequest";

public static readonly SEND = "send_appaymentrequest";

public static readonly VOID = "void_appaymentrequest";

private recordNo: number;

constructor(recordNo: number, controlId?: string) {
super(controlId);
this.recordNo = recordNo;
}

public writeXml(xml: IaXmlWriter): void {
switch (this.getFunction()) {
case AbstractApPaymentFunction.DELETE:
this.writeCrudXml(xml);
break;
case AbstractApPaymentFunction.DECLINE:
case AbstractApPaymentFunction.CONFIRM:
case AbstractApPaymentFunction.APPROVE:
case AbstractApPaymentFunction.SEND:
case AbstractApPaymentFunction.VOID:
this.writeLegacyXml(xml);
break;
default:
throw new IntacctException("Cannot write XML for ApPaymentFunction " + this.getFunction());
}
}

protected abstract getFunction(): string;

private writeCrudXml(xml: IaXmlWriter): void {

xml.writeStartElement("function");
xml.writeAttribute("controlid", this.controlId, true);

xml.writeStartElement(this.getFunction());

xml.writeElement("object", "APPYMT");
xml.writeElement("keys", this.recordNo);

xml.writeEndElement(); // delete

xml.writeEndElement(); // function
}

private writeLegacyXml(xml: IaXmlWriter): void {

xml.writeStartElement("function");
xml.writeAttribute("controlid", this.controlId, true);

xml.writeStartElement(this.getFunction());

xml.writeStartElement("appaymentkeys");

xml.writeElement("appaymentkey", this.recordNo, true);

xml.writeEndElement(); // appaymentkeys

xml.writeEndElement(); // GetFunction

xml.writeEndElement(); // function
}
}
30 changes: 30 additions & 0 deletions src/Functions/AccountsPayable/ApPaymentApprove.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @module Intacct/SDK/Functions/AccountsPayable
*/

/**
* Copyright 2020 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import AbstractApPaymentFunction from "./AbstractApPaymentFunction";

export default class ApPaymentApprove extends AbstractApPaymentFunction {
constructor(recordNo: number, controlId?: string) {
super(recordNo, controlId);
}

protected getFunction(): string {
return AbstractApPaymentFunction.APPROVE;
}
}
30 changes: 30 additions & 0 deletions src/Functions/AccountsPayable/ApPaymentConfirm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @module Intacct/SDK/Functions/AccountsPayable
*/

/**
* Copyright 2020 Sage Intacct, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "LICENSE" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import AbstractApPaymentFunction from "./AbstractApPaymentFunction";

export default class ApPaymentConfirm extends AbstractApPaymentFunction {
constructor(recordNo: number, controlId?: string) {
super(recordNo, controlId);
}

protected getFunction(): string {
return AbstractApPaymentFunction.CONFIRM;
}
}
Loading

0 comments on commit b76ddae

Please sign in to comment.