conversionObject = $conversionObject; $this->configurations = $configurations; $this->voucherObject = $voucherObject; } /** * @return CurrencyConversionObject */ public function getConversionObject(): CurrencyConversionObject { return $this->conversionObject; } /** * @return CompanyServiceConfigurationsObject */ public function getConfigurations(): CompanyServiceConfigurationsObject { return $this->configurations; } /** * @return ValidatedVoucherObject */ public function getValidatedVoucherObject(): ?ValidatedVoucherObject { return $this->voucherObject; } public function getConvertibleTotal(){ return $this->getConversionObject()->getType() === 1 ? $this->getConversionObject()->getAmount() : $this->getConversionTotal(); } /** * @return float */ public function getConversionTotal(): float { $rate = $this->getConversionObject()->getType() === 1 ? (1/$this->getConfigurations()->getRate()) : $this->getConfigurations()->getRate(); return $this->getConversionObject()->getAmount() * $rate; } /** * @return float */ public function getLocalTotal(){ return $this->getConversionObject()->getType() === 1 ? $this->getConversionTotal() : $this->getConversionObject()->getAmount(); } /** * @return float */ public function getForeignTotal(){ return $this->getConversionObject()->getType() === 1 ? $this->getConversionObject()->getAmount() : $this->getConversionTotal(); } /** * @return float */ public function getServiceCharge(): float { return ($this->getLocalTotal()/100) * $this->getConfigurations()->getServiceCharge() < $this->getConfigurations()->getMinimumCharge() ? $this->getConfigurations()->getMinimumCharge() : ($this->getLocalTotal()/100) * $this->getConfigurations()->getServiceCharge(); } public function getSubTotal(): float { return $this->getLocalTotal() + $this->getServiceCharge(); } /** * @return float */ public function getTax(): float { return ($this->getSubTotal()/100) * $this->getConfigurations()->getTax(); } public function getVoucherDiscountAmount(): float { if($this->getValidatedVoucherObject()){ return $this->getValidatedVoucherObject()->getTotalDiscountAmount(); } else{ return 0.00; } } public function getVoucherCode(): string { if($this->getValidatedVoucherObject()){ return $this->getValidatedVoucherObject()->getCode(); } else{ return ""; } } public function getTotal(): float { if($this->getValidatedVoucherObject()){ return $this->getValidatedVoucherObject()->getTotalAmount() + $this->getTax(); } else{ return $this->getSubTotal() + $this->getTax(); } } }