예제 #1
0
        }
        require_once $otTotalDir . '/' . $file;
    }
    closedir($handle);
}
$language = HelperFunctions::getSofortLanguage($_SESSION['language']);
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_sofortvorkasse.php';
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_sofortueberweisung.php';
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_sofortrechnung.php';
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_sofortlastschrift.php';
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_lastschrift.php';
include DIR_FS_CATALOG . 'lang/' . $language . '/modules/payment/sofort_ideal.php';
if ($_GET['action'] == 'ideal') {
    // iDeal
    list($userid, $projectid) = preg_split(':', MODULE_PAYMENT_SOFORT_IDEAL_CLASSIC_CONFIGURATION_KEY);
    $SofortLib_ClassicNotification = new SofortLib_ClassicNotification($userid, $projectid, MODULE_PAYMENT_SOFORT_IDEAL_CLASSIC_NOTIFICATION_PASSWORD);
    $SofortLib_ClassicNotification->getNotification();
    if ($SofortLib_ClassicNotification->isError()) {
        exit($SofortLib_ClassicNotification->getError());
    }
    $transactionId = $SofortLib_ClassicNotification->getTransaction();
    if (empty($transactionId)) {
        exit('TransID empty!');
    }
    $time = $SofortLib_ClassicNotification->getTime();
    $time = strftime('%Y-%m-%d %H:%M:%S', strtotime($time));
    $statusReason = $SofortLib_ClassicNotification->getStatusReason();
    $status = $SofortLib_ClassicNotification->getStatus();
    $xOrderId = $SofortLib_ClassicNotification->getUserVariable(0);
    $xCustomerId = $SofortLib_ClassicNotification->getUserVariable(1);
    $paymentMethod = 'ideal';
 /**
  * notification about status change for iDEAL
  */
 public function notificationIdealAction()
 {
     // get response
     $response = $this->getRequest()->getParams();
     $orderId = $response['orderId'];
     // get order
     $order = Mage::getModel('sales/order');
     $order->loadByIncrementId($orderId);
     $paymentObj = $order->getPayment()->getMethodInstance();
     $payment = $order->getPayment();
     // get post
     $post = $this->getRequest()->getPost();
     list($userid, $projectid) = explode(':', Mage::getStoreConfig('payment/sofort_ideal/configkey'));
     // load transaction Data
     $transData = new SofortLib_ClassicNotification($userid, $projectid, Mage::getStoreConfig('payment/sofort_ideal/notification_password'));
     $transData->getNotification($post);
     // hash not matched
     if ($transData->isError()) {
         Mage::log('Notification invalid: ' . __CLASS__ . ' ' . __LINE__);
         return;
     }
     if ($payment->getAdditionalInformation('sofort_transaction')) {
         // wrong transaction id
         if ($payment->getAdditionalInformation('sofort_transaction') != $transData->getTransaction()) {
             Mage::log('Notification invalid: ' . __CLASS__ . ' ' . __LINE__);
             return;
         }
     } else {
         // store transaction
         $payment->setAdditionalInformation('sofort_transaction', $transData->getTransaction());
         $payment->save();
     }
     // check if something change
     if ($payment->getAdditionalInformation('sofort_lastchanged') === $this->_getLastChanged($transData)) {
         return;
     }
     $payment->setAdditionalInformation('sofort_lastchanged', $this->_getLastChanged($transData))->save();
     /*
      * payment was receiced
      * - mark as pay
      * - update order status
      * - make visible frontend
      * - send customer email
      */
     if ($transData->getStatus() == 'received') {
         $payment->setStatus(Paymentnetwork_Pnsofortueberweisung_Model_Pnsofortueberweisung::STATUS_SUCCESS);
         $payment->save();
         $order->setPayment($payment);
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
         $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Payment was successful.', $transData->getTransaction()), $paymentObj->getConfigData('order_status'))->setIsVisibleOnFront(true);
         // send email to customer if not send already
         if (!$order->getEmailSent()) {
             $order->setEmailSent(true);
             $order->save();
             $order->sendNewOrderEmail();
         }
         $order->save();
     }
     /*
      * pending payment
      * - just save transaction id before
      */
     if ($transData->getStatus() == 'pending') {
         $newStatus = $paymentObj->getConfigData('order_status_waiting');
         if ($newStatus == 'unchanged') {
             $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Waiting for money'));
         } else {
             $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Waiting for money'), $newStatus);
         }
         $order->save();
     }
     /*
      * transaction is loss to various reasons
      * - cancel order 
      * - make visible frontend
      */
     if ($transData->getStatus() == 'loss') {
         // be sure that order can cancel
         $order->setState('sofort');
         $order->cancel();
         $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Customer canceled payment'))->setIsVisibleOnFront(true);
         $order->save();
     }
 }
 public function classicResponse()
 {
     extract($this->settings);
     $Sofort = new SofortLib_ClassicNotification($user, $project, $password, $hash);
     return $Sofort->getNotification();
 }