1: <?php
2:
3: namespace ShippoClient\Http\Request\Transactions;
4:
5: use ShippoClient\Http\Request\CommonParameter;
6: use TurmericSpice\Container\InvalidAttributeException;
7:
8: /**
9: * A Transaction is the purchase of a Shipment Label for a given Shipment Rate.
10: * Transactions can be as simple as posting a Rate ID, but also allow you to define further parameters of the desired Label, such as pickup and notifications.
11: * Transactions can only be created for Rates that are less than 7 days old and that have an object_purpose of "PURCHASE".
12: * Transactions are created asynchronous. The response time depends exclusively on the carrier's server.
13: */
14: class CreateObject extends CommonParameter
15: {
16: /**
17: * ID of the Rate object for which a Label has to be obtained.
18: * Please note that only rates that are not older than 7 days can be purchased in order to ensure up-to-date pricing.
19: *
20: * @return string
21: * @throws InvalidAttributeException
22: */
23: public function getRate()
24: {
25: return $this->attributes->mustHave('rate')->asString();
26: }
27: }
28: