@things-factory/integration-accounting 9.0.0-beta.27 → 9.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/controllers/accounting-api/decorators.d.ts +1 -0
- package/dist-server/controllers/accounting-api/decorators.js +33 -0
- package/dist-server/controllers/accounting-api/decorators.js.map +1 -0
- package/dist-server/controllers/accounting-api/index.d.ts +25 -0
- package/dist-server/controllers/accounting-api/index.js +124 -0
- package/dist-server/controllers/accounting-api/index.js.map +1 -0
- package/dist-server/controllers/index.d.ts +2 -0
- package/dist-server/controllers/index.js +6 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/controllers/xero/apis/contact/get-contact.d.ts +19 -0
- package/dist-server/controllers/xero/apis/contact/get-contact.js +32 -0
- package/dist-server/controllers/xero/apis/contact/get-contact.js.map +1 -0
- package/dist-server/controllers/xero/apis/contact/get-contacts.d.ts +8 -0
- package/dist-server/controllers/xero/apis/contact/get-contacts.js +18 -0
- package/dist-server/controllers/xero/apis/contact/get-contacts.js.map +1 -0
- package/dist-server/controllers/xero/apis/contact/index.d.ts +2 -0
- package/dist-server/controllers/xero/apis/contact/index.js +6 -0
- package/dist-server/controllers/xero/apis/contact/index.js.map +1 -0
- package/dist-server/controllers/xero/apis/index.d.ts +4 -0
- package/dist-server/controllers/xero/apis/index.js +8 -0
- package/dist-server/controllers/xero/apis/index.js.map +1 -0
- package/dist-server/controllers/xero/apis/invoice/create-invoice.d.ts +6 -0
- package/dist-server/controllers/xero/apis/invoice/create-invoice.js +16 -0
- package/dist-server/controllers/xero/apis/invoice/create-invoice.js.map +1 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoice.d.ts +10 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoice.js +18 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoice.js.map +1 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoices.d.ts +10 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoices.js +59 -0
- package/dist-server/controllers/xero/apis/invoice/get-invoices.js.map +1 -0
- package/dist-server/controllers/xero/apis/invoice/index.d.ts +4 -0
- package/dist-server/controllers/xero/apis/invoice/index.js +8 -0
- package/dist-server/controllers/xero/apis/invoice/index.js.map +1 -0
- package/dist-server/controllers/xero/apis/invoice/update-invoice.d.ts +6 -0
- package/dist-server/controllers/xero/apis/invoice/update-invoice.js +16 -0
- package/dist-server/controllers/xero/apis/invoice/update-invoice.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/create-item.d.ts +16 -0
- package/dist-server/controllers/xero/apis/item/create-item.js +32 -0
- package/dist-server/controllers/xero/apis/item/create-item.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/delete-item.d.ts +11 -0
- package/dist-server/controllers/xero/apis/item/delete-item.js +21 -0
- package/dist-server/controllers/xero/apis/item/delete-item.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/get-item.d.ts +10 -0
- package/dist-server/controllers/xero/apis/item/get-item.js +34 -0
- package/dist-server/controllers/xero/apis/item/get-item.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/get-items.d.ts +8 -0
- package/dist-server/controllers/xero/apis/item/get-items.js +32 -0
- package/dist-server/controllers/xero/apis/item/get-items.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/index.d.ts +6 -0
- package/dist-server/controllers/xero/apis/item/index.js +10 -0
- package/dist-server/controllers/xero/apis/item/index.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/update-item.d.ts +14 -0
- package/dist-server/controllers/xero/apis/item/update-item.js +30 -0
- package/dist-server/controllers/xero/apis/item/update-item.js.map +1 -0
- package/dist-server/controllers/xero/apis/item/update-items.d.ts +10 -0
- package/dist-server/controllers/xero/apis/item/update-items.js +36 -0
- package/dist-server/controllers/xero/apis/item/update-items.js.map +1 -0
- package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.d.ts +8 -0
- package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.js +56 -0
- package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.js.map +1 -0
- package/dist-server/controllers/xero/apis/purchase-order/index.d.ts +1 -0
- package/dist-server/controllers/xero/apis/purchase-order/index.js +5 -0
- package/dist-server/controllers/xero/apis/purchase-order/index.js.map +1 -0
- package/dist-server/controllers/xero/index.d.ts +1 -0
- package/dist-server/controllers/xero/index.js +9 -0
- package/dist-server/controllers/xero/index.js.map +1 -0
- package/dist-server/controllers/xero/platform-action.d.ts +6 -0
- package/dist-server/controllers/xero/platform-action.js +49 -0
- package/dist-server/controllers/xero/platform-action.js.map +1 -0
- package/dist-server/controllers/xero/xero.d.ts +18 -0
- package/dist-server/controllers/xero/xero.js +155 -0
- package/dist-server/controllers/xero/xero.js.map +1 -0
- package/dist-server/engine/connector/accounting-connector.d.ts +8 -0
- package/dist-server/engine/connector/accounting-connector.js +28 -0
- package/dist-server/engine/connector/accounting-connector.js.map +1 -0
- package/dist-server/engine/connector/index.d.ts +1 -0
- package/dist-server/engine/connector/index.js +4 -0
- package/dist-server/engine/connector/index.js.map +1 -0
- package/dist-server/engine/index.d.ts +2 -0
- package/dist-server/engine/index.js +5 -0
- package/dist-server/engine/index.js.map +1 -0
- package/dist-server/engine/task/accounting-api.d.ts +1 -0
- package/dist-server/engine/task/accounting-api.js +54 -0
- package/dist-server/engine/task/accounting-api.js.map +1 -0
- package/dist-server/engine/task/index.d.ts +1 -0
- package/dist-server/engine/task/index.js +4 -0
- package/dist-server/engine/task/index.js.map +1 -0
- package/dist-server/entities/account.d.ts +23 -0
- package/dist-server/entities/account.js +113 -0
- package/dist-server/entities/account.js.map +1 -0
- package/dist-server/entities/index.d.ts +3 -0
- package/dist-server/entities/index.js +7 -0
- package/dist-server/entities/index.js.map +1 -0
- package/dist-server/graphql/index.d.ts +6 -0
- package/dist-server/graphql/index.js +11 -0
- package/dist-server/graphql/index.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/account.d.ts +6 -0
- package/dist-server/graphql/resolvers/accounting/account.js +15 -0
- package/dist-server/graphql/resolvers/accounting/account.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/accounts.d.ts +8 -0
- package/dist-server/graphql/resolvers/accounting/accounts.js +14 -0
- package/dist-server/graphql/resolvers/accounting/accounts.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/create-account.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/create-account.js +13 -0
- package/dist-server/graphql/resolvers/accounting/create-account.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/delete-account.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/delete-account.js +16 -0
- package/dist-server/graphql/resolvers/accounting/delete-account.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/delete-accounts.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/delete-accounts.js +20 -0
- package/dist-server/graphql/resolvers/accounting/delete-accounts.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/index.d.ts +25 -0
- package/dist-server/graphql/resolvers/accounting/index.js +15 -0
- package/dist-server/graphql/resolvers/accounting/index.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/update-account.d.ts +6 -0
- package/dist-server/graphql/resolvers/accounting/update-account.js +15 -0
- package/dist-server/graphql/resolvers/accounting/update-account.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.js +30 -0
- package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.js +51 -0
- package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.d.ts +6 -0
- package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.js +31 -0
- package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/xero/index.d.ts +13 -0
- package/dist-server/graphql/resolvers/accounting/xero/index.js +9 -0
- package/dist-server/graphql/resolvers/accounting/xero/index.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.d.ts +5 -0
- package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.js +51 -0
- package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.d.ts +20 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.js +32 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-item.d.ts +24 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-item.js +36 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-item.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.d.ts +6 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.js +16 -0
- package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.js.map +1 -0
- package/dist-server/graphql/resolvers/accounting-api/index.d.ts +44 -0
- package/dist-server/graphql/resolvers/accounting-api/index.js +9 -0
- package/dist-server/graphql/resolvers/accounting-api/index.js.map +1 -0
- package/dist-server/graphql/resolvers/index.d.ts +25 -0
- package/dist-server/graphql/resolvers/index.js +8 -0
- package/dist-server/graphql/resolvers/index.js.map +1 -0
- package/dist-server/graphql/types/accounting/account-list.d.ts +1 -0
- package/dist-server/graphql/types/accounting/account-list.js +12 -0
- package/dist-server/graphql/types/accounting/account-list.js.map +1 -0
- package/dist-server/graphql/types/accounting/account-patch.d.ts +1 -0
- package/dist-server/graphql/types/accounting/account-patch.js +18 -0
- package/dist-server/graphql/types/accounting/account-patch.js.map +1 -0
- package/dist-server/graphql/types/accounting/account.d.ts +1 -0
- package/dist-server/graphql/types/accounting/account.js +29 -0
- package/dist-server/graphql/types/accounting/account.js.map +1 -0
- package/dist-server/graphql/types/accounting/index.d.ts +3 -0
- package/dist-server/graphql/types/accounting/index.js +45 -0
- package/dist-server/graphql/types/accounting/index.js.map +1 -0
- package/dist-server/graphql/types/accounting/new-account.d.ts +1 -0
- package/dist-server/graphql/types/accounting/new-account.js +16 -0
- package/dist-server/graphql/types/accounting/new-account.js.map +1 -0
- package/dist-server/graphql/types/accounting-api/invoice.d.ts +3 -0
- package/dist-server/graphql/types/accounting-api/invoice.js +63 -0
- package/dist-server/graphql/types/accounting-api/invoice.js.map +1 -0
- package/dist-server/graphql/types/accounting-api/item.d.ts +3 -0
- package/dist-server/graphql/types/accounting-api/item.js +63 -0
- package/dist-server/graphql/types/accounting-api/item.js.map +1 -0
- package/dist-server/graphql/types/accounting-api/purchase-order.d.ts +2 -0
- package/dist-server/graphql/types/accounting-api/purchase-order.js +34 -0
- package/dist-server/graphql/types/accounting-api/purchase-order.js.map +1 -0
- package/dist-server/graphql/types/index.d.ts +3 -0
- package/dist-server/graphql/types/index.js +12 -0
- package/dist-server/graphql/types/index.js.map +1 -0
- package/dist-server/index.d.ts +6 -0
- package/dist-server/index.js +11 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routers/xero-private-router.d.ts +1 -0
- package/dist-server/routers/xero-private-router.js +17 -0
- package/dist-server/routers/xero-private-router.js.map +1 -0
- package/dist-server/routers/xero-router.d.ts +1 -0
- package/dist-server/routers/xero-router.js +109 -0
- package/dist-server/routers/xero-router.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +11 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +13 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const api: (target: Object, property: string, descriptor: TypedPropertyDescriptor<any>) => any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.api = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
6
|
+
const debug = (0, debug_1.default)('things-factory:integration-accounting:accounting-api-decorator');
|
|
7
|
+
const NOOP = v => v;
|
|
8
|
+
const api = (target, property, descriptor) => {
|
|
9
|
+
const method = descriptor.value;
|
|
10
|
+
descriptor.value = async function (accounting, request) {
|
|
11
|
+
const AccountingAPI = this;
|
|
12
|
+
var { platform } = accounting;
|
|
13
|
+
var { action: platformAction, apis } = AccountingAPI.getPlatform(platform);
|
|
14
|
+
var m = apis[method.name];
|
|
15
|
+
if (!m) {
|
|
16
|
+
throw Error(`Accounting Platform '${platform}' doesn't have API ${method.name}`);
|
|
17
|
+
}
|
|
18
|
+
var { path, method: httpMethod = 'post', denormalize = NOOP, normalize = NOOP, action = platformAction } = m.apply(this, [request]);
|
|
19
|
+
var denormalized = await denormalize(request || {}, { accounting });
|
|
20
|
+
debug('request', denormalized);
|
|
21
|
+
var response = await action.apply(this, [
|
|
22
|
+
{ accounting, method: httpMethod, path, request: denormalized, platformAction }
|
|
23
|
+
]);
|
|
24
|
+
debug('response', response);
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
throw response;
|
|
27
|
+
}
|
|
28
|
+
return await normalize(response, { accounting });
|
|
29
|
+
};
|
|
30
|
+
return descriptor;
|
|
31
|
+
};
|
|
32
|
+
exports.api = api;
|
|
33
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../server/controllers/accounting-api/decorators.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AACzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,gEAAgE,CAAC,CAAA;AAIrF,MAAM,IAAI,GAAG,C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EAAE,EAAE,CAAC;YACjB,MAAM,QAAQ,CAAA;QAChB,CAAC;QAED,OAAO,MAAM,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;IAClD,CAAC,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAvCY,QAAA,GAAG,OAuCf","sourcesContent":["import Debug from 'debug'\nconst debug = Debug('things-factory:integration-accounting:accounting-api-decorator')\n\nimport { Account } from '../../entities'\n\nconst NOOP = v => v\n\nexport const api = (target: Object, property: string, descriptor: TypedPropertyDescriptor<any>): any => {\n const method = descriptor.value\n\n descriptor.value = async function (accounting: Account, request) {\n const AccountingAPI = this\n\n var { platform } = accounting\n\n var { action: platformAction, apis } = AccountingAPI.getPlatform(platform)\n\n var m = apis[method.name]\n if (!m) {\n throw Error(`Accounting Platform '${platform}' doesn't have API ${method.name}`)\n }\n\n var {\n path,\n method: httpMethod = 'post',\n denormalize = NOOP,\n normalize = NOOP,\n action = platformAction\n } = m.apply(this, [request])\n\n var denormalized = await denormalize(request || {}, { accounting })\n debug('request', denormalized)\n\n var response = await action.apply(this, [\n { accounting, method: httpMethod, path, request: denormalized, platformAction }\n ])\n\n debug('response', response)\n if (!response.ok) {\n throw response\n }\n\n return await normalize(response, { accounting })\n }\n\n return descriptor\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Account } from '../../entities';
|
|
2
|
+
export declare const ACCOUNTING_STATUS: {
|
|
3
|
+
ACTIVE: string;
|
|
4
|
+
INACTIVE: string;
|
|
5
|
+
TERMINATED: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class AccountingAPI {
|
|
8
|
+
static platforms: {};
|
|
9
|
+
static registerPlatform(name: any, action: any, apis: any): void;
|
|
10
|
+
static getPlatform(name: any): any;
|
|
11
|
+
static getAccounting(id: any): Promise<Account>;
|
|
12
|
+
static getInvoice(accounting: any, req: any): any;
|
|
13
|
+
static getInvoices(accounting: any, req: any): any;
|
|
14
|
+
static createInvoice(accounting: any, req: any): any;
|
|
15
|
+
static updateInvoice(accounting: any, req: any): any;
|
|
16
|
+
static getPurchaseOrders(accounting: any, req: any): any;
|
|
17
|
+
static getContact(accounting: any, req: any): any;
|
|
18
|
+
static getContacts(accounting: any, req: any): any;
|
|
19
|
+
static getItem(accounting: any, req: any): any;
|
|
20
|
+
static getItems(accounting: any, req: any): any;
|
|
21
|
+
static createItem(accounting: any, req: any): any;
|
|
22
|
+
static updateItem(accounting: any, req: any): any;
|
|
23
|
+
static updateItems(accounting: any, req: any): any;
|
|
24
|
+
static deleteItem(accounting: any, req: any): any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountingAPI = exports.ACCOUNTING_STATUS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const shell_1 = require("@things-factory/shell");
|
|
6
|
+
const entities_1 = require("../../entities");
|
|
7
|
+
const decorators_1 = require("./decorators");
|
|
8
|
+
exports.ACCOUNTING_STATUS = {
|
|
9
|
+
ACTIVE: 'active',
|
|
10
|
+
INACTIVE: 'inactive',
|
|
11
|
+
TERMINATED: 'terminated'
|
|
12
|
+
};
|
|
13
|
+
class AccountingAPI {
|
|
14
|
+
static registerPlatform(name, action, apis) {
|
|
15
|
+
AccountingAPI.platforms[name] = {
|
|
16
|
+
action,
|
|
17
|
+
apis
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static getPlatform(name) {
|
|
21
|
+
return AccountingAPI.platforms[name];
|
|
22
|
+
}
|
|
23
|
+
static async getAccounting(id) {
|
|
24
|
+
const repository = (0, shell_1.getRepository)(entities_1.Account);
|
|
25
|
+
return await repository.findOne({
|
|
26
|
+
where: { id },
|
|
27
|
+
relations: ['domain']
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static getInvoice(accounting, req) { }
|
|
31
|
+
static getInvoices(accounting, req) { }
|
|
32
|
+
static createInvoice(accounting, req) { }
|
|
33
|
+
static updateInvoice(accounting, req) { }
|
|
34
|
+
static getPurchaseOrders(accounting, req) { }
|
|
35
|
+
static getContact(accounting, req) { }
|
|
36
|
+
static getContacts(accounting, req) { }
|
|
37
|
+
static getItem(accounting, req) { }
|
|
38
|
+
static getItems(accounting, req) { }
|
|
39
|
+
static createItem(accounting, req) { }
|
|
40
|
+
static updateItem(accounting, req) { }
|
|
41
|
+
static updateItems(accounting, req) { }
|
|
42
|
+
static deleteItem(accounting, req) { }
|
|
43
|
+
}
|
|
44
|
+
exports.AccountingAPI = AccountingAPI;
|
|
45
|
+
AccountingAPI.platforms = {};
|
|
46
|
+
tslib_1.__decorate([
|
|
47
|
+
decorators_1.api,
|
|
48
|
+
tslib_1.__metadata("design:type", Function),
|
|
49
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
50
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
51
|
+
], AccountingAPI, "getInvoice", null);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
decorators_1.api,
|
|
54
|
+
tslib_1.__metadata("design:type", Function),
|
|
55
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
56
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
57
|
+
], AccountingAPI, "getInvoices", null);
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
decorators_1.api,
|
|
60
|
+
tslib_1.__metadata("design:type", Function),
|
|
61
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
62
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
63
|
+
], AccountingAPI, "createInvoice", null);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
decorators_1.api,
|
|
66
|
+
tslib_1.__metadata("design:type", Function),
|
|
67
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
68
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
69
|
+
], AccountingAPI, "updateInvoice", null);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
decorators_1.api,
|
|
72
|
+
tslib_1.__metadata("design:type", Function),
|
|
73
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
74
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
75
|
+
], AccountingAPI, "getPurchaseOrders", null);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
decorators_1.api,
|
|
78
|
+
tslib_1.__metadata("design:type", Function),
|
|
79
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
80
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
81
|
+
], AccountingAPI, "getContact", null);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
decorators_1.api,
|
|
84
|
+
tslib_1.__metadata("design:type", Function),
|
|
85
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
86
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
87
|
+
], AccountingAPI, "getContacts", null);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
decorators_1.api,
|
|
90
|
+
tslib_1.__metadata("design:type", Function),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
92
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
93
|
+
], AccountingAPI, "getItem", null);
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
decorators_1.api,
|
|
96
|
+
tslib_1.__metadata("design:type", Function),
|
|
97
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
98
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
99
|
+
], AccountingAPI, "getItems", null);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
decorators_1.api,
|
|
102
|
+
tslib_1.__metadata("design:type", Function),
|
|
103
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
104
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
105
|
+
], AccountingAPI, "createItem", null);
|
|
106
|
+
tslib_1.__decorate([
|
|
107
|
+
decorators_1.api,
|
|
108
|
+
tslib_1.__metadata("design:type", Function),
|
|
109
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
110
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
111
|
+
], AccountingAPI, "updateItem", null);
|
|
112
|
+
tslib_1.__decorate([
|
|
113
|
+
decorators_1.api,
|
|
114
|
+
tslib_1.__metadata("design:type", Function),
|
|
115
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
116
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
117
|
+
], AccountingAPI, "updateItems", null);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
decorators_1.api,
|
|
120
|
+
tslib_1.__metadata("design:type", Function),
|
|
121
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
122
|
+
tslib_1.__metadata("design:returntype", Object)
|
|
123
|
+
], AccountingAPI, "deleteItem", null);
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/accounting-api/index.ts"],"names":[],"mappings":";;;;AAAA,iDAAqD;AAErD,6CAAwC;AACxC,6CAAkC;AAErB,QAAA,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CACzB,CAAA;AAED,MAAa,aAAa;IAGxB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI;QACxC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YAC9B,MAAM;YACN,IAAI;SACL,CAAA;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAI;QACrB,OAAO,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QAC3B,MAAM,UAAU,GAAG,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gBAAG;;;;wCACyC;AAGtC;IADN,gBAAG;;;;4CAC6C;AAG1C;IADN,gBAAG;;;;qCACsC;AAGnC;IADN,gBAAG;;;;sCACuC;AAGpC;IADN,gBAAG;;;;kCACmC;AAGhC;IADN,gBAAG;;;;mCACoC;AAGjC;IADN,gBAAG;;;;qCACsC;AAGnC;IADN,gBAAG;;;;qCACsC;AAGnC;IADN,gBAAG;;;;sCACuC;AAGpC;IADN,gBAAG;;;;qCACsC","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { Account } from '../../entities'\nimport { api } from './decorators'\n\nexport const ACCOUNTING_STATUS = {\n ACTIVE: 'active',\n INACTIVE: 'inactive',\n TERMINATED: 'terminated'\n}\n\nexport class AccountingAPI {\n static platforms = {}\n\n static registerPlatform(name, action, apis) {\n AccountingAPI.platforms[name] = {\n action,\n apis\n }\n }\n\n static getPlatform(name) {\n return AccountingAPI.platforms[name]\n }\n\n static async getAccounting(id) {\n const repository = getRepository(Account)\n return await repository.findOne({\n where: { id },\n relations: ['domain']\n })\n }\n\n @api\n static getInvoice(accounting, req): any {}\n\n @api\n static getInvoices(accounting, req): any {}\n\n @api\n static createInvoice(accounting, req): any {}\n\n @api\n static updateInvoice(accounting, req): any {}\n\n @api\n static getPurchaseOrders(accounting, req): any {}\n\n @api\n static getContact(accounting, req): any {}\n\n @api\n static getContacts(accounting, req): any {}\n\n @api\n static getItem(accounting, req): any {}\n\n @api\n static getItems(accounting, req): any {}\n\n @api\n static createItem(accounting, req): any {}\n\n @api\n static updateItem(accounting, req): any {}\n\n @api\n static updateItems(accounting, req): any {}\n\n @api\n static deleteItem(accounting, req): any {}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;AAAA,kBAAe;AAEf,2DAAgC","sourcesContent":["import './xero'\n\nexport * from './accounting-api'\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function getContact(): {
|
|
2
|
+
method: string;
|
|
3
|
+
path: string;
|
|
4
|
+
denormalize(req: any): {
|
|
5
|
+
resource: {
|
|
6
|
+
contactId: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
normalize(res: any): {
|
|
10
|
+
attentionCompany: any;
|
|
11
|
+
attentionTo: string;
|
|
12
|
+
email: any;
|
|
13
|
+
deliveryAddress1: string;
|
|
14
|
+
billingAddress: string;
|
|
15
|
+
city: any;
|
|
16
|
+
postalCode: any;
|
|
17
|
+
country: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContact = getContact;
|
|
4
|
+
function getContact() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'get',
|
|
7
|
+
path: '/Contacts/{contactId}',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
const { ContactID: contactId } = req;
|
|
10
|
+
return {
|
|
11
|
+
resource: { contactId }
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
normalize(res) {
|
|
15
|
+
const { Contacts: contacts } = res;
|
|
16
|
+
const { Name: attentionCompany, FirstName, LastName, EmailAddress: email, Addresses, Phones } = contacts[0];
|
|
17
|
+
const { AddressLine1, AddressLine2, AddressLine3, AddressLine4, City: city, PostalCode: postalCode, Country: country } = Addresses[0];
|
|
18
|
+
const mergedAddressLine = `${AddressLine1}, ${AddressLine2}, ${AddressLine3} ${AddressLine4}`;
|
|
19
|
+
return {
|
|
20
|
+
attentionCompany,
|
|
21
|
+
attentionTo: FirstName ? `${FirstName} ${LastName}` : null,
|
|
22
|
+
email,
|
|
23
|
+
deliveryAddress1: AddressLine1 ? mergedAddressLine : null,
|
|
24
|
+
billingAddress: AddressLine1 ? mergedAddressLine : null,
|
|
25
|
+
city: city ? city : null,
|
|
26
|
+
postalCode: postalCode ? postalCode : null,
|
|
27
|
+
country: country ? country : null
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=get-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contact.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/contact/get-contact.ts"],"names":[],"mappings":";;AAAA,gCAqCC;AArCD,SAAgB,UAAU;IACxB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,GAAG,CAAA;YACpC,OAAO;gBACL,QAAQ,EAAE,EAAE,SAAS,EAAE;aACxB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;YAClC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;YAE3G,MAAM,EACJ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EACjB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;YAChB,MAAM,iBAAiB,GAAW,GAAG,YAAY,KAAK,YAAY,KAAK,YAAY,IAAI,YAAY,EAAE,CAAA;YAErG,OAAO;gBACL,gBAAgB;gBAChB,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;gBAC1D,KAAK;gBACL,gBAAgB,EAAE,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;gBACzD,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI;gBACvD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;gBACxB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;gBAC1C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;aAClC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getContact() {\n return {\n method: 'get',\n path: '/Contacts/{contactId}',\n denormalize(req) {\n const { ContactID: contactId } = req\n return {\n resource: { contactId }\n }\n },\n normalize(res) {\n const { Contacts: contacts } = res\n const { Name: attentionCompany, FirstName, LastName, EmailAddress: email, Addresses, Phones } = contacts[0]\n\n const {\n AddressLine1,\n AddressLine2,\n AddressLine3,\n AddressLine4,\n City: city,\n PostalCode: postalCode,\n Country: country\n } = Addresses[0]\n const mergedAddressLine: string = `${AddressLine1}, ${AddressLine2}, ${AddressLine3} ${AddressLine4}`\n\n return {\n attentionCompany,\n attentionTo: FirstName ? `${FirstName} ${LastName}` : null,\n email,\n deliveryAddress1: AddressLine1 ? mergedAddressLine : null,\n billingAddress: AddressLine1 ? mergedAddressLine : null,\n city: city ? city : null,\n postalCode: postalCode ? postalCode : null,\n country: country ? country : null\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContacts = getContacts;
|
|
4
|
+
function getContacts() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'get',
|
|
7
|
+
path: '/Contacts',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
return {
|
|
10
|
+
payload: Object.assign({}, req)
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
normalize(res) {
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=get-contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contacts.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/contact/get-contacts.ts"],"names":[],"mappings":";;AAAA,kCAeC;AAfD,SAAgB,WAAW;IACzB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,WAAW;QACjB,WAAW,CAAC,GAAG;YACb,OAAO;gBACL,OAAO,oBACF,GAAG,CACP;aACF,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getContacts() {\n return {\n method: 'get',\n path: '/Contacts',\n denormalize(req) {\n return {\n payload: {\n ...req\n }\n }\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/contact/index.ts"],"names":[],"mappings":";;;AAAA,yDAA8B;AAC9B,wDAA6B","sourcesContent":["export * from './get-contacts'\nexport * from './get-contact'\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./invoice"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./item"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./purchase-order"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./contact"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/controllers/xero/apis/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB;AACzB,iDAAsB;AACtB,2DAAgC;AAChC,oDAAyB","sourcesContent":["export * from './invoice'\nexport * from './item'\nexport * from './purchase-order'\nexport * from './contact'\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInvoice = createInvoice;
|
|
4
|
+
function createInvoice() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'post',
|
|
7
|
+
path: '/Invoices/{invoiceNo}',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
return req;
|
|
10
|
+
},
|
|
11
|
+
normalize(res) {
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=create-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-invoice.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/invoice/create-invoice.ts"],"names":[],"mappings":";;AAAA,sCAWC;AAXD,SAAgB,aAAa;IAC3B,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,OAAO,GAAG,CAAA;QACZ,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function createInvoice() {\n return {\n method: 'post',\n path: '/Invoices/{invoiceNo}',\n denormalize(req) {\n return req\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvoice = getInvoice;
|
|
4
|
+
function getInvoice() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'get',
|
|
7
|
+
path: '/Invoices/{invoiceId}',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
return {
|
|
10
|
+
resource: { invoiceId: req.invoiceId }
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
normalize(res) {
|
|
14
|
+
return res;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=get-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-invoice.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/invoice/get-invoice.ts"],"names":[],"mappings":";;AAAA,gCAaC;AAbD,SAAgB,UAAU;IACxB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,OAAO;gBACL,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE;aACvC,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function getInvoice() {\n return {\n method: 'get',\n path: '/Invoices/{invoiceId}',\n denormalize(req) {\n return {\n resource: { invoiceId: req.invoiceId }\n }\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInvoices = getInvoices;
|
|
4
|
+
const accounting_api_1 = require("../../../accounting-api");
|
|
5
|
+
function getInvoices() {
|
|
6
|
+
return {
|
|
7
|
+
method: 'get',
|
|
8
|
+
path: '/Invoices',
|
|
9
|
+
denormalize(req) {
|
|
10
|
+
return {
|
|
11
|
+
payload: Object.assign({}, req)
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
async normalize(res, { accounting }) {
|
|
15
|
+
var { Invoices } = res;
|
|
16
|
+
let results = [];
|
|
17
|
+
results = await Promise.all(Invoices.filter(invoice => invoice.Type === 'ACCREC').map(async (invoice) => {
|
|
18
|
+
var { InvoiceID } = invoice;
|
|
19
|
+
var { Invoices } = await accounting_api_1.AccountingAPI.getInvoice(accounting, { invoiceId: InvoiceID });
|
|
20
|
+
var { InvoiceNumber: refNo, Reference: refNo2, DateString, Contact, LineItems } = Invoices[0];
|
|
21
|
+
var releaseDate = String(DateString.split('T')[0]);
|
|
22
|
+
var { ContactID } = Contact;
|
|
23
|
+
const { attentionCompany, attentionTo, email, deliveryAddress1, billingAddress, city, postalCode, country } = await accounting_api_1.AccountingAPI.getContact(accounting, {
|
|
24
|
+
ContactID
|
|
25
|
+
});
|
|
26
|
+
var products = LineItems.length
|
|
27
|
+
? LineItems.map(item => {
|
|
28
|
+
var { ItemCode: sku, Quantity: releaseQty } = item;
|
|
29
|
+
return { product: { sku }, releaseQty };
|
|
30
|
+
})
|
|
31
|
+
: ['undefined'];
|
|
32
|
+
return {
|
|
33
|
+
refNo,
|
|
34
|
+
refNo2,
|
|
35
|
+
releaseDate,
|
|
36
|
+
type: 'b2b',
|
|
37
|
+
exportOption: false,
|
|
38
|
+
ownTransport: true,
|
|
39
|
+
packingOption: false,
|
|
40
|
+
deliverTo: {
|
|
41
|
+
attentionTo,
|
|
42
|
+
attentionCompany,
|
|
43
|
+
email,
|
|
44
|
+
deliveryAddress1,
|
|
45
|
+
city,
|
|
46
|
+
postalCode,
|
|
47
|
+
country
|
|
48
|
+
},
|
|
49
|
+
billTo: {
|
|
50
|
+
billingAddress
|
|
51
|
+
},
|
|
52
|
+
orderInventories: products
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
55
|
+
return results;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=get-invoices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-invoices.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/invoice/get-invoices.ts"],"names":[],"mappings":";;AAEA,kCAyEC;AA3ED,4DAAuD;AAEvD,SAAgB,WAAW;IACzB,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,WAAW;QACjB,WAAW,CAAC,GAAG;YACb,OAAO;gBACL,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AAA;wBAClD,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAA;oBACzC,CAAC,CAAC;oBACJ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;gBAEjB,OAAO;oBACL,KAAK;oBACL,MAAM;oBACN,WAAW;oBACX,IAAI,EAAE,KAAK;oBACX,YAAY,EAAE,KAAK;oBACnB,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,KAAK;oBACpB,SAAS,EAAE;wBACT,WAAW;wBACX,gBAAgB;wBAChB,KAAK;wBACL,gBAAgB;wBAChB,IAAI;wBACJ,UAAU;wBACV,OAAO;qBACR;oBACD,MAAM,EAAE;wBACN,cAAc;qBACf;oBACD,gBAAgB,EAAE,QAAQ;iBAC3B,CAAA;YACH,CAAC,CAAC,CACH,CAAA;YACD,OAAO,OAAO,CAAA;QAChB,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { AccountingAPI } from '../../../accounting-api'\n\nexport function getInvoices() {\n return {\n method: 'get',\n path: '/Invoices',\n denormalize(req) {\n return {\n payload: {\n ...req\n }\n }\n },\n async normalize(res, { accounting }) {\n var { Invoices } = res\n\n let results: any[] = []\n\n results = await Promise.all(\n Invoices.filter(invoice => invoice.Type === 'ACCREC').map(async invoice => {\n var { InvoiceID } = invoice\n var { Invoices } = await AccountingAPI.getInvoice(accounting, { invoiceId: InvoiceID })\n\n var { InvoiceNumber: refNo, Reference: refNo2, DateString, Contact, LineItems } = Invoices[0]\n var releaseDate = String(DateString.split('T')[0])\n\n var { ContactID } = Contact\n\n const {\n attentionCompany,\n attentionTo,\n email,\n deliveryAddress1,\n billingAddress,\n city,\n postalCode,\n country\n } = await AccountingAPI.getContact(accounting, {\n ContactID\n })\n\n var products = LineItems.length\n ? LineItems.map(item => {\n var { ItemCode: sku, Quantity: releaseQty } = item\n return { product: { sku }, releaseQty }\n })\n : ['undefined']\n\n return {\n refNo,\n refNo2,\n releaseDate,\n type: 'b2b',\n exportOption: false,\n ownTransport: true,\n packingOption: false,\n deliverTo: {\n attentionTo,\n attentionCompany,\n email,\n deliveryAddress1,\n city,\n postalCode,\n country\n },\n billTo: {\n billingAddress\n },\n orderInventories: products\n }\n })\n )\n return results\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./get-invoice"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./get-invoices"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./create-invoice"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./update-invoice"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/invoice/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,yDAA8B;AAC9B,2DAAgC;AAChC,2DAAgC","sourcesContent":["export * from './get-invoice'\nexport * from './get-invoices'\nexport * from './create-invoice'\nexport * from './update-invoice'"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateInvoice = updateInvoice;
|
|
4
|
+
function updateInvoice() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'put',
|
|
7
|
+
path: '/Invoices/{invoiceNo}',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
return req;
|
|
10
|
+
},
|
|
11
|
+
normalize(res) {
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=update-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-invoice.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/invoice/update-invoice.ts"],"names":[],"mappings":";;AAAA,sCAWC;AAXD,SAAgB,aAAa;IAC3B,OAAO;QACL,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,OAAO,GAAG,CAAA;QACZ,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function updateInvoice() {\n return {\n method: 'put',\n path: '/Invoices/{invoiceNo}',\n denormalize(req) {\n return req\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function createItem(): {
|
|
2
|
+
method: string;
|
|
3
|
+
path: string;
|
|
4
|
+
denormalize(req: any): {
|
|
5
|
+
payload: {
|
|
6
|
+
Code: any;
|
|
7
|
+
Description: any;
|
|
8
|
+
Name: any;
|
|
9
|
+
PurchaseDetails: Object;
|
|
10
|
+
IsSold: Boolean;
|
|
11
|
+
IsPurchased: Boolean;
|
|
12
|
+
InventoryAssetAccountCode: any;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
normalize(res: any): any;
|
|
16
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createItem = createItem;
|
|
4
|
+
function createItem() {
|
|
5
|
+
return {
|
|
6
|
+
method: 'post',
|
|
7
|
+
path: '/Items',
|
|
8
|
+
denormalize(req) {
|
|
9
|
+
var { sku: Code, name: Name, description: Description, inventoryAccountCode: InventoryAssetAccountCode, cogsAccountCode: COGSAccountCode } = req;
|
|
10
|
+
let IsSold = true;
|
|
11
|
+
let IsPurchased = true;
|
|
12
|
+
var PurchaseDetails = {
|
|
13
|
+
COGSAccountCode
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
payload: {
|
|
17
|
+
Code,
|
|
18
|
+
Description,
|
|
19
|
+
Name,
|
|
20
|
+
PurchaseDetails,
|
|
21
|
+
IsSold,
|
|
22
|
+
IsPurchased,
|
|
23
|
+
InventoryAssetAccountCode
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
normalize(res) {
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=create-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-item.js","sourceRoot":"","sources":["../../../../../server/controllers/xero/apis/item/create-item.ts"],"names":[],"mappings":";;AAAA,gCAoCC;AApCD,SAAgB,UAAU;IACxB,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,QAAQ;QACd,WAAW,CAAC,GAAG;YACb,IAAI,EACF,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,yBAAyB,EAC/C,eAAe,EAAE,eAAe,EACjC,GAAG,GAAG,CAAA;YAEP,IAAI,MAAM,GAAY,IAAI,CAAA;YAC1B,IAAI,WAAW,GAAY,IAAI,CAAA;YAE/B,IAAI,eAAe,GAAW;gBAC5B,eAAe;aAChB,CAAA;YAED,OAAO;gBACL,OAAO,EAAE;oBACP,IAAI;oBACJ,WAAW;oBACX,IAAI;oBACJ,eAAe;oBACf,MAAM;oBACN,WAAW;oBACX,yBAAyB;iBAC1B;aACF,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["export function createItem() {\n return {\n method: 'post',\n path: '/Items',\n denormalize(req) {\n var {\n sku: Code,\n name: Name,\n description: Description,\n inventoryAccountCode: InventoryAssetAccountCode,\n cogsAccountCode: COGSAccountCode\n } = req\n\n let IsSold: Boolean = true\n let IsPurchased: Boolean = true\n\n var PurchaseDetails: Object = {\n COGSAccountCode\n }\n\n return {\n payload: {\n Code,\n Description,\n Name,\n PurchaseDetails,\n IsSold,\n IsPurchased,\n InventoryAssetAccountCode\n }\n }\n },\n normalize(res) {\n return res\n }\n }\n}\n"]}
|