protected function setUp()
 {
     OpenPayU_Configuration::setEnvironment('secure');
     // production
     OpenPayU_Configuration::setMerchantPosId('145227');
     // POS ID (Checkout)
     OpenPayU_Configuration::setSignatureKey('13a980d4f851f3d9a1cfc792fb1f5e50');
     //Second MD5 key. You will find it in admin panel.
     $this->initializeOrderData();
 }
 protected function setUp()
 {
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId('145227');
     OpenPayU_Configuration::setSignatureKey('13a980d4f851f3d9a1cfc792fb1f5e50');
     $this->initializeOrderData();
 }
예제 #3
0
 public function __construct(Session $session, Router $router, $environement, $merchant_pos_id, $pos_auth_key, $client_id, $client_secret, $signature_key)
 {
     $this->session = $session;
     $this->session->start();
     $this->environment = $environement;
     $this->merchantPosId = $merchant_pos_id;
     $this->posAuthKey = $pos_auth_key;
     $this->clientId = $client_id;
     $this->clientSecret = $client_secret;
     $this->signatureKey = $signature_key;
     $this->currencyCode = 'PLN';
     // TODO: from configuration
     $this->orderType = self::ORDER_TYPE_VIRTUAL;
     \OpenPayU_Configuration::setEnvironment($this->environment);
     \OpenPayU_Configuration::setMerchantPosId($this->merchantPosId);
     \OpenPayU_Configuration::setPosAuthKey($this->posAuthKey);
     \OpenPayU_Configuration::setClientId($this->clientId);
     \OpenPayU_Configuration::setClientSecret($this->clientSecret);
     \OpenPayU_Configuration::setSignatureKey($this->signatureKey);
     $this->authUrl = \OpenPayU_Configuration::$authUrl;
     $this->summaryUrl = \OpenPayU_Configuration::$summaryUrl;
     $this->notifyUrl = $router->generate('webultdPayuPaymentBundle_status', array(), true);
     $this->cancelUrl = $router->generate('webultdPayuPaymentBundle_cancel', array(), true);
     $this->completeUrl = $router->generate('webultdPayuPaymentBundle_success', array(), true);
 }
 /**
  * @param EntityManager $em
  * @param string        $env
  * @param int           $posId
  * @param string        $signatureKey
  * @param string        $class
  */
 public function __construct(EntityManager $em, $env, $posId, $signatureKey, $class)
 {
     $this->em = $em;
     $this->class = $class;
     \OpenPayU_Configuration::setEnvironment($env);
     \OpenPayU_Configuration::setMerchantPosId($posId);
     \OpenPayU_Configuration::setSignatureKey($signatureKey);
 }
예제 #5
0
 protected function loadLibConfig()
 {
     require_once DIR_SYSTEM . 'library/sdk_v21/openpayu.php';
     OpenPayU_Configuration::setMerchantPosId($this->config->get('payu_merchantposid'));
     OpenPayU_Configuration::setSignatureKey($this->config->get('payu_signaturekey'));
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setApiVersion(2.1);
     OpenPayU_Configuration::setSender("OpenCart ver/Plugin ver 2.1.5");
     $this->logger = new Log('payu.log');
 }
예제 #6
0
 function payment_status($payment)
 {
     $this->config->load('payu', true);
     if (!$this->isLoggedIn) {
         redirect('/login', 'refresh');
     }
     if (!$this->isAdmin) {
         redirect('/', 'refresh');
     }
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId($this->config->item('PosId', 'payu'));
     OpenPayU_Configuration::setSignatureKey($this->config->item('SignatureKey', 'payu'));
     $order = OpenPayU_Order::retrieve($payment)->getResponse()->orders;
     /* $this->Debug( $order, true ); */
     $this->show('user/panels/admin/payment_status', array('order' => $order));
 }
예제 #7
0
 /**
  * @return bool
  * @throws LocalizedException
  */
 public function setConfig()
 {
     \OpenPayU_Configuration::setEnvironment('secure');
     $merchantPosId = $this->scopeConfig->getValue(Payupl::XML_PATH_POS_ID, 'store');
     if ($merchantPosId) {
         \OpenPayU_Configuration::setMerchantPosId($merchantPosId);
     } else {
         throw new LocalizedException(new Phrase('Merchant POS ID is empty.'));
     }
     $signatureKey = $this->scopeConfig->getValue(Payupl::XML_PATH_SECOND_KEY_MD5, 'store');
     if ($signatureKey) {
         \OpenPayU_Configuration::setSignatureKey($signatureKey);
     } else {
         throw new LocalizedException(new Phrase('Signature key is empty.'));
     }
     return true;
 }
예제 #8
0
 /**
  * Initialize PayU configuration
  */
 protected function initializeOpenPayUConfiguration()
 {
     $this->_config = $this->getConfig();
     $this->_myUrl = $this->_config->getBaseUrl();
     OpenPayU_Configuration::setApiVersion(2.1);
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId($this->_config->getMerchantPosId());
     OpenPayU_Configuration::setSignatureKey($this->_config->getSignatureKey());
     OpenPayU_Configuration::setSender("Magento ver " . Mage::getVersion() . "/Plugin ver " . $this->_config->getPluginVersion());
 }
예제 #9
0
<?php

//namespace OpenPayuSdk\Examples\V2;
/**
 * OpenPayU
 *
 * @copyright  Copyright (c) 2014 PayU
 * @license    http://opensource.org/licenses/LGPL-3.0  Open Software License (LGPL 3.0)
 *
 * http://www.payu.com
 * http://developers.payu.com
 * http://twitter.com/openpayu
 *
 */
OpenPayU_Configuration::setEnvironment('secure');
OpenPayU_Configuration::setMerchantPosId('145227');
// POS ID (Checkout)
OpenPayU_Configuration::setSignatureKey('13a980d4f851f3d9a1cfc792fb1f5e50');
//Second MD5 key. You will find it in admin panel.
/* path for example files*/
$dir = explode(basename(dirname(__FILE__)) . '/', $_SERVER['SCRIPT_NAME']);
$directory = $dir[0] . basename(dirname(__FILE__));
$url = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $dir[0];
define('HOME_DIR', $url);
define('EXAMPLES_DIR', HOME_DIR . 'examples/');
예제 #10
0
<?php

//namespace OpenPayuSdk\Examples\V2;
/**
 * OpenPayU
 *
 * @copyright  Copyright (c) 2014 PayU
 * @license    http://opensource.org/licenses/LGPL-3.0  Open Software License (LGPL 3.0)
 *
 * http://www.payu.com
 * http://developers.payu.com
 * http://twitter.com/openpayu
 *
 */
OpenPayU_Configuration::setEnvironment('secure');
OpenPayU_Configuration::setMerchantPosId('4966124');
// POS ID (Checkout)
OpenPayU_Configuration::setSignatureKey('b5588f9e8c0b3587bf8de820f385c76e');
//Second MD5 key. You will find it in admin panel.
/* path for example files*/
$dir = explode(basename(dirname(__FILE__)) . '/', $_SERVER['SCRIPT_NAME']);
$directory = $dir[0] . basename(dirname(__FILE__));
$url = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $dir[0];
define('HOME_DIR', $url);
define('EXAMPLES_DIR', HOME_DIR . 'examples/');
 public function testMerchantPosId()
 {
     OpenPayU_Configuration::setMerchantPosId('PosId');
     $this->assertEquals('PosId', OpenPayU_Configuration::getMerchantPosId());
 }
예제 #12
0
 /**
  * Initialize PayU configuration
  */
 protected function initializeOpenPayUConfiguration()
 {
     OpenPayU_Configuration::setApiVersion(2.1);
     OpenPayU_Configuration::setEnvironment($this->getConfig()->getEnvironment());
     OpenPayU_Configuration::setMerchantPosId($this->getConfig()->getMerchantPosId());
     OpenPayU_Configuration::setSignatureKey($this->getConfig()->getSignatureKey());
     OpenPayU_Configuration::setSender("Magento ver " . Mage::getVersion() . "/Plugin ver " . $this->getConfig()->getPluginVersion());
 }
예제 #13
0
 public function __construct($environment, $signatureKey, $posId)
 {
     \OpenPayU_Configuration::setEnvironment($environment);
     \OpenPayU_Configuration::setMerchantPosId($posId);
     \OpenPayU_Configuration::setSignatureKey($signatureKey);
 }
예제 #14
0
 /**
  *
  */
 protected function initializeOpenPayU()
 {
     OpenPayU_Configuration::setApiVersion(2);
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId(Configuration::get('PAYU_POS_ID'));
     OpenPayU_Configuration::setSignatureKey(Configuration::get('PAYU_SIGNATURE_KEY'));
     OpenPayU_Configuration::setSender('Prestashop ver ' . _PS_VERSION_ . '/Plugin ver ' . $this->version);
 }
예제 #15
0
 /**
  * Payment test - payU
  *
  */
 public function payU(Request $request)
 {
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId('145227');
     // POS ID (Checkout)
     OpenPayU_Configuration::setSignatureKey('13a980d4f851f3d9a1cfc792fb1f5e50');
     //Second MD5 key. You will find it in admin panel.
     return view('pages.testPayU', []);
 }
예제 #16
0
 function process($order_id)
 {
     if (!$this->isLoggedIn) {
         redirect('/login', 'refresh');
     }
     $this->load->model('Ordermodel');
     $_order = $this->Ordermodel->get_order($this->session->userdata['user']->id, $order_id, 'W');
     if ($_order == null) {
         $this->http404();
     }
     $_order = $_order[0];
     $this->config->load('payu', true);
     OpenPayU_Configuration::setEnvironment('secure');
     OpenPayU_Configuration::setMerchantPosId($this->config->item('PosId', 'payu'));
     OpenPayU_Configuration::setSignatureKey($this->config->item('SignatureKey', 'payu'));
     $order = array();
     $order['notifyUrl'] = base_url() . 'index.php/order/notify';
     //$order['notifyUrl'] = "http://t01.pl/payu/index.php";
     $order['continueUrl'] = base_url() . 'index.php/user_panel/history';
     $order['customerIp'] = $this->input->ip_address();
     $order['merchantPosId'] = OpenPayU_Configuration::getMerchantPosId();
     $order['description'] = $this->config->item('title', 'payu');
     $order['currencyCode'] = 'PLN';
     //$order['extOrderId'] = "think01-".time().'-'.$order_id;
     $order['products'] = array();
     $cost = 0;
     if (count($_order->cart) == 0) {
         return false;
     }
     foreach ($_order->cart as $v) {
         array_push($order['products'], array('name' => $v->diet, 'unitPrice' => $v->price, 'quantity' => $v->quantity));
         $cost += $v->price * $v->quantity;
     }
     $order['totalAmount'] = $cost;
     $order['buyer']['email'] = $v->email;
     $order['buyer']['phone'] = preg_replace('/[^0-9\\+]/', '', $v->phone);
     $order['buyer']['firstName'] = $v->name;
     $order['buyer']['lastName'] = $v->surname;
     try {
         //echo '<pre>'; print_r($order); die('');
         $response = OpenPayU_Order::create($order);
         $status_desc = OpenPayU_Util::statusDesc($response->getStatus());
         if ($response->getStatus() == 'SUCCESS') {
             $this->Ordermodel->set_payment_id($order_id, $response->getResponse()->orderId);
             redirect($response->getResponse()->redirectUri, 'refresh');
         } else {
             $this->show("alert", array('msg' => '<pre>' . print_r($order, true) . '</pre><br>' . $response->getStatus() . ': ' . $status_desc));
         }
         return;
     } catch (OpenPayU_Exception $e) {
         $this->show("alert", array('msg' => '<pre>' . print_r($order, true) . '</pre><br>' . (string) $e));
     }
 }