-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCheckoutMessageOrderPayloadBaseDataBuilder.php
More file actions
164 lines (133 loc) · 3.44 KB
/
Copy pathCheckoutMessageOrderPayloadBaseDataBuilder.php
File metadata and controls
164 lines (133 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/
namespace Commercetools\Api\Models\Event;
use Commercetools\Api\Models\Cart\CartReference;
use Commercetools\Api\Models\Cart\CartReferenceBuilder;
use Commercetools\Api\Models\Error\ErrorObjectCollection;
use Commercetools\Api\Models\Payment\PaymentReferenceCollection;
use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
use Commercetools\Base\MapperFactory;
use stdClass;
/**
* @implements Builder<CheckoutMessageOrderPayloadBaseData>
*/
final class CheckoutMessageOrderPayloadBaseDataBuilder implements Builder
{
/**
* @var ?string
*/
private $projectKey;
/**
* @var null|CartReference|CartReferenceBuilder
*/
private $cart;
/**
* @var ?PaymentReferenceCollection
*/
private $payments;
/**
* @var ?ErrorObjectCollection
*/
private $errors;
/**
* <p><code>key</code> of the <a href="ctp:api:type:Project">Project</a> where the order would belong to.</p>
*
* @return null|string
*/
public function getProjectKey()
{
return $this->projectKey;
}
/**
* <p>The <a href="ctp:api:type:Cart">Cart</a> on which the change or action was performed.</p>
*
* @return null|CartReference
*/
public function getCart()
{
return $this->cart instanceof CartReferenceBuilder ? $this->cart->build() : $this->cart;
}
/**
* <p>The <a href="ctp:api:type:Payment">Payments</a> on which the change or action was performed.</p>
*
* @return null|PaymentReferenceCollection
*/
public function getPayments()
{
return $this->payments;
}
/**
* <p>Errors associated with the order event.</p>
*
* @return null|ErrorObjectCollection
*/
public function getErrors()
{
return $this->errors;
}
/**
* @param ?string $projectKey
* @return $this
*/
public function withProjectKey(?string $projectKey)
{
$this->projectKey = $projectKey;
return $this;
}
/**
* @param ?CartReference $cart
* @return $this
*/
public function withCart(?CartReference $cart)
{
$this->cart = $cart;
return $this;
}
/**
* @param ?PaymentReferenceCollection $payments
* @return $this
*/
public function withPayments(?PaymentReferenceCollection $payments)
{
$this->payments = $payments;
return $this;
}
/**
* @param ?ErrorObjectCollection $errors
* @return $this
*/
public function withErrors(?ErrorObjectCollection $errors)
{
$this->errors = $errors;
return $this;
}
/**
* @deprecated use withCart() instead
* @return $this
*/
public function withCartBuilder(?CartReferenceBuilder $cart)
{
$this->cart = $cart;
return $this;
}
public function build(): CheckoutMessageOrderPayloadBaseData
{
return new CheckoutMessageOrderPayloadBaseDataModel(
$this->projectKey,
$this->cart instanceof CartReferenceBuilder ? $this->cart->build() : $this->cart,
$this->payments,
$this->errors
);
}
public static function of(): CheckoutMessageOrderPayloadBaseDataBuilder
{
return new self();
}
}