VenmoAccount.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace Braintree;
  3. /**
  4. * Braintree VenmoAccount module
  5. * Creates and manages Braintree Venmo accounts
  6. *
  7. * <b>== More information ==</b>
  8. *
  9. * See {@link https://developers.braintreepayments.com/javascript+php}<br />
  10. *
  11. * @package Braintree
  12. * @category Resources
  13. *
  14. * @property-read string $createdAt
  15. * @property-read string $default
  16. * @property-read string $updatedAt
  17. * @property-read string $customerId
  18. * @property-read string $sourceDescription
  19. * @property-read string $token
  20. * @property-read string $imageUrl
  21. * @property-read string $username
  22. * @property-read string $venmoUserId
  23. */
  24. class VenmoAccount extends Base
  25. {
  26. /* instance methods */
  27. /**
  28. * returns false if default is null or false
  29. *
  30. * @return boolean
  31. */
  32. public function isDefault()
  33. {
  34. return $this->default;
  35. }
  36. /**
  37. * factory method: returns an instance of VenmoAccount
  38. * to the requesting method, with populated properties
  39. *
  40. * @ignore
  41. * @return VenmoAccount
  42. */
  43. public static function factory($attributes)
  44. {
  45. $instance = new self();
  46. $instance->_initialize($attributes);
  47. return $instance;
  48. }
  49. /**
  50. * sets instance properties from an array of values
  51. *
  52. * @access protected
  53. * @param array $venmoAccountAttribs array of Venmo account properties
  54. * @return void
  55. */
  56. protected function _initialize($venmoAccountAttribs)
  57. {
  58. $this->_attributes = $venmoAccountAttribs;
  59. $subscriptionArray = array();
  60. if (isset($venmoAccountAttribs['subscriptions'])) {
  61. foreach ($venmoAccountAttribs['subscriptions'] AS $subscription) {
  62. $subscriptionArray[] = Subscription::factory($subscription);
  63. }
  64. }
  65. $this->_set('subscriptions', $subscriptionArray);
  66. }
  67. }
  68. class_alias('Braintree\VenmoAccount', 'Braintree_VenmoAccount');