Exemple #1
0
 /**
  * @param $data
  * @param $occupancy
  * @return ChargeProcess
  */
 private function getPaymentsData($data, $occupancy)
 {
     $charge = new ChargeProcess();
     $charge->setPrice($data['amount_price']);
     $visitor = new Container('visitor');
     if (!is_null($visitor->partnerId) && (int) $visitor->partnerId) {
         $partnerId = (int) $visitor->partnerId;
         $charge->setPartnerId($partnerId);
     }
     $charge->setDateTo($data['date_to']);
     $charge->setDateFrom($data['date_from']);
     $charge->setGuestCurrency($data['user_currency']);
     $charge->setCountryCurrency($data['country_currency']);
     if (isset($data['tot_type']) && $data['tot_type'] > 0 && $data['tot'] > 0) {
         $charge->setCityTot($data['tot'] + $data['tot_additional']);
         $charge->setCityTotType($data['tot_type']);
         $charge->setTotIncluded($data['tot_included']);
         $charge->setTotMaxDuration($data['tot_max_duration']);
     }
     if (isset($data['vat_type']) && $data['vat_type'] > 0 && $data['vat'] > 0) {
         $charge->setCityVat($data['vat'] + $data['vat_additional']);
         $charge->setCityVatType($data['vat_type']);
         $charge->setVatIncluded($data['vat_included']);
         $charge->setVatMaxDuration($data['vat_max_duration']);
     }
     if (isset($data['sales_tax_type']) && $data['sales_tax_type'] > 0 && $data['sales_tax'] > 0) {
         $charge->setCitySalesTax($data['sales_tax'] + $data['sales_tax_additional']);
         $charge->setCitySalesTaxType($data['sales_tax_type']);
         $charge->setSalesTaxIncluded($data['sales_tax_included']);
         $charge->setSalesTaxMaxDuration($data['sales_tax_max_duration']);
     }
     if (isset($data['city_tax_type']) && $data['city_tax_type'] > 0 && $data['city_tax'] > 0) {
         $charge->setCityTax($data['city_tax'] + $data['city_tax_additional']);
         $charge->setCityTaxType($data['city_tax_type']);
         $charge->setCityTaxIncluded($data['city_tax_included']);
         $charge->setCityTaxMaxDuration($data['city_tax_max_duration']);
     }
     $charge->setOccupancy($occupancy);
     $charge->setApartmentId($data['apartment_id']);
     $charge->setApartmentCurrency($data['acc_currency']);
     $charge->setCurrencySymbol($data['symbol']);
     $charge->setCheckCurrency(true);
     /** @var \DDD\Service\Booking\Charge $chargeService */
     $chargeService = $this->getServiceLocator()->get('service_booking_charge');
     return $chargeService->getToBeChargedItems($charge);
 }