Filter the result to only return payment methods allowed for a country

@param array $paymentMethods
@param string $country
@return array filtered paymentmethods
336208
private static function filterCountry($paymentMethods, $country)
    {
        $output = array();
        foreach ($paymentMethods as $paymentMethod) {
            if (in_array($country, $paymentMethod['countries'], true)
              || in_array('ALL', $paymentMethod['countries'], true)
            ) {
                $output[] = $paymentMethod;
            }
        }
        return $output;
    }
1194218
function filterByMethods(req) {
        if(_config.allowedMethods) {
            return _config.allowedMethods.indexOf(req.method) > -1;
        } else if(_config.blockedMethods){
            return !(_config.blockedMethods.indexOf(req.method) > -1);
        } else {
            return true;
        }
    }
909285
public function updateFromEmbeddedApiResponse(array $data, string $currency, PaymentMethodInterface $paymentMethod = null): PaymentMethodInterface
    {
        if (!$paymentMethod) {
            $paymentMethod = $this->getPaymentMethod($data['id']);
        }

        if (!$paymentMethod->getId()) {
            // only update when we create a new entity because this is the embedded method
            $paymentMethod
                ->setFee(DandomainFoundation\createMoney((string) $currency, $data['fee']))
                ->setFeeInclVat($data['feeInclVat'])
                ->setName($data['name']);
        }

        return $paymentMethod;
    }
7904
public function listPaymentMethods()
    {
        $request = new ListPaymentMethods($this->config->getMerchantId());

        $this->request = $request->getXml();

        $this->send();

        $result = new ListPaymentMethodsResponse($this->response);

        return $result;
    }
1221677
public function getCountryAvailableCardTypes($country) {
        $types = $this->getCountrySpecificCardTypeConfig();
        return (!empty($types[$country])) ? $types[$country] : [];
    }
65445
public function getCountries()
    {
        if ($this->_aCountries === null) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $this->_aCountries = [];
            $sSelect = 'select oxobjectid from oxobject2payment where oxpaymentid=' . $oDb->quote($this->getId()) . ' and oxtype = "oxcountry" ';
            $rs = $oDb->getCol($sSelect);
            $this->_aCountries = $rs;
        }

        return $this->_aCountries;
    }
894388
public function setPaymentMethod($paymentMethod)
    {
        if ($this->paymentMethod !== $paymentMethod) {
            $this->paymentMethod      = (string)$paymentMethod;
            $this->isShopSumChanged   = true;
            $this->isClientSumChanged = true;
        }

        return $this;
    }
662538
public function getPaymentMethod()
    {
        /** @var \Order $order */
        $order = $this->getOrder()->source;
        if (isset($order->module)) {
            return $order->module;
        }
        return parent::getPaymentMethod();
    }
344782
static public function isPaymentMode($paymentMode) {
    return ((string) $paymentMode == Connect2PayClient::PAYMENT_MODE_SINGLE ||
        (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_ONSHIPPING ||
        (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_RECURRENT ||
        (string) $paymentMode == Connect2PayClient::PAYMENT_MODE_INSTALMENTS);
  }
1368390
public function resetPaymentMethodFilter(){
        foreach($this->options as $op=>$junk){
            if(preg_match("#PaymentMethod#",$op)){
                unset($this->options[$op]);
            }
        }
    }
1334934
public function getPaymentMethods()
    {
        $obj = new stdClass();

        // Must be in specific order for checksum --
        $obj->Timestamp = $this->getTimeStamp();
        $obj->SessionID = $this->getSessionID();
        $obj->PinCode = $this->getPinCode();
        $obj->UserAgent = $this->getUserAgent();
        // -----------------------------------------
        // Generate Checksum
        $obj->Checksum = $this->generateChecksum($obj);

        // Ask for GetPaymentMethods and get response
        $result = $this->client->GetPaymentMethods($obj);
        $result = $result->GetPaymentMethodsResult;
        $methods = isset($result->PaymentMethods->PaymentMethod) ? $result->PaymentMethods->PaymentMethod : null;

        $obj->Timestamp = $result->Timestamp;

        if (!is_null($methods)) {
            // Assign all properties of the PaymentMethods object as property of mainObject
            $obj = $this->parseForChecksum($obj, $methods);
        }

        // Unset properties for new Checksum
        unset($obj->Checksum);

        // Verify response data by making a new Checksum
        $CheckSum = $this->generateChecksum($obj);

        // Compare Checksums
        if ($result->Checksum != $CheckSum)
            throw new Exception('Data could not be verified');

        return (array) $methods;
    }
994639
protected function createPaymentMethodContainerFromPayment(SpyPaymentPayone $paymentEntity): CashOnDeliveryContainer
    {
        $shippingProviderName = $paymentEntity->getSpyPaymentPayoneDetail()->getShippingProvider();

        $translatedShippingProviderName = $shippingProviderName ? $this->translate($shippingProviderName) : $shippingProviderName;

        $paymentMethodContainer = new CashOnDeliveryContainer();
        $paymentMethodContainer->setShippingProvider($translatedShippingProviderName);

        return $paymentMethodContainer;
    }
84528
public function filterByCurrency($currency)
    {
        $filteredArr = array();
        foreach ($this->_paymentMethodsArrayFiltered as $paymentMethod) {
            $continue = true;
            foreach ($paymentMethod["Issuers"] as $issuer) {
                foreach ($issuer["Countries"] as $country) {
                    if (in_array(strtoupper($currency), $country["Currencies"])) {
                        array_push($filteredArr, $paymentMethod); //return//return
                        $continue = false;
                    }
                    if (!$continue)
                        break;
                }
                if (!$continue)
                    break;
            }
        }
        $this->_paymentMethodsArrayFiltered = $filteredArr;
        return $this;
    }
199312
private function prepareData(StripeMethod $paymentMethod, $amount)
    {
        /// first check that amounts are the same
        $cartAmount = intval($this->paymentBridge->getAmount());

        /**
         * If both amounts are different, execute Exception.
         */
        if (abs($amount - $cartAmount) > 0.00001) {
            throw new PaymentAmountsNotMatchException();
        }

        /**
         * At this point, order must be created given a cart, and placed in PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $paymentMethod
            );

        /**
         * Order Not found Exception must be thrown just here.
         */
        if (!$this->paymentBridge->getOrder()) {
            throw new PaymentOrderNotFoundException();
        }

        /**
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $paymentMethod
            );

        return new StripeTransaction(
            $paymentMethod->getApiToken(),
            $cartAmount,
            $this->paymentBridge->getCurrency()
        );
    }
748553
private function _setPayments($paymentEntries)
    {
        $payments = Array();
        foreach ($paymentEntries as $paymentEntry) {
            switch ($paymentEntry['paymentType']) {
                case self::$PAYMENTTYPE_PAYPAL:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Paypal($paymentEntry);
                    break;
                case self::$PAYMENTTYPE_SOFORTUEBERWEISUNG:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Sofortueberweisung($paymentEntry);
                    break;
                case self::$PAYMENTTYPE_IDEAL:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Ideal($paymentEntry);
                    break;
                default:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment($paymentEntry);
                    break;
            }
        }
        $this->_payments = new WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator($payments);
    }
352915
private static function methodIsAllowed($httpMethod)
    {
        $allowedMethods = [
            self::METHOD_GET,
            self::METHOD_POST,
            self::METHOD_PUT,
            self::METHOD_PATCH,
            self::METHOD_DELETE,
        ];

        return in_array($httpMethod, $allowedMethods, true);
    }
788388
public FunctionList webMethodsLegacy() {
        return filter(new Filter() {
            public boolean keep(Function m) {
                return m.getName().startsWith("do") || m.getAnnotation(WebMethod.class)!=null;
            }
        });
    }