예제 #1
0
<?php

require_once "./common/config.php";
require_once "./common/cart.php";
include "./front/header.php";
?>


<?php 
process_transaction();
?>

<!-- Page Content -->
<div class="container">
	<h1 class="text-center">ありがとうございました!</h1>
</div><!-- container -->

<?php 
include "./front/footer.php";
function buy_land($method_name, $params, $app_data)
{
    global $economy_source_account;
    $req = $params[0];
    $agentid = $req['agentId'];
    $sessionid = $req['secureSessionId'];
    $amount = $req['currencyBuy'];
    $real = $req['estimatedCost'];
    $billableArea = $req['billableArea'];
    $ipAddress = $_SERVER['REMOTE_ADDR'];
    #
    # Validate Requesting user has a session
    #
    $db = new DB();
    $db->query("select UUID from " . C_AGENTS_TBL . " where " . "UUID='" . $db->escape($agentid) . "' and " . "secureSessionID='" . $db->escape($sessionid) . "'");
    list($UUID) = $db->next_record();
    if ($UUID) {
        if ($amount > 0) {
            if (!process_transaction($agentid, $real, $ipAddress)) {
                header("Content-type: text/xml");
                $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "\n\nThe gateway has declined your transaction. Please update your payment method and try again later.", 'errorURI' => "" . SYSURL . ""));
                print $response_xml;
                return "";
            }
            move_money($economy_source_account, $agentid, $amount, 0, 0, 0, 0, "Currency purchase", 0, $ipAddress);
        }
        header("Content-type: text/xml");
        $response_xml = xmlrpc_encode(array('success' => True));
        print $response_xml;
    } else {
        header("Content-type: text/xml");
        $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "\n\nUnable to Authenticate\n\nClick URL for more info.", 'errorURI' => "" . SYSURL . ""));
        print $response_xml;
    }
    return "";
}
예제 #3
0
// |                                                                          |
// | This program is distributed in the hope that it will be useful,          |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with this program; if not, write to the Free Software Foundation,  |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.          |
// |                                                                          |
// +--------------------------------------------------------------------------+
// If submitted attempt fails it will return results to this page.
// This page only gets the error message and passes it to index.php
if (isset($_POST['decision'])) {
    //Payment was sent and rejected display error message
    $error = process_transaction();
}
echo "<SCRIPT> window.location='index.php?error={$error}'</SCRIPT>";
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^PROCESS_TRANSACTION^^
# Get reason payment process was declined. All missing and incorrect fields.
#______________________________________________________________________________________________
function process_transaction()
{
    $error = "";
    //Get core reason:
    $error .= cybersource_error_code($_POST['reasonCode']) . "<br>";
    //Get all missing fields:
    $i = 0;
    while (isset($_POST['MissingField' . $i])) {
        $error .= cybersource_field_name($_POST['MissingField' . $i]) . " was left blank.<br>";
        $i++;
function buy_currency($method_name, $params, $app_data)
{
    global $economy_source_account;
    global $minimum_real;
    global $low_amount_error;
    $req = $params[0];
    $agentid = $req['agentId'];
    $regionid = $req['regionId'];
    $sessionid = $req['secureSessionId'];
    $amount = $req['currencyBuy'];
    $ipAddress = $_SERVER['REMOTE_ADDR'];
    #
    # Validate Requesting user has a session
    #
    $db = new DB();
    $db->query("select UUID from " . C_AGENTS_TBL . " where " . "UUID='" . $db->escape($agentid) . "' and " . "secureSessionID='" . $db->escape($sessionid) . "'");
    list($UUID) = $db->next_record();
    if ($UUID) {
        $cost = convert_to_real($amount);
        if ($cost < $minimum_real) {
            $error = sprintf($low_amount_error, $minimum_real / 100.0);
            header("Content-type: text/xml");
            $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => $error, 'errorURI' => "" . SYSURL . ""));
            print $response_xml;
            return "";
        }
        $transactionResult = process_transaction($agentid, $cost, $ipAddress);
        if ($transactionResult) {
            header("Content-type: text/xml");
            $response_xml = xmlrpc_encode(array('success' => True));
            print $response_xml;
            move_money($economy_source_account, $agentid, $amount, 0, 0, 0, 2100, "Currency purchased", $regionid, $ipAddress);
            update_simulator_balance($agentid);
        } else {
            header("Content-type: text/xml");
            $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "We were unable to process the transaction.  The gateway denied your charge", 'errorURI' => "" . SYSURL . ""));
            print $response_xml;
        }
    } else {
        header("Content-type: text/xml");
        $response_xml = xmlrpc_encode(array('success' => False, 'errorMessage' => "Unable to Authenticate\n\nClick URL for more info.", 'errorURI' => "" . SYSURL . ""));
        print $response_xml;
    }
    return "";
}