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

Commit 21f3d65

Browse files
committed
feat: add endpoint to get guest carts total information
1 parent fe37915 commit 21f3d65

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/Api/GuestCarts.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,16 @@ public function estimateShippingMethods($cartId, $body = [])
7474
{
7575
return $this->post('/guest-carts/'.$cartId.'/estimate-shipping-methods', $body);
7676
}
77+
78+
/**
79+
* Calculate quote totals based on address and shipping method.
80+
*
81+
* @param string $cartId
82+
* @param array $body
83+
* @return array
84+
*/
85+
public function totalsInformation($cartId, $body = [])
86+
{
87+
return $this->post('/guest-carts/'.$cartId.'/totals-information', $body);
88+
}
7789
}

tests/Api/GuestCartsTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,17 @@ public function test_can_call_guest_carts_estimate_shipping_methods()
8282

8383
$this->assertTrue($api->ok());
8484
}
85+
86+
public function test_can_call_guest_carts_totals_information()
87+
{
88+
Http::fake([
89+
'*rest/all/V1/guest-carts/foo/totals-information' => Http::response([], 200),
90+
]);
91+
92+
$magento = new Magento();
93+
94+
$api = $magento->api('guestCarts')->totalsInformation('foo');
95+
96+
$this->assertTrue($api->ok());
97+
}
8598
}

0 commit comments

Comments
 (0)