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

Commit 2df62ea

Browse files
committed
feat: add guest cart payment methods endpoint
1 parent b2ebb35 commit 2df62ea

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Api/GuestCarts.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,14 @@ public function shippingInformation($cartId, $body = [])
9898
{
9999
return $this->post('/guest-carts/'.$cartId.'/shipping-information', $body);
100100
}
101+
102+
/**
103+
* List available payment methods for a specified shopping cart. This call returns an array of objects, but detailed information about each object’s attributes might not be included.
104+
*
105+
* @return array
106+
*/
107+
public function paymentMethods($cartId)
108+
{
109+
return $this->get('/guest-carts/'.$cartId.'/payment-methods');
110+
}
101111
}

tests/Api/GuestCartsTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,17 @@ public function test_can_call_guest_carts_shipping_information()
108108

109109
$this->assertTrue($api->ok());
110110
}
111+
112+
public function test_can_call_guest_carts_payment_methods()
113+
{
114+
Http::fake([
115+
'*rest/all/V1/guest-carts/foo/payment-methods' => Http::response([], 200),
116+
]);
117+
118+
$magento = new Magento();
119+
120+
$api = $magento->api('guestCarts')->paymentMethods('foo');
121+
122+
$this->assertTrue($api->ok());
123+
}
111124
}

0 commit comments

Comments
 (0)