Returns an array of payment methods
@param array $options
@return array
333228
public function getList(array $options = array())
    {
        $methods = &gplcart_static(gplcart_array_hash(array('payment.methods' => $options)));

        if (isset($methods)) {
            return $methods;
        }

        $methods = $this->getDefaultList();
        $this->hook->attach('payment.methods', $methods, $this);

        $weights = array();
        foreach ($methods as $id => &$method) {

            $method['id'] = $id;

            if (!isset($method['weight'])) {
                $method['weight'] = 0;
            }

            if (!empty($options['status']) && empty($method['status'])) {
                unset($methods[$id]);
                continue;
            }

            if (!empty($options['module'])
                && (empty($method['module']) || !in_array($method['module'], (array) $options['module']))) {
                unset($methods[$id]);
                continue;
            }

            $weights[] = $method['weight'];
        }

        if (empty($methods)) {
            return array();
        }

        // Sort by weight then by key
        array_multisort($weights, SORT_ASC, array_keys($methods), SORT_ASC, $methods);
        return $methods;
    }
2631
protected function addBilling(array $params, array $options)
    {
        if ($address = Arr::get($options, 'billing_address')) {
            $params['payer']['payer_info']['billing_address'] = [
                'line1'        => Arr::get($address, 'address1', ''),
                'line2'        => Arr::get($address, 'address2', ''),
                'city'         => Arr::get($address, 'city', ''),
                'country_code' => Arr::get($address, 'country', ''),
                'postal_code'  => Arr::get($address, 'zip', ''),
                'state'        => Arr::get($address, 'state', ''),
            ];
        }

        return $params;
    }
319322
public function getChoices(Options $options)
    {
        if (!$options['category'] instanceof CategoryInterface) {
            return [];
        }

        if (null === $options['context']) {
            $categories = $this->manager->getAllRootCategories();
        } else {
            $categories = $this->manager->getRootCategoriesForContext($options['context']);
        }

        $choices = [];

        foreach ($categories as $category) {
            $choices[$category->getId()] = sprintf('%s (%s)', $category->getName(), $category->getContext()->getId());

            $this->childWalker($category, $options, $choices);
        }

        return $choices;
    }
1125640
protected function getOptions(array $options)
    {
        $labels = [];
        if ($this->hasLanguages()) {
            // As this point we are construction the options for multiple languages
            foreach ($this->languages as $language) {
                foreach ($options as $key => $option) {
                    $labels[$language][$key] = Helpers::convertNameToLabel($option);
                }
            }
        } else {

            // At this point we are just formatting the labels
            foreach ($options as $key => $option) {
                $labels[$key] = Helpers::convertNameToLabel($option);
            }
        }

        return $labels;
    }
839331
public function getEventTypes(array $options = []): array
    {
        $result = [];

        if (!empty($options['calendar'])) {
            $types = json_decode($options['calendar']->event_types, true);
            foreach ($types as $type) {
                $result[$type] = $type;
            }

            asort($result);

            return $result;
        }

        $event = new Event('App.Calendars.getCalendarEventTypes', $this, [
            'user' => $options['user'],
        ]);

        EventManager::instance()->dispatch($event);

        if (!empty($event->result)) {
            $result = array_merge($result, $event->result);
        }

        $configEventTypes = $this->getEventTypeBy();
        $result = array_merge($result, $configEventTypes);

        return $result;
    }
1612
protected function getListPayment()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            $list = $this->payment->getList();
            $this->limitArray($list);
            return $list;
        }

        $method = $this->payment->get($id);

        if (empty($method)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($method);
    }
1224139
public function toOptionArray() {
        return [
            [
                'value' => self::MODE_CARDS,
                'label' => __('Cards')
            ],
            [
                'value' => self::MODE_MIXED,
                'label' => __('Mixed')
            ],
            [
                'value' => self::MODE_LOCAL,
                'label' => __('Local payments')
            ] 
        ];
    }
692211
protected function getResourcePayload(array $options = []) : ?array
    {
        $location = $this->getLocation($options['head'] ?? true);

        if ($this->processedScripts === null) {
            $local  = $this->parseLocalResources($this->resources->get('compiled'));
            $remote = $this->resources->get('scripts.remote');

            $this->processedScripts = [
                'head'  => $this->mergeResourceArrays($local['head'] ?? null, $remote['head'] ?? null),
                'body'  => $this->mergeResourceArrays($local['body'] ?? null, $remote['body'] ?? null),
            ];

            if ($this->processedScripts['head'] !== null) {
                ksort($this->processedScripts['head']);
            }

            if ($this->processedScripts['body'] !== null) {
                ksort($this->processedScripts['body']);
            }
        }

        return $this->processedScripts[$location] !== null ? $this->processedScripts[$location] : null;
    }
567686
public function getList(array $options = array())
    {
        $result = null;
        $this->hook->attach('sku.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT ps.*, p.title, p.currency';

        if (!empty($options['count'])) {
            $sql = 'SELECT COUNT(ps.product_sku_id)';
        }

        $sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)';

        $conditions = array();

        if (isset($options['product_sku_id'])) {
            $sql .= ' WHERE ps.product_sku_id = ?';
            $conditions[] = $options['product_sku_id'];
        } else {
            $sql .= ' WHERE ps.product_sku_id IS NOT NULL';
        }

        if (isset($options['sku'])) {
            $sql .= ' AND ps.sku=?';
            $conditions[] = $options['sku'];
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id=?';
            $conditions[] = $options['store_id'];
        }

        if (isset($options['title_sku'])) {
            $sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)';
            $conditions[] = "%{$options['title_sku']}%";
            $conditions[] = "%{$options['title_sku']}%";
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND ps.product_id=?';
            $conditions[] = $options['product_id'];
        }

        if (isset($options['combination_id'])) {
            $sql .= ' AND ps.combination_id=?';
            $conditions[] = $options['combination_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND ps.status=?';
            $conditions[] = (int) $options['status'];
        }

        $sql .= " ORDER BY ps.sku ASC";

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        if (empty($options['count'])) {
            $list = $this->db->fetchAll($sql, $conditions, array('index' => 'product_sku_id'));
            $result = $this->prepareList($list);
        } else {
            $result = (int) $this->db->fetchColumn($sql, $conditions);
        }

        $this->hook->attach('sku.list.after', $options, $result, $this);
        return $result;
    }
403191
protected function getPdoOptions(array $options)
    {
        $result = $this->pdoDefaultOptions;

        foreach ($options as $k => $v)
        {
            $result[$k] = $v;
        }

        return $result;
    }
612143
protected function getOptions(array  $options): array
    {
        $options['format'] = array_get($options, 'format', $this->format);
        $options['locale'] = array_get($options, 'locale', config('app.locale'));

        return $options;
    }
1050622
protected function getAuthorizationParameters(array $options)
    {
        $options = parent::getAuthorizationParameters($options);
        $options['purpose'] = $this->purpose;
        return $options;
    }
832435
public static function start($options = array())
    {
        $api = new Api\Start();

        if (isset($options['amount'])) {
            $api->setAmount(round($options['amount'] * 100));
        }
        if (isset($options['currency'])) {
            $api->setCurrency($options['currency']);
        }
        if (isset($options['expireDate'])) {
            if (is_string($options['expireDate'])) {
                $options['expireDate'] = new \DateTime($options['expireDate']);
            }
            $api->setExpireDate($options['expireDate']);
        }

        if (isset($options['returnUrl'])) {
            $api->setFinishUrl($options['returnUrl']);
        }
        if (isset($options['exchangeUrl'])) {
            $api->setExchangeUrl($options['exchangeUrl']);
        }
        if (isset($options['paymentMethod']) && !empty($options['paymentMethod'])) {
            $api->setPaymentOptionId($options['paymentMethod']);
        }
        if (isset($options['bank']) && !empty($options['bank'])) {
            $api->setPaymentOptionSubId($options['bank']);
        }
        if (isset($options['orderNumber']) && !empty($options['orderNumber'])) {
            $api->setOrderNumber($options['orderNumber']);
        }
        if (isset($options['description']) && !empty($options['description'])) {
            $api->setDescription($options['description']);
        }
        if (isset($options['testmode']) && $options['testmode'] == 1) {
            $api->setTestMode(true);
        }
        if (isset($options['extra1'])) {
            $api->setExtra1($options['extra1']);
        }
        if (isset($options['extra2'])) {
            $api->setExtra2($options['extra2']);
        }
        if (isset($options['extra3'])) {
            $api->setExtra3($options['extra3']);
        }
        if (isset($options['ipaddress'])) {
            $api->setIpAddress($options['ipaddress']);
        }
        if (isset($options['invoiceDate'])) {
            if (is_string($options['invoiceDate'])) {
                $options['invoiceDate'] = new \DateTime($options['invoiceDate']);
            }
            $api->setInvoiceDate($options['invoiceDate']);
        }
        if (isset($options['deliveryDate'])) {
            if (is_string($options['deliveryDate'])) {
                $options['deliveryDate'] = new \DateTime($options['deliveryDate']);
            }
            $api->setDeliveryDate($options['deliveryDate']);
        }

        if (isset($options['products'])) {
            foreach ((array)$options['products'] as $product) {
                $taxClass = 'N';
                $taxPercentage = 0;
                if (isset($product['tax'])) {
                    $taxClass = Helper::calculateTaxClass($product['price'], $product['tax']);
                    $taxPercentage = round(Helper::calculateTaxPercentage($product['price'], $product['tax']));
                }

                if (isset($product['vatPercentage']) && is_numeric($product['vatPercentage'])) {
                    $taxPercentage = round($product['vatPercentage'], 2);
                    $taxClass = Helper::calculateTaxClass(100 + $taxPercentage, $taxPercentage);
                }

                if (!isset($product['type'])) {
                    $product['type'] = self::PRODUCT_TYPE_ARTICLE;
                }

                $api->addProduct(
                    $product['id'],
                    $product['name'],
                    $product['type'],
                    round($product['price'] * 100),
                    $product['qty'],
                    $taxClass,
                    $taxPercentage
                );
            }
        }
        $enduser = array();
        if (isset($options['enduser'])) {
            if (isset($options['enduser']['birthDate']) && is_string($options['enduser']['birthDate'])) {
                $options['enduser']['birthDate'] = new \DateTime($options['enduser']['birthDate']);
            }
            $enduser = $options['enduser'];
        }
        if (isset($options['company'])) {
            $enduser['company'] = $options['company'];
        }
        if (isset($options['language'])) {
            $enduser['language'] = $options['language'];
        }
        if (isset($options['address'])) {
            $address = array();
            if (isset($options['address']['streetName'])) {
                $address['streetName'] = $options['address']['streetName'];
            }
            if (isset($options['address']['houseNumber'])) {
                $address['streetNumber'] = $options['address']['houseNumber'];
            }
            if (isset($options['address']['houseNumberExtension'])) {
                $address['streetNumberExtension'] = $options['address']['houseNumberExtension'];
            }
            if (isset($options['address']['zipCode'])) {
                $address['zipCode'] = $options['address']['zipCode'];
            }
            if (isset($options['address']['city'])) {
                $address['city'] = $options['address']['city'];
            }
            if (isset($options['address']['country'])) {
                $address['countryCode'] = $options['address']['country'];
            }
            $enduser['address'] = $address;
        }
        if (isset($options['invoiceAddress'])) {
            $invoiceAddress = array();

            if (isset($options['invoiceAddress']['initials'])) {
                $invoiceAddress['initials'] = $options['invoiceAddress']['initials'];
            }
            if (isset($options['invoiceAddress']['lastName'])) {
                $invoiceAddress['lastName'] = $options['invoiceAddress']['lastName'];
            }
            if (isset($options['invoiceAddress']['streetName'])) {
                $invoiceAddress['streetName'] = $options['invoiceAddress']['streetName'];
            }
            if (isset($options['invoiceAddress']['houseNumber'])) {
                $invoiceAddress['streetNumber'] = $options['invoiceAddress']['houseNumber'];
            }
            if (isset($options['invoiceAddress']['houseNumberExtension'])) {
                $invoiceAddress['streetNumberExtension'] = $options['invoiceAddress']['houseNumberExtension'];
            }
            if (isset($options['invoiceAddress']['zipCode'])) {
                $invoiceAddress['zipCode'] = $options['invoiceAddress']['zipCode'];
            }
            if (isset($options['invoiceAddress']['city'])) {
                $invoiceAddress['city'] = $options['invoiceAddress']['city'];
            }
            if (isset($options['invoiceAddress']['country'])) {
                $invoiceAddress['countryCode'] = $options['invoiceAddress']['country'];
            }
            if (isset($options['invoiceAddress']['gender'])) {
                $invoiceAddress['gender'] = $options['invoiceAddress']['gender'];
            }

            $enduser['invoiceAddress'] = $invoiceAddress;
        }
        if (!empty($enduser)) {
            $api->setEnduser($enduser);
        }

        if (!empty($options['object'])) {
            $api->setObject($options['object']);
        }
        if (!empty($options['tool'])) {
            $api->setTool($options['tool']);
        }
        if (!empty($options['info'])) {
            $api->setInfo($options['info']);
        }

        if (!empty($options['promotorId'])) {
            $api->setPromotorId($options['promotorId']);
        }
        if (isset($options['transferType'])) {
            $api->setTransferType($options['transferType']);
        }
        if (isset($options['transferValue'])) {
            $api->setTransferValue($options['transferValue']);
        }

        $result = $api->doRequest();

        return new Result\Start($result);
    }
167555
protected function getMethods($options)
	{
		if (isset($options['only']) && count($options['only']) > 0)
		{
			return $options['only'];
		}
		elseif (isset($options['except']) && count($options['except']) > 0)
		{
			return array_diff($this->defaults, $options['except']);
		}

		return $this->defaults;
	}
1322756
protected function getPrestaShopOptions(array $options)
    {
        $result = array(
            'query' => array(),
            'id' => 'id',
            'name' => 'name',
        );

        foreach ($options as $value => $label) {
            $result['query'][] = array(
                'id' => $value,
                'name' => $label,
            );
        }

        return $result;
    }
76783
protected function addPayment($params, $amount, $payment, $options)
    {
        return array_merge($params, [
            'payment' => [
                'external' => [
                    'transaction'     => Arr::get($options, 'reference'),
                    'application_key' => $this->gateway->getApplicationKey(),
                ],
                'reference' => [
                    'number'      => Arr::get($options, 'reference'),
                    'description' => Arr::get($options, 'description'),
                ],
                'total' => [
                    'amount'   => $this->gateway->amount($amount),
                    'currency' => Arr::get($options, 'currency', $this->gateway->getCurrency()),
                ],
                'origin'    => [
                    'ip'       => Arr::get($options, 'ip', ''),
                    'location' => [
                        'latitude'  => Arr::get($options, 'latitude', '0.00000'),
                        'longitude' => Arr::get($options, 'longitude', '0.00000'),
                    ],
                ],
            ],
            'recurrent' => $payment,
            'total'     => [
                'amount' => $this->gateway->amount($amount),
            ],
        ]);
    }
527556
protected function getFilteredOptions(array $options)
    {
        $default = $this->getDefaultOptions();
        $options = \array_merge($default, $options);

        $uses = \array_unique(\array_merge([
            'path', 'filename', 'extension', 'format',
        ], \array_keys($default)));

        $data = Arr::only($options, $uses);

        return $data;
    }