/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders '; $sql .= "WHERE o_id = :id AND o_paymentmethod = 'paypal' AND o_paymentcompleted = 'n'"; /** @var \PDOStatement $hResult */ $hResult = $this->serviceManager->get('db')->prepare($sql); $hResult->bindValue(':id', $iId, \PDO::PARAM_INT); $hResult->execute(); if ($hResult->rowCount() == 1) { $aOrder = $hResult->fetch(); $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder); $sPaypalURL = HelperConfig::$shop["paypal"]["url"] . '?cmd=_xclick&rm=2&custom=' . $iId . '&business=' . HelperConfig::$shop["paypal"]["business"]; $sPaypalURL .= '¬ify_url=http://' . $_SERVER["SERVER_NAME"] . '/_misc/paypal_notify.html&item_name=' . $this->textcats->T("misc_paypaypal_paypaltitle") . ' ' . $iId; $sPaypalURL .= '¤cy_code=' . HelperConfig::$shop["paypal"]["currency_id"] . '&amount=' . str_replace(',', '.', number_format($fGesamtbrutto, 2, '.', '')); if (HelperConfig::$shop["interactive_paymentmethods_redirect_immediately"]) { header('Location: ' . $sPaypalURL); die; } $this->P->oPayload->cl_html = $this->textcats->T("misc_paypaypal_greeting") . '<br><br>'; $this->P->oPayload->cl_html .= '<a href="' . $sPaypalURL . '">' . $this->textcats->T("misc_paypaypal") . '</a>'; } else { $this->P->oPayload->cl_html = $this->textcats->T("misc_paypaypal_paymentnotavailable"); } }
/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; if (HelperConfig::$shop["show_pricesonlytologgedin"] && !\HaaseIT\HCSF\Customer\Helper::getUserData()) { $this->P->oPayload->cl_html = $this->serviceManager->get('textcats')->T("denied_notloggedin"); } else { $this->P->cb_customcontenttemplate = 'shop/checkedout'; $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders WHERE o_id = :id AND o_paymentcompleted = \'n\''; /** @var \PDOStatement $hResult */ $hResult = $this->serviceManager->get('db')->prepare($sql); $hResult->bindValue(':id', $iId, \PDO::PARAM_INT); $hResult->execute(); if ($hResult->rowCount() == 1) { $this->P->cb_customdata["order"] = $hResult->fetch(); $this->P->cb_customdata["gesamtbrutto"] = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($this->P->cb_customdata["order"]); } } }
/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders ' . "WHERE o_id = :id AND o_paymentmethod = 'sofortueberweisung' AND o_paymentcompleted = 'n'"; /** @var \PDOStatement $hResult */ $hResult = $this->serviceManager->get('db')->prepare($sql); $hResult->bindValue(':id', $iId, \PDO::PARAM_INT); $hResult->execute(); if ($hResult->rowCount() == 1) { $aOrder = $hResult->fetch(); $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder); $sPURL = 'https://www.sofortueberweisung.de/payment/start?user_id=' . HelperConfig::$shop["sofortueberweisung"]["user_id"] . '&project_id=' . HelperConfig::$shop["sofortueberweisung"]["project_id"] . '&amount=' . number_format($fGesamtbrutto, 2, '.', '') . '&currency_id=' . HelperConfig::$shop["sofortueberweisung"]["currency_id"] . '&reason_1=' . urlencode($this->textcats->T("misc_paysofortueberweisung_ueberweisungsbetreff") . ' ') . $iId; if (HelperConfig::$shop["interactive_paymentmethods_redirect_immediately"]) { header('Location: ' . $sPURL); die; } $this->P->oPayload->cl_html = $this->textcats->T("misc_paysofortueberweisung_greeting") . '<br><br>'; $this->P->oPayload->cl_html .= '<a href="' . $sPURL . '">' . $this->textcats->T("misc_paysofortueberweisung") . '</a>'; } else { $this->P->oPayload->cl_html = $this->textcats->T("misc_paysofortueberweisung_paymentnotavailable"); } }
/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $sLogData = ''; $iId = \filter_input(INPUT_POST, 'custom', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders WHERE o_id = ' . $iId . ' AND o_paymentmethod' . " = 'paypal' AND o_paymentcompleted = 'n'"; $hResult = $this->db->query($sql); if ($hResult->rowCount() == 1) { $aOrder = $hResult->fetch(); $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder); $postdata = ''; foreach ($_POST as $i => $v) { $postdata .= $i . '=' . urlencode($v) . '&'; } $postdata .= 'cmd=_notify-validate'; $web = parse_url(HelperConfig::$shop["paypal"]["url"]); if ($web['scheme'] == 'https') { $web['port'] = 443; $ssl = 'ssl://'; } else { $web['port'] = 80; $ssl = ''; } $fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30); if ($fp) { fputs($fp, "POST " . $web['path'] . " HTTP/1.1\r\n"); fputs($fp, "Host: " . $web['host'] . "\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($postdata) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $postdata . "\r\n\r\n"); $info = []; while (!feof($fp)) { $info[] = @fgets($fp, 1024); } fclose($fp); $info = implode(',', $info); if (!(strpos($info, 'VERIFIED') === false)) { $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\n"; $sLogData .= "W00T!\n\n"; $sLogData .= \HaaseIT\Tools::debug($_REQUEST, '', true, true) . "\n\n"; // Check if the transaction id has been used before $sTxn_idQ = 'SELECT o_paypal_tx FROM orders WHERE o_paypal_tx = :txn_id'; $hTxn_idResult = $this->db->prepare($sTxn_idQ); $hTxn_idResult->bindValue(':txn_id', $_REQUEST["txn_id"]); $hTxn_idResult->execute(); if ($hTxn_idResult->rowCount() == 0) { if ($_REQUEST["mc_gross"] == number_format($fGesamtbrutto, 2, '.', '') && $_REQUEST["custom"] == $aOrder['o_id'] && $_REQUEST["payment_status"] == "Completed" && $_REQUEST["mc_currency"] == HelperConfig::$shop["paypal"]["currency_id"] && $_REQUEST["business"] == HelperConfig::$shop["paypal"]["business"]) { $aTxnUpdateData = ['o_paypal_tx' => $_REQUEST["txn_id"], 'o_paymentcompleted' => 'y', 'o_id' => $iId]; $sql = \HaaseIT\DBTools::buildPSUpdateQuery($aTxnUpdateData, 'orders', 'o_id'); $hResult = $this->db->prepare($sql); foreach ($aTxnUpdateData as $sKey => $sValue) { $hResult->bindValue(':' . $sKey, $sValue); } $hResult->execute(); $sLogData .= "-- Alles ok. Zahlung erfolgreich. TXNID: " . $_REQUEST["txn_id"] . " --\n\n"; } else { $sLogData .= "-- In my country we have problem; Problem is evaluation. Throw the data down the log!\n"; $sLogData .= "mc_gross: " . $_REQUEST["mc_gross"] . ' - number_format($fGesamtbrutto, 2, \'.\', \'\'): ' . number_format($fGesamtbrutto, 2, '.', '') . "\n"; $sLogData .= "custom: " . $_REQUEST["custom"] . ' - $aOrder[\'o_id\']: ' . $aOrder['o_id'] . "\n"; $sLogData .= "payment_status: " . $_REQUEST["payment_status"] . "\n"; $sLogData .= "mc_currency: " . $_REQUEST["mc_currency"] . ' - HelperConfig::$shop["paypal"]["currency_id"]: ' . HelperConfig::$shop["paypal"]["currency_id"] . "\n"; $sLogData .= "business: " . $_REQUEST["receiver_email"] . ' - HelperConfig::$shop["paypal"]["business"]: ' . HelperConfig::$shop["paypal"]["business"] . "\n\n"; } } else { // INVALID LOGGING ERROR $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\nPHAIL\n\n"; $sLogData .= "!!! JEMAND HAT EINE ALTE TXN_ID BENUTZT: " . $_REQUEST["txn_id"] . " !!!\n\n"; $sLogData .= "!!! INVALID !!!\n\n"; } } else { $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\nPHAIL - Transaktion fehlgeschlagen. TXNID: " . $_REQUEST["txn_id"] . "\n" . $info . "\n\n"; } $fp = fopen(PATH_LOGS . FILE_PAYPALLOG, 'a'); // Write $somecontent to our opened file. fwrite($fp, $sLogData); fclose($fp); } } die; }