1: <?php
2:
3: namespace ShippoClient;
4:
5: use ShippoClient\Entity\Transaction;
6: use ShippoClient\Http\Request;
7: use ShippoClient\Http\Request\Transactions\CreateObject;
8: use ShippoClient\Http\Response\TransactionList;
9:
10: class Transactions
11: {
12: private $request;
13:
14: public function __construct(Request $request)
15: {
16: $this->request = $request;
17: }
18:
19: public function purchase($rateObjectId)
20: {
21: $createObject = new CreateObject(['rate' => $rateObjectId]);
22: $responseArray = $this->request->post("transactions", $createObject->toArray());
23:
24: return new Transaction($responseArray);
25: }
26:
27: public function retrieve($objectId)
28: {
29: $responseArray = $this->request->get("transactions/$objectId");
30:
31: return new Transaction($responseArray);
32: }
33:
34: 35: 36: 37:
38: public function getList($results = null)
39: {
40: $responseArray = $this->request->get("transactions", ['results' => $results]);
41:
42: return new TransactionList($responseArray);
43: }
44: }
45: