mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
Add plugins Stripe
This commit is contained in:
85
htdocs/includes/stripe/lib/BitcoinReceiver.php
Normal file
85
htdocs/includes/stripe/lib/BitcoinReceiver.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Stripe;
|
||||
|
||||
/**
|
||||
* Class BitcoinReceiver
|
||||
*
|
||||
* @package Stripe
|
||||
*/
|
||||
class BitcoinReceiver extends ExternalAccount
|
||||
{
|
||||
/**
|
||||
* @return string The class URL for this resource. It needs to be special
|
||||
* cased because it doesn't fit into the standard resource pattern.
|
||||
*/
|
||||
public static function classUrl()
|
||||
{
|
||||
return "/v1/bitcoin/receivers";
|
||||
}
|
||||
|
||||
/**
|
||||
* @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()
|
||||
{
|
||||
$result = parent::instanceUrl();
|
||||
if ($result) {
|
||||
return $result;
|
||||
} else {
|
||||
$id = $this['id'];
|
||||
$id = Util\Util::utf8($id);
|
||||
$extn = urlencode($id);
|
||||
$base = BitcoinReceiver::classUrl();
|
||||
return "$base/$extn";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id The ID of the Bitcoin Receiver to retrieve.
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return BitcoinReceiver
|
||||
*/
|
||||
public static function retrieve($id, $opts = null)
|
||||
{
|
||||
return self::_retrieve($id, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return Collection of BitcoinReceivers
|
||||
*/
|
||||
public static function all($params = null, $opts = null)
|
||||
{
|
||||
return self::_all($params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $opts
|
||||
*
|
||||
* @return BitcoinReceiver The created Bitcoin Receiver item.
|
||||
*/
|
||||
public static function create($params = null, $opts = null)
|
||||
{
|
||||
return self::_create($params, $opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $params
|
||||
* @param array|string|null $options
|
||||
*
|
||||
* @return BitcoinReceiver The refunded Bitcoin Receiver item.
|
||||
*/
|
||||
public function refund($params = null, $options = null)
|
||||
{
|
||||
$url = $this->instanceUrl() . '/refund';
|
||||
list($response, $opts) = $this->_request('post', $url, $params, $options);
|
||||
$this->refreshFrom($response, $opts);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user