commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DiscountOnTotalPriceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $discountedAmount;
29 
34  protected $includedDiscounts;
35 
41 
47 
48 
52  public function __construct(
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  }
79  $this->discountedAmount = $className::of($data);
80  }
81 
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 
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 
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 
147  }
148 
149 
154  {
155  $this->discountedAmount = $discountedAmount;
156  }
157 
162  {
163  $this->includedDiscounts = $includedDiscounts;
164  }
165 
170  {
171  $this->discountedNetAmount = $discountedNetAmount;
172  }
173 
178  {
179  $this->discountedGrossAmount = $discountedGrossAmount;
180  }
181 }
setIncludedDiscounts(?DiscountedTotalPricePortionCollection $includedDiscounts)
__construct(?TypedMoney $discountedAmount=null, ?DiscountedTotalPricePortionCollection $includedDiscounts=null, ?TypedMoney $discountedNetAmount=null, ?TypedMoney $discountedGrossAmount=null)