@endora-commerce/contracts 0.108.0 → 0.110.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/actor.d.ts +16 -0
- package/dist/actor.d.ts.map +1 -1
- package/dist/addresses.d.ts +35 -0
- package/dist/addresses.d.ts.map +1 -1
- package/dist/addresses.js +8 -1
- package/dist/addresses.js.map +1 -1
- package/dist/admin-actions.d.ts +12 -3
- package/dist/admin-actions.d.ts.map +1 -1
- package/dist/admin-actions.js +34 -3
- package/dist/admin-actions.js.map +1 -1
- package/dist/admin-contributions.d.ts +94 -10
- package/dist/admin-contributions.d.ts.map +1 -1
- package/dist/admin-contributions.js +65 -0
- package/dist/admin-contributions.js.map +1 -1
- package/dist/admin-notifications.d.ts +17 -1
- package/dist/admin-notifications.d.ts.map +1 -1
- package/dist/admin-preferences.d.ts +108 -0
- package/dist/admin-preferences.d.ts.map +1 -0
- package/dist/admin-preferences.js +133 -0
- package/dist/admin-preferences.js.map +1 -0
- package/dist/admin-roles.d.ts +8 -2
- package/dist/admin-roles.d.ts.map +1 -1
- package/dist/admin-roles.js.map +1 -1
- package/dist/admin-users.d.ts +9 -0
- package/dist/admin-users.d.ts.map +1 -1
- package/dist/admin.d.ts +92 -5
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +86 -3
- package/dist/admin.js.map +1 -1
- package/dist/assets-library.d.ts +123 -3
- package/dist/assets-library.d.ts.map +1 -1
- package/dist/assets-library.js +11 -3
- package/dist/assets-library.js.map +1 -1
- package/dist/audit-logs.d.ts +12 -0
- package/dist/audit-logs.d.ts.map +1 -1
- package/dist/audit-logs.js +12 -0
- package/dist/audit-logs.js.map +1 -1
- package/dist/blog.d.ts +431 -14
- package/dist/blog.d.ts.map +1 -1
- package/dist/blog.js +251 -7
- package/dist/blog.js.map +1 -1
- package/dist/carts.d.ts +507 -92
- package/dist/carts.d.ts.map +1 -1
- package/dist/carts.js +197 -21
- package/dist/carts.js.map +1 -1
- package/dist/catalog.d.ts +515 -144
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +356 -68
- package/dist/catalog.js.map +1 -1
- package/dist/cms-brand.d.ts +2233 -0
- package/dist/cms-brand.d.ts.map +1 -0
- package/dist/cms-brand.js +311 -0
- package/dist/cms-brand.js.map +1 -0
- package/dist/cms-contact-form.d.ts +55 -0
- package/dist/cms-contact-form.d.ts.map +1 -0
- package/dist/cms-contact-form.js +100 -0
- package/dist/cms-contact-form.js.map +1 -0
- package/dist/cms.d.ts +576 -17
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +251 -0
- package/dist/cms.js.map +1 -1
- package/dist/common.d.ts +23 -6
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +25 -2
- package/dist/common.js.map +1 -1
- package/dist/comparisons.d.ts +28 -21
- package/dist/comparisons.d.ts.map +1 -1
- package/dist/comparisons.js +2 -1
- package/dist/comparisons.js.map +1 -1
- package/dist/credit-limits.d.ts +1 -0
- package/dist/credit-limits.d.ts.map +1 -1
- package/dist/credit-limits.js +14 -0
- package/dist/credit-limits.js.map +1 -1
- package/dist/crm-rich-text.d.ts +10 -61
- package/dist/crm-rich-text.d.ts.map +1 -1
- package/dist/crm-rich-text.js +10 -300
- package/dist/crm-rich-text.js.map +1 -1
- package/dist/crm.d.ts +173 -115
- package/dist/crm.d.ts.map +1 -1
- package/dist/crm.js +35 -88
- package/dist/crm.js.map +1 -1
- package/dist/custom-fields.d.ts +54 -22
- package/dist/custom-fields.d.ts.map +1 -1
- package/dist/custom-fields.js +21 -1
- package/dist/custom-fields.js.map +1 -1
- package/dist/customer-accounts.d.ts +216 -22
- package/dist/customer-accounts.d.ts.map +1 -1
- package/dist/customer-accounts.js +70 -0
- package/dist/customer-accounts.js.map +1 -1
- package/dist/customers.d.ts +40 -73
- package/dist/customers.d.ts.map +1 -1
- package/dist/customers.js +45 -10
- package/dist/customers.js.map +1 -1
- package/dist/document-templates.d.ts +35 -23
- package/dist/document-templates.d.ts.map +1 -1
- package/dist/document-values.d.ts +8 -0
- package/dist/document-values.d.ts.map +1 -1
- package/dist/document-values.js +24 -6
- package/dist/document-values.js.map +1 -1
- package/dist/email.d.ts +5 -0
- package/dist/email.d.ts.map +1 -1
- package/dist/errors.d.ts +224 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +269 -1
- package/dist/errors.js.map +1 -1
- package/dist/forms-logic.d.ts +79 -0
- package/dist/forms-logic.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.d.ts +52 -0
- package/dist/forms-logic.fixtures.d.ts.map +1 -0
- package/dist/forms-logic.fixtures.js +610 -0
- package/dist/forms-logic.fixtures.js.map +1 -0
- package/dist/forms-logic.js +699 -0
- package/dist/forms-logic.js.map +1 -0
- package/dist/forms.d.ts +9833 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +827 -0
- package/dist/forms.js.map +1 -0
- package/dist/import-export.d.ts +180 -0
- package/dist/import-export.d.ts.map +1 -1
- package/dist/import-export.js +60 -0
- package/dist/import-export.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +6 -6
- package/dist/invoice-ledger.d.ts +7 -7
- package/dist/invoices.d.ts +6 -2
- package/dist/invoices.d.ts.map +1 -1
- package/dist/invoices.js +7 -0
- package/dist/invoices.js.map +1 -1
- package/dist/megamenu.d.ts +674 -0
- package/dist/megamenu.d.ts.map +1 -1
- package/dist/megamenu.js +96 -3
- package/dist/megamenu.js.map +1 -1
- package/dist/mfa.d.ts +125 -4
- package/dist/mfa.d.ts.map +1 -1
- package/dist/mfa.js +54 -2
- package/dist/mfa.js.map +1 -1
- package/dist/modules.d.ts +44 -5
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +73 -0
- package/dist/modules.js.map +1 -1
- package/dist/money-decimal.d.ts +54 -0
- package/dist/money-decimal.d.ts.map +1 -1
- package/dist/money-decimal.js +95 -0
- package/dist/money-decimal.js.map +1 -1
- package/dist/newsletter.d.ts +7 -7
- package/dist/orders.d.ts +128 -10
- package/dist/orders.d.ts.map +1 -1
- package/dist/orders.js +74 -4
- package/dist/orders.js.map +1 -1
- package/dist/organization-registry-lookup.d.ts +362 -0
- package/dist/organization-registry-lookup.d.ts.map +1 -0
- package/dist/organization-registry-lookup.js +196 -0
- package/dist/organization-registry-lookup.js.map +1 -0
- package/dist/organization-roles.d.ts +340 -0
- package/dist/organization-roles.d.ts.map +1 -0
- package/dist/organization-roles.js +211 -0
- package/dist/organization-roles.js.map +1 -0
- package/dist/organizations.d.ts +123 -89
- package/dist/organizations.d.ts.map +1 -1
- package/dist/organizations.js +68 -24
- package/dist/organizations.js.map +1 -1
- package/dist/page-builder-props.d.ts +1401 -0
- package/dist/page-builder-props.d.ts.map +1 -0
- package/dist/page-builder-props.js +266 -0
- package/dist/page-builder-props.js.map +1 -0
- package/dist/page-builder-values.d.ts +95 -0
- package/dist/page-builder-values.d.ts.map +1 -0
- package/dist/page-builder-values.js +164 -0
- package/dist/page-builder-values.js.map +1 -0
- package/dist/pim-connector.d.ts +6 -2
- package/dist/pim-connector.d.ts.map +1 -1
- package/dist/pim-connector.js +6 -2
- package/dist/pim-connector.js.map +1 -1
- package/dist/pim-field-path.d.ts +5 -1
- package/dist/pim-field-path.d.ts.map +1 -1
- package/dist/pim-field-path.js +37 -81
- package/dist/pim-field-path.js.map +1 -1
- package/dist/pim-locale-mapping.d.ts +131 -0
- package/dist/pim-locale-mapping.d.ts.map +1 -0
- package/dist/pim-locale-mapping.js +193 -0
- package/dist/pim-locale-mapping.js.map +1 -0
- package/dist/platform-language.d.ts +9 -0
- package/dist/platform-language.d.ts.map +1 -1
- package/dist/platform-language.js +14 -0
- package/dist/platform-language.js.map +1 -1
- package/dist/price-books.d.ts +47 -43
- package/dist/price-books.d.ts.map +1 -1
- package/dist/price-books.js +6 -2
- package/dist/price-books.js.map +1 -1
- package/dist/price-lists.d.ts +48 -14
- package/dist/price-lists.d.ts.map +1 -1
- package/dist/price-lists.js +24 -1
- package/dist/price-lists.js.map +1 -1
- package/dist/product-feeds.d.ts +144 -84
- package/dist/product-feeds.d.ts.map +1 -1
- package/dist/product-feeds.js +23 -0
- package/dist/product-feeds.js.map +1 -1
- package/dist/product-scope-model.d.ts +161 -0
- package/dist/product-scope-model.d.ts.map +1 -0
- package/dist/product-scope-model.js +161 -0
- package/dist/product-scope-model.js.map +1 -0
- package/dist/product-scope-overrides.d.ts +0 -103
- package/dist/product-scope-overrides.d.ts.map +1 -1
- package/dist/product-scope-overrides.js +0 -54
- package/dist/product-scope-overrides.js.map +1 -1
- package/dist/product-scoped-values.d.ts +2610 -0
- package/dist/product-scoped-values.d.ts.map +1 -0
- package/dist/product-scoped-values.js +425 -0
- package/dist/product-scoped-values.js.map +1 -0
- package/dist/product-scopes.d.ts +746 -0
- package/dist/product-scopes.d.ts.map +1 -0
- package/dist/product-scopes.js +436 -0
- package/dist/product-scopes.js.map +1 -0
- package/dist/product-summary-text.d.ts +23 -0
- package/dist/product-summary-text.d.ts.map +1 -0
- package/dist/product-summary-text.js +64 -0
- package/dist/product-summary-text.js.map +1 -0
- package/dist/product-tax-rates.d.ts +38 -0
- package/dist/product-tax-rates.d.ts.map +1 -0
- package/dist/product-tax-rates.js +45 -0
- package/dist/product-tax-rates.js.map +1 -0
- package/dist/product-url-keys.d.ts +210 -0
- package/dist/product-url-keys.d.ts.map +1 -0
- package/dist/product-url-keys.js +200 -0
- package/dist/product-url-keys.js.map +1 -0
- package/dist/product-value-resolver.d.ts +37 -60
- package/dist/product-value-resolver.d.ts.map +1 -1
- package/dist/product-value-resolver.js +36 -96
- package/dist/product-value-resolver.js.map +1 -1
- package/dist/projects.d.ts +2370 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +843 -0
- package/dist/projects.js.map +1 -0
- package/dist/promotions.d.ts +10 -10
- package/dist/prompt-actions.d.ts +19 -1
- package/dist/prompt-actions.d.ts.map +1 -1
- package/dist/prompt-actions.js +31 -2
- package/dist/prompt-actions.js.map +1 -1
- package/dist/pwa.d.ts +2 -2
- package/dist/quick-order.d.ts +150 -7
- package/dist/quick-order.d.ts.map +1 -1
- package/dist/quick-order.js +76 -2
- package/dist/quick-order.js.map +1 -1
- package/dist/quote-requests.d.ts +99 -13
- package/dist/quote-requests.d.ts.map +1 -1
- package/dist/quote-requests.js +66 -1
- package/dist/quote-requests.js.map +1 -1
- package/dist/record-references.d.ts +252 -0
- package/dist/record-references.d.ts.map +1 -0
- package/dist/record-references.js +178 -0
- package/dist/record-references.js.map +1 -0
- package/dist/record-rich-text.d.ts +66 -0
- package/dist/record-rich-text.d.ts.map +1 -0
- package/dist/record-rich-text.js +304 -0
- package/dist/record-rich-text.js.map +1 -0
- package/dist/returns.d.ts +234 -52
- package/dist/returns.d.ts.map +1 -1
- package/dist/returns.js +139 -26
- package/dist/returns.js.map +1 -1
- package/dist/sales-channels.d.ts +51 -7
- package/dist/sales-channels.d.ts.map +1 -1
- package/dist/sales-channels.js +38 -4
- package/dist/sales-channels.js.map +1 -1
- package/dist/saved-list-views.d.ts +56 -0
- package/dist/saved-list-views.d.ts.map +1 -1
- package/dist/saved-list-views.js +27 -1
- package/dist/saved-list-views.js.map +1 -1
- package/dist/scoped-write-encoding.d.ts +100 -0
- package/dist/scoped-write-encoding.d.ts.map +1 -0
- package/dist/scoped-write-encoding.js +135 -0
- package/dist/scoped-write-encoding.js.map +1 -0
- package/dist/search.d.ts +25 -15
- package/dist/search.d.ts.map +1 -1
- package/dist/seo.d.ts +127 -15
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +38 -4
- package/dist/seo.js.map +1 -1
- package/dist/settings.d.ts +161 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +73 -3
- package/dist/settings.js.map +1 -1
- package/dist/shopping-lists.d.ts +24 -3
- package/dist/shopping-lists.d.ts.map +1 -1
- package/dist/shopping-lists.js +20 -0
- package/dist/shopping-lists.js.map +1 -1
- package/dist/storefront-cache-tags.d.ts +41 -0
- package/dist/storefront-cache-tags.d.ts.map +1 -1
- package/dist/storefront-cache-tags.js +36 -0
- package/dist/storefront-cache-tags.js.map +1 -1
- package/dist/storefront-language-path.d.ts +77 -0
- package/dist/storefront-language-path.d.ts.map +1 -0
- package/dist/storefront-language-path.js +123 -0
- package/dist/storefront-language-path.js.map +1 -0
- package/dist/storefront-value-overrides.d.ts +18 -56
- package/dist/storefront-value-overrides.d.ts.map +1 -1
- package/dist/storefront-value-overrides.js +11 -86
- package/dist/storefront-value-overrides.js.map +1 -1
- package/dist/tasks.d.ts +2842 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +901 -0
- package/dist/tasks.js.map +1 -0
- package/dist/transactional-emails.d.ts +14 -11
- package/dist/transactional-emails.d.ts.map +1 -1
- package/dist/transactional-emails.js +13 -0
- package/dist/transactional-emails.js.map +1 -1
- package/package.json +3 -3
package/dist/returns.d.ts
CHANGED
|
@@ -20,6 +20,49 @@ export declare const resolutionTypeSchema: z.ZodEnum<{
|
|
|
20
20
|
repair: "repair";
|
|
21
21
|
}>;
|
|
22
22
|
export type ResolutionType = z.infer<typeof resolutionTypeSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* The resolutions that settle a consumer withdrawal otherwise than by a refund
|
|
25
|
+
* (issue #905, design D1). A consumer who withdraws is reimbursed by the same
|
|
26
|
+
* means of payment unless they expressly agree otherwise (Directive 2011/83
|
|
27
|
+
* art. 13(1)), so each needs the consumer's consent on record first.
|
|
28
|
+
*/
|
|
29
|
+
export declare const alternativeResolutionSchema: z.ZodEnum<{
|
|
30
|
+
credit: "credit";
|
|
31
|
+
replacement: "replacement";
|
|
32
|
+
repair: "repair";
|
|
33
|
+
}>;
|
|
34
|
+
export type AlternativeResolution = z.infer<typeof alternativeResolutionSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Who put the consent on record. `operator_recorded` is the only source today:
|
|
37
|
+
* the consumer agrees by e-mail or telephone and an operator records it with
|
|
38
|
+
* the evidence. `consumer_storefront` is reserved for a consumer's own click on
|
|
39
|
+
* the storefront, should that be required later.
|
|
40
|
+
*/
|
|
41
|
+
export declare const alternativeConsentSourceSchema: z.ZodEnum<{
|
|
42
|
+
operator_recorded: "operator_recorded";
|
|
43
|
+
consumer_storefront: "consumer_storefront";
|
|
44
|
+
}>;
|
|
45
|
+
export type AlternativeConsentSource = z.infer<typeof alternativeConsentSourceSchema>;
|
|
46
|
+
/**
|
|
47
|
+
* The consumer's consent to settle a withdrawal as `resolution` (issue #905,
|
|
48
|
+
* design D1). `note` (the evidence) and `byAdminUserId` are the operator's:
|
|
49
|
+
* the buyer's view of a case leaves both out.
|
|
50
|
+
*/
|
|
51
|
+
export declare const alternativeResolutionConsentSchema: z.ZodObject<{
|
|
52
|
+
resolution: z.ZodEnum<{
|
|
53
|
+
credit: "credit";
|
|
54
|
+
replacement: "replacement";
|
|
55
|
+
repair: "repair";
|
|
56
|
+
}>;
|
|
57
|
+
at: z.ZodString;
|
|
58
|
+
note: z.ZodOptional<z.ZodString>;
|
|
59
|
+
byAdminUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
source: z.ZodEnum<{
|
|
61
|
+
operator_recorded: "operator_recorded";
|
|
62
|
+
consumer_storefront: "consumer_storefront";
|
|
63
|
+
}>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export type AlternativeResolutionConsent = z.infer<typeof alternativeResolutionConsentSchema>;
|
|
23
66
|
/** State of a recorded refund's money movement. */
|
|
24
67
|
export declare const settlementStateSchema: z.ZodEnum<{
|
|
25
68
|
failed: "failed";
|
|
@@ -141,6 +184,7 @@ export declare const returnCaseSummarySchema: z.ZodObject<{
|
|
|
141
184
|
totalRefundAmount: z.ZodNumber;
|
|
142
185
|
currency: z.ZodString;
|
|
143
186
|
submittedAt: z.ZodString;
|
|
187
|
+
customerAccountId: z.ZodString;
|
|
144
188
|
}, z.core.$strip>;
|
|
145
189
|
export type ReturnCaseSummary = z.infer<typeof returnCaseSummarySchema>;
|
|
146
190
|
/**
|
|
@@ -244,6 +288,25 @@ export declare const returnCaseDetailSchema: z.ZodObject<{
|
|
|
244
288
|
}>;
|
|
245
289
|
invoiceId: z.ZodNullable<z.ZodString>;
|
|
246
290
|
}, z.core.$strip>>;
|
|
291
|
+
chargeRefunds: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
delivery: z.ZodNumber;
|
|
293
|
+
surcharge: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>>;
|
|
295
|
+
consumerWithdrawal: z.ZodNullable<z.ZodBoolean>;
|
|
296
|
+
alternativeResolutionConsent: z.ZodNullable<z.ZodObject<{
|
|
297
|
+
resolution: z.ZodEnum<{
|
|
298
|
+
credit: "credit";
|
|
299
|
+
replacement: "replacement";
|
|
300
|
+
repair: "repair";
|
|
301
|
+
}>;
|
|
302
|
+
at: z.ZodString;
|
|
303
|
+
note: z.ZodOptional<z.ZodString>;
|
|
304
|
+
byAdminUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
305
|
+
source: z.ZodEnum<{
|
|
306
|
+
operator_recorded: "operator_recorded";
|
|
307
|
+
consumer_storefront: "consumer_storefront";
|
|
308
|
+
}>;
|
|
309
|
+
}, z.core.$strip>>;
|
|
247
310
|
}, z.core.$strip>;
|
|
248
311
|
export type ReturnCaseDetail = z.infer<typeof returnCaseDetailSchema>;
|
|
249
312
|
export declare const returnableLineSchema: z.ZodObject<{
|
|
@@ -339,10 +402,17 @@ export declare const adminReturnRowSchema: z.ZodObject<{
|
|
|
339
402
|
totalRefundAmount: z.ZodNumber;
|
|
340
403
|
currency: z.ZodString;
|
|
341
404
|
submittedAt: z.ZodString;
|
|
405
|
+
customerAccountId: z.ZodString;
|
|
342
406
|
customerName: z.ZodNullable<z.ZodString>;
|
|
343
407
|
organizationName: z.ZodNullable<z.ZodString>;
|
|
344
408
|
}, z.core.$strip>;
|
|
345
409
|
export type AdminReturnRow = z.infer<typeof adminReturnRowSchema>;
|
|
410
|
+
/** One order charge a settlement may refund (issue #876): the most that may be approved, and the amount prefilled. */
|
|
411
|
+
export declare const settlementChargeSchema: z.ZodObject<{
|
|
412
|
+
cap: z.ZodNumber;
|
|
413
|
+
approved: z.ZodNumber;
|
|
414
|
+
}, z.core.$strip>;
|
|
415
|
+
export type SettlementCharge = z.infer<typeof settlementChargeSchema>;
|
|
346
416
|
export declare const settlementPrefillSchema: z.ZodObject<{
|
|
347
417
|
currency: z.ZodString;
|
|
348
418
|
resolutionOptions: z.ZodArray<z.ZodEnum<{
|
|
@@ -351,6 +421,19 @@ export declare const settlementPrefillSchema: z.ZodObject<{
|
|
|
351
421
|
replacement: "replacement";
|
|
352
422
|
repair: "repair";
|
|
353
423
|
}>>;
|
|
424
|
+
defaultResolution: z.ZodEnum<{
|
|
425
|
+
refund: "refund";
|
|
426
|
+
credit: "credit";
|
|
427
|
+
replacement: "replacement";
|
|
428
|
+
repair: "repair";
|
|
429
|
+
}>;
|
|
430
|
+
consentRequiredFor: z.ZodArray<z.ZodEnum<{
|
|
431
|
+
refund: "refund";
|
|
432
|
+
credit: "credit";
|
|
433
|
+
replacement: "replacement";
|
|
434
|
+
repair: "repair";
|
|
435
|
+
}>>;
|
|
436
|
+
defaultRefundPaymentMethodId: z.ZodNullable<z.ZodString>;
|
|
354
437
|
items: z.ZodArray<z.ZodObject<{
|
|
355
438
|
returnCaseItemId: z.ZodString;
|
|
356
439
|
productName: z.ZodString;
|
|
@@ -358,6 +441,16 @@ export declare const settlementPrefillSchema: z.ZodObject<{
|
|
|
358
441
|
defaultRefundAmount: z.ZodNumber;
|
|
359
442
|
approvedRefundAmount: z.ZodNumber;
|
|
360
443
|
}, z.core.$strip>>;
|
|
444
|
+
charges: z.ZodOptional<z.ZodObject<{
|
|
445
|
+
delivery: z.ZodOptional<z.ZodObject<{
|
|
446
|
+
cap: z.ZodNumber;
|
|
447
|
+
approved: z.ZodNumber;
|
|
448
|
+
}, z.core.$strip>>;
|
|
449
|
+
surcharge: z.ZodOptional<z.ZodObject<{
|
|
450
|
+
cap: z.ZodNumber;
|
|
451
|
+
approved: z.ZodNumber;
|
|
452
|
+
}, z.core.$strip>>;
|
|
453
|
+
}, z.core.$strip>>;
|
|
361
454
|
}, z.core.$strip>;
|
|
362
455
|
export type SettlementPrefill = z.infer<typeof settlementPrefillSchema>;
|
|
363
456
|
export declare const settlementRequestSchema: z.ZodObject<{
|
|
@@ -373,8 +466,25 @@ export declare const settlementRequestSchema: z.ZodObject<{
|
|
|
373
466
|
}, z.core.$strip>>>;
|
|
374
467
|
refundPaymentMethodId: z.ZodOptional<z.ZodString>;
|
|
375
468
|
createCorrectiveInvoice: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
+
deliveryRefundAmount: z.ZodOptional<z.ZodNumber>;
|
|
470
|
+
surchargeRefundAmount: z.ZodOptional<z.ZodNumber>;
|
|
376
471
|
}, z.core.$strip>;
|
|
377
472
|
export type SettlementRequest = z.infer<typeof settlementRequestSchema>;
|
|
473
|
+
/**
|
|
474
|
+
* `POST /api/v1/admin/returns/:id/alternative-consent` (issue #905, design D1):
|
|
475
|
+
* the operator records that the consumer agreed to `resolution`, when, and the
|
|
476
|
+
* evidence. The moment may not be in the future, nor before the case was filed.
|
|
477
|
+
*/
|
|
478
|
+
export declare const recordAlternativeConsentRequestSchema: z.ZodObject<{
|
|
479
|
+
resolution: z.ZodEnum<{
|
|
480
|
+
credit: "credit";
|
|
481
|
+
replacement: "replacement";
|
|
482
|
+
repair: "repair";
|
|
483
|
+
}>;
|
|
484
|
+
consentGivenAt: z.ZodString;
|
|
485
|
+
note: z.ZodString;
|
|
486
|
+
}, z.core.$strip>;
|
|
487
|
+
export type RecordAlternativeConsentRequest = z.infer<typeof recordAlternativeConsentRequestSchema>;
|
|
378
488
|
/**
|
|
379
489
|
* What became of the corrective invoice a settlement asked for (#135).
|
|
380
490
|
*
|
|
@@ -478,17 +588,17 @@ export declare const createReturnShipmentRequestSchema: z.ZodObject<{
|
|
|
478
588
|
externalReference: z.ZodOptional<z.ZodString>;
|
|
479
589
|
}, z.core.$strip>;
|
|
480
590
|
export declare const reasonAppliesToSchema: z.ZodEnum<{
|
|
591
|
+
both: "both";
|
|
481
592
|
return: "return";
|
|
482
593
|
complaint: "complaint";
|
|
483
|
-
both: "both";
|
|
484
594
|
}>;
|
|
485
595
|
export declare const returnReasonSchema: z.ZodObject<{
|
|
486
596
|
id: z.ZodString;
|
|
487
597
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
488
598
|
appliesTo: z.ZodEnum<{
|
|
599
|
+
both: "both";
|
|
489
600
|
return: "return";
|
|
490
601
|
complaint: "complaint";
|
|
491
|
-
both: "both";
|
|
492
602
|
}>;
|
|
493
603
|
isActive: z.ZodBoolean;
|
|
494
604
|
weight: z.ZodNumber;
|
|
@@ -497,9 +607,9 @@ export type ReturnReasonDto = z.infer<typeof returnReasonSchema>;
|
|
|
497
607
|
export declare const returnReasonCreateSchema: z.ZodObject<{
|
|
498
608
|
label: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
499
609
|
appliesTo: z.ZodEnum<{
|
|
610
|
+
both: "both";
|
|
500
611
|
return: "return";
|
|
501
612
|
complaint: "complaint";
|
|
502
|
-
both: "both";
|
|
503
613
|
}>;
|
|
504
614
|
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
505
615
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -507,9 +617,9 @@ export declare const returnReasonCreateSchema: z.ZodObject<{
|
|
|
507
617
|
export declare const returnReasonUpdateSchema: z.ZodObject<{
|
|
508
618
|
label: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
509
619
|
appliesTo: z.ZodOptional<z.ZodEnum<{
|
|
620
|
+
both: "both";
|
|
510
621
|
return: "return";
|
|
511
622
|
complaint: "complaint";
|
|
512
|
-
both: "both";
|
|
513
623
|
}>>;
|
|
514
624
|
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
515
625
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -552,6 +662,7 @@ export declare const adminReturnsListResponseSchema: z.ZodObject<{
|
|
|
552
662
|
totalRefundAmount: z.ZodNumber;
|
|
553
663
|
currency: z.ZodString;
|
|
554
664
|
submittedAt: z.ZodString;
|
|
665
|
+
customerAccountId: z.ZodString;
|
|
555
666
|
customerName: z.ZodNullable<z.ZodString>;
|
|
556
667
|
organizationName: z.ZodNullable<z.ZodString>;
|
|
557
668
|
}, z.core.$strip>>;
|
|
@@ -572,54 +683,6 @@ export declare const bulkTransitionResultSchema: z.ZodObject<{
|
|
|
572
683
|
}, z.core.$strip>>;
|
|
573
684
|
}, z.core.$strip>;
|
|
574
685
|
export type BulkTransitionResult = z.infer<typeof bulkTransitionResultSchema>;
|
|
575
|
-
export declare const returnSavedViewSortSchema: z.ZodObject<{
|
|
576
|
-
field: z.ZodString;
|
|
577
|
-
dir: z.ZodEnum<{
|
|
578
|
-
asc: "asc";
|
|
579
|
-
desc: "desc";
|
|
580
|
-
}>;
|
|
581
|
-
}, z.core.$strip>;
|
|
582
|
-
export declare const returnSavedViewSchema: z.ZodObject<{
|
|
583
|
-
id: z.ZodString;
|
|
584
|
-
name: z.ZodString;
|
|
585
|
-
shared: z.ZodBoolean;
|
|
586
|
-
filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
587
|
-
sort: z.ZodObject<{
|
|
588
|
-
field: z.ZodString;
|
|
589
|
-
dir: z.ZodEnum<{
|
|
590
|
-
asc: "asc";
|
|
591
|
-
desc: "desc";
|
|
592
|
-
}>;
|
|
593
|
-
}, z.core.$strip>;
|
|
594
|
-
visibleColumns: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
595
|
-
}, z.core.$strip>;
|
|
596
|
-
export type ReturnSavedViewDto = z.infer<typeof returnSavedViewSchema>;
|
|
597
|
-
export declare const returnSavedViewCreateSchema: z.ZodObject<{
|
|
598
|
-
name: z.ZodString;
|
|
599
|
-
shared: z.ZodOptional<z.ZodBoolean>;
|
|
600
|
-
filters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
601
|
-
sort: z.ZodObject<{
|
|
602
|
-
field: z.ZodString;
|
|
603
|
-
dir: z.ZodEnum<{
|
|
604
|
-
asc: "asc";
|
|
605
|
-
desc: "desc";
|
|
606
|
-
}>;
|
|
607
|
-
}, z.core.$strip>;
|
|
608
|
-
visibleColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
609
|
-
}, z.core.$strip>;
|
|
610
|
-
export declare const returnSavedViewUpdateSchema: z.ZodObject<{
|
|
611
|
-
name: z.ZodOptional<z.ZodString>;
|
|
612
|
-
shared: z.ZodOptional<z.ZodBoolean>;
|
|
613
|
-
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
614
|
-
sort: z.ZodOptional<z.ZodObject<{
|
|
615
|
-
field: z.ZodString;
|
|
616
|
-
dir: z.ZodEnum<{
|
|
617
|
-
asc: "asc";
|
|
618
|
-
desc: "desc";
|
|
619
|
-
}>;
|
|
620
|
-
}, z.core.$strip>>;
|
|
621
|
-
visibleColumns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
622
|
-
}, z.core.$strip>;
|
|
623
686
|
export interface PaymentRefundInput {
|
|
624
687
|
orderId: string;
|
|
625
688
|
amount: number;
|
|
@@ -649,6 +712,79 @@ export interface PaymentRefundResult {
|
|
|
649
712
|
export interface PaymentRefundPort {
|
|
650
713
|
refund(input: PaymentRefundInput): Promise<PaymentRefundResult>;
|
|
651
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* One money-moving resolution a settled return case recorded for an order
|
|
717
|
+
* (issue #428): a refund (`resolutionType: 'refund'`) or a credit-limit top-up
|
|
718
|
+
* (`'credit'`), its two-place amount, and whether it was issued.
|
|
719
|
+
*/
|
|
720
|
+
export interface OrderReturnRefund {
|
|
721
|
+
resolutionType: 'refund' | 'credit';
|
|
722
|
+
/** A two-place decimal string, as stored. */
|
|
723
|
+
amount: string;
|
|
724
|
+
settlementState: 'issued' | 'pending_manual' | 'failed';
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* How much of one order line came back (issue #435): the quantity, summed over
|
|
728
|
+
* the order's settled `return`-kind cases resolved with a refund or a credit —
|
|
729
|
+
* whether or not the money has been paid out. A replacement, a repair and a
|
|
730
|
+
* complaint are not counted: the goods were not given up for money.
|
|
731
|
+
*/
|
|
732
|
+
export interface OrderReturnedQuantity {
|
|
733
|
+
orderItemId: string;
|
|
734
|
+
/** A whole number of units, greater than 0. */
|
|
735
|
+
quantity: number;
|
|
736
|
+
/**
|
|
737
|
+
* The part of the order-level discount those cases carried back for the
|
|
738
|
+
* line, as recorded at settlement — each case line's default discount in
|
|
739
|
+
* proportion to its approved refund — summed, as a two-place decimal string
|
|
740
|
+
* (`'0.00'` without a discount). An invoice issued afterwards takes it off
|
|
741
|
+
* its discount line, so the line carries only the kept goods' share.
|
|
742
|
+
*/
|
|
743
|
+
discount: string;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* The key of the transaction-scoped advisory lock (`pg_advisory_xact_lock(hashtext(key))`)
|
|
747
|
+
* that serialises the writes about one order's returns. Owner: `returns`.
|
|
748
|
+
*
|
|
749
|
+
* `returns` takes it to create a case and to settle one; `invoices` takes it to
|
|
750
|
+
* issue an invoice (review of PR #865, F3), so an invoice is never issued from
|
|
751
|
+
* a case a settlement has moved money for but not yet recorded as resolved —
|
|
752
|
+
* it waits, and then lists only the kept lines.
|
|
753
|
+
*/
|
|
754
|
+
export declare function returnCaseOrderLockKey(orderId: string): string;
|
|
755
|
+
/**
|
|
756
|
+
* Container name: `returnRefundReadPort`. Owner: `returns`.
|
|
757
|
+
*
|
|
758
|
+
* What the order's settled return cases refunded, so a reader that states what
|
|
759
|
+
* was paid for an order — the invoice — can count a refund that never passed
|
|
760
|
+
* through `payments`: a manual bank transfer for an order paid offline, or a
|
|
761
|
+
* credit-limit top-up. A gateway order's refunds also appear here, and the
|
|
762
|
+
* reader is the one that knows `payments` reports those (issue #428).
|
|
763
|
+
*
|
|
764
|
+
* **Owner off:** the seam fails closed — resolving this port throws
|
|
765
|
+
* `ModuleDisabledError`. A reader that may degrade decides presence first.
|
|
766
|
+
*/
|
|
767
|
+
export interface ReturnRefundReadPort {
|
|
768
|
+
listForOrder(orderId: string): Promise<OrderReturnRefund[]>;
|
|
769
|
+
/**
|
|
770
|
+
* The quantity of each order line that came back, one entry per line with
|
|
771
|
+
* any (issue #435), so an invoice issued after a return — when there is no
|
|
772
|
+
* invoice to correct yet — lists only what the buyer kept.
|
|
773
|
+
*/
|
|
774
|
+
listReturnedQuantities(orderId: string): Promise<OrderReturnedQuantity[]>;
|
|
775
|
+
/**
|
|
776
|
+
* What the order's settled `return` cases refunded of its delivery cost and
|
|
777
|
+
* of its payment surcharge (issue #876), over the same cases as
|
|
778
|
+
* {@link listReturnedQuantities}, so an invoice issued afterwards charges
|
|
779
|
+
* only what is left of each.
|
|
780
|
+
*/
|
|
781
|
+
listRefundedCharges(orderId: string): Promise<OrderRefundedCharges>;
|
|
782
|
+
}
|
|
783
|
+
/** What settled returns refunded of an order's charges (issue #876): two-place decimal strings, `0.00` for none. */
|
|
784
|
+
export interface OrderRefundedCharges {
|
|
785
|
+
delivery: string;
|
|
786
|
+
surcharge: string;
|
|
787
|
+
}
|
|
652
788
|
/**
|
|
653
789
|
* A "credit toward future orders" resolution credits the customer's
|
|
654
790
|
* organisation credit limit, which `credit_limits` already grants and the
|
|
@@ -711,6 +847,12 @@ export interface OrderReturnContext {
|
|
|
711
847
|
currency: string;
|
|
712
848
|
/** When the order entered its fulfilment-completing status; null if it has not. */
|
|
713
849
|
completingStatusEnteredAt: Date | null;
|
|
850
|
+
/**
|
|
851
|
+
* The payment method the order was paid with (issue #905): a consumer's
|
|
852
|
+
* withdrawal is refunded by the same means of payment unless they agree
|
|
853
|
+
* otherwise, so the settlement proposes it.
|
|
854
|
+
*/
|
|
855
|
+
paymentMethodId: string | null;
|
|
714
856
|
/**
|
|
715
857
|
* The VAT method the order was placed under (issue #417): `per_rate` — VAT
|
|
716
858
|
* per rate on the sum of the nets — from 0.108.0; `null` before, when the
|
|
@@ -726,6 +868,13 @@ export interface OrderReturnContext {
|
|
|
726
868
|
productsPaidTotal: string;
|
|
727
869
|
/** The order-level discount, as stored (two places) — the part of it a return carries is credited back as a discount. */
|
|
728
870
|
discountTotal: string;
|
|
871
|
+
/**
|
|
872
|
+
* Issue #876 — the order's delivery cost, as stored (two places): a
|
|
873
|
+
* consumer's withdrawal from the whole sale refunds it.
|
|
874
|
+
*/
|
|
875
|
+
deliveryTotal: string;
|
|
876
|
+
/** Issue #876 — the payment surcharge captured at placement, as stored (two places; `0.00` without one). */
|
|
877
|
+
paymentSurcharge: string;
|
|
729
878
|
lines: OrderReturnContextLine[];
|
|
730
879
|
}
|
|
731
880
|
/**
|
|
@@ -744,6 +893,14 @@ export interface OrderReturnContext {
|
|
|
744
893
|
export interface OrderReturnContextPort {
|
|
745
894
|
getReturnContext(orderId: string): Promise<OrderReturnContext | null>;
|
|
746
895
|
}
|
|
896
|
+
/**
|
|
897
|
+
* What a corrective-invoice line documents (issue #885). `returned_goods`: the
|
|
898
|
+
* units came back and are credited. `price_reduction`: a complaint settled with
|
|
899
|
+
* money (art. 106j ust. 1 pkt 2 of the Polish VAT Act), so the buyer keeps the
|
|
900
|
+
* goods and only their price is reduced.
|
|
901
|
+
*/
|
|
902
|
+
export declare const CORRECTION_LINE_BASES: readonly ["returned_goods", "price_reduction"];
|
|
903
|
+
export type CorrectionLineBasis = (typeof CORRECTION_LINE_BASES)[number];
|
|
747
904
|
export interface CorrectiveInvoiceLine {
|
|
748
905
|
/**
|
|
749
906
|
* The order item this line credits. It is the link back to the line of the
|
|
@@ -763,6 +920,15 @@ export interface CorrectiveInvoiceLine {
|
|
|
763
920
|
* a 0 % line; it still totals `amount`. Absent: no discount.
|
|
764
921
|
*/
|
|
765
922
|
discount?: number;
|
|
923
|
+
/**
|
|
924
|
+
* What the line documents (issue #885). `returned_goods` (the default when
|
|
925
|
+
* absent): `quantity` units came back and are credited. `price_reduction`: a
|
|
926
|
+
* complaint settled with money, art. 106j ust. 1 pkt 2. The buyer keeps the
|
|
927
|
+
* goods, the line is credited at `amount` as gross at the line's rate, with no
|
|
928
|
+
* discount (one is refused), and `quantity` (the units complained about) is not
|
|
929
|
+
* credited. The document stores quantity 0.
|
|
930
|
+
*/
|
|
931
|
+
basis?: CorrectionLineBasis;
|
|
766
932
|
}
|
|
767
933
|
export interface CorrectiveInvoiceInput {
|
|
768
934
|
orderId: string;
|
|
@@ -784,6 +950,22 @@ export interface CorrectiveInvoiceInput {
|
|
|
784
950
|
* Omitted, no deduplication is attempted and every call issues a document.
|
|
785
951
|
*/
|
|
786
952
|
idempotencyKey?: string;
|
|
953
|
+
/**
|
|
954
|
+
* The case's RMA number, for the label of a price-reduction line (issue #885).
|
|
955
|
+
* Absent: the label names no case.
|
|
956
|
+
*/
|
|
957
|
+
caseReference?: string;
|
|
958
|
+
/**
|
|
959
|
+
* Issue #876 — the order's charges this correction credits, gross: a
|
|
960
|
+
* consumer's withdrawal from the whole sale refunds the delivery and the
|
|
961
|
+
* payment surcharge. Each is credited at the rate of the invoice line that
|
|
962
|
+
* charged it, and never above what that line still charges. `total`
|
|
963
|
+
* includes them. Absent or 0: a return correction credits goods only.
|
|
964
|
+
*/
|
|
965
|
+
charges?: {
|
|
966
|
+
delivery?: number;
|
|
967
|
+
surcharge?: number;
|
|
968
|
+
};
|
|
787
969
|
}
|
|
788
970
|
/** A correction was issued: the document that credits the original invoice. */
|
|
789
971
|
export interface CorrectiveInvoiceIssued {
|
package/dist/returns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"returns.d.ts","sourceRoot":"","sources":["../src/returns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAM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AAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAED,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,IAAI,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,MAAM,MAAM,uBAAuB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAExF;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAClF;;;;OAIG;IACH,kBAAkB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE"}
|
package/dist/returns.js
CHANGED
|
@@ -15,6 +15,33 @@ import { twoDecimalAmount } from './money-input.js';
|
|
|
15
15
|
export const returnKindSchema = z.enum(['return', 'complaint']);
|
|
16
16
|
/** Settlement resolution chosen by the admin. */
|
|
17
17
|
export const resolutionTypeSchema = z.enum(['refund', 'credit', 'replacement', 'repair']);
|
|
18
|
+
/**
|
|
19
|
+
* The resolutions that settle a consumer withdrawal otherwise than by a refund
|
|
20
|
+
* (issue #905, design D1). A consumer who withdraws is reimbursed by the same
|
|
21
|
+
* means of payment unless they expressly agree otherwise (Directive 2011/83
|
|
22
|
+
* art. 13(1)), so each needs the consumer's consent on record first.
|
|
23
|
+
*/
|
|
24
|
+
export const alternativeResolutionSchema = z.enum(['credit', 'replacement', 'repair']);
|
|
25
|
+
/**
|
|
26
|
+
* Who put the consent on record. `operator_recorded` is the only source today:
|
|
27
|
+
* the consumer agrees by e-mail or telephone and an operator records it with
|
|
28
|
+
* the evidence. `consumer_storefront` is reserved for a consumer's own click on
|
|
29
|
+
* the storefront, should that be required later.
|
|
30
|
+
*/
|
|
31
|
+
export const alternativeConsentSourceSchema = z.enum(['operator_recorded', 'consumer_storefront']);
|
|
32
|
+
/**
|
|
33
|
+
* The consumer's consent to settle a withdrawal as `resolution` (issue #905,
|
|
34
|
+
* design D1). `note` (the evidence) and `byAdminUserId` are the operator's:
|
|
35
|
+
* the buyer's view of a case leaves both out.
|
|
36
|
+
*/
|
|
37
|
+
export const alternativeResolutionConsentSchema = z.object({
|
|
38
|
+
resolution: alternativeResolutionSchema,
|
|
39
|
+
/** When the consumer gave the consent, as the operator recorded it. */
|
|
40
|
+
at: isoDateTimeSchema,
|
|
41
|
+
note: z.string().optional(),
|
|
42
|
+
byAdminUserId: uuidSchema.nullable().optional(),
|
|
43
|
+
source: alternativeConsentSourceSchema,
|
|
44
|
+
});
|
|
18
45
|
/** State of a recorded refund's money movement. */
|
|
19
46
|
export const settlementStateSchema = z.enum(['issued', 'pending_manual', 'failed']);
|
|
20
47
|
/** Who bears the return shipping cost. */
|
|
@@ -104,6 +131,16 @@ export const returnCaseSummarySchema = z.object({
|
|
|
104
131
|
totalRefundAmount: z.number().finite(),
|
|
105
132
|
currency: z.string().length(3),
|
|
106
133
|
submittedAt: isoDateTimeSchema,
|
|
134
|
+
/**
|
|
135
|
+
* Who filed the case (`specs/170-organization-roles/` FR-053, research R-41
|
|
136
|
+
* item 6). A buyer whose role holds `returns.view_organization` lists the
|
|
137
|
+
* Organization's cases, so the summary names its filer — as the order summary
|
|
138
|
+
* carries `placedByCustomerAccountId` — and the storefront can tell a
|
|
139
|
+
* colleague's case, whose follow-up actions stay the filer's, from the
|
|
140
|
+
* caller's own. Additive: the detail always carried it, and the operator's
|
|
141
|
+
* row (`adminReturnRowSchema`) inherits it through `.extend`.
|
|
142
|
+
*/
|
|
143
|
+
customerAccountId: uuidSchema,
|
|
107
144
|
});
|
|
108
145
|
/**
|
|
109
146
|
* What became of the corrective invoice for a settled case (D-92, issue #156).
|
|
@@ -150,6 +187,23 @@ export const returnCaseDetailSchema = returnCaseSummarySchema.extend({
|
|
|
150
187
|
* "not requested" (D-92).
|
|
151
188
|
*/
|
|
152
189
|
correctiveInvoice: returnCaseCorrectiveInvoiceSchema.nullable(),
|
|
190
|
+
/**
|
|
191
|
+
* Issue #876 — the order's delivery cost and payment surcharge this case
|
|
192
|
+
* refunds: a consumer's withdrawal from the whole sale refunds both
|
|
193
|
+
* (Directive 2011/83 art. 13(1)) on the case that completes it. The approved
|
|
194
|
+
* amounts — provisional until the case is settled — and `0` on every other
|
|
195
|
+
* case. Optional on the wire, so an older producer still parses.
|
|
196
|
+
*/
|
|
197
|
+
chargeRefunds: z.object({ delivery: z.number().finite(), surcharge: z.number().finite() }).optional(),
|
|
198
|
+
/**
|
|
199
|
+
* Whether the case is a consumer's withdrawal from a distance contract (issue
|
|
200
|
+
* #905, design §2): a `return` by a personal Organization, filed while the
|
|
201
|
+
* withdrawal function was available for the order. Fixed when the case is
|
|
202
|
+
* filed. `null` for a case filed before the classification existed.
|
|
203
|
+
*/
|
|
204
|
+
consumerWithdrawal: z.boolean().nullable(),
|
|
205
|
+
/** The consumer's consent to a resolution other than a refund, when one is on record (design D1). */
|
|
206
|
+
alternativeResolutionConsent: alternativeResolutionConsentSchema.nullable(),
|
|
153
207
|
});
|
|
154
208
|
// ---------------------------------------------------------------------------
|
|
155
209
|
// Customer requests (US1)
|
|
@@ -228,9 +282,33 @@ export const adminReturnRowSchema = returnCaseSummarySchema.extend({
|
|
|
228
282
|
// ---------------------------------------------------------------------------
|
|
229
283
|
// Settlement (US5)
|
|
230
284
|
// ---------------------------------------------------------------------------
|
|
285
|
+
/** One order charge a settlement may refund (issue #876): the most that may be approved, and the amount prefilled. */
|
|
286
|
+
export const settlementChargeSchema = z.object({
|
|
287
|
+
cap: z.number().finite(),
|
|
288
|
+
approved: z.number().finite(),
|
|
289
|
+
});
|
|
231
290
|
export const settlementPrefillSchema = z.object({
|
|
232
291
|
currency: z.string().length(3),
|
|
292
|
+
/**
|
|
293
|
+
* Every resolution, always: a client that predates the consent gate keeps
|
|
294
|
+
* working, and the settlement's `422` is the boundary
|
|
295
|
+
* (`RETURN_ALTERNATIVE_RESOLUTION_CONSENT_REQUIRED`).
|
|
296
|
+
*/
|
|
233
297
|
resolutionOptions: z.array(resolutionTypeSchema),
|
|
298
|
+
/** The resolution the form starts on (issue #905): `refund`. */
|
|
299
|
+
defaultResolution: resolutionTypeSchema,
|
|
300
|
+
/**
|
|
301
|
+
* The resolutions this case cannot settle as until the consumer's consent is
|
|
302
|
+
* recorded (issue #905, design D1): on a consumer withdrawal, every one but a
|
|
303
|
+
* refund and the one consented to; empty on any other case.
|
|
304
|
+
*/
|
|
305
|
+
consentRequiredFor: z.array(resolutionTypeSchema),
|
|
306
|
+
/**
|
|
307
|
+
* The order's own payment method, which a refund proposes (Directive 2011/83
|
|
308
|
+
* art. 13(1), "the same means of payment"). `null` when the order cannot be
|
|
309
|
+
* read.
|
|
310
|
+
*/
|
|
311
|
+
defaultRefundPaymentMethodId: uuidSchema.nullable(),
|
|
234
312
|
items: z.array(z.object({
|
|
235
313
|
returnCaseItemId: uuidSchema,
|
|
236
314
|
productName: z.string(),
|
|
@@ -238,6 +316,23 @@ export const settlementPrefillSchema = z.object({
|
|
|
238
316
|
defaultRefundAmount: z.number().finite(),
|
|
239
317
|
approvedRefundAmount: z.number().finite(),
|
|
240
318
|
})),
|
|
319
|
+
/**
|
|
320
|
+
* Issue #876 — the order's charges the case may refund: present only on a
|
|
321
|
+
* consumer's withdrawal that completes the order, and each charge only when
|
|
322
|
+
* its cap is above 0. `cap` is what was paid for it less what earlier cases
|
|
323
|
+
* refunded — the most the operator may approve; `approved` is what settles
|
|
324
|
+
* if the field is omitted: the cap within the withdrawal window (the
|
|
325
|
+
* statutory 14 days or the channel's longer free-return window), `0`
|
|
326
|
+
* outside it. On a settled case `cap` equals `approved`, and a charge settled
|
|
327
|
+
* at 0 is left out; the cap at settlement is recorded in the
|
|
328
|
+
* `return.settled` audit entry.
|
|
329
|
+
*/
|
|
330
|
+
charges: z
|
|
331
|
+
.object({
|
|
332
|
+
delivery: settlementChargeSchema.optional(),
|
|
333
|
+
surcharge: settlementChargeSchema.optional(),
|
|
334
|
+
})
|
|
335
|
+
.optional(),
|
|
241
336
|
});
|
|
242
337
|
export const settlementRequestSchema = z.object({
|
|
243
338
|
resolutionType: resolutionTypeSchema,
|
|
@@ -261,6 +356,31 @@ export const settlementRequestSchema = z.object({
|
|
|
261
356
|
.default([]),
|
|
262
357
|
refundPaymentMethodId: uuidSchema.optional(),
|
|
263
358
|
createCorrectiveInvoice: z.boolean().optional(),
|
|
359
|
+
/**
|
|
360
|
+
* Issue #876 — what the case refunds of the order's delivery cost and of its
|
|
361
|
+
* payment surcharge (ruling Q2 on PR #965):
|
|
362
|
+
* - omitted: the default recomputed under the order's lock (the full amount
|
|
363
|
+
* within the withdrawal window, 0 outside it);
|
|
364
|
+
* - present: settled exactly as sent, 0 included, when it is at most the cap
|
|
365
|
+
* (art. 13(2): a premium delivery reduced to the standard one);
|
|
366
|
+
* - above the cap: refused `422 refund_exceeds_paid`, with nothing written.
|
|
367
|
+
* Only a consumer's withdrawal that completes the order, settled with a
|
|
368
|
+
* refund or a credit, has a cap above 0. This deliberately differs from the
|
|
369
|
+
* line rule, where an amount equal to a default means the default approved.
|
|
370
|
+
*/
|
|
371
|
+
deliveryRefundAmount: twoDecimalAmount(z.number().finite().nonnegative()).optional(),
|
|
372
|
+
surchargeRefundAmount: twoDecimalAmount(z.number().finite().nonnegative()).optional(),
|
|
373
|
+
});
|
|
374
|
+
/**
|
|
375
|
+
* `POST /api/v1/admin/returns/:id/alternative-consent` (issue #905, design D1):
|
|
376
|
+
* the operator records that the consumer agreed to `resolution`, when, and the
|
|
377
|
+
* evidence. The moment may not be in the future, nor before the case was filed.
|
|
378
|
+
*/
|
|
379
|
+
export const recordAlternativeConsentRequestSchema = z.object({
|
|
380
|
+
resolution: alternativeResolutionSchema,
|
|
381
|
+
consentGivenAt: isoDateTimeSchema,
|
|
382
|
+
/** Where the consent is documented, e.g. "Customer's e-mail of 10 Nov 2026, ticket #123". */
|
|
383
|
+
note: z.string().trim().min(1).max(2000),
|
|
264
384
|
});
|
|
265
385
|
/**
|
|
266
386
|
* What became of the corrective invoice a settlement asked for (#135).
|
|
@@ -395,30 +515,23 @@ export const bulkTransitionResultSchema = z.object({
|
|
|
395
515
|
moved: z.array(uuidSchema),
|
|
396
516
|
skipped: z.array(z.object({ id: uuidSchema, reason: z.string() })),
|
|
397
517
|
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
export const returnSavedViewUpdateSchema = z.object({
|
|
418
|
-
name: z.string().min(1).max(200).optional(),
|
|
419
|
-
shared: z.boolean().optional(),
|
|
420
|
-
filters: z.record(z.string(), z.unknown()).optional(),
|
|
421
|
-
sort: returnSavedViewSortSchema.optional(),
|
|
422
|
-
visibleColumns: z.array(z.string()).nullable().optional(),
|
|
423
|
-
});
|
|
518
|
+
/**
|
|
519
|
+
* The key of the transaction-scoped advisory lock (`pg_advisory_xact_lock(hashtext(key))`)
|
|
520
|
+
* that serialises the writes about one order's returns. Owner: `returns`.
|
|
521
|
+
*
|
|
522
|
+
* `returns` takes it to create a case and to settle one; `invoices` takes it to
|
|
523
|
+
* issue an invoice (review of PR #865, F3), so an invoice is never issued from
|
|
524
|
+
* a case a settlement has moved money for but not yet recorded as resolved —
|
|
525
|
+
* it waits, and then lists only the kept lines.
|
|
526
|
+
*/
|
|
527
|
+
export function returnCaseOrderLockKey(orderId) {
|
|
528
|
+
return `return_cases:${orderId}`;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* What a corrective-invoice line documents (issue #885). `returned_goods`: the
|
|
532
|
+
* units came back and are credited. `price_reduction`: a complaint settled with
|
|
533
|
+
* money (art. 106j ust. 1 pkt 2 of the Polish VAT Act), so the buyer keeps the
|
|
534
|
+
* goods and only their price is reduced.
|
|
535
|
+
*/
|
|
536
|
+
export const CORRECTION_LINE_BASES = ['returned_goods', 'price_reduction'];
|
|
424
537
|
//# sourceMappingURL=returns.js.map
|