commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DiscountedTotalPricePortionModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
30 protected $discount;
31
37
38
42 public function __construct(
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
90 }
91
92
97 {
98 $this->discount = $discount;
99 }
100
105 {
106 $this->discountedAmount = $discountedAmount;
107 }
108}
__construct(?CartDiscountReference $discount=null, ?TypedMoney $discountedAmount=null)