@@ -122,11 +122,6 @@ export class ViURShopClient {
122
122
. then ( req => req . json ( ) ) ;
123
123
}
124
124
125
- // --- Basket ---------------------------------------------------------------
126
- basket_list ( ) {
127
- return request ( `${ this . shop_api_url } /basket_list` ) . then ( req => req . json ( ) ) ;
128
- }
129
-
130
125
// --- Cart ---------------------------------------------------------------
131
126
132
127
/**
@@ -236,6 +231,26 @@ export class ViURShopClient {
236
231
. then ( req => req . json ( ) ) ;
237
232
}
238
233
234
+ /**
235
+ * List the children of the basket (the cart stored in the session)
236
+ *
237
+ * @returns {Promise<Response> }
238
+ */
239
+ basket_list ( ) {
240
+ return request ( `${ this . shop_api_url } /basket_list` )
241
+ . then ( req => req . json ( ) ) ;
242
+ }
243
+
244
+ /**
245
+ * View the basket (the cart stored in the session) itself
246
+ *
247
+ * @returns {Promise<Response> }
248
+ */
249
+ basket_view ( ) {
250
+ return request ( `${ this . shop_api_url } /basket_view` )
251
+ . then ( req => req . json ( ) ) ;
252
+ }
253
+
239
254
cart_structure ( ) {
240
255
return request ( `${ this . getStructure_url } /${ this . shop_module } .cart` , {
241
256
method : 'GET' ,
@@ -308,7 +323,24 @@ export class ViURShopClient {
308
323
309
324
// --- Order --------------------------------------------------------------
310
325
311
- payment_providers_list ( { } = { } ) {
326
+
327
+ /**
328
+ * Get a list of payment providers.
329
+ *
330
+ * This API method returns a JSON response containing a object of
331
+ * payment providers. The keys in the response represent provider
332
+ * identifiers, and the values are objects describing the details of
333
+ * each provider.
334
+ *
335
+ * @param {boolean } [onlyAvailable=true] -
336
+ * If true, only payment providers that are currently available
337
+ * will be included in the response. If false, all providers will
338
+ * be listed regardless of availability.
339
+ * @returns {Promise<Response> }
340
+ */
341
+ payment_providers_list ( {
342
+ only_available = true ,
343
+ } = { } ) {
312
344
return request ( `${ this . shop_url } /order/payment_providers_list` )
313
345
. then ( req => req . json ( ) ) ;
314
346
}
@@ -365,37 +397,65 @@ export class ViURShopClient {
365
397
. then ( req => req . json ( ) ) ;
366
398
}
367
399
368
- order_checkout_start ( {
369
- order_key,
370
- } = { } ) {
371
- return request ( `${ this . shop_url } /order/checkout_start` , {
372
- method : 'POST' ,
400
+ /**
401
+ * List the orders of the current user
402
+ * @param {object } param Any key-value pairs for filtering or ordering
403
+ * @returns {Promise<Response> }
404
+ */
405
+ order_list ( param = { } ) {
406
+ return request ( `${ this . shop_url } /api/order_list` , {
407
+ method : 'GET' ,
408
+ params,
409
+ } )
410
+ . then ( req => req . json ( ) ) ;
411
+ }
412
+
413
+ /**
414
+ * View an order
415
+ * @param {String } order_key Key of the order to view.
416
+ * Use "SESSION" as key to view the order of the current session
417
+ * @returns {Promise<Response> }
418
+ */
419
+ order_view ( {
420
+ order_key = 'SESSION' ,
421
+ } = { } ) {
422
+ return request ( `${ this . shop_url } /api/order_view` , {
423
+ method : 'GET' ,
373
424
params : { order_key} ,
374
425
} )
375
426
. then ( req => req . json ( ) ) ;
376
427
}
377
428
378
- order_checkout_order ( {
429
+ /**
430
+ * Start the checkout process
431
+ * @param {String } key The key of the order
432
+ * @returns {Promise<Response> }
433
+ */
434
+ order_checkout_start ( {
379
435
order_key,
380
436
} = { } ) {
381
- return request ( `${ this . shop_url } /order/checkout_order ` , {
437
+ return request ( `${ this . shop_url } /order/checkout_start ` , {
382
438
method : 'POST' ,
383
439
params : { order_key} ,
384
440
} )
385
441
. then ( req => req . json ( ) ) ;
386
442
}
387
443
388
- order_pp_get_settings ( {
389
- order_key,
390
- } = { } ) {
444
+ /**
445
+ * The final order now step
446
+ * @param {String } key The key of the order
447
+ * @returns {Promise<Response> }
448
+ */
449
+ order_checkout_order ( {
450
+ order_key,
451
+ } = { } ) {
391
452
return request ( `${ this . shop_url } /order/checkout_order` , {
392
453
method : 'POST' ,
393
454
params : { order_key} ,
394
455
} )
395
456
. then ( req => req . json ( ) ) ;
396
457
}
397
458
398
-
399
459
// --- User ---------------------------------------------------------------
400
460
401
461
user_view ( {
0 commit comments