commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Cart
DiscountOnTotalPriceModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\Common\TypedMoney
;
12
use
Commercetools\Api\Models\Common\TypedMoneyModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
DiscountOnTotalPriceModel
extends
JsonObjectModel
implements
DiscountOnTotalPrice
23
{
28
protected
$discountedAmount
;
29
34
protected
$includedDiscounts
;
35
40
protected
$discountedNetAmount
;
41
46
protected
$discountedGrossAmount
;
47
48
52
public
function
__construct
(
53
?
TypedMoney
$discountedAmount
=
null
,
54
?
DiscountedTotalPricePortionCollection
$includedDiscounts
=
null
,
55
?
TypedMoney
$discountedNetAmount
=
null
,
56
?
TypedMoney
$discountedGrossAmount
=
null
57
) {
58
$this->discountedAmount =
$discountedAmount
;
59
$this->includedDiscounts =
$includedDiscounts
;
60
$this->discountedNetAmount =
$discountedNetAmount
;
61
$this->discountedGrossAmount =
$discountedGrossAmount
;
62
}
63
70
public
function
getDiscountedAmount
()
71
{
72
if
(is_null($this->discountedAmount)) {
74
$data = $this->
raw
(self::FIELD_DISCOUNTED_AMOUNT);
75
if
(is_null($data)) {
76
return
null
;
77
}
78
$className = TypedMoneyModel::resolveDiscriminatorClass($data);
79
$this->discountedAmount = $className::of($data);
80
}
81
82
return
$this->discountedAmount
;
83
}
84
91
public
function
getIncludedDiscounts
()
92
{
93
if
(is_null($this->includedDiscounts)) {
95
$data = $this->
raw
(self::FIELD_INCLUDED_DISCOUNTS);
96
if
(is_null($data)) {
97
return
null
;
98
}
99
$this->includedDiscounts =
DiscountedTotalPricePortionCollection::fromArray
($data);
100
}
101
102
return
$this->includedDiscounts
;
103
}
104
112
public
function
getDiscountedNetAmount
()
113
{
114
if
(is_null($this->discountedNetAmount)) {
116
$data = $this->
raw
(self::FIELD_DISCOUNTED_NET_AMOUNT);
117
if
(is_null($data)) {
118
return
null
;
119
}
120
$className = TypedMoneyModel::resolveDiscriminatorClass($data);
121
$this->discountedNetAmount = $className::of($data);
122
}
123
124
return
$this->discountedNetAmount
;
125
}
126
134
public
function
getDiscountedGrossAmount
()
135
{
136
if
(is_null($this->discountedGrossAmount)) {
138
$data = $this->
raw
(self::FIELD_DISCOUNTED_GROSS_AMOUNT);
139
if
(is_null($data)) {
140
return
null
;
141
}
142
$className = TypedMoneyModel::resolveDiscriminatorClass($data);
143
$this->discountedGrossAmount = $className::of($data);
144
}
145
146
return
$this->discountedGrossAmount
;
147
}
148
149
153
public
function
setDiscountedAmount
(?
TypedMoney
$discountedAmount
): void
154
{
155
$this->discountedAmount =
$discountedAmount
;
156
}
157
161
public
function
setIncludedDiscounts
(?
DiscountedTotalPricePortionCollection
$includedDiscounts
): void
162
{
163
$this->includedDiscounts =
$includedDiscounts
;
164
}
165
169
public
function
setDiscountedNetAmount
(?
TypedMoney
$discountedNetAmount
): void
170
{
171
$this->discountedNetAmount =
$discountedNetAmount
;
172
}
173
177
public
function
setDiscountedGrossAmount
(?
TypedMoney
$discountedGrossAmount
): void
178
{
179
$this->discountedGrossAmount =
$discountedGrossAmount
;
180
}
181
}
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel
Definition
DiscountOnTotalPriceModel.php:23
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\getDiscountedNetAmount
getDiscountedNetAmount()
Definition
DiscountOnTotalPriceModel.php:112
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\$discountedAmount
$discountedAmount
Definition
DiscountOnTotalPriceModel.php:28
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\setDiscountedAmount
setDiscountedAmount(?TypedMoney $discountedAmount)
Definition
DiscountOnTotalPriceModel.php:153
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\setIncludedDiscounts
setIncludedDiscounts(?DiscountedTotalPricePortionCollection $includedDiscounts)
Definition
DiscountOnTotalPriceModel.php:161
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\getDiscountedGrossAmount
getDiscountedGrossAmount()
Definition
DiscountOnTotalPriceModel.php:134
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\$includedDiscounts
$includedDiscounts
Definition
DiscountOnTotalPriceModel.php:34
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\getIncludedDiscounts
getIncludedDiscounts()
Definition
DiscountOnTotalPriceModel.php:91
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\$discountedGrossAmount
$discountedGrossAmount
Definition
DiscountOnTotalPriceModel.php:46
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\setDiscountedNetAmount
setDiscountedNetAmount(?TypedMoney $discountedNetAmount)
Definition
DiscountOnTotalPriceModel.php:169
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\__construct
__construct(?TypedMoney $discountedAmount=null, ?DiscountedTotalPricePortionCollection $includedDiscounts=null, ?TypedMoney $discountedNetAmount=null, ?TypedMoney $discountedGrossAmount=null)
Definition
DiscountOnTotalPriceModel.php:52
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\getDiscountedAmount
getDiscountedAmount()
Definition
DiscountOnTotalPriceModel.php:70
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\setDiscountedGrossAmount
setDiscountedGrossAmount(?TypedMoney $discountedGrossAmount)
Definition
DiscountOnTotalPriceModel.php:177
Commercetools\Api\Models\Cart\DiscountOnTotalPriceModel\$discountedNetAmount
$discountedNetAmount
Definition
DiscountOnTotalPriceModel.php:40
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionCollection
Definition
DiscountedTotalPricePortionCollection.php:22
Commercetools\Api\Models\Common\TypedMoneyModel
Definition
TypedMoneyModel.php:21
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Cart\DiscountOnTotalPrice
Definition
DiscountOnTotalPrice.php:16
Commercetools\Api\Models\Common\TypedMoney
Definition
TypedMoney.php:15
Commercetools\Base\CSequence\fromArray
static fromArray(array $data)
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition
Cart.php:9
Generated by
1.9.8