Class: Braintree::TestingGateway
- Inherits:
-
Object
- Object
- Braintree::TestingGateway
- Defined in:
- lib/braintree/testing_gateway.rb
Instance Method Summary collapse
- #check_environment ⇒ Object
-
#initialize(gateway) ⇒ TestingGateway
constructor
A new instance of TestingGateway.
- #settle(transaction_id) ⇒ Object
- #settlement_confirm(transaction_id) ⇒ Object
- #settlement_decline(transaction_id) ⇒ Object
- #settlement_pending(transaction_id) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ TestingGateway
Returns a new instance of TestingGateway.
4 5 6 7 8 9 |
# File 'lib/braintree/testing_gateway.rb', line 4 def initialize(gateway) @gateway = gateway @config = gateway.config @config.assert_has_access_token_or_keys @transaction_gateway = TransactionGateway.new(gateway) end |
Instance Method Details
#check_environment ⇒ Object
39 40 41 |
# File 'lib/braintree/testing_gateway.rb', line 39 def check_environment raise TestOperationPerformedInProduction if @config.environment == :production end |
#settle(transaction_id) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/braintree/testing_gateway.rb', line 11 def settle(transaction_id) check_environment response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settle") @transaction_gateway._handle_transaction_response(response) end |
#settlement_confirm(transaction_id) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/braintree/testing_gateway.rb', line 18 def settlement_confirm(transaction_id) check_environment response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_confirm") @transaction_gateway._handle_transaction_response(response) end |
#settlement_decline(transaction_id) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/braintree/testing_gateway.rb', line 25 def settlement_decline(transaction_id) check_environment response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_decline") @transaction_gateway._handle_transaction_response(response) end |
#settlement_pending(transaction_id) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/braintree/testing_gateway.rb', line 32 def settlement_pending(transaction_id) check_environment response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/settlement_pending") @transaction_gateway._handle_transaction_response(response) end |