예제 #1
0
 /**
  * Display the success page
  * 
  * @return null
  */
 function showSuccessPage()
 {
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     if ($_REQUEST["handler"] == "yellowpay") {
         $orderId = \Yellowpay::getOrderId();
         $this->getSettings();
         if (\Yellowpay::checkin($this->arrSettings["paymentYellowpayShaOut"])) {
             switch (abs($_REQUEST["result"])) {
                 case 2:
                     // fehler aufgetreten
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->delete($orderId);
                     $this->_objTpl->touchBlock("cancelMessage");
                     break;
                 case 1:
                     // erfolgreich
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->get($orderId);
                     $objRegistration->setPaid(1);
                     $this->_objTpl->touchBlock("successMessage");
                     break;
                 case 0:
                     // abgebrochen
                     $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(null);
                     $objRegistration->delete($orderId);
                     $this->_objTpl->touchBlock("cancelMessage");
                     break;
                 default:
                     \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
                     break;
             }
         } else {
             \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
             return;
         }
     } else {
         \Cx\Core\Csrf\Controller\Csrf::redirect("index.php?section=" . $this->moduleName);
         return;
     }
 }
 static function getOrderId()
 {
     if (empty($_REQUEST['handler'])) {
         //DBG::log("PaymentProcessing::getOrderId(): No handler, fail");
         return false;
     }
     switch ($_REQUEST['handler']) {
         case 'saferpay':
             return \Saferpay::getOrderId();
         case 'paypal':
             return \PayPal::getOrderId();
         case 'yellowpay':
             return \Yellowpay::getOrderId();
         case 'payrexx':
             return \PayrexxProcessor::getOrderId();
             // Added 20100222 -- Reto Kohli
         // Added 20100222 -- Reto Kohli
         case 'mobilesolutions':
             //DBG::log("getOrderId(): mobilesolutions");
             $order_id = \PostfinanceMobile::getOrderId();
             //DBG::log("getOrderId(): mobilesolutions, Order ID $order_id");
             return $order_id;
             // Added 20081117 -- Reto Kohli
         // Added 20081117 -- Reto Kohli
         case 'datatrans':
             return \Datatrans::getOrderId();
             // For the remaining types, there's no need to check in, so we
             // return true and jump over the validation of the order ID
             // directly to success!
             // Note: A backup of the order ID is kept in the session
             // for payment methods that do not return it. This is used
             // to cancel orders in all cases where false is returned.
         // For the remaining types, there's no need to check in, so we
         // return true and jump over the validation of the order ID
         // directly to success!
         // Note: A backup of the order ID is kept in the session
         // for payment methods that do not return it. This is used
         // to cancel orders in all cases where false is returned.
         case 'Internal':
         case 'Internal_CreditCard':
         case 'Internal_Debit':
         case 'Internal_LSV':
         case 'dummy':
             return isset($_SESSION['shop']['order_id_checkin']) ? $_SESSION['shop']['order_id_checkin'] : false;
     }
     // Anything else is wrong.
     return false;
 }
예제 #3
0
 /**
  * Evaluate and register the payment result.
  * If the transaction was successful an email will be sent to the customer and administrator.
  *
  * @access      private
  */
 private function registerPaymentResult()
 {
     global $_ARRAYLANG, $_CONFIG, $objDatabase;
     $objSettingsYellowpay = new SettingsYellowpay($objDatabase);
     $arrYellowpay = $objSettingsYellowpay->get();
     //evaluate payment result
     $status = '';
     $orderId = \Yellowpay::getOrderId();
     $arrTransaction = $this->objTransaction->get(array($orderId));
     if (\Yellowpay::checkin($arrYellowpay['sha_out'])) {
         if (abs($_REQUEST['result']) == 1) {
             $status = self::CONFIRMED;
             if ($arrTransaction[0]['status'] == self::WAITING || $arrTransaction[0]['status'] == $status) {
                 $this->arrStatusMessages['ok'][] = $_ARRAYLANG['TXT_CHECKOUT_TRANSACTION_WAS_SUCCESSFUL'];
             }
             if ($arrTransaction[0]['status'] == $status) {
                 return;
             }
         } else {
             if ($_REQUEST['result'] == 0 || abs($_REQUEST['result']) == 2) {
                 $status = self::CANCELLED;
                 if ($arrTransaction[0]['status'] == self::WAITING || $arrTransaction[0]['status'] == $status) {
                     $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_TRANSACTION_WAS_CANCELLED'];
                 }
                 if ($arrTransaction[0]['status'] == $status) {
                     return;
                 }
             } else {
                 $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_INVALID_TRANSACTION_STATUS'];
                 return;
             }
         }
     } else {
         $this->arrStatusMessages['error'][] = $_ARRAYLANG['TXT_CHECKOUT_SECURITY_CHECK_ERROR'];
         return;
     }
     if ($arrTransaction[0]['status'] == self::WAITING) {
         //update transaction status
         $this->objTransaction->updateStatus($orderId, $status);
         //send confirmation email (if the payment was successful)
         if ($status == self::CONFIRMED) {
             $arrTransaction = $this->objTransaction->get(array($orderId));
             if (!empty($arrTransaction[0])) {
                 //prepare transaction data for output
                 $arrTransaction[0]['time'] = date('j.n.Y G:i:s', $arrTransaction[0]['time']);
                 switch ($arrTransaction[0]['status']) {
                     case self::WAITING:
                         $arrTransaction[0]['status'] = $_ARRAYLANG['TXT_CHECKOUT_STATUS_WAITING'];
                         break;
                     case self::CONFIRMED:
                         $arrTransaction[0]['status'] = $_ARRAYLANG['TXT_CHECKOUT_STATUS_CONFIRMED'];
                         break;
                     case self::CANCELLED:
                         $arrTransaction[0]['status'] = $_ARRAYLANG['TXT_CHECKOUT_STATUS_CANCELLED'];
                         break;
                 }
                 $arrTransaction[0]['invoice_currency'] = $this->arrCurrencies[$arrTransaction[0]['invoice_currency']];
                 $arrTransaction[0]['invoice_amount'] = number_format($arrTransaction[0]['invoice_amount'], 2, '.', '\'');
                 switch ($arrTransaction[0]['contact_title']) {
                     case self::MISTER:
                         $arrTransaction[0]['contact_title'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISTER'];
                         break;
                     case self::MISS:
                         $arrTransaction[0]['contact_title'] = $_ARRAYLANG['TXT_CHECKOUT_CONTACT_TITLE_MISS'];
                         break;
                 }
                 //get mail templates
                 $objSettingsMail = new SettingsMails($objDatabase);
                 $arrAdminMail = $objSettingsMail->getAdminMail();
                 $arrCustomerMail = $objSettingsMail->getCustomerMail();
                 //fill up placeholders in mail templates
                 $arrPlaceholders = array('DOMAIN_URL' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET, 'TRANSACTION_ID' => $arrTransaction[0]['id'], 'TRANSACTION_TIME' => $arrTransaction[0]['time'], 'TRANSACTION_STATUS' => $arrTransaction[0]['status'], 'INVOICE_NUMBER' => $arrTransaction[0]['invoice_number'], 'INVOICE_CURRENCY' => $arrTransaction[0]['invoice_currency'], 'INVOICE_AMOUNT' => $arrTransaction[0]['invoice_amount'], 'CONTACT_TITLE' => $arrTransaction[0]['contact_title'], 'CONTACT_FORENAME' => $arrTransaction[0]['contact_forename'], 'CONTACT_SURNAME' => $arrTransaction[0]['contact_surname'], 'CONTACT_COMPANY' => $arrTransaction[0]['contact_company'], 'CONTACT_STREET' => $arrTransaction[0]['contact_street'], 'CONTACT_POSTCODE' => $arrTransaction[0]['contact_postcode'], 'CONTACT_PLACE' => $arrTransaction[0]['contact_place'], 'CONTACT_COUNTRY' => $arrTransaction[0]['contact_country'], 'CONTACT_PHONE' => $arrTransaction[0]['contact_phone'], 'CONTACT_EMAIL' => $arrTransaction[0]['contact_email']);
                 foreach ($arrPlaceholders as $placeholder => $value) {
                     $arrAdminMail['title'] = str_replace('[[' . $placeholder . ']]', contrexx_raw2xhtml($value), $arrAdminMail['title']);
                     $arrAdminMail['content'] = str_replace('[[' . $placeholder . ']]', contrexx_raw2xhtml($value), $arrAdminMail['content']);
                     $arrCustomerMail['title'] = str_replace('[[' . $placeholder . ']]', contrexx_raw2xhtml($value), $arrCustomerMail['title']);
                     $arrCustomerMail['content'] = str_replace('[[' . $placeholder . ']]', contrexx_raw2xhtml($value), $arrCustomerMail['content']);
                 }
                 //send mail to administrator and customer
                 $this->sendConfirmationMail($_CONFIG['contactFormEmail'], $arrAdminMail);
                 $this->sendConfirmationMail($arrTransaction[0]['contact_email'], $arrCustomerMail);
             }
         }
         exit;
     }
 }
예제 #4
0
 function paymentYellowpayVerify()
 {
     global $_ARRAYLANG;
     $result = isset($_REQUEST['result']) ? $_REQUEST['result'] : 0;
     $order_id = \Yellowpay::getOrderId();
     if ($result < 0) {
         \Cx\Core\Setting\Controller\Setting::init('Egov', 'config');
         if (\Yellowpay::checkIn(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Egov'))) {
             // Silently process yellowpay notifications and die().
             if (abs($_REQUEST['result']) == 1) {
                 $this->updateOrder($order_id);
             }
         }
         die;
     }
     $strReturn = '';
     if ($order_id) {
         $order_id = intval($_REQUEST['order_id']);
         $product_id = self::GetOrderValue('order_product', $order_id);
         if (empty($product_id)) {
             $strReturn = 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_PROCESSING_ORDER'] . "\");\n";
         }
         $status = self::GetOrderValue('order_state', $order_id);
         switch ($status) {
             case 1:
                 // The payment has been completed.
                 // The direct payment notification (with result == -1) has
                 // successfully caused the order to be updated.
                 // Show an appropriate message, and optionally redirect
                 // the customer.
                 $product_id = self::GetOrderValue('order_product', $order_id);
                 return self::getSuccessMessage($product_id);
                 break;
                 // Not applicable:
                 // Mind that the payment result (cancelled or failed) is not
                 // available outside of the direct payment request from
                 // PostFinance!  Thus, this outcome is never encountered.
             // Not applicable:
             // Mind that the payment result (cancelled or failed) is not
             // available outside of the direct payment request from
             // PostFinance!  Thus, this outcome is never encountered.
             case 0:
             case 2:
             default:
                 // Payment failed, or has been cancelled
                 $strReturn = 'alert("' . $_ARRAYLANG['TXT_EGOV_YELLOWPAY_CANCEL'] . "\");\n";
         }
     }
     return $strReturn . 'document.location.href="' . $_SERVER['PHP_SELF'] . "?section=Egov\";\n";
 }