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

Revert "Credorax: Update OpCode for Credit transactions" #4306

Merged
merged 1 commit into from
Jan 31, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* PaySafe: Update `unstore` method and authorization for redact [ajawadmirza] #4294
* CyberSource: Add `national_tax_indicator` fields in authorize and purchase [ajawadmirza] #4299
* Credorax: Update `OpCode` for credit transactions [dsmcclain] #4279
* Credorax: Revert update made to `OpCode` [dsmcclain] #4306

== Version 1.125.0 (January 20, 2022)
* Wompi: support gateway [therufs] #4173
Expand Down
11 changes: 6 additions & 5 deletions lib/active_merchant/billing/gateways/credorax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def credit(amount, payment_method, options = {})
add_submerchant_id(post, options)
add_transaction_type(post, options)
add_processor(post, options)
add_customer_name(post, options)

commit(:credit, post)
end
Expand Down Expand Up @@ -425,7 +424,7 @@ def add_authorization_details(post, options)
capture: '3',
authorize_void: '4',
refund: '5',
credit: '35',
credit: '6',
purchase_void: '7',
refund_void: '8',
capture_void: '9',
Expand Down Expand Up @@ -466,9 +465,11 @@ def post_data(action, params, reference_action)
end

def request_action(action, reference_action)
return ACTIONS["#{reference_action}_#{action}".to_sym] if reference_action

ACTIONS[action]
if reference_action
ACTIONS["#{reference_action}_#{action}".to_sym]
else
ACTIONS[action]
end
end

def url
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_credorax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,12 @@ def test_failed_referral_cft
end

def test_successful_credit
response = @gateway.credit(@amount, @credit_card, @options.merge(first_name: 'Test', last_name: 'McTest'))
response = @gateway.credit(@amount, @credit_card, @options)
assert_success response
assert_equal 'Succeeded', response.message
end

def test_failed_credit_with_zero_amount
def test_failed_credit
response = @gateway.credit(0, @declined_card, @options)
assert_failure response
assert_equal 'Invalid amount', response.message
Expand Down
21 changes: 2 additions & 19 deletions test/unit/gateways/credorax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,23 +209,6 @@ def test_successful_credit
assert response.test?
end

def test_credit_sends_correct_action_code
stub_comms do
@gateway.credit(@amount, @credit_card)
end.check_request do |_endpoint, data, _headers|
assert_match(/O=35/, data)
end.respond_with(successful_credit_response)
end

def test_credit_sends_customer_name
stub_comms do
@gateway.credit(@amount, @credit_card, { first_name: 'Test', last_name: 'McTest' })
end.check_request do |_endpoint, data, _headers|
assert_match(/j5=Test/, data)
assert_match(/j13=McTest/, data)
end.respond_with(successful_credit_response)
end

def test_failed_credit
response = stub_comms do
@gateway.credit(@amount, @credit_card)
Expand Down Expand Up @@ -1085,11 +1068,11 @@ def failed_referral_cft_response
end

def successful_credit_response
'M=SPREE978&O=35&T=03%2F09%2F2016+03%3A16%3A35&V=413&a1=868f8b942fae639d28e27e8933d575d4&a2=2&a4=100&z1=8a82944a53515706015359604c135301&z13=606944188289&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z5=0&z6=00&K=51ba24f6ef3aa161f86e53c34c9616ac'
'M=SPREE978&O=6&T=03%2F09%2F2016+03%3A16%3A35&V=413&a1=868f8b942fae639d28e27e8933d575d4&a2=2&a4=100&z1=8a82944a53515706015359604c135301&z13=606944188289&z15=100&z2=0&z3=Transaction+has+been+executed+successfully.&z5=0&z6=00&K=51ba24f6ef3aa161f86e53c34c9616ac'
end

def failed_credit_response
'M=SPREE978&O=35&T=03%2F09%2F2016+03%3A16%3A59&V=413&a1=ff28246cfc811b1c686a52d08d075d9c&a2=2&a4=100&z1=8a829449535154bc01535960a962524f&z13=606944188290&z15=100&z2=05&z3=Transaction+has+been+declined.&z5=0&z6=57&K=cf34816d5c25dc007ef3525505c4c610'
'M=SPREE978&O=6&T=03%2F09%2F2016+03%3A16%3A59&V=413&a1=ff28246cfc811b1c686a52d08d075d9c&a2=2&a4=100&z1=8a829449535154bc01535960a962524f&z13=606944188290&z15=100&z2=05&z3=Transaction+has+been+declined.&z5=0&z6=57&K=cf34816d5c25dc007ef3525505c4c610'
end

def empty_purchase_response
Expand Down