/** * Sends answer by sms ID get from callback. Answer can be send only if it was not provided * when responding to callback * * @param integer $smsId * @param string $text * * @throws WebToPayException */ public function sendAnswer($smsId, $text) { $content = $this->webClient->get(WebToPay::SMS_ANSWER_URL, array('id' => $smsId, 'msg' => $text, 'transaction' => md5($this->password . '|' . $smsId))); if (strpos($content, 'OK') !== 0) { throw new WebToPayException(sprintf('Error: %s', $content), WebToPayException::E_SMS_ANSWER); } }
/** * Gets payment method list for specified currency * * @param string $currency * * @return WebToPay_PaymentMethodList * * @throws WebToPayException */ public function getPaymentMethodList($currency) { if (!isset($this->methodListCache[$currency])) { $xmlAsString = $this->webClient->get(WebToPay::XML_URL . $this->projectId . '/currency:' . $currency); $useInternalErrors = libxml_use_internal_errors(false); $rootNode = simplexml_load_string($xmlAsString); libxml_clear_errors(); libxml_use_internal_errors($useInternalErrors); if (!$rootNode) { throw new WebToPayException('Unable to load XML from remote server'); } $methodList = new WebToPay_PaymentMethodList($this->projectId, $currency); $methodList->fromXmlNode($rootNode); $this->methodListCache[$currency] = $methodList; } return $this->methodListCache[$currency]; }