Sha256: 6116104c26d2b6e1da6925483a6392dd74c0c640a53683d4ba9121be505938f8
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require 'digest/md5' require 'active_support/core_ext/module/delegation' module Buckaroo module Ideal class ResponseSignature # @return [String] The configured merchant_key in +Buckaroo::Ideal::Config+ delegate :merchant_key, :to => Config # @return [String] The configured secret_key in +Buckaroo::Ideal::Config+ delegate :secret_key, :to => Config # @return [String] The signature that was given in the response attr_reader :signature # @return [Buckaroo::Ideal::Response] The response that was signed. attr_reader :response # @return [String] The secret key that is used to sign the order. attr_reader :secret def initialize(response, signature = '') @response = response @signature = signature end def valid? signature == generate_signature end def generate_signature salt = [ response.transaction_id, response.timestamp, merchant_key, response.invoice_number, response.reference, response.currency, to_cents(response.amount), response.status.code, to_numeric_boolean(response.test_mode), secret_key ].join Digest::MD5.hexdigest(salt) end private include Util end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buckaroo-ideal-0.0.2 | lib/buckaroo-ideal/response_signature.rb |