Set installment settings for checkout preferences.

@param array $quantity
@param int   $discountValue
@param int   $additionalValue

@return $this
500312
public function addInstallmentCheckoutPreferences($quantity, $discountValue = 0, $additionalValue = 0)
    {
        $installmentPreferences = new stdClass();
        $installmentPreferences->quantity = $quantity;
        $installmentPreferences->discount = $discountValue;
        $installmentPreferences->addition = $additionalValue;

        $this->data->checkoutPreferences->installments[] = $installmentPreferences;

        return $this;
    }
330476
public function validateCoupon(
        CartInterface $cart,
        CouponInterface $coupon
    ) {
        if ($cart->getTotalItemNumber() === 0) {
            throw new CouponIncompatibleException();
        }

        $this
            ->couponManager
            ->checkCoupon($coupon);
    }
825444
public function setExtra($extra)
    {
        $resultData = $this->hydrateIfJsonToArray($extra);
        if (!empty($resultData)) {
            $this->extra = $resultData;
        }
        else {
            $this->extra = [];
        }
    }
333676
public function setQuantity(int $quantity): self
    {
        $this->quantity = $quantity;
        $this->updateTotalPrice();
        $this->updateTotalRetailPrice();

        return $this;
    }
1098246
public function setInstallment(
        $cardBrand,
        $quantity = null,
        $amount = null,
        $totalAmount = null,
        $interestFree = null
    ) {
        $param = $cardBrand;
        if (isset($param) && is_array($param) || is_object($param)) {
            if (isset($param->cardBrand)) {
                $this->setCardBrand($param->cardBrand);
            }
            if (isset($param->quantity)) {
                $this->setQuantity($param->quantity);
            }
            if (isset($param->installmentAmount)) {
                $this->setInstallmentAmount($param->installmentAmount);
            }
            if (isset($param->totalAmount)) {
                $this->setTotalAmount($param->totalAmount);
            }
            if (isset($param->interestFree)) {
                $this->setInterestFree($param->interestFree);
            }
        } else {
            if (isset($cardBrand)) {
                $this->setCardBrand($cardBrand);
            }
            if (isset($quantity)) {
                $this->setQuantity($quantity);
            }
            if (isset($amount)) {
                $this->setInstallmentAmount($amount);
            }
            if (isset($totalAmount)) {
                $this->setTotalAmount($totalAmount);
            }
            if (isset($interestFree)) {
                $this->setInterestFree($interestFree);
            }
        }
    }
1091203
public function setOrderReferenceOrderValue($orderValue)
    {
        $request = new \OffAmazonPaymentsService_Model_SetOrderReferenceDetailsRequest();
        $request->setSellerId($this->config->getMerchantId());
        $request->setAmazonOrderReferenceId($this->amazonOrderReferenceId);

        $request->setOrderReferenceAttributes(new \OffAmazonPaymentsService_Model_OrderReferenceAttributes());
        $request->getOrderReferenceAttributes()->setPlatformId($this->config->getPlatformId());
        $request->getOrderReferenceAttributes()->setOrderTotal(new \OffAmazonPaymentsService_Model_OrderTotal());

        $request->getOrderReferenceAttributes()->getOrderTotal()->setCurrencyCode('EUR');

        $request->getOrderReferenceAttributes()->getOrderTotal()->setAmount($orderValue);

        $orderReferenceDetails = null;

        // set order reference details
        try {
            $response = $this->config->getAmazonAPI()->setOrderReferenceDetails($request);
            /** @var \OffAmazonPaymentsService_Model_SetOrderReferenceDetailsResult $result */
            $result = $response->getSetOrderReferenceDetailsResult();
            /** @var \OffAmazonPaymentsService_Model_OrderReferenceDetails $orderReferenceDetails */
            $orderReferenceDetails = $result->getOrderReferenceDetails();
            $this->logApiCall($request, $response);
        } catch (\OffAmazonPaymentsService_Exception $e) {
            $this->logApiError($request, $e);
            // api error
            throw $this->convertApiToLogMessageException($request, $e, 'setOrderReferenceOrderValue');
        }

        return $orderReferenceDetails;
    }
559688
public void setAdditionalPreference(String name, String value) {

        if (value == null) {
            m_additionalPreferences.remove(name);
        } else {
            m_additionalPreferences.put(name, value);
        }
    }
396138
public function CommitVoucherUseForCurrentUser($iShopOrderId)
    {
        $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance();
        /** @var $oShopvoucherUse TdbShopVoucherUse */
        $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId);
        // hook to post-convert value (as may be required when dealing with currency)
        $this->CommitVoucherUseForCurrentUserPreSaveHook($aData);
        $oShopVoucherUse->LoadFromRow($aData);
        $oShopVoucherUse->AllowEditByAll(true);
        $oShopVoucherUse->Save();

        if ($this->checkMarkVoucherAsCompletelyUsed()) {
            $this->MarkVoucherAsCompletelyUsed();
        }
    }
147375
private function saveProductToSession(int $productId, int $count, $attributesAndValues = null, $additionalProducts = [], $combinationId = null)
    {
        if (!empty($productId) && (!empty($count))) {

            $additionalProductsArray = [];
            if (!empty($additionalProducts)) {
                foreach ($additionalProducts as $additionalProduct) {
                    $additionalProductsArray[] = [
                        'productId' => $additionalProduct->productId,
                        'number' => $additionalProduct->number
                    ];
                }
            }

            $session = Yii::$app->session;
            $productsFromSession = $session[self::SESSION_KEY];

            if (\Yii::$app->getModule('shop')->enableCombinations) {
                if (!empty($attributesAndValues)) {
                    $combination = $this->getCombination($attributesAndValues, $productId);
                    if (!empty($combination)) $combinationId = $combination->id;
                }
            }

            if (!empty($productsFromSession)) {
                foreach ($productsFromSession as $key => $product) {

                    if ($product['id'] == $productId) {

                        if (\Yii::$app->getModule('shop')->enableCombinations && !empty($combinationId)) {

                            if ($product['combinationId'] == $combinationId) {
                                $productsFromSession[$key]['count'] += $count;

                                $productsFromSession[$key]['additionalProducts'] = (empty($productsFromSession[$key]['additionalProducts'])) ?
                                    $additionalProductsArray : array_merge($productsFromSession[$key]['additionalProducts'], $additionalProductsArray);

                                break;
                            }
                        } else {
                            if (empty($product['combinationId'])) {
                                $productsFromSession[$key]['count'] += $count;
                                $productsFromSession[$key]['additionalProducts'] = (empty($productsFromSession[$key]['additionalProducts'])) ?
                                    $additionalProductsArray : array_merge($productsFromSession[$key]['additionalProducts'], $additionalProductsArray);

                                break;
                            }
                        }
                    }
                    if (count($productsFromSession) - 1 == $key) {
                        $productsFromSession[] =
                            [
                                'id' => $productId,
                                'count' => $count,
                                'combinationId' => $combinationId,
                                'additionalProducts' => $additionalProductsArray
                            ];
                    }
                }
                $session[self::SESSION_KEY] = $productsFromSession;
            } else {
                $_SESSION[self::SESSION_KEY][] =
                    [
                        'id' => $productId,
                        'count' => $count,
                        'combinationId' => $combinationId,
                        'additionalProducts' => $additionalProductsArray
                    ];
            }
            return true;
        }
        return false;
    }
817305
public function incrementQuantityAt($cartItemIndex, $quantity = 1)
    {
        $this->existenceCheckFor($cartItemIndex);

        $this->items[$cartItemIndex]->quantity += $quantity;

        $this->cartDriver->setCartItemQuantity(
            $this->items[$cartItemIndex]->id,
            $this->items[$cartItemIndex]->quantity
        );

        return $this->cartUpdates();
    }
164473
public function applyFlatDiscount($amount, $couponId = null)
    {
        if ($amount > $this->subtotal) {
            throw new IncorrectDiscount('The discount amount cannot be more that subtotal of the cart');
        }

        $this->discount = round($amount, 2);
        $this->discountPercentage = 0;
        $this->couponId = $couponId;

        $cartData = $this->cartUpdates($isNewItem = false, $keepDiscount = true);

        event(new DiscountApplied($cartData));

        return $cartData;
    }
1013693
protected function _fillOutDiscount(IDiscount $discountPayload, array $discountData)
    {
        return $discountPayload
            ->setAmount($this->_nullCoalesce($discountData, 'amount', 0.00))
            ->setAppliedCount($this->_nullCoalesce($discountData, 'applied_count', null))
            ->setCode($this->_nullCoalesce($discountData, 'code', null))
            ->setDescription($this->_nullCoalesce($discountData, 'description', null))
            ->setEffectType($this->_nullCoalesce($discountData, 'effect_type', null))
            ->setId($this->_nullCoalesce($discountData, 'id', null));
    }
419645
public function setAttributeValue(\Sulu\Bundle\ProductBundle\Entity\AttributeValue $attributeValue)
    {
        $this->attributeValue = $attributeValue;

        return $this;
    }
147105
static function withOrderNumberAmountAndCurrency($orderNumber, $amount, $currency)
    {
        return (new static())
            ->setOrderNumber($orderNumber)
            ->setAmount($amount)
            ->setCurrency($currency)
            ;
    }
817510
public function decrement($column, $amount = 1, array $extra = array())
    {
        $extra = $this->addUpdatedAtColumn($extra);

        return $this->query->decrement($column, $amount, $extra);
    }
606884
public function setDiscount($value)
    {
        $this->data->amount->subtotals->discount = $this->convertAmount($value);

        return $this;
    }
64837
public function addAmountToShippingOptions($amount){
        foreach ($this->getShippingOptions() as $option) {
            $option->setCost($option->getCost() + $amount);
        }

        return $this;
    }