@viu/emporix-sdk 1.0.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/CHANGELOG.md +407 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/cart.cjs +214 -0
- package/dist/cart.cjs.map +1 -0
- package/dist/cart.d.cts +1807 -0
- package/dist/cart.d.ts +1807 -0
- package/dist/cart.js +4 -0
- package/dist/cart.js.map +1 -0
- package/dist/category.cjs +97 -0
- package/dist/category.cjs.map +1 -0
- package/dist/category.d.cts +313 -0
- package/dist/category.d.ts +313 -0
- package/dist/category.js +4 -0
- package/dist/category.js.map +1 -0
- package/dist/checkout.cjs +98 -0
- package/dist/checkout.cjs.map +1 -0
- package/dist/checkout.d.cts +252 -0
- package/dist/checkout.d.ts +252 -0
- package/dist/checkout.js +4 -0
- package/dist/checkout.js.map +1 -0
- package/dist/chunk-4BJUCCKJ.js +86 -0
- package/dist/chunk-4BJUCCKJ.js.map +1 -0
- package/dist/chunk-6UNFMCHZ.js +95 -0
- package/dist/chunk-6UNFMCHZ.js.map +1 -0
- package/dist/chunk-B56JZNI7.js +49 -0
- package/dist/chunk-B56JZNI7.js.map +1 -0
- package/dist/chunk-BFQ732VZ.js +11 -0
- package/dist/chunk-BFQ732VZ.js.map +1 -0
- package/dist/chunk-F3WAQH2E.js +120 -0
- package/dist/chunk-F3WAQH2E.js.map +1 -0
- package/dist/chunk-GWJ2U2CP.js +14 -0
- package/dist/chunk-GWJ2U2CP.js.map +1 -0
- package/dist/chunk-HEO34WLO.js +47 -0
- package/dist/chunk-HEO34WLO.js.map +1 -0
- package/dist/chunk-HKPZI7Y5.js +30 -0
- package/dist/chunk-HKPZI7Y5.js.map +1 -0
- package/dist/chunk-IEZHGU7F.js +171 -0
- package/dist/chunk-IEZHGU7F.js.map +1 -0
- package/dist/chunk-KTODT6DV.js +86 -0
- package/dist/chunk-KTODT6DV.js.map +1 -0
- package/dist/chunk-NM7VDXBR.js +57 -0
- package/dist/chunk-NM7VDXBR.js.map +1 -0
- package/dist/chunk-OMYVOOSX.js +57 -0
- package/dist/chunk-OMYVOOSX.js.map +1 -0
- package/dist/chunk-QDABAMVN.js +89 -0
- package/dist/chunk-QDABAMVN.js.map +1 -0
- package/dist/chunk-RXVVFNYN.js +56 -0
- package/dist/chunk-RXVVFNYN.js.map +1 -0
- package/dist/chunk-SKX7KCMH.js +23 -0
- package/dist/chunk-SKX7KCMH.js.map +1 -0
- package/dist/chunk-TLH6SLAF.js +215 -0
- package/dist/chunk-TLH6SLAF.js.map +1 -0
- package/dist/chunk-Z6PNI5VT.js +142 -0
- package/dist/chunk-Z6PNI5VT.js.map +1 -0
- package/dist/companies.cjs +58 -0
- package/dist/companies.cjs.map +1 -0
- package/dist/companies.d.cts +31 -0
- package/dist/companies.d.ts +31 -0
- package/dist/companies.js +3 -0
- package/dist/companies.js.map +1 -0
- package/dist/contacts.cjs +51 -0
- package/dist/contacts.cjs.map +1 -0
- package/dist/contacts.d.cts +28 -0
- package/dist/contacts.d.ts +28 -0
- package/dist/contacts.js +3 -0
- package/dist/contacts.js.map +1 -0
- package/dist/context-vKgzZ-5f.d.cts +329 -0
- package/dist/context-vKgzZ-5f.d.ts +329 -0
- package/dist/customer-groups.cjs +25 -0
- package/dist/customer-groups.cjs.map +1 -0
- package/dist/customer-groups.d.cts +36 -0
- package/dist/customer-groups.d.ts +36 -0
- package/dist/customer-groups.js +3 -0
- package/dist/customer-groups.js.map +1 -0
- package/dist/customer.cjs +262 -0
- package/dist/customer.cjs.map +1 -0
- package/dist/customer.d.cts +386 -0
- package/dist/customer.d.ts +386 -0
- package/dist/customer.js +5 -0
- package/dist/customer.js.map +1 -0
- package/dist/index.cjs +2075 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +218 -0
- package/dist/index.d.ts +218 -0
- package/dist/index.js +791 -0
- package/dist/index.js.map +1 -0
- package/dist/locations.cjs +59 -0
- package/dist/locations.cjs.map +1 -0
- package/dist/locations.d.cts +30 -0
- package/dist/locations.d.ts +30 -0
- package/dist/locations.js +3 -0
- package/dist/locations.js.map +1 -0
- package/dist/media.cjs +123 -0
- package/dist/media.cjs.map +1 -0
- package/dist/media.d.cts +219 -0
- package/dist/media.d.ts +219 -0
- package/dist/media.js +3 -0
- package/dist/media.js.map +1 -0
- package/dist/orders.cjs +98 -0
- package/dist/orders.cjs.map +1 -0
- package/dist/orders.d.cts +167 -0
- package/dist/orders.d.ts +167 -0
- package/dist/orders.js +3 -0
- package/dist/orders.js.map +1 -0
- package/dist/payment.cjs +77 -0
- package/dist/payment.cjs.map +1 -0
- package/dist/payment.d.cts +110 -0
- package/dist/payment.d.ts +110 -0
- package/dist/payment.js +5 -0
- package/dist/payment.js.map +1 -0
- package/dist/price.cjs +88 -0
- package/dist/price.cjs.map +1 -0
- package/dist/price.d.cts +445 -0
- package/dist/price.d.ts +445 -0
- package/dist/price.js +4 -0
- package/dist/price.js.map +1 -0
- package/dist/product.cjs +100 -0
- package/dist/product.cjs.map +1 -0
- package/dist/product.d.cts +400 -0
- package/dist/product.d.ts +400 -0
- package/dist/product.js +4 -0
- package/dist/product.js.map +1 -0
- package/dist/segment.cjs +189 -0
- package/dist/segment.cjs.map +1 -0
- package/dist/segment.d.cts +241 -0
- package/dist/segment.d.ts +241 -0
- package/dist/segment.js +5 -0
- package/dist/segment.js.map +1 -0
- package/dist/types.gen-D1QuqPLs.d.cts +166 -0
- package/dist/types.gen-D1QuqPLs.d.ts +166 -0
- package/package.json +141 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-vKgzZ-5f.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hand-written mirror of the Emporix Order-v2 schemas (storefront-relevant
|
|
5
|
+
* subset). Captures /orders, /orders/{id}, /orders/{id}/transitions, and
|
|
6
|
+
* /salesorders/{id} response/body shapes.
|
|
7
|
+
*
|
|
8
|
+
* **Not generated.** When the OpenAPI input file lands in the repo, this
|
|
9
|
+
* file is replaced by codegen output. Keep the exported names stable so
|
|
10
|
+
* the façade re-exports don't churn.
|
|
11
|
+
*/
|
|
12
|
+
type OrderStatus = "CREATED" | "IN_CHECKOUT" | "CONFIRMED" | "SHIPPED" | "COMPLETED" | "DECLINED";
|
|
13
|
+
interface OrderMoney {
|
|
14
|
+
amount: number;
|
|
15
|
+
currency: string;
|
|
16
|
+
}
|
|
17
|
+
interface OrderItem {
|
|
18
|
+
id: string;
|
|
19
|
+
productId: string;
|
|
20
|
+
productCode?: string;
|
|
21
|
+
productName?: string | Record<string, string>;
|
|
22
|
+
imageUrl?: string;
|
|
23
|
+
quantity: number;
|
|
24
|
+
unitPrice: OrderMoney;
|
|
25
|
+
totalPrice: OrderMoney;
|
|
26
|
+
}
|
|
27
|
+
interface OrderCustomer {
|
|
28
|
+
id?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
firstName?: string;
|
|
31
|
+
lastName?: string;
|
|
32
|
+
companyName?: string;
|
|
33
|
+
guest?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface OrderAddress {
|
|
36
|
+
contactName?: string;
|
|
37
|
+
companyName?: string;
|
|
38
|
+
street?: string;
|
|
39
|
+
streetNumber?: string;
|
|
40
|
+
zip?: string;
|
|
41
|
+
city?: string;
|
|
42
|
+
country?: string;
|
|
43
|
+
}
|
|
44
|
+
interface OrderPayment {
|
|
45
|
+
paymentMode?: string;
|
|
46
|
+
paymentStatus?: string;
|
|
47
|
+
transactionId?: string;
|
|
48
|
+
}
|
|
49
|
+
interface OrderDelivery {
|
|
50
|
+
deliveryDate?: string;
|
|
51
|
+
trackingNumber?: string;
|
|
52
|
+
carrier?: string;
|
|
53
|
+
}
|
|
54
|
+
interface OrderTaxLine {
|
|
55
|
+
rate: number;
|
|
56
|
+
amount: number;
|
|
57
|
+
}
|
|
58
|
+
interface OrderMetadata {
|
|
59
|
+
version: number;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
modifiedAt: string;
|
|
62
|
+
mixins?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
interface Order {
|
|
65
|
+
id: string;
|
|
66
|
+
orderNumber: string;
|
|
67
|
+
status: OrderStatus;
|
|
68
|
+
currency: string;
|
|
69
|
+
totalPrice: OrderMoney;
|
|
70
|
+
subTotalPrice?: OrderMoney;
|
|
71
|
+
shippingPrice?: OrderMoney;
|
|
72
|
+
taxAggregate?: {
|
|
73
|
+
lines: OrderTaxLine[];
|
|
74
|
+
};
|
|
75
|
+
items: OrderItem[];
|
|
76
|
+
customer?: OrderCustomer;
|
|
77
|
+
billingAddress?: OrderAddress;
|
|
78
|
+
shippingAddress?: OrderAddress;
|
|
79
|
+
payment?: OrderPayment;
|
|
80
|
+
delivery?: OrderDelivery;
|
|
81
|
+
siteCode?: string;
|
|
82
|
+
legalEntityId?: string;
|
|
83
|
+
channel?: string;
|
|
84
|
+
metadata?: OrderMetadata;
|
|
85
|
+
mixins?: Record<string, unknown>;
|
|
86
|
+
customAttributes?: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
interface OrderTransition {
|
|
89
|
+
status: OrderStatus;
|
|
90
|
+
comment?: string;
|
|
91
|
+
}
|
|
92
|
+
interface SalesOrderPatch {
|
|
93
|
+
status?: OrderStatus;
|
|
94
|
+
mixins?: Record<string, unknown>;
|
|
95
|
+
customAttributes?: Record<string, unknown>;
|
|
96
|
+
metadata?: {
|
|
97
|
+
version: number;
|
|
98
|
+
mixins?: Record<string, unknown>;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Optional fields supported by the order-v2 list endpoint. */
|
|
103
|
+
interface ListMyOrdersOptions {
|
|
104
|
+
pageNumber?: number;
|
|
105
|
+
pageSize?: number;
|
|
106
|
+
status?: OrderStatus;
|
|
107
|
+
legalEntityId?: string;
|
|
108
|
+
siteCode?: string;
|
|
109
|
+
saasToken?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Options for single-order reads (saas-token only). */
|
|
112
|
+
interface GetOrderOptions {
|
|
113
|
+
saasToken?: string;
|
|
114
|
+
}
|
|
115
|
+
/** Options for status transitions. */
|
|
116
|
+
interface OrderTransitionOptions {
|
|
117
|
+
saasToken?: string;
|
|
118
|
+
comment?: string;
|
|
119
|
+
}
|
|
120
|
+
/** Options for `salesOrders.update`. */
|
|
121
|
+
interface UpdateSalesOrderOptions {
|
|
122
|
+
/** Forwarded as `?recalculate=`. Omit to use the server default (true). */
|
|
123
|
+
recalculate?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Storefront-customer access to Order-v2's customer endpoints.
|
|
127
|
+
*
|
|
128
|
+
* `listMine`/`get` require `order.order_read_own`; transitions require
|
|
129
|
+
* `order.order_manage_own`. All methods accept an optional `saasToken` that
|
|
130
|
+
* is passed as the `saas-token` header (mirrors `checkout.placeOrder`).
|
|
131
|
+
*/
|
|
132
|
+
declare class OrdersService {
|
|
133
|
+
private readonly ctx;
|
|
134
|
+
constructor(ctx: ClientContext);
|
|
135
|
+
private base;
|
|
136
|
+
private saasHeader;
|
|
137
|
+
/** Lists the calling customer's orders. */
|
|
138
|
+
listMine(auth: AuthContext, opts?: ListMyOrdersOptions): Promise<PaginatedItems<Order>>;
|
|
139
|
+
/** Fetches one of the calling customer's orders by id. */
|
|
140
|
+
get(orderId: string, auth: AuthContext, opts?: GetOrderOptions): Promise<Order>;
|
|
141
|
+
/** Transitions an order to a new status. Server enforces legal transitions. */
|
|
142
|
+
transition(orderId: string, status: OrderStatus, auth: AuthContext, opts?: OrderTransitionOptions): Promise<void>;
|
|
143
|
+
/** Convenience: transitions to `DECLINED` (customer cancel). */
|
|
144
|
+
cancel(orderId: string, auth: AuthContext, opts?: {
|
|
145
|
+
saasToken?: string;
|
|
146
|
+
}): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Backend / service-account access to the merchant-facing
|
|
150
|
+
* `/salesorders/{id}` resource. Requires `order.order_read` (read) /
|
|
151
|
+
* `order.order_manage` (update) scopes on a service token.
|
|
152
|
+
*
|
|
153
|
+
* The full admin list + filter surface is deferred to a follow-up
|
|
154
|
+
* sub-spec. This service ships only single-resource read + patch — the
|
|
155
|
+
* common backend use case (e.g. mixin updates after fulfilment).
|
|
156
|
+
*/
|
|
157
|
+
declare class SalesOrdersService {
|
|
158
|
+
private readonly ctx;
|
|
159
|
+
constructor(ctx: ClientContext);
|
|
160
|
+
private base;
|
|
161
|
+
/** Fetches a single sales-order by id. */
|
|
162
|
+
get(orderId: string, auth: AuthContext): Promise<Order>;
|
|
163
|
+
/** Patches an existing order (status, mixins, customAttributes, metadata). */
|
|
164
|
+
update(orderId: string, patch: SalesOrderPatch, auth: AuthContext, opts?: UpdateSalesOrderOptions): Promise<Order>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { type GetOrderOptions, type ListMyOrdersOptions, type Order, type OrderAddress, type OrderCustomer, type OrderDelivery, type OrderItem, type OrderMetadata, type OrderMoney, type OrderPayment, type OrderStatus, type OrderTaxLine, type OrderTransition, type OrderTransitionOptions, OrdersService, type SalesOrderPatch, SalesOrdersService, type UpdateSalesOrderOptions };
|
package/dist/orders.d.ts
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-vKgzZ-5f.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hand-written mirror of the Emporix Order-v2 schemas (storefront-relevant
|
|
5
|
+
* subset). Captures /orders, /orders/{id}, /orders/{id}/transitions, and
|
|
6
|
+
* /salesorders/{id} response/body shapes.
|
|
7
|
+
*
|
|
8
|
+
* **Not generated.** When the OpenAPI input file lands in the repo, this
|
|
9
|
+
* file is replaced by codegen output. Keep the exported names stable so
|
|
10
|
+
* the façade re-exports don't churn.
|
|
11
|
+
*/
|
|
12
|
+
type OrderStatus = "CREATED" | "IN_CHECKOUT" | "CONFIRMED" | "SHIPPED" | "COMPLETED" | "DECLINED";
|
|
13
|
+
interface OrderMoney {
|
|
14
|
+
amount: number;
|
|
15
|
+
currency: string;
|
|
16
|
+
}
|
|
17
|
+
interface OrderItem {
|
|
18
|
+
id: string;
|
|
19
|
+
productId: string;
|
|
20
|
+
productCode?: string;
|
|
21
|
+
productName?: string | Record<string, string>;
|
|
22
|
+
imageUrl?: string;
|
|
23
|
+
quantity: number;
|
|
24
|
+
unitPrice: OrderMoney;
|
|
25
|
+
totalPrice: OrderMoney;
|
|
26
|
+
}
|
|
27
|
+
interface OrderCustomer {
|
|
28
|
+
id?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
firstName?: string;
|
|
31
|
+
lastName?: string;
|
|
32
|
+
companyName?: string;
|
|
33
|
+
guest?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface OrderAddress {
|
|
36
|
+
contactName?: string;
|
|
37
|
+
companyName?: string;
|
|
38
|
+
street?: string;
|
|
39
|
+
streetNumber?: string;
|
|
40
|
+
zip?: string;
|
|
41
|
+
city?: string;
|
|
42
|
+
country?: string;
|
|
43
|
+
}
|
|
44
|
+
interface OrderPayment {
|
|
45
|
+
paymentMode?: string;
|
|
46
|
+
paymentStatus?: string;
|
|
47
|
+
transactionId?: string;
|
|
48
|
+
}
|
|
49
|
+
interface OrderDelivery {
|
|
50
|
+
deliveryDate?: string;
|
|
51
|
+
trackingNumber?: string;
|
|
52
|
+
carrier?: string;
|
|
53
|
+
}
|
|
54
|
+
interface OrderTaxLine {
|
|
55
|
+
rate: number;
|
|
56
|
+
amount: number;
|
|
57
|
+
}
|
|
58
|
+
interface OrderMetadata {
|
|
59
|
+
version: number;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
modifiedAt: string;
|
|
62
|
+
mixins?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
interface Order {
|
|
65
|
+
id: string;
|
|
66
|
+
orderNumber: string;
|
|
67
|
+
status: OrderStatus;
|
|
68
|
+
currency: string;
|
|
69
|
+
totalPrice: OrderMoney;
|
|
70
|
+
subTotalPrice?: OrderMoney;
|
|
71
|
+
shippingPrice?: OrderMoney;
|
|
72
|
+
taxAggregate?: {
|
|
73
|
+
lines: OrderTaxLine[];
|
|
74
|
+
};
|
|
75
|
+
items: OrderItem[];
|
|
76
|
+
customer?: OrderCustomer;
|
|
77
|
+
billingAddress?: OrderAddress;
|
|
78
|
+
shippingAddress?: OrderAddress;
|
|
79
|
+
payment?: OrderPayment;
|
|
80
|
+
delivery?: OrderDelivery;
|
|
81
|
+
siteCode?: string;
|
|
82
|
+
legalEntityId?: string;
|
|
83
|
+
channel?: string;
|
|
84
|
+
metadata?: OrderMetadata;
|
|
85
|
+
mixins?: Record<string, unknown>;
|
|
86
|
+
customAttributes?: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
interface OrderTransition {
|
|
89
|
+
status: OrderStatus;
|
|
90
|
+
comment?: string;
|
|
91
|
+
}
|
|
92
|
+
interface SalesOrderPatch {
|
|
93
|
+
status?: OrderStatus;
|
|
94
|
+
mixins?: Record<string, unknown>;
|
|
95
|
+
customAttributes?: Record<string, unknown>;
|
|
96
|
+
metadata?: {
|
|
97
|
+
version: number;
|
|
98
|
+
mixins?: Record<string, unknown>;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Optional fields supported by the order-v2 list endpoint. */
|
|
103
|
+
interface ListMyOrdersOptions {
|
|
104
|
+
pageNumber?: number;
|
|
105
|
+
pageSize?: number;
|
|
106
|
+
status?: OrderStatus;
|
|
107
|
+
legalEntityId?: string;
|
|
108
|
+
siteCode?: string;
|
|
109
|
+
saasToken?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Options for single-order reads (saas-token only). */
|
|
112
|
+
interface GetOrderOptions {
|
|
113
|
+
saasToken?: string;
|
|
114
|
+
}
|
|
115
|
+
/** Options for status transitions. */
|
|
116
|
+
interface OrderTransitionOptions {
|
|
117
|
+
saasToken?: string;
|
|
118
|
+
comment?: string;
|
|
119
|
+
}
|
|
120
|
+
/** Options for `salesOrders.update`. */
|
|
121
|
+
interface UpdateSalesOrderOptions {
|
|
122
|
+
/** Forwarded as `?recalculate=`. Omit to use the server default (true). */
|
|
123
|
+
recalculate?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Storefront-customer access to Order-v2's customer endpoints.
|
|
127
|
+
*
|
|
128
|
+
* `listMine`/`get` require `order.order_read_own`; transitions require
|
|
129
|
+
* `order.order_manage_own`. All methods accept an optional `saasToken` that
|
|
130
|
+
* is passed as the `saas-token` header (mirrors `checkout.placeOrder`).
|
|
131
|
+
*/
|
|
132
|
+
declare class OrdersService {
|
|
133
|
+
private readonly ctx;
|
|
134
|
+
constructor(ctx: ClientContext);
|
|
135
|
+
private base;
|
|
136
|
+
private saasHeader;
|
|
137
|
+
/** Lists the calling customer's orders. */
|
|
138
|
+
listMine(auth: AuthContext, opts?: ListMyOrdersOptions): Promise<PaginatedItems<Order>>;
|
|
139
|
+
/** Fetches one of the calling customer's orders by id. */
|
|
140
|
+
get(orderId: string, auth: AuthContext, opts?: GetOrderOptions): Promise<Order>;
|
|
141
|
+
/** Transitions an order to a new status. Server enforces legal transitions. */
|
|
142
|
+
transition(orderId: string, status: OrderStatus, auth: AuthContext, opts?: OrderTransitionOptions): Promise<void>;
|
|
143
|
+
/** Convenience: transitions to `DECLINED` (customer cancel). */
|
|
144
|
+
cancel(orderId: string, auth: AuthContext, opts?: {
|
|
145
|
+
saasToken?: string;
|
|
146
|
+
}): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Backend / service-account access to the merchant-facing
|
|
150
|
+
* `/salesorders/{id}` resource. Requires `order.order_read` (read) /
|
|
151
|
+
* `order.order_manage` (update) scopes on a service token.
|
|
152
|
+
*
|
|
153
|
+
* The full admin list + filter surface is deferred to a follow-up
|
|
154
|
+
* sub-spec. This service ships only single-resource read + patch — the
|
|
155
|
+
* common backend use case (e.g. mixin updates after fulfilment).
|
|
156
|
+
*/
|
|
157
|
+
declare class SalesOrdersService {
|
|
158
|
+
private readonly ctx;
|
|
159
|
+
constructor(ctx: ClientContext);
|
|
160
|
+
private base;
|
|
161
|
+
/** Fetches a single sales-order by id. */
|
|
162
|
+
get(orderId: string, auth: AuthContext): Promise<Order>;
|
|
163
|
+
/** Patches an existing order (status, mixins, customAttributes, metadata). */
|
|
164
|
+
update(orderId: string, patch: SalesOrderPatch, auth: AuthContext, opts?: UpdateSalesOrderOptions): Promise<Order>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { type GetOrderOptions, type ListMyOrdersOptions, type Order, type OrderAddress, type OrderCustomer, type OrderDelivery, type OrderItem, type OrderMetadata, type OrderMoney, type OrderPayment, type OrderStatus, type OrderTaxLine, type OrderTransition, type OrderTransitionOptions, OrdersService, type SalesOrderPatch, SalesOrdersService, type UpdateSalesOrderOptions };
|
package/dist/orders.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"orders.js"}
|
package/dist/payment.cjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/core/errors.ts
|
|
4
|
+
var REDACTED_BODY_KEYS = /* @__PURE__ */ new Set([
|
|
5
|
+
"access_token",
|
|
6
|
+
"refresh_token",
|
|
7
|
+
"token",
|
|
8
|
+
"customertoken",
|
|
9
|
+
"saastoken",
|
|
10
|
+
"secret",
|
|
11
|
+
"client_secret",
|
|
12
|
+
"authorization",
|
|
13
|
+
"password"
|
|
14
|
+
]);
|
|
15
|
+
function scrub(body) {
|
|
16
|
+
if (Array.isArray(body)) return body.map(scrub);
|
|
17
|
+
if (body && typeof body === "object") {
|
|
18
|
+
const out = {};
|
|
19
|
+
for (const [k, v] of Object.entries(body)) {
|
|
20
|
+
out[k] = REDACTED_BODY_KEYS.has(k.toLowerCase()) ? "***redacted***" : scrub(v);
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
return body;
|
|
25
|
+
}
|
|
26
|
+
var EmporixError = class extends Error {
|
|
27
|
+
status;
|
|
28
|
+
body;
|
|
29
|
+
constructor(message, status, body) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = new.target.name;
|
|
32
|
+
this.status = status;
|
|
33
|
+
this.body = body;
|
|
34
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
35
|
+
}
|
|
36
|
+
/** Safe serialisation — token-like body fields are redacted. */
|
|
37
|
+
toJSON() {
|
|
38
|
+
return { name: this.name, message: this.message, status: this.status, body: scrub(this.body) };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var EmporixAuthError = class extends EmporixError {
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/core/require-customer.ts
|
|
45
|
+
function requireCustomer(auth) {
|
|
46
|
+
if (auth && (auth.kind === "customer" || auth.kind === "raw")) return auth;
|
|
47
|
+
throw new EmporixAuthError("This operation requires a customer or raw AuthContext");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/services/payment.ts
|
|
51
|
+
var PaymentGatewayService = class {
|
|
52
|
+
constructor(ctx) {
|
|
53
|
+
this.ctx = ctx;
|
|
54
|
+
}
|
|
55
|
+
ctx;
|
|
56
|
+
/** Lists configured frontend payment modes. */
|
|
57
|
+
async listPaymentModes(auth) {
|
|
58
|
+
return this.ctx.http.request({
|
|
59
|
+
method: "GET",
|
|
60
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/frontend`,
|
|
61
|
+
auth: requireCustomer(auth)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** Authorizes a post-checkout (deferred) payment for an existing order. */
|
|
65
|
+
async authorize(input, auth) {
|
|
66
|
+
return this.ctx.http.request({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: `/payment-gateway/${this.ctx.tenant}/payment/frontend/authorize`,
|
|
69
|
+
auth: requireCustomer(auth),
|
|
70
|
+
body: input
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.PaymentGatewayService = PaymentGatewayService;
|
|
76
|
+
//# sourceMappingURL=payment.cjs.map
|
|
77
|
+
//# sourceMappingURL=payment.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/errors.ts","../src/core/require-customer.ts","../src/services/payment.ts"],"names":[],"mappings":"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","file":"payment.cjs","sourcesContent":["/** Keys whose values are stripped from any serialised error body. */\nconst REDACTED_BODY_KEYS = new Set([\n \"access_token\", \"refresh_token\", \"token\", \"customertoken\", \"saastoken\",\n \"secret\", \"client_secret\", \"authorization\", \"password\",\n]);\n\nfunction scrub(body: unknown): unknown {\n if (Array.isArray(body)) return body.map(scrub);\n if (body && typeof body === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(body as Record<string, unknown>)) {\n out[k] = REDACTED_BODY_KEYS.has(k.toLowerCase()) ? \"***redacted***\" : scrub(v);\n }\n return out;\n }\n return body;\n}\n\n/** Base class for every error thrown by the SDK. */\nexport class EmporixError extends Error {\n readonly status: number | undefined;\n readonly body: unknown;\n constructor(message: string, status?: number, body?: unknown) {\n super(message);\n this.name = new.target.name;\n this.status = status;\n this.body = body;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n /** Safe serialisation — token-like body fields are redacted. */\n toJSON(): Record<string, unknown> {\n return { name: this.name, message: this.message, status: this.status, body: scrub(this.body) };\n }\n}\n\n/** 401 — authentication failed or token expired. */\nexport class EmporixAuthError extends EmporixError {}\n/** 403 — authenticated but not permitted. */\nexport class EmporixForbiddenError extends EmporixError {}\n/** 404 — resource not found. */\nexport class EmporixNotFoundError extends EmporixError {}\n/** 400/422 — request validation failed. */\nexport class EmporixValidationError extends EmporixError {}\n/** 5xx — server-side failure. */\nexport class EmporixServerError extends EmporixError {}\n\n/**\n * 403 with a `missing scope: <name>` hint in the body's `details` array.\n * Subclasses {@link EmporixForbiddenError} so existing 403 catches still work.\n */\nexport class EmporixInsufficientScopeError extends EmporixForbiddenError {\n readonly requiredScope: string | undefined;\n constructor(message: string, status: number, body: unknown, requiredScope?: string) {\n super(message, status, body);\n this.requiredScope = requiredScope;\n }\n}\n\nconst SCOPE_HINT_RE = /missing scope[: ]+([a-z0-9._-]+)/i;\n\nfunction extractRequiredScope(body: unknown): string | undefined {\n if (body && typeof body === \"object\" && \"details\" in body) {\n const details = (body as { details?: unknown }).details;\n if (Array.isArray(details)) {\n for (const d of details) {\n if (typeof d === \"string\") {\n const m = d.match(SCOPE_HINT_RE);\n if (m) return m[1];\n }\n }\n }\n }\n return undefined;\n}\n\n/** Maps an HTTP status to the matching {@link EmporixError} subclass. */\nexport function errorFromResponse(status: number, message: string, body: unknown): EmporixError {\n if (status === 401) return new EmporixAuthError(message, status, body);\n if (status === 403) {\n const scope = extractRequiredScope(body);\n if (scope) return new EmporixInsufficientScopeError(message, status, body, scope);\n return new EmporixForbiddenError(message, status, body);\n }\n if (status === 404) return new EmporixNotFoundError(message, status, body);\n if (status === 400 || status === 422) return new EmporixValidationError(message, status, body);\n if (status >= 500) return new EmporixServerError(message, status, body);\n return new EmporixError(message, status, body);\n}\n","import type { AuthContext } from \"./auth\";\nimport { EmporixAuthError } from \"./errors\";\n\n/**\n * Enforces a caller-owned customer or raw token. Throws `EmporixAuthError`\n * for any other `AuthContext` kind (or when `auth` is missing). Shared by\n * services whose endpoints require a customer scope (`/me`, payments,\n * customer-segments…).\n */\nexport function requireCustomer(auth: AuthContext | undefined): AuthContext {\n if (auth && (auth.kind === \"customer\" || auth.kind === \"raw\")) return auth;\n throw new EmporixAuthError(\"This operation requires a customer or raw AuthContext\");\n}\n","import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport { EmporixAuthError } from \"../core/errors\";\nimport { requireCustomer } from \"../core/require-customer\";\nimport type {\n PaymentModeFrontendResponse,\n AuthorizePaymentRequest,\n} from \"../generated/payment\";\n\n/** A frontend payment mode (generated). */\nexport type PaymentMode = PaymentModeFrontendResponse;\n\n/** Post-checkout authorize request (generated; caller sends the exact wire shape). */\nexport type AuthorizePaymentInput = AuthorizePaymentRequest;\n\n/** Post-checkout authorize result. */\nexport interface AuthorizePaymentResult {\n successful: boolean;\n paymentTransactionId?: string;\n authorizationToken?: string;\n requiresExternalPayment?: boolean;\n externalPaymentRedirectURL?: string;\n externalPaymentHttpMethod?: string;\n [k: string]: unknown;\n}\n\n/** Payment-Gateway: list frontend payment modes, authorize deferred payments. */\nexport class PaymentGatewayService {\n constructor(private readonly ctx: ClientContext) {}\n\n /** Lists configured frontend payment modes. */\n async listPaymentModes(auth?: AuthContext): Promise<PaymentMode[]> {\n return this.ctx.http.request<PaymentMode[]>({\n method: \"GET\",\n path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/frontend`,\n auth: requireCustomer(auth),\n });\n }\n\n /** Authorizes a post-checkout (deferred) payment for an existing order. */\n async authorize(\n input: AuthorizePaymentInput,\n auth?: AuthContext,\n ): Promise<AuthorizePaymentResult> {\n return this.ctx.http.request<AuthorizePaymentResult>({\n method: \"POST\",\n path: `/payment-gateway/${this.ctx.tenant}/payment/frontend/authorize`,\n auth: requireCustomer(auth),\n body: input,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.cjs';
|
|
2
|
+
|
|
3
|
+
type PaymentModeFrontendResponse = {
|
|
4
|
+
/**
|
|
5
|
+
* Indicates an autogenerated identifier of a given payment method.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Indicates a code of a given method.
|
|
10
|
+
*/
|
|
11
|
+
code?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Indicates a type of the mode integration.
|
|
14
|
+
*/
|
|
15
|
+
integrationType?: 'OFFSITE' | 'EXTERNAL' | 'SEPA' | 'TOKENIZED';
|
|
16
|
+
/**
|
|
17
|
+
* The field is specific for the Spreedly integration. Example values: credit_card, sprel, paypal.
|
|
18
|
+
*/
|
|
19
|
+
paymentMethodType?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The field is specific for the Spreedly integration and it indicates a Spreedly environment used for the mode configuration.
|
|
22
|
+
*/
|
|
23
|
+
environmentKey?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The field is specific for the Spreedly integration. Strong Customer Authentication token.
|
|
26
|
+
*/
|
|
27
|
+
scaProviderToken?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The field is specific for the Tokenization integration.
|
|
30
|
+
*/
|
|
31
|
+
javascriptUrl?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The field is specific for the Unzer integration.
|
|
34
|
+
*/
|
|
35
|
+
publicKey?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The field is specific for the Unzer integration.
|
|
38
|
+
*/
|
|
39
|
+
threatMetrixId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The field is specific for the Saferpay integration.
|
|
42
|
+
*/
|
|
43
|
+
receiverId?: string;
|
|
44
|
+
};
|
|
45
|
+
type InitializePaymentRequest = {
|
|
46
|
+
order?: {
|
|
47
|
+
/**
|
|
48
|
+
* Identifier of an order for which the payment should be authorized.
|
|
49
|
+
*/
|
|
50
|
+
id?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Identifier of a payment mode configured in the payment-gateway service for a given tenant.
|
|
54
|
+
*/
|
|
55
|
+
paymentModeId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates a payment method token, usually generated on a frontend site, when an user provides a credit card information.
|
|
58
|
+
*/
|
|
59
|
+
creditCardToken?: string;
|
|
60
|
+
};
|
|
61
|
+
type AuthorizeFrontendPaymentRequest = InitializePaymentRequest & {
|
|
62
|
+
/**
|
|
63
|
+
* Contains a token generated during the 3DS authentication process.
|
|
64
|
+
*/
|
|
65
|
+
threeDSToken?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Holds information related to the user's web browser.
|
|
68
|
+
*/
|
|
69
|
+
browserInfo?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Stores the IP address of the client or user making the request.
|
|
72
|
+
*/
|
|
73
|
+
clientIP?: string;
|
|
74
|
+
};
|
|
75
|
+
type AuthorizePaymentRequest = AuthorizeFrontendPaymentRequest & {
|
|
76
|
+
/**
|
|
77
|
+
* Amount that should be authorized.
|
|
78
|
+
*/
|
|
79
|
+
amountToAuthorize?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Currency for the amount that should be authorized.
|
|
82
|
+
*/
|
|
83
|
+
currency?: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** A frontend payment mode (generated). */
|
|
87
|
+
type PaymentMode = PaymentModeFrontendResponse;
|
|
88
|
+
/** Post-checkout authorize request (generated; caller sends the exact wire shape). */
|
|
89
|
+
type AuthorizePaymentInput = AuthorizePaymentRequest;
|
|
90
|
+
/** Post-checkout authorize result. */
|
|
91
|
+
interface AuthorizePaymentResult {
|
|
92
|
+
successful: boolean;
|
|
93
|
+
paymentTransactionId?: string;
|
|
94
|
+
authorizationToken?: string;
|
|
95
|
+
requiresExternalPayment?: boolean;
|
|
96
|
+
externalPaymentRedirectURL?: string;
|
|
97
|
+
externalPaymentHttpMethod?: string;
|
|
98
|
+
[k: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
/** Payment-Gateway: list frontend payment modes, authorize deferred payments. */
|
|
101
|
+
declare class PaymentGatewayService {
|
|
102
|
+
private readonly ctx;
|
|
103
|
+
constructor(ctx: ClientContext);
|
|
104
|
+
/** Lists configured frontend payment modes. */
|
|
105
|
+
listPaymentModes(auth?: AuthContext): Promise<PaymentMode[]>;
|
|
106
|
+
/** Authorizes a post-checkout (deferred) payment for an existing order. */
|
|
107
|
+
authorize(input: AuthorizePaymentInput, auth?: AuthContext): Promise<AuthorizePaymentResult>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type AuthorizePaymentInput, type AuthorizePaymentResult, PaymentGatewayService, type PaymentMode };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { C as ClientContext, b as AuthContext } from './context-vKgzZ-5f.js';
|
|
2
|
+
|
|
3
|
+
type PaymentModeFrontendResponse = {
|
|
4
|
+
/**
|
|
5
|
+
* Indicates an autogenerated identifier of a given payment method.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Indicates a code of a given method.
|
|
10
|
+
*/
|
|
11
|
+
code?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Indicates a type of the mode integration.
|
|
14
|
+
*/
|
|
15
|
+
integrationType?: 'OFFSITE' | 'EXTERNAL' | 'SEPA' | 'TOKENIZED';
|
|
16
|
+
/**
|
|
17
|
+
* The field is specific for the Spreedly integration. Example values: credit_card, sprel, paypal.
|
|
18
|
+
*/
|
|
19
|
+
paymentMethodType?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The field is specific for the Spreedly integration and it indicates a Spreedly environment used for the mode configuration.
|
|
22
|
+
*/
|
|
23
|
+
environmentKey?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The field is specific for the Spreedly integration. Strong Customer Authentication token.
|
|
26
|
+
*/
|
|
27
|
+
scaProviderToken?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The field is specific for the Tokenization integration.
|
|
30
|
+
*/
|
|
31
|
+
javascriptUrl?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The field is specific for the Unzer integration.
|
|
34
|
+
*/
|
|
35
|
+
publicKey?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The field is specific for the Unzer integration.
|
|
38
|
+
*/
|
|
39
|
+
threatMetrixId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The field is specific for the Saferpay integration.
|
|
42
|
+
*/
|
|
43
|
+
receiverId?: string;
|
|
44
|
+
};
|
|
45
|
+
type InitializePaymentRequest = {
|
|
46
|
+
order?: {
|
|
47
|
+
/**
|
|
48
|
+
* Identifier of an order for which the payment should be authorized.
|
|
49
|
+
*/
|
|
50
|
+
id?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Identifier of a payment mode configured in the payment-gateway service for a given tenant.
|
|
54
|
+
*/
|
|
55
|
+
paymentModeId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates a payment method token, usually generated on a frontend site, when an user provides a credit card information.
|
|
58
|
+
*/
|
|
59
|
+
creditCardToken?: string;
|
|
60
|
+
};
|
|
61
|
+
type AuthorizeFrontendPaymentRequest = InitializePaymentRequest & {
|
|
62
|
+
/**
|
|
63
|
+
* Contains a token generated during the 3DS authentication process.
|
|
64
|
+
*/
|
|
65
|
+
threeDSToken?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Holds information related to the user's web browser.
|
|
68
|
+
*/
|
|
69
|
+
browserInfo?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Stores the IP address of the client or user making the request.
|
|
72
|
+
*/
|
|
73
|
+
clientIP?: string;
|
|
74
|
+
};
|
|
75
|
+
type AuthorizePaymentRequest = AuthorizeFrontendPaymentRequest & {
|
|
76
|
+
/**
|
|
77
|
+
* Amount that should be authorized.
|
|
78
|
+
*/
|
|
79
|
+
amountToAuthorize?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Currency for the amount that should be authorized.
|
|
82
|
+
*/
|
|
83
|
+
currency?: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** A frontend payment mode (generated). */
|
|
87
|
+
type PaymentMode = PaymentModeFrontendResponse;
|
|
88
|
+
/** Post-checkout authorize request (generated; caller sends the exact wire shape). */
|
|
89
|
+
type AuthorizePaymentInput = AuthorizePaymentRequest;
|
|
90
|
+
/** Post-checkout authorize result. */
|
|
91
|
+
interface AuthorizePaymentResult {
|
|
92
|
+
successful: boolean;
|
|
93
|
+
paymentTransactionId?: string;
|
|
94
|
+
authorizationToken?: string;
|
|
95
|
+
requiresExternalPayment?: boolean;
|
|
96
|
+
externalPaymentRedirectURL?: string;
|
|
97
|
+
externalPaymentHttpMethod?: string;
|
|
98
|
+
[k: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
/** Payment-Gateway: list frontend payment modes, authorize deferred payments. */
|
|
101
|
+
declare class PaymentGatewayService {
|
|
102
|
+
private readonly ctx;
|
|
103
|
+
constructor(ctx: ClientContext);
|
|
104
|
+
/** Lists configured frontend payment modes. */
|
|
105
|
+
listPaymentModes(auth?: AuthContext): Promise<PaymentMode[]>;
|
|
106
|
+
/** Authorizes a post-checkout (deferred) payment for an existing order. */
|
|
107
|
+
authorize(input: AuthorizePaymentInput, auth?: AuthContext): Promise<AuthorizePaymentResult>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type AuthorizePaymentInput, type AuthorizePaymentResult, PaymentGatewayService, type PaymentMode };
|
package/dist/payment.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"payment.js"}
|