* payment. */ require_once __DIR__ . '/../bootstrap.php'; session_start(); if (!isSignedIn()) { header('Location: ../user/sign_in.php'); exit; } if (isset($_GET['success'])) { // We were redirected here from PayPal after the buyer approved/cancelled // the payment if ($_GET['success'] == 'true' && isset($_GET['PayerID']) && isset($_GET['orderId'])) { $orderId = $_GET['orderId']; try { $order = getOrder($orderId); $payment = executePayment($order['payment_id'], $_GET['PayerID']); updateOrder($orderId, $payment->getState()); $messageType = "success"; $message = "Your payment was successful. Your order id is {$orderId}."; } catch (\PayPal\Exception\PPConnectionException $ex) { $message = parseApiError($ex->getData()); $messageType = "error"; } catch (Exception $ex) { $message = $ex->getMessage(); $messageType = "error"; } } else { $messageType = "error"; $message = "Your payment was cancelled."; } }
<?php die; header('Content-type: application/json'); require_once "include.php"; require_once "../../configuration.php"; require_once "../../include.php"; session_start(); $con = mysql_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_PASSWORD); if (!$con) { die("-2"); } if (!mysql_select_db($MYSQL_DATABASE, $con)) { mysql_close($con); die("-3"); } if (!hasRole($_GET["googleid"], "ROLE_USER", $con)) { mysql_close($con); die("-4"); } $paymentObject = executePayment(getPaypalAccessToken(), $_SESSION["paypalPaymentId"], $_GET["PayerID"]); if ($paymentObject->state === "approved") { addRole($_GET["googleid"], "ROLE_PRO", $con); //grant user pro echo json_encode($paymentObject); } else { echo "-1"; } unset($_SESSION["paypalPaymentId"]); mysql_close($con);
if (strcmp($orderId, $orderinfo['id']) != 0) { $messageType = "error"; $message = "Session time out!Payment was cancelled.!"; } else { try { $extent = ""; if (isset($orderinfo["key"])) { $keyresult = updateKey($orderinfo["key"], $orderinfo["daylimit"], $orderinfo["price"], $payerId); $extent = "had been extentsion successfull!"; } else { $keyresult = insertKey($orderinfo["email"], $orderinfo["ime"], $orderinfo["deviceid"], $orderinfo["devicetype"], $payerId, $orderinfo['daylimit'], $orderinfo['price']); } if (!$keyresult) { throw new Exception("Error when processing! Please contact admin"); } $payment = executePayment($orderinfo['payment_id'], $payerId); $messageType = "success"; $message = "Your payment was successful. Your license key is <strong style='color:red'> {$keyresult}</strong>"; if ($extent != "") { $message .= " " . $extent; } } catch (\PayPal\Exception\PPConnectionException $ex) { $message = parseApiError($ex->getData()); $messageType = "error"; } catch (Exception $ex) { $message = $ex->getMessage(); $messageType = "error"; } } } else { $messageType = "error";
* Acción para registrar una consulta. En el registro se salva la información * correspondiente al tipo de pago seleccionado. Existen dos tipos de pagos * uno por PayPal y otro por TPV. * * @author Manuel Morejón * @copyright 2013 - 2014 * @access public * */ require __DIR__ . '/../../src/paypal/payments/paypal.php'; // se chequea si se realizó el pago o no if (isset($_GET['success'])) { if ($_GET['success'] == 'true') { try { if (isset($_GET['PayerID'])) { $payment = executePayment($_SESSION['paymentId'], $_GET['PayerID']); } // se carga la información temporal $issueData = $mantisCore->loadTempData($_GET['idData']); // se crean las variables existentes en la información temporal $summary = $issueData['summary']; $description = $issueData['description']; $specialistId = $issueData['specialistId']; $paymentType = $issueData['paymentType']; $projectId = $issueData['projectId']; // se establecen los valores de pago setProjectPaypalConfiguration($paymentType); // se crea la incidencia con la información almacenada $mantisCore->addIssue($summary, $description, $projectId, $specialistId, $paymentType, $_GET['idData']); // se envia un mensaje al usuario del registro realizado $mantisCore->sendEmail($summary, $description, $projectId, $specialistId, $GLOBALS['PAY_NAME'], $GLOBALS['PAY_PRICE'], $GLOBALS['PAY_TAX'], $GLOBALS['PAY_TOTAL_AMOUNT']);
public function capture(Varien_Object $payment, $amount) { if ($payment->getAdditionalInformation('hyperpay_transaction_code') == 'PA') { $refId = $payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID'); $currency = $payment->getAdditionalInformation('CURRENCY'); $dataTransaction = $this->getCredentials(); $dataTransaction['tx_mode'] = $this->getTransactionMode(); $postData = getPostCapture($refId, $amount, $currency, $dataTransaction); $server = $this->getServerMode(); $url = getExecuteUrl($server); $response = executePayment($postData, $url); $result = buildResponseArray($response); $payment->setAdditionalInformation('CAPTURE', $result['PROCESSING.RESULT']); if ($result['PROCESSING.RESULT'] == 'ACK') { $payment->setStatus('APPROVED')->setTransactionId($payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID'))->setIsTransactionClosed(1)->save(); } else { Mage::throwException(Mage::helper('hyperpay')->__('An error occurred while processing')); } } else { $payment->setStatus('APPROVED')->setTransactionId($payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID'))->setIsTransactionClosed(1)->save(); } return $this; }