commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DiscountOnTotalPriceBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class DiscountOnTotalPriceBuilder implements Builder
24 {
29  private $discountedAmount;
30 
35  private $includedDiscounts;
36 
41  private $discountedNetAmount;
42 
47  private $discountedGrossAmount;
48 
55  public function getDiscountedAmount()
56  {
57  return $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount;
58  }
59 
66  public function getIncludedDiscounts()
67  {
68  return $this->includedDiscounts;
69  }
70 
78  public function getDiscountedNetAmount()
79  {
80  return $this->discountedNetAmount instanceof TypedMoneyBuilder ? $this->discountedNetAmount->build() : $this->discountedNetAmount;
81  }
82 
90  public function getDiscountedGrossAmount()
91  {
92  return $this->discountedGrossAmount instanceof TypedMoneyBuilder ? $this->discountedGrossAmount->build() : $this->discountedGrossAmount;
93  }
94 
99  public function withDiscountedAmount(?TypedMoney $discountedAmount)
100  {
101  $this->discountedAmount = $discountedAmount;
102 
103  return $this;
104  }
105 
111  {
112  $this->includedDiscounts = $includedDiscounts;
113 
114  return $this;
115  }
116 
121  public function withDiscountedNetAmount(?TypedMoney $discountedNetAmount)
122  {
123  $this->discountedNetAmount = $discountedNetAmount;
124 
125  return $this;
126  }
127 
132  public function withDiscountedGrossAmount(?TypedMoney $discountedGrossAmount)
133  {
134  $this->discountedGrossAmount = $discountedGrossAmount;
135 
136  return $this;
137  }
138 
143  public function withDiscountedAmountBuilder(?TypedMoneyBuilder $discountedAmount)
144  {
145  $this->discountedAmount = $discountedAmount;
146 
147  return $this;
148  }
149 
154  public function withDiscountedNetAmountBuilder(?TypedMoneyBuilder $discountedNetAmount)
155  {
156  $this->discountedNetAmount = $discountedNetAmount;
157 
158  return $this;
159  }
160 
165  public function withDiscountedGrossAmountBuilder(?TypedMoneyBuilder $discountedGrossAmount)
166  {
167  $this->discountedGrossAmount = $discountedGrossAmount;
168 
169  return $this;
170  }
171 
172  public function build(): DiscountOnTotalPrice
173  {
174  return new DiscountOnTotalPriceModel(
175  $this->discountedAmount instanceof TypedMoneyBuilder ? $this->discountedAmount->build() : $this->discountedAmount,
176  $this->includedDiscounts,
177  $this->discountedNetAmount instanceof TypedMoneyBuilder ? $this->discountedNetAmount->build() : $this->discountedNetAmount,
178  $this->discountedGrossAmount instanceof TypedMoneyBuilder ? $this->discountedGrossAmount->build() : $this->discountedGrossAmount
179  );
180  }
181 
182  public static function of(): DiscountOnTotalPriceBuilder
183  {
184  return new self();
185  }
186 }
withDiscountedGrossAmountBuilder(?TypedMoneyBuilder $discountedGrossAmount)
withIncludedDiscounts(?DiscountedTotalPricePortionCollection $includedDiscounts)
withDiscountedNetAmountBuilder(?TypedMoneyBuilder $discountedNetAmount)