Class: Razorpay::Utility

Inherits:
Object
  • Object
show all
Defined in:
lib/razorpay/utility.rb

Overview

Helper functions are defined here

Class Method Summary collapse

Class Method Details

.verify_payment_signature(attributes) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/razorpay/utility.rb', line 6

def self.verify_payment_signature(attributes)
  signature = attributes.delete(:razorpay_signature)

  # Data requires the values to be in sorted order of their keys.
  # attributes.sort returns a nested array, and the last
  # element of each is the value. These are joined.
  data = attributes.sort.map(&:last).join('|')

  secret = Razorpay.auth[:password]

  verify_signature(data, signature, secret)
end

.verify_webhook_signature(body, signature, secret) ⇒ Object



19
20
21
# File 'lib/razorpay/utility.rb', line 19

def self.verify_webhook_signature(body, signature, secret)
  verify_signature(body, signature, secret)
end