本文整理汇总了PHP中Stripe_ApiRequestor类的典型用法代码示例。如果您正苦于以下问题:PHP Stripe_ApiRequestor类的具体用法?PHP Stripe_ApiRequestor怎么用?PHP Stripe_ApiRequestor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stripe_ApiRequestor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transactions
public function transactions($params = null)
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/transactions';
list($response, $apiKey) = $requestor->request('get', $url, $params);
return Stripe_Util::convertToStripeObject($response, $apiKey);
}
示例2: upcoming
public static function upcoming($params = null, $apiKey = null)
{
$requestor = new Stripe_ApiRequestor($apiKey);
$url = self::classUrl(get_class()) . '/upcoming';
list($response, $apiKey) = $requestor->request('get', $url, $params);
return Stripe_Util::convertToStripeObject($response, $apiKey);
}
示例3: deleteDiscount
/**
* @return Stripe_Subscription The updated subscription.
*/
public function deleteDiscount()
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/discount';
list($response, $apiKey) = $requestor->request('delete', $url);
$this->refreshFrom(array('discount' => null), $apiKey, true);
}
示例4: cancelSubscription
public function cancelSubscription($params = null)
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/subscription';
list($response, $apiKey) = $requestor->request('delete', $url, $params);
$this->refreshFrom(array('subscription' => $response), $apiKey, true);
return $this->subscription;
}
示例5: closeDispute
public function closeDispute()
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/dispute/close';
list($response, $apiKey) = $requestor->request('post', $url);
$this->refreshFrom($response, $apiKey);
return $this;
}
示例6: updateDispute
public function updateDispute($params = null)
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/dispute';
list($response, $apiKey) = $requestor->request('post', $url, $params);
$this->refreshFrom(array('dispute' => $response), $apiKey, true);
return $this->dispute;
}
示例7: capture
public function capture($params = null)
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl() . '/capture';
list($response, $apiKey) = $requestor->request('post', $url, $params);
$this->refreshFrom($response, $apiKey);
return $this;
}
示例8: retrieve
public function retrieve($id, $params = null)
{
list($url, $params) = $this->extractPathAndUpdateParams($params);
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$id = Stripe_ApiRequestor::utf8($id);
$extn = urlencode($id);
list($response, $apiKey) = $requestor->request('get', "{$url}/{$extn}", $params);
return Stripe_Util::convertToStripeObject($response, $apiKey);
}
示例9: retrieve
public function retrieve($id, $params = null)
{
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$base = $this['url'];
$id = Stripe_ApiRequestor::utf8($id);
$extn = urlencode($id);
list($response, $apiKey) = $requestor->request('get', "{$base}/{$extn}", $params);
return Stripe_Util::convertToStripeObject($response, $apiKey);
}
示例10: markAsSafe
public function markAsSafe()
{
$params = array('fraud_details' => array('user_report' => 'safe'));
$requestor = new Stripe_ApiRequestor($this->_apiKey);
$url = $this->instanceUrl();
list($response, $apiKey) = $requestor->request('post', $url, $params);
$this->refreshFrom($response, $apiKey);
return $this;
}
示例11: instanceUrl
/**
* @return string The instance URL for this resource. It needs to be special
* cased because it doesn't fit into the standard resource pattern.
*/
public function instanceUrl()
{
$id = $this['id'];
if (!$id) {
$class = get_class($this);
$msg = "Could not determine which URL to request: {$class} instance " . "has invalid ID: {$id}";
throw new Stripe_InvalidRequestError($msg, null);
}
if (isset($this['customer'])) {
$parent = $this['customer'];
$base = self::classUrl('Stripe_Customer');
} else {
if (isset($this['recipient'])) {
$parent = $this['recipient'];
$base = self::classUrl('Stripe_Recipient');
} else {
return null;
}
}
$parent = Stripe_ApiRequestor::utf8($parent);
$id = Stripe_ApiRequestor::utf8($id);
$parentExtn = urlencode($parent);
$extn = urlencode($id);
return "{$base}/{$parentExtn}/cards/{$extn}";
}
示例12: testEncode
public function testEncode()
{
$a = array('my' => 'value', 'that' => array('your' => 'example'), 'bar' => 1, 'baz' => null);
$enc = Stripe_ApiRequestor::encode($a);
$this->assertEqual($enc, 'my=value&that%5Byour%5D=example&bar=1');
$a = array('that' => array('your' => 'example', 'foo' => null));
$enc = Stripe_ApiRequestor::encode($a);
$this->assertEqual($enc, 'that%5Byour%5D=example');
}
示例13: testUtf8
public function testUtf8()
{
// UTF-8 string
$x = "é";
$this->assertEqual(Stripe_ApiRequestor::utf8($x), $x);
// Latin-1 string
$x = "é";
$this->assertEqual(Stripe_ApiRequestor::utf8($x), "é");
// Not a string
$x = TRUE;
$this->assertEqual(Stripe_ApiRequestor::utf8($x), $x);
}
示例14: instanceUrl
public function instanceUrl()
{
$id = $this['id'];
$fee = $this['fee'];
if (!$id) {
throw new Stripe_InvalidRequestError("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null);
}
$id = Stripe_ApiRequestor::utf8($id);
$fee = Stripe_ApiRequestor::utf8($fee);
$base = self::classUrl('Stripe_ApplicationFee');
$feeExtn = urlencode($fee);
$extn = urlencode($id);
return "{$base}/{$feeExtn}/refunds/{$extn}";
}
示例15: instanceUrl
public function instanceUrl()
{
$id = $this['id'];
$customer = $this['customer'];
$class = get_class($this);
if (!$id) {
throw new Stripe_InvalidRequestError("Could not determine which URL to request: {$class} instance has invalid ID: {$id}", null);
}
$id = Stripe_ApiRequestor::utf8($id);
$customer = Stripe_ApiRequestor::utf8($customer);
$base = self::classUrl('Stripe_Customer');
$customerExtn = urlencode($customer);
$extn = urlencode($id);
return "{$base}/{$customerExtn}/cards/{$extn}";
}