/**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     foreach ($quoteTransfer->getExpenses() as $expenseTransfer) {
         $expenseTransfer->requireUnitGrossPrice()->requireQuantity();
         $expenseTransfer->setSumGrossPrice($expenseTransfer->getUnitGrossPrice() * $expenseTransfer->getQuantity());
     }
 }
Esempio n. 2
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return int
  */
 protected function sumItemTaxes(QuoteTransfer $quoteTransfer)
 {
     $totalTaxAmount = 0;
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $totalTaxAmount += $itemTransfer->getSumTaxAmount();
     }
     return $totalTaxAmount;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     $totalsTransfer = $this->createTotalsTransfer();
     $totalsTransfer->setTaxTotal($this->createTaxTotalsTransfer());
     $totalsTransfer->setDiscountTotal(0);
     $totalsTransfer->setExpenseTotal(0);
     $quoteTransfer->setTotals($totalsTransfer);
 }
Esempio n. 4
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return array
  */
 public function buildPreCheckRequest(QuoteTransfer $quoteTransfer)
 {
     $payolutionTransfer = $quoteTransfer->getPayment()->getPayolution();
     $addressTransfer = $payolutionTransfer->getAddress();
     $requestData = $this->getBaseTransactionRequest($quoteTransfer->getTotals()->getGrandTotal(), $payolutionTransfer->getCurrencyIso3Code());
     $this->addRequestData($requestData, [ApiConstants::PAYMENT_CODE => ApiConstants::PAYMENT_CODE_PRE_CHECK, ApiConstants::TRANSACTION_CHANNEL => $this->config->getTransactionChannelPreCheck(), ApiConstants::NAME_GIVEN => $addressTransfer->getFirstName(), ApiConstants::NAME_FAMILY => $addressTransfer->getLastName(), ApiConstants::NAME_TITLE => $addressTransfer->getSalutation(), ApiConstants::NAME_SEX => $this->mapGender($payolutionTransfer->getGender()), ApiConstants::NAME_BIRTHDATE => $payolutionTransfer->getDateOfBirth(), ApiConstants::ADDRESS_STREET => $this->formatAddress($addressTransfer), ApiConstants::ADDRESS_ZIP => $addressTransfer->getZipCode(), ApiConstants::ADDRESS_CITY => $addressTransfer->getCity(), ApiConstants::ADDRESS_COUNTRY => $addressTransfer->getIso2Code(), ApiConstants::CONTACT_EMAIL => $payolutionTransfer->getEmail(), ApiConstants::CONTACT_PHONE => $addressTransfer->getPhone(), ApiConstants::CONTACT_MOBILE => $addressTransfer->getCellPhone(), ApiConstants::CONTACT_IP => $payolutionTransfer->getClientIp(), ApiConstants::CRITERION_PRE_CHECK => 'TRUE', ApiConstants::CRITERION_CUSTOMER_LANGUAGE => $payolutionTransfer->getLanguageIso2Code(), ApiConstants::CRITERION_CALCULATION_ID => $payolutionTransfer->getInstallmentCalculationId(), ApiConstants::CRITERION_INSTALLMENT_AMOUNT => $this->getCurrencyManager()->convertCentToDecimal($payolutionTransfer->getInstallmentAmount()), ApiConstants::CRITERION_DURATION => $payolutionTransfer->getInstallmentDuration(), ApiConstants::CRITERION_ACCOUNT_HOLDER => $payolutionTransfer->getBankAccountHolder(), ApiConstants::CRITERION_ACCOUNT_BIC => $payolutionTransfer->getBankAccountBic(), ApiConstants::CRITERION_ACCOUNT_IBAN => $payolutionTransfer->getBankAccountIban(), ApiConstants::CRITERION_ACCOUNT_COUNTRY => $addressTransfer->getIso2Code()]);
     return $requestData;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     $quoteTransfer->requireTotals();
     $grandTotal = $quoteTransfer->getTotals()->getGrandTotal();
     $discountTotal = $quoteTransfer->getTotals()->getDiscountTotal();
     $grandTotal = $this->subtractDiscount($discountTotal, $grandTotal);
     $quoteTransfer->getTotals()->setGrandTotal($grandTotal);
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return int
  */
 protected function getCalculatedGrandTotal(QuoteTransfer $quoteTransfer)
 {
     $quoteTransfer->getTotals()->requireSubtotal();
     $subTotal = $quoteTransfer->getTotals()->getSubtotal();
     $expensesTotal = $quoteTransfer->getTotals()->getExpenseTotal();
     $grandTotal = $subTotal + $expensesTotal;
     return $grandTotal;
 }
Esempio n. 7
0
 /**
  * Defines logic to determine if order is placed for testing purposes. When order is persisted, is_test flag is set.
  *
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return bool
  */
 public function isTestOrder(QuoteTransfer $quoteTransfer)
 {
     $shippingAddressTransfer = $quoteTransfer->getShippingAddress();
     if ($shippingAddressTransfer === null || $shippingAddressTransfer->getFirstName() !== self::TEST_CUSTOMER_FIRST_NAME) {
         return false;
     }
     return true;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return int
  */
 protected function getQuoteItemQuantity(QuoteTransfer $quoteTransfer)
 {
     $totalQuantity = 0;
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $totalQuantity += $itemTransfer->getQuantity();
     }
     return $totalQuantity;
 }
Esempio n. 9
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\ItemTransfer $currentItemTransfer
  * @param \Generated\Shared\Transfer\ClauseTransfer $clauseTransfer
  *
  * @return bool
  */
 public function isSatisfiedBy(QuoteTransfer $quoteTransfer, ItemTransfer $currentItemTransfer, ClauseTransfer $clauseTransfer)
 {
     if (!$quoteTransfer->getTotals()) {
         return false;
     }
     $this->moneyValueConverter->convertDecimalToCent($clauseTransfer);
     return $this->comparators->compare($clauseTransfer, $quoteTransfer->getTotals()->getSubtotal());
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
  *
  * @return \Generated\Shared\Transfer\CheckoutResponseTransfer
  */
 public function checkCondition(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
 {
     if ($quoteTransfer->getTotals()->getGrandTotal() === 0) {
         $quoteTransfer->getPayment()->setPaymentMethod(ZeroPaymentConstants::PAYMENT_METHOD_ZERO_PAYMENT);
         $quoteTransfer->getPayment()->setPaymentSelection(ZeroPaymentConstants::PAYMENT_METHOD_ZERO_PAYMENT);
         $quoteTransfer->getPayment()->setPaymentProvider(ZeroPaymentConstants::PROVIDER_NAME);
     }
     return $checkoutResponseTransfer;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return int
  */
 protected function getCalculatedExpenseTotalAmount(QuoteTransfer $quoteTransfer)
 {
     $totalExpenseAmount = 0;
     foreach ($quoteTransfer->getExpenses() as $expenseTransfer) {
         $expenseTransfer->requireSumGrossPrice();
         $totalExpenseAmount += $expenseTransfer->getSumGrossPrice();
     }
     return $totalExpenseAmount;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     foreach ($quoteTransfer->getItems() as $item) {
         $item->setCalculatedDiscounts(new \ArrayObject());
     }
     foreach ($quoteTransfer->getExpenses() as $expense) {
         $expense->setCalculatedDiscounts(new \ArrayObject());
     }
 }
 /**
  * QuoteTransfer $quoteTransfer
  *
  * @return int
  */
 protected function getCalculatedSubtotal(QuoteTransfer $quoteTransfer)
 {
     $subTotal = 0;
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $itemTransfer->requireSumGrossPriceWithProductOptions();
         $subTotal += $itemTransfer->getSumGrossPriceWithProductOptions();
     }
     return $subTotal;
 }
Esempio n. 14
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     $this->accruedTaxCalculator->resetRoundingErrorDelta();
     foreach ($quoteTransfer->getExpenses() as $expenseTransfer) {
         $unitTaxAmount = $this->calculateTaxAmount($expenseTransfer->getUnitGrossPrice(), $expenseTransfer->getTaxRate());
         $sumTaxAmount = $this->calculateTaxAmount($expenseTransfer->getSumGrossPrice(), $expenseTransfer->getTaxRate());
         $expenseTransfer->setUnitTaxAmount($unitTaxAmount);
         $expenseTransfer->setSumTaxAmount($sumTaxAmount);
     }
 }
Esempio n. 15
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function saveOrder(QuoteTransfer $quoteTransfer)
 {
     Propel::getConnection()->beginTransaction();
     $paymentTransfer = $quoteTransfer->getPayonePayment();
     $paymentTransfer->setFkSalesOrder($orderTransfer->getIdSalesOrder());
     $payment = $this->savePayment($paymentTransfer);
     $paymentDetailTransfer = $paymentTransfer->getPaymentDetail();
     $this->savePaymentDetail($payment, $paymentDetailTransfer);
     Propel::getConnection()->commit();
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse
  *
  * @return void
  */
 public function checkCondition(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse)
 {
     $groupedItemQuantities = $this->groupItemsBySku($quoteTransfer->getItems());
     foreach ($groupedItemQuantities as $sku => $quantity) {
         if (!$this->isProductSellable($sku, $quantity)) {
             $checkoutErrorTransfer = $this->createCheckoutErrorTransfer();
             $checkoutErrorTransfer->setErrorCode(CheckoutConstants::ERROR_CODE_PRODUCT_UNAVAILABLE)->setMessage('product.unavailable');
             $checkoutResponse->addError($checkoutErrorTransfer)->setIsSuccess(false);
         }
     }
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $this->assertItemRequirements($itemTransfer);
         $this->setProductOptionSumGrossPrice($itemTransfer);
         $productOptionUnitTotal = $this->getProductOptionUnitTotal($itemTransfer);
         $productOptionSumTotal = $this->getProductOptionSumTotal($itemTransfer);
         $itemTransfer->setUnitGrossPriceWithProductOptions($itemTransfer->getUnitGrossPrice() + $productOptionUnitTotal);
         $itemTransfer->setSumGrossPriceWithProductOptions($itemTransfer->getSumGrossPrice() + $productOptionSumTotal);
     }
 }
Esempio n. 18
0
 /**
  * @return void
  */
 public function testGetPayolutionPaymentTransferShouldThrowExceptionIfPaymentSelectionNotFound()
 {
     $paymentHandler = new PayolutionHandler($this->getPayolutionClientMock(), CurrencyManager::getInstance());
     $request = Request::createFromGlobals();
     $quoteTransfer = new QuoteTransfer();
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('payolutionInvoice');
     $quoteTransfer->setPayment($paymentTransfer);
     $this->expectException(PaymentMethodNotFoundException::class);
     $paymentHandler->addPaymentToQuote($request, $quoteTransfer);
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
  *
  * @return void
  */
 public function validateCheckoutGrandTotal(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
 {
     $totalsBefore = $quoteTransfer->getTotals()->getGrandTotal();
     $this->stackExecutor->recalculate($quoteTransfer);
     $totalsAfter = $quoteTransfer->getTotals()->getGrandTotal();
     if ($totalsBefore !== $totalsAfter) {
         $error = $this->createCheckoutErrorTransfer();
         $error->setErrorCode(CheckoutConstants::ERROR_CODE_CART_AMOUNT_DIFFERENT)->setMessage('Checkout grand total changed.');
         $checkoutResponseTransfer->addError($error);
     }
 }
Esempio n. 20
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\ClauseTransfer $clauseTransfer
  *
  * @return \Generated\Shared\Transfer\DiscountableItemTransfer[]
  */
 public function collect(QuoteTransfer $quoteTransfer, ClauseTransfer $clauseTransfer)
 {
     $discountableItems = [];
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         if ($this->comparators->compare($clauseTransfer, $itemTransfer->getSku()) === false) {
             continue;
         }
         $discountableItems[] = $this->createDiscountableItemTransfer($itemTransfer->getUnitGrossPrice(), $itemTransfer->getQuantity(), $itemTransfer->getCalculatedDiscounts());
     }
     return $discountableItems;
 }
Esempio n. 21
0
 /**
  * @return void
  */
 public function testSetTaxRateWhenExemptTaxRateUsedAndCountryMatchingShouldUseCountryRate()
 {
     $abstractProcuctEntity = $this->createAbstractProductWithTaxSet(20, 'DE');
     $quoteTransfer = new QuoteTransfer();
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setIdProductAbstract($abstractProcuctEntity->getIdProductAbstract());
     $quoteTransfer->addItem($itemTransfer);
     $taxFacadeTest = $this->createTaxFacade();
     $taxFacadeTest->calculateProductItemTaxRate($quoteTransfer);
     $this->assertEquals('20.00', $itemTransfer->getTaxRate());
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 protected function addExpenseTaxes(QuoteTransfer $quoteTransfer)
 {
     $this->taxFacade->resetAccruedTaxCalculatorRoundingErrorDelta();
     foreach ($quoteTransfer->getExpenses() as $expenseTransfer) {
         if (!$expenseTransfer->getTaxRate()) {
             continue;
         }
         $itemUnitTaxAmount = $this->calculateTaxAmount($expenseTransfer->getUnitGrossPriceWithDiscounts(), $expenseTransfer->getTaxRate());
         $expenseTransfer->setUnitTaxAmountWithDiscounts($itemUnitTaxAmount);
         $itemSumTaxAmount = $this->calculateTaxAmount($expenseTransfer->getSumGrossPriceWithDiscounts(), $expenseTransfer->getTaxRate());
         $expenseTransfer->setSumTaxAmountWithDiscounts($itemSumTaxAmount);
     }
 }
Esempio n. 23
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
  *
  * @return void
  */
 public function checkPreConditions(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
 {
     if ($quoteTransfer->getCustomer() !== null && $quoteTransfer->getCustomer()->getIdCustomer() !== null) {
         return;
     }
     if ($quoteTransfer->getCustomer()->getIsGuest() === true) {
         return;
     }
     if ($this->customer->hasEmail($quoteTransfer->getCustomer()->getEmail())) {
         $checkoutErrorTransfer = $this->createCheckoutErrorTransfer();
         $checkoutErrorTransfer->setErrorCode(CheckoutConstants::ERROR_CODE_CUSTOMER_ALREADY_REGISTERED)->setMessage('Email already taken');
         $checkoutResponseTransfer->setIsSuccess(false)->addError($checkoutErrorTransfer);
     }
 }
Esempio n. 24
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return void
  */
 public function recalculate(QuoteTransfer $quoteTransfer)
 {
     $this->accruedTaxCalculator->resetRoundingErrorDelta();
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $itemTransfer->setUnitTaxAmount(0);
         $itemTransfer->setSumTaxAmount(0);
         if (!$itemTransfer->getTaxRate()) {
             continue;
         }
         $unitTaxAmount = $this->calculateTaxAmount($itemTransfer->getUnitGrossPrice(), $itemTransfer->getTaxRate());
         $sumTaxAmount = $this->calculateTaxAmount($itemTransfer->getSumGrossPrice(), $itemTransfer->getTaxRate());
         $itemTransfer->setUnitTaxAmount($unitTaxAmount);
         $itemTransfer->setSumTaxAmount($sumTaxAmount);
     }
 }
Esempio n. 25
0
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getQuoteTransfer()
 {
     $quoteTransfer = new QuoteTransfer();
     $totalsTransfer = new TotalsTransfer();
     $totalsTransfer->setGrandTotal(10000)->setSubtotal(10000);
     $quoteTransfer->setTotals($totalsTransfer);
     $addressTransfer = new AddressTransfer();
     $addressTransfer->setFirstName('John')->setLastName('Doe')->setSalutation('Mr')->setCity('Berlin')->setIso2Code('DE')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623');
     $quoteTransfer->setBillingAddress($addressTransfer);
     $paymentTransfer = new PayolutionPaymentTransfer();
     $paymentTransfer->setGender('Male')->setDateOfBirth('1970-01-01')->setClientIp('127.0.0.1')->setAccountBrand(ApiConstants::BRAND_INVOICE)->setAddress($addressTransfer);
     $payment = new PaymentTransfer();
     $payment->setPayolution($paymentTransfer);
     $quoteTransfer->setPayment($payment);
     return $quoteTransfer;
 }
 /**
  * @return void
  */
 public function testSetTaxRateWhenExemptTaxRateUsedAndCountryMatchingShouldUseCountryRate()
 {
     $shipmentMethodEntity = $this->createShipmentMethodWithTaxSet(20, 'DE');
     $quoteTransfer = new QuoteTransfer();
     $addressTransfer = new AddressTransfer();
     $addressTransfer->setIso2Code('DE');
     $quoteTransfer->setShippingAddress($addressTransfer);
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentMethodTransfer = new ShipmentMethodTransfer();
     $shipmentMethodTransfer->fromArray($shipmentMethodEntity->toArray(), true);
     $shipmentTransfer->setMethod($shipmentMethodTransfer);
     $quoteTransfer->setShipment($shipmentTransfer);
     $shipmentFacadeTest = $this->createShipmentFacade();
     $shipmentFacadeTest->calculateShipmentTaxRate($quoteTransfer);
     $this->assertEquals('20.00', $shipmentMethodTransfer->getTaxRate());
 }
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 private function getCheckoutRequestTransfer()
 {
     $itemTransfer = new ItemTransfer();
     $itemTransfer->setSku('1234567890')->setQuantity(1)->setUnitGrossPriceWithProductOptions(10000)->setName('Socken');
     $billingAddressTransfer = new AddressTransfer();
     $billingAddressTransfer->setIso2Code('DE')->setEmail('*****@*****.**')->setFirstName('John')->setLastName('Doe')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623')->setCity('Berlin');
     $shippingAddressTransfer = new AddressTransfer();
     $shippingAddressTransfer->setIso2Code('DE')->setEmail('*****@*****.**')->setFirstName('John')->setLastName('Doe')->setAddress1('Fraunhoferstraße')->setAddress2('120')->setZipCode('80469')->setCity('München');
     $paymentAddressTransfer = (new AddressTransfer())->setFirstName('John')->setLastName('Doe')->setSalutation('Mr')->setEmail('*****@*****.**')->setCity('Berlin')->setIso2Code('DE')->setAddress1('Straße des 17. Juni')->setAddress2('135')->setZipCode('10623');
     $payolutionPaymentTransfer = (new PayolutionPaymentTransfer())->setGender('Male')->setDateOfBirth('1970-01-01')->setClientIp('127.0.0.1')->setAccountBrand(PayolutionConstants::BRAND_INVOICE)->setAddress($paymentAddressTransfer);
     $quoteTransfer = new QuoteTransfer();
     $totalsTransfer = new TotalsTransfer();
     $totalsTransfer->setGrandTotal(10000)->setSubtotal(10000);
     $quoteTransfer->setTotals($totalsTransfer);
     $paymentTransfer = new PaymentTransfer();
     $paymentTransfer->setPaymentSelection('no_payment');
     $paymentTransfer->setPayolution($payolutionPaymentTransfer);
     $quoteTransfer->setPayment($paymentTransfer);
     $quoteTransfer->setShippingAddress($shippingAddressTransfer)->setBillingAddress($billingAddressTransfer);
     return $quoteTransfer;
 }
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return \Orm\Zed\Shipment\Persistence\SpyShipmentMethod
  */
 protected function findTaxSetByIdShipmentMethod(QuoteTransfer $quoteTransfer)
 {
     return $this->shipmentQueryContainer->queryTaxSetByIdShipmentMethodAndCountryIso2Code($quoteTransfer->getShipment()->getMethod()->getIdShipmentMethod(), $quoteTransfer->getShippingAddress()->getIso2Code())->findOne();
 }
 /**
  * @return \Generated\Shared\Transfer\QuoteTransfer
  */
 protected function createQuoteTransfer()
 {
     $quoteTransfer = new QuoteTransfer();
     $shipmentMethodTransfer = new ShipmentMethodTransfer();
     $shipmentMethodTransfer->setName('DummyShipment');
     $shipmentTransfer = new ShipmentTransfer();
     $shipmentTransfer->setMethod($shipmentMethodTransfer);
     $quoteTransfer->setShipment($shipmentTransfer);
     $expenseTransfer = new ExpenseTransfer();
     $expenseTransfer->setName($shipmentMethodTransfer->getName());
     $expenseTransfer->setType(ShipmentConstants::SHIPMENT_EXPENSE_TYPE);
     $quoteTransfer->addExpense($expenseTransfer);
     return $quoteTransfer;
 }
Esempio n. 30
0
 /**
  * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
  *
  * @return array|\Generated\Shared\Transfer\DiscountableItemTransfer[]
  */
 protected function createDiscountableItemsFromQuoteTransfer(QuoteTransfer $quoteTransfer)
 {
     $discountableItems = [];
     foreach ($quoteTransfer->getItems() as $itemTransfer) {
         $discountableItemTransfer = new DiscountableItemTransfer();
         $discountableItemTransfer->fromArray($itemTransfer->toArray(), true);
         $discountableItemTransfer->setOriginalItemCalculatedDiscounts($itemTransfer->getCalculatedDiscounts());
         $discountableItems[] = $discountableItemTransfer;
     }
     return $discountableItems;
 }