/**
  * Set specific payment properties
  *
  * @param Payment $payment
  * @return void
  */
 public function initializePayment(Payment $payment)
 {
     $payment->setMerchantReference('12345678');
     $payment->setPaymentAmount(10000);
     $today = new DateTime();
     $shipDate = $today->modifyClone('+ 10 days');
     $payment->setShipBeforeDate($shipDate);
     $sessionValidity = $today->modifyClone('+ 30 minutes');
     $payment->setSessionValidity($sessionValidity);
 }
 /**
  * Generate table
  */
 protected function generate()
 {
     $openingHours = $this->openingHours;
     $days = $this->getRelativeDays();
     $table = new Table\Sheet();
     foreach ($days as $day) {
         $line = new Table\Line();
         if ($day === 0) {
             $line->setActive();
         }
         $now = new DateTime();
         $dayOpeningHours = $openingHours->getDay($day === 0 ? $now : $now->modifyClone(($day > 0 ? '+' : '-') . $day . ' days'));
         $timeFrom = (new FilterTime\Def($dayOpeningHours->getOpenTime()))->getOutput();
         $timeTo = (new FilterTime\Def($dayOpeningHours->getCloseTime()))->getOutput();
         foreach ($this->timeFilters as $filter) {
             $timeFromFormatted = (new $filter($timeFrom))->getOutput();
             $timeToFormatted = (new $filter($timeTo))->getOutput();
         }
         $line->setTitle($day);
         $line->setTimeFrom($timeFrom);
         $line->setTimeFromFormatted($timeFromFormatted);
         $line->setTimeTo($timeTo);
         $line->setTimeToFormatted($timeToFormatted);
         $line->tags = $dayOpeningHours->tags;
         if ($dayOpeningHours instanceof \Cothema\OpeningHours\Model\SpecificDay) {
             $line->specific = TRUE;
         }
         $table->addLine($line);
     }
     $this->generatedTable = $table;
 }
Exemple #3
0
 protected function createComponentFaktura()
 {
     $dateNow = new DateTime();
     $variableSymbol = 123;
     $supplierBuilder = new ParticipantBuilder("company", "Street", '', "City", "Postcode");
     $supplier = $supplierBuilder->setIn(1111)->setTin("CZ1111")->setAccountNumber("123/0800")->build();
     $nazev = "Customer Name";
     $customerBuilder = new ParticipantBuilder($nazev, "Customer street", '', "Customer city", "Postcode");
     $customer = $customerBuilder->build();
     $items = array(new ItemImpl('Sample item', 1, 1111, TaxImpl::fromPercent(22), false));
     $dataBuilder = new DataBuilder(999, 'Faktura', $supplier, $customer, $dateNow->modifyClone("+14 days"), $dateNow, $items);
     $dataBuilder->setVariableSymbol($variableSymbol)->setDateOfVatRevenueRecognition($dateNow->modifyClone("+15 days"));
     $data = $dataBuilder->build();
     $env = new Eciovni($data);
     $env->setTemplatePath(__DIR__ . "/templates/faktura.latte");
     return $env;
 }