@sixtyninecommerce/admin 0.11.0 → 0.13.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/README.md +1509 -28
- package/dist/auth/index.d.ts +7 -1
- package/dist/auth/index.js +8 -1
- package/dist/catalog/documents.d.ts +142 -0
- package/dist/catalog/documents.js +114 -0
- package/dist/catalog/index.d.ts +48 -7
- package/dist/catalog/index.js +6 -1
- package/dist/catalog/metadata.d.ts +244 -0
- package/dist/catalog/metadata.js +220 -0
- package/dist/catalog/properties.d.ts +38 -0
- package/dist/catalog/properties.js +52 -1
- package/dist/catalog/recommendations.d.ts +33 -6
- package/dist/catalog/recommendations.js +94 -2
- package/dist/catalog/reviews.d.ts +17 -4
- package/dist/catalog/reviews.js +7 -0
- package/dist/catalog/variants.d.ts +60 -0
- package/dist/catalog/variants.js +39 -0
- package/dist/catalog/visibility.d.ts +18 -2
- package/dist/client.d.ts +29 -3
- package/dist/client.js +19 -8
- package/dist/content/assets.d.ts +3 -4
- package/dist/content/forms.d.ts +332 -1
- package/dist/content/forms.js +140 -4
- package/dist/content/items.d.ts +31 -8
- package/dist/content/items.js +1 -1
- package/dist/content/menus.d.ts +254 -0
- package/dist/content/menus.js +70 -0
- package/dist/content/strings.d.ts +137 -0
- package/dist/content/strings.js +82 -0
- package/dist/customers/delivery-terms.d.ts +44 -0
- package/dist/customers/delivery-terms.js +32 -0
- package/dist/customers/groups.d.ts +16 -5
- package/dist/customers/groups.js +6 -2
- package/dist/customers/index.d.ts +15 -0
- package/dist/customers/index.js +4 -0
- package/dist/documents/emails.d.ts +154 -0
- package/dist/documents/emails.js +220 -0
- package/dist/documents/index.d.ts +13 -0
- package/dist/documents/index.js +2 -0
- package/dist/fulfillments/create.d.ts +1 -1
- package/dist/fulfillments/create.js +5 -2
- package/dist/fulfillments/index.d.ts +119 -1
- package/dist/fulfillments/index.js +124 -4
- package/dist/fulfillments/warehouse.d.ts +29 -17
- package/dist/fulfillments/warehouse.js +32 -1
- package/dist/index.d.ts +43 -23
- package/dist/index.js +11 -5
- package/dist/integrations/exact-online-types.d.ts +542 -0
- package/dist/integrations/exact-online.d.ts +541 -5
- package/dist/integrations/exact-online.js +714 -1
- package/dist/integrations/index.d.ts +23 -8
- package/dist/integrations/index.js +9 -4
- package/dist/integrations/pipeline-discoveries.d.ts +65 -0
- package/dist/integrations/pipeline-discoveries.js +65 -0
- package/dist/integrations/pipeline-runs.d.ts +119 -0
- package/dist/integrations/pipeline-runs.js +87 -0
- package/dist/integrations/pipelines.d.ts +73 -2
- package/dist/integrations/pipelines.js +36 -1
- package/dist/integrations/price-import.d.ts +223 -0
- package/dist/integrations/price-import.js +124 -0
- package/dist/integrations/types.d.ts +221 -3
- package/dist/integrations/types.js +4 -3
- package/dist/meta/index.d.ts +10 -0
- package/dist/metafields/index.d.ts +8 -1
- package/dist/metafields/index.js +10 -0
- package/dist/orders/cancel-with-money.d.ts +10 -0
- package/dist/orders/cancel-with-money.js +2 -0
- package/dist/orders/commit-edit.d.ts +16 -0
- package/dist/orders/commit-edit.js +14 -1
- package/dist/orders/deposit-policy.d.ts +3 -1
- package/dist/orders/index.d.ts +22 -11
- package/dist/orders/index.js +5 -2
- package/dist/orders/list.d.ts +26 -5
- package/dist/orders/list.js +123 -13
- package/dist/orders/manual-discounts.d.ts +13 -5
- package/dist/orders/money-view.d.ts +149 -0
- package/dist/orders/money-view.js +99 -0
- package/dist/orders/plan-edit.d.ts +34 -2
- package/dist/orders/plan-edit.js +110 -12
- package/dist/orders/surcharges.d.ts +12 -0
- package/dist/orders/surcharges.js +34 -9
- package/dist/payments/account-credit.d.ts +17 -1
- package/dist/payments/account-credit.js +25 -2
- package/dist/payments/credit-noted-fields.d.ts +8 -1
- package/dist/payments/credit-noted-fields.js +34 -2
- package/dist/payments/customer-consent.d.ts +30 -0
- package/dist/payments/customer-consent.js +49 -0
- package/dist/payments/index.d.ts +89 -14
- package/dist/payments/index.js +22 -2
- package/dist/payments/requests.d.ts +6 -3
- package/dist/payments/requests.js +1 -0
- package/dist/pickups/index.d.ts +5 -3
- package/dist/pickups/index.js +5 -2
- package/dist/platform/email-gateways.d.ts +165 -0
- package/dist/platform/email-gateways.js +78 -0
- package/dist/platform/tax.d.ts +11 -3
- package/dist/platform/tax.js +30 -0
- package/dist/pos/exchanges.d.ts +6 -1
- package/dist/pos/index.d.ts +229 -10
- package/dist/pos/index.js +113 -4
- package/dist/pos/offline-sales.d.ts +44 -3
- package/dist/pos/offline-sales.js +57 -3
- package/dist/pos/returns.d.ts +28 -1
- package/dist/pos/returns.js +36 -6
- package/dist/pricing/price-lists.d.ts +3 -1
- package/dist/purchasing/alerts.d.ts +19 -4
- package/dist/purchasing/alerts.js +29 -3
- package/dist/purchasing/backorders.d.ts +61 -0
- package/dist/purchasing/backorders.js +92 -0
- package/dist/purchasing/index.d.ts +21 -3
- package/dist/purchasing/index.js +8 -0
- package/dist/purchasing/links.d.ts +263 -0
- package/dist/purchasing/links.js +192 -0
- package/dist/purchasing/purchase-orders.d.ts +4 -1
- package/dist/purchasing/receipts.d.ts +396 -0
- package/dist/purchasing/receipts.js +287 -0
- package/dist/purchasing/returns.d.ts +273 -0
- package/dist/purchasing/returns.js +229 -0
- package/dist/quotes/index.d.ts +20 -3
- package/dist/returns/index.d.ts +62 -1
- package/dist/returns/index.js +61 -0
- package/dist/seo/config.d.ts +128 -0
- package/dist/seo/config.js +95 -0
- package/dist/seo/redirects.d.ts +125 -0
- package/dist/seo/redirects.js +60 -1
- package/dist/seo/settings.d.ts +147 -0
- package/dist/seo/settings.js +209 -0
- package/dist/shipping/index.d.ts +6 -0
- package/dist/shipping/index.js +2 -0
- package/dist/shipping/methods.d.ts +8 -1
- package/dist/shipping/myparcel.d.ts +415 -1
- package/dist/shipping/myparcel.js +291 -3
- package/dist/shipping/rate-tables.d.ts +149 -4
- package/dist/shipping/rate-tables.js +229 -23
- package/dist/shipping/ship-to-countries.d.ts +75 -0
- package/dist/shipping/ship-to-countries.js +47 -0
- package/dist/stock/by-location.d.ts +86 -0
- package/dist/stock/by-location.js +94 -0
- package/dist/stock/index.d.ts +8 -1
- package/dist/stock/index.js +4 -0
- package/dist/stock/settings.d.ts +106 -0
- package/dist/stock/settings.js +103 -0
- package/dist/stock/transfers.d.ts +171 -10
- package/dist/stock/transfers.js +82 -4
- package/dist/stored-value/index.d.ts +98 -7
- package/dist/stored-value/index.js +71 -4
- package/dist/tax/display-policy.d.ts +105 -0
- package/dist/tax/display-policy.js +84 -0
- package/dist/tax/index.d.ts +3 -0
- package/dist/tax/index.js +2 -0
- package/dist/tenant/email-templates.d.ts +222 -1
- package/dist/tenant/email-templates.js +227 -10
- package/package.json +2 -2
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { pageFromVendureList, readOffsetCursor, } from '@sixtyninecommerce/core';
|
|
2
|
+
export const GOODS_RECEIPT_LINE_FIELDS = /* GraphQL */ `
|
|
3
|
+
id
|
|
4
|
+
goodsReceiptId
|
|
5
|
+
purchaseOrderId
|
|
6
|
+
purchaseOrderCode
|
|
7
|
+
purchaseOrderLineId
|
|
8
|
+
reversesLineId
|
|
9
|
+
productVariantId
|
|
10
|
+
sku
|
|
11
|
+
name
|
|
12
|
+
supplierSku
|
|
13
|
+
purchaseUnitLabel
|
|
14
|
+
purchaseUnitFactor
|
|
15
|
+
acceptedBaseQuantity
|
|
16
|
+
rejectedBaseQuantity
|
|
17
|
+
rejectReason
|
|
18
|
+
overReceiptReason
|
|
19
|
+
cancelledBaseQuantity
|
|
20
|
+
reversedBaseQuantity
|
|
21
|
+
returnedBaseQuantity
|
|
22
|
+
returnedRejectedBaseQuantity
|
|
23
|
+
supplierCurrencyCode
|
|
24
|
+
unitCostSupplierCurrency
|
|
25
|
+
fxRate
|
|
26
|
+
fxRateSource
|
|
27
|
+
fxRateDate
|
|
28
|
+
unitCostEntityCurrency
|
|
29
|
+
landedUnitCost
|
|
30
|
+
traceability { lot expiresOn serials }
|
|
31
|
+
stockMovementId
|
|
32
|
+
externalLineId
|
|
33
|
+
createdAt
|
|
34
|
+
`;
|
|
35
|
+
export const GOODS_RECEIPT_FIELDS = /* GraphQL */ `
|
|
36
|
+
id
|
|
37
|
+
scopeId
|
|
38
|
+
legalEntityId
|
|
39
|
+
originChannelId
|
|
40
|
+
code
|
|
41
|
+
kind
|
|
42
|
+
reversesReceiptId
|
|
43
|
+
reversesReceiptCode
|
|
44
|
+
supplierId
|
|
45
|
+
supplier { id code name status }
|
|
46
|
+
stockLocationId
|
|
47
|
+
stockLocation { id name }
|
|
48
|
+
receivedOn
|
|
49
|
+
receivedAt
|
|
50
|
+
currencyCode
|
|
51
|
+
supplierDeliveryRef
|
|
52
|
+
reason
|
|
53
|
+
managedBy
|
|
54
|
+
externalId
|
|
55
|
+
externalNumber
|
|
56
|
+
actorRef
|
|
57
|
+
createdByRef
|
|
58
|
+
reversals { id code createdAt }
|
|
59
|
+
lines { ${GOODS_RECEIPT_LINE_FIELDS} }
|
|
60
|
+
createdAt
|
|
61
|
+
`;
|
|
62
|
+
export const LANDED_CHARGE_FIELDS = /* GraphQL */ `
|
|
63
|
+
id
|
|
64
|
+
goodsReceiptId
|
|
65
|
+
purchaseOrderId
|
|
66
|
+
kind
|
|
67
|
+
label
|
|
68
|
+
payeeSupplierId
|
|
69
|
+
payeeSupplier { id code name status }
|
|
70
|
+
payeeName
|
|
71
|
+
currencyCode
|
|
72
|
+
amount
|
|
73
|
+
allocation
|
|
74
|
+
incurredOn
|
|
75
|
+
fxRate
|
|
76
|
+
fxRateSource
|
|
77
|
+
fxRateDate
|
|
78
|
+
amountEntityCurrency
|
|
79
|
+
allocations { goodsReceiptLineId productVariantId baseQuantity basis amount unitCostDelta }
|
|
80
|
+
appliedAt
|
|
81
|
+
removedAt
|
|
82
|
+
removeReason
|
|
83
|
+
removedByRef
|
|
84
|
+
createdByRef
|
|
85
|
+
createdAt
|
|
86
|
+
`;
|
|
87
|
+
/** A receipt with its landed charges: `get` and the charge writes. */
|
|
88
|
+
export const GOODS_RECEIPT_DETAIL_FIELDS = /* GraphQL */ `
|
|
89
|
+
${GOODS_RECEIPT_FIELDS}
|
|
90
|
+
charges { ${LANDED_CHARGE_FIELDS} }
|
|
91
|
+
`;
|
|
92
|
+
export const RECEIVABLE_LINE_FIELDS = /* GraphQL */ `
|
|
93
|
+
purchaseOrderId
|
|
94
|
+
purchaseOrderCode
|
|
95
|
+
purchaseOrderLineId
|
|
96
|
+
position
|
|
97
|
+
supplierId
|
|
98
|
+
supplier { id code name status }
|
|
99
|
+
stockLocationId
|
|
100
|
+
productVariantId
|
|
101
|
+
sku
|
|
102
|
+
name
|
|
103
|
+
supplierSku
|
|
104
|
+
supplierBarcode
|
|
105
|
+
gtin
|
|
106
|
+
purchaseUnitLabel
|
|
107
|
+
purchaseUnitFactor
|
|
108
|
+
orderedBaseQuantity
|
|
109
|
+
cancelledBaseQuantity
|
|
110
|
+
receivedBaseQuantity
|
|
111
|
+
returnedForReplacementBaseQuantity
|
|
112
|
+
remainingBaseQuantity
|
|
113
|
+
toleranceBaseQuantity
|
|
114
|
+
maxAcceptedBaseQuantity
|
|
115
|
+
confirmedBaseQuantity
|
|
116
|
+
expectedOn
|
|
117
|
+
`;
|
|
118
|
+
export const GOODS_RECEIPTS_QUERY = /* GraphQL */ `
|
|
119
|
+
query GoodsReceipts($options: GoodsReceiptListOptions) {
|
|
120
|
+
goodsReceipts(options: $options) {
|
|
121
|
+
items { ${GOODS_RECEIPT_FIELDS} }
|
|
122
|
+
totalItems
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
export const GOODS_RECEIPT_QUERY = /* GraphQL */ `
|
|
127
|
+
query GoodsReceipt($id: ID!) {
|
|
128
|
+
goodsReceipt(id: $id) { ${GOODS_RECEIPT_DETAIL_FIELDS} }
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
export const RECEIVABLE_PURCHASE_ORDER_LINES_QUERY = /* GraphQL */ `
|
|
132
|
+
query ReceivablePurchaseOrderLines($options: ReceivablePurchaseOrderLinesOptions) {
|
|
133
|
+
receivablePurchaseOrderLines(options: $options) { ${RECEIVABLE_LINE_FIELDS} }
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
export const POST_GOODS_RECEIPT_MUTATION = /* GraphQL */ `
|
|
137
|
+
mutation PostGoodsReceipt($input: PostGoodsReceiptInput!, $idempotencyKey: String!) {
|
|
138
|
+
postGoodsReceipt(input: $input, idempotencyKey: $idempotencyKey) { ${GOODS_RECEIPT_FIELDS} }
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
export const REVERSE_GOODS_RECEIPT_MUTATION = /* GraphQL */ `
|
|
142
|
+
mutation ReverseGoodsReceipt($input: ReverseGoodsReceiptInput!, $idempotencyKey: String!) {
|
|
143
|
+
reverseGoodsReceipt(input: $input, idempotencyKey: $idempotencyKey) {
|
|
144
|
+
${GOODS_RECEIPT_FIELDS}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
export const ADD_GOODS_RECEIPT_CHARGE_MUTATION = /* GraphQL */ `
|
|
149
|
+
mutation AddGoodsReceiptCharge($input: AddGoodsReceiptChargeInput!, $idempotencyKey: String) {
|
|
150
|
+
addGoodsReceiptCharge(input: $input, idempotencyKey: $idempotencyKey) {
|
|
151
|
+
${GOODS_RECEIPT_DETAIL_FIELDS}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
export const REMOVE_GOODS_RECEIPT_CHARGE_MUTATION = /* GraphQL */ `
|
|
156
|
+
mutation RemoveGoodsReceiptCharge(
|
|
157
|
+
$input: RemoveGoodsReceiptChargeInput!
|
|
158
|
+
$idempotencyKey: String
|
|
159
|
+
) {
|
|
160
|
+
removeGoodsReceiptCharge(input: $input, idempotencyKey: $idempotencyKey) {
|
|
161
|
+
${GOODS_RECEIPT_DETAIL_FIELDS}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`;
|
|
165
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
166
|
+
const LIST_FILTERS = ['purchaseOrderId', 'supplierId', 'stockLocationId', 'kind', 'term'];
|
|
167
|
+
const RECEIVABLE_FILTERS = ['supplierId', 'stockLocationId', 'purchaseOrderId'];
|
|
168
|
+
const LINE_INPUT_FIELDS = [
|
|
169
|
+
'purchaseOrderLineId',
|
|
170
|
+
'acceptedBaseQuantity',
|
|
171
|
+
'rejectedBaseQuantity',
|
|
172
|
+
'rejectReason',
|
|
173
|
+
'overReceiptReason',
|
|
174
|
+
'traceability',
|
|
175
|
+
];
|
|
176
|
+
const CHARGE_INPUT_FIELDS = [
|
|
177
|
+
'goodsReceiptId',
|
|
178
|
+
'kind',
|
|
179
|
+
'label',
|
|
180
|
+
'payeeSupplierId',
|
|
181
|
+
'payeeName',
|
|
182
|
+
'currencyCode',
|
|
183
|
+
'amount',
|
|
184
|
+
'allocation',
|
|
185
|
+
'incurredOn',
|
|
186
|
+
'fxRate',
|
|
187
|
+
];
|
|
188
|
+
const POST_INPUT_FIELDS = [
|
|
189
|
+
'supplierId',
|
|
190
|
+
'stockLocationId',
|
|
191
|
+
'receivedOn',
|
|
192
|
+
'supplierDeliveryRef',
|
|
193
|
+
'fxRates',
|
|
194
|
+
];
|
|
195
|
+
function picked(input, fields) {
|
|
196
|
+
const out = {};
|
|
197
|
+
for (const field of fields) {
|
|
198
|
+
const value = input[field];
|
|
199
|
+
if (value !== undefined)
|
|
200
|
+
out[field] = value;
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
export function createPurchasingReceiptsModule(transport) {
|
|
205
|
+
const listPage = async (skip, take, options) => {
|
|
206
|
+
const filters = options ? picked(options, LIST_FILTERS) : {};
|
|
207
|
+
const data = await transport.graphql({
|
|
208
|
+
api: 'admin',
|
|
209
|
+
query: GOODS_RECEIPTS_QUERY,
|
|
210
|
+
variables: { options: { skip, take, ...filters } },
|
|
211
|
+
}, options);
|
|
212
|
+
return pageFromVendureList(data.goodsReceipts, skip, take, (cursor) => listPage(readOffsetCursor(cursor), take, options));
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
async list(options) {
|
|
216
|
+
const take = options?.limit ?? DEFAULT_PAGE_SIZE;
|
|
217
|
+
const skip = options?.after === undefined ? 0 : readOffsetCursor(options.after);
|
|
218
|
+
return listPage(skip, take, options);
|
|
219
|
+
},
|
|
220
|
+
async get(id, call) {
|
|
221
|
+
const data = await transport.graphql({ api: 'admin', query: GOODS_RECEIPT_QUERY, variables: { id } }, call);
|
|
222
|
+
return data.goodsReceipt;
|
|
223
|
+
},
|
|
224
|
+
async receivable(options) {
|
|
225
|
+
const filters = options ? picked(options, RECEIVABLE_FILTERS) : {};
|
|
226
|
+
const data = await transport.graphql({
|
|
227
|
+
api: 'admin',
|
|
228
|
+
query: RECEIVABLE_PURCHASE_ORDER_LINES_QUERY,
|
|
229
|
+
variables: Object.keys(filters).length > 0 ? { options: filters } : {},
|
|
230
|
+
}, options);
|
|
231
|
+
return data.receivablePurchaseOrderLines;
|
|
232
|
+
},
|
|
233
|
+
async post(input, call) {
|
|
234
|
+
const data = await transport.graphql({
|
|
235
|
+
api: 'admin',
|
|
236
|
+
query: POST_GOODS_RECEIPT_MUTATION,
|
|
237
|
+
variables: {
|
|
238
|
+
input: {
|
|
239
|
+
...picked(input, POST_INPUT_FIELDS),
|
|
240
|
+
lines: input.lines.map((line) => picked(line, LINE_INPUT_FIELDS)),
|
|
241
|
+
},
|
|
242
|
+
idempotencyKey: call.idempotencyKey,
|
|
243
|
+
},
|
|
244
|
+
}, call);
|
|
245
|
+
return data.postGoodsReceipt;
|
|
246
|
+
},
|
|
247
|
+
async reverse(input, call) {
|
|
248
|
+
const data = await transport.graphql({
|
|
249
|
+
api: 'admin',
|
|
250
|
+
query: REVERSE_GOODS_RECEIPT_MUTATION,
|
|
251
|
+
variables: {
|
|
252
|
+
input: {
|
|
253
|
+
goodsReceiptId: input.goodsReceiptId,
|
|
254
|
+
reason: input.reason,
|
|
255
|
+
...(input.lines === undefined ? {} : { lines: input.lines }),
|
|
256
|
+
},
|
|
257
|
+
idempotencyKey: call.idempotencyKey,
|
|
258
|
+
},
|
|
259
|
+
}, call);
|
|
260
|
+
return data.reverseGoodsReceipt;
|
|
261
|
+
},
|
|
262
|
+
charges: {
|
|
263
|
+
async add(input, call) {
|
|
264
|
+
const data = await transport.graphql({
|
|
265
|
+
api: 'admin',
|
|
266
|
+
query: ADD_GOODS_RECEIPT_CHARGE_MUTATION,
|
|
267
|
+
variables: {
|
|
268
|
+
input: picked(input, CHARGE_INPUT_FIELDS),
|
|
269
|
+
idempotencyKey: call?.idempotencyKey,
|
|
270
|
+
},
|
|
271
|
+
}, call);
|
|
272
|
+
return data.addGoodsReceiptCharge;
|
|
273
|
+
},
|
|
274
|
+
async remove(input, call) {
|
|
275
|
+
const data = await transport.graphql({
|
|
276
|
+
api: 'admin',
|
|
277
|
+
query: REMOVE_GOODS_RECEIPT_CHARGE_MUTATION,
|
|
278
|
+
variables: {
|
|
279
|
+
input: { chargeId: input.chargeId, reason: input.reason },
|
|
280
|
+
idempotencyKey: call?.idempotencyKey,
|
|
281
|
+
},
|
|
282
|
+
}, call);
|
|
283
|
+
return data.removeGoodsReceiptCharge;
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { type Page, type Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call, ListOptions } from '../types.js';
|
|
3
|
+
import type { PurchaseOrderLocation, PurchaseOrderSupplier } from './purchase-orders.js';
|
|
4
|
+
/**
|
|
5
|
+
* A supplier return's status (purchase-orders spec §7.3): `draft → shipped → resolved`, and
|
|
6
|
+
* `draft → cancelled`. The meta catalog serves the machine (`admin.meta.catalog()` →
|
|
7
|
+
* `transitions.supplierReturn`) and its labels. A string on the wire: more statuses may arrive.
|
|
8
|
+
*/
|
|
9
|
+
export type SupplierReturnStatus = 'draft' | 'shipped' | 'resolved' | 'cancelled' | (string & {});
|
|
10
|
+
/** Refused goods sent back from a receipt (`rejected`), or goods from stock (`on_hand`). */
|
|
11
|
+
export type SupplierReturnOrigin = 'rejected' | 'on_hand' | (string & {});
|
|
12
|
+
/** What is expected of the supplier for a line. */
|
|
13
|
+
export type SupplierReturnOutcome = 'credit_expected' | 'replacement_expected' | 'written_off' | (string & {});
|
|
14
|
+
/** What became of a line; `open` until the supplier answered. */
|
|
15
|
+
export type SupplierReturnResolution = 'open' | 'credited' | 'replaced' | 'written_off' | (string & {});
|
|
16
|
+
/**
|
|
17
|
+
* One line of a supplier return (spec §7.1, §8.9): base units of one goods receipt line going back
|
|
18
|
+
* to the supplier. `unitCost` is a decimal string of minor units with six decimals: parse it with a
|
|
19
|
+
* decimal library, not `Number`.
|
|
20
|
+
*/
|
|
21
|
+
export interface SupplierReturnLine {
|
|
22
|
+
id: string;
|
|
23
|
+
supplierReturnId: string;
|
|
24
|
+
position: number;
|
|
25
|
+
goodsReceiptId: string;
|
|
26
|
+
/** The goods receipt's number. */
|
|
27
|
+
goodsReceiptCode: string;
|
|
28
|
+
/** The receipt line the goods came in on: it fixes the cost they leave at. */
|
|
29
|
+
goodsReceiptLineId: string;
|
|
30
|
+
purchaseOrderId: string;
|
|
31
|
+
/** The purchase order's number. */
|
|
32
|
+
purchaseOrderCode: string;
|
|
33
|
+
purchaseOrderLineId: string;
|
|
34
|
+
productVariantId: string;
|
|
35
|
+
/** The purchase order line's snapshots. */
|
|
36
|
+
sku: string;
|
|
37
|
+
name: string;
|
|
38
|
+
supplierSku: string | null;
|
|
39
|
+
purchaseUnitLabel: string | null;
|
|
40
|
+
purchaseUnitFactor: number;
|
|
41
|
+
/** Base units going back. */
|
|
42
|
+
baseQuantity: number;
|
|
43
|
+
reason: string;
|
|
44
|
+
outcome: SupplierReturnOutcome;
|
|
45
|
+
resolution: SupplierReturnResolution;
|
|
46
|
+
/** The receipt line's supplier currency: a credit amount is stated in it. */
|
|
47
|
+
currencyCode: string;
|
|
48
|
+
/** Informational: what the supplier credited, minor units of `currencyCode`. */
|
|
49
|
+
creditAmount: number | null;
|
|
50
|
+
/** The supplier's credit note or replacement delivery reference. */
|
|
51
|
+
resolutionReference: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* What the cost ledger took each unit out at when a return from stock shipped, minor units of
|
|
54
|
+
* the purchasing currency; null for refused goods and before the return ships.
|
|
55
|
+
*/
|
|
56
|
+
unitCost: string | null;
|
|
57
|
+
/** What this line cancelled on its purchase order line. */
|
|
58
|
+
cancelledBaseQuantity: number;
|
|
59
|
+
/** What this line re-opened on its purchase order line (goods from stock to be replaced). */
|
|
60
|
+
reopenedBaseQuantity: number;
|
|
61
|
+
/** ISO-8601 UTC. */
|
|
62
|
+
resolvedAt: string | null;
|
|
63
|
+
resolvedByRef: string | null;
|
|
64
|
+
stockMovementId: string | null;
|
|
65
|
+
/** ISO-8601 UTC. */
|
|
66
|
+
createdAt: string;
|
|
67
|
+
}
|
|
68
|
+
/** One move of a supplier return's status, oldest first. */
|
|
69
|
+
export interface SupplierReturnStatusEntry {
|
|
70
|
+
id: string;
|
|
71
|
+
/** Null on the entry that records the return's creation. */
|
|
72
|
+
fromStatus: SupplierReturnStatus | null;
|
|
73
|
+
status: SupplierReturnStatus;
|
|
74
|
+
actorRef: string | null;
|
|
75
|
+
reason: string | null;
|
|
76
|
+
metadata: Record<string, unknown> | null;
|
|
77
|
+
/** ISO-8601 UTC. */
|
|
78
|
+
createdAt: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A return of goods to ONE supplier from ONE stock location, of the active store's PURCHASING
|
|
82
|
+
* SCOPE (purchase-orders spec §7.1, §8.9): refused goods from a receipt (no stock effect), or goods
|
|
83
|
+
* from stock (they leave the location when the return ships).
|
|
84
|
+
*/
|
|
85
|
+
export interface SupplierReturn {
|
|
86
|
+
id: string;
|
|
87
|
+
/** The legal entity's id, or `sandbox:<channelId>` for a sandbox store. */
|
|
88
|
+
scopeId: string;
|
|
89
|
+
legalEntityId: string | null;
|
|
90
|
+
/** The store that raised it. */
|
|
91
|
+
originChannelId: string;
|
|
92
|
+
/** The supplier-return number (`RS-…`; `TEST-RS-…` in a sandbox store). */
|
|
93
|
+
code: string;
|
|
94
|
+
status: SupplierReturnStatus;
|
|
95
|
+
origin: SupplierReturnOrigin;
|
|
96
|
+
supplierId: string;
|
|
97
|
+
supplier: PurchaseOrderSupplier | null;
|
|
98
|
+
/** Where the goods leave from. */
|
|
99
|
+
stockLocationId: string;
|
|
100
|
+
stockLocation: PurchaseOrderLocation | null;
|
|
101
|
+
/** The supplier's return authorisation (RMA) number. */
|
|
102
|
+
supplierReference: string | null;
|
|
103
|
+
notesToSupplier: string | null;
|
|
104
|
+
carrier: string | null;
|
|
105
|
+
trackingCode: string | null;
|
|
106
|
+
/** ISO-8601 UTC. */
|
|
107
|
+
shippedAt: string | null;
|
|
108
|
+
/** ISO-8601 UTC. */
|
|
109
|
+
resolvedAt: string | null;
|
|
110
|
+
managedBy: string | null;
|
|
111
|
+
externalId: string | null;
|
|
112
|
+
createdByRef: string | null;
|
|
113
|
+
/** When the return's PDF was drawn (at ship); null without one. ISO-8601 UTC. */
|
|
114
|
+
documentIssuedAt: string | null;
|
|
115
|
+
lines: SupplierReturnLine[];
|
|
116
|
+
statusHistory: SupplierReturnStatusEntry[];
|
|
117
|
+
/** ISO-8601 UTC. */
|
|
118
|
+
createdAt: string;
|
|
119
|
+
/** ISO-8601 UTC. */
|
|
120
|
+
updatedAt: string;
|
|
121
|
+
}
|
|
122
|
+
/** A five-minute signed link to a shipped return's PDF. */
|
|
123
|
+
export interface SupplierReturnDocumentUrl {
|
|
124
|
+
url: string;
|
|
125
|
+
/** ISO-8601 UTC. */
|
|
126
|
+
expiresAt: string;
|
|
127
|
+
filename: string;
|
|
128
|
+
}
|
|
129
|
+
export interface SupplierReturnListOptions extends ListOptions {
|
|
130
|
+
status?: 'draft' | 'shipped' | 'resolved' | 'cancelled';
|
|
131
|
+
origin?: 'rejected' | 'on_hand';
|
|
132
|
+
supplierId?: string;
|
|
133
|
+
stockLocationId?: string;
|
|
134
|
+
/** Returns with a line of this purchase order. */
|
|
135
|
+
purchaseOrderId?: string;
|
|
136
|
+
/** Returns with a line of this goods receipt. */
|
|
137
|
+
goodsReceiptId?: string;
|
|
138
|
+
/** Matches the number, the supplier's reference or the tracking code, case-insensitively. */
|
|
139
|
+
term?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface SupplierReturnLineInput {
|
|
142
|
+
/** A line of a goods receipt (not of a reversal) of the return's supplier. */
|
|
143
|
+
goodsReceiptLineId: string;
|
|
144
|
+
/** Base units going back: at most what the receipt line still holds to return. */
|
|
145
|
+
baseQuantity: number;
|
|
146
|
+
/** Why; refused goods take the receipt line's reason when left out, goods from stock need one. */
|
|
147
|
+
reason?: string;
|
|
148
|
+
outcome: 'credit_expected' | 'replacement_expected' | 'written_off';
|
|
149
|
+
}
|
|
150
|
+
export interface CreateSupplierReturnInput {
|
|
151
|
+
origin: 'rejected' | 'on_hand';
|
|
152
|
+
/** The lines' supplier; named, it must be theirs. */
|
|
153
|
+
supplierId?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Refused goods: the receipts' location (named, it must be it). From stock: a stock location of
|
|
156
|
+
* the store the legal entity owns; the receipts' when left out.
|
|
157
|
+
*/
|
|
158
|
+
stockLocationId?: string;
|
|
159
|
+
supplierReference?: string;
|
|
160
|
+
notesToSupplier?: string;
|
|
161
|
+
carrier?: string;
|
|
162
|
+
trackingCode?: string;
|
|
163
|
+
lines: SupplierReturnLineInput[];
|
|
164
|
+
}
|
|
165
|
+
/** A change of a return: a field left out is kept, `null` clears it. */
|
|
166
|
+
export interface UpdateSupplierReturnInput {
|
|
167
|
+
/** A draft from stock only; `null` takes the receipts' location again. */
|
|
168
|
+
stockLocationId?: string | null;
|
|
169
|
+
supplierReference?: string | null;
|
|
170
|
+
/** A draft only. */
|
|
171
|
+
notesToSupplier?: string | null;
|
|
172
|
+
carrier?: string | null;
|
|
173
|
+
trackingCode?: string | null;
|
|
174
|
+
/** A draft only: every line, in its new order. */
|
|
175
|
+
lines?: SupplierReturnLineInput[];
|
|
176
|
+
}
|
|
177
|
+
export interface ShipSupplierReturnInput {
|
|
178
|
+
carrier?: string;
|
|
179
|
+
trackingCode?: string;
|
|
180
|
+
/** Email the supplier the return's PDF ("Supplier Return Sent"); `true` when left out. */
|
|
181
|
+
notifySupplier?: boolean;
|
|
182
|
+
}
|
|
183
|
+
export interface ResolveSupplierReturnLineInput {
|
|
184
|
+
supplierReturnLineId: string;
|
|
185
|
+
resolution: 'credited' | 'replaced' | 'written_off';
|
|
186
|
+
/** Informational, a credited line only: minor units of the line's `currencyCode`. */
|
|
187
|
+
creditAmount?: number;
|
|
188
|
+
/** The supplier's credit note or replacement delivery reference. */
|
|
189
|
+
resolutionReference?: string;
|
|
190
|
+
}
|
|
191
|
+
/** A cancel, with the staff's optional reason. */
|
|
192
|
+
export interface SupplierReturnCancelOptions extends Call {
|
|
193
|
+
reason?: string;
|
|
194
|
+
}
|
|
195
|
+
/** A ship must carry its idempotency key (spec §10.1). */
|
|
196
|
+
export type SupplierReturnKeyedCall = Call & {
|
|
197
|
+
idempotencyKey: string;
|
|
198
|
+
};
|
|
199
|
+
export declare const SUPPLIER_RETURN_LINE_FIELDS = "\n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n";
|
|
200
|
+
export declare const SUPPLIER_RETURN_FIELDS = "\n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n";
|
|
201
|
+
export declare const SUPPLIER_RETURNS_QUERY = "\n query SupplierReturns($options: SupplierReturnListOptions) {\n supplierReturns(options: $options) {\n items { \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n }\n totalItems\n }\n }\n";
|
|
202
|
+
export declare const SUPPLIER_RETURN_QUERY = "\n query SupplierReturn($id: ID!) {\n supplierReturn(id: $id) { \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n }\n }\n";
|
|
203
|
+
export declare const CREATE_SUPPLIER_RETURN_MUTATION = "\n mutation CreateSupplierReturn($input: CreateSupplierReturnInput!, $idempotencyKey: String) {\n createSupplierReturn(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n\n }\n }\n";
|
|
204
|
+
export declare const UPDATE_SUPPLIER_RETURN_MUTATION = "\n mutation UpdateSupplierReturn($input: UpdateSupplierReturnInput!, $idempotencyKey: String) {\n updateSupplierReturn(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n\n }\n }\n";
|
|
205
|
+
export declare const SHIP_SUPPLIER_RETURN_MUTATION = "\n mutation ShipSupplierReturn($input: ShipSupplierReturnInput!, $idempotencyKey: String!) {\n shipSupplierReturn(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n\n }\n }\n";
|
|
206
|
+
export declare const RESOLVE_SUPPLIER_RETURN_LINE_MUTATION = "\n mutation ResolveSupplierReturnLine(\n $input: ResolveSupplierReturnLineInput!\n $idempotencyKey: String\n ) {\n resolveSupplierReturnLine(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n\n }\n }\n";
|
|
207
|
+
export declare const CANCEL_SUPPLIER_RETURN_MUTATION = "\n mutation CancelSupplierReturn($id: ID!, $reason: String, $idempotencyKey: String) {\n cancelSupplierReturn(id: $id, reason: $reason, idempotencyKey: $idempotencyKey) {\n \n id\n scopeId\n legalEntityId\n originChannelId\n code\n status\n origin\n supplierId\n supplier { id code name status }\n stockLocationId\n stockLocation { id name }\n supplierReference\n notesToSupplier\n carrier\n trackingCode\n shippedAt\n resolvedAt\n managedBy\n externalId\n createdByRef\n documentIssuedAt\n lines { \n id\n supplierReturnId\n position\n goodsReceiptId\n goodsReceiptCode\n goodsReceiptLineId\n purchaseOrderId\n purchaseOrderCode\n purchaseOrderLineId\n productVariantId\n sku\n name\n supplierSku\n purchaseUnitLabel\n purchaseUnitFactor\n baseQuantity\n reason\n outcome\n resolution\n currencyCode\n creditAmount\n resolutionReference\n unitCost\n cancelledBaseQuantity\n reopenedBaseQuantity\n resolvedAt\n resolvedByRef\n stockMovementId\n createdAt\n }\n statusHistory { id fromStatus status actorRef reason metadata createdAt }\n createdAt\n updatedAt\n\n }\n }\n";
|
|
208
|
+
export declare const CREATE_SUPPLIER_RETURN_DOCUMENT_URL_MUTATION = "\n mutation CreateSupplierReturnDocumentUrl($supplierReturnId: ID!) {\n createSupplierReturnDocumentUrl(supplierReturnId: $supplierReturnId) {\n url\n expiresAt\n filename\n }\n }\n";
|
|
209
|
+
/**
|
|
210
|
+
* `admin.purchasing.returns` (purchase-orders spec §8.9, §10.1): returns of goods to suppliers —
|
|
211
|
+
* refused goods from a goods receipt, or goods found faulty later, from stock. Every method needs
|
|
212
|
+
* the Purchasing plugin on the store and purchasing switched on for its legal entity
|
|
213
|
+
* (`PURCHASING_NOT_ENABLED`, 422; `PLUGIN_ACCESS_DENIED`, 403, for an ordinary caller). Reads and
|
|
214
|
+
* `document` need `ReadPurchaseOrder` or `ReceivePurchaseOrder`; `create` needs
|
|
215
|
+
* `CreatePurchaseOrder`, `update`, `resolveLine` and `cancel` `UpdatePurchaseOrder`, and `ship`
|
|
216
|
+
* `ReceivePurchaseOrder`, each on EVERY store of the legal entity (`SHARED_SELLER_NOT_ALLOWED`,
|
|
217
|
+
* 403). `ship` REQUIRES an idempotency key: a retried ship answers the first one, it never takes
|
|
218
|
+
* the goods out of stock twice.
|
|
219
|
+
*/
|
|
220
|
+
export interface PurchasingReturnsModule {
|
|
221
|
+
/** The scope's returns, newest first. */
|
|
222
|
+
list(options?: SupplierReturnListOptions): Promise<Page<SupplierReturn>>;
|
|
223
|
+
/** One return; null when none has that id in the scope. */
|
|
224
|
+
get(id: string, call?: Call): Promise<SupplierReturn | null>;
|
|
225
|
+
/**
|
|
226
|
+
* Raises a draft return (spec §8.9), numbered `RS-…`: each line names the goods receipt line its
|
|
227
|
+
* goods came in on, of a receipt of ONE supplier; refused goods leave from the receipts'
|
|
228
|
+
* location, goods from stock from the location named (else the receipts'). Refusals:
|
|
229
|
+
* `GOODS_RECEIPT_NOT_FOUND` (404), `SUPPLIER_RETURN_EXCEEDS_RETURNABLE` (422; `details` per line
|
|
230
|
+
* with `returnableBaseQuantity`), `SUPPLIER_ARCHIVED` (422), `LOCATION_NOT_IN_CHANNEL`,
|
|
231
|
+
* `LOCATION_NOT_ALLOWED` (403), `LOCATION_NOT_OWNED_BY_ENTITY`, `SUPPLIER_RETURN_INVALID` (400).
|
|
232
|
+
*/
|
|
233
|
+
create(input: CreateSupplierReturnInput, call?: Call): Promise<SupplierReturn>;
|
|
234
|
+
/**
|
|
235
|
+
* Changes a draft (its lines, location, notes and references), or a SHIPPED return's carrier,
|
|
236
|
+
* tracking code and supplier reference. Refusals: `SUPPLIER_RETURN_NOT_FOUND` (404),
|
|
237
|
+
* `SUPPLIER_RETURN_INVALID_TRANSITION` (422), `SUPPLIER_RETURN_EXCEEDS_RETURNABLE` (422),
|
|
238
|
+
* `SUPPLIER_RETURN_INVALID` (400).
|
|
239
|
+
*/
|
|
240
|
+
update(id: string, input: UpdateSupplierReturnInput, call?: Call): Promise<SupplierReturn>;
|
|
241
|
+
/**
|
|
242
|
+
* Ships a draft return (spec §8.9): goods from stock leave the location at their receipt lines'
|
|
243
|
+
* landed cost; refused goods credited or written off are cancelled on their purchase order
|
|
244
|
+
* lines, goods from stock to be replaced are open there again (an order closes or reopens
|
|
245
|
+
* accordingly); the PDF is drawn and, unless `notifySupplier: false`, emailed to the supplier.
|
|
246
|
+
* Refusals, before anything changes: `SUPPLIER_RETURN_INVALID_TRANSITION` (422, not a draft),
|
|
247
|
+
* `SUPPLIER_RETURN_EXCEEDS_RETURNABLE` (422), `STOCK_WOULD_GO_NEGATIVE` (422: move or recount
|
|
248
|
+
* stock first), `FIELD_GROUP_LOCKED` (an app owns a variant's stock), `LOCATION_NOT_ALLOWED`
|
|
249
|
+
* (403), and by email `SUPPLIER_HAS_NO_ORDER_EMAIL`, `SUPPLIER_EMAIL_UNDELIVERABLE`,
|
|
250
|
+
* `PRIVATE_STORAGE_UNCONFIGURED` (422, `details[0]` with `field: 'notifySupplier'`). The key is
|
|
251
|
+
* required.
|
|
252
|
+
*/
|
|
253
|
+
ship(id: string, input: ShipSupplierReturnInput, call: SupplierReturnKeyedCall): Promise<SupplierReturn>;
|
|
254
|
+
/**
|
|
255
|
+
* Records what the supplier did with one line of a shipped return: `credited` (with an
|
|
256
|
+
* informational `creditAmount`), `replaced` or `written_off`; the last line resolved resolves the
|
|
257
|
+
* return. Refusals: `SUPPLIER_RETURN_NOT_FOUND` (404), `SUPPLIER_RETURN_INVALID_TRANSITION`
|
|
258
|
+
* (422, not shipped, or the line resolved already), `SUPPLIER_RETURN_INVALID` (400, a
|
|
259
|
+
* resolution that does not settle the line's outcome).
|
|
260
|
+
*/
|
|
261
|
+
resolveLine(input: ResolveSupplierReturnLineInput, call?: Call): Promise<SupplierReturn>;
|
|
262
|
+
/**
|
|
263
|
+
* Cancels a draft: its lines no longer hold their quantities. A shipped return is never
|
|
264
|
+
* cancelled (`SUPPLIER_RETURN_INVALID_TRANSITION`, 422).
|
|
265
|
+
*/
|
|
266
|
+
cancel(id: string, options?: SupplierReturnCancelOptions): Promise<SupplierReturn>;
|
|
267
|
+
/**
|
|
268
|
+
* A five-minute link to a shipped return's PDF. Refusal: `SUPPLIER_RETURN_DOCUMENT_NOT_FOUND`
|
|
269
|
+
* (404: not shipped, or shipped on a deployment without a private document bucket).
|
|
270
|
+
*/
|
|
271
|
+
document(id: string, call?: Call): Promise<SupplierReturnDocumentUrl>;
|
|
272
|
+
}
|
|
273
|
+
export declare function createPurchasingReturnsModule(transport: Transport): PurchasingReturnsModule;
|