-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathClient.php
1336 lines (1079 loc) · 37.3 KB
/
Client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace Picqer\Api;
class Client
{
protected string $company;
protected string $apiKey;
protected string $password;
protected string $protocol = 'https';
protected string $apiHost = 'picqer.com';
protected string $apiLocation = '/api';
protected string $apiVersion = 'v1';
protected string $userAgent = 'Picqer PHP API Client (picqer.com)';
protected string $clientVersion = '0.23.1';
protected bool $debug = false;
protected bool $skipSslVerification = false;
protected int $timeoutInSeconds = 60;
protected bool $waitOnRateLimit = false;
protected int $sleepTimeOnRateLimitHitInSeconds = 20;
protected array $entityBaseMethodNameMap = [
'product' => 'getProducts',
'picklistBatch' => 'getPicklistBatches',
'returnStatus' => 'getReturnStatuses',
];
const METHOD_GET = 'GET';
const METHOD_POST = 'POST';
const METHOD_PUT = 'PUT';
const METHOD_DELETE = 'DELETE';
protected array $rawResponseHeaders = [];
public function __construct($company, $apikey = '', $password = 'X')
{
$this->company = $company;
$this->apiKey = $apikey;
$this->password = $password; // Only needed with legacy integrations
}
/*
* Customers
*/
public function getCustomers($filters = [])
{
return $this->sendRequest('/customers', null, null, $filters);
}
public function getAllCustomers($filters = [])
{
return $this->getAllResults('customer', $filters);
}
public function getCustomer($idcustomer)
{
return $this->sendRequest('/customers/' . $idcustomer);
}
public function getCustomerByCustomerid($customerid)
{
$result = $this->sendRequest('/customers?customerid=' . urlencode($customerid));
if (is_array($result['data']) && count($result['data']) == 1) {
$result['data'] = $result['data'][0];
} else {
$result['data'] = null;
}
return $result;
}
public function addCustomer($params)
{
return $this->sendRequest('/customers', $params, self::METHOD_POST);
}
/** @deprecated Use the `update`, stays here for backwards compatibility */
public function editCustomer($idcustomer, $params)
{
$this->updateCustomer($idcustomer, $params);
}
public function updateCustomer($idcustomer, $params)
{
return $this->sendRequest('/customers/' . $idcustomer, $params, self::METHOD_PUT);
}
public function getCustomerAddress($idcustomer)
{
return $this->sendRequest('/customers/' . $idcustomer . '/addresses');
}
public function addCustomerAddress($idcustomer, $params)
{
return $this->sendRequest('/customers/' . $idcustomer . '/addresses', $params, self::METHOD_POST);
}
public function updateCustomerAddress($idcustomer, $idaddress, $params)
{
return $this->sendRequest('/customers/' . $idcustomer . '/addresses/' . $idaddress, $params, self::METHOD_PUT);
}
public function deleteCustomerAddress($idcustomer, $idaddress)
{
return $this->sendRequest('/customers/' . $idcustomer . '/addresses/' . $idaddress, [], self::METHOD_DELETE);
}
public function getCustomerTags($idcustomer)
{
return $this->sendRequest('/customers/' . $idcustomer . '/tags');
}
public function addCustomerTag($idcustomer, $idtag)
{
return $this->sendRequest('/customers/' . $idcustomer . '/tags', ['idtag' => $idtag], self::METHOD_POST);
}
public function deleteCustomerTag($idcustomer, $idtag)
{
return $this->sendRequest('/customers/' . $idcustomer . '/tags/' . $idtag, [], self::METHOD_DELETE);
}
/**
* Fulfilment customers
*/
public function getFulfilmentCustomers($filters = [])
{
return $this->sendRequest('/fulfilment/customers', null, null, $filters);
}
public function getAllFulfilmentCustomers($filters = [])
{
return $this->getAllResults('fulfilmentCustomer', $filters);
}
public function getFulfilmentCustomer($idfulfilmentcustomer)
{
return $this->sendRequest('/fulfilment/customers/' . $idfulfilmentcustomer);
}
public function addFulfilmentCustomer($params)
{
return $this->sendRequest('/fulfilment/customers', $params, self::METHOD_POST);
}
public function updateFulfilmentCustomer($idfulfilmentcustomer, $params)
{
return $this->sendRequest('/fulfilment/customers/' . $idfulfilmentcustomer, $params, self::METHOD_PUT);
}
/*
* Products
*/
public function getProducts($filters = [])
{
return $this->sendRequest('/products', null, null, $filters);
}
public function getAllProducts($filters = [])
{
return $this->getAllResults('product', $filters);
}
public function getProduct($idproduct)
{
return $this->sendRequest('/products/' . $idproduct);
}
public function getProductByProductcode($productcode)
{
$result = $this->sendRequest('/products?productcode=' . urlencode($productcode));
if (is_array($result['data']) && count($result['data']) == 1) {
$result['data'] = $result['data'][0];
} else {
$result['data'] = null;
}
return $result;
}
public function addProduct($params)
{
return $this->sendRequest('/products', $params, self::METHOD_POST);
}
public function inactivateProduct($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/inactivate', [], self::METHOD_POST);
}
public function activateProduct($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/activate', [], self::METHOD_POST);
}
public function getProductStock($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/stock');
}
public function getProductStockForWarehouse($idproduct, $idwarehouse)
{
return $this->sendRequest('/products/' . $idproduct . '/stock/' . $idwarehouse);
}
public function updateProductStockForWarehouse($idproduct, $idwarehouse, $params)
{
return $this->sendRequest('/products/' . $idproduct . '/stock/' . $idwarehouse, $params, self::METHOD_POST);
}
public function getProductWarehouseSettings($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/warehouses');
}
public function updateProductWarehouseSetting($idproduct, $idwarehouse, $params)
{
return $this->sendRequest('/products/' . $idproduct . '/warehouses/' . $idwarehouse, $params, self::METHOD_PUT);
}
public function getProductImages($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/images');
}
public function addImageToProduct($idproduct, $base64Image)
{
return $this->sendRequest('/products/' . $idproduct . '/images', ['image' => $base64Image], self::METHOD_POST);
}
public function deleteImageFromProduct($idproduct, $idproduct_image)
{
return $this->sendRequest('/products/' . $idproduct . '/images/' . $idproduct_image, [], self::METHOD_DELETE);
}
public function updateProduct($idproduct, $params)
{
return $this->sendRequest('/products/' . $idproduct, $params, self::METHOD_PUT);
}
public function getProductTags($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/tags');
}
public function addProductTag($idproduct, $idtag)
{
return $this->sendRequest('/products/' . $idproduct . '/tags', ['idtag' => $idtag], self::METHOD_POST);
}
public function deleteProductTag($idproduct, $idtag)
{
return $this->sendRequest('/products/' . $idproduct . '/tags/' . $idtag, [], self::METHOD_DELETE);
}
public function getProductParts($idproduct)
{
return $this->sendRequest('/products/'.$idproduct.'/parts');
}
public function getProductPart($idproduct, $idproduct_part)
{
return $this->sendRequest('/products/'.$idproduct.'/parts/'.$idproduct_part);
}
public function addProductPart($idproduct, $params)
{
return $this->sendRequest('/products/' . $idproduct . '/parts', $params, self::METHOD_POST);
}
public function updateProductPartAmount($idproduct, $idproductpart, $amount)
{
$params = ['amount' => $amount];
return $this->sendRequest('/products/' . $idproduct . '/parts/'.$idproductpart, $params, self::METHOD_PUT);
}
public function deleteProductPart($idproduct, $idproductpart)
{
return $this->sendRequest('/products/' . $idproduct . '/parts/' . $idproductpart, [], self::METHOD_DELETE);
}
public function getProductLocations($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/locations');
}
public function linkProductToLocation($idproduct, $idlocation)
{
$params = array('idlocation' => $idlocation);
return $this->sendRequest('/products/' . $idproduct . '/locations', $params, self::METHOD_POST);
}
public function unlinkProductFromLocation($idproduct, $idlocation)
{
return $this->sendRequest('/products/' . $idproduct . '/locations/' . $idlocation, array(), self::METHOD_DELETE);
}
/*
* Stock history
*/
public function getStockHistories($filters = [])
{
return $this->sendRequest('/stockhistory', null, null, $filters);
}
public function getStockHistory($idproduct_stock_history)
{
return $this->sendRequest('/stockhistory/' . $idproduct_stock_history);
}
public function getStockHistoryForProduct($idproduct, $offset = 0)
{
return $this->getStockHistories(['idproduct' => $idproduct, 'offset' => $offset]);
}
public function getStockHistoryForWarehouse($idwarehouse, $offset = 0)
{
return $this->getStockHistories(['idwarehouse' => $idwarehouse, 'offset' => $offset]);
}
/*
* Orders
*/
public function getOrders($filters = [])
{
return $this->sendRequest('/orders', null, null, $filters);
}
public function getAllOrders($filters = [])
{
return $this->getAllResults('order', $filters);
}
public function getOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder);
}
public function getOrderByOrderid($orderid)
{
$result = $this->sendRequest('/orders?orderid=' . urlencode($orderid));
if (count($result['data']) == 1) {
$result['data'] = $result['data'][0];
}
return $result;
}
public function addOrder($params)
{
return $this->sendRequest('/orders', $params, self::METHOD_POST);
}
public function cancelOrder($idorder, $params = [])
{
return $this->sendRequest('/orders/' . $idorder, $params, self::METHOD_DELETE);
}
public function getOrderProductStatus($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/productstatus');
}
public function getOrderBackorders($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/backorders');
}
/** @deprecated Use `processOrder`, still here for backwards compatibility */
public function closeOrder($idorder)
{
return $this->processOrder($idorder);
}
public function processOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/process', null, self::METHOD_POST);
}
public function getOrderNotes($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/notes');
}
public function addOrderNote($idorder, $note)
{
return $this->sendRequest('/orders/' . $idorder . '/notes', ['note' => $note], self::METHOD_POST);
}
public function getOrderTags($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/tags');
}
public function createTag(string $title, string $color = '#823882', bool $inherit = false)
{
$params = [
'title' => $title,
'color' => $color,
'inherit' => $inherit
];
return $this->sendRequest('/tags/', $params, self::METHOD_POST);
}
public function deleteTag(string $idtag)
{
return $this->sendRequest('/tags/'.$idtag, [], self::METHOD_DELETE);
}
public function addOrderTag($idorder, $idtag)
{
$params = ['idtag' => $idtag];
return $this->sendRequest('/orders/' . $idorder . '/tags', $params, self::METHOD_POST);
}
/** @deprecated Use the `delete`, stays here for backwards compatibility */
public function removeOrderTag($idorder, $idtag)
{
$this->deleteOrderTag($idorder, $idtag);
}
public function deleteOrderTag($idorder, $idtag)
{
return $this->sendRequest('/orders/' . $idorder . '/tags/' . $idtag, [], self::METHOD_DELETE);
}
public function updateOrder($idorder, $params)
{
return $this->sendRequest('/orders/' . $idorder, $params, self::METHOD_PUT);
}
public function getOrderFieldsOnOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/orderfields');
}
public function updateOrderFieldOnOrder($idorder, $idorderfield, $value)
{
return $this->sendRequest('/orders/' . $idorder . '/orderfields/' . $idorderfield, ['value' => $value], self::METHOD_PUT);
}
public function deleteOrderFieldFromOrder($idorder, $idorderfield)
{
return $this->sendRequest('/orders/' . $idorder . '/orderfields/' . $idorderfield, [], self::METHOD_DELETE);
}
public function allocateStockForOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/allocate', null, self::METHOD_POST);
}
public function deallocateStockForOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/deallocate', null, self::METHOD_POST);
}
public function prioritiseOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/prioritise', null, self::METHOD_POST);
}
/*
* Picklists
*/
public function getPicklists($filters = [])
{
return $this->sendRequest('/picklists', null, null, $filters);
}
public function getAllPicklists($filters = [])
{
return $this->getAllResults('picklist', $filters);
}
public function getPicklist($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist);
}
public function getPicklistByPicklistid($picklistid)
{
$result = $this->sendRequest('/picklists?picklistid=' . urlencode($picklistid));
if (count($result['data']) == 1) {
$result['data'] = $result['data'][0];
}
return $result;
}
public function updatePicklist($idpicklist, $params)
{
return $this->sendRequest('/picklists/' . $idpicklist, $params, self::METHOD_PUT);
}
public function closePicklist($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/close', null, self::METHOD_POST);
}
public function cancelPicklist($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/cancel', null, self::METHOD_POST);
}
public function pickProductOnPicklist($idpicklist, $product, $amount)
{
$params = [
'product' => $product,
'amount' => $amount
];
return $this->sendRequest('/picklists/' . $idpicklist . '/pick', $params, self::METHOD_POST);
}
public function pickallPicklist($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/pickall', null, self::METHOD_POST);
}
public function assignPicklistToUser($idpicklist, $iduser)
{
$params = ['iduser' => $iduser];
return $this->sendRequest('/picklists/' . $idpicklist . '/assign', $params, self::METHOD_POST);
}
public function unassignPicklist($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/unassign', null, self::METHOD_POST);
}
public function snoozePicklist($idpicklist, $snooze_until = null)
{
$params = ['snooze_until' => $snooze_until];
return $this->sendRequest('/picklists/' . $idpicklist . '/snooze', $params, self::METHOD_POST);
}
public function createShipment($idpicklist, $params)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/shipments', $params, self::METHOD_POST);
}
public function getShipments($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/shipments');
}
public function getPicklistPdf($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/picklistpdf');
}
public function getPackinglistPdf($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/packinglistpdf');
}
/*
* Picklist batches
*/
public function getPicklistBatches($filters = [])
{
return $this->sendRequest('/picklists/batches', null, null, $filters);
}
public function getAllPicklistBatches($filters = [])
{
return $this->getAllResults('picklistBatch', $filters);
}
public function getPicklistBatch($idpicklist_batch)
{
return $this->sendRequest('/picklists/batches/' . $idpicklist_batch);
}
/*
* Suppliers
*/
public function getSuppliers($filters = [])
{
return $this->sendRequest('/suppliers', null, null, $filters);
}
public function getAllSuppliers($filters = [])
{
return $this->getAllResults('supplier', $filters);
}
public function getSupplier($idsupplier)
{
return $this->sendRequest('/suppliers/' . $idsupplier);
}
public function addSupplier($params)
{
return $this->sendRequest('/suppliers', $params, self::METHOD_POST);
}
public function updateSupplier($idsupplier, $params)
{
return $this->sendRequest('/suppliers/' . $idsupplier, $params, self::METHOD_PUT);
}
/*
* Purchase orders
*/
public function addPurchaseorder($params)
{
return $this->sendRequest('/purchaseorders', $params, self::METHOD_POST);
}
public function getPurchaseorders($filters = [])
{
return $this->sendRequest('/purchaseorders', null, null, $filters);
}
public function getPurchaseorder($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder);
}
public function markPurchaseorderAsPurchased($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/mark-as-purchased', null, self::METHOD_POST);
}
public function cancelPurchaseorder($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/cancel', null, self::METHOD_POST);
}
public function getPurchaseorderProducts($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products');
}
public function addProductToPurchaseorder($idpurchaseorder, $idproduct, $amount, $price = null, $deliverydate = null)
{
$params = [
'idproduct' => $idproduct,
'amount' => $amount
];
if (! is_null($price)) {
$params['price'] = $price;
}
if (! is_null($deliverydate)) {
$params['delivery_date'] = $deliverydate;
}
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products', $params, self::METHOD_POST);
}
public function updatePurchaseorderProduct($idpurchaseorder, $idpurchaseorder_product, $params)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products/' . $idpurchaseorder_product, $params, self::METHOD_PUT);
}
public function removePurchaseorderProduct($idpurchaseorder, $idpurchaseorder_product)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/products/' . $idpurchaseorder_product, [], self::METHOD_DELETE);
}
public function getReceiptsFromPurchaseorder($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/receipts');
}
public function getReceiptFromPurchaseorder($idpurchaseorder, $idreceipt)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/receipts/' . $idreceipt);
}
public function addReceiptToPurchaseorder($idpurchaseorder, $params)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/receipts', $params, self::METHOD_POST);
}
public function updatePurchaseorder($idpurchaseorder, $params)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder, $params, self::METHOD_PUT);
}
/*
* Returns
*/
public function getReturns($filters = [])
{
return $this->sendRequest('/returns', null, null, $filters);
}
public function getAllReturns($filters = [])
{
return $this->getAllResults('return', $filters);
}
public function getReturn($idreturn)
{
return $this->sendRequest('/returns/' . $idreturn);
}
public function addReturn($params)
{
return $this->sendRequest('/returns', $params, self::METHOD_POST);
}
public function updateReturn($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn, $params, self::METHOD_PUT);
}
public function getReturnLogAndComments($idreturn)
{
return $this->sendRequest('/returns/' . $idreturn . '/logs');
}
public function addReturnLogOrChangeStatus($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/logs', $params, self::METHOD_POST);
}
public function getReturnStatuses()
{
return $this->sendRequest('/return_statuses');
}
public function getAllReturnStatuses($filters = [])
{
return $this->getAllResults('returnStatuse');
}
public function getReturnReasons()
{
return $this->sendRequest('/return_reasons');
}
public function getAllReturnReasons($filters = [])
{
return $this->getAllResults('returnReason');
}
/*
* Returned Products
*/
public function getReturnedProducts($idreturn)
{
return $this->sendRequest('/returns/' . $idreturn . '/returned_products');
}
public function addReturnedProducts($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/returned_products', $params, self::METHOD_POST);
}
public function updateReturnedProduct($idreturn, $idreturn_product, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/returned_products/' . $idreturn_product, $params, self::METHOD_PUT);
}
public function removeReturnedProduct($idreturn, $idreturn_product)
{
return $this->sendRequest('/returns/' . $idreturn . '/returned_products/' . $idreturn_product, null,self::METHOD_DELETE);
}
public function receiveReturnedProducts($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/receive', $params, self::METHOD_POST);
}
/*
* Replacement Products
*/
public function getReplacementProducts($idreturn)
{
return $this->sendRequest('/returns/' . $idreturn . '/replacement_products');
}
public function addReplacementProducts($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/replacement_products', $params, self::METHOD_POST);
}
public function updateReplacementProduct($idreturn, $idreturn_product_replacement, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/replacement_products/' . $idreturn_product_replacement, $params, self::METHOD_PUT);
}
public function removeReplacementProduct($idreturn, $idreturn_product_replacement)
{
return $this->sendRequest('/returns/' . $idreturn . '/replacement_products/' . $idreturn_product_replacement, null,self::METHOD_DELETE);
}
/*
* Tags
*/
public function getTags($filters = [])
{
return $this->sendRequest('/tags', [], self::METHOD_GET, $filters);
}
public function getAllTags($filters = [])
{
return $this->getAllResults('tag', $filters);
}
public function getTag($idtag)
{
return $this->sendRequest('/tags/' . $idtag);
}
/*
* VAT Groups
*/
public function getVatgroups()
{
return $this->sendRequest('/vatgroups');
}
public function getVatgroup($idvatgroup)
{
return $this->sendRequest('/vatgroups/' . $idvatgroup);
}
/*
* Hooks
*/
public function getHooks()
{
return $this->sendRequest('/hooks');
}
public function getHook($id)
{
return $this->sendRequest('/hooks/' . $id);
}
public function addHook($params)
{
return $this->sendRequest('/hooks', $params, self::METHOD_POST);
}
public function deleteHook($id)
{
return $this->sendRequest('/hooks/' . $id, [], self::METHOD_DELETE);
}
/*
* Backorders
*/
public function getBackorders($filters = [])
{
return $this->sendRequest('/backorders', null, null, $filters);
}
public function getBackorder($idbackorder)
{
return $this->sendRequest('/backorders/' . $idbackorder);
}
public function processBackorders()
{
return $this->sendRequest('/backorders/process', null, self::METHOD_POST);
}
public function deleteBackorder($idbackorder)
{
return $this->sendRequest('/backorders/' . $idbackorder, null, self::METHOD_DELETE);
}
public function getBackordersForOrder($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/backorders');
}
/*
* Warehouses
*/
public function getWarehouses()
{
return $this->sendRequest('/warehouses');
}
public function getWarehouse($idwarehouse)
{
return $this->sendRequest('/warehouses/' . $idwarehouse);
}
/*
* Pricelists
*/
public function getPricelists()
{
return $this->sendRequest('/pricelists');
}
public function getPricelist($idpricelist)
{
return $this->sendRequest('/pricelists/' . $idpricelist);
}
/*
* Shipping providers
*/
public function getShippingProviders()
{
return $this->sendRequest('/shippingproviders');
}
/*
* Product fields
*/
public function getProductFields()
{
return $this->sendRequest('/productfields');
}
public function getProductField($idproductfield)
{
return $this->sendRequest('/productfields/' . $idproductfield);
}
/*
* Order fields
*/
public function getOrderFields()
{
return $this->sendRequest('/orderfields');
}
public function getOrderField($idorderfield)
{
return $this->sendRequest('/orderfields/' . $idorderfield);
}
/*
* Customer fields
*/
public function getCustomerFields()
{
return $this->sendRequest('/customerfields');
}
public function getCustomerField($idcustomerfield)
{
return $this->sendRequest('/customerfields/' . $idcustomerfield);
}
/*
* Users
*/
public function getUsers()
{
return $this->sendRequest('/users');
}
public function getUser($iduser)
{
return $this->sendRequest('/users/' . $iduser);
}
public function getCurrentUser()
{
return $this->getUser('me');
}
/*
* Templates
*/
public function getTemplates()
{
return $this->sendRequest('/templates');
}
/*
* Locations
*/
public function getLocations($filters = [])
{
return $this->sendRequest('/locations', [], self::METHOD_GET, $filters);
}
public function getAllLocations($filters = array())
{
return $this->getAllResults('location', $filters);
}