public static function send($method, $url, $params = array(), $env = null, $headers = array()) { if (is_null($env)) { $env = ChargeBee_Environment::defaultEnv(); } if (is_null($env)) { throw new Exception("ChargeBee api environment is not set. Set your site & api key in ChargeBee_Environment::configure('your_site', 'your_api_key')"); } $ser_params = ChargeBee_Util::serialize($params); $response = ChargeBee_Curl::doRequest($method, $url, $env, $ser_params, $headers); if (is_array($response) && array_key_exists("list", $response)) { return new ChargeBee_ListResult($response['list'], isset($response['next_offset']) ? $response['next_offset'] : null); } else { return new ChargeBee_Result($response); } }
private function _load() { foreach ($this->_values as $k => $v) { $setVal = null; if ($this->isHash($v) && array_key_exists($k, $this->_subTypes)) { $setVal = new $this->_subTypes[$k]($v); } else { if (is_array($v) && array_key_exists($k, $this->_subTypes)) { $setVal = array(); foreach ($v as $stV) { array_push($setVal, new $this->_subTypes[$k]($stV)); } } } if (is_null($setVal)) { $setVal = $v; } $this->_data[ChargeBee_Util::toCamelCaseFromUnderscore($k)] = $setVal; } }
public static function retrieve($id, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("coupons", $id), array(), $env, $headers); }
public static function renewalEstimate($id, $params = array(), $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("subscriptions", $id, "renewal_estimate"), $params, $env, $headers); }
public static function deleteCardForCustomer($id, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers", $id, "delete_card"), array(), $env, $headers); }
public function _initDependantList($obj, $type, $subTypes = array()) { if (!array_key_exists($type, $obj)) { return $this; } if (!is_array($obj[$type])) { return $this; } $class = $this->__getDependant($type); if (!is_null($class)) { $setVal = array(); foreach ($obj[$type] as $dt) { array_push($setVal, new $class($dt, $subTypes)); } $this->_data[ChargeBee_Util::toCamelCaseFromUnderscore($type)] = $setVal; } return $this; }
public static function setAccountCredits($id, $params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers", $id, "set_account_credits"), $params, $env, $headers); }
public static function update($params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("addresses"), $params, $env, $headers); }
public static function recordPayment($id, $params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("invoices", $id, "record_payment"), $params, $env, $headers); }
public static function chargeAddonAtTermEnd($id, $params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("subscriptions", $id, "charge_addon_at_term_end"), $params, $env, $headers); }
public static function activate($id, $params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("portal_sessions", $id, "activate"), $params, $env, $headers); }
public static function creditNotesForCustomer($id, $params = array(), $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("customers", $id, "credit_notes"), $params, $env, $headers); }
public static function ordersForInvoice($id, $params = array(), $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("invoices", $id, "orders"), $params, $env, $headers); }
public static function copy($params, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("coupons", "copy"), $params, $env, $headers); }
public static function delete($id, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("addons", $id, "delete"), array(), $env, $headers); }
function testToUnderscoreFromCamelCase() { $before = "testString"; $after = "test_string"; $this->assertEqual($after, ChargeBee_Util::toUnderscoreFromCamelCase($before)); }
public static function archive($id, $env = null, $headers = array()) { return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("coupon_codes", $id, "archive"), array(), $env, $headers); }