Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added fields for consumer bankaccount details to IdealStatusResponse #6

Merged
merged 1 commit into from

2 participants

@johankok

When confirming a successful iDeal transaction, the returning XML message contains information about the consumer. I've created some methods for easy access to the bankaccount number and associated name and city of the accountholder.

@dovadi dovadi merged commit 8ea37ef into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
17 lib/active_merchant_ideal/ideal_response.rb
@@ -189,6 +189,23 @@ def verified?
verify(OpenSSL::Digest::SHA1.new, signature, message)
end
+ # Returns the bankaccount number when the transaction was successful.
+ def consumer_account_number
+ text('//consumerAccountNumber')
+ end
+
+ # Returns the name on the bankaccount of the customer when the
+ # transaction was successful.
+ def consumer_name
+ text('//consumerName')
+ end
+
+ # Returns the city on the bankaccount of the customer when the
+ # transaction was successful.
+ def consumer_city
+ text('//consumerCity')
+ end
+
private
# Checks if no errors occured _and_ if the message was authentic.
View
9 test/test_active_merchant_ideal.rb
@@ -514,6 +514,15 @@ def test_capture_of_successful_payment_but_message_does_not_match_signature
assert !capture_response.success?
end
+
+ def test_capture_of_consumer_fields
+ expects_request_and_returns ACQUIRER_SUCCEEDED_STATUS_RESPONSE
+ capture_response = @gateway.capture('0001023456789112')
+
+ assert_equal '0949298989', capture_response.consumer_account_number
+ assert_equal 'Onderheuvel', capture_response.consumer_name
+ assert_equal 'DEN HAAG', capture_response.consumer_city
+ end
def test_returns_status
response = IdealStatusResponse.new(ACQUIRER_SUCCEEDED_STATUS_RESPONSE)
Something went wrong with that request. Please try again.