Class: Omnipay::Signer
- Inherits:
-
Object
- Object
- Omnipay::Signer
- Defined in:
- lib/omnipay/signer.rb
Instance Method Summary collapse
-
#initialize(transaction_id, amount, context) ⇒ Signer
constructor
A new instance of Signer.
-
#secret_token ⇒ Object
Unique key : to configure globally.
- #signature ⇒ Object
Constructor Details
#initialize(transaction_id, amount, context) ⇒ Signer
Returns a new instance of Signer.
9 10 11 12 13 |
# File 'lib/omnipay/signer.rb', line 9 def initialize(transaction_id, amount, context) @transaction_id = transaction_id @amount = amount @context = context || {} end |
Instance Method Details
#secret_token ⇒ Object
Unique key : to configure globally
22 23 24 |
# File 'lib/omnipay/signer.rb', line 22 def secret_token Omnipay.configuration.secret_token end |
#signature ⇒ Object
15 16 17 18 |
# File 'lib/omnipay/signer.rb', line 15 def signature to_sign = "#{secret_token}:#{@transaction_id}:#{@amount}:#{self.class.hash_to_string @context}" CGI.escape(Base64.encode64(OpenSSL::HMAC.digest('sha1', secret_token, to_sign))) end |