AmexExpressCheckoutCard.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace Braintree;
  3. /**
  4. * Braintree AmexExpressCheckoutCard module
  5. * Creates and manages Braintree Amex Express Checkout cards
  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 $cardType
  19. * @property-read string $bin
  20. * @property-read string $cardMemberExpiryDate
  21. * @property-read string $cardMemberNumber
  22. * @property-read string $sourceDescription
  23. * @property-read string $token
  24. * @property-read string $imageUrl
  25. * @property-read string $expirationMonth
  26. * @property-read string $expirationYear
  27. */
  28. class AmexExpressCheckoutCard extends Base
  29. {
  30. /* instance methods */
  31. /**
  32. * returns false if default is null or false
  33. *
  34. * @return boolean
  35. */
  36. public function isDefault()
  37. {
  38. return $this->default;
  39. }
  40. /**
  41. * factory method: returns an instance of AmexExpressCheckoutCard
  42. * to the requesting method, with populated properties
  43. *
  44. * @ignore
  45. * @return AmexExpressCheckoutCard
  46. */
  47. public static function factory($attributes)
  48. {
  49. $instance = new self();
  50. $instance->_initialize($attributes);
  51. return $instance;
  52. }
  53. /**
  54. * sets instance properties from an array of values
  55. *
  56. * @access protected
  57. * @param array $amexExpressCheckoutCardAttribs array of Amex Express Checkout card properties
  58. * @return void
  59. */
  60. protected function _initialize($amexExpressCheckoutCardAttribs)
  61. {
  62. // set the attributes
  63. $this->_attributes = $amexExpressCheckoutCardAttribs;
  64. $subscriptionArray = [];
  65. if (isset($amexExpressCheckoutCardAttribs['subscriptions'])) {
  66. foreach ($amexExpressCheckoutCardAttribs['subscriptions'] AS $subscription) {
  67. $subscriptionArray[] = Subscription::factory($subscription);
  68. }
  69. }
  70. $this->_set('subscriptions', $subscriptionArray);
  71. }
  72. }
  73. class_alias('Braintree\AmexExpressCheckoutCard', 'Braintree_AmexExpressCheckoutCard');