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

Add L2/L3 data for cybersource rest and worldpay #5117

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

Conversation

aenand
Copy link
Contributor

@aenand aenand commented May 7, 2024

Worldpay:
Refactor L2/L3 data for Worldpay to be more in line with how active merchant gateways expect this data. It also lowers the burden for what merchants must provide to use L2/L3 data

Test Summary
Local:
5883 tests, 79441 assertions, 0 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications
99.609% passed
Unit:
117 tests, 668 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
103 tests, 444 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
98.0583% passed

Cybersource Rest
Adds support for L2 and L3 data to the Cybersource Rest

Test Summary
Local:
5882 tests, 79430 assertions, 0 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications
99.609% passed
Unit:
36 tests, 189 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
54 tests, 168 assertions, 7 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
87.037% passed

aenand added 2 commits May 6, 2024 14:50
COMP-134

Adds support for L2 and L3 data to the Cybersource Rest
gateway

Test Summary
Local:
5882 tests, 79430 assertions, 0 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications
99.609% passed
Unit:
36 tests, 189 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
COMP-134

Refactor L2/L3 data for Worldpay to be more in line with
how active merchant gateways expect this data. It also lowers the burden
for what merchants must provide to use L2/L3 data

Test Summary
Local:
5883 tests, 79441 assertions, 0 failures, 23 errors, 0 pendings, 0 omissions, 0 notifications
99.609% passed

Unit:
117 tests, 668 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
103 tests, 444 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
98.0583% passed
@aenand aenand requested review from travismorrison and a team May 7, 2024 17:22
Copy link
Contributor

@DustinHaefele DustinHaefele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions.

# data[:shipping_courier][:tracking_number],
# data[:shipping_courier][:name]
# )
# end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason that these are commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing to see if these are actually a thing. They're not in WP's docs so I think I'm going to delete them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aenand were you going to go ahead and remove these?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm half of the mind to leave them as-is; it wouldn't be the first time an undocumented field was functional and utilized. It's a bit of a gray area, but I'm on board with either.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I forgot to. Yeah I'm going to delete them

Copy link

@travismorrison travismorrison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

little bit of a stranger round here... comment/Qs

elsif data.include?(:item)
add_items_into_level_three_data(xml, data[:item].symbolize_keys)
end
data[:item].each { |item| add_items_into_level_three_data(xml, item.symbolize_keys, data) } if data.include?(:item)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that where data.item was once an optional hash OR array, it is now a required array. Is it so?
Also, does this possibly mean the key can be changed to :items? I've been this way before and have sad memories of the time I spent staring at data[:item].kind_of?(Array) like derrrr it's just item, not items

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think it makes sense to treat line_items as a hash if there's only one item. I can update it to expect line_items to be more clear

item_discount_amount: 'itemDiscountAmount',
tax_amount: 'taxAmount'
}.each do |key, tag|
next unless item.include?(key)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old "each on a hardcoded hash" strategy checked to see if the param existed in item, at this next clause. That check appears to have been removed? is that cool?

Not for nothing but--while I see why you flattened the each out (there are two XML nodes that require special code) it's a little verbose. What would you think of keeping the original implementation for unitCost, itemTotalWithTax, itemDiscountAmount, and taxAmount... with less functionality, like I like how you moved to_i to the function that needs it... and then having special ones for itemTotal and unitOfMeasure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this because Worldpay is particular about the order in which the xml attributes are added and i kept having to interrupt the hash to get the order "right"

Copy link
Contributor

@DustinHaefele DustinHaefele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants