test/razorpay/test_utility.rb in razorpay-2.4.1 vs test/razorpay/test_utility.rb in razorpay-3.0.0
- old
+ new
@@ -19,9 +19,41 @@
assert_raises(SecurityError) do
Razorpay::Utility.verify_payment_signature(payment_response)
end
end
+ def test_payment_link_signature_verification_exception
+
+ payment_response = {
+ payment_link_id: 'fake_razorpay_payment_link_id',
+ payment_link_reference_id: 'fake_reference_id',
+ payment_link_status: 'paid',
+ razorpay_payment_id: 'pay_IH3d0ara9bSsjQ',
+ razorpay_signature: 'b8a6acda585c9b74e9da393c7354c7e685e37e69d30ae654730f042e674e0283'
+ }
+
+ Razorpay::Utility.verify_payment_link_signature(payment_response)
+
+ payment_response[:razorpay_signature] = '_dummy_signature' * 4
+ assert_raises(SecurityError) do
+ Razorpay::Utility.verify_payment_link_signature(payment_response)
+ end
+ end
+
+ def test_payment_link_signature_verification
+
+ payment_response = {
+ payment_link_id: 'fake_razorpay_payment_link_id',
+ payment_link_reference_id: 'fake_reference_id',
+ payment_link_status: 'paid',
+ razorpay_payment_id: 'pay_IH3d0ara9bSsjQ',
+ razorpay_signature: 'b8a6acda585c9b74e9da393c7354c7e685e37e69d30ae654730f042e674e0283'
+ }
+
+ response = Razorpay::Utility.verify_payment_link_signature(payment_response)
+ assert(response)
+ end
+
def test_subscription_signature_verification
payment_response = {
razorpay_payment_id: 'fake_payment_id',
razorpay_subscription_id: 'fake_other_id',
razorpay_signature: '3dabcab8ca113e7994cf78c80f8d50974ddfb2d380029743f30a6d67934cd845'