private function getEnabledPayment($countryCode) { $countryCode3Digit = SkrillPaymentCore::getCountryIso3($countryCode); $notSupportCountries = SkrillPaymentCore::isCountryNotSupport($countryCode3Digit); $supportedPayments = SkrillPaymentCore::getSupportedPayments($countryCode3Digit); $paymentsConfig = array(); if (Configuration::get('SKRILL_FLEXIBLE_ACTIVE')) { $paymentsConfig[0] = array('name' => 'flexible', 'enabled' => '1'); } $defaultPaymentSort = 1000; foreach (array_keys(SkrillPaymentCore::getPaymentMethods()) as $paymentType) { if ($paymentType == 'FLEXIBLE') { continue; } $paymentActive = Configuration::get('SKRILL_' . $paymentType . '_ACTIVE'); $paymentShowSeparatly = Configuration::get('SKRILL_' . $paymentType . '_MODE'); $supportedPayment = in_array($paymentType, $supportedPayments); $paymentSort = (int) Configuration::get('SKRILL_' . $paymentType . '_SORT'); if (!$paymentSort || $paymentSort == 0 || array_key_exists($paymentSort, $paymentsConfig)) { $paymentSort = $defaultPaymentSort; } if ($paymentActive && $paymentShowSeparatly && $notSupportCountries == false && $supportedPayment) { $paymentsConfig[$paymentSort] = array('name' => Tools::strtolower($paymentType), 'enabled' => $paymentActive); } $defaultPaymentSort++; } ksort($paymentsConfig); return $paymentsConfig; }
private function getPostParameters() { $paymentMethod = $this->getPaymentMethod(); $address = new Address((int) $this->context->cart->id_address_delivery); $country = new Country($address->id_country); $currencyobj = new Currency((int) $this->context->cart->id_currency); $getDateTime = SkrillPaymentCore::getDateTime(); $randomNumber = SkrillPaymentCore::randomNumber(4); $contextLink = $this->context->link; $skrillSettings = $this->getSkrillSettings(); if (empty($skrillSettings['merchant_id']) || empty($skrillSettings['merchant_account']) || empty($skrillSettings['recipient_desc']) || empty($skrillSettings['logo_url']) || empty($skrillSettings['api_passwd']) || empty($skrillSettings['secret_word'])) { Tools::redirect($contextLink->getPageLink('order', true, null, array('step' => '3', 'skrillerror' => 'ERROR_GENERAL_REDIRECT'))); } $postParameters = array(); $postParameters['pay_to_email'] = $skrillSettings['merchant_account']; $postParameters['recipient_description'] = $skrillSettings['recipient_desc']; $postParameters['transaction_id'] = date('ymd') . $this->context->cart->id . $getDateTime . $randomNumber; $postParameters['return_url'] = $contextLink->getModuleLink('skrill', 'validation', ['payment_method' => $paymentMethod], true); $postParameters['cancel_url'] = $contextLink->getPageLink('order', true, null, array('step' => '3')); $postParameters['language'] = $this->getLang(); $postParameters['logo_url'] = $skrillSettings['logo_url']; $postParameters['prepare_only'] = 1; $postParameters['pay_from_email'] = $this->context->customer->email; $postParameters['firstname'] = $this->context->customer->firstname; $postParameters['lastname'] = $this->context->customer->lastname; $postParameters['address'] = $address->address1; $postParameters['postal_code'] = $address->postcode; $postParameters['city'] = $address->city; $postParameters['country'] = SkrillPaymentCore::getCountryIso3($country->iso_code); $postParameters['amount'] = $this->context->cart->getOrderTotal(true, Cart::BOTH); $postParameters['currency'] = $currencyobj->iso_code; $postParameters['detail1_description'] = "Order pay from " . $this->context->customer->email; if ($paymentMethod != 'FLEXIBLE') { $postParameters['payment_methods'] = $paymentMethod; } return $postParameters; }