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

FlexCharge: quick fix on void call #5171

Merged
merged 1 commit into from
Jul 11, 2024
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
3 changes: 2 additions & 1 deletion lib/active_merchant/billing/gateways/flex_charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def refund(money, authorization, options = {})
commit(:refund, { amountToRefund: localized_amount(money, 2).to_f }, order_id)
end

def void(money, authorization, options = {})
def void(authorization, options = {})
order_id, _currency = authorization.split('#')
commit(:void, {}, order_id)
end
Expand Down Expand Up @@ -145,6 +145,7 @@ def add_base_data(post, options)
post[:isDeclined] = cast_bool(options[:is_declined])
post[:orderId] = options[:order_id]
post[:idempotencyKey] = options[:idempotency_key] || options[:order_id]
post[:senseKey] = options[:sense_key]
end

def add_mit_data(post, options)
Expand Down
2 changes: 1 addition & 1 deletion test/remote/gateways/remote_flex_charge_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_successful_void
response = @gateway.authorize(@amount, @credit_card_mit, @cit_options)
assert_success response

assert void = @gateway.void(@amount, response.authorization)
assert void = @gateway.void(response.authorization)
assert_success void
end

Expand Down
4 changes: 3 additions & 1 deletion test/unit/gateways/flex_charge_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def setup
cvv_result_code: '111',
cavv_result_code: '111',
timezone_utc_offset: '-5',
billing_address: address.merge(name: 'Cure Tester')
billing_address: address.merge(name: 'Cure Tester'),
sense_key: 'abc123'
}

@cit_options = {
Expand Down Expand Up @@ -106,6 +107,7 @@ def test_successful_purchase
assert_equal request['isDeclined'], @options[:is_declined]
assert_equal request['orderId'], @options[:order_id]
assert_equal request['idempotencyKey'], @options[:idempotency_key]
assert_equal request['senseKey'], 'abc123'
assert_equal request['transaction']['timezoneUtcOffset'], @options[:timezone_utc_offset]
assert_equal request['transaction']['amount'], @amount
assert_equal request['transaction']['responseCode'], @options[:response_code]
Expand Down
Loading