/**
  *
  * Enter description here ...
  * @param int $userid
  * @param int $projectid
  * @param string $apiKey
  * @param string $password
  * @param string $hashfunction (sha1, sha256, sha512) depending on PHP and OS and adjustment in project on pnag-server
  */
 function SofortLib_iDealClassic($configurationKey, $password, $hashfunction = 'sha1')
 {
     $apiUrl = getenv('idealApiUrl') != '' ? getenv('idealApiUrl') : 'https://www.sofort.com/payment/ideal';
     $this->apiUrl = $apiUrl;
     list($userid, $projectid, $apiKey) = explode(':', $configurationKey);
     $this->sofortLib = new SofortLib_iDeal_Banks($configurationKey, $this->apiUrl);
     parent::SofortLib_SofortueberweisungClassic($userid, $projectid, $password, $hashfunction);
     $this->apiKey = $apiKey;
 }
Exemplo n.º 2
0
 /**
  * Executes the pay request to sofort
  */
 public function paymentRequest()
 {
     $orderId = $this->_getQuote()->getReservedOrderId();
     $this->_sofortSdk->setVersion('magento_3.0');
     $this->_sofortSdk->setAmount(Mage::app()->getStore()->roundPrice($this->_getQuote()->getGrandTotal()));
     $this->_sofortSdk->setCurrencyCode($this->_getQuote()->getBaseCurrencyCode());
     $this->_sofortSdk->setReason($this->_getReasonOne(), $this->_getReasonTwo());
     $this->_sofortSdk->setSuccessUrl(Mage::getUrl('pisofort/payment/success', array('orderId' => $orderId)), true);
     $this->_sofortSdk->setAbortUrl(Mage::getUrl('pisofort/payment/abort', array('orderId' => $orderId)));
     $this->_sofortSdk->setNotificationUrl(Mage::getUrl('pisofort/payment/notification', array('orderId' => $orderId)));
     $this->_sofortSdk->setCustomerprotection((bool) Mage::getStoreConfig('payment/paymentnetwork_pnsofortueberweisung/customer_protection', Mage::app()->getStore()->getStoreId()));
     $this->_sofortSdk->sendRequest();
 }
 public function getUrl()
 {
     $order = $this->getOrder();
     $amount = number_format($order->getGrandTotal(), 2, '.', '');
     $billing = $order->getBillingAddress();
     $security = $this->getSecurityKey();
     $reason1_template = Mage::getStoreConfig('payment/pnsofortueberweisung/reason_1', $order->getStore());
     $reason2_template = Mage::getStoreConfig('payment/pnsofortueberweisung/reason_2', $order->getStore());
     $tmp_orderid = $order->getRealOrderId();
     $address = $order->getBillingAddress();
     $tmp_name = $this->_getFirstname($address) . " " . $this->_getLastname($address);
     $tmp_date = Mage::getModel('core/date')->date('d.m.Y');
     $tmp_storename = Mage::getStoreConfig('general/store_information/name', $order->getStore());
     $reason1 = preg_replace('#\\{\\{ordernr\\}\\}#', $tmp_orderid, $reason1_template);
     $reason2 = preg_replace('#\\{\\{ordernr\\}\\}#', $tmp_orderid, $reason2_template);
     $reason1 = preg_replace('#Order No.:#', Mage::helper('pnsofortueberweisung')->__('Order No.: '), $reason1);
     $reason2 = preg_replace('#Order No.:#', Mage::helper('pnsofortueberweisung')->__('Order No.: '), $reason2);
     $reason1 = preg_replace('#\\{\\{name\\}\\}#', $tmp_name, $reason1);
     $reason2 = preg_replace('#\\{\\{name\\}\\}#', $tmp_name, $reason2);
     $reason1 = preg_replace('#\\{\\{date\\}\\}#', $tmp_date, $reason1);
     $reason2 = preg_replace('#\\{\\{date\\}\\}#', $tmp_date, $reason2);
     $reason1 = preg_replace('#\\{\\{shopname\\}\\}#', $tmp_storename, $reason1);
     $reason2 = preg_replace('#\\{\\{shopname\\}\\}#', $tmp_storename, $reason2);
     $reason1 = preg_replace('#\\{\\{transaction\\}\\}#', '-TRANSACTION-', $reason1);
     $reason2 = preg_replace('#\\{\\{transaction\\}\\}#', '-TRANSACTION-', $reason2);
     $reason1 = preg_replace('#[^a-zA-Z0-9+-\\.,\\s+]#', '', $reason1);
     $reason2 = preg_replace('#[^a-zA-Z0-9+-\\.,\\s+]#', '', $reason2);
     $success_url = Mage::getUrl('pnsofortueberweisung/pnsofortueberweisung/return', array('orderId' => $order->getRealOrderId(), '_store' => $order->getStore()->getId()));
     $cancel_url = Mage::getUrl('pnsofortueberweisung/pnsofortueberweisung/error', array('orderId' => $order->getRealOrderId(), '_store' => $order->getStore()->getId()));
     $notification_url = Mage::getUrl('pnsofortueberweisung/pnsofortueberweisung/returnhttp', array('orderId' => $order->getRealOrderId(), 'transId' => '-TRANSACTION-', 'var1' => '-USER_VARIABLE_1_MD5_PASS-', 'secret' => $security, '_store' => $order->getStore()->getId()));
     $sObj = new SofortLib_SofortueberweisungClassic(Mage::getStoreConfig('payment/pnsofortueberweisung/customer', $order->getStore()), Mage::getStoreConfig('payment/pnsofortueberweisung/project', $order->getStore()), Mage::getStoreConfig('payment/pnsofortueberweisung/project_pswd', $order->getStore()));
     $sObj->setVersion(self::MODULE_VERSION);
     $sObj->setAmount($amount, $this->getOrder()->getOrderCurrencyCode());
     $sObj->setReason($reason1, $reason2);
     $sObj->setSuccessUrl($success_url);
     $sObj->setAbortUrl($cancel_url);
     $sObj->setNotificationUrl($notification_url);
     $sObj->addUserVariable($this->getOrder()->getRealOrderId());
     $sObj->addUserVariable($security);
     $order->getPayment()->setAdditionalInformation('sofort_lastchanged', 0);
     $order->getPayment()->setAdditionalInformation('sofort_secret', $security)->save();
     // all information where decoded in url secured by hash key
     return $sObj->getPaymentUrl();
 }
Exemplo n.º 4
0
 static function getSecurityKey()
 {
     if (!class_exists('SofortLib_SofortueberweisungClassic')) {
         require VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'sofort' . DS . 'sofort' . DS . 'library' . DS . 'sofortLib_sofortueberweisung_classic.php';
     }
     return SofortLib_SofortueberweisungClassic::generatePassword();
 }
 /**
  * Using the classic way (without gateway)
  * - identification via foreign_id + model (transaction id yet unknown)
  */
 public function setClassicExpressCheckout($data)
 {
     extract($this->settings);
     $Sofort = new SofortLib_SofortueberweisungClassic($user, $project, $password, $hash);
     $Sofort->setAmount($data['amount'], $currencyCode);
     $Sofort->setReason(Inflector::slug($data['reason']), Inflector::slug($data['description']));
     $url = array('plugin' => 'payment', 'admin' => false, 'controller' => 'payment_network');
     $abortUrl = array_merge($url, array('action' => 'abort'));
     $Sofort->setAbortUrl(Router::url($abortUrl, true));
     $successUrl = array_merge($url, array('action' => 'success'));
     $Sofort->setSuccessUrl(Router::url($successUrl, true));
     $nUrl = array_merge($url, array('action' => 'notification'));
     $Sofort->setNotificationUrl(Router::url($nUrl, true));
     if (!empty($data['token'])) {
         $Sofort->addUserVariable($data['token']);
     } else {
         $Sofort->addUserVariable($data['foreign_id']);
         $Sofort->addUserVariable($data['model']);
     }
     //die(returns($Sofort->params));
     $url = $Sofort->getPaymentUrl();
     $token = $Sofort->params['hash'];
     return compact('url', 'token');
 }
Exemplo n.º 6
0
 public function getSecurityKey()
 {
     return SofortLib_SofortueberweisungClassic::generatePassword();
 }