public function confirm($token = "") { $token = trim($token); if (empty($token)) { $token = $_GET['token']; } $result = MPower_Utilities::httpGetRequest(MPower_Setup::getCheckoutConfirmUrl() . $token); if (count($result) > 0) { switch ($result['status']) { case 'completed': $this->status = $result['status']; $this->pushCustomData($result["custom_data"]); $this->pushItems($result["invoice"]['items']); $this->pushTaxes($result["invoice"]['taxes']); $this->customer = $result['customer']; $this->setTotalAmount($result['invoice']['total_amount']); $this->receipt_url = $result['receipt_url']; return true; break; default: $this->status = $result['status']; $this->pushCustomData($result["custom_data"]); $this->pushItems($result["invoice"]['items']); $this->pushTaxes($result["invoice"]['taxes']); $this->setTotalAmount($result['invoice']['total_amount']); $this->response_text = "Invoice status is " . strtoupper($result['status']); return false; } } else { $this->status = "fail"; $this->response_code = 1002; $this->response_text = "Invoice Not Found"; return false; } }