This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,17 @@ public function mine()
1515
1616 return $ this ->get ('/carts/mine ' );
1717 }
18+
19+ /**
20+ * Estimate shipping by address and return list of available shipping methods.
21+ *
22+ * @param array $body
23+ * @return array
24+ */
25+ public function estimateShippingMethods ($ body = [])
26+ {
27+ $ this ->validateSingleStoreCode ();
28+
29+ return $ this ->post ('/carts/mine/estimate-shipping-methods ' , $ body );
30+ }
1831}
Original file line number Diff line number Diff line change @@ -34,4 +34,26 @@ public function test_must_pass_a_single_store_code_to_carts_mine()
3434 $ magento = new Magento ();
3535 $ magento ->api ('carts ' )->mine ();
3636 }
37+
38+ public function test_can_call_carts_estimate_shipping_methods ()
39+ {
40+ Http::fake ([
41+ '*rest/default/V1/carts/mine/estimate-shipping-methods ' => Http::response ([], 200 ),
42+ ]);
43+
44+ $ magento = new Magento ();
45+ $ magento ->storeCode = 'default ' ;
46+
47+ $ api = $ magento ->api ('carts ' )->estimateShippingMethods ([]);
48+
49+ $ this ->assertTrue ($ api ->ok ());
50+ }
51+
52+ public function test_must_pass_a_single_store_code_to_estimate_shipping_methods ()
53+ {
54+ $ this ->expectException ('exception ' );
55+
56+ $ magento = new Magento ();
57+ $ magento ->api ('carts ' )->estimateShippingMethods ([]);
58+ }
3759}
You can’t perform that action at this time.
0 commit comments