Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Update IPNs URL #347

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/offsite_payments/integrations/paxum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def self.notification(query_string, options = {})

module Common
def generate_signature_string
@raw_post.slice!(0) if @raw_post.starts_with?("&")
@raw_post.slice!(0) if @raw_post.start_with?("&")
@raw_post = CGI.unescape(@raw_post)
@raw_post = "&#{@raw_post}" unless @raw_post.starts_with?("&")
@raw_post = "&#{@raw_post}" unless @raw_post.start_with?("&")
arr = @raw_post.split('&')
arr.delete(arr.last)
data = arr.join('&')
Expand Down
6 changes: 4 additions & 2 deletions lib/offsite_payments/integrations/paypal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module Integrations #:nodoc:
module Paypal
# Overwrite this if you want to change the Paypal test url
mattr_accessor :test_url
self.test_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
self.test_url = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'

# Overwrite this if you want to change the Paypal production url
# NOTE: https://www.paypal.com/ returns dynamic IP addresse.
# Please refer to <https://www.paypal.com/us/smarthelp/article/what-are-the-ip-addresses-for-live-paypal-servers-ts1056>
mattr_accessor :production_url
self.production_url = 'https://www.paypal.com/cgi-bin/webscr'
self.production_url = 'https://ipnpb.paypal.com/cgi-bin/webscr'

def self.service_url
mode = OffsitePayments.mode
Expand Down
4 changes: 2 additions & 2 deletions test/unit/integrations/paypal/paypal_module_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def test_notification_method

def test_test_mode
OffsitePayments.mode = :test
assert_equal 'https://www.sandbox.paypal.com/cgi-bin/webscr', Paypal.service_url
assert_equal 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr', Paypal.service_url
end

def test_production_mode
OffsitePayments.mode = :production
assert_equal 'https://www.paypal.com/cgi-bin/webscr', Paypal.service_url
assert_equal 'https://ipnpb.paypal.com/cgi-bin/webscr', Paypal.service_url
ensure
OffsitePayments.mode = :test
end
Expand Down