Ejemplo n.º 1
0
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
define('EMAIL', "*****@*****.**");
//<--- Change this into your own e-mail address
require_once '../src/icepay_api_basic.php';
/* Apply logging rules */
$logger = Icepay_Api_Logger::getInstance();
$logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("postback.txt")->logToScreen();
/* Start the postback class */
$icepay = new Icepay_Postback();
$icepay->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
$order = new Example_Order();
// This is a dummy class to depict a sample usage.
try {
    if ($icepay->validate()) {
        // In this example the ICEPAY OrderID is identical to the Order ID used in our project
        $order->loadByOrderID($icepay->getOrderID());
        /* Only update the status if it's a new order (NEW)
         * or update the status if the statuscode allowes it.
         * In this example the project order status is an ICEPAY statuscode.
         */
        if ($order->getStatus() == "NEW" || $icepay->canUpdateStatus($order->getStatus())) {
            $order->saveStatus($icepay->getStatus());
            //Update the status of your order
            $order->sendMail(sprintf("icepay_status_update_to_%s", $order->getStatus()));
        }
        $order->updateStatusHistory($icepay->getTransactionString());
Ejemplo n.º 2
0
 *  arising from, out of or in connection with the software or the use
 *  of other dealings in the software.
 *
 */
/*  Define your ICEPAY Merchant ID and Secret code. The values below are sample values and will not work, Change them to your own merchant settings. */
define('MERCHANTID', 12345);
//<--- Change this into your own merchant ID
define('SECRETCODE', "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//<--- Change this into your own merchant ID
require_once '../src/icepay_api_basic.php';
/* Apply logging rules */
$logger = Icepay_Api_Logger::getInstance();
$logger->enableLogging()->setLoggingLevel(Icepay_Api_Logger::LEVEL_ALL)->logToFile()->setLoggingDirectory(realpath("../logs"))->setLoggingFile("result.txt")->logToScreen();
$icepay = new Icepay_Result();
$icepay->setMerchantID(MERCHANTID)->setSecretCode(SECRETCODE);
$order = new Example_Order();
// This is a dummy class to depict a sample usage.
try {
    if ($icepay->validate()) {
        switch ($icepay->getStatus()) {
            case Icepay_StatusCode::OPEN:
                // Close the cart
                echo "Thank you, awaiting payment verification.";
                break;
            case Icepay_StatusCode::SUCCESS:
                // Close the cart
                echo "Thank you for your purchase. The payment has been received.";
                break;
            case Icepay_StatusCode::ERROR:
                //Redirect to cart
                echo sprintf("An error occurred: %s", $icepay->getStatus(true));