-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Vantiv: Read saleResponse duplicate attribute #4413
Vantiv: Read saleResponse duplicate attribute #4413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One request for change that is probably unnecessary but more of a best practices
sort of thing.
doc = Nokogiri::XML(xml).remove_namespaces! | ||
|
||
parsed['duplicate'] = doc.at_xpath('//saleResponse')['duplicate'] == 'true' if kind == :sale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One worry I have here is that if doc.at_xpath('//saleResponse')
returns nil
then calling ['duplicate']
on it will cause ruby to say NoMethodError: undefined method '[]' for nil:NilClass
and then we are returning a sad 500 to the customer.
It looks like we make assumptions like this elsewhere in the parse
method, and it could very well be that saleResponse
is ALWAYS there when kind == :sale
, but I would still feel better if we protected against a nil
here. Something like:
parsed['duplicate'] = doc.at_xpath('//saleResponse').try(:[], 'duplicate') == 'true' if kind == :sale
@@ -727,6 +743,25 @@ def successful_purchase_response | |||
) | |||
end | |||
|
|||
def duplicate_purchase_response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nicely done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I am getting a failure on test_unsuccessful_xml_schema_validation
in the litle unit tests. Looks like we still need the if kind == :sale
check.
I sure wish there was a better way to check for xml validation errors than |
Agree 100%. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run bundle exec rake test:local
I get a linting error now.
Once that is fixed, rebase with master and squash down to one commit. Then add an entry to the changelog (at the bottom of the == HEAD
section), and at that point you are good to merge.
I am approving so that you don't have to tag me for re-review on a linting fix, but don't hesitate to reach out if you have questions about the merge process 🙂 Please don't forget to fix the linting error before merging
For posterity: I am getting 13 failing remote tests on this branch, same as master
407ded0
to
abf7cfd
Compare
The LitleGateway parse method reads elements and their text values, but does not read any of the elements attributes. Here we read one very specific attribute (probably not worth generalizing just yet). Here we're interested in a litle saleResponse that may or may not have the attribute "duplicate='true'". All AM litle saleResposnes will include duplicate: true/false. Note on testing: Remote test for this feature is missing. It looks like the testvantivcnp api does not return the duplicate attribute the same way the production api does. Additionally, something seems to have changed in the testvantivcnp api such that existing remote tests fail. PR coming soon with fixes for existing tests. CE-2506 Local: 5175 tests, 75684 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed Remote: 13 failed tests, same as master. See note above. Linting: 739 files inspected, no offenses detected
abf7cfd
to
35c00e4
Compare
The LitleGateway parse method reads elements and their text values, but does not read any of the elements attributes. Here we read one very specific attribute (probably not worth generalizing just yet). Here we're interested in a Litle saleResponse that may or may not have the attribute
duplicate='true'
. All Litle saleResponses will include duplicate: true/false.Note on testing: Remote test for this feature is missing. It looks like the
testvantivcnp
api does not return the duplicate attribute the same way the production api does. Additionally, something seems to have changed in thetestvantivcnp
api such that existing remote tests fail. PR coming soon with fixes for existing tests.CE-2506
Local:
5175 tests, 75684 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
See note.
Linting:
739 files inspected, no offenses detected