CashBalance.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * A customer's <code>Cash balance</code> represents real funds. Customers can add
  6. * funds to their cash balance by sending a bank transfer. These funds can be used
  7. * for payment and can eventually be paid out to your bank account.
  8. *
  9. * @property string $object String representing the object's type. Objects of the same type share the same value.
  10. * @property null|\Stripe\StripeObject $available A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
  11. * @property string $customer The ID of the customer whose cash balance this object represents.
  12. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
  13. * @property \Stripe\StripeObject $settings
  14. */
  15. class CashBalance extends ApiResource
  16. {
  17. const OBJECT_NAME = 'cash_balance';
  18. /**
  19. * @return string the API URL for this balance transaction
  20. */
  21. public function instanceUrl()
  22. {
  23. $customer = $this['customer'];
  24. $customer = Util\Util::utf8($customer);
  25. $base = Customer::classUrl();
  26. $customerExtn = \urlencode($customer);
  27. return "{$base}/{$customerExtn}/cash_balance";
  28. }
  29. /**
  30. * @param array|string $_id
  31. * @param null|array|string $_opts
  32. *
  33. * @throws \Stripe\Exception\BadMethodCallException
  34. */
  35. public static function retrieve($_id, $_opts = null)
  36. {
  37. $msg = 'Customer Cash Balance cannot be retrieved without a ' .
  38. 'customer ID. Retrieve a Customer Cash Balance using ' .
  39. "`Customer::retrieveCashBalance('customer_id')`.";
  40. throw new Exception\BadMethodCallException($msg);
  41. }
  42. /**
  43. * @param string $_id
  44. * @param null|array $_params
  45. * @param null|array|string $_options
  46. *
  47. * @throws \Stripe\Exception\BadMethodCallException
  48. */
  49. public static function update($_id, $_params = null, $_options = null)
  50. {
  51. $msg = 'Customer Cash Balance cannot be updated without a ' .
  52. 'customer ID. Retrieve a Customer Cash Balance using ' .
  53. "`Customer::updateCashBalance('customer_id')`.";
  54. throw new Exception\BadMethodCallException($msg);
  55. }
  56. }