13 use InvalidArgumentException;
26 private $paymentToken;
31 private $shippingAddress;
36 private $billingAddress;
41 private $shippingMethod;
58 Address $shippingAddress =
null,
66 if ($shippingAddress) {
67 $customers[] = $shippingAddress->getCustomerId();
69 if ($billingAddress) {
70 $customers[] = $billingAddress->getCustomerId();
73 throw new InvalidArgumentException(
'Provided data does not belong to same customer.');
76 $this->paymentToken = $paymentToken;
77 $this->shippingAddress = $shippingAddress;
78 $this->billingAddress = $billingAddress;
79 $this->shippingMethod = $shippingMethod;
92 $this->shippingAddress,
93 $this->billingAddress,
95 ) && $this->shippingMethod->getAvailable();
107 if (!isset($this->paymentToken)) {
109 __(
"A payment method isn't defined for instance purchase. Verify and try again.")
112 return $this->paymentToken;
124 if (!isset($this->shippingAddress)) {
127 return $this->shippingAddress;
139 if (!isset($this->billingAddress)) {
142 return $this->billingAddress;
154 if (!isset($this->shippingMethod)) {
157 return $this->shippingMethod;
__construct(PaymentTokenInterface $paymentToken=null, Address $shippingAddress=null, Address $billingAddress=null, ShippingMethodInterface $shippingMethod=null)