order3000 0.10.1 → 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/dist/client.cjs +38 -0
- package/dist/client.d.cts +70 -2
- package/dist/client.d.mts +70 -2
- package/dist/client.mjs +38 -0
- package/package.json +3 -3
package/dist/client.cjs
CHANGED
|
@@ -273,12 +273,45 @@ class OrdersResource extends BaseResource {
|
|
|
273
273
|
constructor(tokenManager, baseUrl) {
|
|
274
274
|
super(tokenManager, baseUrl, "/orders");
|
|
275
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Place a new order.
|
|
278
|
+
*
|
|
279
|
+
* The order3000 backend calculates taxAmount and totalAmount from the basket items:
|
|
280
|
+
* - totalAmount: derived from basket items' prices (bundleId -> price)
|
|
281
|
+
* - taxAmount: derived from basket items' tax rates (bundleId -> taxRateId -> rate)
|
|
282
|
+
*
|
|
283
|
+
* SDK callers cannot provide these values - they're implicit from the basket contents.
|
|
284
|
+
*/
|
|
276
285
|
async place(order) {
|
|
277
286
|
return this.request("POST", "", order);
|
|
278
287
|
}
|
|
279
288
|
async get(orderId) {
|
|
280
289
|
return this.request("GET", `/${orderId}`);
|
|
281
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Confirm an order after client-side Stripe payment has succeeded.
|
|
293
|
+
*
|
|
294
|
+
* Verifies the PaymentIntent status with Stripe and transitions
|
|
295
|
+
* the order to 'paid' status.
|
|
296
|
+
*/
|
|
297
|
+
async confirm(orderId, request) {
|
|
298
|
+
return this.request("POST", `/${orderId}/confirm`, request);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
class PaymentIntentsResource extends BaseResource {
|
|
303
|
+
constructor(tokenManager, baseUrl) {
|
|
304
|
+
super(tokenManager, baseUrl, "/payment-intents");
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Create a Stripe PaymentIntent via order3000's Stripe Connect integration.
|
|
308
|
+
*
|
|
309
|
+
* Returns a clientSecret for client-side payment confirmation and an orderId
|
|
310
|
+
* for the draft order that was created.
|
|
311
|
+
*/
|
|
312
|
+
async create(request) {
|
|
313
|
+
return this.request("POST", "", request);
|
|
314
|
+
}
|
|
282
315
|
}
|
|
283
316
|
|
|
284
317
|
class ReservationsResource extends BaseResource {
|
|
@@ -631,6 +664,7 @@ class Order3000Client {
|
|
|
631
664
|
__publicField(this, "events");
|
|
632
665
|
__publicField(this, "menus");
|
|
633
666
|
__publicField(this, "orders");
|
|
667
|
+
__publicField(this, "paymentIntents");
|
|
634
668
|
__publicField(this, "reservations");
|
|
635
669
|
__publicField(this, "realtime");
|
|
636
670
|
__publicField(this, "baseUrl");
|
|
@@ -647,6 +681,10 @@ class Order3000Client {
|
|
|
647
681
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
648
682
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
649
683
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|
|
684
|
+
this.paymentIntents = new PaymentIntentsResource(
|
|
685
|
+
this.tokenManager,
|
|
686
|
+
this.baseUrl
|
|
687
|
+
);
|
|
650
688
|
this.reservations = new ReservationsResource(
|
|
651
689
|
this.tokenManager,
|
|
652
690
|
this.baseUrl
|
package/dist/client.d.cts
CHANGED
|
@@ -110,6 +110,8 @@ interface components {
|
|
|
110
110
|
id?: string;
|
|
111
111
|
venueId: string;
|
|
112
112
|
basketId: string;
|
|
113
|
+
publicId?: string | null;
|
|
114
|
+
quickReferenceNumber?: number | null;
|
|
113
115
|
/** @enum {string} */
|
|
114
116
|
status?: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
|
|
115
117
|
paymentIntentId?: string | null;
|
|
@@ -119,6 +121,9 @@ interface components {
|
|
|
119
121
|
totalAmount: number;
|
|
120
122
|
/** @enum {string} */
|
|
121
123
|
currency?: "EUR" | "CHF";
|
|
124
|
+
/** @enum {string|null} */
|
|
125
|
+
fulfillmentType?: "pickup" | "delivery" | null;
|
|
126
|
+
fulfillmentAt?: unknown;
|
|
122
127
|
orderedAt?: unknown;
|
|
123
128
|
orderedBy: string;
|
|
124
129
|
updatedAt?: unknown;
|
|
@@ -129,6 +134,8 @@ interface components {
|
|
|
129
134
|
id: string;
|
|
130
135
|
venueId: string;
|
|
131
136
|
basketId: string;
|
|
137
|
+
publicId: string | null;
|
|
138
|
+
quickReferenceNumber: number | null;
|
|
132
139
|
/** @enum {string} */
|
|
133
140
|
status: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
|
|
134
141
|
paymentIntentId: string | null;
|
|
@@ -138,6 +145,9 @@ interface components {
|
|
|
138
145
|
totalAmount: number;
|
|
139
146
|
/** @enum {string} */
|
|
140
147
|
currency: "EUR" | "CHF";
|
|
148
|
+
/** @enum {string|null} */
|
|
149
|
+
fulfillmentType: "pickup" | "delivery" | null;
|
|
150
|
+
fulfillmentAt: unknown;
|
|
141
151
|
orderedAt: unknown;
|
|
142
152
|
orderedBy: string;
|
|
143
153
|
updatedAt: unknown;
|
|
@@ -292,7 +302,17 @@ interface components {
|
|
|
292
302
|
type schemas = components['schemas'];
|
|
293
303
|
type CreateEventRequest = schemas['CreateEventRequest'];
|
|
294
304
|
type CreateEventResponse = schemas['CreateEventResponse'];
|
|
295
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
|
|
307
|
+
* Keep in sync with apps/order3000/src/drizzle/enums.ts
|
|
308
|
+
*/
|
|
309
|
+
type OrderFulfillmentType = 'pickup' | 'delivery';
|
|
310
|
+
type PlaceOrderRequest = Omit<schemas['PlaceOrderRequest'], 'taxAmount' | 'totalAmount'> & {
|
|
311
|
+
/** Fulfillment type for the order (pickup or delivery) */
|
|
312
|
+
fulfillmentType?: OrderFulfillmentType;
|
|
313
|
+
/** When the order should be fulfilled (pickup/delivery time) */
|
|
314
|
+
fulfillmentAt?: Date;
|
|
315
|
+
};
|
|
296
316
|
type PlaceOrderResponse = schemas['PlaceOrderResponse'];
|
|
297
317
|
type MakeReservationRequest = schemas['MakeReservationRequest'];
|
|
298
318
|
type MakeReservationResponse = schemas['MakeReservationResponse'];
|
|
@@ -623,6 +643,26 @@ interface RemoveFromBasketResponse {
|
|
|
623
643
|
basketItemId: string;
|
|
624
644
|
itemCount: number;
|
|
625
645
|
}
|
|
646
|
+
interface CreatePaymentIntentRequest {
|
|
647
|
+
basketId: string;
|
|
648
|
+
currency: Currency;
|
|
649
|
+
sessionId: string;
|
|
650
|
+
fulfillmentType?: OrderFulfillmentType;
|
|
651
|
+
fulfillmentTime?: string;
|
|
652
|
+
}
|
|
653
|
+
interface CreatePaymentIntentResponse {
|
|
654
|
+
clientSecret: string;
|
|
655
|
+
paymentIntentId: string;
|
|
656
|
+
orderId: string;
|
|
657
|
+
}
|
|
658
|
+
interface ConfirmOrderRequest {
|
|
659
|
+
paymentIntentId: string;
|
|
660
|
+
}
|
|
661
|
+
interface ConfirmOrderResponse {
|
|
662
|
+
id: string;
|
|
663
|
+
status: string;
|
|
664
|
+
publicId: string | null;
|
|
665
|
+
}
|
|
626
666
|
|
|
627
667
|
declare class BasketsResource extends BaseResource {
|
|
628
668
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
@@ -709,8 +749,35 @@ declare class MenusResource extends BaseResource {
|
|
|
709
749
|
|
|
710
750
|
declare class OrdersResource extends BaseResource {
|
|
711
751
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
752
|
+
/**
|
|
753
|
+
* Place a new order.
|
|
754
|
+
*
|
|
755
|
+
* The order3000 backend calculates taxAmount and totalAmount from the basket items:
|
|
756
|
+
* - totalAmount: derived from basket items' prices (bundleId -> price)
|
|
757
|
+
* - taxAmount: derived from basket items' tax rates (bundleId -> taxRateId -> rate)
|
|
758
|
+
*
|
|
759
|
+
* SDK callers cannot provide these values - they're implicit from the basket contents.
|
|
760
|
+
*/
|
|
712
761
|
place(order: PlaceOrderRequest): Promise<PlaceOrderResponse>;
|
|
713
762
|
get(orderId: string): Promise<PlaceOrderRequest>;
|
|
763
|
+
/**
|
|
764
|
+
* Confirm an order after client-side Stripe payment has succeeded.
|
|
765
|
+
*
|
|
766
|
+
* Verifies the PaymentIntent status with Stripe and transitions
|
|
767
|
+
* the order to 'paid' status.
|
|
768
|
+
*/
|
|
769
|
+
confirm(orderId: string, request: ConfirmOrderRequest): Promise<ConfirmOrderResponse>;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
declare class PaymentIntentsResource extends BaseResource {
|
|
773
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
774
|
+
/**
|
|
775
|
+
* Create a Stripe PaymentIntent via order3000's Stripe Connect integration.
|
|
776
|
+
*
|
|
777
|
+
* Returns a clientSecret for client-side payment confirmation and an orderId
|
|
778
|
+
* for the draft order that was created.
|
|
779
|
+
*/
|
|
780
|
+
create(request: CreatePaymentIntentRequest): Promise<CreatePaymentIntentResponse>;
|
|
714
781
|
}
|
|
715
782
|
|
|
716
783
|
declare class ReservationsResource extends BaseResource {
|
|
@@ -890,6 +957,7 @@ declare class Order3000Client {
|
|
|
890
957
|
events: EventsResource;
|
|
891
958
|
menus: MenusResource;
|
|
892
959
|
orders: OrdersResource;
|
|
960
|
+
paymentIntents: PaymentIntentsResource;
|
|
893
961
|
reservations: ReservationsResource;
|
|
894
962
|
realtime: RealtimeManager;
|
|
895
963
|
private readonly baseUrl;
|
|
@@ -897,4 +965,4 @@ declare class Order3000Client {
|
|
|
897
965
|
constructor(config: Order3000ClientConfig);
|
|
898
966
|
}
|
|
899
967
|
|
|
900
|
-
export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, Order3000Client, type Order3000ClientConfig, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscriptionOptions, type TimeSlot, type Unit, getScheduleInfo };
|
|
968
|
+
export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type ConfirmOrderRequest, type ConfirmOrderResponse, type CreatePaymentIntentRequest, type CreatePaymentIntentResponse, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, Order3000Client, type Order3000ClientConfig, type OrderFulfillmentType, type PlaceOrderRequest, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscriptionOptions, type TimeSlot, type Unit, getScheduleInfo };
|
package/dist/client.d.mts
CHANGED
|
@@ -110,6 +110,8 @@ interface components {
|
|
|
110
110
|
id?: string;
|
|
111
111
|
venueId: string;
|
|
112
112
|
basketId: string;
|
|
113
|
+
publicId?: string | null;
|
|
114
|
+
quickReferenceNumber?: number | null;
|
|
113
115
|
/** @enum {string} */
|
|
114
116
|
status?: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
|
|
115
117
|
paymentIntentId?: string | null;
|
|
@@ -119,6 +121,9 @@ interface components {
|
|
|
119
121
|
totalAmount: number;
|
|
120
122
|
/** @enum {string} */
|
|
121
123
|
currency?: "EUR" | "CHF";
|
|
124
|
+
/** @enum {string|null} */
|
|
125
|
+
fulfillmentType?: "pickup" | "delivery" | null;
|
|
126
|
+
fulfillmentAt?: unknown;
|
|
122
127
|
orderedAt?: unknown;
|
|
123
128
|
orderedBy: string;
|
|
124
129
|
updatedAt?: unknown;
|
|
@@ -129,6 +134,8 @@ interface components {
|
|
|
129
134
|
id: string;
|
|
130
135
|
venueId: string;
|
|
131
136
|
basketId: string;
|
|
137
|
+
publicId: string | null;
|
|
138
|
+
quickReferenceNumber: number | null;
|
|
132
139
|
/** @enum {string} */
|
|
133
140
|
status: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
|
|
134
141
|
paymentIntentId: string | null;
|
|
@@ -138,6 +145,9 @@ interface components {
|
|
|
138
145
|
totalAmount: number;
|
|
139
146
|
/** @enum {string} */
|
|
140
147
|
currency: "EUR" | "CHF";
|
|
148
|
+
/** @enum {string|null} */
|
|
149
|
+
fulfillmentType: "pickup" | "delivery" | null;
|
|
150
|
+
fulfillmentAt: unknown;
|
|
141
151
|
orderedAt: unknown;
|
|
142
152
|
orderedBy: string;
|
|
143
153
|
updatedAt: unknown;
|
|
@@ -292,7 +302,17 @@ interface components {
|
|
|
292
302
|
type schemas = components['schemas'];
|
|
293
303
|
type CreateEventRequest = schemas['CreateEventRequest'];
|
|
294
304
|
type CreateEventResponse = schemas['CreateEventResponse'];
|
|
295
|
-
|
|
305
|
+
/**
|
|
306
|
+
* Order fulfillment type - matches order_fulfillment_type enum in order3000 database.
|
|
307
|
+
* Keep in sync with apps/order3000/src/drizzle/enums.ts
|
|
308
|
+
*/
|
|
309
|
+
type OrderFulfillmentType = 'pickup' | 'delivery';
|
|
310
|
+
type PlaceOrderRequest = Omit<schemas['PlaceOrderRequest'], 'taxAmount' | 'totalAmount'> & {
|
|
311
|
+
/** Fulfillment type for the order (pickup or delivery) */
|
|
312
|
+
fulfillmentType?: OrderFulfillmentType;
|
|
313
|
+
/** When the order should be fulfilled (pickup/delivery time) */
|
|
314
|
+
fulfillmentAt?: Date;
|
|
315
|
+
};
|
|
296
316
|
type PlaceOrderResponse = schemas['PlaceOrderResponse'];
|
|
297
317
|
type MakeReservationRequest = schemas['MakeReservationRequest'];
|
|
298
318
|
type MakeReservationResponse = schemas['MakeReservationResponse'];
|
|
@@ -623,6 +643,26 @@ interface RemoveFromBasketResponse {
|
|
|
623
643
|
basketItemId: string;
|
|
624
644
|
itemCount: number;
|
|
625
645
|
}
|
|
646
|
+
interface CreatePaymentIntentRequest {
|
|
647
|
+
basketId: string;
|
|
648
|
+
currency: Currency;
|
|
649
|
+
sessionId: string;
|
|
650
|
+
fulfillmentType?: OrderFulfillmentType;
|
|
651
|
+
fulfillmentTime?: string;
|
|
652
|
+
}
|
|
653
|
+
interface CreatePaymentIntentResponse {
|
|
654
|
+
clientSecret: string;
|
|
655
|
+
paymentIntentId: string;
|
|
656
|
+
orderId: string;
|
|
657
|
+
}
|
|
658
|
+
interface ConfirmOrderRequest {
|
|
659
|
+
paymentIntentId: string;
|
|
660
|
+
}
|
|
661
|
+
interface ConfirmOrderResponse {
|
|
662
|
+
id: string;
|
|
663
|
+
status: string;
|
|
664
|
+
publicId: string | null;
|
|
665
|
+
}
|
|
626
666
|
|
|
627
667
|
declare class BasketsResource extends BaseResource {
|
|
628
668
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
@@ -709,8 +749,35 @@ declare class MenusResource extends BaseResource {
|
|
|
709
749
|
|
|
710
750
|
declare class OrdersResource extends BaseResource {
|
|
711
751
|
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
752
|
+
/**
|
|
753
|
+
* Place a new order.
|
|
754
|
+
*
|
|
755
|
+
* The order3000 backend calculates taxAmount and totalAmount from the basket items:
|
|
756
|
+
* - totalAmount: derived from basket items' prices (bundleId -> price)
|
|
757
|
+
* - taxAmount: derived from basket items' tax rates (bundleId -> taxRateId -> rate)
|
|
758
|
+
*
|
|
759
|
+
* SDK callers cannot provide these values - they're implicit from the basket contents.
|
|
760
|
+
*/
|
|
712
761
|
place(order: PlaceOrderRequest): Promise<PlaceOrderResponse>;
|
|
713
762
|
get(orderId: string): Promise<PlaceOrderRequest>;
|
|
763
|
+
/**
|
|
764
|
+
* Confirm an order after client-side Stripe payment has succeeded.
|
|
765
|
+
*
|
|
766
|
+
* Verifies the PaymentIntent status with Stripe and transitions
|
|
767
|
+
* the order to 'paid' status.
|
|
768
|
+
*/
|
|
769
|
+
confirm(orderId: string, request: ConfirmOrderRequest): Promise<ConfirmOrderResponse>;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
declare class PaymentIntentsResource extends BaseResource {
|
|
773
|
+
constructor(tokenManager: TokenManager, baseUrl: string);
|
|
774
|
+
/**
|
|
775
|
+
* Create a Stripe PaymentIntent via order3000's Stripe Connect integration.
|
|
776
|
+
*
|
|
777
|
+
* Returns a clientSecret for client-side payment confirmation and an orderId
|
|
778
|
+
* for the draft order that was created.
|
|
779
|
+
*/
|
|
780
|
+
create(request: CreatePaymentIntentRequest): Promise<CreatePaymentIntentResponse>;
|
|
714
781
|
}
|
|
715
782
|
|
|
716
783
|
declare class ReservationsResource extends BaseResource {
|
|
@@ -890,6 +957,7 @@ declare class Order3000Client {
|
|
|
890
957
|
events: EventsResource;
|
|
891
958
|
menus: MenusResource;
|
|
892
959
|
orders: OrdersResource;
|
|
960
|
+
paymentIntents: PaymentIntentsResource;
|
|
893
961
|
reservations: ReservationsResource;
|
|
894
962
|
realtime: RealtimeManager;
|
|
895
963
|
private readonly baseUrl;
|
|
@@ -897,4 +965,4 @@ declare class Order3000Client {
|
|
|
897
965
|
constructor(config: Order3000ClientConfig);
|
|
898
966
|
}
|
|
899
967
|
|
|
900
|
-
export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, Order3000Client, type Order3000ClientConfig, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscriptionOptions, type TimeSlot, type Unit, getScheduleInfo };
|
|
968
|
+
export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type ConfirmOrderRequest, type ConfirmOrderResponse, type CreatePaymentIntentRequest, type CreatePaymentIntentResponse, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, Order3000Client, type Order3000ClientConfig, type OrderFulfillmentType, type PlaceOrderRequest, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscriptionOptions, type TimeSlot, type Unit, getScheduleInfo };
|
package/dist/client.mjs
CHANGED
|
@@ -271,12 +271,45 @@ class OrdersResource extends BaseResource {
|
|
|
271
271
|
constructor(tokenManager, baseUrl) {
|
|
272
272
|
super(tokenManager, baseUrl, "/orders");
|
|
273
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Place a new order.
|
|
276
|
+
*
|
|
277
|
+
* The order3000 backend calculates taxAmount and totalAmount from the basket items:
|
|
278
|
+
* - totalAmount: derived from basket items' prices (bundleId -> price)
|
|
279
|
+
* - taxAmount: derived from basket items' tax rates (bundleId -> taxRateId -> rate)
|
|
280
|
+
*
|
|
281
|
+
* SDK callers cannot provide these values - they're implicit from the basket contents.
|
|
282
|
+
*/
|
|
274
283
|
async place(order) {
|
|
275
284
|
return this.request("POST", "", order);
|
|
276
285
|
}
|
|
277
286
|
async get(orderId) {
|
|
278
287
|
return this.request("GET", `/${orderId}`);
|
|
279
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Confirm an order after client-side Stripe payment has succeeded.
|
|
291
|
+
*
|
|
292
|
+
* Verifies the PaymentIntent status with Stripe and transitions
|
|
293
|
+
* the order to 'paid' status.
|
|
294
|
+
*/
|
|
295
|
+
async confirm(orderId, request) {
|
|
296
|
+
return this.request("POST", `/${orderId}/confirm`, request);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
class PaymentIntentsResource extends BaseResource {
|
|
301
|
+
constructor(tokenManager, baseUrl) {
|
|
302
|
+
super(tokenManager, baseUrl, "/payment-intents");
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Create a Stripe PaymentIntent via order3000's Stripe Connect integration.
|
|
306
|
+
*
|
|
307
|
+
* Returns a clientSecret for client-side payment confirmation and an orderId
|
|
308
|
+
* for the draft order that was created.
|
|
309
|
+
*/
|
|
310
|
+
async create(request) {
|
|
311
|
+
return this.request("POST", "", request);
|
|
312
|
+
}
|
|
280
313
|
}
|
|
281
314
|
|
|
282
315
|
class ReservationsResource extends BaseResource {
|
|
@@ -629,6 +662,7 @@ class Order3000Client {
|
|
|
629
662
|
__publicField(this, "events");
|
|
630
663
|
__publicField(this, "menus");
|
|
631
664
|
__publicField(this, "orders");
|
|
665
|
+
__publicField(this, "paymentIntents");
|
|
632
666
|
__publicField(this, "reservations");
|
|
633
667
|
__publicField(this, "realtime");
|
|
634
668
|
__publicField(this, "baseUrl");
|
|
@@ -645,6 +679,10 @@ class Order3000Client {
|
|
|
645
679
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
646
680
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
647
681
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|
|
682
|
+
this.paymentIntents = new PaymentIntentsResource(
|
|
683
|
+
this.tokenManager,
|
|
684
|
+
this.baseUrl
|
|
685
|
+
);
|
|
648
686
|
this.reservations = new ReservationsResource(
|
|
649
687
|
this.tokenManager,
|
|
650
688
|
this.baseUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "order3000",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "order3000 node.js sdk",
|
|
5
5
|
"main": "./dist/client.cjs",
|
|
6
6
|
"module": "./dist/client.mjs",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"prettier": "^3.7.4",
|
|
31
31
|
"tsx": "^4.19.2",
|
|
32
32
|
"typescript": "^5.9.3",
|
|
33
|
-
"@kolaveri/eslint-config": "1.4.0",
|
|
34
33
|
"@kolaveri/prettier-config": "1.0.6",
|
|
35
|
-
"@kolaveri/tsconfig": "1.0.1"
|
|
34
|
+
"@kolaveri/tsconfig": "1.0.1",
|
|
35
|
+
"@kolaveri/eslint-config": "1.4.0"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist"
|