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

Realex: update avs/address code creation #2509

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

slogsdon
Copy link
Contributor

No description provided.

The Billing Code XML element is currently only formatted correctly for GB
AVS checks. This is where only the digits from the post code and the first
line of the address are submitted with a “|” between. For example:

<address type='billing'>
  <code>321|456</code>
  <country>GB</country>
</address>

However, for US and CA the full post code and address should be submitted.
For example:

<address type='billing'>
  <code>50001|Flat 123</code>
  <country>US</country>
</address>

We just need to introduce code here to only remove the non-digits when the
country is GB. For all other countries the full zip and first line of the
address should be submitted.
@bpollack
Copy link
Contributor

Thanks for the PR. If this is still relevant to you (sorry it's been awhile!), I'd appreciate at least some information about what this is correcting/fixing and why, and ideally also an equivalent note in the remote tests so we can verify that it works properly.

@bpollack bpollack added the gateway/fix Fixes a bug in Active Merchant label Jun 25, 2018
@slogsdon
Copy link
Contributor Author

slogsdon commented Jul 2, 2018

@bpollack Thanks for following up.

This change corrects AVS behavior for non-GB countries that support AVS through the Realex gateway. Here's the relevant Realex documentation that covers this functionality: https://developer.realexpayments.com/#!/api/fraud-management/avs. Essentially, only GB address should strip non-numeric characters from the postal code and first address line when constructing the code field that is sent to the gateway. Previously, it would incorrectly perform this for all cases.

Are you able to confirm if you're looking to add tests/assertions for this change to match the unit test assertions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gateway/fix Fixes a bug in Active Merchant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants