@sixtyninecommerce/admin 0.10.0 → 0.12.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 +5772 -118
- package/dist/auth/index.d.ts +7 -1
- package/dist/auth/index.js +8 -1
- 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/documents.d.ts +142 -0
- package/dist/catalog/documents.js +114 -0
- package/dist/catalog/index.d.ts +54 -6
- package/dist/catalog/index.js +10 -1
- package/dist/catalog/metadata.d.ts +244 -0
- package/dist/catalog/metadata.js +220 -0
- package/dist/catalog/products.d.ts +159 -19
- package/dist/catalog/products.js +88 -13
- package/dist/catalog/properties.d.ts +140 -14
- package/dist/catalog/properties.js +65 -1
- package/dist/catalog/recommendations.d.ts +288 -0
- package/dist/catalog/recommendations.js +237 -0
- package/dist/catalog/reviews.d.ts +381 -0
- package/dist/catalog/reviews.js +325 -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 +293 -26
- package/dist/catalog/variants.js +164 -7
- package/dist/catalog/visibility.d.ts +38 -7
- package/dist/catalog/visibility.js +19 -1
- package/dist/client.d.ts +121 -9
- package/dist/client.js +53 -14
- package/dist/content/assets.d.ts +285 -0
- package/dist/content/assets.js +181 -0
- package/dist/content/forms.d.ts +332 -1
- package/dist/content/forms.js +140 -4
- package/dist/content/items.d.ts +292 -0
- package/dist/content/items.js +170 -0
- 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/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/delivery-terms.d.ts +44 -0
- package/dist/customers/delivery-terms.js +32 -0
- package/dist/customers/groups.d.ts +207 -0
- package/dist/customers/groups.js +438 -0
- package/dist/customers/index.d.ts +462 -37
- package/dist/customers/index.js +317 -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/emails.d.ts +150 -0
- package/dist/documents/emails.js +220 -0
- package/dist/documents/index.d.ts +744 -21
- package/dist/documents/index.js +438 -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 +163 -11
- package/dist/fulfillments/index.js +135 -6
- 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 +147 -39
- package/dist/index.js +51 -12
- 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 +965 -0
- package/dist/integrations/exact-online-types.js +6 -0
- package/dist/integrations/exact-online.d.ts +784 -0
- package/dist/integrations/exact-online.js +1089 -0
- package/dist/integrations/index.d.ts +44 -3
- package/dist/integrations/index.js +23 -3
- package/dist/integrations/pipeline-discoveries.d.ts +65 -0
- package/dist/integrations/pipeline-discoveries.js +65 -0
- package/dist/integrations/pipeline-keys.d.ts +13 -0
- package/dist/integrations/pipeline-keys.js +22 -0
- package/dist/integrations/pipeline-runs.d.ts +119 -0
- package/dist/integrations/pipeline-runs.js +87 -0
- package/dist/integrations/pipelines.d.ts +87 -15
- package/dist/integrations/pipelines.js +41 -22
- package/dist/integrations/price-import.d.ts +223 -0
- package/dist/integrations/price-import.js +124 -0
- package/dist/integrations/types.d.ts +367 -3
- package/dist/integrations/types.js +4 -3
- package/dist/locations/index.d.ts +66 -0
- package/dist/locations/index.js +31 -0
- package/dist/meta/index.d.ts +172 -0
- package/dist/metafields/index.d.ts +8 -1
- package/dist/metafields/index.js +10 -0
- package/dist/orders/cancel-with-money.d.ts +237 -0
- package/dist/orders/cancel-with-money.js +155 -0
- package/dist/orders/commit-edit.d.ts +23 -1
- package/dist/orders/commit-edit.js +19 -2
- package/dist/orders/deposit-policy.d.ts +3 -1
- 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 +66 -15
- package/dist/orders/index.js +25 -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 +243 -0
- package/dist/orders/list.js +487 -0
- package/dist/orders/manual-discounts.d.ts +13 -5
- package/dist/orders/manual-pricing.d.ts +5 -0
- package/dist/orders/money-view.d.ts +149 -0
- package/dist/orders/money-view.js +99 -0
- package/dist/orders/order-entry.d.ts +20 -7
- package/dist/orders/plan-edit.d.ts +34 -2
- package/dist/orders/plan-edit.js +112 -11
- 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 +20 -1
- package/dist/orders/surcharges.js +37 -11
- package/dist/payments/account-credit.d.ts +46 -0
- package/dist/payments/account-credit.js +42 -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 +19 -0
- package/dist/payments/credit-noted-fields.js +69 -0
- package/dist/payments/customer-consent.d.ts +30 -0
- package/dist/payments/customer-consent.js +49 -0
- package/dist/payments/index.d.ts +340 -19
- package/dist/payments/index.js +151 -1
- package/dist/payments/methods.d.ts +303 -8
- package/dist/payments/methods.js +337 -7
- 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 +147 -0
- package/dist/payments/requests.js +93 -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 +106 -0
- package/dist/pickups/index.js +108 -0
- package/dist/platform/channels.d.ts +132 -0
- package/dist/platform/channels.js +128 -0
- package/dist/platform/email-gateways.d.ts +165 -0
- package/dist/platform/email-gateways.js +78 -0
- package/dist/platform/geo.d.ts +123 -0
- package/dist/platform/geo.js +144 -0
- package/dist/platform/tax.d.ts +162 -0
- package/dist/platform/tax.js +169 -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 +108 -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 +2370 -58
- package/dist/pos/index.js +854 -7
- package/dist/pos/no-receipt.d.ts +94 -0
- package/dist/pos/no-receipt.js +25 -0
- package/dist/pos/offline-sales.d.ts +228 -0
- package/dist/pos/offline-sales.js +170 -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 +244 -0
- package/dist/pos/returns.js +83 -0
- package/dist/pricing/bulk-coupons.d.ts +139 -0
- package/dist/pricing/bulk-coupons.js +112 -0
- package/dist/pricing/index.d.ts +174 -4
- package/dist/pricing/index.js +174 -1
- package/dist/pricing/price-lists.d.ts +606 -0
- package/dist/pricing/price-lists.js +600 -0
- package/dist/purchasing/alerts.d.ts +104 -0
- package/dist/purchasing/alerts.js +88 -0
- package/dist/purchasing/backorders.d.ts +61 -0
- package/dist/purchasing/backorders.js +92 -0
- package/dist/purchasing/cost.d.ts +110 -0
- package/dist/purchasing/cost.js +86 -0
- package/dist/purchasing/index.d.ts +54 -0
- package/dist/purchasing/index.js +24 -0
- package/dist/purchasing/links.d.ts +263 -0
- package/dist/purchasing/links.js +192 -0
- package/dist/purchasing/purchase-orders.d.ts +551 -0
- package/dist/purchasing/purchase-orders.js +491 -0
- package/dist/purchasing/receipts.d.ts +396 -0
- package/dist/purchasing/receipts.js +287 -0
- package/dist/purchasing/replenishment.d.ts +281 -0
- package/dist/purchasing/replenishment.js +240 -0
- package/dist/purchasing/returns.d.ts +273 -0
- package/dist/purchasing/returns.js +229 -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 +518 -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 +675 -21
- package/dist/returns/index.js +756 -11
- package/dist/search/index.d.ts +76 -1
- package/dist/search/index.js +63 -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/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 +54 -0
- package/dist/shipping/index.js +27 -0
- package/dist/shipping/methods.d.ts +205 -0
- package/dist/shipping/methods.js +240 -0
- package/dist/shipping/myparcel.d.ts +668 -0
- package/dist/shipping/myparcel.js +466 -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 +324 -0
- package/dist/shipping/rate-tables.js +390 -0
- 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 +18 -4
- package/dist/stock/index.js +7 -0
- package/dist/stock/locations.d.ts +144 -0
- package/dist/stock/locations.js +168 -0
- package/dist/stock/settings.d.ts +106 -0
- package/dist/stock/settings.js +103 -0
- package/dist/stock/transfers.d.ts +386 -52
- package/dist/stock/transfers.js +222 -17
- package/dist/stored-value/index.d.ts +312 -11
- package/dist/stored-value/index.js +223 -4
- package/dist/subscriptions/index.d.ts +682 -0
- package/dist/subscriptions/index.js +815 -0
- package/dist/tax/display-policy.d.ts +105 -0
- package/dist/tax/display-policy.js +84 -0
- package/dist/tax/index.d.ts +79 -1
- package/dist/tax/index.js +52 -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 +287 -0
- package/dist/tenant/email-templates.js +271 -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 +50 -3
- 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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Pay by link at the till (engine C5, row 41): the till asks the customer to pay part or all of an
|
|
5
|
+
* open till sale through a link (shown as a QR code), which opens the store's online checkout on
|
|
6
|
+
* the customer's phone. The payment provider's webhook records the money on the sale; none of
|
|
7
|
+
* these calls does. While a link is open its amount is held back from every other tender
|
|
8
|
+
* (`outstanding` leaves it out) and the sale's money cannot change. Off until the store switches
|
|
9
|
+
* it on and picks the hosted payment method customers pay with.
|
|
10
|
+
*
|
|
11
|
+
* A headless till is a supported caller of every till money door: the link create is keyed like a
|
|
12
|
+
* tender (`idempotencyKey`), its check and cancel take no key (they read the state and are safe to
|
|
13
|
+
* repeat). An engine before C5 answers every call `GRAPHQL_VALIDATION_FAILED`.
|
|
14
|
+
*/
|
|
15
|
+
/** A link's life in minutes (the store's policy). */
|
|
16
|
+
export declare const POS_PAY_BY_LINK_EXPIRY_MINUTES: {
|
|
17
|
+
readonly min: 5;
|
|
18
|
+
readonly max: 120;
|
|
19
|
+
readonly default: 30;
|
|
20
|
+
};
|
|
21
|
+
export interface PosPayByLinkPolicy {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
/** The code of the store's hosted payment method a link opens; null until chosen. */
|
|
24
|
+
methodCode: string | null;
|
|
25
|
+
/** 5-120; 30 by default. */
|
|
26
|
+
expiryMinutes: number;
|
|
27
|
+
}
|
|
28
|
+
export interface PosPayByLinkPolicyInput {
|
|
29
|
+
/** Omitted keeps the stored value. Switching on needs a method. */
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
methodCode?: string;
|
|
32
|
+
expiryMinutes?: number;
|
|
33
|
+
}
|
|
34
|
+
/** Whether the till may offer pay by link for a sale. */
|
|
35
|
+
export interface PosPayByLinkOptions {
|
|
36
|
+
available: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Why not: `OFF`, `NO_METHOD`, `METHOD_UNUSABLE`, `NO_RETURN_PAGE`, `NOT_ENTITLED`,
|
|
39
|
+
* `NOT_CONFIGURED`; more may come. Null when available.
|
|
40
|
+
*/
|
|
41
|
+
reason: string | null;
|
|
42
|
+
methodName: string | null;
|
|
43
|
+
expiryMinutes: number;
|
|
44
|
+
}
|
|
45
|
+
export interface PosPaymentRequest {
|
|
46
|
+
id: string;
|
|
47
|
+
amount: number;
|
|
48
|
+
currencyCode: string;
|
|
49
|
+
/** `OPEN`, `PAID`, `EXPIRED` or `CANCELLED`; more may come. */
|
|
50
|
+
status: string;
|
|
51
|
+
closeReason: string | null;
|
|
52
|
+
/** The link to show as a QR code; null once it is closed. A bearer link: never log it. */
|
|
53
|
+
url: string | null;
|
|
54
|
+
expiresAt: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
/** How many checkouts the customer opened with it. */
|
|
57
|
+
attemptCount: number;
|
|
58
|
+
paymentId: string | null;
|
|
59
|
+
}
|
|
60
|
+
/** The sale's money with its links (`PosTenderState`), integer minor units. */
|
|
61
|
+
export interface PosLinkTenderState {
|
|
62
|
+
orderId: string;
|
|
63
|
+
total: number;
|
|
64
|
+
settled: number;
|
|
65
|
+
pending: number;
|
|
66
|
+
/** What the OPEN links ask for, already left out of `outstanding`. */
|
|
67
|
+
requested: number;
|
|
68
|
+
/** What a new tender may take: total − settled − pending − requested, at least 0. */
|
|
69
|
+
outstanding: number;
|
|
70
|
+
covered: boolean;
|
|
71
|
+
paymentRequests: PosPaymentRequest[];
|
|
72
|
+
}
|
|
73
|
+
export interface PosPaymentRequestResult {
|
|
74
|
+
request: PosPaymentRequest;
|
|
75
|
+
tenderState: PosLinkTenderState;
|
|
76
|
+
}
|
|
77
|
+
export interface PosPaymentRequestOutcomeResult {
|
|
78
|
+
requestId: string;
|
|
79
|
+
/** `paid`, `pending`, `cancelled` or `unknown`; treat one you do not know as `unknown`. */
|
|
80
|
+
outcome: string;
|
|
81
|
+
/**
|
|
82
|
+
* Why, when pending, unknown or forced: `POS_PAYMENT_REQUEST_WAITING`, `…_CHECKOUT_OPEN`,
|
|
83
|
+
* `…_PAID_LANDING`, `…_PROVIDER_UNREACHABLE`, `…_FORCED`. Null otherwise.
|
|
84
|
+
*/
|
|
85
|
+
reasonCode: string | null;
|
|
86
|
+
tenderState: PosLinkTenderState;
|
|
87
|
+
}
|
|
88
|
+
/** A till call's cashier: a paired DEVICE's PIN session; a machine principal omits it. */
|
|
89
|
+
type TillCall = Call & {
|
|
90
|
+
staffToken?: string;
|
|
91
|
+
};
|
|
92
|
+
export interface PosPayByLinkModule {
|
|
93
|
+
/** The store's policy. Needs `UpdateSettings` or `ManagePosDevices`. */
|
|
94
|
+
policy(options?: Call): Promise<PosPayByLinkPolicy>;
|
|
95
|
+
/**
|
|
96
|
+
* Set it (omitted fields keep their value). Needs `UpdateSettings`. Refusals:
|
|
97
|
+
* `POS_PAY_BY_LINK_POLICY_INVALID` (`field`: `expiryMinutes` outside 5-120, a blank `methodCode`,
|
|
98
|
+
* or switched on with no method), `POS_PAY_BY_LINK_METHOD_UNUSABLE` (`reason`: switched on with a
|
|
99
|
+
* method that cannot open an online checkout here), `ORGANIZATION_WORKSPACE_NOT_A_STORE`.
|
|
100
|
+
*/
|
|
101
|
+
setPolicy(input: PosPayByLinkPolicyInput, options?: Call): Promise<PosPayByLinkPolicy>;
|
|
102
|
+
/** Whether a link may be offered for this sale, and why not. Read only. */
|
|
103
|
+
options(orderId: string, options?: Call): Promise<PosPayByLinkOptions>;
|
|
104
|
+
/**
|
|
105
|
+
* Open a link for `amount` (at most what the sale still owes) on an open till sale; readies it
|
|
106
|
+
* for payment. Keyed: a repeat with the same `idempotencyKey` answers the same link. Refusals:
|
|
107
|
+
* `POS_PAY_BY_LINK_UNAVAILABLE` (`reason`), `POS_PAY_BY_LINK_TILL_CART_ONLY` (an order no till
|
|
108
|
+
* opened: send a link from the back office), `POS_PAYMENT_REQUEST_OPEN` (one open link per sale),
|
|
109
|
+
* `POS_TENDER_EXCEEDS_OUTSTANDING` (`requested`).
|
|
110
|
+
*/
|
|
111
|
+
request(input: {
|
|
112
|
+
orderId: string;
|
|
113
|
+
amount: number;
|
|
114
|
+
}, options: TillCall & {
|
|
115
|
+
idempotencyKey: string;
|
|
116
|
+
}): Promise<PosPaymentRequestResult>;
|
|
117
|
+
/** How a link is doing; never records money. Refused `POS_PAYMENT_REQUEST_NOT_FOUND`. */
|
|
118
|
+
check(input: {
|
|
119
|
+
orderId: string;
|
|
120
|
+
requestId: string;
|
|
121
|
+
}, options?: TillCall): Promise<PosPaymentRequestOutcomeResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Close a link: only when no checkout of the customer's can still pay, else it answers pending or
|
|
124
|
+
* unknown and stays open. `force` closes it anyway and needs a manager: a manager's own
|
|
125
|
+
* `staffToken` or a manager's `approvalToken` (`POS_MANAGER_REQUIRED` otherwise); a payment that
|
|
126
|
+
* lands afterwards is recorded on the sale and refunded like any other.
|
|
127
|
+
*/
|
|
128
|
+
cancel(input: {
|
|
129
|
+
orderId: string;
|
|
130
|
+
requestId: string;
|
|
131
|
+
force?: boolean;
|
|
132
|
+
}, options?: TillCall & {
|
|
133
|
+
approvalToken?: string;
|
|
134
|
+
}): Promise<PosPaymentRequestOutcomeResult>;
|
|
135
|
+
}
|
|
136
|
+
export declare const POS_PAY_BY_LINK_POLICY_QUERY = "query PosPayByLinkPolicy { posPayByLinkPolicy { enabled methodCode expiryMinutes } }";
|
|
137
|
+
export declare const SET_POS_PAY_BY_LINK_POLICY_MUTATION = "mutation SetPosPayByLinkPolicy($input: PosPayByLinkPolicyInput!) { setPosPayByLinkPolicy(input: $input) { enabled methodCode expiryMinutes } }";
|
|
138
|
+
export declare const POS_PAY_BY_LINK_OPTIONS_QUERY = "query PosPayByLinkOptions($orderId: ID!) { posPayByLinkOptions(orderId: $orderId) { available reason methodName expiryMinutes } }";
|
|
139
|
+
export declare const POS_REQUEST_PAYMENT_MUTATION = "mutation PosRequestPayment($input: PosRequestPaymentInput!, $staffToken: String) { posRequestPayment(input: $input, staffToken: $staffToken) { request { id amount currencyCode status closeReason url expiresAt createdAt attemptCount paymentId } tenderState { orderId total settled pending requested outstanding covered paymentRequests { id amount currencyCode status closeReason url expiresAt createdAt attemptCount paymentId } } } }";
|
|
140
|
+
export declare const POS_CHECK_PAYMENT_REQUEST_MUTATION = "mutation PosCheckPaymentRequest($input: PosPaymentRequestInput!, $staffToken: String) { posCheckPaymentRequest(input: $input, staffToken: $staffToken) { requestId outcome reasonCode tenderState { orderId total settled pending requested outstanding covered paymentRequests { id amount currencyCode status closeReason url expiresAt createdAt attemptCount paymentId } } } }";
|
|
141
|
+
export declare const POS_CANCEL_PAYMENT_REQUEST_MUTATION = "mutation PosCancelPaymentRequest($input: PosCancelPaymentRequestInput!, $staffToken: String, $approvalToken: String) { posCancelPaymentRequest(input: $input, staffToken: $staffToken, approvalToken: $approvalToken) { requestId outcome reasonCode tenderState { orderId total settled pending requested outstanding covered paymentRequests { id amount currencyCode status closeReason url expiresAt createdAt attemptCount paymentId } } } }";
|
|
142
|
+
export declare function createPosPayByLinkModule(transport: Transport): PosPayByLinkModule;
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pay by link at the till (engine C5, row 41): the till asks the customer to pay part or all of an
|
|
3
|
+
* open till sale through a link (shown as a QR code), which opens the store's online checkout on
|
|
4
|
+
* the customer's phone. The payment provider's webhook records the money on the sale; none of
|
|
5
|
+
* these calls does. While a link is open its amount is held back from every other tender
|
|
6
|
+
* (`outstanding` leaves it out) and the sale's money cannot change. Off until the store switches
|
|
7
|
+
* it on and picks the hosted payment method customers pay with.
|
|
8
|
+
*
|
|
9
|
+
* A headless till is a supported caller of every till money door: the link create is keyed like a
|
|
10
|
+
* tender (`idempotencyKey`), its check and cancel take no key (they read the state and are safe to
|
|
11
|
+
* repeat). An engine before C5 answers every call `GRAPHQL_VALIDATION_FAILED`.
|
|
12
|
+
*/
|
|
13
|
+
/** A link's life in minutes (the store's policy). */
|
|
14
|
+
export const POS_PAY_BY_LINK_EXPIRY_MINUTES = { min: 5, max: 120, default: 30 };
|
|
15
|
+
const POLICY_FIELDS = 'enabled methodCode expiryMinutes';
|
|
16
|
+
const REQUEST_FIELDS = 'id amount currencyCode status closeReason url expiresAt createdAt attemptCount paymentId';
|
|
17
|
+
const STATE_FIELDS = `orderId total settled pending requested outstanding covered paymentRequests { ${REQUEST_FIELDS} }`;
|
|
18
|
+
const OUTCOME_FIELDS = `requestId outcome reasonCode tenderState { ${STATE_FIELDS} }`;
|
|
19
|
+
export const POS_PAY_BY_LINK_POLICY_QUERY = `query PosPayByLinkPolicy { posPayByLinkPolicy { ${POLICY_FIELDS} } }`;
|
|
20
|
+
export const SET_POS_PAY_BY_LINK_POLICY_MUTATION = `mutation SetPosPayByLinkPolicy($input: PosPayByLinkPolicyInput!) { setPosPayByLinkPolicy(input: $input) { ${POLICY_FIELDS} } }`;
|
|
21
|
+
export const POS_PAY_BY_LINK_OPTIONS_QUERY = 'query PosPayByLinkOptions($orderId: ID!) { posPayByLinkOptions(orderId: $orderId) { available reason methodName expiryMinutes } }';
|
|
22
|
+
export const POS_REQUEST_PAYMENT_MUTATION = `mutation PosRequestPayment($input: PosRequestPaymentInput!, $staffToken: String) { posRequestPayment(input: $input, staffToken: $staffToken) { request { ${REQUEST_FIELDS} } tenderState { ${STATE_FIELDS} } } }`;
|
|
23
|
+
export const POS_CHECK_PAYMENT_REQUEST_MUTATION = `mutation PosCheckPaymentRequest($input: PosPaymentRequestInput!, $staffToken: String) { posCheckPaymentRequest(input: $input, staffToken: $staffToken) { ${OUTCOME_FIELDS} } }`;
|
|
24
|
+
export const POS_CANCEL_PAYMENT_REQUEST_MUTATION = `mutation PosCancelPaymentRequest($input: PosCancelPaymentRequestInput!, $staffToken: String, $approvalToken: String) { posCancelPaymentRequest(input: $input, staffToken: $staffToken, approvalToken: $approvalToken) { ${OUTCOME_FIELDS} } }`;
|
|
25
|
+
export function createPosPayByLinkModule(transport) {
|
|
26
|
+
const gql = async (query, variables, options) => transport.graphql({ api: 'admin', query, variables }, options);
|
|
27
|
+
return {
|
|
28
|
+
async policy(options) {
|
|
29
|
+
const data = await gql(POS_PAY_BY_LINK_POLICY_QUERY, {}, options);
|
|
30
|
+
return data.posPayByLinkPolicy;
|
|
31
|
+
},
|
|
32
|
+
async setPolicy(input, options) {
|
|
33
|
+
const data = await gql(SET_POS_PAY_BY_LINK_POLICY_MUTATION, { input }, options);
|
|
34
|
+
return data.setPosPayByLinkPolicy;
|
|
35
|
+
},
|
|
36
|
+
async options(orderId, options) {
|
|
37
|
+
const data = await gql(POS_PAY_BY_LINK_OPTIONS_QUERY, { orderId }, options);
|
|
38
|
+
return data.posPayByLinkOptions;
|
|
39
|
+
},
|
|
40
|
+
async request(input, options) {
|
|
41
|
+
const key = options?.idempotencyKey;
|
|
42
|
+
if (typeof key !== 'string' || key.trim() === '') {
|
|
43
|
+
throw new TypeError('payByLink.request needs options.idempotencyKey (a fresh UUIDv7 per link; resend it only to retry the same link).');
|
|
44
|
+
}
|
|
45
|
+
const data = await gql(POS_REQUEST_PAYMENT_MUTATION, { input: { ...input, idempotencyKey: key }, staffToken: options.staffToken }, options);
|
|
46
|
+
return data.posRequestPayment;
|
|
47
|
+
},
|
|
48
|
+
async check(input, options) {
|
|
49
|
+
const data = await gql(POS_CHECK_PAYMENT_REQUEST_MUTATION, { input, staffToken: options?.staffToken }, options);
|
|
50
|
+
return data.posCheckPaymentRequest;
|
|
51
|
+
},
|
|
52
|
+
async cancel(input, options) {
|
|
53
|
+
const data = await gql(POS_CANCEL_PAYMENT_REQUEST_MUTATION, { input, staffToken: options?.staffToken, approvalToken: options?.approvalToken }, options);
|
|
54
|
+
return data.posCancelPaymentRequest;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Transport } from '@sixtyninecommerce/core';
|
|
2
|
+
import type { Call } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A store's quick keys (POS sprint 13): the till's favourite-product buttons, on named, coloured
|
|
5
|
+
* pages, one layout per store, shown on every till of the store. The limits and the palette are
|
|
6
|
+
* the engine's (`vendure-plugin-pos` `services/quick-key-layout.ts`), pinned by
|
|
7
|
+
* `pos-quick-keys.spec.ts`.
|
|
8
|
+
*/
|
|
9
|
+
/** The quick key palette; anything else is refused `POS_QUICK_KEYS_INVALID`. */
|
|
10
|
+
export declare const POS_QUICK_KEY_COLORS: readonly ["slate", "red", "orange", "amber", "green", "teal", "sky", "blue", "violet", "pink"];
|
|
11
|
+
export type PosQuickKeyColor = (typeof POS_QUICK_KEY_COLORS)[number];
|
|
12
|
+
/** At most 10 pages of at most 40 keys; a page name of 1-20 and a label of up to 30 characters. */
|
|
13
|
+
export declare const POS_QUICK_KEY_LIMITS: {
|
|
14
|
+
readonly pages: 10;
|
|
15
|
+
readonly keysPerPage: 40;
|
|
16
|
+
readonly pageNameLength: 20;
|
|
17
|
+
readonly labelLength: 30;
|
|
18
|
+
};
|
|
19
|
+
/** Whether the till shows a key; only `available` keys are on the till. More may come. */
|
|
20
|
+
export type PosQuickKeyState = 'available' | 'product_disabled' | 'product_gone' | 'variant_disabled' | 'variant_gone' | 'no_sellable_variant' | (string & {});
|
|
21
|
+
export interface PosQuickKey {
|
|
22
|
+
/** Send it back to keep the key, also when it moves to another page. */
|
|
23
|
+
id: string;
|
|
24
|
+
productId: string;
|
|
25
|
+
/** The one variant the key adds; null for a product key (one variant adds, several open the picker). */
|
|
26
|
+
variantId: string | null;
|
|
27
|
+
/** The store's button text; null shows the product's (or the variant's) own name. */
|
|
28
|
+
label: string | null;
|
|
29
|
+
/** A palette colour, or a newer engine's; null for none. */
|
|
30
|
+
color: string | null;
|
|
31
|
+
state: PosQuickKeyState;
|
|
32
|
+
/** The catalogue's name now (the variant's for a variant key); null when it is gone. */
|
|
33
|
+
name: string | null;
|
|
34
|
+
/** The variant's SKU for a variant key; null otherwise. */
|
|
35
|
+
sku: string | null;
|
|
36
|
+
featuredAsset: {
|
|
37
|
+
id: string;
|
|
38
|
+
preview: string;
|
|
39
|
+
} | null;
|
|
40
|
+
}
|
|
41
|
+
export interface PosQuickKeyPage {
|
|
42
|
+
/** Send it back to keep the page. */
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
color: string | null;
|
|
46
|
+
keys: PosQuickKey[];
|
|
47
|
+
}
|
|
48
|
+
export interface PosQuickKeyLayout {
|
|
49
|
+
/** Raised by every save that changes the layout; 0 before the first. Send it as `expectedVersion`. */
|
|
50
|
+
version: number;
|
|
51
|
+
/** When a save last changed the layout (ISO-8601); null before the first. */
|
|
52
|
+
updatedAt: string | null;
|
|
53
|
+
pages: PosQuickKeyPage[];
|
|
54
|
+
}
|
|
55
|
+
export interface PosQuickKeyInput {
|
|
56
|
+
/** A stored key's id keeps the key; omit it for a new key. */
|
|
57
|
+
id?: string;
|
|
58
|
+
productId: string;
|
|
59
|
+
/** Pin the key to one variant of the product; omit for the product. */
|
|
60
|
+
variantId?: string | null;
|
|
61
|
+
/** Blank shows the product's (or the variant's) own name. */
|
|
62
|
+
label?: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* A palette colour, or null for none. A colour this SDK does not list is sent as read (sprint
|
|
65
|
+
* 27: a back office keeps an engine colour it does not know); the engine refuses one IT does not
|
|
66
|
+
* know (`POS_QUICK_KEYS_INVALID`, `color_unknown`).
|
|
67
|
+
*/
|
|
68
|
+
color?: PosQuickKeyColor | (string & {}) | null;
|
|
69
|
+
}
|
|
70
|
+
export interface PosQuickKeyPageInput {
|
|
71
|
+
/** A stored page's id keeps the page; omit it for a new page. */
|
|
72
|
+
id?: string;
|
|
73
|
+
name: string;
|
|
74
|
+
/**
|
|
75
|
+
* A palette colour, or null for none. A colour this SDK does not list is sent as read (sprint
|
|
76
|
+
* 27: a back office keeps an engine colour it does not know); the engine refuses one IT does not
|
|
77
|
+
* know (`POS_QUICK_KEYS_INVALID`, `color_unknown`).
|
|
78
|
+
*/
|
|
79
|
+
color?: PosQuickKeyColor | (string & {}) | null;
|
|
80
|
+
keys: PosQuickKeyInput[];
|
|
81
|
+
}
|
|
82
|
+
export interface SetPosQuickKeyLayoutInput {
|
|
83
|
+
/** The `version` the editor read. */
|
|
84
|
+
expectedVersion: number;
|
|
85
|
+
pages: PosQuickKeyPageInput[];
|
|
86
|
+
}
|
|
87
|
+
/** Read needs UpdateSettings or ManagePosDevices; set needs UpdateSettings. */
|
|
88
|
+
export interface PosQuickKeysModule {
|
|
89
|
+
/** The store's quick keys, every page and key in order, each key's `state` saying whether the till shows it. */
|
|
90
|
+
get(options?: Call): Promise<PosQuickKeyLayout>;
|
|
91
|
+
/**
|
|
92
|
+
* Replace them (the whole layout). Refusals: `POS_QUICK_KEYS_CONFLICT` (`ConflictError`, 409:
|
|
93
|
+
* changed since `expectedVersion`; read again), `POS_QUICK_KEYS_INVALID` (`ValidationError`, 400;
|
|
94
|
+
* `error.details[0].field` is a JSON Pointer into the input), `POS_QUICK_KEYS_PRODUCT_NOT_FOUND`
|
|
95
|
+
* (`NotFoundError`, 404), `POS_QUICK_KEYS_FORMAT_UNSUPPORTED` (`BusinessRuleError`, 422),
|
|
96
|
+
* `ORGANIZATION_WORKSPACE_NOT_A_STORE`. Sending what is stored again is never refused, whatever
|
|
97
|
+
* `expectedVersion` says.
|
|
98
|
+
*/
|
|
99
|
+
set(input: SetPosQuickKeyLayoutInput, options?: Call): Promise<PosQuickKeyLayout>;
|
|
100
|
+
}
|
|
101
|
+
export declare const POS_QUICK_KEY_LAYOUT_QUERY = "query PosQuickKeyLayout { posQuickKeyLayout { version updatedAt pages { id name color keys { id productId variantId label color state name sku featuredAsset { id preview } } } } }";
|
|
102
|
+
export declare const SET_POS_QUICK_KEY_LAYOUT_MUTATION = "mutation SetPosQuickKeyLayout($input: SetPosQuickKeyLayoutInput!) { setPosQuickKeyLayout(input: $input) { version updatedAt pages { id name color keys { id productId variantId label color state name sku featuredAsset { id preview } } } } }";
|
|
103
|
+
export declare function createPosQuickKeysModule(transport: Transport): PosQuickKeysModule;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A store's quick keys (POS sprint 13): the till's favourite-product buttons, on named, coloured
|
|
3
|
+
* pages, one layout per store, shown on every till of the store. The limits and the palette are
|
|
4
|
+
* the engine's (`vendure-plugin-pos` `services/quick-key-layout.ts`), pinned by
|
|
5
|
+
* `pos-quick-keys.spec.ts`.
|
|
6
|
+
*/
|
|
7
|
+
/** The quick key palette; anything else is refused `POS_QUICK_KEYS_INVALID`. */
|
|
8
|
+
export const POS_QUICK_KEY_COLORS = [
|
|
9
|
+
'slate',
|
|
10
|
+
'red',
|
|
11
|
+
'orange',
|
|
12
|
+
'amber',
|
|
13
|
+
'green',
|
|
14
|
+
'teal',
|
|
15
|
+
'sky',
|
|
16
|
+
'blue',
|
|
17
|
+
'violet',
|
|
18
|
+
'pink',
|
|
19
|
+
];
|
|
20
|
+
/** At most 10 pages of at most 40 keys; a page name of 1-20 and a label of up to 30 characters. */
|
|
21
|
+
export const POS_QUICK_KEY_LIMITS = {
|
|
22
|
+
pages: 10,
|
|
23
|
+
keysPerPage: 40,
|
|
24
|
+
pageNameLength: 20,
|
|
25
|
+
labelLength: 30,
|
|
26
|
+
};
|
|
27
|
+
const LAYOUT_FIELDS = 'version updatedAt pages { id name color keys { id productId variantId label color state name sku featuredAsset { id preview } } }';
|
|
28
|
+
export const POS_QUICK_KEY_LAYOUT_QUERY = `query PosQuickKeyLayout { posQuickKeyLayout { ${LAYOUT_FIELDS} } }`;
|
|
29
|
+
export const SET_POS_QUICK_KEY_LAYOUT_MUTATION = `mutation SetPosQuickKeyLayout($input: SetPosQuickKeyLayoutInput!) { setPosQuickKeyLayout(input: $input) { ${LAYOUT_FIELDS} } }`;
|
|
30
|
+
export function createPosQuickKeysModule(transport) {
|
|
31
|
+
const gql = async (query, variables, options) => transport.graphql({ api: 'admin', query, variables }, options);
|
|
32
|
+
return {
|
|
33
|
+
async get(options) {
|
|
34
|
+
const data = await gql(POS_QUICK_KEY_LAYOUT_QUERY, {}, options);
|
|
35
|
+
return data.posQuickKeyLayout;
|
|
36
|
+
},
|
|
37
|
+
async set(input, options) {
|
|
38
|
+
if (!Number.isInteger(input.expectedVersion) || input.expectedVersion < 0) {
|
|
39
|
+
throw new TypeError('quickKeys.set needs expectedVersion: the whole-number version the layout was read at (0 before the first save).');
|
|
40
|
+
}
|
|
41
|
+
const data = await gql(SET_POS_QUICK_KEY_LAYOUT_MUTATION, { input }, options);
|
|
42
|
+
return data.setPosQuickKeyLayout;
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|