BraintreeTestingGateway

The PayPal for WooCommerce Braintree TestingGateway class.

Defined (1)

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

/classes/lib/Braintree/Braintree/TestingGateway.php  
  1. final class TestingGateway 
  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($this->_config); 
  10.  
  11. public function settle($transactionId) 
  12. return self::_doTestRequest('/settle', $transactionId); 
  13.  
  14. public function settlementPending($transactionId) 
  15. return self::_doTestRequest('/settlement_pending', $transactionId); 
  16.  
  17. public function settlementConfirm($transactionId) 
  18. return self::_doTestRequest('/settlement_confirm', $transactionId); 
  19.  
  20. public function settlementDecline($transactionId) 
  21. return self::_doTestRequest('/settlement_decline', $transactionId); 
  22.  
  23. private function _doTestRequest($testPath, $transactionId) 
  24. self::_checkEnvironment(); 
  25. $path = $this->_config->merchantPath() . '/transactions/' . $transactionId . $testPath; 
  26. $response = $this->_http->put($path); 
  27. return Transaction::factory($response['transaction']); 
  28.  
  29. private function _checkEnvironment() 
  30. if (Configuration::$global->getEnvironment() === 'production') { 
  31. throw new Exception\TestOperationPerformedInProduction();