Esempio n. 1
0
    function process_payment_return()
    {
        global $label;
        if ($_POST['Merchant_Id'] != '') {
            $sql = "SELECT * FROM orders where order_id='" . $_POST['Order_Id'] . "'";
            $result = mysql_query($sql) or die(mysql_error() . $sql);
            $order_row = mysql_fetch_array($result);
            //$WorkingKey = "" ; //put in the 32 bit working key in the quotes provided here
            $Checksum = cc_verifychecksum($_POST['Merchant_Id'], $_POST['Order_Id'], $_POST['Amount'], $_POST['AuthDesc'], $_POST['Checksum'], CCAVENUE_WORKING_KEY);
            if ($Checksum == "true" && $_POST['AuthDesc'] == "Y") {
                debit_transaction($_POST['Order_Id'], $_POST['Amount'], CCAVENUE_CURRENCY, "ccAve" . $_POST['Order_Id'], $reason_code, 'CCAvenue');
                complete_order($order_row['user_id'], $_POST['Order_Id']);
                ?>

					<center>

				<?php 
                echo $label['payment_ccave_note_y'];
                ?>
 ?>

				</center>
					
					<h3><?php 
                echo $label['payment_ccave_go_back'];
                ?>
</h3>

				<?php 
                echo "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. You can continue and upload your pixels.";
                //Here you need to put in the routines for a successful
                //transaction such as sending an email to customer,
                //setting database status, informing logistics etc etc
            } else {
                if ($Checksum == "true" && $_POST['AuthDesc'] == "B") {
                    pend_order($order_row['user_id'], $_POST['Order_Id']);
                    ?>

				<center>

				<?php 
                    echo $label['payment_ccave_note_b'];
                    ?>
 ?>

				</center>
					
					

					?>
				<br>

				<?php 
                    //Here you need to put in the routines/e-mail for a  "Batch Processing" order
                    //This is only if payment for this transaction has been made by an American Express Card
                    //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
                } else {
                    if ($Checksum == "true" && $_POST['AuthDesc'] == "N") {
                        echo "<br>Thank you for shopping with us. However, the transaction has been declined.";
                        //Here you need to put in the routines for a failed
                        //transaction such as sending an email to customer
                        //setting database status etc etc
                        ?>

				<h3><?php 
                        echo $label['payment_ccave_go_back'];
                        ?>
</h3>

				<?php 
                    } else {
                        echo "<br>Security Error. Illegal access detected";
                        //Here you need to simply ignore this and dont need
                        //to perform any operation in this condition
                    }
                }
            }
        }
    }
Esempio n. 2
0
    function process_payment_return()
    {
        global $label;
        if ($_POST['Merchant_Id'] != '') {
            foreach ($_POST as $key => $value) {
                $req .= "&{$key}={$value}";
            }
            cc_log_entry('ccAvenue:' . $req);
            $Checksum = cc_verifychecksum($_POST['Merchant_Id'], $_POST['Order_Id'], $_POST['Amount'], $_POST['AuthDesc'], $_POST['Checksum'], CCAVENUE_WORKING_KEY);
            $label['payment_ccave_go_back'] = str_replace("%ADV_LINK%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_ccave_go_back']);
            $invoice_id = jb_strip_order_id($_POST['Order_Id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($Checksum == "true") {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
            } else {
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
            }
            if ($Checksum == "true" && $_POST['AuthDesc'] == "Y") {
                if ($product_type == 'P') {
                    JB_complete_package_invoice($invoice_id, 'ccAvenue');
                    ?>
					<center>

					<img src="<?php 
                    echo JB_SITE_LOGO_URL;
                    ?>
">
					<?php 
                    $label['payment_posts_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_posts_completed2']);
                    ?>
					<p><?php 
                    echo $label['payment_posts_completed2'];
                    ?>
</p>
					</center>
					<?php 
                } elseif ($product_type == 'S') {
                    JB_complete_subscription_invoice($invoice_id, 'ccAvenue');
                    ?>
					<center>

					<img src="<?php 
                    echo JB_SITE_LOGO_URL;
                    ?>
">
					<?php 
                    $label['payment_subscription_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_subscription_completed2']);
                    ?>
					<p><?php 
                    echo $label['payment_subscription_completed2'];
                    ?>
</p>
					</center>
					<?php 
                } elseif ($product_type == 'M') {
                    JB_complete_membership_invoice($invoice_id, 'ccAvenue');
                    ?>
					<center>

					<img src="<?php 
                    echo JB_SITE_LOGO_URL;
                    ?>
">
					<p><?php 
                    echo $label['payment_membership_completed'];
                    ?>
</p>
					</center>
					<?php 
                }
                JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type);
                JB_debit_transaction($invoice_id, $_POST['Amount'], CCAVENUE_CURRENCY, $_POST['Order_Id'], $reason, 'ccAvenue', $product_type);
                //Here you need to put in the routines for a successful
                //transaction such as sending an email to customer,
                //setting database status, informing logistics etc etc
            } else {
                if ($Checksum == "true" && $_POST['AuthDesc'] == "B") {
                    if ($product_type == 'P') {
                        JB_pend_package_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']);
                    } elseif ($product_type == 'S') {
                        JB_pend_subscription_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']);
                    } elseif ($product_type == 'M') {
                        JB_pend_membership_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                    $label['payment_return_pending'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_pending']);
                    ?>
				<center>
				<img src="<?php 
                    echo JB_SITE_LOGO_URL;
                    ?>
">
				<p><?php 
                    echo $label['payment_return_pending'];
                    ?>
</p>
				</center>
				<?php 
                    //Here you need to put in the routines/e-mail for a  "Batch Processing" order
                    //This is only if payment for this transaction has been made by an American Express Card
                    //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
                } else {
                    if ($Checksum == "true" && $_POST['AuthDesc'] == "N") {
                        JBPLUG_do_callback('pay_trn_failed', $invoice_id, $product_type);
                        $label['payment_return_denied'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_denied']);
                        echo $label["payment_return_denied"];
                        //Here you need to put in the routines for a failed
                        //transaction such as sending an email to customer
                        //setting database status etc etc
                        ?>


				<?php 
                    } else {
                        echo "<br>Security Error. Illegal access detected";
                        //Here you need to simply ignore this and dont need
                        //to perform any operation in this condition
                    }
                }
            }
        }
        ?>

		
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>

		<?php 
    }