Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a1b4505

Browse files
committed
feat: 🚧 Assign a specified customer to a specified shopping cart
1 parent 4a2af15 commit a1b4505

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Api/GuestCarts.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,20 @@ public function removeCoupons($cartId)
168168
{
169169
return $this->delete('/guest-carts/'.$cartId.'/coupons');
170170
}
171+
172+
/**
173+
* Assign a specified customer to a specified shopping cart.
174+
*
175+
* @param string $cartId
176+
* @param integer $customerId
177+
* @param integer $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+
}
171187
}

tests/Api/GuestCartsTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,15 @@ public function test_can_edit_item()
156156

157157
$this->assertTrue($api->ok());
158158
}
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+
}
159170
}

0 commit comments

Comments
 (0)