@mj-biz-apps/accounting-actions 0.9.0 → 0.10.0
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/CreateBusinessCentralJournalEntryWithDimensionsAction.d.ts +33 -0
- package/dist/CreateBusinessCentralJournalEntryWithDimensionsAction.d.ts.map +1 -0
- package/dist/CreateBusinessCentralJournalEntryWithDimensionsAction.js +205 -0
- package/dist/CreateBusinessCentralJournalEntryWithDimensionsAction.js.map +1 -0
- package/dist/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.d.ts +2 -0
- package/dist/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.d.ts.map +1 -0
- package/dist/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.js +136 -0
- package/dist/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
2
|
+
import { CreateBusinessCentralJournalEntryAction } from '@memberjunction/actions-bizapps-accounting';
|
|
3
|
+
export declare class CreateBusinessCentralJournalEntryWithDimensionsAction extends CreateBusinessCentralJournalEntryAction {
|
|
4
|
+
get Description(): string;
|
|
5
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
6
|
+
/**
|
|
7
|
+
* Write every line (with its dimension tags) and then post the batch. Any failure before the post
|
|
8
|
+
* deletes the lines already written: a half-tagged or half-written batch must never reach the GL,
|
|
9
|
+
* and BC cascades a line's dimension set lines when the line itself is deleted.
|
|
10
|
+
*/
|
|
11
|
+
private writeAndPost;
|
|
12
|
+
/**
|
|
13
|
+
* POST one `dimensionSetLines` child per tag on the line. A tagged line whose create returned no
|
|
14
|
+
* id is an error rather than a skip — posting it would silently drop exactly the tags this action
|
|
15
|
+
* exists to carry.
|
|
16
|
+
*/
|
|
17
|
+
private writeLineDimensions;
|
|
18
|
+
/** BC journal line body. Dimensions are NOT line fields — they are a child collection. */
|
|
19
|
+
private mapJournalLine;
|
|
20
|
+
/**
|
|
21
|
+
* Pick the journal to write into. A journal with a balancing account would add an extra line to a
|
|
22
|
+
* self-balanced multi-line entry, so those are refused (named) or skipped (auto-selected).
|
|
23
|
+
*/
|
|
24
|
+
private resolveJournal;
|
|
25
|
+
/** Compensating delete: orphan lines left by a failed write would go to the GL on the next post. */
|
|
26
|
+
private deleteJournalLines;
|
|
27
|
+
private entryDateOf;
|
|
28
|
+
private successResult;
|
|
29
|
+
private errorResult;
|
|
30
|
+
}
|
|
31
|
+
/** Tree-shaking anchor — the class must be imported for its @RegisterClass to run. */
|
|
32
|
+
export declare function LoadCreateBusinessCentralJournalEntryWithDimensionsAction(): void;
|
|
33
|
+
//# sourceMappingURL=CreateBusinessCentralJournalEntryWithDimensionsAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateBusinessCentralJournalEntryWithDimensionsAction.d.ts","sourceRoot":"","sources":["../src/CreateBusinessCentralJournalEntryWithDimensionsAction.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEhG,OAAO,EAEL,uCAAuC,EAOxC,MAAM,4CAA4C,CAAC;AAkBpD,qBACa,qDAAsD,SAAQ,uCAAuC;IAEhH,IAAW,WAAW,IAAI,MAAM,CAE/B;cAEe,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA0BvF;;;;OAIG;YACW,YAAY;IAoC1B;;;;OAIG;YACW,mBAAmB;IAyBjC,0FAA0F;IAC1F,OAAO,CAAC,cAAc;IA0BtB;;;OAGG;YACW,cAAc;IAoC5B,oGAAoG;YACtF,kBAAkB;IAWhC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,WAAW;CAGpB;AAED,sFAAsF;AACtF,wBAAgB,yDAAyD,IAAI,IAAI,CAAG"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Business Central journal posting WITH the journal lines' dimension tags.
|
|
9
|
+
*
|
|
10
|
+
* WHY THIS EXISTS. MJ's `CreateBusinessCentralJournalEntryAction` builds each BC journal line from
|
|
11
|
+
* account / amount / posting date / document number / description and ignores `line.dimensions`
|
|
12
|
+
* entirely — its QuickBooks sibling already consumes that field. A fully tagged batch therefore
|
|
13
|
+
* lands in Business Central with no dimensions, and the consolidated chart cannot report by
|
|
14
|
+
* venture, product, new-vs-renewal, event or counterparty. This subclass closes that gap from the
|
|
15
|
+
* app side, leaving the MJ platform untouched.
|
|
16
|
+
*
|
|
17
|
+
* KNOWN, ACCEPTED FOOTPRINT. Registering for the plugin key
|
|
18
|
+
* `CreateJournalEntry:Microsoft Dynamics 365 Business Central` overrides Business Central journal
|
|
19
|
+
* posting for EVERY app in the instance, not just Accounting. That is undesirable but predictable,
|
|
20
|
+
* which is the trade this repo makes rather than editing the platform.
|
|
21
|
+
*
|
|
22
|
+
* HOW DIMENSIONS REACH BC. The standard API v2.0 `journalLine` resource has NO
|
|
23
|
+
* `shortcutDimension1Code` / `shortcutDimension2Code` properties — its writable fields are account,
|
|
24
|
+
* amount, dates, document numbers, description, tax and balancing account. The only dimension
|
|
25
|
+
* surface is the `dimensionSetLines` child collection, which accepts POST with `journalLine` as a
|
|
26
|
+
* parent. So every dimension travels the same way, and BC derives Shortcut Dimension 1 and 2 on the
|
|
27
|
+
* posted G/L entry from the dimension set — the two global dimensions land in their slots on their
|
|
28
|
+
* own, provided they are configured as global dimensions in that BC company.
|
|
29
|
+
*
|
|
30
|
+
* WHY THE WHOLE POST LOOP IS RESTATED. `mapToBCJournalLine`, `resolveGeneralJournal` and
|
|
31
|
+
* `deleteCreatedJournalLines` are all PRIVATE on the MJ class, so there is no seam to extend;
|
|
32
|
+
* `InternalRunAction` is the only override point. The protected helpers on the BC base
|
|
33
|
+
* (`makeBCRequest`, `formatBCDate`, `getParamValue`, `validateJournalEntryBalance`) and the
|
|
34
|
+
* package's shared journal helpers are reused rather than copied.
|
|
35
|
+
*/
|
|
36
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
37
|
+
import { LogError } from '@memberjunction/core';
|
|
38
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
39
|
+
import { ACCOUNTING_VERBS, CreateBusinessCentralJournalEntryAction, ERP_INTEGRATION, erpPluginKey, journalEntryBalanceError, parseAndValidateJournalEntryLines, totalDebits, } from '@memberjunction/actions-bizapps-accounting';
|
|
40
|
+
let CreateBusinessCentralJournalEntryWithDimensionsAction = class CreateBusinessCentralJournalEntryWithDimensionsAction extends CreateBusinessCentralJournalEntryAction {
|
|
41
|
+
get Description() {
|
|
42
|
+
return 'Creates a balanced journal entry in Microsoft Dynamics 365 Business Central, tagging each line with its dimensions, and posts the batch';
|
|
43
|
+
}
|
|
44
|
+
async InternalRunAction(params) {
|
|
45
|
+
try {
|
|
46
|
+
const contextUser = params.ContextUser;
|
|
47
|
+
if (!contextUser) {
|
|
48
|
+
return this.errorResult('Context user is required for Business Central API calls', params.Params);
|
|
49
|
+
}
|
|
50
|
+
this.params = params.Params;
|
|
51
|
+
const lines = parseAndValidateJournalEntryLines(this.getParamValue(params.Params, 'Lines'));
|
|
52
|
+
if (!this.validateJournalEntryBalance(lines)) {
|
|
53
|
+
return journalEntryBalanceError(params.Params);
|
|
54
|
+
}
|
|
55
|
+
const resolved = await this.resolveJournal(this.getParamValue(params.Params, 'JournalCode'), contextUser);
|
|
56
|
+
if (!resolved.journal) {
|
|
57
|
+
return this.errorResult(resolved.error ?? 'No general journal found in Business Central.', params.Params);
|
|
58
|
+
}
|
|
59
|
+
return await this.writeAndPost(resolved.journal, lines, params, contextUser);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
63
|
+
return this.errorResult(message, params.Params);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Write every line (with its dimension tags) and then post the batch. Any failure before the post
|
|
68
|
+
* deletes the lines already written: a half-tagged or half-written batch must never reach the GL,
|
|
69
|
+
* and BC cascades a line's dimension set lines when the line itself is deleted.
|
|
70
|
+
*/
|
|
71
|
+
async writeAndPost(journal, lines, params, contextUser) {
|
|
72
|
+
const postingDate = this.formatBCDate(this.entryDateOf(params));
|
|
73
|
+
const docNumber = this.getParamValue(params.Params, 'DocNumber');
|
|
74
|
+
const description = this.getParamValue(params.Params, 'PrivateNote')
|
|
75
|
+
|| this.getParamValue(params.Params, 'Description');
|
|
76
|
+
const createdLineIds = [];
|
|
77
|
+
try {
|
|
78
|
+
let lastLine;
|
|
79
|
+
for (let i = 0; i < lines.length; i++) {
|
|
80
|
+
lastLine = await this.makeBCRequest(`journals(${journal.id})/journalLines`, 'POST', this.mapJournalLine(lines[i], i, postingDate, docNumber, description), contextUser);
|
|
81
|
+
if (lastLine?.id) {
|
|
82
|
+
createdLineIds.push(lastLine.id);
|
|
83
|
+
}
|
|
84
|
+
await this.writeLineDimensions(lines[i], i, lastLine?.id, contextUser);
|
|
85
|
+
}
|
|
86
|
+
await this.makeBCRequest(`journals(${journal.id})/Microsoft.NAV.post`, 'POST', undefined, contextUser);
|
|
87
|
+
return this.successResult(journal, docNumber || lastLine?.documentNumber || '', lines, params.Params);
|
|
88
|
+
}
|
|
89
|
+
catch (postError) {
|
|
90
|
+
await this.deleteJournalLines(createdLineIds, contextUser);
|
|
91
|
+
throw postError;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* POST one `dimensionSetLines` child per tag on the line. A tagged line whose create returned no
|
|
96
|
+
* id is an error rather than a skip — posting it would silently drop exactly the tags this action
|
|
97
|
+
* exists to carry.
|
|
98
|
+
*/
|
|
99
|
+
async writeLineDimensions(line, index, lineId, contextUser) {
|
|
100
|
+
const dimensions = (line.dimensions ?? []).filter(d => d.code && d.valueCode);
|
|
101
|
+
if (dimensions.length === 0) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!lineId) {
|
|
105
|
+
throw new Error(`Line ${index + 1}: Business Central returned no line id, so its ${dimensions.length} dimension tag(s) cannot be written.`);
|
|
106
|
+
}
|
|
107
|
+
for (const dimension of dimensions) {
|
|
108
|
+
await this.makeBCRequest(`journalLines(${lineId})/dimensionSetLines`, 'POST', { code: dimension.code, valueCode: dimension.valueCode }, contextUser);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** BC journal line body. Dimensions are NOT line fields — they are a child collection. */
|
|
112
|
+
mapJournalLine(line, index, postingDate, documentNumber, batchDescription) {
|
|
113
|
+
const body = {
|
|
114
|
+
lineNumber: (index + 1) * 10000,
|
|
115
|
+
accountType: 'G/L Account',
|
|
116
|
+
postingDate,
|
|
117
|
+
amount: line.debit != null ? line.debit : -(line.credit || 0),
|
|
118
|
+
description: line.description || batchDescription || '',
|
|
119
|
+
};
|
|
120
|
+
if (documentNumber) {
|
|
121
|
+
body.documentNumber = documentNumber;
|
|
122
|
+
}
|
|
123
|
+
// AM-4: accountNumber wins. Sending both lets a stale accountId override the number.
|
|
124
|
+
if (line.accountNumber) {
|
|
125
|
+
body.accountNumber = line.accountNumber;
|
|
126
|
+
}
|
|
127
|
+
else if (line.accountId) {
|
|
128
|
+
body.accountId = line.accountId;
|
|
129
|
+
}
|
|
130
|
+
return body;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Pick the journal to write into. A journal with a balancing account would add an extra line to a
|
|
134
|
+
* self-balanced multi-line entry, so those are refused (named) or skipped (auto-selected).
|
|
135
|
+
*/
|
|
136
|
+
async resolveJournal(journalCode, contextUser) {
|
|
137
|
+
const response = await this.makeBCRequest('journals', 'GET', undefined, contextUser);
|
|
138
|
+
const journals = response?.value || [];
|
|
139
|
+
if (journals.length === 0) {
|
|
140
|
+
return { error: 'This Business Central company has no journals.' };
|
|
141
|
+
}
|
|
142
|
+
if (journalCode) {
|
|
143
|
+
const match = journals.find(j => j.code === journalCode);
|
|
144
|
+
if (!match) {
|
|
145
|
+
return { error: `JournalCode '${journalCode}' does not exist in Business Central.` };
|
|
146
|
+
}
|
|
147
|
+
if (match.balancingAccountNumber) {
|
|
148
|
+
return {
|
|
149
|
+
error: `Journal '${journalCode}' has a balancing account; posting a self-balanced multi-line entry would add an extra line. Use a journal without a balancing account.`,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return { journal: match };
|
|
153
|
+
}
|
|
154
|
+
const unbalancing = journals.filter(j => !j.balancingAccountNumber);
|
|
155
|
+
const preferred = unbalancing.find(j => {
|
|
156
|
+
const code = (j.code || '').toUpperCase();
|
|
157
|
+
return code === 'GENERAL' || code === 'DEFAULT';
|
|
158
|
+
}) || unbalancing[0];
|
|
159
|
+
if (!preferred) {
|
|
160
|
+
return {
|
|
161
|
+
error: 'No general journal without a balancing account found. Pass JournalCode for an unbalanced journal, or configure a GENERAL/DEFAULT journal without a balancing account.',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return { journal: preferred };
|
|
165
|
+
}
|
|
166
|
+
/** Compensating delete: orphan lines left by a failed write would go to the GL on the next post. */
|
|
167
|
+
async deleteJournalLines(lineIds, contextUser) {
|
|
168
|
+
for (const lineId of lineIds) {
|
|
169
|
+
try {
|
|
170
|
+
await this.makeBCRequest(`journalLines(${lineId})`, 'DELETE', undefined, contextUser);
|
|
171
|
+
}
|
|
172
|
+
catch (cleanupError) {
|
|
173
|
+
const message = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
174
|
+
LogError(`CreateBusinessCentralJournalEntryWithDimensions: failed to delete orphan journalLines(${lineId}): ${message}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
entryDateOf(params) {
|
|
179
|
+
const raw = this.getParamValue(params.Params, 'EntryDate');
|
|
180
|
+
return raw ? new Date(raw) : new Date();
|
|
181
|
+
}
|
|
182
|
+
successResult(journal, docNumber, lines, params) {
|
|
183
|
+
const outputParams = [
|
|
184
|
+
{ Name: 'JournalEntryID', Value: journal.id, Type: 'Output' },
|
|
185
|
+
{ Name: 'DocNumber', Value: docNumber, Type: 'Output' },
|
|
186
|
+
{ Name: 'TotalAmount', Value: totalDebits(lines), Type: 'Output' },
|
|
187
|
+
];
|
|
188
|
+
return {
|
|
189
|
+
Success: true,
|
|
190
|
+
ResultCode: 'SUCCESS',
|
|
191
|
+
Params: [...params, ...outputParams],
|
|
192
|
+
Message: `Journal entry ${docNumber || journal.id} posted successfully`,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
errorResult(message, params) {
|
|
196
|
+
return { Success: false, ResultCode: 'ERROR', Message: message, Params: params };
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
CreateBusinessCentralJournalEntryWithDimensionsAction = __decorate([
|
|
200
|
+
RegisterClass(BaseAction, erpPluginKey(ACCOUNTING_VERBS.CreateJournalEntry, ERP_INTEGRATION.BusinessCentral))
|
|
201
|
+
], CreateBusinessCentralJournalEntryWithDimensionsAction);
|
|
202
|
+
export { CreateBusinessCentralJournalEntryWithDimensionsAction };
|
|
203
|
+
/** Tree-shaking anchor — the class must be imported for its @RegisterClass to run. */
|
|
204
|
+
export function LoadCreateBusinessCentralJournalEntryWithDimensionsAction() { }
|
|
205
|
+
//# sourceMappingURL=CreateBusinessCentralJournalEntryWithDimensionsAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateBusinessCentralJournalEntryWithDimensionsAction.js","sourceRoot":"","sources":["../src/CreateBusinessCentralJournalEntryWithDimensionsAction.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,uCAAuC,EACvC,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,iCAAiC,EACjC,WAAW,GAEZ,MAAM,4CAA4C,CAAC;AAmB7C,IAAM,qDAAqD,GAA3D,MAAM,qDAAsD,SAAQ,uCAAuC;IAEhH,IAAW,WAAW;QACpB,OAAO,yIAAyI,CAAC;IACnJ,CAAC;IAES,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACvD,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,IAAI,CAAC,WAAW,CAAC,yDAAyD,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YACpG,CAAC;YAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YAE5B,MAAM,KAAK,GAAG,iCAAiC,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAC5F,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7C,OAAO,wBAAwB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K,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;SACnE,CAAC;QACF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,YAAY,CAAC;YACpC,OAAO,EAAE,iBAAiB,SAAS,IAAI,OAAO,CAAC,EAAE,sBAAsB;SACxE,CAAC;IACJ,CAAC;IAEO,WAAW,CAAC,OAAe,EAAE,MAAqB;QACxD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACnF,CAAC;CACF,CAAA;AA9MY,qDAAqD;IADjE,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;GACjG,qDAAqD,CA8MjE;;AAED,sFAAsF;AACtF,MAAM,UAAU,yDAAyD,KAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateBusinessCentralJournalEntryWithDimensionsAction.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { MJGlobal } from '@memberjunction/global';
|
|
3
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
4
|
+
import { RunActionParams } from '@memberjunction/actions-base';
|
|
5
|
+
import { ACCOUNTING_VERBS, ERP_INTEGRATION, erpPluginKey } from '@memberjunction/actions-bizapps-accounting';
|
|
6
|
+
import { CreateBusinessCentralJournalEntryWithDimensionsAction } from '../CreateBusinessCentralJournalEntryWithDimensionsAction.js';
|
|
7
|
+
const PLUGIN_KEY = erpPluginKey(ACCOUNTING_VERBS.CreateJournalEntry, ERP_INTEGRATION.BusinessCentral);
|
|
8
|
+
const seamOf = (action) => action;
|
|
9
|
+
const inputs = (values) => {
|
|
10
|
+
const params = new RunActionParams();
|
|
11
|
+
params.ContextUser = { ID: 'SYSTEM-USER' };
|
|
12
|
+
params.Params = Object.entries(values).map(([Name, Value]) => ({ Name, Type: 'Input', Value }));
|
|
13
|
+
return params;
|
|
14
|
+
};
|
|
15
|
+
const run = (action, params) => action.Run(params);
|
|
16
|
+
const outParam = (result, name) => result.Params?.find(p => p.Name === name)?.Value;
|
|
17
|
+
/** Records every BC call and answers the journal lookup + line creates. */
|
|
18
|
+
const stubBC = (action, overrides = () => undefined) => {
|
|
19
|
+
let lineNumber = 0;
|
|
20
|
+
return vi.spyOn(seamOf(action), 'makeBCRequest').mockImplementation(async (endpoint, method) => {
|
|
21
|
+
const override = overrides(endpoint, method);
|
|
22
|
+
if (override !== undefined) {
|
|
23
|
+
return override;
|
|
24
|
+
}
|
|
25
|
+
if (endpoint === 'journals') {
|
|
26
|
+
return { value: [{ id: 'j-1', code: 'GENERAL', balancingAccountNumber: null }] };
|
|
27
|
+
}
|
|
28
|
+
if (endpoint.endsWith('/journalLines') && method === 'POST') {
|
|
29
|
+
lineNumber += 1;
|
|
30
|
+
return { id: `line-${lineNumber}`, documentNumber: 'JE-9' };
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const calls = (spy) => spy.mock.calls.map(c => [c[0], c[1], c[2]]);
|
|
36
|
+
const TAGGED_LINES = [
|
|
37
|
+
{
|
|
38
|
+
accountNumber: '1000',
|
|
39
|
+
debit: 100,
|
|
40
|
+
description: 'Debit side',
|
|
41
|
+
dimensions: [
|
|
42
|
+
{ code: 'VENTURE', valueCode: 'ACME' },
|
|
43
|
+
{ code: 'PRODUCT', valueCode: 'WIDGET' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
accountNumber: '2000',
|
|
48
|
+
credit: 100,
|
|
49
|
+
dimensions: [{ code: 'VENTURE', valueCode: 'ACME' }],
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
describe('CreateBusinessCentralJournalEntryWithDimensionsAction', () => {
|
|
53
|
+
let action;
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
vi.restoreAllMocks();
|
|
56
|
+
action = new CreateBusinessCentralJournalEntryWithDimensionsAction();
|
|
57
|
+
});
|
|
58
|
+
it('outranks the platform registration for the Business Central CreateJournalEntry plugin key', () => {
|
|
59
|
+
const instance = MJGlobal.Instance.ClassFactory.CreateInstance(BaseAction, PLUGIN_KEY);
|
|
60
|
+
expect(instance).toBeInstanceOf(CreateBusinessCentralJournalEntryWithDimensionsAction);
|
|
61
|
+
});
|
|
62
|
+
it('POSTs a dimensionSetLine per tag, against the created line, before posting the batch', async () => {
|
|
63
|
+
const spy = stubBC(action);
|
|
64
|
+
const result = await run(action, inputs({ CompanyID: 'comp-1', DocNumber: 'JE-9', Lines: TAGGED_LINES }));
|
|
65
|
+
expect(calls(spy).map(c => [c[0], c[1]])).toEqual([
|
|
66
|
+
['journals', 'GET'],
|
|
67
|
+
['journals(j-1)/journalLines', 'POST'],
|
|
68
|
+
['journalLines(line-1)/dimensionSetLines', 'POST'],
|
|
69
|
+
['journalLines(line-1)/dimensionSetLines', 'POST'],
|
|
70
|
+
['journals(j-1)/journalLines', 'POST'],
|
|
71
|
+
['journalLines(line-2)/dimensionSetLines', 'POST'],
|
|
72
|
+
['journals(j-1)/Microsoft.NAV.post', 'POST'],
|
|
73
|
+
]);
|
|
74
|
+
expect(calls(spy)[2][2]).toEqual({ code: 'VENTURE', valueCode: 'ACME' });
|
|
75
|
+
expect(calls(spy)[3][2]).toEqual({ code: 'PRODUCT', valueCode: 'WIDGET' });
|
|
76
|
+
expect(calls(spy)[5][2]).toEqual({ code: 'VENTURE', valueCode: 'ACME' });
|
|
77
|
+
expect(result.Success).toBe(true);
|
|
78
|
+
expect(outParam(result, 'JournalEntryID')).toBe('j-1');
|
|
79
|
+
expect(outParam(result, 'TotalAmount')).toBe(100);
|
|
80
|
+
});
|
|
81
|
+
it('keeps the line body free of dimension fields — BC v2.0 journalLines has no shortcut dimension properties', async () => {
|
|
82
|
+
const spy = stubBC(action);
|
|
83
|
+
await run(action, inputs({ CompanyID: 'comp-1', DocNumber: 'JE-9', Lines: TAGGED_LINES }));
|
|
84
|
+
const firstLine = calls(spy)[1][2];
|
|
85
|
+
expect(firstLine.accountNumber).toBe('1000');
|
|
86
|
+
expect(firstLine.amount).toBe(100);
|
|
87
|
+
expect(Object.keys(firstLine)).not.toContain('dimensions');
|
|
88
|
+
expect(Object.keys(firstLine)).not.toContain('shortcutDimension1Code');
|
|
89
|
+
expect(Object.keys(firstLine)).not.toContain('shortcutDimension2Code');
|
|
90
|
+
});
|
|
91
|
+
it('writes no dimensionSetLines for untagged lines, and skips tags missing a code', async () => {
|
|
92
|
+
const spy = stubBC(action);
|
|
93
|
+
await run(action, inputs({
|
|
94
|
+
CompanyID: 'comp-1',
|
|
95
|
+
Lines: [
|
|
96
|
+
{ accountNumber: '1000', debit: 100 },
|
|
97
|
+
{ accountNumber: '2000', credit: 100, dimensions: [{ code: '', valueCode: 'ACME' }, { code: 'VENTURE', valueCode: '' }] },
|
|
98
|
+
],
|
|
99
|
+
}));
|
|
100
|
+
expect(calls(spy).filter(c => c[0].includes('dimensionSetLines'))).toEqual([]);
|
|
101
|
+
});
|
|
102
|
+
it('deletes the lines written so far and does not post when a dimensionSetLine POST fails', async () => {
|
|
103
|
+
const spy = stubBC(action, (endpoint, method) => {
|
|
104
|
+
if (endpoint.includes('dimensionSetLines') && method === 'POST') {
|
|
105
|
+
throw new Error('dimension VENTURE does not exist');
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
});
|
|
109
|
+
const result = await run(action, inputs({ CompanyID: 'comp-1', Lines: TAGGED_LINES }));
|
|
110
|
+
expect(result.Success).toBe(false);
|
|
111
|
+
expect(result.Message).toBe('dimension VENTURE does not exist');
|
|
112
|
+
expect(calls(spy).map(c => [c[0], c[1]])).toEqual([
|
|
113
|
+
['journals', 'GET'],
|
|
114
|
+
['journals(j-1)/journalLines', 'POST'],
|
|
115
|
+
['journalLines(line-1)/dimensionSetLines', 'POST'],
|
|
116
|
+
['journalLines(line-1)', 'DELETE'],
|
|
117
|
+
]);
|
|
118
|
+
});
|
|
119
|
+
it('fails rather than dropping tags when BC returns a created line with no id', async () => {
|
|
120
|
+
const spy = stubBC(action, (endpoint, method) => endpoint.endsWith('/journalLines') && method === 'POST' ? { documentNumber: 'JE-9' } : undefined);
|
|
121
|
+
const result = await run(action, inputs({ CompanyID: 'comp-1', Lines: TAGGED_LINES }));
|
|
122
|
+
expect(result.Success).toBe(false);
|
|
123
|
+
expect(result.Message).toContain('no line id');
|
|
124
|
+
expect(calls(spy).some(c => c[0].includes('Microsoft.NAV.post'))).toBe(false);
|
|
125
|
+
});
|
|
126
|
+
it('still refuses an unbalanced entry without calling Business Central', async () => {
|
|
127
|
+
const spy = stubBC(action);
|
|
128
|
+
const result = await run(action, inputs({
|
|
129
|
+
CompanyID: 'comp-1',
|
|
130
|
+
Lines: [{ accountNumber: '1000', debit: 100 }, { accountNumber: '2000', credit: 50 }],
|
|
131
|
+
}));
|
|
132
|
+
expect(result.ResultCode).toBe('VALIDATION_ERROR');
|
|
133
|
+
expect(spy).not.toHaveBeenCalled();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
//# sourceMappingURL=CreateBusinessCentralJournalEntryWithDimensionsAction.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateBusinessCentralJournalEntryWithDimensionsAction.test.js","sourceRoot":"","sources":["../../src/__tests__/CreateBusinessCentralJournalEntryWithDimensionsAction.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CA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AC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yDAAyD,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,yDAAyD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mj-biz-apps/accounting-actions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"description": "Generated action subclasses maintained by the CodeGen utility.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
"vitest": "^4.0.18"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mj-biz-apps/accounting-core-entities-server": "0.
|
|
22
|
+
"@mj-biz-apps/accounting-core-entities-server": "0.10.0",
|
|
23
23
|
"zod": "^3.25.28"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@memberjunction/actions-base": "^6.1.0-edge.7",
|
|
27
27
|
"@memberjunction/actions": "^6.1.0-edge.7",
|
|
28
|
+
"@memberjunction/actions-bizapps-accounting": "^6.1.0-edge.7",
|
|
28
29
|
"@memberjunction/global": "^6.1.0-edge.7",
|
|
29
30
|
"@memberjunction/core": "^6.1.0-edge.7",
|
|
30
31
|
"@memberjunction/core-entities": "^6.1.0-edge.7",
|