Skip to content

Commit

Permalink
Merge branch 'fix-pxpay-merchant-references'
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Simpson committed Apr 1, 2013
2 parents f7ab064 + e4739ff commit 859fdcd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/active_merchant/billing/integrations/pxpay/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate_request
root = xml.add_element('GenerateRequest')

@fields.each do | k, v |
v = v.slice(0, 50) if k == "MerchantReference"
root.add_element(k).text = v
end

Expand Down
6 changes: 6 additions & 0 deletions test/remote/integrations/remote_pxpay_integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ def setup
@helper = Pxpay::Helper.new('500', @options[:login], :amount => "120.99", :currency => 'USD', :credential2 => @options[:password])
end

def test_merchant_references_longer_than_50_characters_should_be_trimmed
@helper.description = "more than 50 chars--------------------40--------50---55"
request = @helper.send(:generate_request)
assert_match /<MerchantReference>more than 50 chars--------------------40--------50<\/MerchantReference>/, request
end

def test_valid_credentials_returns_secure_token
@helper.return_url "http://t/pxpay/return_url"
@helper.cancel_return_url "http://t/pxpay/cancel_url"
Expand Down

0 comments on commit 859fdcd

Please sign in to comment.