-
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
Worlpay: Fix Google Pay #4774
Worlpay: Fix Google Pay #4774
Conversation
@@ -6,6 +6,7 @@ def setup | |||
@cftgateway = WorldpayGateway.new(fixtures(:world_pay_gateway_cft)) | |||
|
|||
@amount = 100 | |||
@year = (Time.now.year + 2).to_s[-2..-1].to_i |
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.
Nice. It may be controversial, but I'm a fan of negative indices in Ruby. Very straightforward and readable.
else | ||
{ payment_type: :credit } | ||
type = payment_method.respond_to?(:source) ? :network_token : :credit |
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.
Can you add an assertion to existing tests for Google Pay/Apple Pay that confirms that they are now going through the network tokenization path?
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.
Yes I can. The weird thing is that we are going through the network tokenization path with the current way which makes me think that we are saving Google or Apple Pay as NetworkTokenizationCreditCard but as CreditCard
903dc6b
to
550b927
Compare
test/unit/gateways/worldpay_test.rb
Outdated
def test_successfully_attaching_payment_type | ||
[@credit_card, @nt_credit_card].each do |pm| | ||
payment = @gateway.send(:payment_details, pm)[:payment_type] | ||
if pm.respond_to?(:source) |
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.
I think it's better to split these into separate tests to keep the passing conditions clear. This test may result in a false positive later on if, for example, a payment method contains a source
field and it shouldn't.
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.
It wouldn't be possible for CreditCard to have the source
field but I can still separate.
550b927
to
82b4d16
Compare
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.
🚀
Ensure that we don't send cardHolderName if empty and that Google Pay and Apple Pay fall into the network tokenization code path and not the credit card path. Remote Tests: 100 tests, 416 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed Unit Tests: 107 tests, 633 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
82b4d16
to
51c1f2d
Compare
Ensure that we don't send cardHolderName if empty and that Google Pay and Apple Pay fall into the network tokenization code path and not the credit card path.
Remote Tests:
100 tests, 416 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
Unit Tests:
107 tests, 633 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed