Skip to content

Commit

Permalink
BPoint: Hook up merchant_reference and CRN fields
Browse files Browse the repository at this point in the history
These fields were already implemented in the request structure but did
not actually get anything passed to them from options.

Closes #3249

Unit:
18 tests, 59 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote: No current test credentials, fairly confident the changes are
safe given that the fields are already present in requests, just without
a value.
  • Loading branch information
curiousepic committed Jun 19, 2019
1 parent 1ab94da commit 1c06389
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Checkout V2: Update stored card flag [curiousepic] #3247
* NMI: Add support for stored credentials [bayprogrammer] #3243
* Spreedly: Consolidate API requests and support bank accounts [lancecarlson] #3105
* BPoint: Hook up merchant_reference and CRN fields [curiousepic] #3249

== Version 1.95.0 (May 23, 2019)
* Adyen: Constantize version to fix subdomains [curiousepic] #3228
Expand Down
8 changes: 4 additions & 4 deletions lib/active_merchant/billing/gateways/bpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ def payment_xml(xml, payment_type, amount, options)
xml.send('PaymentType', payment_type)
xml.send('TxnType', 'WEB_SHOP')
xml.send('BillerCode', options.fetch(:biller_code, ''))
xml.send('MerchantReference', '')
xml.send('CRN1', '')
xml.send('CRN2', '')
xml.send('CRN3', '')
xml.send('MerchantReference', options[:order_id]) if options[:order_id]
xml.send('CRN1', options[:crn1]) if options[:crn1]
xml.send('CRN2', options[:crn2]) if options[:crn2]
xml.send('CRN3', options[:crn3]) if options[:crn3]
xml.send('Amount', amount)
end

Expand Down
6 changes: 6 additions & 0 deletions test/remote/gateways/remote_bpoint_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def test_successful_purchase
assert_equal 'Approved', response.message
end

def test_successful_purchase_with_more_options
response = @gateway.purchase(@amount, @credit_card, @options.merge({ crn1: 'ref'}))
assert_success response
assert_equal 'Approved', response.message
end

def test_failed_purchase
response = @gateway.purchase(@amount, @declined_card, @options)
assert_failure response
Expand Down
9 changes: 9 additions & 0 deletions test/unit/gateways/bpoint_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ def test_passing_biller_code
end.respond_with(successful_authorize_response)
end

def test_passing_reference_and_crn
stub_comms do
@gateway.authorize(@amount, @credit_card, @options.merge({ crn1: 'ref' }))
end.check_request do |endpoint, data, headers|
assert_match(%r(<MerchantReference>1</MerchantReference>)m, data)
assert_match(%r(<CRN1>ref</CRN1>)m, data)
end.respond_with(successful_authorize_response)
end

private

def pre_scrubbed
Expand Down

0 comments on commit 1c06389

Please sign in to comment.