@sixtyninecommerce/admin 0.9.0 → 0.11.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 +4598 -128
- package/dist/catalog/assets.d.ts +120 -8
- package/dist/catalog/assets.js +98 -12
- package/dist/catalog/collections.d.ts +279 -14
- package/dist/catalog/collections.js +246 -15
- package/dist/catalog/index.d.ts +9 -2
- package/dist/catalog/index.js +4 -0
- package/dist/catalog/products.d.ts +318 -17
- package/dist/catalog/products.js +182 -14
- package/dist/catalog/properties.d.ts +102 -14
- package/dist/catalog/properties.js +13 -0
- package/dist/catalog/recommendations.d.ts +261 -0
- package/dist/catalog/recommendations.js +145 -0
- package/dist/catalog/reviews.d.ts +368 -0
- package/dist/catalog/reviews.js +318 -0
- package/dist/catalog/types.d.ts +17 -1
- package/dist/catalog/types.js +10 -0
- package/dist/catalog/variant-find.d.ts +136 -0
- package/dist/catalog/variant-find.js +239 -0
- package/dist/catalog/variants.d.ts +282 -25
- package/dist/catalog/variants.js +173 -25
- package/dist/catalog/visibility.d.ts +20 -5
- package/dist/catalog/visibility.js +19 -1
- package/dist/client.d.ts +116 -9
- package/dist/client.js +41 -7
- package/dist/content/assets.d.ts +286 -0
- package/dist/content/assets.js +181 -0
- package/dist/content/items.d.ts +269 -0
- package/dist/content/items.js +170 -0
- package/dist/content/types.d.ts +282 -0
- package/dist/content/types.js +100 -0
- package/dist/customers/age-verification.d.ts +66 -0
- package/dist/customers/age-verification.js +79 -0
- package/dist/customers/credit.d.ts +263 -0
- package/dist/customers/credit.js +244 -0
- package/dist/customers/delivery-preferences.d.ts +120 -0
- package/dist/customers/delivery-preferences.js +97 -0
- package/dist/customers/groups.d.ts +207 -0
- package/dist/customers/groups.js +438 -0
- package/dist/customers/index.d.ts +447 -37
- package/dist/customers/index.js +313 -40
- package/dist/customers/invitation-status.d.ts +57 -0
- package/dist/customers/invitation-status.js +21 -0
- package/dist/customers/notes.d.ts +67 -0
- package/dist/customers/notes.js +51 -0
- package/dist/customers/notification-recipients.d.ts +97 -0
- package/dist/customers/notification-recipients.js +84 -0
- package/dist/customers/saved-lists.d.ts +42 -0
- package/dist/customers/saved-lists.js +61 -0
- package/dist/customers/vat.d.ts +83 -0
- package/dist/customers/vat.js +46 -0
- package/dist/customers/wire.d.ts +20 -0
- package/dist/customers/wire.js +35 -0
- package/dist/documents/ar.d.ts +307 -0
- package/dist/documents/ar.js +254 -0
- package/dist/documents/index.d.ts +731 -21
- package/dist/documents/index.js +436 -24
- package/dist/documents/pdf.d.ts +2 -0
- package/dist/documents/pdf.js +11 -0
- package/dist/fulfillments/create.d.ts +167 -0
- package/dist/fulfillments/create.js +216 -0
- package/dist/fulfillments/index.d.ts +121 -10
- package/dist/fulfillments/index.js +120 -2
- package/dist/fulfillments/payment-policy.d.ts +64 -0
- package/dist/fulfillments/payment-policy.js +140 -0
- package/dist/fulfillments/warehouse.d.ts +724 -0
- package/dist/fulfillments/warehouse.js +914 -0
- package/dist/geo/index.d.ts +119 -0
- package/dist/geo/index.js +107 -0
- package/dist/index.d.ts +129 -30
- package/dist/index.js +47 -9
- package/dist/integrations/afas-actions.d.ts +234 -0
- package/dist/integrations/afas-actions.js +310 -0
- package/dist/integrations/afas-types.d.ts +483 -0
- package/dist/integrations/afas-types.js +5 -0
- package/dist/integrations/afas.d.ts +234 -0
- package/dist/integrations/afas.js +290 -0
- package/dist/integrations/connections.d.ts +103 -0
- package/dist/integrations/connections.js +55 -0
- package/dist/integrations/esp.d.ts +313 -0
- package/dist/integrations/esp.js +169 -0
- package/dist/integrations/exact-online-types.d.ts +423 -0
- package/dist/integrations/exact-online-types.js +6 -0
- package/dist/integrations/exact-online.d.ts +248 -0
- package/dist/integrations/exact-online.js +376 -0
- package/dist/integrations/index.d.ts +40 -0
- package/dist/integrations/index.js +24 -0
- package/dist/integrations/pipeline-keys.d.ts +13 -0
- package/dist/integrations/pipeline-keys.js +22 -0
- package/dist/integrations/pipelines.d.ts +114 -0
- package/dist/integrations/pipelines.js +46 -0
- package/dist/integrations/types.d.ts +322 -0
- package/dist/integrations/types.js +8 -0
- package/dist/jobs/bulk-action-run.d.ts +11 -2
- package/dist/jobs/bulk-action-run.js +4 -5
- package/dist/locations/index.d.ts +66 -0
- package/dist/locations/index.js +31 -0
- package/dist/meta/index.d.ts +162 -0
- package/dist/orders/bulk.d.ts +75 -0
- package/dist/orders/bulk.js +150 -0
- package/dist/orders/cancel-with-money.d.ts +227 -0
- package/dist/orders/cancel-with-money.js +153 -0
- package/dist/orders/commit-edit.d.ts +7 -1
- package/dist/orders/commit-edit.js +5 -1
- package/dist/orders/deposit-policy.d.ts +103 -0
- package/dist/orders/deposit-policy.js +202 -0
- package/dist/orders/drafts.d.ts +800 -0
- package/dist/orders/drafts.js +771 -0
- package/dist/orders/fields.d.ts +245 -0
- package/dist/orders/fields.js +188 -0
- package/dist/orders/get.d.ts +29 -19
- package/dist/orders/get.js +17 -8
- package/dist/orders/index.d.ts +125 -5
- package/dist/orders/index.js +35 -2
- package/dist/orders/lifecycle.d.ts +128 -0
- package/dist/orders/lifecycle.js +158 -0
- package/dist/orders/line-price-preview.d.ts +7 -2
- package/dist/orders/list.d.ts +222 -0
- package/dist/orders/list.js +377 -0
- package/dist/orders/manual-discounts.d.ts +11 -2
- package/dist/orders/manual-discounts.js +2 -0
- package/dist/orders/manual-pricing.d.ts +5 -0
- package/dist/orders/order-entry.d.ts +20 -7
- package/dist/orders/plan-edit.d.ts +1 -1
- package/dist/orders/plan-edit.js +4 -1
- package/dist/orders/settings.d.ts +201 -0
- package/dist/orders/settings.js +325 -0
- package/dist/orders/status.d.ts +159 -13
- package/dist/orders/status.js +21 -0
- package/dist/orders/surcharges.d.ts +8 -1
- package/dist/orders/surcharges.js +3 -2
- package/dist/payments/account-credit.d.ts +30 -0
- package/dist/payments/account-credit.js +19 -0
- package/dist/payments/ar.d.ts +292 -0
- package/dist/payments/ar.js +223 -0
- package/dist/payments/connected-account.d.ts +47 -0
- package/dist/payments/connected-account.js +61 -0
- package/dist/payments/credit-noted-fields.d.ts +12 -0
- package/dist/payments/credit-noted-fields.js +37 -0
- package/dist/payments/index.d.ts +263 -10
- package/dist/payments/index.js +133 -1
- package/dist/payments/methods.d.ts +332 -0
- package/dist/payments/methods.js +363 -0
- package/dist/payments/mollie-methods.d.ts +159 -0
- package/dist/payments/mollie-methods.js +141 -0
- package/dist/payments/payment-links.d.ts +180 -0
- package/dist/payments/payment-links.js +97 -0
- package/dist/payments/provider-keys.d.ts +150 -0
- package/dist/payments/provider-keys.js +118 -0
- package/dist/payments/providers.d.ts +86 -11
- package/dist/payments/providers.js +29 -0
- package/dist/payments/requests.d.ts +144 -0
- package/dist/payments/requests.js +92 -0
- package/dist/payments/store-credit-fields.d.ts +15 -0
- package/dist/payments/store-credit-fields.js +51 -0
- package/dist/pickups/index.d.ts +104 -0
- package/dist/pickups/index.js +105 -0
- package/dist/platform/channels.d.ts +132 -0
- package/dist/platform/channels.js +128 -0
- package/dist/platform/geo.d.ts +123 -0
- package/dist/platform/geo.js +144 -0
- package/dist/platform/tax.d.ts +154 -0
- package/dist/platform/tax.js +139 -0
- package/dist/pos/anomalies.d.ts +158 -0
- package/dist/pos/anomalies.js +64 -0
- package/dist/pos/assisted-selling.d.ts +79 -0
- package/dist/pos/assisted-selling.js +38 -0
- package/dist/pos/exchanges.d.ts +103 -0
- package/dist/pos/exchanges.js +22 -0
- package/dist/pos/gift-cards.d.ts +135 -0
- package/dist/pos/gift-cards.js +47 -0
- package/dist/pos/index.d.ts +2125 -32
- package/dist/pos/index.js +742 -4
- package/dist/pos/no-receipt.d.ts +94 -0
- package/dist/pos/no-receipt.js +25 -0
- package/dist/pos/offline-sales.d.ts +187 -0
- package/dist/pos/offline-sales.js +116 -0
- package/dist/pos/pay-by-link.d.ts +143 -0
- package/dist/pos/pay-by-link.js +57 -0
- package/dist/pos/quick-keys.d.ts +103 -0
- package/dist/pos/quick-keys.js +45 -0
- package/dist/pos/reports.d.ts +360 -0
- package/dist/pos/reports.js +62 -0
- package/dist/pos/returns.d.ts +217 -0
- package/dist/pos/returns.js +53 -0
- package/dist/pricing/bulk-coupons.d.ts +139 -0
- package/dist/pricing/bulk-coupons.js +112 -0
- package/dist/pricing/index.d.ts +177 -4
- package/dist/pricing/index.js +176 -1
- package/dist/pricing/price-lists.d.ts +604 -0
- package/dist/pricing/price-lists.js +600 -0
- package/dist/pricing/vouchers.d.ts +103 -0
- package/dist/pricing/vouchers.js +69 -0
- package/dist/purchasing/alerts.d.ts +89 -0
- package/dist/purchasing/alerts.js +62 -0
- package/dist/purchasing/cost.d.ts +110 -0
- package/dist/purchasing/cost.js +86 -0
- package/dist/purchasing/index.d.ts +36 -0
- package/dist/purchasing/index.js +16 -0
- package/dist/purchasing/purchase-orders.d.ts +548 -0
- package/dist/purchasing/purchase-orders.js +491 -0
- package/dist/purchasing/replenishment.d.ts +281 -0
- package/dist/purchasing/replenishment.js +240 -0
- package/dist/purchasing/settings.d.ts +152 -0
- package/dist/purchasing/settings.js +181 -0
- package/dist/purchasing/suppliers.d.ts +476 -0
- package/dist/purchasing/suppliers.js +438 -0
- package/dist/quotes/index.d.ts +501 -0
- package/dist/quotes/index.js +439 -0
- package/dist/reports/index.d.ts +71 -8
- package/dist/reports/index.js +74 -11
- package/dist/returns/index.d.ts +818 -0
- package/dist/returns/index.js +844 -0
- package/dist/search/index.d.ts +174 -0
- package/dist/search/index.js +125 -0
- package/dist/shipping/definitions.d.ts +29 -0
- package/dist/shipping/definitions.js +47 -0
- package/dist/shipping/fulfillment-profiles.d.ts +174 -0
- package/dist/shipping/fulfillment-profiles.js +104 -0
- package/dist/shipping/hendriks.d.ts +97 -0
- package/dist/shipping/hendriks.js +50 -0
- package/dist/shipping/index.d.ts +48 -0
- package/dist/shipping/index.js +25 -0
- package/dist/shipping/methods.d.ts +198 -0
- package/dist/shipping/methods.js +240 -0
- package/dist/shipping/myparcel.d.ts +254 -0
- package/dist/shipping/myparcel.js +178 -0
- package/dist/shipping/parcel-count-suggestion.d.ts +2 -0
- package/dist/shipping/parcel-rule.d.ts +6 -5
- package/dist/shipping/parcel-rule.js +21 -23
- package/dist/shipping/rate-tables.d.ts +179 -0
- package/dist/shipping/rate-tables.js +184 -0
- package/dist/stock/index.d.ts +10 -3
- package/dist/stock/index.js +3 -0
- package/dist/stock/locations.d.ts +144 -0
- package/dist/stock/locations.js +168 -0
- package/dist/stock/transfers.d.ts +216 -43
- package/dist/stock/transfers.js +140 -13
- package/dist/stored-value/index.d.ts +214 -4
- package/dist/stored-value/index.js +152 -0
- package/dist/subscriptions/index.d.ts +682 -0
- package/dist/subscriptions/index.js +815 -0
- package/dist/tax/index.d.ts +76 -1
- package/dist/tax/index.js +50 -0
- package/dist/tenant/email-style.d.ts +102 -0
- package/dist/tenant/email-style.js +72 -0
- package/dist/tenant/email-templates.d.ts +66 -0
- package/dist/tenant/email-templates.js +54 -0
- package/dist/tenant/notifications.d.ts +23 -17
- package/dist/tenant/settings-sources.d.ts +1 -1
- package/dist/tenant/time-zone.d.ts +17 -0
- package/dist/tenant/time-zone.js +11 -0
- package/dist/types.d.ts +51 -4
- package/dist/users/index.d.ts +3 -0
- package/dist/users/index.js +2 -0
- package/dist/users/warehouses.d.ts +50 -0
- package/dist/users/warehouses.js +51 -0
- package/package.json +2 -2
package/dist/orders/status.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type OrderAllocationBadge = (typeof ORDER_ALLOCATION_BADGES)[number];
|
|
|
34
34
|
export declare const ORDER_EDIT_BLOCK_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED"];
|
|
35
35
|
export type OrderEditBlockCode = (typeof ORDER_EDIT_BLOCK_CODES)[number];
|
|
36
36
|
/** The actions the engine answers for, in the order it lists them. */
|
|
37
|
-
export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEASE_ALLOCATION", "CORRECT_FULFILLMENT", "CANCEL", "TRANSITION", "MARK_COMPLETED", "REOPEN"];
|
|
37
|
+
export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEASE_ALLOCATION", "CORRECT_FULFILLMENT", "CANCEL", "TRANSITION", "MARK_COMPLETED", "REOPEN", "SET_PAYMENT_NOT_REQUIRED", "SET_FULFILLMENT_HOLD", "SET_GOODWILL_ROUNDING", "SET_BILLING_FIELDS", "APPLY_GOODWILL_ROUNDING", "SET_PRICING_FIELDS"];
|
|
38
38
|
/**
|
|
39
39
|
* One thing that can be done to an order, with the engine write behind it and
|
|
40
40
|
* what `allowed` asks of the caller:
|
|
@@ -56,14 +56,76 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
|
|
|
56
56
|
* locations (an API token or app installation with `locationIds`) must also
|
|
57
57
|
* hold every location the order's reservation sits at; otherwise the release
|
|
58
58
|
* answers `LOCATION_NOT_ALLOWED` and this action `PERMISSION`.
|
|
59
|
-
* - `CANCEL`: `cancelOrder` for the whole order. Needs `UpdateOrder`.
|
|
59
|
+
* - `CANCEL`: `cancelOrder` for the whole order. Needs `UpdateOrder`. A credential
|
|
60
|
+
* restricted to stock locations must also hold every location the order's
|
|
61
|
+
* reservation sits at (a cancel releases it there); otherwise the cancel answers
|
|
62
|
+
* `LOCATION_OUT_OF_SCOPE` and this action `PERMISSION`.
|
|
60
63
|
* - `TRANSITION`: `transitionOrderToState` into one of `nextStates`. Needs
|
|
61
64
|
* `UpdateOrder`.
|
|
62
|
-
* - `MARK_COMPLETED`: `
|
|
63
|
-
* - `REOPEN`: `
|
|
65
|
+
* - `MARK_COMPLETED`: `orders.markCompleted`. Needs `UpdateOrder`.
|
|
66
|
+
* - `REOPEN`: `orders.reopen`. Needs `UpdateOrder`.
|
|
67
|
+
* - `SET_PAYMENT_NOT_REQUIRED`: `orders.setPaymentNotRequired`, in the direction it would go
|
|
68
|
+
* next: lifting the waiver while the order carries one (`lifecycle.payment` then reads
|
|
69
|
+
* `not_required`), waiving it otherwise. A cancelled order changes neither way (`CANCELLED`);
|
|
70
|
+
* an order whose payment reads `not_required` without a waiver (a total of 0) has nothing to
|
|
71
|
+
* waive or lift (`STATE`); a waiver waits while an invoice still bills the order
|
|
72
|
+
* (`CREDIT_NOTE_REQUIRED`). The write refuses the `CANCELLED` and `CREDIT_NOTE_REQUIRED`
|
|
73
|
+
* cases, `ORDER_PAYMENT_WAIVER_REFUSED`; it takes a waiver on a zero-total order, which this
|
|
74
|
+
* action does not offer. Needs `UpdateOrder`.
|
|
75
|
+
* - `SET_FULFILLMENT_HOLD`: `orders.setFulfillmentHold`, in the direction it would go next: a
|
|
76
|
+
* release while `lifecycle.fulfillment` is `on_hold` (any order but a live cart), a new hold
|
|
77
|
+
* only on an open order (`STATE` otherwise). Needs `UpdateOrder`.
|
|
78
|
+
* - `SET_GOODWILL_ROUNDING`: `orders.setGoodwillRounding`, either way (apply or clear). Closed
|
|
79
|
+
* once the order's total no longer moves: an invoice bills it (`INVOICE_LOCKED`), it is
|
|
80
|
+
* completed or cancelled (`COMPLETED`, `CANCELLED`), or it is settled or invoiced in the
|
|
81
|
+
* store's ERP (`ERP_LOCKED`); the write then refuses `GOODWILL_ROUNDING_LOCKED`. Whether
|
|
82
|
+
* there is anything to round (one VAT rate, a total that is not whole) is not answered here:
|
|
83
|
+
* applying to such an order is refused `GOODWILL_ROUNDING_NOT_APPLICABLE`. Needs
|
|
84
|
+
* `UpdateOrder`. Whether APPLYING one is open is `APPLY_GOODWILL_ROUNDING`.
|
|
85
|
+
* - `APPLY_GOODWILL_ROUNDING`: `orders.setGoodwillRounding` with `apply: true`. The same lock as
|
|
86
|
+
* `SET_GOODWILL_ROUNDING` first, then `LEAVES_MONEY_OVER`: the order is paid, and its payments
|
|
87
|
+
* would hold more than the rounded total; the write then refuses
|
|
88
|
+
* `GOODWILL_ROUNDING_LEAVES_MONEY_OVER`, because the rounding refunds nothing. Clearing a
|
|
89
|
+
* rounding stays `SET_GOODWILL_ROUNDING` alone. Needs `UpdateOrder`.
|
|
90
|
+
* - `SET_BILLING_FIELDS`: a change of `customFields.removeTax`, `paymentTermsDays` or
|
|
91
|
+
* `paymentConditionCode`, the order's fields that decide what it BILLS, through the engine's
|
|
92
|
+
* `setOrderCustomFields` or `setOrderRemoveTax`. Closed while a live invoice bills the order
|
|
93
|
+
* (`INVOICE_LOCKED`): its standard invoice not voided, or an accounts-receivable invoice
|
|
94
|
+
* neither voided nor superseded. The write then refuses `ORDER_INVOICE_LOCKED` (422), with
|
|
95
|
+
* the field in `details[].field` (a pointer into the arguments) and a sentence naming the
|
|
96
|
+
* invoice and its ledger in `details[].message`; what the order bills is changed through that
|
|
97
|
+
* invoice's correction (`documents.commitCorrection`). A value equal to the stored one is
|
|
98
|
+
* never refused, and notes and the order's reference (`orders.setPurchaseOrderNumber`) are
|
|
99
|
+
* not part of it. It answers those two writes only, and they store the value without
|
|
100
|
+
* recalculating the order. Applying it to the order's amounts (the order edit:
|
|
101
|
+
* `orders.planEdit`, `orders.commitEdit`), and changing a line's `unitPriceOverride` or
|
|
102
|
+
* `unitPriceImported`, which this lock refuses too, are also closed while `MODIFY` answers
|
|
103
|
+
* `INVOICE_LOCKED`, and that outlives the void of a retail invoice. The void opens the payment
|
|
104
|
+
* terms again, not `removeTax`: `SET_PRICING_FIELDS` answers that. Needs `UpdateOrder`.
|
|
105
|
+
* - `SET_PRICING_FIELDS`: a change of `customFields.removeTax`, or of a line's
|
|
106
|
+
* `unitPriceOverride` or `unitPriceImported`, the fields that decide the order's AMOUNTS, at
|
|
107
|
+
* the engine's custom-field writes (`setOrderCustomFields`, `setOrderRemoveTax`,
|
|
108
|
+
* `modifyOrder`, the draft line writes). Closed (`INVOICE_LOCKED`) while a live invoice bills
|
|
109
|
+
* the order, and while its content stays locked with none: after its retail invoice was
|
|
110
|
+
* voided, and on an order the platform it was imported from invoiced. Nothing recalculates
|
|
111
|
+
* such an order, so its tax and prices stay as invoiced. The write refuses
|
|
112
|
+
* `ORDER_INVOICE_LOCKED` (422) with the field in `details[].field` and the reason in
|
|
113
|
+
* `details[].message`. A value equal to the stored one is never refused; the payment terms
|
|
114
|
+
* are not part of it. Needs `UpdateOrder`.
|
|
115
|
+
*
|
|
116
|
+
* The two toggles are answered by engines from W10-25 on, the rounding from W10-26 on, and
|
|
117
|
+
* `SET_BILLING_FIELDS` and `SET_PRICING_FIELDS` from the engines that enforce them on; an older
|
|
118
|
+
* engine leaves them out of `actions`. For the first three that reads as "not available"; an
|
|
119
|
+
* engine that does not answer `SET_BILLING_FIELDS` does not lock those fields either, and one
|
|
120
|
+
* that does not answer `SET_PRICING_FIELDS` locks them only as `SET_BILLING_FIELDS` says. `APPLY_GOODWILL_ROUNDING` is answered
|
|
121
|
+
* by the engine that refuses a rounding on a paid order; an older one leaves it out and does not
|
|
122
|
+
* refuse it, so read a missing answer as "not available" (never offer the rounding on a guess).
|
|
64
123
|
* - `CORRECT_FULFILLMENT`: one of TWO writes, with different gates.
|
|
65
|
-
* - `updateFulfillmentLineQuantities`
|
|
66
|
-
* fulfillment of the order on any store.
|
|
124
|
+
* - `updateFulfillmentLineQuantities` (`orders.correctFulfillmentQuantities`) needs
|
|
125
|
+
* `UpdateOrder`, and corrects any fulfillment of the order on any store. A credential
|
|
126
|
+
* restricted to stock locations (an API token or app installation with `locationIds`)
|
|
127
|
+
* corrects only a fulfillment that ships from one of them (`LOCATION_OUT_OF_SCOPE`
|
|
128
|
+
* otherwise).
|
|
67
129
|
* - `correctFulfillmentQuantities` needs `UpdateFulfillment` or
|
|
68
130
|
* `UpdateOrder`, and works only on a store with the warehouse workspace
|
|
69
131
|
* (`WAREHOUSE_NOT_ENABLED` otherwise). For a caller without `UpdateOrder`
|
|
@@ -73,7 +135,8 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
|
|
|
73
135
|
* quantity (`OFFICE_ONLY`).
|
|
74
136
|
*
|
|
75
137
|
* So `allowed` is true for a caller with `UpdateOrder` whenever the order is
|
|
76
|
-
* eligible
|
|
138
|
+
* eligible, except a credential restricted to stock locations, for which it is true only
|
|
139
|
+
* while one of THIS order's fulfillments ships from one of its locations. For a caller holding `UpdateFulfillment` without `UpdateOrder`
|
|
77
140
|
* it is true only on a store with the warehouse workspace, and only while
|
|
78
141
|
* at least one of THIS order's fulfillments ships from one of the caller's
|
|
79
142
|
* warehouses. That caller must call `correctFulfillmentQuantities`: the
|
|
@@ -86,7 +149,7 @@ export declare const ORDER_STATUS_ACTIONS: readonly ["MODIFY", "DELETE", "RELEAS
|
|
|
86
149
|
*/
|
|
87
150
|
export type OrderStatusActionName = (typeof ORDER_STATUS_ACTIONS)[number];
|
|
88
151
|
/** Why an action is not allowed, in the order the engine lists them. */
|
|
89
|
-
export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED", "STATE", "NOTHING_ALLOCATED", "HAS_RECORDS", "NOTHING_TO_CANCEL", "SHOPPER_CART", "UNITS_SHIPPED", "ACTIVE_FULFILLMENT", "PERMISSION"];
|
|
152
|
+
export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COMPLETED", "CANCELLED", "STATE", "NOTHING_ALLOCATED", "HAS_RECORDS", "NOTHING_TO_CANCEL", "SHOPPER_CART", "UNITS_SHIPPED", "ACTIVE_FULFILLMENT", "CREDIT_NOTE_REQUIRED", "HOLDS_MONEY", "ERP_LOCKED", "LEAVES_MONEY_OVER", "PERMISSION"];
|
|
90
153
|
/**
|
|
91
154
|
* - `INVOICE_LOCKED`, `COMPLETED`, `CANCELLED`: the edit block.
|
|
92
155
|
* - `STATE`: the order's state does not allow it.
|
|
@@ -104,6 +167,31 @@ export declare const ORDER_STATUS_REASON_CODES: readonly ["INVOICE_LOCKED", "COM
|
|
|
104
167
|
* units come back through a return.
|
|
105
168
|
* - `ACTIVE_FULFILLMENT`: a fulfillment not yet shipped holds a line. Detach
|
|
106
169
|
* the order from it or correct its quantities first.
|
|
170
|
+
* - `CREDIT_NOTE_REQUIRED` (`CANCEL` and `SET_PAYMENT_NOT_REQUIRED`): an invoice
|
|
171
|
+
* still bills the order, paid or not. For `SET_PAYMENT_NOT_REQUIRED`, correct
|
|
172
|
+
* the invoice first. For `CANCEL`, cancelling (whole or by lines) would leave
|
|
173
|
+
* the invoice standing. Do what {@link OrderStatusView.cancelCreditNote}'s `remedy`
|
|
174
|
+
* says first, then cancel: `CORRECT_INVOICE`, correct the invoice it names
|
|
175
|
+
* (`documents.commitCorrection` on its ledger: credit it in full, with a
|
|
176
|
+
* refund on a retail invoice); `REFUND_PAYMENT`, refund the order's settled
|
|
177
|
+
* payment (`payments.refund`), whose AR credit note corrects the invoice,
|
|
178
|
+
* and do NOT correct it as well (that credits the customer twice). Both cancel
|
|
179
|
+
* doors (`cancelOrder` and `orders.cancelWithMoney`) refuse
|
|
180
|
+
* `ORDER_CANCEL_CREDIT_NOTE_CONFLICT` (409) meanwhile. Named before
|
|
181
|
+
* `HOLDS_MONEY`.
|
|
182
|
+
* - `HOLDS_MONEY`: `CANCEL` only. The order has been placed or parked and
|
|
183
|
+
* still holds money, which a plain cancel would leave on it (the Admin
|
|
184
|
+
* `cancelOrder` refuses it `ORDER_HOLDS_MONEY`). Cancel it with
|
|
185
|
+
* `orders.cancelWithMoney`, or give its money back first: refund settled
|
|
186
|
+
* payments, cancel card holds (a hold released at the payment provider
|
|
187
|
+
* first where its payment method cannot). The value of spent gift cards
|
|
188
|
+
* sold on it is never given back: only `orders.cancelWithMoney`'s
|
|
189
|
+
* `retain` keeps it.
|
|
190
|
+
* - `ERP_LOCKED`: `SET_GOODWILL_ROUNDING` and `APPLY_GOODWILL_ROUNDING` only. The order is
|
|
191
|
+
* settled or invoiced in the store's ERP, which holds its total: correct it there.
|
|
192
|
+
* - `LEAVES_MONEY_OVER`: `APPLY_GOODWILL_ROUNDING` only. The order is paid: rounding its total
|
|
193
|
+
* down would leave the customer's money over the rounded total, which nothing pays back.
|
|
194
|
+
* Refund the customer instead.
|
|
107
195
|
* - `PERMISSION`: the order allows it and this caller may not. The only
|
|
108
196
|
* reason about the caller.
|
|
109
197
|
*/
|
|
@@ -147,13 +235,18 @@ export interface OrderStatusView {
|
|
|
147
235
|
locked: boolean;
|
|
148
236
|
reason: OrderLockReason | (string & {});
|
|
149
237
|
/**
|
|
150
|
-
* Set only when the reason is `INVOICE`: the live standard invoice,
|
|
151
|
-
*
|
|
238
|
+
* Set only when the reason is `INVOICE`: the live standard retail invoice,
|
|
239
|
+
* else the live accounts-receivable invoice billing the order, else a voided
|
|
240
|
+
* standard retail one (voiding a retail invoice does not unlock the order;
|
|
241
|
+
* an AR invoice locks only while it is live, so it is never voided here).
|
|
242
|
+
* `ledger` is `RETAIL` or `AR`: the ledger to correct it on
|
|
243
|
+
* (`documents.planCorrection`).
|
|
152
244
|
*/
|
|
153
245
|
lockingInvoice: {
|
|
154
246
|
id: string;
|
|
155
247
|
number: string;
|
|
156
248
|
voided: boolean;
|
|
249
|
+
ledger: 'RETAIL' | 'AR' | (string & {});
|
|
157
250
|
} | null;
|
|
158
251
|
};
|
|
159
252
|
/** Null when the order's content may change; the message is the one every edit is refused with. */
|
|
@@ -192,6 +285,12 @@ export interface OrderStatusView {
|
|
|
192
285
|
* fulfillment provider, and the store blocks shipping it again.
|
|
193
286
|
*/
|
|
194
287
|
sourceFulfilled: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Why `sourceFulfilled` is true, in words for staff (the source platform and its order
|
|
290
|
+
* number), the same sentence the warehouse demand carries; null when it is false. Show it as
|
|
291
|
+
* sent rather than composing one.
|
|
292
|
+
*/
|
|
293
|
+
sourceFulfilledReason: string | null;
|
|
195
294
|
/** Set while the order is parked. */
|
|
196
295
|
park: {
|
|
197
296
|
reason: string | null;
|
|
@@ -207,6 +306,13 @@ export interface OrderStatusView {
|
|
|
207
306
|
} | null;
|
|
208
307
|
/** Empty when the order runs on every provider the store assigned. */
|
|
209
308
|
providerFallbacks: OrderStatusProviderFallback[];
|
|
309
|
+
/**
|
|
310
|
+
* Set while a cancel (whole or by lines) waits for a credit note (`CANCEL` answers
|
|
311
|
+
* `CREDIT_NOTE_REQUIRED`, unless a more fundamental reason comes first).
|
|
312
|
+
* This SDK's document selects it, so against an engine older than the field
|
|
313
|
+
* `status` fails validation: deploy the engine first.
|
|
314
|
+
*/
|
|
315
|
+
cancelCreditNote: OrderStatusCancelCreditNote | null;
|
|
210
316
|
/**
|
|
211
317
|
* The states a change-status menu lists, in the engine's order: without
|
|
212
318
|
* `Cancelled` and `Modifying` (their own actions), without the cart phase,
|
|
@@ -216,7 +322,41 @@ export interface OrderStatusView {
|
|
|
216
322
|
nextStates: string[];
|
|
217
323
|
actions: OrderStatusAction[];
|
|
218
324
|
}
|
|
219
|
-
|
|
325
|
+
/**
|
|
326
|
+
* Why a cancel (whole or by lines) waits for a credit note: an invoice still
|
|
327
|
+
* bills the order, paid or not (cancelling would leave the invoice
|
|
328
|
+
* standing for revenue the order no longer has).
|
|
329
|
+
*/
|
|
330
|
+
export interface OrderStatusCancelCreditNote {
|
|
331
|
+
/** The `InvoiceCorrectionLedger` to correct the invoice on: `RETAIL` or `AR`. */
|
|
332
|
+
ledger: 'RETAIL' | 'AR' | (string & {});
|
|
333
|
+
/**
|
|
334
|
+
* What to do first. `CORRECT_INVOICE`: correct this invoice (credited in
|
|
335
|
+
* full; a `RETAIL` correction refunds along). `REFUND_PAYMENT`: refund the
|
|
336
|
+
* order's settled payment first (`payments.refund`): on an AR-invoiced
|
|
337
|
+
* order the refund issues the AR credit note that corrects the invoice, and
|
|
338
|
+
* correcting the invoice as well would credit the customer twice.
|
|
339
|
+
*/
|
|
340
|
+
remedy: 'CORRECT_INVOICE' | 'REFUND_PAYMENT' | (string & {});
|
|
341
|
+
invoiceId: string;
|
|
342
|
+
invoiceNumber: string;
|
|
343
|
+
/**
|
|
344
|
+
* What the invoice still bills the order for, in minor units of
|
|
345
|
+
* `currencyCode`: its total (on `AR`, the order's share) less its credit
|
|
346
|
+
* notes.
|
|
347
|
+
*/
|
|
348
|
+
uncredited: number;
|
|
349
|
+
/**
|
|
350
|
+
* What the order still holds, in minor units of `currencyCode`: its settled
|
|
351
|
+
* payments less what went back, or the receipts on its live
|
|
352
|
+
* accounts-receivable invoices, whichever is larger (a collected direct
|
|
353
|
+
* debit records the same money on both).
|
|
354
|
+
*/
|
|
355
|
+
held: number;
|
|
356
|
+
/** The order's currency. */
|
|
357
|
+
currencyCode: string;
|
|
358
|
+
}
|
|
359
|
+
export declare const ORDER_STATUS_QUERY = "\n query OrderStatus($orderId: ID!) {\n orderStatus(orderId: $orderId) {\n orderId\n state\n lifecycle {\n status\n payment\n fulfillment\n return\n }\n lock {\n locked\n reason\n lockingInvoice {\n id\n number\n voided\n ledger\n }\n }\n editBlock {\n code\n message\n }\n modifiable\n deletable\n releasableUnits\n releaseAllowed\n allocationBadge\n fulfillmentCorrection {\n blocked\n code\n }\n sourceFulfilled\n sourceFulfilledReason\n park {\n reason\n }\n hold {\n forReview\n byApp\n }\n providerFallbacks {\n kind\n installationId\n reason\n since\n }\n cancelCreditNote {\n ledger\n remedy\n invoiceId\n invoiceNumber\n uncredited\n held\n currencyCode\n }\n nextStates\n actions {\n action\n eligible\n allowed\n reasonCode\n }\n }\n }\n";
|
|
220
360
|
export interface OrderStatusModule {
|
|
221
361
|
/**
|
|
222
362
|
* Why the order is the way it is, and the actions open to this caller.
|
|
@@ -227,8 +367,14 @@ export interface OrderStatusModule {
|
|
|
227
367
|
* the ORDER allows it (`eligible`) and whether THIS caller may take it now
|
|
228
368
|
* (`allowed`), so a head can show an action greyed out with its reason.
|
|
229
369
|
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
370
|
+
* An order a live accounts-receivable invoice bills is invoice-locked like a
|
|
371
|
+
* retail-invoiced one (`INVOICE_LOCKED`, `lock.lockingInvoice.ledger: 'AR'`).
|
|
372
|
+
*
|
|
373
|
+
* Needs an engine that serves `orderStatus` with `cancelCreditNote`,
|
|
374
|
+
* `lock.lockingInvoice.ledger` and `sourceFulfilledReason`; against an older
|
|
375
|
+
* one this call fails validation and nothing else does.
|
|
376
|
+
*
|
|
377
|
+
* @effect read
|
|
232
378
|
*/
|
|
233
379
|
status(orderId: string, options?: Call): Promise<OrderStatusView>;
|
|
234
380
|
}
|
package/dist/orders/status.js
CHANGED
|
@@ -14,6 +14,12 @@ export const ORDER_STATUS_ACTIONS = [
|
|
|
14
14
|
'TRANSITION',
|
|
15
15
|
'MARK_COMPLETED',
|
|
16
16
|
'REOPEN',
|
|
17
|
+
'SET_PAYMENT_NOT_REQUIRED',
|
|
18
|
+
'SET_FULFILLMENT_HOLD',
|
|
19
|
+
'SET_GOODWILL_ROUNDING',
|
|
20
|
+
'SET_BILLING_FIELDS',
|
|
21
|
+
'APPLY_GOODWILL_ROUNDING',
|
|
22
|
+
'SET_PRICING_FIELDS',
|
|
17
23
|
];
|
|
18
24
|
/** Why an action is not allowed, in the order the engine lists them. */
|
|
19
25
|
export const ORDER_STATUS_REASON_CODES = [
|
|
@@ -27,6 +33,10 @@ export const ORDER_STATUS_REASON_CODES = [
|
|
|
27
33
|
'SHOPPER_CART',
|
|
28
34
|
'UNITS_SHIPPED',
|
|
29
35
|
'ACTIVE_FULFILLMENT',
|
|
36
|
+
'CREDIT_NOTE_REQUIRED',
|
|
37
|
+
'HOLDS_MONEY',
|
|
38
|
+
'ERP_LOCKED',
|
|
39
|
+
'LEAVES_MONEY_OVER',
|
|
30
40
|
'PERMISSION',
|
|
31
41
|
];
|
|
32
42
|
export const ORDER_STATUS_QUERY = /* GraphQL */ `
|
|
@@ -47,6 +57,7 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
|
|
|
47
57
|
id
|
|
48
58
|
number
|
|
49
59
|
voided
|
|
60
|
+
ledger
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
editBlock {
|
|
@@ -63,6 +74,7 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
|
|
|
63
74
|
code
|
|
64
75
|
}
|
|
65
76
|
sourceFulfilled
|
|
77
|
+
sourceFulfilledReason
|
|
66
78
|
park {
|
|
67
79
|
reason
|
|
68
80
|
}
|
|
@@ -76,6 +88,15 @@ export const ORDER_STATUS_QUERY = /* GraphQL */ `
|
|
|
76
88
|
reason
|
|
77
89
|
since
|
|
78
90
|
}
|
|
91
|
+
cancelCreditNote {
|
|
92
|
+
ledger
|
|
93
|
+
remedy
|
|
94
|
+
invoiceId
|
|
95
|
+
invoiceNumber
|
|
96
|
+
uncredited
|
|
97
|
+
held
|
|
98
|
+
currencyCode
|
|
99
|
+
}
|
|
79
100
|
nextStates
|
|
80
101
|
actions {
|
|
81
102
|
action
|
|
@@ -133,6 +133,13 @@ export interface OverpaymentOption {
|
|
|
133
133
|
available: boolean;
|
|
134
134
|
code: string | null;
|
|
135
135
|
message: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* On an `accountCredit` option: where "credit the customer" lands in this store, its ONE
|
|
138
|
+
* customer-credit book. `AR` (unapplied cash on the AR ledger), `STORE_CREDIT` (the customer's
|
|
139
|
+
* store-credit wallet) or `NONE` (neither: the option is closed). Null on the other options and
|
|
140
|
+
* from an engine before it.
|
|
141
|
+
*/
|
|
142
|
+
book?: string | null;
|
|
136
143
|
}
|
|
137
144
|
/** What a surcharge change would do to an order's money. Nothing was saved. */
|
|
138
145
|
export interface SurchargeChangePreview {
|
|
@@ -190,5 +197,5 @@ export declare const UPDATE_ORDER_SURCHARGE_MUTATION = "\n mutation UpdateOrder
|
|
|
190
197
|
export declare const UPDATE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = "\n mutation UpdateOrderSurchargeWithOverpayment(\n $orderId: ID!\n $surchargeId: ID!\n $input: SurchargeInput!\n $taxClass: String\n $idempotencyKey: String\n $overpayment: OrderOverpaymentChoice\n ) {\n updateOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n input: $input\n taxClass: $taxClass\n idempotencyKey: $idempotencyKey\n overpayment: $overpayment\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
|
|
191
198
|
export declare const REMOVE_ORDER_SURCHARGE_MUTATION = "\n mutation RemoveOrderSurcharge($orderId: ID!, $surchargeId: ID!, $idempotencyKey: String) {\n removeOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n idempotencyKey: $idempotencyKey\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
|
|
192
199
|
export declare const REMOVE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = "\n mutation RemoveOrderSurchargeWithOverpayment(\n $orderId: ID!\n $surchargeId: ID!\n $idempotencyKey: String\n $overpayment: OrderOverpaymentChoice\n ) {\n removeOrderSurcharge(\n orderId: $orderId\n surchargeId: $surchargeId\n idempotencyKey: $idempotencyKey\n overpayment: $overpayment\n ) {\n \n id\n code\n currencyCode\n total\n totalWithTax\n surcharges {\n id\n description\n sku\n price\n priceWithTax\n taxRate\n }\n\n }\n }\n";
|
|
193
|
-
export declare const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = "\n query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {\n previewOrderSurchargeChange(orderId: $orderId, change: $change) {\n currencyCode\n totalBefore\n totalAfter\n overpayment {\n amount\n currencyCode\n refund { available code message }\n accountCredit { available code message }\n }\n }\n }\n";
|
|
200
|
+
export declare const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = "\n query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {\n previewOrderSurchargeChange(orderId: $orderId, change: $change) {\n currencyCode\n totalBefore\n totalAfter\n overpayment {\n amount\n currencyCode\n refund { available code message book }\n accountCredit { available code message book }\n }\n }\n }\n";
|
|
194
201
|
export declare function createSurchargesModule(transport: Transport): SurchargesModule;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { storeCreditAware } from '../payments/store-credit-fields.js';
|
|
1
2
|
const SURCHARGED_ORDER_FIELDS = /* GraphQL */ `
|
|
2
3
|
id
|
|
3
4
|
code
|
|
@@ -120,7 +121,7 @@ export const REMOVE_ORDER_SURCHARGE_WITH_OVERPAYMENT_MUTATION = /* GraphQL */ `
|
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
`;
|
|
123
|
-
const OVERPAYMENT_OPTION_FIELDS = 'available code message';
|
|
124
|
+
const OVERPAYMENT_OPTION_FIELDS = 'available code message book';
|
|
124
125
|
export const PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY = /* GraphQL */ `
|
|
125
126
|
query PreviewOrderSurchargeChange($orderId: ID!, $change: OrderSurchargeChangeInput!) {
|
|
126
127
|
previewOrderSurchargeChange(orderId: $orderId, change: $change) {
|
|
@@ -202,7 +203,7 @@ export function createSurchargesModule(transport) {
|
|
|
202
203
|
},
|
|
203
204
|
async preview(orderId, change, options) {
|
|
204
205
|
const taxClass = taxClassVariable(options);
|
|
205
|
-
const data = await transport.graphql({
|
|
206
|
+
const data = await storeCreditAware(transport).graphql({
|
|
206
207
|
api: 'admin',
|
|
207
208
|
query: PREVIEW_ORDER_SURCHARGE_CHANGE_QUERY,
|
|
208
209
|
variables: {
|
|
@@ -33,6 +33,19 @@ export interface UnappliedCash {
|
|
|
33
33
|
/** ISO-8601 with offset. */
|
|
34
34
|
createdAt: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Money of an order's settled payments moved to the customer's store-credit wallet instead of a
|
|
38
|
+
* refund: one never-expiring ledger entry per payment it came from. Minor units of
|
|
39
|
+
* `currencyCode`, the order's own currency.
|
|
40
|
+
*/
|
|
41
|
+
export interface StoreCreditMove {
|
|
42
|
+
/** The customer's store-credit wallet (a stored-value account of kind `store_credit`). */
|
|
43
|
+
accountId: string;
|
|
44
|
+
amount: number;
|
|
45
|
+
currencyCode: string;
|
|
46
|
+
/** The ledger entries, one per payment the money came from. */
|
|
47
|
+
entryIds: string[];
|
|
48
|
+
}
|
|
36
49
|
export interface CreditOverpaymentInput {
|
|
37
50
|
orderId: string;
|
|
38
51
|
/**
|
|
@@ -123,6 +136,22 @@ export interface AccountCreditModule {
|
|
|
123
136
|
* account refusals above.
|
|
124
137
|
*/
|
|
125
138
|
creditOverpayment(input: CreditOverpaymentInput, options?: Call): Promise<UnappliedCash[]>;
|
|
139
|
+
/**
|
|
140
|
+
* The store-credit sibling of {@link creditOverpayment}, for a store whose customer-credit book
|
|
141
|
+
* is store credit (`storedValue.storeCreditSettings`): what the order holds over its bill moves
|
|
142
|
+
* to the customer's store-credit wallet, in the order's currency, one ledger entry per payment
|
|
143
|
+
* it came from. Same bounds and `ACCOUNT_CREDIT_*` refusals; an AR store is refused
|
|
144
|
+
* `STORE_CREDIT_STORE_KEEPS_ACCOUNTS` (use {@link creditOverpayment} there), a store without
|
|
145
|
+
* store credit `STORE_CREDIT_NOT_ENABLED` / `_NOT_GRANTED` / `_METHOD_REQUIRED`. A gift card's or
|
|
146
|
+
* store credit's payment is never moved (`STORE_CREDIT_STORED_VALUE_REFUND_INSTEAD`: refund it),
|
|
147
|
+
* and the customer must be reachable (`STORE_CREDIT_CUSTOMER_ANONYMOUS`,
|
|
148
|
+
* `STORED_VALUE_ACCOUNT_BLOCKED`). The overpayment is what the order's payments hold over what
|
|
149
|
+
* it BILLS, the larger of its total and its live invoices', as a plain refund of an invoiced order
|
|
150
|
+
* measures it. From then on that money is no longer the order's: `payments.refundPosition` takes
|
|
151
|
+
* it off `refundable` and `payments.position` no longer reports it as `overpaid`. Needs an
|
|
152
|
+
* engine with incentives sprint 8 PR 3.
|
|
153
|
+
*/
|
|
154
|
+
creditOverpaymentToStoreCredit(input: CreditOverpaymentInput, options?: Call): Promise<StoreCreditMove>;
|
|
126
155
|
/** A customer's unapplied cash in this store, oldest first. */
|
|
127
156
|
list(customerId: string, options?: Call): Promise<UnappliedCash[]>;
|
|
128
157
|
/**
|
|
@@ -159,6 +188,7 @@ export interface AccountCreditModule {
|
|
|
159
188
|
onOrder(orderId: string, options?: Call): Promise<OrderMoneyOnAccount>;
|
|
160
189
|
}
|
|
161
190
|
export declare const CREDIT_ORDER_OVERPAYMENT_MUTATION = "\n mutation CreditOrderOverpaymentToAccount(\n $input: CreditOrderOverpaymentInput!\n $idempotencyKey: String\n ) {\n creditOrderOverpaymentToAccount(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
|
|
191
|
+
export declare const CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION = "\n mutation CreditOrderOverpaymentToStoreCredit(\n $input: CreditOrderOverpaymentInput!\n $idempotencyKey: String\n ) {\n creditOrderOverpaymentToStoreCredit(input: $input, idempotencyKey: $idempotencyKey) {\n accountId amount currencyCode entryIds\n }\n }\n";
|
|
162
192
|
export declare const UNAPPLIED_CASH_QUERY = "\n query ArUnappliedCash($customerId: ID!) {\n arUnappliedCash(customerId: $customerId) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
|
|
163
193
|
export declare const APPLY_UNAPPLIED_CASH_MUTATION = "\n mutation ApplyArUnappliedCash($input: ApplyArUnappliedCashInput!, $idempotencyKey: String) {\n applyArUnappliedCash(input: $input, idempotencyKey: $idempotencyKey) {\n \n id\n customerId\n currencyCode\n amount\n applied\n refunded\n remaining\n orderId\n paymentId\n receivedOn\n reference\n notes\n createdAt\n\n }\n }\n";
|
|
164
194
|
export declare const REFUND_UNAPPLIED_CASH_MUTATION = "\n mutation RefundArUnappliedCash($input: RefundArUnappliedCashInput!, $idempotencyKey: String) {\n refundArUnappliedCash(input: $input, idempotencyKey: $idempotencyKey) {\n id\n total\n state\n method\n transactionId\n reason\n }\n }\n";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { STORE_CREDIT_MOVE_FIELDS } from './store-credit-fields.js';
|
|
1
2
|
const UNAPPLIED_CASH_FIELDS = /* GraphQL */ `
|
|
2
3
|
id
|
|
3
4
|
customerId
|
|
@@ -23,6 +24,16 @@ export const CREDIT_ORDER_OVERPAYMENT_MUTATION = /* GraphQL */ `
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
`;
|
|
27
|
+
export const CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION = /* GraphQL */ `
|
|
28
|
+
mutation CreditOrderOverpaymentToStoreCredit(
|
|
29
|
+
$input: CreditOrderOverpaymentInput!
|
|
30
|
+
$idempotencyKey: String
|
|
31
|
+
) {
|
|
32
|
+
creditOrderOverpaymentToStoreCredit(input: $input, idempotencyKey: $idempotencyKey) {
|
|
33
|
+
${STORE_CREDIT_MOVE_FIELDS}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
26
37
|
export const UNAPPLIED_CASH_QUERY = /* GraphQL */ `
|
|
27
38
|
query ArUnappliedCash($customerId: ID!) {
|
|
28
39
|
arUnappliedCash(customerId: $customerId) {
|
|
@@ -79,6 +90,14 @@ export function createAccountCreditModule(transport) {
|
|
|
79
90
|
}, options);
|
|
80
91
|
return data.creditOrderOverpaymentToAccount;
|
|
81
92
|
},
|
|
93
|
+
async creditOverpaymentToStoreCredit(input, options) {
|
|
94
|
+
const data = await transport.graphql({
|
|
95
|
+
api: 'admin',
|
|
96
|
+
query: CREDIT_ORDER_OVERPAYMENT_TO_STORE_CREDIT_MUTATION,
|
|
97
|
+
variables: { input, idempotencyKey: options?.idempotencyKey },
|
|
98
|
+
}, options);
|
|
99
|
+
return data.creditOrderOverpaymentToStoreCredit;
|
|
100
|
+
},
|
|
82
101
|
async list(customerId, options) {
|
|
83
102
|
const data = await transport.graphql({ api: 'admin', query: UNAPPLIED_CASH_QUERY, variables: { customerId } }, options);
|
|
84
103
|
return data.arUnappliedCash;
|