activemerchant / offsite_payments

A simple and unified API to handle dozens of different offsite payment pages.
MIT License
169 stars 200 forks source link

[Bugfix] Update molpay.rb #316

Closed jimanx2 closed 5 years ago

jimanx2 commented 5 years ago

This PR includes fix for a bug where incorrect signature being generated due to urlencoded paydate field. Also fixed warning from unit test where there is unmatched indent in test/unit/integrations/molpay/molpay_helper_test.rb file.

Test Run Result:

$ bundle exec rake
/home/haziman/.rbenv/versions/2.6.1/bin/ruby -w -I"lib:test" -I"/home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.0/lib" "/home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.0/lib/rake/rake_test_loader.rb" "test/unit/integrations/molpay/molpay_helper_test.rb" "test/unit/integrations/molpay/molpay_module_test.rb" "test/unit/integrations/molpay/molpay_notification_test.rb" "test/unit/integrations/molpay/molpay_return_test.rb"
/home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/activesupport-5.1.5/lib/active_support/core_ext/hash/slice.rb:21: warning: method redefined; discarding
old slice
Loaded suite /home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-12.3.0/lib/rake/rake_test_loader
Started
/home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/active_utils-3.3.16/lib/active_utils/connection.rb:26: warning: method redefined; discarding old retry_safe
/home/haziman/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/active_utils-3.3.16/lib/active_utils/connection.rb:26: warning: method redefined; discarding old retry_safe=
..............................
Finished in 0.5212705 seconds.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------30 tests, 62 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
---------------------------------------------------------------------------------------------------------------------------------------------------------------------57.55 tests/s, 118.94 assertions/s

Real-world Testing:

Using the following code:

image

Before fix is applied:

image

Test using urlencoded paydate:

image

Test using non-urlencoded paydate:

image

jimanx2 commented 5 years ago

After deep checking on our codebase, this scenario does not actually happen. Which means, the parameters is being sent correctly.

Due to this, I am going to close/cancel this pull request. Thanks.