Ejemplo n.º 1
0
 $fulltag = $PAYPALFULLTAG;
 $payerID = $PAYPALPAYERID;
 // Set by newpayment.php
 $paymentType = $_SESSION['PaymentType'];
 $currencyCodeType = $_SESSION['currencyCodeType'];
 $FinalPaymentAmt = $_SESSION["Payment_Amount"];
 // From env
 $ipaddress = $_SESSION['ipaddress'];
 dol_syslog("Call paymentok with token=" . $token . " paymentType=" . $paymentType . " currencyCodeType=" . $currencyCodeType . " payerID=" . $payerID . " ipaddress=" . $ipaddress . " FinalPaymentAmt=" . $FinalPaymentAmt . " fulltag=" . $fulltag, LOG_DEBUG, 0, '_paypal');
 // Validate record
 if (!empty($paymentType)) {
     dol_syslog("We call GetExpressCheckoutDetails", LOG_DEBUG, 0, '_paypal');
     $resArray = getDetails($token);
     //var_dump($resarray);
     dol_syslog("We call DoExpressCheckoutPayment token=" . $token . " paymentType=" . $paymentType . " currencyCodeType=" . $currencyCodeType . " payerID=" . $payerID . " ipaddress=" . $ipaddress . " FinalPaymentAmt=" . $FinalPaymentAmt . " fulltag=" . $fulltag, LOG_DEBUG, 0, '_paypal');
     $resArray = confirmPayment($token, $paymentType, $currencyCodeType, $payerID, $ipaddress, $FinalPaymentAmt, $fulltag);
     $ack = strtoupper($resArray["ACK"]);
     if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
         $object = new stdClass();
         $object->source = $source;
         $object->ref = $ref;
         $object->payerID = $payerID;
         $object->fulltag = $fulltag;
         $object->resArray = $resArray;
         // resArray was built from a string like that
         // TOKEN=EC%2d1NJ057703V9359028&TIMESTAMP=2010%2d11%2d01T11%3a40%3a13Z&CORRELATIONID=1efa8c6a36bd8&ACK=Success&VERSION=56&BUILD=1553277&TRANSACTIONID=9B994597K9921420R&TRANSACTIONTYPE=expresscheckout&PAYMENTTYPE=instant&ORDERTIME=2010%2d11%2d01T11%3a40%3a12Z&AMT=155%2e57&FEEAMT=5%2e54&TAXAMT=0%2e00&CURRENCYCODE=EUR&PAYMENTSTATUS=Completed&PENDINGREASON=None&REASONCODE=None
         $PAYMENTSTATUS = urldecode($resArray["PAYMENTSTATUS"]);
         // Should contains 'Completed'
         $TRANSACTIONID = urldecode($resArray["TRANSACTIONID"]);
         $TAXAMT = urldecode($resArray["TAXAMT"]);
         $NOTE = urldecode($resArray["NOTE"]);
Ejemplo n.º 2
0
    /**
     * Event listener method handles all Frontend actions
     *
     * @param Enlight_Event_EventArgs $args
     */
    static function onPostRatepayDispatch(Enlight_Event_EventArgs $args) {
        $config = Shopware()->Plugins()->Frontend()->PigmbhRatePAYPayment()->Config();
        Shopware()->Template()->addTemplateDir(dirname(__FILE__) . '/Views/Frontend/');
        /** @var $request Enlight_Controller_Request_RequestHttp */
        $request = $args->getSubject()->Request();
        // just be active in the frontend and while the plugin is enabled
        if ($request->getModuleName() == 'frontend' && $config->multishopactive == true) {
            $view = $args->getSubject()->View();
            Shopware()->Session()->pi_ratepay_rate_calc_path = Shopware()->Config()->get('basepath') . '/engine/Shopware/Plugins/Default/Frontend/PigmbhRatePAYPayment/Ratenrechner/';
            // return if no template could be found.
            if(!$view->hasTemplate()) {
                return;
            }
            $userData = $view->sUserData;
            if(isset($userData['billingadress']['id'])) {
                Shopware()->Session()->RatepayCustomerId=$userData['billingadress']['id'];
            }
            $ratepayPayment=checkRatepayPayment($userData);
            if ($userData && $ratepayPayment) {
                checkBillingEqualShipping($userData, $view);
                checkB2BAllowed($userData, $view);
                if(Shopware()->Session()->ratepayB2BInvoice && $userData["additional"]["payment"]["name"] == "RatePAYInvoice"
                    || Shopware()->Session()->ratepayB2BRate && $userData["additional"]["payment"]["name"] == "RatePAYRate"
                    || Shopware()->Session()->ratepayB2BDebit && $userData["additional"]["payment"]["name"] == "RatePAYDebit"
                    || Shopware()->Session()->ratePAYadressDiff) {
                    $sql = "UPDATE `s_user` SET `paymentID` = ? WHERE `id` = ?";
                    Shopware()->Db()->query($sql, array(
                        (int)Shopware()->Config()->Paymentdefault,
                        (int)$userData['billingaddress']['userID']
                    ));
                }
            }
            $view->extendsTemplate('index/header.tpl');
            //Checks if customer can pay with RatePAY, sets error messages and loads payment_fieldset template
            //Also implements fix for older templates and sets debit data
            // sViewport has been removed - instead $args->getSubject()->Request()->getControllerName() can be used
            if ($request->getControllerName() == 'account' || $request->getControllerName() == 'checkout' || $request->getControllerName() == 'register') {
                $basket = Shopware()->Session()->sOrderVariables['sBasket'];
                //gets userage and checks user data
                if ($userData) {
                    $userAge = getUserAge($userData, $view);
                    checkBillingEqualShipping($userData, $view);
                    checkUserData($userData, $view, $userAge);
                    checkB2BAllowed($userData, $view);
	                $view->debitData = getEncodedDebitData($userData['billingaddress']['userID']);
	                if(!isset($view->debitData)) $view->debitData = getDebitData();
                }
                //displays surcharge at payment selection
                if($basket){
                    setSurcharge($basket, $view);
                    Shopware()->Session()->pi_ratepay_Warenkorbbetrag = number_format($basket['AmountNumeric'], 2, ".", "");
                 }

                $view->activateDebit = $config->activate_debit;
                $view->extendsTemplate('register/payment_fieldset.tpl');
                //Saves data entered in RatePAY form
                if ($request->getActionName() == 'savePayment') {
                    $post = $args->getSubject()->Request()->getPost();
                    setDirectDebitSession($post);
                    if (isset($post['saveRatepayInvoiceData']) || isset($post['saveRatepayRateData']) || isset($post['saveRatepayDebitData'])){
                        saveUserData($args);
                    }
                    elseif($post['register']['payment'] == getDebitPaymentId()
                           || ($post['register']['payment']== getRatePaymentId() && Shopware()->Session()->RatepayDirectDebit)){
                        if(!checkDebitData($post)){
                            header('Location:'.str_replace("savePayment","payment",Shopware()->Config()->Host.$_SERVER['REQUEST_URI']));
                            //break;
                        } else{
                            Shopware()->Session()->RatepayRateMissingBankData = false;
                            Shopware()->Session()->RatepayDebitMissingBankData = false;
                            saveDebitData($args);
                        }
                    }
                }

                 //template fix and saving of direct debit selection for ratepay installment
                if($request->getActionName() == 'payment'){
                    if(Shopware()->Session()->RatepayDebitMissingBankData){
                            $view->RatepayDebitMissingBankData = true;
                    }
                    elseif(Shopware()->Session()->RatepayRateMissingBankData){
                            $view->RatepayRateMissingBankData = true;
                    }
                }

                //Sets debit data
                if(Shopware()->Session()->RatepayDirectDebit){
                    $view->ratepayDebitPayType = Shopware()->Session()->RatepayDirectDebit;
                }
                //Extends checkout with RatePAY AGB, rate calculator and payment notices and also sets template vars
                if ($request->getControllerName() == 'checkout' && $request->getActionName() != 'finish' && $request->getActionName() != 'cart'
                        && $request->sTargetAction != 'cart' && isset($ratepayPayment)) {
                    $view->extendsTemplate('checkout/confirm.tpl');
                    setTemplateVars($view, $request, $config, $userData);
                }
                //Confirms RatePAY order at finish page
                if ($request->getControllerName() == 'checkout' && $request->getActionName() == 'finish' && $request->getActionName() != 'cart'
                        && $ratepayPayment && !Shopware()->Session()->pi_ratepay_Confirm){
                    confirmPayment($config, $userData);
                }
            }
        }
    }
Ejemplo n.º 3
0
 $to = $_SESSION[$guid]["organisationAdmissionsEmail"];
 $subject = $_SESSION[$guid]["organisationNameShort"] . " Gibbon Application Form Payment Issue";
 $headers = "From: " . $_SESSION[$guid]["organisationAdministratorEmail"];
 //Check return values to see if we can proceed
 if ($paymentToken == "" or $gibbonApplicationFormID == "" or $applicationFee == "") {
     $body = _('Payment via PayPal may or may not have been successful, but has not been recorded either way due to a system error. Please check your PayPal account for details. The following may be useful:') . "\n\nPayment Token: {$paymentToken}\n\nPayer ID: {$paymentPayerID}\n\nApplication Form ID: {$gibbonApplicationFormID}\n\nApplication Fee: {$applicationFee}\n\n" . $_SESSION[$guid]["systemName"] . " " . _('Administrator');
     mail($to, $subject, $body, $headers);
     //Success 2
     $URL .= "&addReturn=success2&id=" . $_GET["id"];
     header("Location: {$URL}");
     exit;
 } else {
     //PROCEED AND FINALISE PAYMENT
     require "../../lib/paypal/paypalfunctions.php";
     //Ask paypal to finalise the payment
     $confirmPayment = confirmPayment($guid, $applicationFee, $paymentToken, $paymentPayerID);
     $ACK = $confirmPayment["ACK"];
     $paymentTransactionID = $confirmPayment["PAYMENTINFO_0_TRANSACTIONID"];
     $paymentReceiptID = $confirmPayment["PAYMENTINFO_0_RECEIPTID"];
     //Payment was successful. Yeah!
     if ($ACK = "Success") {
         $updateFail = false;
         //Save payment details to gibbonPayment
         try {
             $data = array("status" => "Success", "paymentToken" => $paymentToken, "paymentPayerID" => $paymentPayerID, "paymentTransactionID" => $paymentTransactionID, "paymentReceiptID" => $paymentReceiptID, "foreignTable" => "gibbonApplicationForm", "foreignTableID" => $gibbonApplicationFormID);
             $sql = "INSERT INTO gibbonPayment SET status=:status, paymentToken=:paymentToken, paymentPayerID=:paymentPayerID, paymentTransactionID=:paymentTransactionID, paymentReceiptID=:paymentReceiptID, foreignTable=:foreignTable, foreignTableID=:foreignTableID";
             $result = $connection2->prepare($sql);
             $result->execute($data);
         } catch (PDOException $e) {
             $updateFail = true;
         }
Ejemplo n.º 4
0
     $rowKeyRead = $resultKeyRead->fetch();
     $gibbonFinanceInvoiceeID = $rowKeyRead["gibbonFinanceInvoiceeID"];
     $invoiceTo = $rowKeyRead["invoiceTo"];
     $gibbonSchoolYearID = $rowKeyRead["gibbonSchoolYearID"];
 }
 //Check return values to see if we can proceed
 if ($paymentToken == "" or $feeTotal == "" or $gibbonFinanceInvoiceID == "" or $key == "" or $gibbonFinanceInvoiceeID == "" or $invoiceTo = "" or $gibbonSchoolYearID == "") {
     //Success 2
     $URL .= "&addReturn=success2&gibbonFinanceInvoiceID={$gibbonFinanceInvoiceID}&key={$key}";
     header("Location: {$URL}");
     exit;
 } else {
     //PROCEED AND FINALISE PAYMENT
     require "../../lib/paypal/paypalfunctions.php";
     //Ask paypal to finalise the payment
     $confirmPayment = confirmPayment($guid, $feeTotal, $paymentToken, $paymentPayerID);
     $ACK = $confirmPayment["ACK"];
     $paymentTransactionID = $confirmPayment["PAYMENTINFO_0_TRANSACTIONID"];
     $paymentReceiptID = $confirmPayment["PAYMENTINFO_0_RECEIPTID"];
     //Payment was successful. Yeah!
     if ($ACK == "Success") {
         $updateFail = false;
         //Save payment details to gibbonPayment
         $gibbonPaymentID = setPaymentLog($connection2, $guid, "gibbonFinanceInvoice", $gibbonFinanceInvoiceID, "Online", "Complete", $feeTotal, "Paypal", "Success", $paymentToken, $paymentPayerID, $paymentTransactionID, $paymentReceiptID);
         //Link gibbonPayment record to gibbonApplicationForm, and make note that payment made
         if ($gibbonPaymentID != "") {
             try {
                 $data = array("paidDate" => date("Y-m-d"), "paidAmount" => $feeTotal, "gibbonPaymentID" => $gibbonPaymentID, "gibbonFinanceInvoiceID" => $gibbonFinanceInvoiceID);
                 $sql = "UPDATE gibbonFinanceInvoice SET status='Paid', paidDate=:paidDate, paidAmount=:paidAmount, gibbonPaymentID=:gibbonPaymentID WHERE gibbonFinanceInvoiceID=:gibbonFinanceInvoiceID";
                 $result = $connection2->prepare($sql);
                 $result->execute($data);
Ejemplo n.º 5
0
					</table>
					<!--PlainBox Bottom End-->
				</td>
			</tr>
		</table>
	</td>
</tr>
</table>
<!-- END DONATION BANNER -->

<?php 
builddiv_start(0, $lang['donate']);
// First we need to check if the request is &pay=finish
if (isset($_GET['pay'])) {
    if ($_GET['pay'] == 'finish') {
        confirmPayment();
    }
} else {
    // Echo the page description from the language file
    echo $PAGE_DESC . "<br /><br />";
    ?>
	<ul>
		<li>Already donated? <a href='?p=donate&amp;pay=finish'>Redeem your points!</a> (You need to buy an item below first)</li>
	</ul>
	<br />
	<?php 
    if ($donate_packages != FALSE) {
        foreach ($donate_packages as $package) {
            write_metalborder_header();
            echo "\r\n\t\t\t\t<table cellpadding='3' cellspacing='0' width='100%'>\r\n\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t<tr> \r\n\t\t\t\t\t\t\t<td class='rankingHeader' align='center' colspan='2' nowrap='nowrap'>\r\n\t\t\t\t\t\t\t\tDonate Package #" . $package['id'] . " :: <font color='green'>" . $package['desc'] . "</font>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class='rankingHeader' align='center' nowrap='nowrap'>Reward</td>\r\n\t\t\t\t\t\t\t<td class='rankingHeader' align='center' nowrap='nowrap'>Choose&nbsp;</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td width='60%' class='serverStatus1' style='text-align: center;'><font size='-1'>\r\n\t\t\t\t\t\t\t\t<b>" . $package['points'] . " " . $lang['web_points'] . "</b>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td class='serverStatus1' style='text-align: center;'><font size='-1'>";
            $Paypal->addVar('business', $Config->get('paypal_email'));