module Adyen::API::PaymentService::TestHelpers
A collection of test helpers that create and assign stubbed response instances for a subsequent remote call.
This module extends the {PaymentService} class and thus these methods are callable on it.
Constants
- AUTHORISATION_REFUSED_RESPONSE
- AUTHORISATION_REQUEST_INVALID_RESPONSE
- AUTHORISE_RESPONSE
Public Instance Methods
@return [AuthorisationResponse] An ‘invalid request’ response instance.
# File lib/adyen/api/test_helpers.rb 69 def invalid_stub 70 http_response = Net::HTTPOK.new('1.1', '200', 'OK') 71 def http_response.body; AUTHORISATION_REQUEST_INVALID_RESPONSE; end 72 PaymentService::AuthorisationResponse.new(http_response) 73 end
@return [AuthorisationResponse] An authorisation refused response instance.
# File lib/adyen/api/test_helpers.rb 62 def refused_stub 63 http_response = Net::HTTPOK.new('1.1', '200', 'OK') 64 def http_response.body; AUTHORISATION_REFUSED_RESPONSE; end 65 PaymentService::AuthorisationResponse.new(http_response) 66 end
Assigns a {#invalid_stub}, meaning the subsequent authoristaion request will be refused, because the request was invalid.
@return [AuthorisationResponse] An ‘invalid request’ response instance.
# File lib/adyen/api/test_helpers.rb 93 def stub_invalid! 94 @stubbed_response = invalid_stub 95 end
Assigns a {#refused_stub}, meaning the subsequent authoristaion request will be refused.
@return [AuthorisationResponse] An authorisation refused response instance.
# File lib/adyen/api/test_helpers.rb 85 def stub_refused! 86 @stubbed_response = refused_stub 87 end
Assigns a {#success_stub}, meaning the subsequent authoristaion request will be authorised.
@return [AuthorisationResponse] A authorisation succeeded response instance.
# File lib/adyen/api/test_helpers.rb 78 def stub_success! 79 @stubbed_response = success_stub 80 end
@return [AuthorisationResponse] A authorisation succeeded response instance.
# File lib/adyen/api/test_helpers.rb 55 def success_stub 56 http_response = Net::HTTPOK.new('1.1', '200', 'OK') 57 def http_response.body; AUTHORISE_RESPONSE; end 58 PaymentService::AuthorisationResponse.new(http_response) 59 end