PaymentMethodNonce.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Braintree;
  3. /**
  4. * Braintree PaymentMethodNonce module
  5. *
  6. * @package Braintree
  7. * @category Resources
  8. */
  9. /**
  10. * Creates and manages Braintree PaymentMethodNonces
  11. *
  12. * <b>== More information ==</b>
  13. *
  14. *
  15. * @package Braintree
  16. * @category Resources
  17. */
  18. class PaymentMethodNonce extends Base
  19. {
  20. // static methods redirecting to gateway
  21. public static function create($token)
  22. {
  23. return Configuration::gateway()->paymentMethodNonce()->create($token);
  24. }
  25. public static function find($nonce)
  26. {
  27. return Configuration::gateway()->paymentMethodNonce()->find($nonce);
  28. }
  29. public static function factory($attributes)
  30. {
  31. $instance = new self();
  32. $instance->_initialize($attributes);
  33. return $instance;
  34. }
  35. protected function _initialize($nonceAttributes)
  36. {
  37. $this->_attributes = $nonceAttributes;
  38. $this->_set('nonce', $nonceAttributes['nonce']);
  39. $this->_set('type', $nonceAttributes['type']);
  40. if(isset($nonceAttributes['threeDSecureInfo'])) {
  41. $this->_set('threeDSecureInfo', ThreeDSecureInfo::factory($nonceAttributes['threeDSecureInfo']));
  42. }
  43. if(isset($nonceAttributes['binData'])) {
  44. $this->_set('binData', BinData::factory($nonceAttributes['binData']));
  45. }
  46. }
  47. }
  48. class_alias('Braintree\PaymentMethodNonce', 'Braintree_PaymentMethodNonce');