commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Cart
DiscountedTotalPricePortionModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\CartDiscount\CartDiscountReference
;
12
use
Commercetools\Api\Models\CartDiscount\CartDiscountReferenceModel
;
13
use
Commercetools\Api\Models\Common\TypedMoney
;
14
use
Commercetools\Api\Models\Common\TypedMoneyModel
;
15
use
Commercetools\Base\DateTimeImmutableCollection
;
16
use
Commercetools\Base\JsonObject
;
17
use
Commercetools\Base\JsonObjectModel
;
18
use
Commercetools\Base\MapperFactory
;
19
use stdClass;
20
24
final
class
DiscountedTotalPricePortionModel
extends
JsonObjectModel
implements
DiscountedTotalPricePortion
25
{
30
protected
$discount
;
31
36
protected
$discountedAmount
;
37
38
42
public
function
__construct
(
43
?
CartDiscountReference
$discount
=
null
,
44
?
TypedMoney
$discountedAmount
=
null
45
) {
46
$this->discount =
$discount
;
47
$this->discountedAmount =
$discountedAmount
;
48
}
49
56
public
function
getDiscount
()
57
{
58
if
(is_null($this->discount)) {
60
$data = $this->
raw
(self::FIELD_DISCOUNT);
61
if
(is_null($data)) {
62
return
null
;
63
}
64
65
$this->discount =
CartDiscountReferenceModel::of
($data);
66
}
67
68
return
$this->discount
;
69
}
70
77
public
function
getDiscountedAmount
()
78
{
79
if
(is_null($this->discountedAmount)) {
81
$data = $this->
raw
(self::FIELD_DISCOUNTED_AMOUNT);
82
if
(is_null($data)) {
83
return
null
;
84
}
85
$className =
TypedMoneyModel::resolveDiscriminatorClass
($data);
86
$this->discountedAmount = $className::of($data);
87
}
88
89
return
$this->discountedAmount
;
90
}
91
92
96
public
function
setDiscount
(?
CartDiscountReference
$discount
): void
97
{
98
$this->discount =
$discount
;
99
}
100
104
public
function
setDiscountedAmount
(?
TypedMoney
$discountedAmount
): void
105
{
106
$this->discountedAmount =
$discountedAmount
;
107
}
108
}
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel
Definition:
DiscountedTotalPricePortionModel.php:25
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\getDiscountedAmount
getDiscountedAmount()
Definition:
DiscountedTotalPricePortionModel.php:77
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\setDiscount
setDiscount(?CartDiscountReference $discount)
Definition:
DiscountedTotalPricePortionModel.php:96
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\getDiscount
getDiscount()
Definition:
DiscountedTotalPricePortionModel.php:56
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\__construct
__construct(?CartDiscountReference $discount=null, ?TypedMoney $discountedAmount=null)
Definition:
DiscountedTotalPricePortionModel.php:42
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\setDiscountedAmount
setDiscountedAmount(?TypedMoney $discountedAmount)
Definition:
DiscountedTotalPricePortionModel.php:104
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\$discount
$discount
Definition:
DiscountedTotalPricePortionModel.php:30
Commercetools\Api\Models\Cart\DiscountedTotalPricePortionModel\$discountedAmount
$discountedAmount
Definition:
DiscountedTotalPricePortionModel.php:36
Commercetools\Api\Models\CartDiscount\CartDiscountReferenceModel
Definition:
CartDiscountReferenceModel.php:23
Commercetools\Api\Models\Common\TypedMoneyModel
Definition:
TypedMoneyModel.php:21
Commercetools\Api\Models\Common\TypedMoneyModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
TypedMoneyModel.php:190
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
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\DiscountedTotalPricePortion
Definition:
DiscountedTotalPricePortion.php:17
Commercetools\Api\Models\CartDiscount\CartDiscountReference
Definition:
CartDiscountReference.php:16
Commercetools\Api\Models\Common\TypedMoney
Definition:
TypedMoney.php:15
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition:
Cart.php:9
Generated by
1.9.1