Sha256: 8cd8362b2df5fda008267e4e0b580b33bc2c430e6ec73625f8530cb9fbd78f86
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'test_helper' module Razorpay # Tests for Razorpay::Utility class RazorpayUtilityTest < Minitest::Test def setup Razorpay.setup('key_id', 'key_secret') end def test_payment_signature_verification payment_response = { razorpay_order_id: 'fake_order_id', razorpay_payment_id: 'fake_payment_id', razorpay_signature: 'b2335e3b0801106b84a7faff035df56ecffde06918c9ddd1f0fafbb37a51cc89' } Razorpay::Utility.verify_payment_signature(payment_response) payment_response[:razorpay_signature] = '_dummy_signature' * 4 assert_raises(SecurityError) do Razorpay::Utility.verify_payment_signature(payment_response) end end def test_webhook_signature_verification webhook_body = fixture_file('fake_payment_authorized_webhook') secret = 'chosen_webhook_secret' signature = 'dda9ca344c56ccbd90167b1be0fd99dfa92fe2b827020f27e2a46024e31c7c99' Razorpay::Utility.verify_webhook_signature(webhook_body, signature, secret) signature = '_dummy_signature' * 4 assert_raises(SecurityError) do Razorpay::Utility.verify_webhook_signature(webhook_body, signature, secret) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
razorpay-2.2.0 | test/razorpay/test_utility.rb |
razorpay-2.1.0 | test/razorpay/test_utility.rb |
razorpay-2.1.0.pre | test/razorpay/test_utility.rb |
razorpay-2.0.1 | test/razorpay/test_utility.rb |