public static function boot() { parent::boot(); DBOrder::created(function ($order) { $order->icepayObject = \Icepay::paymentObject(); $order->icepayObject->setOrderID($order->id); }); }
} //log the order in the DB try { $db_order = Hansvn\Icepay\DBOrder::find($error->getOrderID()); if ($db_order->error_path && $db_order->error_path != "") { return \Redirect::to($db_order->error_path)->with('OrderID', $db_order->id); } else { return \Redirect::to(Config::get('icepay-postback::error_redirect_path'))->with('OrderID', $db_order->id); } } catch (Exception $e) { \Log::error($e->getMessage()); return \Redirect::to(Config::get('icepay-postback::error_redirect_path'))->with('message', $e->getMessage()); } }); Route::any(Config::get('icepay-postback::postback_path'), function () { $postback = Icepay::postback(); $status = ""; //get the postback and validate try { if ($postback->validate()) { /* Actions based on statuscode */ switch ($postback->getStatus()) { case Hansvn\Icepay\StatusCode::OPEN: $status = "awaiting payment"; break; case Hansvn\Icepay\StatusCode::SUCCESS: $status = "completed"; break; case Hansvn\Icepay\StatusCode::ERROR: $status = "error"; break;