diff --git a/CHANGELOG b/CHANGELOG index 24a5c4c0965..455feb5449c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ * Plexo: Add support to NetworkToken payments [euribe09] #5130 * Braintree: Update card verfification payload if billing address fields are not present [yunnydang] #5142 * DLocal: Update the phone and ip fields [yunnydang] #5143 +* SecurePayAU: Send order ID for payments with stored card [dacook] #3979 == Version 1.136.0 (June 3, 2024) * Shift4V2: Add new gateway based on SecurionPay adapter [heavyblade] #4860 diff --git a/lib/active_merchant/billing/gateways/secure_pay_au.rb b/lib/active_merchant/billing/gateways/secure_pay_au.rb index a23c6f65967..0e7de2a701f 100644 --- a/lib/active_merchant/billing/gateways/secure_pay_au.rb +++ b/lib/active_merchant/billing/gateways/secure_pay_au.rb @@ -207,6 +207,7 @@ def build_periodic_item(action, money, credit_card, options) end xml.tag! 'amount', amount(money) xml.tag! 'periodicType', PERIODIC_TYPES[action] if PERIODIC_TYPES[action] + xml.tag! 'transactionReference', options[:order_id] if options[:order_id] xml.target! end diff --git a/test/remote/gateways/remote_secure_pay_au_test.rb b/test/remote/gateways/remote_secure_pay_au_test.rb index 202b5f44e0c..41fefc26397 100644 --- a/test/remote/gateways/remote_secure_pay_au_test.rb +++ b/test/remote/gateways/remote_secure_pay_au_test.rb @@ -21,7 +21,7 @@ def setup @credit_card = credit_card('4242424242424242', { month: 9, year: 15 }) @options = { - order_id: '2', + order_id: 'order123', billing_address: address, description: 'Store Purchase' } @@ -166,6 +166,7 @@ def test_successful_triggered_payment assert response = @gateway.purchase(12300, 'test1234', @options) assert_success response assert_equal response.params['amount'], '12300' + assert_equal response.params['ponum'], 'order123' assert_equal 'Approved', response.message end diff --git a/test/unit/gateways/secure_pay_au_test.rb b/test/unit/gateways/secure_pay_au_test.rb index 4bbd0213712..88f9a83f32c 100644 --- a/test/unit/gateways/secure_pay_au_test.rb +++ b/test/unit/gateways/secure_pay_au_test.rb @@ -13,7 +13,7 @@ def setup @amount = 100 @options = { - order_id: '1', + order_id: 'order123', billing_address: address, description: 'Store Purchase' } @@ -79,6 +79,14 @@ def test_purchase_with_stored_id_calls_commit_periodic @gateway.purchase(@amount, '123', @options) end + def test_periodic_payment_submits_order_id + stub_comms(@gateway, :ssl_request) do + @gateway.purchase(@amount, '123', @options) + end.check_request do |method, endpoint, data, headers| + assert_match(/order123<\/transactionReference>/, data) + end.respond_with(successful_purchase_response) + end + def test_purchase_with_creditcard_calls_commit_with_purchase @gateway.expects(:commit).with(:purchase, anything)