Ejemplo n.º 1
0
 private function getPaymentForm($locale)
 {
     $paymentForm = array();
     $i = 0;
     foreach (array_keys(SkrillPaymentCore::getPaymentMethods()) as $paymentType) {
         $paymentTitle = Tools::strtolower($paymentType);
         $activeTooltips = @$locale['active'][$paymentTitle]['desc'];
         $modeTooltips = @$locale['mode'][$paymentTitle]['desc'];
         $activeLabel = $locale['active']['label'];
         $getSwitchList = $this->getSwitchList('active');
         if (!$activeTooltips) {
             $activeTooltips = 'All Countries';
         }
         $paymentForm[$i] = array('form' => array('legend' => array('title' => $locale[$paymentTitle]), 'input' => array($this->getSwitchForm($paymentType . '_ACTIVE', $activeLabel, $getSwitchList, $activeTooltips), $this->getTextForm($paymentType . '_SORT', $locale['order'])), 'submit' => array('title' => $locale['save'])));
         if ($paymentType != "FLEXIBLE") {
             $addInputMode = array($this->getSwitchForm($paymentType . '_MODE', $locale['mode']['label'], $getSwitchList, $modeTooltips));
             array_splice($paymentForm[$i]['form']['input'], 1, 0, $addInputMode);
         }
         $i++;
     }
     return $paymentForm;
 }
Ejemplo n.º 2
0
 private function getPaymentName($paymentType)
 {
     $paymentMethod = SkrillPaymentCore::getPaymentMethods($paymentType);
     if ($this->module->l('SKRILL_FRONTEND_PM_' . $paymentType) == 'SKRILL_FRONTEND_PM_' . $paymentType) {
         $paymentName = $paymentMethod['name'];
     } else {
         $paymentName = $this->module->l('SKRILL_FRONTEND_PM_' . $paymentType);
     }
     $isSkrill = strpos($paymentName, 'Skrill');
     if ($isSkrill === false) {
         $paymentName = 'Skrill ' . $paymentName;
     }
     return $paymentName;
 }
 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;
 }