@@ -8,66 +8,70 @@ class FulfillmentService extends AbstractService
88{
99 public function all ($ orderId , array $ params = [])
1010 {
11- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments.json ' ;
11+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments.json ' ;
1212 $ response = $ this ->request ($ endpoint , 'GET ' , $ params );
1313 return $ this ->createCollection (Fulfillment::class, $ response ['fulfillments ' ]);
1414 }
1515
1616 public function count ($ orderId , array $ params = [])
1717 {
18- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/count.json ' ;
18+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/count.json ' ;
1919 $ response = $ this ->request ($ endpoint , 'GET ' , $ params );
2020 return $ response ['count ' ];
2121 }
2222
2323 public function get ($ orderId , $ fulfillmentId , array $ params = [])
2424 {
25- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/ ' . $ fulfillmentId. '.json ' ;
25+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/ ' . $ fulfillmentId . '.json ' ;
2626 $ response = $ this ->request ($ endpoint , 'GET ' , $ params );
2727 return $ this ->createObject (Fulfillment::class, $ response ['fulfillments ' ]);
2828 }
2929
3030 public function create ($ orderId , Fulfillment &$ fulfillment )
3131 {
3232 $ data = $ fulfillment ->exportData ();
33- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments.json ' ;
33+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments.json ' ;
3434 $ response = $ this ->request (
35- $ endpoint , 'POST ' , array (
36- 'fulfillment ' => $ data
37- )
35+ $ endpoint ,
36+ 'POST ' ,
37+ [
38+ 'fulfillment ' => $ data
39+ ]
3840 );
3941 $ fulfillment ->setData ($ response ['fulfillment ' ]);
4042 }
4143
4244 public function update ($ orderId , Fulfillment &$ fulfillment )
4345 {
4446 $ data = $ fulfillment ->exportData ();
45- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/ ' . $ fulfillment ->gtId (). '.json ' ;
47+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/ ' . $ fulfillment ->getId () . '.json ' ;
4648 $ response = $ this ->request (
47- $ endpoint , 'POST ' , array (
48- 'fulfillment ' => $ data
49- )
49+ $ endpoint ,
50+ 'POST ' ,
51+ [
52+ 'fulfillment ' => $ data
53+ ]
5054 );
5155 $ fulfillment ->setData ($ response ['fulfillment ' ]);
5256 }
5357
5458 public function complete ($ orderId , Fulfillment &$ fulfillment )
5559 {
56- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/ ' . $ fulfillment ->getId (). '/complete.json ' ;
60+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/ ' . $ fulfillment ->getId () . '/complete.json ' ;
5761 $ response = $ this ->request ($ endpoint , 'POST ' );
5862 $ fulfillment ->setData ($ response ['fulfillment ' ]);
5963 }
6064
6165 public function cancel ($ orderId , Fulfillment &$ fulfillment )
6266 {
63- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/ ' . $ fulfillment ->getId (). '/cancel.json ' ;
67+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/ ' . $ fulfillment ->getId () . '/cancel.json ' ;
6468 $ response = $ this ->request ($ endpoint , 'POST ' );
6569 $ fulfillment ->setData ($ response ['fulfillment ' ]);
6670 }
6771
6872 public function open ($ orderId , Fulfillment &$ fulfillment )
6973 {
70- $ endpoint = 'orders/ ' . $ orderId. '/fulfillments/ ' . $ fulfillment ->getId (). '/open.json ' ;
74+ $ endpoint = 'orders/ ' . $ orderId . '/fulfillments/ ' . $ fulfillment ->getId () . '/open.json ' ;
7175 $ response = $ this ->request ($ endpoint , 'POST ' );
7276 $ fulfillment ->setData ($ response ->fulfillment );
7377 }
0 commit comments