From 5935cc691732a29312a545f6bcce23bb8346d708 Mon Sep 17 00:00:00 2001 From: Alma Malambo Date: Mon, 30 Dec 2024 11:21:53 -0600 Subject: [PATCH] CommerceHub: Update merchantInvoiceNumber & merchantTransactionId MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update merchantTransactionId to be a random number and merchantInvoiceNumber to be the order_id. Remove account_verification, primary_transaction_type and merchant_invoice_number since they are not in use. Remote
36 tests, 97 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 97.2222% passed --- lib/active_merchant/billing/gateways/commerce_hub.rb | 12 ++++-------- test/remote/gateways/remote_commerce_hub_test.rb | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/active_merchant/billing/gateways/commerce_hub.rb b/lib/active_merchant/billing/gateways/commerce_hub.rb index 97f979c7e8d..4a352c2536d 100644 --- a/lib/active_merchant/billing/gateways/commerce_hub.rb +++ b/lib/active_merchant/billing/gateways/commerce_hub.rb @@ -154,16 +154,12 @@ def add_transaction_details(post, options, action = nil) physicalGoodsIndicator: [true, 'true'].include?(options[:physical_goods_indicator]) } - if options[:order_id].present? && action == 'sale' - details[:merchantOrderId] = options[:order_id] - details[:merchantTransactionId] = options[:order_id] + if action == 'sale' + details[:merchantOrderId] = options[:order_id] if options[:order_id] + details[:merchantTransactionId] = rand.to_s[2..13] end - if action != 'capture' - details[:merchantInvoiceNumber] = options[:merchant_invoice_number] || rand.to_s[2..13] - details[:primaryTransactionType] = options[:primary_transaction_type] - details[:accountVerification] = options[:account_verification] - end + details[:merchantInvoiceNumber] = options[:order_id] if action != 'capture' post[:transactionDetails] = details.compact end diff --git a/test/remote/gateways/remote_commerce_hub_test.rb b/test/remote/gateways/remote_commerce_hub_test.rb index 5960028b831..ad6aadcb814 100644 --- a/test/remote/gateways/remote_commerce_hub_test.rb +++ b/test/remote/gateways/remote_commerce_hub_test.rb @@ -174,7 +174,7 @@ def test_successful_purchase_with_failed_avs_cvv_response_codes assert_equal 'Approved', response.message assert_equal 'X', response.cvv_result['code'] assert_equal 'CVV check not supported for card', response.cvv_result['message'] - assert_nil response.avs_result['code'] + assert_equal 'Y', response.avs_result['code'] end def test_successful_purchase_with_billing_and_shipping