dolibarr/htdocs/includes/stripe/stripe-php/lib/AlipayAccount.php

76 lines
2.3 KiB
PHP
Raw Normal View History

2017-04-18 05:44:08 +02:00
<?php
namespace Stripe;
/**
2021-01-03 23:37:44 +01:00
* Class AlipayAccount.
2018-03-06 13:52:56 +01:00
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
2021-01-03 23:37:44 +01:00
* @see https://stripe.com/docs/sources/alipay
2017-04-18 05:44:08 +02:00
*/
2018-03-06 13:52:56 +01:00
class AlipayAccount extends ApiResource
2017-04-18 05:44:08 +02:00
{
2021-01-03 23:37:44 +01:00
const OBJECT_NAME = 'alipay_account';
2019-05-03 02:22:27 +02:00
2018-03-06 13:52:56 +01:00
use ApiOperations\Delete;
use ApiOperations\Update;
/**
* @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()
{
if ($this['customer']) {
$base = Customer::classUrl();
$parent = $this['customer'];
$path = 'sources';
} else {
2021-01-03 23:37:44 +01:00
$msg = 'Alipay accounts cannot be accessed without a customer ID.';
throw new Exception\UnexpectedValueException($msg);
2018-03-06 13:52:56 +01:00
}
2021-01-03 23:37:44 +01:00
$parentExtn = \urlencode(Util\Util::utf8($parent));
$extn = \urlencode(Util\Util::utf8($this['id']));
return "{$base}/{$parentExtn}/{$path}/{$extn}";
2018-03-06 13:52:56 +01:00
}
/**
* @param array|string $_id
2021-01-03 23:37:44 +01:00
* @param null|array|string $_opts
2018-03-06 13:52:56 +01:00
*
2021-01-03 23:37:44 +01:00
* @throws \Stripe\Exception\BadMethodCallException
2018-03-06 13:52:56 +01:00
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
2021-01-03 23:37:44 +01:00
* @see https://stripe.com/docs/sources/alipay
2018-03-06 13:52:56 +01:00
*/
public static function retrieve($_id, $_opts = null)
{
2021-01-03 23:37:44 +01:00
$msg = 'Alipay accounts cannot be retrieved without a customer ID. ' .
'Retrieve an Alipay account using `Customer::retrieveSource(' .
"'customer_id', 'alipay_account_id')`.";
throw new Exception\BadMethodCallException($msg);
2018-03-06 13:52:56 +01:00
}
2017-04-18 05:44:08 +02:00
2018-03-06 13:52:56 +01:00
/**
* @param string $_id
2021-01-03 23:37:44 +01:00
* @param null|array $_params
* @param null|array|string $_options
2018-03-06 13:52:56 +01:00
*
2021-01-03 23:37:44 +01:00
* @throws \Stripe\Exception\BadMethodCallException
2018-03-06 13:52:56 +01:00
*
* @deprecated Alipay accounts are deprecated. Please use the sources API instead.
2021-01-03 23:37:44 +01:00
* @see https://stripe.com/docs/sources/alipay
2018-03-06 13:52:56 +01:00
*/
public static function update($_id, $_params = null, $_options = null)
{
2021-01-03 23:37:44 +01:00
$msg = 'Alipay accounts cannot be updated without a customer ID. ' .
'Update an Alipay account using `Customer::updateSource(' .
"'customer_id', 'alipay_account_id', \$updateParams)`.";
throw new Exception\BadMethodCallException($msg);
2018-03-06 13:52:56 +01:00
}
2017-04-18 05:44:08 +02:00
}