-
Notifications
You must be signed in to change notification settings - Fork 7
DASH-4820 add three d secure module #67
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7c5d9d4
add three d secure module
devUniWork ef5cb9a
add specs
devUniWork 3070f2e
specs running green
devUniWork c0ed211
tidy
devUniWork 667109c
removed unnecessary file
devUniWork a9e4372
revertion
devUniWork 37b3b9f
sacrifice to the github action lords
devUniWork 2e3507c
make ci run
devUniWork 7507bb6
isolate pain
devUniWork 2b06ceb
one pain at a time
devUniWork cbe9b28
rubocop'd
devUniWork 68766c9
bump bump bump
devUniWork 14b1da2
Merge branch 'main' into DASH-4820-make-3ds-cybs-sdk
Devlaird File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module FatZebra | ||
| ## | ||
| # == FatZebra \ThreeDSecure | ||
| # | ||
| # Manage 3DS2 authentication for the Cybersource REST API | ||
| # | ||
| # * setup | ||
| # * enrollment | ||
| # * validation | ||
| # | ||
| class ThreeDSecure < APIResource | ||
| validates :card_token, required: true, on: :setup | ||
|
|
||
| CHECK_ENROLLMENT_REQUIRED_FIELDS = %i[ | ||
| merchant_username | ||
| card_token | ||
| amount | ||
| currency | ||
| reference | ||
| verification | ||
| device_channel | ||
| reference_id | ||
| return_url | ||
| acs_window_size | ||
| browser_accept_content | ||
| browser_language | ||
| browser_java_enabled | ||
| browser_color_depth | ||
| browser_screen_height | ||
| browser_screen_width | ||
| browser_time_difference | ||
| browser_user_agent | ||
| ].freeze | ||
|
|
||
| CHECK_ENROLLMENT_REQUIRED_FIELDS.each do |field| | ||
| validates field, required: true, on: :check_enrollment | ||
| end | ||
|
|
||
| VALIDATE_AUTHENTICATION_REQUIRED_FIELDS = %i[ | ||
| merchant_username | ||
| card_token | ||
| amount | ||
| currency | ||
| authentication_transaction_id | ||
| ].freeze | ||
|
|
||
| VALIDATE_AUTHENTICATION_REQUIRED_FIELDS.each do |field| | ||
| validates field, required: true, on: :validate_authentication | ||
| end | ||
|
|
||
| class << self | ||
|
|
||
| def resource_name | ||
| 'three_d_secure' | ||
| end | ||
|
|
||
| def resource_path | ||
| "/sdk/#{resource_name}" | ||
| end | ||
|
|
||
| ## | ||
| # Sets up a 3ds request | ||
| # | ||
| # @param [Hash] params | ||
| # @param [Hash] options for the request, and configurations (Optional) | ||
| # | ||
| # @return [FatZebra::ThreeDSecure] | ||
| def setup(params = {}, options = {}) | ||
| valid!(params, :setup) if respond_to?(:valid!) | ||
|
|
||
| response = request(:post, "#{resource_path}/setup", params, options) | ||
| initialize_from(response) | ||
| end | ||
|
|
||
| ## | ||
| # Enrols card | ||
| # | ||
| # @param [Hash] params | ||
| # @param [Hash] options for the request, and configurations (Optional) | ||
| # | ||
| # @return [FatZebra::ThreeDSecure] | ||
| def check_enrollment(params = {}, options = {}) | ||
| valid!(params, :check_enrollment) if respond_to?(:valid!) | ||
|
|
||
| response = request(:post, "#{resource_path}/check_enrollment", params, options) | ||
| initialize_from(response) | ||
| end | ||
|
|
||
| ## | ||
| # Validates card | ||
| # | ||
| # @param [Hash] params | ||
| # @param [Hash] options for the request, and configurations (Optional) | ||
| # | ||
| # @return [FatZebra::ThreeDSecure] | ||
| def validate_authentication(params = {}, options = {}) | ||
| valid!(params, :validate_authentication) if respond_to?(:valid!) | ||
|
|
||
| response = request(:post, "#{resource_path}/validate_authentication", params, options) | ||
| initialize_from(response) | ||
| end | ||
| end | ||
| end | ||
| end | ||
89 changes: 89 additions & 0 deletions
89
spec/cassettes/FatZebra_ThreeDSecure/_check_enrollment/validations/1_2_2_1.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 viewed as "checking if the card is enrolled", rather than "enrolling the card". This is a common misconception.