-
Notifications
You must be signed in to change notification settings - Fork 0
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 logic for ApplePay #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Spreedly | ||
|
||
class ApplePay < PaymentMethod | ||
|
||
end | ||
|
||
Comment on lines
+2
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need the extra space? |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ def self.new_from(xml_doc) | |
return ThirdPartyToken.new(xml_doc) | ||
when 'google_pay' | ||
return GooglePay.new(xml_doc) | ||
when 'apple_pay' | ||
return ApplePay.new(xml_doc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an issue, just a Ruby newbie question about performance. When ordering a "case" statement, is any thought given to ordering the "when"s so that the most likely hits are at the top, and the least likely are at the bottom? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably up to the individual engineer, and whether there is a real world difference between the options. So yes, in some cases, but there is nothing dogmatic that we follow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've never really thought about it, I guess is you have a very large case statement it could have an effect but in general i would say the gains would be minimal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree, in this case the gain would be marginal since each option is a simple string. |
||
end | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Spreedly | ||
VERSION = "2.0.28" | ||
VERSION = "2.0.29" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module ApplePaymentTokenStubs | ||
def apple_pay_token | ||
token = <<~TEXT | ||
{\"signature\":\"MEYCIQD/JoCQ2AMHS0o1bXH4BhfosEsndtXU0jBhXrlFRXqHVgIhAMbYV8JOR1ysS6rrV4vwF+S8/I0bBDytRMEdItlHkXEQ\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"tJUnNLW8HBaDS3w6Q959I0WdTbo3IE9P1TMAFb/OhAQoRhV+qaiwQ0GTOMI7Dmzl1bfaMnYBFh8yAbCw6RMnzK71AZLwwXkDknUpxwtU1QJds2k2SINjiuBrQyt4VpgBFjVAzV9SWlCW+Mm9qfqAzN4N4mFgsvNw0GDlbzgHpjHyjKev/HAH4Gk98bLjXh+cmG9pL9hk1NIooLZPJ4I5q34Ri1dChKIXoQRScBYYFXzt3tk4u8ykiqCqPydjAls3vujNceKKj0SIRaixlpJ+jRJgK04XL3OOe4EzHd476ElKSwVfg96t5Y/ScJ1lPav2FNiCIekHevyhyIIiN9Vun3OsZ6wSRkSWaIkeflsK2potCpb2MzAdAgc1qQIdqBc3x9x1aLS/jEKgPY/gA1gnAyrbb8Ol/RF8W0FCaCE/A/DqPY+YdH92sUHBuOgmarPPU4KhZkshF09cD6hFMKMZBezYgFikXQ\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BKX7sb9PXjbdL8GsfEzcAiVYkM+QBJXt/L2yGXHjyJM7+NO7SlyPyXe3wK6+ky16ujphhwRy10c73LPANrwPTXY\\\\u003d\\\",\\\"tag\\\":\\\"e7DeYqVtIKIEZWmXAvA5OTZ2HwPSxyfCyrAAn7XEbm4\\\\u003d\\\"}\"} | ||
TEXT | ||
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.
We can probably do something fancier here in which we use the value of the options[:payment_method] as the value for <apple_pay> or <google_pay>
Example: