BraintreePaymentMethodNonceGateway

Creates and manages Braintree PaymentMethodNonces.

Defined (1)

The class is defined in the following location(s).

/includes/lib/Braintree/lib/Braintree/PaymentMethodNonceGateway.php  
  1. class PaymentMethodNonceGateway 
  2. private $_gateway; 
  3. private $_config; 
  4. private $_http; 
  5.  
  6. public function __construct($gateway) 
  7. $this->_gateway = $gateway; 
  8. $this->_config = $gateway->config; 
  9. $this->_http = new Http($gateway->config); 
  10.  
  11.  
  12. public function create($token) 
  13. $subPath = '/payment_methods/' . $token . '/nonces'; 
  14. $fullPath = $this->_config->merchantPath() . $subPath; 
  15. $response = $this->_http->post($fullPath); 
  16.  
  17. return new Result\Successful( 
  18. PaymentMethodNonce::factory($response['paymentMethodNonce']),  
  19. "paymentMethodNonce" 
  20. ); 
  21.  
  22. /** 
  23. * @access public 
  24. */ 
  25. public function find($nonce) 
  26. try { 
  27. $path = $this->_config->merchantPath() . '/payment_method_nonces/' . $nonce; 
  28. $response = $this->_http->get($path); 
  29. return PaymentMethodNonce::factory($response['paymentMethodNonce']); 
  30. } catch (Exception\NotFound $e) { 
  31. throw new Exception\NotFound( 
  32. 'payment method nonce with id ' . $nonce . ' not found' 
  33. ); 
  34.