checkoutCart->getQuote(); $customerId = (int)$this->currentCustomer->getCustomerId() ?: (int)$quote->getCustomerId(); $balance = $customerId > 0 ? (int)$this->balances->getAccount($customerId, (int)$quote->getStore()->getWebsiteId())['balance'] : 0; $result['reward'] = ['logged_in' => $customerId > 0, 'balance' => $balance, 'applied_points' => (int)$quote->getData('reward_points_used'), 'maximum' => $this->config->maxCheckoutPoints((int)$quote->getStoreId()), 'rate' => $this->config->redemptionRate((int)$quote->getStoreId())]; if (isset($result['drawer_totals'])) { $result['drawer_totals']['reward_discount'] = (float)$quote->getData('reward_discount_amount') > 0 ? '-' . $this->checkoutHelper->formatPrice((float)$quote->getData('reward_discount_amount')) : ''; } return $result; } }