-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix validation for tokenized ECv1 #29
Conversation
I have gone through the PR and compared it with https://developers.google.com/pay/api/processors/guides/test-and-validation/sample-tokens#ecv2_4 |
A few small suggestions from me, otherwise it looks solid. |
Gemfile
Outdated
@@ -1,3 +1,5 @@ | |||
source 'https://rubygems.org' | |||
|
|||
gem 'aliquot-pay', :git => 'https://github.com/clearhaus/aliquot-pay', :branch => 'make-tokens-consistent-with-googles-sample-tokens' |
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.
This should be removed before merging, right? And re introduced in aliquot.gemspec
with version requirement.
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 indeed it should but with the mutual dependency the automated tests will fail without.
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 was just to highlight that this was still hanging around even though you got a ✔️
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.
Just a few things I stumbled upon. Only syntax stuff.
@message['paymentMethodDetails'].merge!( | ||
'threedsCryptogram' => @message['paymentMethodDetails'] | ||
.delete('3dsCryptogram')) if @message['paymentMethodDetails']['3dsCryptogram'] |
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.
This is IMO not easily readable.
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.
@message['paymentMethodDetails'].merge!( | |
'threedsCryptogram' => @message['paymentMethodDetails'] | |
.delete('3dsCryptogram')) if @message['paymentMethodDetails']['3dsCryptogram'] | |
details = @message['paymentMethodDetails'] | |
if details['3dsCryptogram'] | |
details['threedsCryptogram'] = details.delete('3dsCryptogram') | |
end |
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.
@message['paymentMethodDetails'].merge!( | |
'threedsCryptogram' => @message['paymentMethodDetails'] | |
.delete('3dsCryptogram')) if @message['paymentMethodDetails']['3dsCryptogram'] | |
d = @message['paymentMethodDetails'] | |
d['threedsCryptogram'] = d.delete('3dsCryptogram') if d['3dsCryptogram'] |
rule(:paymentMethod) do | ||
key.failure('must be equal to CARD') unless 'CARD'.eql?(value) | ||
if values[:paymentMethodDetails].is_a?(Hash) | ||
if '3DS'.eql?(values[:paymentMethodDetails]['authMethod']) # Tokenized ECv1 |
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.
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.
if '3DS'.eql?(values[:paymentMethodDetails]['authMethod']) # Tokenized ECv1 | |
if values[:paymentMethodDetails]['authMethod'] == '3DS' # Tokenized ECv1 |
if version == 'ECv1' | ||
if tokenized | ||
Aliquot::Validator::ECv1_TokenizedPaymentMethodDetailsContract.new | ||
else | ||
Aliquot::Validator::ECv1_PaymentMethodDetailsContract.new | ||
end | ||
else | ||
if tokenized | ||
Aliquot::Validator::ECv2_TokenizedPaymentMethodDetailsContract.new | ||
else | ||
Aliquot::Validator::ECv2_PaymentMethodDetailsContract.new | ||
end | ||
end |
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.
if version == 'ECv1' | |
if tokenized | |
Aliquot::Validator::ECv1_TokenizedPaymentMethodDetailsContract.new | |
else | |
Aliquot::Validator::ECv1_PaymentMethodDetailsContract.new | |
end | |
else | |
if tokenized | |
Aliquot::Validator::ECv2_TokenizedPaymentMethodDetailsContract.new | |
else | |
Aliquot::Validator::ECv2_PaymentMethodDetailsContract.new | |
end | |
end | |
if version == 'ECv1' | |
if tokenized | |
Aliquot::Validator::ECv1_TokenizedPaymentMethodDetailsContract.new | |
else | |
Aliquot::Validator::ECv1_PaymentMethodDetailsContract.new | |
end | |
else | |
if tokenized | |
Aliquot::Validator::ECv2_TokenizedPaymentMethodDetailsContract.new | |
else | |
Aliquot::Validator::ECv2_PaymentMethodDetailsContract.new | |
end | |
end |
Start supporting validation of tokenized ECv1 tokens. Previously they have not been supported.