public function charge($opr_token, $confirm_token) { $payload = array('token' => $opr_token, 'confirm_token' => $confirm_token); $result = MPower_Utilities::httpJsonRequest(MPower_Setup::getOPRChargeUrl(), $payload); if (count($result) > 0) { switch ($result['response_code']) { case 00: $this->status = $result["invoice_data"]['status']; $this->pushCustomData($result["invoice_data"]["custom_data"]); $this->pushItems($result["invoice_data"]["invoice"]['items']); $this->pushTaxes($result["invoice_data"]["invoice"]['taxes']); $this->customer = $result["invoice_data"]['customer']; $this->setTotalAmount($result["invoice_data"]['invoice']['total_amount']); $this->receipt_url = $result["invoice_data"]['receipt_url']; $this->response_text = $result["response_text"]; return true; break; default: $this->status = "fail"; $this->response_text = $result["response_text"]; $this->response_code = $result["response_code"]; return false; } } else { $this->status = "fail"; $this->response_code = 4002; $this->response_text = "An Unknown MPower Server Error Occured."; return false; } }