예제 #1
0
$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());
        echo "Validated!";
    } else {
        die("Unable to validate postback data");
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
/* Example Classes */
class Example_Order
{
    protected $status = "OPEN";
    public function loadByOrderID($id)
    {
    }
    public function getStatus()
예제 #2
0
    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));
                break;
        }
        $order->updateStatusHistory(sprintf("Customer returned with statuscode %s", $icepay->getStatus(true)));
    } else {
        die("Unable to validate data");
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
/* Example Classes */
class Example_Order
{
    protected $status = "OPEN";
    public function getStatus()
    {
        return $this->status;
    }
    public function saveStatus($status)