private function handleResponseBalance($balResult) { $xml = new xmlData($balResult["response"]); $program = 'Gift'; if ($balResult['curlErr'] != CURLE_OK || $balResult['curlHTTP'] != 200) { if ($authResult['curlHTTP'] == '0') { CoreLocal::set("boxMsg", "No response from processor<br />\n The transaction did not go through"); return PaycardLib::PAYCARD_ERR_PROC; } return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_COMM); // comm error, try again } CoreLocal::set("paycard_response", array()); CoreLocal::set("paycard_response", $xml->array_dump()); $resp = CoreLocal::get("paycard_response"); if (isset($resp["BALANCE"])) { $resp["Balance"] = $resp["BALANCE"]; CoreLocal::set("paycard_response", $resp); } // there's less to verify for balance checks, just make sure all the fields are there if ($xml->isValid() && $xml->get('TRANSACTIONTYPE') && $xml->get('TRANSACTIONTYPE') == $program && $xml->get('AUTHORIZED') && $xml->get('AUTHORIZED') == 'true' && (!$xml->get('ERRORMSG') || $xml->get_first('ERRORMSG') == '') && $xml->get('BALANCE')) { return PaycardLib::PAYCARD_ERR_OK; // balance checked, no error } // the authorizor gave us some failure code CoreLocal::set("boxMsg", "Processor error: " . $xml->get_first("ERRORMSG")); return PaycardLib::PAYCARD_ERR_PROC; }
private function handleResponseBalance($balResult) { $resp = $this->desoapify("GiftTransactionResult", $balResult["response"]); $xml = new xmlData($resp); $program = 'Gift'; if ($balResult['curlErr'] != CURLE_OK || $balResult['curlHTTP'] != 200) { if ($authResult['curlHTTP'] == '0') { if (!$this->second_try) { $this->second_try = true; return $this->send_balance("w2.backuppay.com"); } else { CoreLocal::set("boxMsg", "No response from processor<br />\n The transaction did not go through"); return PaycardLib::PAYCARD_ERR_PROC; } } return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_COMM); // comm error, try again } CoreLocal::set("paycard_response", array()); CoreLocal::set("paycard_response", $xml->array_dump()); $resp = CoreLocal::get("paycard_response"); if (isset($resp["BALANCE"])) { $resp["Balance"] = $resp["BALANCE"]; CoreLocal::set("paycard_response", $resp); } // there's less to verify for balance checks, just make sure all the fields are there if ($xml->isValid() && $xml->get('TRANTYPE') && $xml->get('TRANTYPE') == 'PrePaid' && $xml->get('CMDSTATUS') && $xml->get('CMDSTATUS') == 'Approved' && $xml->get('BALANCE')) { return PaycardLib::PAYCARD_ERR_OK; // balance checked, no error } // the authorizor gave us some failure code CoreLocal::set("boxMsg", "Processor error: " . $xml->get_first("TEXTRESPONSE")); return PaycardLib::PAYCARD_ERR_PROC; }