AlipayAccount.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace Stripe;
  3. /**
  4. * Class AlipayAccount.
  5. *
  6. * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
  7. * @see https://stripe.com/docs/sources/alipay
  8. */
  9. class AlipayAccount extends ApiResource
  10. {
  11. const OBJECT_NAME = 'alipay_account';
  12. use ApiOperations\Delete;
  13. use ApiOperations\Update;
  14. /**
  15. * @return string The instance URL for this resource. It needs to be special
  16. * cased because it doesn't fit into the standard resource pattern.
  17. */
  18. public function instanceUrl()
  19. {
  20. if ($this['customer']) {
  21. $base = Customer::classUrl();
  22. $parent = $this['customer'];
  23. $path = 'sources';
  24. } else {
  25. $msg = 'Alipay accounts cannot be accessed without a customer ID.';
  26. throw new Exception\UnexpectedValueException($msg);
  27. }
  28. $parentExtn = \urlencode(Util\Util::utf8($parent));
  29. $extn = \urlencode(Util\Util::utf8($this['id']));
  30. return "{$base}/{$parentExtn}/{$path}/{$extn}";
  31. }
  32. /**
  33. * @param array|string $_id
  34. * @param null|array|string $_opts
  35. *
  36. * @throws \Stripe\Exception\BadMethodCallException
  37. *
  38. * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
  39. * @see https://stripe.com/docs/sources/alipay
  40. */
  41. public static function retrieve($_id, $_opts = null)
  42. {
  43. $msg = 'Alipay accounts cannot be retrieved without a customer ID. ' .
  44. 'Retrieve an Alipay account using `Customer::retrieveSource(' .
  45. "'customer_id', 'alipay_account_id')`.";
  46. throw new Exception\BadMethodCallException($msg);
  47. }
  48. /**
  49. * @param string $_id
  50. * @param null|array $_params
  51. * @param null|array|string $_options
  52. *
  53. * @throws \Stripe\Exception\BadMethodCallException
  54. *
  55. * @deprecated Alipay accounts are deprecated. Please use the sources API instead.
  56. * @see https://stripe.com/docs/sources/alipay
  57. */
  58. public static function update($_id, $_params = null, $_options = null)
  59. {
  60. $msg = 'Alipay accounts cannot be updated without a customer ID. ' .
  61. 'Update an Alipay account using `Customer::updateSource(' .
  62. "'customer_id', 'alipay_account_id', \$updateParams)`.";
  63. throw new Exception\BadMethodCallException($msg);
  64. }
  65. }