rerobe-js-orm 4.9.11 → 4.9.13
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.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function formatSekOre(ore: number): string;
|
|
2
|
+
export declare function paymentTypeLabel(paymentType: string): string;
|
|
3
|
+
export type GrandTotalsOre = {
|
|
4
|
+
salesOre?: number;
|
|
5
|
+
returnsOre?: number;
|
|
6
|
+
} | null | undefined;
|
|
7
|
+
export type DailyReportInput = {
|
|
8
|
+
orders: any[];
|
|
9
|
+
reportType?: string;
|
|
10
|
+
grandTotalsBeforeOre?: GrandTotalsOre;
|
|
11
|
+
copiesCount?: number;
|
|
12
|
+
trainingCount?: number;
|
|
13
|
+
incompleteCount?: number;
|
|
14
|
+
drawerOpenCount?: number;
|
|
15
|
+
certified?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function buildDailyReport(input: DailyReportInput): any;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Swedish "gold standard" daily fiscal report (X-rapport / Z-dagrapport) aggregation.
|
|
3
|
+
//
|
|
4
|
+
// Pure + dependency-light: turns a day's COMPLETED orders for a register into the
|
|
5
|
+
// data object a kassaregister dagrapport must show per Skatteverket SKVFS 2014:9
|
|
6
|
+
// (7 kap. 2-3 §; grand totals added by SKVFS 2021:17). The renderer
|
|
7
|
+
// (ReceiptXmlHelpers.buildReportReceiptXML) is a dumb consumer of this shape, so
|
|
8
|
+
// print + simulator stay in lockstep.
|
|
9
|
+
//
|
|
10
|
+
// Money model — consistent with MarketplaceReceiptHelpers.lineItemGrossOre: a
|
|
11
|
+
// line's originalTotalPrice is the NET (ex-VAT) amount; gross = net * (1 + taxRate);
|
|
12
|
+
// line VAT = gross - net. Everything reconciles: salesGross = netExVat + vatTotal.
|
|
13
|
+
//
|
|
14
|
+
// Scope/date correctness is the CALLER's responsibility — it decides which orders
|
|
15
|
+
// belong to this register and this day; this function aggregates exactly what it
|
|
16
|
+
// is given. (Returns are taken from those orders' refunds[]; a refund processed on
|
|
17
|
+
// a different day than its order is the caller's concern to scope.)
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.formatSekOre = formatSekOre;
|
|
20
|
+
exports.paymentTypeLabel = paymentTypeLabel;
|
|
21
|
+
exports.buildDailyReport = buildDailyReport;
|
|
22
|
+
const OrderHelpers_1 = require("./OrderHelpers");
|
|
23
|
+
const MarketplaceReceiptHelpers_1 = require("./marketplace/MarketplaceReceiptHelpers");
|
|
24
|
+
const order_constants_1 = require("../constants/order-constants");
|
|
25
|
+
// The three Swedish VAT rates always shown on a dagrapport; 0% only when present.
|
|
26
|
+
const VAT_RATES_SHOWN = [25, 12, 6];
|
|
27
|
+
// öre -> Swedish currency string: "1 250,00 kr", "-160,00 kr", "0,00 kr".
|
|
28
|
+
function formatSekOre(ore) {
|
|
29
|
+
const n = Math.round(Number(ore) || 0);
|
|
30
|
+
const sign = n < 0 ? '-' : '';
|
|
31
|
+
const abs = Math.abs(n);
|
|
32
|
+
const kronor = Math.floor(abs / 100);
|
|
33
|
+
const dec = String(abs % 100).padStart(2, '0');
|
|
34
|
+
const grouped = String(kronor).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
|
|
35
|
+
return `${sign}${grouped},${dec} kr`;
|
|
36
|
+
}
|
|
37
|
+
// SKVFS-friendly Swedish label per payment type ("försäljning per betalsätt").
|
|
38
|
+
function paymentTypeLabel(paymentType) {
|
|
39
|
+
switch (paymentType) {
|
|
40
|
+
case order_constants_1.PAYMENT_TYPES.creditCard:
|
|
41
|
+
return 'Kort';
|
|
42
|
+
case order_constants_1.PAYMENT_TYPES.swish:
|
|
43
|
+
return 'Swish';
|
|
44
|
+
case order_constants_1.PAYMENT_TYPES.klarna:
|
|
45
|
+
return 'Klarna';
|
|
46
|
+
case order_constants_1.PAYMENT_TYPES.cash:
|
|
47
|
+
return 'Kontant';
|
|
48
|
+
case order_constants_1.PAYMENT_TYPES.mobilePayment:
|
|
49
|
+
return 'Mobil';
|
|
50
|
+
case order_constants_1.PAYMENT_TYPES.shoppingCredit:
|
|
51
|
+
return 'Tillgodo';
|
|
52
|
+
case order_constants_1.PAYMENT_TYPES.shopifyPayment:
|
|
53
|
+
return 'Shopify';
|
|
54
|
+
case order_constants_1.PAYMENT_TYPES.traderaPayment:
|
|
55
|
+
return 'Tradera';
|
|
56
|
+
default:
|
|
57
|
+
return paymentType || 'Ovrigt';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// VAT (öre) for one line, by integer rate percent. Net model: VAT = gross - net.
|
|
61
|
+
function lineVat(lineItem) {
|
|
62
|
+
const li = lineItem || {};
|
|
63
|
+
const rate = Number(li.taxRate || 0);
|
|
64
|
+
const taxable = li.isTaxable !== false && rate > 0;
|
|
65
|
+
const ratePercent = taxable ? Math.round(rate * 100) : 0;
|
|
66
|
+
const netOre = Math.abs((0, MarketplaceReceiptHelpers_1.toOre)((li.originalTotalPrice && li.originalTotalPrice.amount) || 0));
|
|
67
|
+
const grossOre = taxable ? Math.round(netOre * (1 + rate)) : netOre;
|
|
68
|
+
return { ratePercent, grossOre, vatOre: grossOre - netOre };
|
|
69
|
+
}
|
|
70
|
+
// Gross (öre) returned across an order's refunds, and the count of return events.
|
|
71
|
+
function orderReturns(order) {
|
|
72
|
+
const refunds = (order && order.refunds) || [];
|
|
73
|
+
let grossOre = 0;
|
|
74
|
+
refunds.forEach((refund) => {
|
|
75
|
+
(refund.refundLineItems || []).forEach((rli) => {
|
|
76
|
+
const returned = OrderHelpers_1.default.getReturnedLineAmounts(rli);
|
|
77
|
+
grossOre += Math.abs((0, MarketplaceReceiptHelpers_1.toOre)(returned.net));
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
return { count: refunds.length, grossOre };
|
|
81
|
+
}
|
|
82
|
+
// Aggregate a day's orders into the full SKVFS dagrapport data object. Amounts are
|
|
83
|
+
// returned both as Swedish-formatted strings (for the renderer) and as raw öre
|
|
84
|
+
// (under `ore`, for accumulator persistence / cross-checks).
|
|
85
|
+
function buildDailyReport(input) {
|
|
86
|
+
const params = input || { orders: [] };
|
|
87
|
+
const orders = params.orders || [];
|
|
88
|
+
const reportType = params.reportType || 'X';
|
|
89
|
+
const before = params.grandTotalsBeforeOre || {};
|
|
90
|
+
const copiesCount = params.copiesCount || 0;
|
|
91
|
+
const trainingCount = params.trainingCount || 0;
|
|
92
|
+
const incompleteCount = params.incompleteCount || 0;
|
|
93
|
+
const drawerOpenCount = params.drawerOpenCount || 0;
|
|
94
|
+
const certified = !!params.certified;
|
|
95
|
+
let receiptCount = 0;
|
|
96
|
+
let goodsCount = 0;
|
|
97
|
+
let salesGrossOre = 0;
|
|
98
|
+
let discountsOre = 0;
|
|
99
|
+
let returnsCount = 0;
|
|
100
|
+
let returnsGrossOre = 0;
|
|
101
|
+
const vatByRate = {};
|
|
102
|
+
const grossByRate = {};
|
|
103
|
+
const payByType = {};
|
|
104
|
+
orders.forEach((order) => {
|
|
105
|
+
receiptCount += 1;
|
|
106
|
+
discountsOre += Math.abs((0, MarketplaceReceiptHelpers_1.toOre)((order.totalDiscount && order.totalDiscount.amount) || 0));
|
|
107
|
+
let orderGrossOre = 0;
|
|
108
|
+
(order.lineItems || []).forEach((li) => {
|
|
109
|
+
goodsCount += Number(li.quantity || 0);
|
|
110
|
+
const { ratePercent, grossOre, vatOre } = lineVat(li);
|
|
111
|
+
orderGrossOre += grossOre;
|
|
112
|
+
vatByRate[ratePercent] = (vatByRate[ratePercent] || 0) + vatOre;
|
|
113
|
+
grossByRate[ratePercent] = (grossByRate[ratePercent] || 0) + grossOre;
|
|
114
|
+
});
|
|
115
|
+
salesGrossOre += orderGrossOre;
|
|
116
|
+
const pt = order.paymentType || order_constants_1.PAYMENT_TYPES.creditCard;
|
|
117
|
+
if (!payByType[pt])
|
|
118
|
+
payByType[pt] = { count: 0, ore: 0 };
|
|
119
|
+
payByType[pt].count += 1;
|
|
120
|
+
payByType[pt].ore += orderGrossOre;
|
|
121
|
+
const ret = orderReturns(order);
|
|
122
|
+
returnsCount += ret.count;
|
|
123
|
+
returnsGrossOre += ret.grossOre;
|
|
124
|
+
});
|
|
125
|
+
const vatTotalOre = Object.keys(vatByRate).reduce((sum, r) => sum + vatByRate[Number(r)], 0);
|
|
126
|
+
const netExVatOre = salesGrossOre - vatTotalOre;
|
|
127
|
+
// VAT lines: the standard Swedish rates always, plus any other rate present;
|
|
128
|
+
// 0% only when there is 0-rated turnover. Descending by rate.
|
|
129
|
+
const rateSet = VAT_RATES_SHOWN.slice();
|
|
130
|
+
Object.keys(grossByRate)
|
|
131
|
+
.map(Number)
|
|
132
|
+
.forEach((r) => {
|
|
133
|
+
if (r > 0 && rateSet.indexOf(r) === -1)
|
|
134
|
+
rateSet.push(r);
|
|
135
|
+
});
|
|
136
|
+
if ((grossByRate[0] || 0) > 0)
|
|
137
|
+
rateSet.push(0);
|
|
138
|
+
const vatLines = rateSet.sort((a, b) => b - a).map((rate) => ({ rate, amount: formatSekOre(vatByRate[rate] || 0) }));
|
|
139
|
+
const paymentBreakdown = Object.keys(payByType)
|
|
140
|
+
.map((type) => ({
|
|
141
|
+
type,
|
|
142
|
+
label: paymentTypeLabel(type),
|
|
143
|
+
count: payByType[type].count,
|
|
144
|
+
amount: formatSekOre(payByType[type].ore),
|
|
145
|
+
ore: payByType[type].ore,
|
|
146
|
+
}))
|
|
147
|
+
.sort((a, b) => b.ore - a.ore);
|
|
148
|
+
const gtSalesOre = (before.salesOre || 0) + salesGrossOre;
|
|
149
|
+
const gtReturnsOre = (before.returnsOre || 0) + returnsGrossOre;
|
|
150
|
+
const gtNetOre = gtSalesOre - gtReturnsOre;
|
|
151
|
+
return {
|
|
152
|
+
reportType: String(reportType).toUpperCase().indexOf('Z') !== -1 ? 'Z' : 'X',
|
|
153
|
+
receiptCount,
|
|
154
|
+
goodsCount,
|
|
155
|
+
copiesCount,
|
|
156
|
+
trainingCount,
|
|
157
|
+
incompleteCount,
|
|
158
|
+
drawerOpenCount,
|
|
159
|
+
paymentBreakdown,
|
|
160
|
+
salesGross: formatSekOre(salesGrossOre),
|
|
161
|
+
discounts: formatSekOre(discountsOre),
|
|
162
|
+
returns: { count: returnsCount, amount: formatSekOre(returnsGrossOre) },
|
|
163
|
+
vatLines,
|
|
164
|
+
vatTotal: formatSekOre(vatTotalOre),
|
|
165
|
+
netExVat: formatSekOre(netExVatOre),
|
|
166
|
+
grandTotals: {
|
|
167
|
+
sales: formatSekOre(gtSalesOre),
|
|
168
|
+
returns: formatSekOre(gtReturnsOre),
|
|
169
|
+
net: formatSekOre(gtNetOre),
|
|
170
|
+
},
|
|
171
|
+
certified,
|
|
172
|
+
ore: {
|
|
173
|
+
salesGross: salesGrossOre,
|
|
174
|
+
discounts: discountsOre,
|
|
175
|
+
returns: returnsGrossOre,
|
|
176
|
+
vatTotal: vatTotalOre,
|
|
177
|
+
netExVat: netExVatOre,
|
|
178
|
+
grandTotalSales: gtSalesOre,
|
|
179
|
+
grandTotalReturns: gtReturnsOre,
|
|
180
|
+
grandTotalNet: gtNetOre,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
@@ -10,6 +10,9 @@ export default class ReceiptXmlHelpers {
|
|
|
10
10
|
private static variantLabelForReceipt;
|
|
11
11
|
static formatLineItemXML(lineItem: any): string;
|
|
12
12
|
static buildReceiptContentXML(receiptData: any): string;
|
|
13
|
+
private static padRow;
|
|
14
|
+
private static negateAmount;
|
|
15
|
+
static buildReportReceiptXML(data: any): string;
|
|
13
16
|
private static decodeXML;
|
|
14
17
|
private static parseAttrs;
|
|
15
18
|
static parseReceiptXml(xml: string): ReceiptPreviewLine[];
|
|
@@ -231,6 +231,140 @@ class ReceiptXmlHelpers {
|
|
|
231
231
|
receipt += '</epos-print>';
|
|
232
232
|
return receipt;
|
|
233
233
|
}
|
|
234
|
+
// Pad a label (left) and value (right) into a fixed 42-col row, so amounts line
|
|
235
|
+
// up on the right edge of the paper. Label is truncated if it would collide.
|
|
236
|
+
static padRow(label, value) {
|
|
237
|
+
const width = 42;
|
|
238
|
+
let l = String(label);
|
|
239
|
+
const v = String(value);
|
|
240
|
+
let space = width - l.length - v.length;
|
|
241
|
+
if (space < 1) {
|
|
242
|
+
l = l.slice(0, Math.max(0, width - v.length - 1));
|
|
243
|
+
space = Math.max(1, width - l.length - v.length);
|
|
244
|
+
}
|
|
245
|
+
return l + ' '.repeat(space) + v;
|
|
246
|
+
}
|
|
247
|
+
// Prefix a formatted amount with a minus (for discounts/returns), unless it is
|
|
248
|
+
// already negative. Callers guard against zero amounts.
|
|
249
|
+
static negateAmount(amount) {
|
|
250
|
+
const a = String(amount || '');
|
|
251
|
+
return a.indexOf('-') === 0 ? a : `-${a}`;
|
|
252
|
+
}
|
|
253
|
+
// Render a Swedish "gold standard" X/Z daily report (X-rapport / Z-dagrapport)
|
|
254
|
+
// as ePOS-Print XML — prints on the same thermal printer and renders in the same
|
|
255
|
+
// simulator (ReceiptPaper) as sales receipts. Pure; a dumb renderer of the data
|
|
256
|
+
// object produced by FiscalReportHelpers.buildDailyReport plus identity fields:
|
|
257
|
+
// { reportType:'X'|'Z', merchantName, organizationNumber, storeAddress,
|
|
258
|
+
// cashRegisterName|terminalName, date, sequenceNumber,
|
|
259
|
+
// receiptCount, goodsCount, copiesCount, trainingCount, incompleteCount,
|
|
260
|
+
// drawerOpenCount,
|
|
261
|
+
// paymentBreakdown:[{label,count,amount}],
|
|
262
|
+
// salesGross, discounts, returns:{count,amount},
|
|
263
|
+
// vatLines:[{rate,amount}], netExVat,
|
|
264
|
+
// grandTotals:{sales,returns,net},
|
|
265
|
+
// certified, controlUnitSerial?, controlCode? }
|
|
266
|
+
// Covers SKVFS 2014:9 (7 kap. 2-3 §) + the 2021:17 grand totals. When certified
|
|
267
|
+
// is falsy (no srv4pos control unit yet) it stamps a PRELIMINÄR RAPPORT notice so
|
|
268
|
+
// the report never masquerades as a registered kassaregister dagrapport.
|
|
269
|
+
// Back-compat: older callers passing totalSales/netTotal/vatRates still render.
|
|
270
|
+
static buildReportReceiptXML(data) {
|
|
271
|
+
const d = data || {};
|
|
272
|
+
const isZ = String(d.reportType || d.type || '')
|
|
273
|
+
.toUpperCase()
|
|
274
|
+
.indexOf('Z') !== -1;
|
|
275
|
+
const label = isZ ? 'Z-DAGRAPPORT' : 'X-DAGRAPPORT';
|
|
276
|
+
const divider = '----------------------------------------';
|
|
277
|
+
const hasSeq = d.sequenceNumber !== undefined && d.sequenceNumber !== null && d.sequenceNumber !== '';
|
|
278
|
+
const kassabeteckning = d.cashRegisterName || d.terminalName || '';
|
|
279
|
+
// Back-compat mapping for older inputs.
|
|
280
|
+
const salesGross = d.salesGross || d.totalSales || '0,00 kr';
|
|
281
|
+
const netExVat = d.netExVat || d.netTotal || '';
|
|
282
|
+
let vatLines = d.vatLines;
|
|
283
|
+
if (!vatLines && d.vatRates && typeof d.vatRates === 'object') {
|
|
284
|
+
vatLines = Object.keys(d.vatRates).map((rate) => ({
|
|
285
|
+
rate: parseFloat(String(rate)),
|
|
286
|
+
amount: d.vatRates[rate],
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
vatLines = vatLines || [];
|
|
290
|
+
// em is sticky in ePOS-Print, so always emit it explicitly (true/false) to stop
|
|
291
|
+
// a bold line bleeding into the rows that follow; width="1" likewise resets the
|
|
292
|
+
// sticky double-width left by the title.
|
|
293
|
+
const row = (lbl, value, em) => `<text font="font_a" width="1" height="1" em="${em ? 'true' : 'false'}">` +
|
|
294
|
+
`${this.escapeXML(this.padRow(lbl, value))}</text><feed/>`;
|
|
295
|
+
const line = (text, em) => `<text font="font_a" width="1" height="1" em="${em ? 'true' : 'false'}">` +
|
|
296
|
+
`${this.escapeXML(text)}</text><feed/>`;
|
|
297
|
+
const dividerLine = `<text font="font_a" width="1" height="1" em="false">${divider}</text><feed/>`;
|
|
298
|
+
let receipt = '<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">';
|
|
299
|
+
receipt += '<text align="center"/>';
|
|
300
|
+
// --- Header ---
|
|
301
|
+
receipt += `<text font="font_a" width="2" height="2">${this.escapeXML(d.merchantName || '')}</text><feed/>`;
|
|
302
|
+
if (d.organizationNumber)
|
|
303
|
+
receipt += line(`Org.nr: ${d.organizationNumber}`);
|
|
304
|
+
if (d.storeAddress)
|
|
305
|
+
receipt += line(String(d.storeAddress));
|
|
306
|
+
receipt += '<feed/>';
|
|
307
|
+
receipt += `<text font="font_a" width="2" height="2">${this.escapeXML(label)}</text><feed/>`;
|
|
308
|
+
if (isZ && hasSeq)
|
|
309
|
+
receipt += line(`Z-nummer: ${d.sequenceNumber}`);
|
|
310
|
+
if (kassabeteckning)
|
|
311
|
+
receipt += line(`Kassabeteckning: ${kassabeteckning}`);
|
|
312
|
+
if (d.date)
|
|
313
|
+
receipt += line(String(d.date));
|
|
314
|
+
// --- Counts ---
|
|
315
|
+
receipt += '<feed/>' + dividerLine;
|
|
316
|
+
receipt += row('Antal kvitton:', String(d.receiptCount || 0));
|
|
317
|
+
if (d.goodsCount !== undefined)
|
|
318
|
+
receipt += row('Antal varor:', String(d.goodsCount));
|
|
319
|
+
receipt += row('Antal kvittokopior:', String(d.copiesCount || 0));
|
|
320
|
+
receipt += row('Antal övningskvitton:', String(d.trainingCount || 0));
|
|
321
|
+
receipt += row('Antal ofullständiga köp:', String(d.incompleteCount || 0));
|
|
322
|
+
receipt += row('Lådöppningar:', String(d.drawerOpenCount || 0));
|
|
323
|
+
// --- Sales per payment method ---
|
|
324
|
+
if (Array.isArray(d.paymentBreakdown) && d.paymentBreakdown.length) {
|
|
325
|
+
receipt += dividerLine;
|
|
326
|
+
receipt += line('Försäljning per betalsätt', true);
|
|
327
|
+
d.paymentBreakdown.forEach((p) => {
|
|
328
|
+
receipt += row(` ${p.label}:`, String(p.amount));
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
// --- Totals ---
|
|
332
|
+
receipt += dividerLine;
|
|
333
|
+
receipt += row('Försäljning brutto:', salesGross, true);
|
|
334
|
+
if (d.discounts && d.discounts !== '0,00 kr') {
|
|
335
|
+
receipt += row('Rabatter:', this.negateAmount(d.discounts));
|
|
336
|
+
}
|
|
337
|
+
if (d.returns && (d.returns.count || (d.returns.amount && d.returns.amount !== '0,00 kr'))) {
|
|
338
|
+
receipt += row(`Returer (${d.returns.count || 0} st):`, this.negateAmount(d.returns.amount));
|
|
339
|
+
}
|
|
340
|
+
// --- VAT ---
|
|
341
|
+
receipt += dividerLine;
|
|
342
|
+
vatLines.forEach((v) => {
|
|
343
|
+
receipt += row(`Moms ${this.escapeXML(String(v.rate))}%:`, String(v.amount));
|
|
344
|
+
});
|
|
345
|
+
if (netExVat)
|
|
346
|
+
receipt += row('Netto (exkl. moms):', netExVat, true);
|
|
347
|
+
// --- Grand totals (ackumulerande; SKVFS 2021:17) ---
|
|
348
|
+
if (d.grandTotals) {
|
|
349
|
+
receipt += dividerLine;
|
|
350
|
+
receipt += row('Grand total försäljning:', String(d.grandTotals.sales || '0,00 kr'));
|
|
351
|
+
receipt += row('Grand total retur:', String(d.grandTotals.returns || '0,00 kr'));
|
|
352
|
+
receipt += row('Grand total netto:', String(d.grandTotals.net || '0,00 kr'));
|
|
353
|
+
}
|
|
354
|
+
// --- Control unit ---
|
|
355
|
+
receipt += dividerLine;
|
|
356
|
+
receipt += row('Kontrollenhet:', d.controlUnitSerial || '-');
|
|
357
|
+
receipt += row('Kontrollkod:', d.controlCode || '-');
|
|
358
|
+
// --- Pre-approval notice ---
|
|
359
|
+
if (!d.certified) {
|
|
360
|
+
receipt += '<feed/>';
|
|
361
|
+
receipt += line('PRELIMINÄR RAPPORT');
|
|
362
|
+
receipt += line('Kassaregister ej aktiverat');
|
|
363
|
+
}
|
|
364
|
+
receipt += '<cut type="feed"/>';
|
|
365
|
+
receipt += '</epos-print>';
|
|
366
|
+
return receipt;
|
|
367
|
+
}
|
|
234
368
|
// Decode the 5 XML entities escapeXML produces, back to their characters.
|
|
235
369
|
// `&` is decoded last so `&lt;` round-trips to `<`, not `<`.
|
|
236
370
|
static decodeXML(text) {
|
package/lib/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ import * as MarketplaceLineDisplayHelpers from './helpers/marketplace/Marketplac
|
|
|
49
49
|
import * as MarketplaceOrderHelpers from './helpers/marketplace/MarketplaceOrderHelpers';
|
|
50
50
|
import * as MarketplaceReceiptHelpers from './helpers/marketplace/MarketplaceReceiptHelpers';
|
|
51
51
|
import * as FiscalHelpers from './helpers/FiscalHelpers';
|
|
52
|
+
import * as FiscalReportHelpers from './helpers/FiscalReportHelpers';
|
|
52
53
|
import TaxHelpers from './helpers/TaxHelpers';
|
|
53
54
|
import PricingHelpers from './helpers/PricingHelpers';
|
|
54
55
|
import ProductSkuHelpers, { DEFAULT_SKU_LENGTH, SKU_ALPHABET } from './helpers/ProductSkuHelpers';
|
|
@@ -59,7 +60,7 @@ import ProductInventoryHelpers, { PLACEHOLDER_VARIANT_ID } from './helpers/Produ
|
|
|
59
60
|
import RetailProductFactory from './factories/Product/RetailProductFactory';
|
|
60
61
|
import { FALLBACK_TAX_COUNTRY_CODE, TAX_CATEGORIES, TAX_CATEGORY_ALIASES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_RATES } from './constants/tax-constants';
|
|
61
62
|
import { ADMIN_SIMPLIFIED_STATES, ADMIN_STATES, PRODUCT_CLASS_VALUES, PRODUCT_STATES, PRODUCT_STATE_LABELS, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions } from './constants/product-constants';
|
|
62
|
-
export { RibbnFile, ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormStateFactory, ProductCollectionHelpers, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFromTraderaEmail, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MERCHANT_ACCOUNT_MODES, MERCHANT_ACCOUNT_CLASSES, MERCHANT_RELATIONSHIP_TYPES, MARKETPLACE_SELLER_CAPABILITIES, DEFAULT_MARKETPLACE_SELLER_CAPABILITIES, MerchantFormState, MerchantFormStateFactory, MerchantConfigAutomatedPayouts, MerchantConfigAutomatedPayoutsFormState, ReRobeProductHelpers, MarketplaceProductHelpers, MarketplaceLedgerHelpers, MarketplaceLegacyAdapters, MarketplaceLineDisplayHelpers, MarketplaceOrderHelpers, MarketplaceReceiptHelpers, FiscalHelpers, MARKETPLACE_LISTING_STATUSES, MARKETPLACE_COMMISSION_BASES, MARKETPLACE_RELATIONSHIP_TYPES, MARKETPLACE_FEE_TYPES, MARKETPLACE_FEE_ALLOCATION_BASES, MARKETPLACE_LEDGER_STATUSES, MARKETPLACE_INVENTORY_POLICY_KINDS, MARKETPLACE_SELLER_DEFAULT_COMMISSION, STOCK_STATUSES, DEFAULT_MARKETPLACE_LISTING_STATUS, DEFAULT_MARKETPLACE_COMMISSION_BASIS, DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE, DEFAULT_STRIPE_FEE_ALLOCATION_BASIS, DEFAULT_RIBBN_FEE_ALLOCATION_BASIS, DEFAULT_MARKETPLACE_LEDGER_STATUS, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, MerchantWebPage, ShopifyMerchantAccount, CustomerNotification, TaxHelpers, PricingHelpers, ProductSkuHelpers, ProductVariantHelpers, ReturnPolicyHelpers, ReceiptXmlHelpers, ProductInventoryHelpers, RetailProductFactory, SKU_ALPHABET, DEFAULT_SKU_LENGTH, PLACEHOLDER_VARIANT_ID, TAX_CATEGORIES, TAX_CATEGORY_RATES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_ALIASES, FALLBACK_TAX_COUNTRY_CODE, PRODUCT_STATES, PRODUCT_STATE_LABELS, PRODUCT_CLASS_VALUES, ADMIN_STATES, ADMIN_SIMPLIFIED_STATES, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions, };
|
|
63
|
+
export { RibbnFile, ProductFromAlgoliaJSONDoc, ProductFromShopifyWebhookJSONDoc, ProductFromShopifyJSClientJSONDoc, ProductFormStateFactory, ProductCollectionFormStateFactory, ProductCollectionHelpers, SellRequestFormStateFactory, PickUpFormStateFactory, AddressFormStateFactory, UserFormStateFactory, UserFromShopifyWebhookJSONDoc, UserFromAuthTemplateMethod, DraftOrderFromMirakl, DraftOrderFromApp, ChatRoomFromNewUserSignUp, KlarnaSessionFactory, Product, ProductStateManager, Order, OrderFromShopifyWebhook, OrderFromShopifyAdminApi, OrderFromShopifyStorefrontApi, OrderFromApp, OrderFromTraderaEmail, OrderFormStateFactory, RefundFormStateFactory, PayoutAccount, PayoutAccountFormState, Merchant, MERCHANT_ACCOUNT_MODES, MERCHANT_ACCOUNT_CLASSES, MERCHANT_RELATIONSHIP_TYPES, MARKETPLACE_SELLER_CAPABILITIES, DEFAULT_MARKETPLACE_SELLER_CAPABILITIES, MerchantFormState, MerchantFormStateFactory, MerchantConfigAutomatedPayouts, MerchantConfigAutomatedPayoutsFormState, ReRobeProductHelpers, MarketplaceProductHelpers, MarketplaceLedgerHelpers, MarketplaceLegacyAdapters, MarketplaceLineDisplayHelpers, MarketplaceOrderHelpers, MarketplaceReceiptHelpers, FiscalHelpers, FiscalReportHelpers, MARKETPLACE_LISTING_STATUSES, MARKETPLACE_COMMISSION_BASES, MARKETPLACE_RELATIONSHIP_TYPES, MARKETPLACE_FEE_TYPES, MARKETPLACE_FEE_ALLOCATION_BASES, MARKETPLACE_LEDGER_STATUSES, MARKETPLACE_INVENTORY_POLICY_KINDS, MARKETPLACE_SELLER_DEFAULT_COMMISSION, STOCK_STATUSES, DEFAULT_MARKETPLACE_LISTING_STATUS, DEFAULT_MARKETPLACE_COMMISSION_BASIS, DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE, DEFAULT_STRIPE_FEE_ALLOCATION_BASIS, DEFAULT_RIBBN_FEE_ALLOCATION_BASIS, DEFAULT_MARKETPLACE_LEDGER_STATUS, User, AnalyticsHelpers, OrderHelpers, WebhookFormState, MerchantWebPage, ShopifyMerchantAccount, CustomerNotification, TaxHelpers, PricingHelpers, ProductSkuHelpers, ProductVariantHelpers, ReturnPolicyHelpers, ReceiptXmlHelpers, ProductInventoryHelpers, RetailProductFactory, SKU_ALPHABET, DEFAULT_SKU_LENGTH, PLACEHOLDER_VARIANT_ID, TAX_CATEGORIES, TAX_CATEGORY_RATES, TAX_CATEGORY_BASE_LABELS, TAX_CATEGORY_ALIASES, FALLBACK_TAX_COUNTRY_CODE, PRODUCT_STATES, PRODUCT_STATE_LABELS, PRODUCT_CLASS_VALUES, ADMIN_STATES, ADMIN_SIMPLIFIED_STATES, RETAIL_EDITABLE_PRODUCT_STATES, getProductStateLabel, getRetailEditableProductStateOptions, };
|
|
63
64
|
export type { PlaceholderVariantInput, PlaceholderVariantInventory, PlaceholderVariantLocation, } from './helpers/ProductInventoryHelpers';
|
|
64
65
|
export type { RetailOwnershipInput, RetailAccountingInput, RetailLocationInput, ClothingDetailsInput, NonClothingDetailsInput, OneOfAKindClothingInput, MultivariantClothingInput, TrackedRetailInput, UntrackedRetailInput, } from './factories/Product/RetailProductFactory';
|
|
65
66
|
export type { TaxCategoryValue } from './constants/tax-constants';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getRetailEditableProductStateOptions = exports.getProductStateLabel = exports.RETAIL_EDITABLE_PRODUCT_STATES = exports.ADMIN_SIMPLIFIED_STATES = exports.ADMIN_STATES = exports.PRODUCT_CLASS_VALUES = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.FALLBACK_TAX_COUNTRY_CODE = exports.TAX_CATEGORY_ALIASES = exports.TAX_CATEGORY_BASE_LABELS = exports.TAX_CATEGORY_RATES = exports.TAX_CATEGORIES = exports.PLACEHOLDER_VARIANT_ID = exports.DEFAULT_SKU_LENGTH = exports.SKU_ALPHABET = exports.RetailProductFactory = exports.ProductInventoryHelpers = exports.ReceiptXmlHelpers = exports.ReturnPolicyHelpers = exports.ProductVariantHelpers = exports.ProductSkuHelpers = exports.PricingHelpers = exports.TaxHelpers = exports.CustomerNotification = exports.ShopifyMerchantAccount = exports.MerchantWebPage = exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.DEFAULT_MARKETPLACE_LEDGER_STATUS = exports.DEFAULT_RIBBN_FEE_ALLOCATION_BASIS = exports.DEFAULT_STRIPE_FEE_ALLOCATION_BASIS = exports.DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE = exports.DEFAULT_MARKETPLACE_COMMISSION_BASIS = exports.DEFAULT_MARKETPLACE_LISTING_STATUS = exports.STOCK_STATUSES = exports.MARKETPLACE_SELLER_DEFAULT_COMMISSION = exports.MARKETPLACE_INVENTORY_POLICY_KINDS = exports.MARKETPLACE_LEDGER_STATUSES = exports.MARKETPLACE_FEE_ALLOCATION_BASES = exports.MARKETPLACE_FEE_TYPES = void 0;
|
|
3
|
+
exports.MARKETPLACE_COMMISSION_BASES = exports.MARKETPLACE_LISTING_STATUSES = exports.FiscalReportHelpers = exports.FiscalHelpers = exports.MarketplaceReceiptHelpers = exports.MarketplaceOrderHelpers = exports.MarketplaceLineDisplayHelpers = exports.MarketplaceLegacyAdapters = exports.MarketplaceLedgerHelpers = exports.MarketplaceProductHelpers = exports.ReRobeProductHelpers = exports.MerchantConfigAutomatedPayoutsFormState = exports.MerchantConfigAutomatedPayouts = exports.MerchantFormStateFactory = exports.MerchantFormState = exports.DEFAULT_MARKETPLACE_SELLER_CAPABILITIES = exports.MARKETPLACE_SELLER_CAPABILITIES = exports.MERCHANT_RELATIONSHIP_TYPES = exports.MERCHANT_ACCOUNT_CLASSES = exports.MERCHANT_ACCOUNT_MODES = exports.Merchant = exports.PayoutAccountFormState = exports.PayoutAccount = exports.RefundFormStateFactory = exports.OrderFormStateFactory = exports.OrderFromTraderaEmail = exports.OrderFromApp = exports.OrderFromShopifyStorefrontApi = exports.OrderFromShopifyAdminApi = exports.OrderFromShopifyWebhook = exports.Order = exports.ProductStateManager = exports.Product = exports.KlarnaSessionFactory = exports.ChatRoomFromNewUserSignUp = exports.DraftOrderFromApp = exports.DraftOrderFromMirakl = exports.UserFromAuthTemplateMethod = exports.UserFromShopifyWebhookJSONDoc = exports.UserFormStateFactory = exports.AddressFormStateFactory = exports.PickUpFormStateFactory = exports.SellRequestFormStateFactory = exports.ProductCollectionHelpers = exports.ProductCollectionFormStateFactory = exports.ProductFormStateFactory = exports.ProductFromShopifyJSClientJSONDoc = exports.ProductFromShopifyWebhookJSONDoc = exports.ProductFromAlgoliaJSONDoc = exports.RibbnFile = void 0;
|
|
4
|
+
exports.getRetailEditableProductStateOptions = exports.getProductStateLabel = exports.RETAIL_EDITABLE_PRODUCT_STATES = exports.ADMIN_SIMPLIFIED_STATES = exports.ADMIN_STATES = exports.PRODUCT_CLASS_VALUES = exports.PRODUCT_STATE_LABELS = exports.PRODUCT_STATES = exports.FALLBACK_TAX_COUNTRY_CODE = exports.TAX_CATEGORY_ALIASES = exports.TAX_CATEGORY_BASE_LABELS = exports.TAX_CATEGORY_RATES = exports.TAX_CATEGORIES = exports.PLACEHOLDER_VARIANT_ID = exports.DEFAULT_SKU_LENGTH = exports.SKU_ALPHABET = exports.RetailProductFactory = exports.ProductInventoryHelpers = exports.ReceiptXmlHelpers = exports.ReturnPolicyHelpers = exports.ProductVariantHelpers = exports.ProductSkuHelpers = exports.PricingHelpers = exports.TaxHelpers = exports.CustomerNotification = exports.ShopifyMerchantAccount = exports.MerchantWebPage = exports.WebhookFormState = exports.OrderHelpers = exports.AnalyticsHelpers = exports.User = exports.DEFAULT_MARKETPLACE_LEDGER_STATUS = exports.DEFAULT_RIBBN_FEE_ALLOCATION_BASIS = exports.DEFAULT_STRIPE_FEE_ALLOCATION_BASIS = exports.DEFAULT_MARKETPLACE_RELATIONSHIP_TYPE = exports.DEFAULT_MARKETPLACE_COMMISSION_BASIS = exports.DEFAULT_MARKETPLACE_LISTING_STATUS = exports.STOCK_STATUSES = exports.MARKETPLACE_SELLER_DEFAULT_COMMISSION = exports.MARKETPLACE_INVENTORY_POLICY_KINDS = exports.MARKETPLACE_LEDGER_STATUSES = exports.MARKETPLACE_FEE_ALLOCATION_BASES = exports.MARKETPLACE_FEE_TYPES = exports.MARKETPLACE_RELATIONSHIP_TYPES = void 0;
|
|
5
5
|
const ProductFromShopifyJSClientJSONDoc_1 = require("./factories/Product/ProductFromShopifyJSClientJSONDoc");
|
|
6
6
|
exports.ProductFromShopifyJSClientJSONDoc = ProductFromShopifyJSClientJSONDoc_1.default;
|
|
7
7
|
const ProductFromAlgoliaJSONDoc_1 = require("./factories/Product/ProductFromAlgoliaJSONDoc");
|
|
@@ -122,6 +122,8 @@ const MarketplaceReceiptHelpers = require("./helpers/marketplace/MarketplaceRece
|
|
|
122
122
|
exports.MarketplaceReceiptHelpers = MarketplaceReceiptHelpers;
|
|
123
123
|
const FiscalHelpers = require("./helpers/FiscalHelpers");
|
|
124
124
|
exports.FiscalHelpers = FiscalHelpers;
|
|
125
|
+
const FiscalReportHelpers = require("./helpers/FiscalReportHelpers");
|
|
126
|
+
exports.FiscalReportHelpers = FiscalReportHelpers;
|
|
125
127
|
const TaxHelpers_1 = require("./helpers/TaxHelpers");
|
|
126
128
|
exports.TaxHelpers = TaxHelpers_1.default;
|
|
127
129
|
const PricingHelpers_1 = require("./helpers/PricingHelpers");
|