lib/buckaruby/response.rb in buckaruby-1.3.1 vs lib/buckaruby/response.rb in buckaruby-1.4.0

- old
+ new

@@ -1,7 +1,9 @@ # frozen_string_literal: true +require_relative 'support/case_insensitive_hash' + require 'cgi' require 'date' module Buckaruby # Base class for any response. @@ -81,11 +83,11 @@ response end def verify_signature!(response, config) - if params[:brq_apiresult] != "Fail" + if params[:brq_apiresult].nil? || !params[:brq_apiresult].casecmp("fail").zero? sent_signature = params[:brq_signature] generated_signature = Signature.generate_signature(response, config) if sent_signature != generated_signature raise SignatureException.new(sent_signature, generated_signature) @@ -345,7 +347,22 @@ end # Response when verifying the Buckaroo callback. class CallbackResponse < Response include TransactionResponse + end + + # Response when retrieving the specification for a transaction. + class TransactionSpecificationResponse < ApiResponse + def services + @services ||= FieldMapper.map_fields(params, :brq_services) + end + + def basic_fields + @basic_fields ||= FieldMapper.map_fields(params, :brq_basicfields) + end + + def custom_parameters + @custom_parameters ||= FieldMapper.map_fields(params, :brq_customparameters) + end end end