AlipayAccount.php 2.2 KB

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