public function pay() { $requestor = new Conekta_ApiRequestor($this->_apiKey); $url = $this->instanceUrl() . '/pay'; list($response, $apiKey) = $requestor->request('post', $url); $this->refreshFrom($response, $apiKey); return $this; }
public function retrieve($id, $params = null) { $requestor = new Conekta_ApiRequestor($this->_apiKey); $base = $this['url']; $id = Conekta_ApiRequestor::utf8($id); $extn = urlencode($id); list($response, $apiKey) = $requestor->request('get', "{$base}/{$extn}", $params); return Conekta_Util::convertToConektaObject($response, $apiKey); }
public function instanceUrl() { $id = $this['id']; $customer = $this['customer']; $class = get_class($this); if (!$id) { throw new Conekta_InvalidRequestError("Could not determine which URL to request: {$class} instance has invalid ID: {$id}", null); } $id = Conekta_ApiRequestor::utf8($id); $customer = Conekta_ApiRequestor::utf8($customer); $base = self::classUrl('Conekta_Customer'); $customerExtn = urlencode($customer); $extn = urlencode($id); return "{$base}/{$customerExtn}/cards/{$extn}"; }
protected function _scopedDelete($class, $params = null) { self::_validateCall('delete'); $requestor = new Conekta_ApiRequestor($this->_apiKey); $url = $this->instanceUrl(); list($response, $apiKey) = $requestor->request('delete', $url, $params); $this->refreshFrom($response, $apiKey); return $this; }
public function deleteDiscount() { $requestor = new Conekta_ApiRequestor($this->_apiKey); $url = $this->instanceUrl() . '/discount'; list($response, $apiKey) = $requestor->request('delete', $url); $this->refreshFrom(array('discount' => null), $apiKey, true); }