adyen-ruby-api-library 4.0.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  5. data/.github/PULL_REQUEST_TEMPLATE.md +7 -0
  6. data/.github/dependabot.yml +8 -0
  7. data/.github/workflows/ruby.yml +20 -0
  8. data/.gitignore +4 -0
  9. data/CODE_OF_CONDUCT.md +76 -0
  10. data/Gemfile +2 -2
  11. data/README.md +72 -109
  12. data/docs/checkout.html +17 -0
  13. data/docs/marketpay.html +2 -0
  14. data/lib/adyen/client.rb +57 -24
  15. data/lib/adyen/errors.rb +44 -2
  16. data/lib/adyen/services/bin_lookup.rb +18 -0
  17. data/lib/adyen/services/checkout.rb +90 -8
  18. data/lib/adyen/services/{checkout_utility.rb → data_protection.rb} +4 -3
  19. data/lib/adyen/services/dispute.rb +20 -0
  20. data/lib/adyen/services/marketpay.rb +27 -6
  21. data/lib/adyen/services/payments.rb +15 -5
  22. data/lib/adyen/services/payouts.rb +3 -2
  23. data/lib/adyen/services/postfmapi.rb +19 -0
  24. data/lib/adyen/services/recurring.rb +3 -2
  25. data/lib/adyen/services/service.rb +2 -2
  26. data/lib/adyen/version.rb +1 -1
  27. data/lib/adyen-ruby-api-library.rb +4 -12
  28. data/renovate.json +5 -0
  29. data/spec/account_spec.rb +4 -1
  30. data/spec/bin_lookup_spec.rb +15 -0
  31. data/spec/checkout_spec.rb +275 -4
  32. data/spec/data_protection_spec.rb +14 -0
  33. data/spec/dispute_spec.rb +17 -0
  34. data/spec/errors_spec.rb +33 -3
  35. data/spec/fund_spec.rb +2 -1
  36. data/spec/hop_spec.rb +14 -0
  37. data/spec/mocks/requests/Account/check_account_holder.json +5 -0
  38. data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
  39. data/spec/mocks/requests/Account/delete_signatories.json +6 -0
  40. data/spec/mocks/requests/BinLookup/get_3ds_availability.json +4 -0
  41. data/spec/mocks/requests/BinLookup/get_cost_estimate.json +8 -0
  42. data/spec/mocks/requests/Checkout/orders.json +6 -0
  43. data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
  44. data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
  45. data/spec/mocks/requests/Checkout/payment_links.json +9 -0
  46. data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
  47. data/spec/mocks/requests/Checkout/sessions.json +10 -0
  48. data/spec/mocks/requests/DataProtectionService/request_subject_erasure.json +5 -0
  49. data/spec/mocks/requests/DisputeService/defend_dispute.json +5 -0
  50. data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +5 -0
  51. data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +4 -0
  52. data/spec/mocks/requests/DisputeService/supply_defense_document.json +11 -0
  53. data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
  54. data/spec/mocks/requests/Hop/get_onboarding_url.json +4 -0
  55. data/spec/mocks/requests/Payment/donate.json +10 -0
  56. data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
  57. data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
  58. data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
  59. data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
  60. data/spec/mocks/requests/Payout/payout.json +8 -0
  61. data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
  62. data/spec/mocks/requests/Terminal/assign_terminals.json +6 -0
  63. data/spec/mocks/requests/Terminal/find_terminal.json +3 -0
  64. data/spec/mocks/requests/Terminal/get_terminals_under_account.json +4 -0
  65. data/spec/mocks/responses/Account/check_account_holder.json +3 -0
  66. data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
  67. data/spec/mocks/responses/Account/delete_signatories.json +3 -0
  68. data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
  69. data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
  70. data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
  71. data/spec/mocks/responses/Checkout/orders.json +8 -0
  72. data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
  73. data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
  74. data/spec/mocks/responses/Checkout/payment_links.json +9 -0
  75. data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
  76. data/spec/mocks/responses/Checkout/sessions-success.json +11 -0
  77. data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
  78. data/spec/mocks/responses/DataProtectionService/request_subject_erasure.json +3 -0
  79. data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
  80. data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
  81. data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
  82. data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
  83. data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
  84. data/spec/mocks/responses/Hop/get_onboarding_url.json +7 -0
  85. data/spec/mocks/responses/Payment/donate.json +4 -0
  86. data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
  87. data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
  88. data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
  89. data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
  90. data/spec/mocks/responses/Payout/payout.json +3 -0
  91. data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
  92. data/spec/mocks/responses/Terminal/assign_terminals.json +5 -0
  93. data/spec/mocks/responses/Terminal/find_terminal.json +6 -0
  94. data/spec/mocks/responses/Terminal/get_terminals_under_account.json +11 -0
  95. data/spec/payments_spec.rb +6 -1
  96. data/spec/payouts_spec.rb +2 -1
  97. data/spec/postfmapi_spec.rb +16 -0
  98. data/spec/recurring_spec.rb +2 -1
  99. data/spec/service_spec.rb +4 -0
  100. data/spec/spec_helper.rb +18 -12
  101. metadata +78 -9
  102. data/.travis.yml +0 -14
  103. data/spec/checkout_utility_spec.rb +0 -29
  104. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
  105. data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 50ac4158ef06b200711ce1b69d7b6c12cad0df4b
4
- data.tar.gz: 338fbfd9fed83cd6a3569dd1f706fdf439e259c1
2
+ SHA256:
3
+ metadata.gz: 61215b9de7ba034430b475ae7e70caaf9e28403e9932d7dee5c2092cab206843
4
+ data.tar.gz: e0363ffc4090d847ecc2e1a7c976a91adf58d3f70d75d88609a51aee5f4dc518
5
5
  SHA512:
6
- metadata.gz: c71dfcff2e34dd0244abdd56da08a0ab430b608de4fc095a472711a69269c416ffcee0b6021ed0db56bff3b8a5d1fc25e1fe13bac4f0c844367a61498ad6de1b
7
- data.tar.gz: 9ea5ee2a69f6de0523ba4fff25975202583bdf3d1218a8cda8d0abe978b57e30158cccd4bb94921c928531ce40442df067089cdb74a066567a4f2cd1f526bcf5
6
+ metadata.gz: 2dc2019edf4bb02922b573b45e151a472cb3cb178b55677ffbb52d3867fb3514b1aabf76458338a8d832d1116a215fa0286c963a086c8ed2fd156ee94b4e5422
7
+ data.tar.gz: 45dee79d7372364092e9b3a9fd789d2b7553ac4052ebf0d6701bed7f2c62ad0772b7eb25702233feffe9ed13d158af7c958fa0a71f07a5740e869dda88402351
@@ -0,0 +1 @@
1
+ * @crrood @Aleffio @wboereboom @cyattilakiss
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **How to reproduce**
14
+ Steps to reproduce the behavior.
15
+
16
+ **Expected behavior**
17
+ A clear and concise description of what you expected to happen.
18
+
19
+ **Screenshots**
20
+ If applicable, add screenshots to help explain your problem.
21
+
22
+ **Desktop (please complete the following information):**
23
+ - ruby Version: [x.y.z]
24
+ - Library Version: [x.y.z]
25
+
26
+ **Additional context**
27
+ Add any other context about the problem here.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **ruby version**: x.y.z
11
+ **Library version**: x.y.z
12
+
13
+ **Is your feature request related to a problem? Please describe.**
14
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
15
+
16
+ **Describe the solution you'd like**
17
+ A clear and concise description of what you want to happen.
18
+
19
+ **Describe alternatives you've considered**
20
+ A clear and concise description of any alternative solutions or features you've considered.
21
+
22
+ **Additional context**
23
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,7 @@
1
+ **Description**
2
+ <!-- Please provide a description of the changes proposed in the Pull Request -->
3
+
4
+ **Tested scenarios**
5
+ <!-- Description of tested scenarios -->
6
+
7
+ **Fixed issue**: <!-- #-prefixed issue number -->
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "04:00"
8
+ open-pull-requests-limit: 10
@@ -0,0 +1,20 @@
1
+ name: ruby
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ os: [ubuntu-latest]
11
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
12
+ ruby: [2.5, 2.6, 2.7, '3.0', head]
13
+ runs-on: ${{ matrix.os }}
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
20
+ - run: bundle exec rspec
data/.gitignore CHANGED
@@ -11,3 +11,7 @@ design.txt
11
11
 
12
12
  .bundle
13
13
  .ruby-version
14
+
15
+ .DS_Store
16
+
17
+ .idea
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at support@adyen.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- ruby "> 2.1.0"
5
+ ruby ">= 2.1.0"
6
6
 
7
7
  gem "faraday"
8
8
 
9
9
  gem "bundler", :group => :development
10
10
  gem "webmock", :group => :development
11
11
  gem "rspec", :group => :development
12
- gem "activesupport", :group => :development
12
+ gem "activesupport", :group => :development
data/README.md CHANGED
@@ -1,51 +1,69 @@
1
1
  # Adyen API Library for Ruby
2
2
 
3
- The Adyen API Library for Ruby lets you easily work with Adyen's API.
3
+
4
+ This is the officially supported Ruby library for using Adyen's APIs.
4
5
 
5
6
  ## Integration
7
+ The library supports all APIs under the following services:
6
8
 
7
- The Library supports all APIs under the following services:
9
+ * [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68**
10
+ * [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64**
11
+ * [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49**
12
+ * [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
13
+ * [Platforms APIs](https://docs.adyen.com/platforms/api): Set of APIs when using Adyen for Platforms.
14
+ * [Account API](https://docs.adyen.com/api-explorer/#/Account/v6/overview) Current supported version: **v6**
15
+ * [Fund API](https://docs.adyen.com/api-explorer/#/Fund/v6/overview) Current supported version: **v6**
16
+ * [Notification Configuration API](https://docs.adyen.com/api-explorer/#/NotificationConfigurationService/v6/overview) Current supported version: **v6**
17
+ * [POS Terminal Management API](https://docs.adyen.com/api-explorer/#/postfmapi/v1/overview): Current supported version: **v1**
18
+ * [Adyen BinLookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v50/overview): Current supported version: **v50**
19
+ * [Data Protection API](https://docs.adyen.com/development-resources/data-protection-api): Current supported version: **v1**
20
+ * [Disputes API](https://docs.adyen.com/risk-management/disputes-api): Current supported version: **v50**
8
21
 
9
- * checkout
10
- * checkout utility
11
- * payments
12
- * modifications
13
- * payouts
14
- * recurring
15
- * marketpay
16
22
 
17
- ## Requirements
23
+ For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).
18
24
 
19
- Built for Ruby >= 2.1
25
+ ## Prerequisites
26
+ - [Adyen test account](https://docs.adyen.com/get-started-with-adyen)
27
+ - [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles).
28
+ - Ruby >= 2.1
20
29
 
21
30
  ## Installation
22
31
 
23
- The sole dependency is faraday for http communication - run `bundle install` to install faraday if you don't already have it
32
+ The sole dependency is faraday for HTTP communication. Run the following command to install faraday if you don't already have it:
33
+
34
+ ~~~~bash
35
+ bundle install
36
+ ~~~~
24
37
 
25
- To validate functionality of client, use `bundle install --with development` and `rspec` to run mock API tests.
38
+ To validate functionality of client and run mock API tests use
26
39
 
40
+ ~~~~bash
41
+ bundle install --with development
42
+ ~~~~
43
+ and
44
+ ~~~~bash
45
+ rspec
46
+ ~~~~
27
47
  ## Documentation
28
48
 
29
49
  Follow the rest of our guides from the [documentation](https://adyen.github.io/adyen-ruby-api-library/) on how to use this library.
30
50
 
31
- ## Usage
51
+ ## Using the library
32
52
 
33
- ### Create a client to connect to the Adyen API
34
- ```ruby
35
- require 'adyen-ruby-api-library'
53
+ ### General use with API key
36
54
 
55
+ ~~~~bash
56
+ require 'adyen-ruby-api-library'
57
+ ~~~~
58
+ ~~~~ruby
37
59
  adyen = Adyen::Client.new
38
60
 
39
- # for API-key based implementations
40
61
  adyen.api_key = 'AF5XXXXXXXXXXXXXXXXXXXX'
41
62
 
42
- # for basic-auth based implementations
43
- adyen.ws_user = 'ws@Company.Adyen'
44
- adyen.ws_password = 'super_secure_password123'
45
- ```
63
+ ~~~~
46
64
 
47
- ### Make a Payment
48
- ```ruby
65
+ - Make a Payment
66
+ ~~~~ruby
49
67
  response = adyen.checkout.payments({
50
68
  :amount => {
51
69
  :currency => "EUR",
@@ -54,100 +72,45 @@ response = adyen.checkout.payments({
54
72
  :reference => "Your order number",
55
73
  :paymentMethod => {
56
74
  :type => "scheme",
57
- :encryptedCardNumber => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
58
- :encryptedExpiryMonth => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
59
- :encryptedExpiryYear => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
60
- :encryptedSecurityCode => "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
75
+ :encryptedCardNumber => "test_4111111111111111",
76
+ :encryptedExpiryMonth => "test_03",
77
+ :encryptedExpiryYear => "test_2030",
78
+ :encryptedSecurityCode => "test_737"
61
79
  },
62
80
  :returnUrl => "https://your-company.com/checkout/",
63
81
  :merchantAccount => "YourMerchantAccount"
64
82
  })
65
- ```
66
-
67
- ### Change API Version
68
- ```ruby
69
- adyen.checkout.version = 50
70
- ```
71
-
72
- ## List of supported methods
73
-
74
- **checkout:**
75
- - payment_session
76
- - payments.result
77
- - payment_methods
78
- - payments
79
- - payments.details
80
-
81
- **checkout utility:**
82
- - origin_keys
83
-
84
- **payments:**
85
- - authorise
86
- - authorise3d
87
-
88
- **modifications:**
89
- - capture
90
- - cancel
91
- - refund
92
- - cancel_or_refund
93
- - adjust_authorisation
94
-
95
- **payouts:**
96
- - confirm_third_party
97
- - decline_third_party
98
- - store_detail
99
- - submit_third_party
100
- - store_detail_and_submit_third_party
101
-
102
- **recurring:**
103
- - list_recurring_details
104
- - disable
105
- - store_token
106
-
107
- **marketpay.account:**
108
- - create_account_holder
109
- - get_account_holder
110
- - update_account_holder
111
- - update_account_holder_state
112
- - suspend_account_holder
113
- - un_suspend_account_holder
114
- - close_account_holder
115
- - create_account
116
- - update_account
117
- - close_account
118
- - upload_document
119
- - get_uploaded_documents
120
- - delete_bank_accounts
121
- - delete_shareholders
122
-
123
- **marketpay.fund:**
124
- - account_holder_balance
125
- - account_holder_transaction_list
126
- - payout_account_holder
127
- - transfer_funds
128
- - setup_beneficiary
129
- - refund_not_paid_out_transfers
130
-
131
- **marketpay.notification:**
132
- - create_notification_configuration
133
- - get_notification_configuration
134
- - get_notification_configuration_list
135
- - test_notification_configuration
136
- - update_notification_configuration
137
- - delete_notification_configurations
83
+ ~~~~
138
84
 
139
- ## Support
85
+ - Change API Version
86
+ ~~~~ruby
87
+ adyen.checkout.version = 68
88
+ ~~~~
140
89
 
141
- If you have any problems, questions or suggestions, create an issue here or send your inquiry to support@adyen.com.
90
+ ### Example integration
91
+
92
+ For a closer look at how our Ruby library works, clone our [example integration](https://github.com/adyen-examples/adyen-rails-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.
93
+
94
+ ### Running the tests
95
+ To run the tests use :
96
+ ~~~~bash
97
+ bundle install --with development
98
+ ~~~~
142
99
 
143
100
  ## Contributing
144
- We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
145
- * New features and functionality
146
- * Resolved bug fixes and issues
147
- * Any general improvements
148
101
 
149
- Read our [**contribution guidelines**](CONTRIBUTING.md) to find out how.
102
+ We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.
103
+ Have a look at our [contributing guidelines](https://github.com/Adyen/adyen-ruby-api-library/blob/develop/CONTRIBUTING.md) to find out how to raise a pull request.
104
+
105
+ ## Support
106
+ If you have a feature request, or spotted a bug or a technical problem, [create an issue here](https://github.com/Adyen/adyen-ruby-api-library/issues/new/choose).
107
+
108
+ For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/requests/new?ticket_form_id=360000705420).
150
109
 
151
110
  ## Licence
111
+ This repository is available under the [MIT license](https://github.com/Adyen/adyen-ruby-api-library/blob/master/LICENSE).
152
112
 
153
- MIT license. For more information, see the LICENSE file.
113
+ ## See also
114
+ * [Example integration](https://github.com/adyen-examples/adyen-rails-online-payments)
115
+ * [Adyen docs](https://docs.adyen.com/)
116
+ * [API Explorer](https://docs.adyen.com/api-explorer/)
data/docs/checkout.html CHANGED
@@ -41,6 +41,8 @@
41
41
  <li>payments</li>
42
42
 
43
43
  <li>payments.details</li>
44
+
45
+ <li>payment_links</li>
44
46
  </ul>
45
47
 
46
48
  <h2 id="authentication">Authentication</h2>
@@ -99,7 +101,22 @@
99
101
 
100
102
  <p>A successful call to payment_methods will return a list of supported payment methods along with redirect URL's so that you can send your shoppers directly to the issuer's site without losing control of front-end styling / logic.</p>
101
103
 
104
+ You can also create a link to Adyen's hosted payment form:
105
+
106
+ <pre><code class="ruby language-ruby">response = adyen.checkout.payment_links('{
107
+ "amount": {
108
+ "value": 1500,
109
+ "currency": "EUR"
110
+ },
111
+ "countryCode": "US",
112
+ "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
113
+ "reference": "YOUR_REFERENCE"
114
+ }')</code></pre>
115
+
116
+ <p>A successful call to payment_links will return a url, which directs a user to Adyen's hosted payment form.</p>
102
117
  </section>
118
+
119
+
103
120
  <footer>
104
121
  <p>This project is maintained by <a href="https://github.com/Adyen">Adyen</a></p>
105
122
  <p><small>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
data/docs/marketpay.html CHANGED
@@ -61,6 +61,8 @@
61
61
  <li>delete_bank_accounts</li>
62
62
 
63
63
  <li>delete_shareholders</li>
64
+
65
+ <li>delete_signatories</li>
64
66
  </ul>
65
67
 
66
68
  <h4 id="marketpayfund">marketpay.fund:</h4>
data/lib/adyen/client.rb CHANGED
@@ -42,15 +42,18 @@ module Adyen
42
42
  when "Checkout"
43
43
  url = "https://checkout-#{@env}.adyen.com/checkout"
44
44
  supports_live_url_prefix = true
45
- when "CheckoutUtility"
46
- url = "https://checkout-#{@env}.adyen.com/checkout"
47
- supports_live_url_prefix = true
48
- when "Account", "Fund", "Notification"
45
+ when "Account", "Fund", "Notification", "Hop"
49
46
  url = "https://cal-#{@env}.adyen.com/cal/services"
50
47
  supports_live_url_prefix = false
51
- when "Recurring", "Payment", "Payout"
48
+ when "Recurring", "Payment", "Payout", "BinLookup"
52
49
  url = "https://pal-#{@env}.adyen.com/pal/servlet"
53
50
  supports_live_url_prefix = true
51
+ when "Terminal"
52
+ url = "https://postfmapi-#{@env}.adyen.com/postfmapi/terminal"
53
+ supports_live_url_prefix = false
54
+ when "DataProtectionService", "DisputeService"
55
+ url = "https://ca-#{@env}.adyen.com/ca/services"
56
+ supports_live_url_prefix = false
54
57
  else
55
58
  raise ArgumentError, "Invalid service specified"
56
59
  end
@@ -66,7 +69,7 @@ module Adyen
66
69
 
67
70
  # construct full URL from service and endpoint
68
71
  def service_url(service, action, version)
69
- if service == "Checkout" || service == "CheckoutUtility"
72
+ if service == "Checkout" || service == "Terminal"
70
73
  "#{service_url_base(service)}/v#{version}/#{action}"
71
74
  else
72
75
  "#{service_url_base(service)}/#{service}/v#{version}/#{action}"
@@ -74,9 +77,9 @@ module Adyen
74
77
  end
75
78
 
76
79
  # send request to adyen API
77
- def call_adyen_api(service, action, request_data, headers, version)
80
+ def call_adyen_api(service, action, request_data, headers, version, with_application_info = false)
78
81
  # get URL for requested endpoint
79
- url = service_url(service, action, version)
82
+ url = service_url(service, action.is_a?(String) ? action : action.fetch(:url), version)
80
83
 
81
84
  # make sure right authentication has been provided
82
85
  # will use api_key if present, otherwise ws_user and ws_password
@@ -119,20 +122,39 @@ module Adyen
119
122
  end
120
123
 
121
124
  # add application only on checkout service
122
- if service == 'Checkout' || service == 'CheckoutUtility'
125
+ if with_application_info
123
126
  add_application_info(request_data)
124
127
  end
125
128
 
126
129
  # convert to json
127
130
  request_data = request_data.to_json
128
131
 
129
- # post request to Adyen
130
- begin
131
- response = conn.post do |req|
132
- req.body = request_data
133
- end # handle client errors
134
- rescue Faraday::ConnectionFailed => connection_error
135
- raise connection_error, "Connection to #{url} failed"
132
+ if action.is_a?(::Hash)
133
+ if action.fetch(:method) == "get"
134
+ begin
135
+ response = conn.get
136
+ rescue Faraday::ConnectionFailed => connection_error
137
+ raise connection_error, "Connection to #{url} failed"
138
+ end
139
+ end
140
+ if action.fetch(:method) == "patch"
141
+ begin
142
+ response = conn.patch do |req|
143
+ req.body = request_data
144
+ end
145
+ rescue Faraday::ConnectionFailed => connection_error
146
+ raise connection_error, "Connection to #{url} failed"
147
+ end
148
+ end
149
+ else
150
+ # post request to Adyen
151
+ begin
152
+ response = conn.post do |req|
153
+ req.body = request_data
154
+ end # handle client errors
155
+ rescue Faraday::ConnectionFailed => connection_error
156
+ raise connection_error, "Connection to #{url} failed"
157
+ end
136
158
  end
137
159
 
138
160
  # check for API errors
@@ -151,16 +173,15 @@ module Adyen
151
173
  # add application_info for analytics
152
174
  def add_application_info(request_data)
153
175
  adyenLibrary = {
154
- :name => Adyen::NAME,
155
- :version => Adyen::VERSION.to_s
176
+ :name => Adyen::NAME,
177
+ :version => Adyen::VERSION.to_s,
156
178
  }
157
179
 
158
180
  if request_data[:applicationInfo].nil?
159
- request_data[:applicationInfo] = {};
181
+ request_data[:applicationInfo] = {}
160
182
  end
161
183
 
162
184
  request_data[:applicationInfo][:adyenLibrary] = adyenLibrary
163
- request_data[:applicationInfo][:adyenLibraryTest] = adyenLibrary
164
185
  end
165
186
 
166
187
  # services
@@ -168,10 +189,6 @@ module Adyen
168
189
  @checkout ||= Adyen::Checkout.new(self)
169
190
  end
170
191
 
171
- def checkout_utility
172
- @checkout_utility ||= Adyen::CheckoutUtility.new(self)
173
- end
174
-
175
192
  def payments
176
193
  @payments ||= Adyen::Payments.new(self)
177
194
  end
@@ -187,5 +204,21 @@ module Adyen
187
204
  def marketpay
188
205
  @marketpay ||= Adyen::Marketpay::Marketpay.new(self)
189
206
  end
207
+
208
+ def postfmapi
209
+ @postfmapi ||= Adyen::PosTerminalManagement.new(self)
210
+ end
211
+
212
+ def data_protection
213
+ @data_protection ||= Adyen::DataProtection.new(self)
214
+ end
215
+
216
+ def dispute
217
+ @dispute ||= Adyen::Dispute.new(self)
218
+ end
219
+
220
+ def bin_lookup
221
+ @bin_lookup ||= Adyen::BinLookup.new(self)
222
+ end
190
223
  end
191
224
  end