This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree 3 files changed +34
-0
lines changed
3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,13 @@ Apply a coupon to a specified cart.
253
253
Magento::api('guestCarts')->couponCode($cartId, $couponCode);
254
254
```
255
255
256
+ ` /V1/guest-carts/{cartId} `
257
+
258
+ Assign a specified customer to a specified shopping cart.
259
+ ``` php
260
+ Magento::api('guestCarts')->assignCustomer($cartId, $customerId, $storeId);
261
+ ```
262
+
256
263
<a id =" orders " ></a >
257
264
### Orders (salesOrderRepositoryV1)
258
265
Original file line number Diff line number Diff line change @@ -168,4 +168,20 @@ public function removeCoupons($cartId)
168
168
{
169
169
return $ this ->delete ('/guest-carts/ ' .$ cartId .'/coupons ' );
170
170
}
171
+
172
+ /**
173
+ * Assign a specified customer to a specified shopping cart.
174
+ *
175
+ * @param string $cartId
176
+ * @param int $customerId
177
+ * @param int $storeId
178
+ * @return array
179
+ */
180
+ public function assignCustomer ($ cartId , $ customerId , $ storeId )
181
+ {
182
+ return $ this ->put ('/guest-carts/ ' .$ cartId , [
183
+ 'customerId ' => $ customerId ,
184
+ 'storeId ' => $ storeId ,
185
+ ]);
186
+ }
171
187
}
Original file line number Diff line number Diff line change @@ -156,4 +156,15 @@ public function test_can_edit_item()
156
156
157
157
$ this ->assertTrue ($ api ->ok ());
158
158
}
159
+
160
+ public function test_it_can_assign_customer ()
161
+ {
162
+ Http::fake ([
163
+ '*rest/all/V1/guest-carts/foo ' => Http::response ([], 200 ),
164
+ ]);
165
+
166
+ $ api = MagentoFacade::api ('guestCarts ' )->assignCustomer ('foo ' , 1 , 1 );
167
+
168
+ $ this ->assertTrue ($ api ->ok ());
169
+ }
159
170
}
You can’t perform that action at this time.
0 commit comments