Return all Coupon given during the Checkout

@return array Array of CouponInterface
172629
public function getCurrentCoupons()
    {
        $couponCodes = $this->getRequest()->getSession()->getConsumedCoupons();

        if (null === $couponCodes) {
            return array();
        }
        /** @var CouponFactory $couponFactory */
        $couponFactory = $this->container->get('thelia.coupon.factory');

        $coupons = [];

        foreach ($couponCodes as $couponCode) {
            // Only valid coupons are returned
            try {
                if (false !== $couponInterface = $couponFactory->buildCouponFromCode($couponCode)) {
                    $coupons[] = $couponInterface;
                }
            } catch (\Exception $ex) {
                // Just ignore the coupon and log the problem, just in case someone realize it.
                Tlog::getInstance()->warning(
                    sprintf("Coupon %s ignored, exception occurred: %s", $couponCode, $ex->getMessage())
                );
            }
        }

        return $coupons;
    }
513655
public function getSettings()
    {
        $storeId = $this->getMagentoStoreId();

        return json_encode([
            'connect_url'              => $this->getConnectJsUrl(),
            'publishable_key_payment'  => $this->configHelper->getPublishableKeyPayment($storeId),
            'publishable_key_checkout' => $this->configHelper->getPublishableKeyCheckout($storeId),
            'publishable_key_back_office' => $this->configHelper->getPublishableKeyBackOffice($storeId),
            'create_order_url'         => $this->getUrl(Config::CREATE_ORDER_ACTION),
            'save_order_url'           => $this->getUrl(Config::SAVE_ORDER_ACTION),
            'selectors'                => $this->getReplaceSelectors(),
            'shipping_prefetch_url'    => $this->getUrl(Config::SHIPPING_PREFETCH_ACTION),
            'prefetch_shipping'        => $this->configHelper->getPrefetchShipping($storeId),
            'save_email_url'           => $this->getUrl(Config::SAVE_EMAIL_ACTION),
            'quote_is_virtual'         => $this->getQuoteIsVirtual(),
            'totals_change_selectors'  => $this->getTotalsChangeSelectors(),
            'additional_checkout_button_class' => $this->getAdditionalCheckoutButtonClass(),
            'initiate_checkout'        => $this->getInitiateCheckout(),
            'toggle_checkout'          => $this->getToggleCheckout(),
        ]);
    }
732647
function checkout() {
		if (isset($_SESSION[$this->key])) {
			$out=$_SESSION[$this->key];
			unset($_SESSION[$this->key]);
			return $out;
		}
		return [];
	}
1242021
protected function buildPayload()
    {
        return array_filter([
            'billing_cycle_anchor' => $this->billingCycleAnchor,
            'coupon' => $this->coupon,
            'metadata' => $this->metadata,
            'plan' => $this->plan,
            'quantity' => $this->quantity,
            'tax_percent' => $this->getTaxPercentageForPayload(),
            'trial_end' => $this->getTrialEndForPayload(),
        ]);
    }
1090930
public function getCartSkus() {
    $items = $this->items();
    if (empty($items)) {
      return [];
    }

    $skus = [];
    foreach ($items as $item) {
      $skus[] = $item['sku'];
    }

    return $skus;
  }
587734
public static function getCoupons($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/coupons' . $filter->toQuery(), 'Coupon');
    }
1128726
protected function getByPriceTypeDESC() : array
    {
        $obPriceType = $this->getPriceTypeObject();
        if (empty($obPriceType)) {
            return $this->getByPriceDESC();
        }

        $arElementIDList = (array) Price::getByItemType(Offer::class)
            ->getByPriceType($obPriceType->id)
            ->orderBy('price', 'desc')
            ->lists('item_id');

        return $arElementIDList;
    }
356430
public function toArray()
    {
        return [
            'title' => $this->title,
            'description' => $this->description,
            'commission' => $this->commission,
            'costCentre' => $this->costCentre,
            'currencyCode' => $this->currencyCode,
            'netShippingCosts' => $this->netShippingCosts,
            'internalNote' => $this->getInternalNote(),
            'responsibleContact' => $this->createDataArray($this->responsibleContact),
            'items' => $this->itemsToArray(),
        ];
    }
929240
function credit_selection() {
    global $db, $currencies;
    $gv_query = $db->Execute("select coupon_id from " . TABLE_COUPONS . " where coupon_type = 'G' and coupon_active='Y'");
    // checks to see if any GVs are in the system and active or if the current customer has any GV balance
    if ($gv_query->RecordCount() > 0 || $this->use_credit_amount()) {
      $selection = array('id' => $this->code,
                         'module' => $this->title,
                         'redeem_instructions' => MODULE_ORDER_TOTAL_GV_REDEEM_INSTRUCTIONS,
                         'checkbox' => $this->use_credit_amount(),
                         'fields' => array(array('title' => MODULE_ORDER_TOTAL_GV_TEXT_ENTER_CODE,
                         'field' => zen_draw_input_field('gv_redeem_code', '', 'id="disc-'.$this->code.'" onkeyup="submitFunction(0,0)"'),
                         'tag' => 'disc-'.$this->code
                         )));

    }
    return $selection;
  }
1204144
public function getCreditNotes()
    {
        $result = null;
        if ($this->getType() === static::Order) {
            $result = array();
            $shopCreditNotes = $this->getShopCreditNotesOrIds();
            foreach ($shopCreditNotes as $shopCreditNote) {
                $result[] = new static(static::CreditNote, $shopCreditNote);
            }
        }
        return $result;
    }
347697
protected function getByPriceTypeASC() : array
    {
        $obPriceType = $this->getPriceTypeObject();
        if (empty($obPriceType)) {
            return $this->getByPriceASC();
        }

        //Get product ID list (sort by offer price)
        //We can not use groupBy() in this place
        $arElementIDList = (array) DB::table('lovata_shopaholic_prices')
            ->select('lovata_shopaholic_offers.product_id')
            ->where('lovata_shopaholic_prices.price_type_id', $obPriceType->id)
            ->where('lovata_shopaholic_offers.active', true)
            ->where('lovata_shopaholic_prices.item_type', Offer::class)
            ->orderBy('lovata_shopaholic_prices.price', 'asc')
            ->join('lovata_shopaholic_offers', 'lovata_shopaholic_offers.id', '=', 'lovata_shopaholic_prices.item_id')
            ->lists('product_id');
        $arElementIDList = array_unique($arElementIDList);

        return $arElementIDList;
    }
1352047
public function getItems()
    {
        $items = [];
        if (isset($this->cart->items) === true) {
            foreach ($this->cart->items as $item) {
                $items[$item->getHash()] = $item;
            }
        }

        return $items;
    }
858732
public function format($value): array
    {
        $coupons = [];

        foreach ($value as $coupon) {
            $coupons[] = $coupon->identifier();
        }

        return $coupons;
    }
980765
public function getOrderItems()
    {
        if (\Yii::$app->user->isGuest) {
            $session = \Yii::$app->session;
            $products = $session[self::SESSION_KEY];
        } else {
            $order = Order::find()->where(['user_id' => \Yii::$app->user->id, 'status' => OrderStatus::STATUS_INCOMPLETE])->one();
            if (!empty($order))
                $products = OrderProduct::find()->asArray()->where(['order_id' => $order->id])->all();
        }
        return $products ?? false;
    }
463606
protected function _getReservedItems()
    {
        if (isset($this->_aCurrentlyReserved)) {
            return $this->_aCurrentlyReserved;
        }

        $oReserved = $this->getReservations();
        if (!$oReserved) {
            return [];
        }

        $this->_aCurrentlyReserved = [];
        foreach ($oReserved->getItems(false, false) as $oItem) {
            if (!isset($this->_aCurrentlyReserved[$oItem->oxuserbasketitems__oxartid->value])) {
                $this->_aCurrentlyReserved[$oItem->oxuserbasketitems__oxartid->value] = 0;
            }
            $this->_aCurrentlyReserved[$oItem->oxuserbasketitems__oxartid->value] += $oItem->oxuserbasketitems__oxamount->value;
        }

        return $this->_aCurrentlyReserved;
    }
538712
public function getReplaceSelectors()
    {
        $storeId = $this->getMagentoStoreId();
        $subject = trim($this->configHelper->getReplaceSelectors($storeId));

        return array_filter(explode(',', preg_replace('/\s+/', ' ', $subject)));
    }
706909
protected function getPurchaseParams()
    {
        $url = "checkout/complete/{$this->data_order['order_id']}";

        return array(
            'currency' => $this->data_order['currency'],
            'amount' => $this->data_order['total_formatted_number'],
            'returnUrl' => $this->controller->url($url, array('authorize_return' => true), true),
            'cancelUrl' => $this->controller->url($url, array('authorize_return' => true, 'cancel' => true), true)
        );
    }