/** * Method verifyParcelValues() * * Get all informations about the parcelling of user defined by $login_moip * * @param string $login The client's login for Moip services * @param int $maxParcel The total parcels * @param float $rate The rate's percents of the parcelling. * @param float $simulatedValue The value for simulation * @return array * @access public */ public function queryParcel($login, $maxParcel, $rate, $simulatedValue) { if (!isset($this->credential)) { $this->setError("You must specify the credentials (token / key) and enriroment"); } $client = new MoipClient(); $url = $this->environment->base_url . "/ws/alpha/ChecarValoresParcelamento/{$login}/{$maxParcel}/{$rate}/{$simulatedValue}"; $credential = $this->credential['token'] . ':' . $this->credential['key']; $answer = $client->curlGet($credential, $url, $this->errors); if ($answer->response) { $xml = new SimpleXmlElement($answer->xml); if ($xml->Resposta->Status == "Sucesso") { $response = true; } else { $response = false; } $return = array('response' => $response, 'installment' => array()); $i = 1; foreach ($xml->Resposta->ValorDaParcela as $parcela) { $attrib = $parcela->attributes(); $return['installment']["{$i}"] = array('total' => (string) $attrib['Total'], 'rate' => (string) $attrib['Juros'], 'value' => (string) $attrib['Valor']); $i++; } return $return; } return $answer; }
public function consultarInstrucao($token) { $client = new MoipClient(); $url = $this->environment->base_url . "/ws/alpha/ConsultarInstrucao/" . $token; $credential = $this->credential['token'] . ':' . $this->credential['key']; $answer = $client->curlGet($credential, $url, $this->errors); if ($answer->response == true) { $answer->array = array_shift($this->XMLToArray($answer->xml)); } return $answer; }