@longvansoftware/service-js-client 1.7.9 → 1.8.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.
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
|
3
|
+
exports.ADD_TO_CART = exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.CREATE_ORDER = (0, graphql_tag_1.gql) `
|
6
6
|
mutation CreateOrder($input: CreateOrderInput!) {
|
@@ -270,3 +270,75 @@ exports.UPDATE_QUANTITY_V2 = (0, graphql_tag_1.gql) `
|
|
270
270
|
}
|
271
271
|
}
|
272
272
|
`;
|
273
|
+
exports.ADD_TO_CART = (0, graphql_tag_1.gql) `
|
274
|
+
mutation AddToCart($serviceId: String!, $actorId: String!, $cartId: String) {
|
275
|
+
addToCart(serviceId: $serviceId, actorId: $actorId, cartId: $cartId) {
|
276
|
+
order {
|
277
|
+
financialStatus
|
278
|
+
orderStatus
|
279
|
+
ownerName
|
280
|
+
ownerEmail
|
281
|
+
ownerPhone
|
282
|
+
ownerPartyId
|
283
|
+
orderId
|
284
|
+
id
|
285
|
+
createdAt
|
286
|
+
currentTotalPrice {
|
287
|
+
amount
|
288
|
+
currencyCode
|
289
|
+
}
|
290
|
+
createdStamp
|
291
|
+
}
|
292
|
+
lineItems {
|
293
|
+
orderLineItem {
|
294
|
+
unitType
|
295
|
+
customAttributes {
|
296
|
+
key
|
297
|
+
value
|
298
|
+
}
|
299
|
+
id
|
300
|
+
orderItemId
|
301
|
+
quantity
|
302
|
+
totalVAT {
|
303
|
+
amount
|
304
|
+
currencyCode
|
305
|
+
}
|
306
|
+
variant {
|
307
|
+
id
|
308
|
+
price {
|
309
|
+
amount
|
310
|
+
currencyCode
|
311
|
+
}
|
312
|
+
product {
|
313
|
+
id
|
314
|
+
title
|
315
|
+
}
|
316
|
+
title
|
317
|
+
unitPrice {
|
318
|
+
amount
|
319
|
+
currencyCode
|
320
|
+
}
|
321
|
+
}
|
322
|
+
productOptions {
|
323
|
+
idOption
|
324
|
+
name
|
325
|
+
value
|
326
|
+
title
|
327
|
+
}
|
328
|
+
resourceItems {
|
329
|
+
name
|
330
|
+
quantity
|
331
|
+
unit
|
332
|
+
productId
|
333
|
+
}
|
334
|
+
resourceConfigs {
|
335
|
+
name
|
336
|
+
quantity
|
337
|
+
unit
|
338
|
+
productId
|
339
|
+
}
|
340
|
+
}
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
`;
|
@@ -8,4 +8,5 @@ export declare class OrderGraphQLService extends Service {
|
|
8
8
|
updateQuantityV2(payload: any): Promise<any>;
|
9
9
|
getOrderLineItemByServiceId(serviceId: string): Promise<any>;
|
10
10
|
getOrderByServiceId(serviceId: string): Promise<any>;
|
11
|
+
addToCart(serviceId: string, actorId: string, cartId: string): Promise<any>;
|
11
12
|
}
|
@@ -102,5 +102,23 @@ class OrderGraphQLService extends serviceSDK_1.Service {
|
|
102
102
|
}
|
103
103
|
});
|
104
104
|
}
|
105
|
+
addToCart(serviceId, actorId, cartId) {
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
107
|
+
const mutation = mutations_1.ADD_TO_CART;
|
108
|
+
const variables = {
|
109
|
+
serviceId,
|
110
|
+
actorId,
|
111
|
+
cartId
|
112
|
+
};
|
113
|
+
try {
|
114
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
115
|
+
return response.addToCart;
|
116
|
+
}
|
117
|
+
catch (error) {
|
118
|
+
console.log(`Error in addToCart: ${error}`);
|
119
|
+
throw error;
|
120
|
+
}
|
121
|
+
});
|
122
|
+
}
|
105
123
|
}
|
106
124
|
exports.OrderGraphQLService = OrderGraphQLService;
|