adyen-ruby-api-library 7.0.0 → 7.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/release.yml +18 -0
  4. data/.github/workflows/gh_release.yml +16 -0
  5. data/.github/workflows/release_request.yml +15 -0
  6. data/.github/workflows/ruby.yml +1 -1
  7. data/.github/workflows/services.yml +28 -0
  8. data/.rubocop.yml +8 -0
  9. data/Gemfile +7 -7
  10. data/Makefile +14 -10
  11. data/README.md +13 -10
  12. data/Rakefile +3 -3
  13. data/adyen-ruby-api-library.gemspec +6 -3
  14. data/bin/console +2 -2
  15. data/lib/adyen/client.rb +96 -76
  16. data/lib/adyen/errors.rb +23 -18
  17. data/lib/adyen/hash_with_accessors.rb +12 -7
  18. data/lib/adyen/services/balanceControlService.rb +7 -14
  19. data/lib/adyen/services/balancePlatform/account_holders_api.rb +22 -38
  20. data/lib/adyen/services/balancePlatform/balance_accounts_api.rb +48 -79
  21. data/lib/adyen/services/balancePlatform/bank_account_validation_api.rb +6 -13
  22. data/lib/adyen/services/balancePlatform/grant_accounts_api.rb +6 -13
  23. data/lib/adyen/services/balancePlatform/grant_offers_api.rb +12 -22
  24. data/lib/adyen/services/balancePlatform/payment_instrument_groups_api.rb +16 -29
  25. data/lib/adyen/services/balancePlatform/payment_instruments_api.rb +26 -45
  26. data/lib/adyen/services/balancePlatform/platform_api.rb +12 -22
  27. data/lib/adyen/services/balancePlatform/transaction_rules_api.rb +21 -37
  28. data/lib/adyen/services/balancePlatform.rb +38 -40
  29. data/lib/adyen/services/binLookup.rb +12 -22
  30. data/lib/adyen/services/checkout/classic_checkout_sdk_api.rb +11 -21
  31. data/lib/adyen/services/checkout/modifications_api.rb +31 -53
  32. data/lib/adyen/services/checkout/orders_api.rb +16 -29
  33. data/lib/adyen/services/checkout/payment_links_api.rb +16 -29
  34. data/lib/adyen/services/checkout/payments_api.rb +40 -53
  35. data/lib/adyen/services/checkout/recurring_api.rb +13 -23
  36. data/lib/adyen/services/checkout/utility_api.rb +11 -21
  37. data/lib/adyen/services/checkout.rb +32 -34
  38. data/lib/adyen/services/dataProtection.rb +7 -14
  39. data/lib/adyen/services/dispute.rb +6 -5
  40. data/lib/adyen/services/legalEntityManagement/business_lines_api.rb +21 -37
  41. data/lib/adyen/services/legalEntityManagement/documents_api.rb +21 -37
  42. data/lib/adyen/services/legalEntityManagement/hosted_onboarding_api.rb +16 -29
  43. data/lib/adyen/services/legalEntityManagement/legal_entities_api.rb +26 -45
  44. data/lib/adyen/services/legalEntityManagement/pci_questionnaires_api.rb +21 -37
  45. data/lib/adyen/services/legalEntityManagement/terms_of_service_api.rb +25 -29
  46. data/lib/adyen/services/legalEntityManagement/transfer_instruments_api.rb +21 -37
  47. data/lib/adyen/services/legalEntityManagement.rb +32 -34
  48. data/lib/adyen/services/management/account_company_level_api.rb +18 -31
  49. data/lib/adyen/services/management/account_merchant_level_api.rb +22 -38
  50. data/lib/adyen/services/management/account_store_level_api.rb +43 -71
  51. data/lib/adyen/services/management/allowed_origins_company_level_api.rb +21 -37
  52. data/lib/adyen/services/management/allowed_origins_merchant_level_api.rb +21 -37
  53. data/lib/adyen/services/management/api_credentials_company_level_api.rb +22 -38
  54. data/lib/adyen/services/management/api_credentials_merchant_level_api.rb +22 -38
  55. data/lib/adyen/services/management/api_key_company_level_api.rb +6 -13
  56. data/lib/adyen/services/management/api_key_merchant_level_api.rb +6 -13
  57. data/lib/adyen/services/management/client_key_company_level_api.rb +6 -13
  58. data/lib/adyen/services/management/client_key_merchant_level_api.rb +6 -13
  59. data/lib/adyen/services/management/my_api_credential_api.rb +26 -45
  60. data/lib/adyen/services/management/payment_methods_merchant_level_api.rb +32 -54
  61. data/lib/adyen/services/management/payout_settings_merchant_level_api.rb +26 -45
  62. data/lib/adyen/services/management/split_configuration_merchant_level_api.rb +92 -0
  63. data/lib/adyen/services/management/terminal_actions_company_level_api.rb +24 -40
  64. data/lib/adyen/services/management/terminal_actions_terminal_level_api.rb +6 -13
  65. data/lib/adyen/services/management/terminal_orders_company_level_api.rb +55 -89
  66. data/lib/adyen/services/management/terminal_orders_merchant_level_api.rb +55 -89
  67. data/lib/adyen/services/management/terminal_settings_company_level_api.rb +23 -39
  68. data/lib/adyen/services/management/terminal_settings_merchant_level_api.rb +23 -39
  69. data/lib/adyen/services/management/terminal_settings_store_level_api.rb +45 -73
  70. data/lib/adyen/services/management/terminal_settings_terminal_level_api.rb +21 -37
  71. data/lib/adyen/services/management/terminals_terminal_level_api.rb +7 -14
  72. data/lib/adyen/services/management/users_company_level_api.rb +22 -38
  73. data/lib/adyen/services/management/users_merchant_level_api.rb +22 -38
  74. data/lib/adyen/services/management/webhooks_company_level_api.rb +37 -62
  75. data/lib/adyen/services/management/webhooks_merchant_level_api.rb +37 -62
  76. data/lib/adyen/services/management.rb +99 -96
  77. data/lib/adyen/services/marketpay.rb +42 -36
  78. data/lib/adyen/services/payment/general_api.rb +56 -0
  79. data/lib/adyen/services/payment/modifications_api.rb +83 -0
  80. data/lib/adyen/services/payment.rb +10 -158
  81. data/lib/adyen/services/payout/initialization_api.rb +16 -29
  82. data/lib/adyen/services/payout/instant_payouts_api.rb +6 -13
  83. data/lib/adyen/services/payout/reviewing_api.rb +11 -21
  84. data/lib/adyen/services/payout.rb +19 -21
  85. data/lib/adyen/services/posTerminalManagement.rb +27 -46
  86. data/lib/adyen/services/recurring.rb +32 -54
  87. data/lib/adyen/services/service.rb +5 -4
  88. data/lib/adyen/services/storedValue.rb +32 -54
  89. data/lib/adyen/services/transfers/capital_api.rb +38 -0
  90. data/lib/adyen/services/transfers/transactions_api.rb +12 -22
  91. data/lib/adyen/services/transfers/transfers_api.rb +6 -13
  92. data/lib/adyen/services/transfers.rb +20 -17
  93. data/lib/adyen/utils/hmac_validator.rb +9 -9
  94. data/lib/adyen/version.rb +3 -3
  95. data/lib/adyen-ruby-api-library.rb +21 -21
  96. data/spec/account_spec.rb +20 -20
  97. data/spec/balance_control_spec.rb +28 -29
  98. data/spec/balance_platform_spec.rb +108 -102
  99. data/spec/bin_lookup_spec.rb +50 -50
  100. data/spec/checkout_spec.rb +581 -515
  101. data/spec/client_spec.rb +118 -71
  102. data/spec/data_protection_spec.rb +4 -4
  103. data/spec/dispute_spec.rb +7 -7
  104. data/spec/errors_spec.rb +37 -17
  105. data/spec/fund_spec.rb +10 -10
  106. data/spec/hash_with_accessors_spec.rb +18 -8
  107. data/spec/hop_spec.rb +4 -4
  108. data/spec/lem_spec.rb +44 -49
  109. data/spec/management_spec.rb +46 -48
  110. data/spec/notification_spec.rb +9 -9
  111. data/spec/payments_spec.rb +31 -32
  112. data/spec/payouts_spec.rb +29 -32
  113. data/spec/pos_terminal_management_spec.rb +30 -32
  114. data/spec/recurring_spec.rb +8 -8
  115. data/spec/service_spec.rb +4 -0
  116. data/spec/spec_helper.rb +37 -35
  117. data/spec/stored_value_spec.rb +28 -27
  118. data/spec/transfers_spec.rb +48 -47
  119. data/spec/utils/hmac_validator_spec.rb +15 -14
  120. data/templates/api-single.mustache +13 -15
  121. data/templates/api-small.mustache +8 -15
  122. data/templates/api.mustache +7 -14
  123. metadata +27 -18
  124. data/.github/dependabot.yml +0 -8
  125. /data/spec/mocks/responses/Webhooks/{backslash_notification.json → backslash_webhook.json} +0 -0
  126. /data/spec/mocks/responses/Webhooks/{colon_notification.json → colon_webhook.json} +0 -0
  127. /data/spec/mocks/responses/Webhooks/{forwardslash_notification.json → forwardslash_webhook.json} +0 -0
  128. /data/spec/mocks/responses/Webhooks/{mixed_notification.json → mixed_webhook.json} +0 -0
@@ -1,171 +1,23 @@
1
- require_relative './service'
2
- module Adyen
3
-
1
+ require_relative 'payment/general_api'
2
+ require_relative 'payment/modifications_api'
4
3
 
5
- class Payment < Service
4
+ module Adyen
5
+ class Payment
6
6
  attr_accessor :service, :version
7
- DEFAULT_VERSION = 68
8
7
 
8
+ DEFAULT_VERSION = 68
9
9
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = "Payment"
10
+ @service = 'Payment'
11
11
  @client = client
12
12
  @version = version
13
13
  end
14
14
 
15
- def adjust_authorisation(request, headers: {} )
16
- """
17
- Change the authorised amount
18
- """
19
- endpoint = "/adjustAuthorisation".gsub(/{.+?}/, '%s')
20
- endpoint = endpoint.gsub(/^\//, "")
21
- endpoint = endpoint % []
22
-
23
- action = { method: "post", url: endpoint}
24
- @client.call_adyen_api(@service, action, request, headers, @version)
25
- end
26
-
27
- def authorise(request, headers: {} )
28
- """
29
- Create an authorisation
30
- """
31
- endpoint = "/authorise".gsub(/{.+?}/, '%s')
32
- endpoint = endpoint.gsub(/^\//, "")
33
- endpoint = endpoint % []
34
-
35
- action = { method: "post", url: endpoint}
36
- @client.call_adyen_api(@service, action, request, headers, @version)
37
- end
38
-
39
- def authorise3d(request, headers: {} )
40
- """
41
- Complete a 3DS authorisation
42
- """
43
- endpoint = "/authorise3d".gsub(/{.+?}/, '%s')
44
- endpoint = endpoint.gsub(/^\//, "")
45
- endpoint = endpoint % []
46
-
47
- action = { method: "post", url: endpoint}
48
- @client.call_adyen_api(@service, action, request, headers, @version)
49
- end
50
-
51
- def authorise3ds2(request, headers: {} )
52
- """
53
- Complete a 3DS2 authorisation
54
- """
55
- endpoint = "/authorise3ds2".gsub(/{.+?}/, '%s')
56
- endpoint = endpoint.gsub(/^\//, "")
57
- endpoint = endpoint % []
58
-
59
- action = { method: "post", url: endpoint}
60
- @client.call_adyen_api(@service, action, request, headers, @version)
61
- end
62
-
63
- def cancel(request, headers: {} )
64
- """
65
- Cancel an authorisation
66
- """
67
- endpoint = "/cancel".gsub(/{.+?}/, '%s')
68
- endpoint = endpoint.gsub(/^\//, "")
69
- endpoint = endpoint % []
70
-
71
- action = { method: "post", url: endpoint}
72
- @client.call_adyen_api(@service, action, request, headers, @version)
73
- end
74
-
75
- def cancel_or_refund(request, headers: {} )
76
- """
77
- Cancel or refund a payment
78
- """
79
- endpoint = "/cancelOrRefund".gsub(/{.+?}/, '%s')
80
- endpoint = endpoint.gsub(/^\//, "")
81
- endpoint = endpoint % []
82
-
83
- action = { method: "post", url: endpoint}
84
- @client.call_adyen_api(@service, action, request, headers, @version)
85
- end
86
-
87
- def capture(request, headers: {} )
88
- """
89
- Capture an authorisation
90
- """
91
- endpoint = "/capture".gsub(/{.+?}/, '%s')
92
- endpoint = endpoint.gsub(/^\//, "")
93
- endpoint = endpoint % []
94
-
95
- action = { method: "post", url: endpoint}
96
- @client.call_adyen_api(@service, action, request, headers, @version)
97
- end
98
-
99
- def donate(request, headers: {} )
100
- """
101
- Create a donation
102
- """
103
- endpoint = "/donate".gsub(/{.+?}/, '%s')
104
- endpoint = endpoint.gsub(/^\//, "")
105
- endpoint = endpoint % []
106
-
107
- action = { method: "post", url: endpoint}
108
- @client.call_adyen_api(@service, action, request, headers, @version)
109
- end
110
-
111
- def get_authentication_result(request, headers: {} )
112
- """
113
- Get the 3DS authentication result
114
- """
115
- endpoint = "/getAuthenticationResult".gsub(/{.+?}/, '%s')
116
- endpoint = endpoint.gsub(/^\//, "")
117
- endpoint = endpoint % []
118
-
119
- action = { method: "post", url: endpoint}
120
- @client.call_adyen_api(@service, action, request, headers, @version)
121
- end
122
-
123
- def refund(request, headers: {} )
124
- """
125
- Refund a captured payment
126
- """
127
- endpoint = "/refund".gsub(/{.+?}/, '%s')
128
- endpoint = endpoint.gsub(/^\//, "")
129
- endpoint = endpoint % []
130
-
131
- action = { method: "post", url: endpoint}
132
- @client.call_adyen_api(@service, action, request, headers, @version)
133
- end
134
-
135
- def retrieve3ds2_result(request, headers: {} )
136
- """
137
- Get the 3DS2 authentication result
138
- """
139
- endpoint = "/retrieve3ds2Result".gsub(/{.+?}/, '%s')
140
- endpoint = endpoint.gsub(/^\//, "")
141
- endpoint = endpoint % []
142
-
143
- action = { method: "post", url: endpoint}
144
- @client.call_adyen_api(@service, action, request, headers, @version)
145
- end
146
-
147
- def technical_cancel(request, headers: {} )
148
- """
149
- Cancel an authorisation using your reference
150
- """
151
- endpoint = "/technicalCancel".gsub(/{.+?}/, '%s')
152
- endpoint = endpoint.gsub(/^\//, "")
153
- endpoint = endpoint % []
154
-
155
- action = { method: "post", url: endpoint}
156
- @client.call_adyen_api(@service, action, request, headers, @version)
15
+ def general_api
16
+ @general_api ||= Adyen::GeneralApi.new(@client, @version)
157
17
  end
158
18
 
159
- def void_pending_refund(request, headers: {} )
160
- """
161
- Cancel an in-person refund
162
- """
163
- endpoint = "/voidPendingRefund".gsub(/{.+?}/, '%s')
164
- endpoint = endpoint.gsub(/^\//, "")
165
- endpoint = endpoint % []
166
-
167
- action = { method: "post", url: endpoint}
168
- @client.call_adyen_api(@service, action, request, headers, @version)
19
+ def modifications_api
20
+ @modifications_api ||= Adyen::ModificationsApi.new(@client, @version)
169
21
  end
170
22
 
171
23
  end
@@ -1,49 +1,36 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class InitializationApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Payout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Payout')
12
8
  end
13
9
 
14
- def store_detail(request, headers: {} )
15
- """
16
- Store payout details
17
- """
18
- endpoint = "/storeDetail".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def store_detail(request, headers: {})
11
+ endpoint = '/storeDetail'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint)
21
14
 
22
- action = { method: "post", url: endpoint}
15
+ action = { method: 'post', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, request, headers, @version)
24
17
  end
25
18
 
26
- def store_detail_and_submit_third_party(request, headers: {} )
27
- """
28
- Store details and submit a payout
29
- """
30
- endpoint = "/storeDetailAndSubmitThirdParty".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % []
19
+ def store_detail_and_submit_third_party(request, headers: {})
20
+ endpoint = '/storeDetailAndSubmitThirdParty'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint)
33
23
 
34
- action = { method: "post", url: endpoint}
24
+ action = { method: 'post', url: endpoint }
35
25
  @client.call_adyen_api(@service, action, request, headers, @version)
36
26
  end
37
27
 
38
- def submit_third_party(request, headers: {} )
39
- """
40
- Submit a payout
41
- """
42
- endpoint = "/submitThirdParty".gsub(/{.+?}/, '%s')
43
- endpoint = endpoint.gsub(/^\//, "")
44
- endpoint = endpoint % []
28
+ def submit_third_party(request, headers: {})
29
+ endpoint = '/submitThirdParty'.gsub(/{.+?}/, '%s')
30
+ endpoint = endpoint.gsub(%r{^/}, '')
31
+ endpoint = format(endpoint)
45
32
 
46
- action = { method: "post", url: endpoint}
33
+ action = { method: 'post', url: endpoint }
47
34
  @client.call_adyen_api(@service, action, request, headers, @version)
48
35
  end
49
36
 
@@ -1,25 +1,18 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class InstantPayoutsApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Payout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Payout')
12
8
  end
13
9
 
14
- def payout(request, headers: {} )
15
- """
16
- Make an instant card payout
17
- """
18
- endpoint = "/payout".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def payout(request, headers: {})
11
+ endpoint = '/payout'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint)
21
14
 
22
- action = { method: "post", url: endpoint}
15
+ action = { method: 'post', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, request, headers, @version)
24
17
  end
25
18
 
@@ -1,37 +1,27 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class ReviewingApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Payout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Payout')
12
8
  end
13
9
 
14
- def confirm_third_party(request, headers: {} )
15
- """
16
- Confirm a payout
17
- """
18
- endpoint = "/confirmThirdParty".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def confirm_third_party(request, headers: {})
11
+ endpoint = '/confirmThirdParty'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint)
21
14
 
22
- action = { method: "post", url: endpoint}
15
+ action = { method: 'post', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, request, headers, @version)
24
17
  end
25
18
 
26
- def decline_third_party(request, headers: {} )
27
- """
28
- Cancel a payout
29
- """
30
- endpoint = "/declineThirdParty".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % []
19
+ def decline_third_party(request, headers: {})
20
+ endpoint = '/declineThirdParty'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint)
33
23
 
34
- action = { method: "post", url: endpoint}
24
+ action = { method: 'post', url: endpoint }
35
25
  @client.call_adyen_api(@service, action, request, headers, @version)
36
26
  end
37
27
 
@@ -3,29 +3,27 @@ require_relative 'payout/instant_payouts_api'
3
3
  require_relative 'payout/reviewing_api'
4
4
 
5
5
  module Adyen
6
-
6
+ class Payout
7
+ attr_accessor :service, :version
7
8
 
8
- class Payout
9
- attr_accessor :service, :version
10
-
11
- DEFAULT_VERSION = 68
12
- def initialize(client, version = DEFAULT_VERSION)
13
- @service = "Payout"
14
- @client = client
15
- @version = version
16
- end
17
-
18
- def initialization_api
19
- @initialization_api ||= Adyen::InitializationApi.new(@client, @version)
20
- end
9
+ DEFAULT_VERSION = 68
10
+ def initialize(client, version = DEFAULT_VERSION)
11
+ @service = 'Payout'
12
+ @client = client
13
+ @version = version
14
+ end
21
15
 
22
- def instant_payouts_api
23
- @instant_payouts_api ||= Adyen::InstantPayoutsApi.new(@client, @version)
24
- end
16
+ def initialization_api
17
+ @initialization_api ||= Adyen::InitializationApi.new(@client, @version)
18
+ end
25
19
 
26
- def reviewing_api
27
- @reviewing_api ||= Adyen::ReviewingApi.new(@client, @version)
28
- end
20
+ def instant_payouts_api
21
+ @instant_payouts_api ||= Adyen::InstantPayoutsApi.new(@client, @version)
22
+ end
29
23
 
24
+ def reviewing_api
25
+ @reviewing_api ||= Adyen::ReviewingApi.new(@client, @version)
30
26
  end
31
- end
27
+
28
+ end
29
+ end
@@ -1,74 +1,55 @@
1
1
  require_relative './service'
2
2
  module Adyen
3
-
4
-
5
3
  class PosTerminalManagement < Service
6
4
  attr_accessor :service, :version
7
- DEFAULT_VERSION = 1
8
5
 
6
+ DEFAULT_VERSION = 1
9
7
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = "PosTerminalManagement"
11
- @client = client
12
- @version = version
8
+ super(client, version, 'PosTerminalManagement')
13
9
  end
14
10
 
15
- def assign_terminals(request, headers: {} )
16
- """
17
- Assign terminals
18
- """
19
- endpoint = "/assignTerminals".gsub(/{.+?}/, '%s')
20
- endpoint = endpoint.gsub(/^\//, "")
21
- endpoint = endpoint % []
11
+ def assign_terminals(request, headers: {})
12
+ endpoint = '/assignTerminals'.gsub(/{.+?}/, '%s')
13
+ endpoint = endpoint.gsub(%r{^/}, '')
14
+ endpoint = format(endpoint)
22
15
 
23
- action = { method: "post", url: endpoint}
16
+ action = { method: 'post', url: endpoint }
24
17
  @client.call_adyen_api(@service, action, request, headers, @version)
25
18
  end
26
19
 
27
- def find_terminal(request, headers: {} )
28
- """
29
- Get the account or store of a terminal
30
- """
31
- endpoint = "/findTerminal".gsub(/{.+?}/, '%s')
32
- endpoint = endpoint.gsub(/^\//, "")
33
- endpoint = endpoint % []
20
+ def find_terminal(request, headers: {})
21
+ endpoint = '/findTerminal'.gsub(/{.+?}/, '%s')
22
+ endpoint = endpoint.gsub(%r{^/}, '')
23
+ endpoint = format(endpoint)
34
24
 
35
- action = { method: "post", url: endpoint}
25
+ action = { method: 'post', url: endpoint }
36
26
  @client.call_adyen_api(@service, action, request, headers, @version)
37
27
  end
38
28
 
39
- def get_stores_under_account(request, headers: {} )
40
- """
41
- Get the stores of an account
42
- """
43
- endpoint = "/getStoresUnderAccount".gsub(/{.+?}/, '%s')
44
- endpoint = endpoint.gsub(/^\//, "")
45
- endpoint = endpoint % []
29
+ def get_stores_under_account(request, headers: {})
30
+ endpoint = '/getStoresUnderAccount'.gsub(/{.+?}/, '%s')
31
+ endpoint = endpoint.gsub(%r{^/}, '')
32
+ endpoint = format(endpoint)
46
33
 
47
- action = { method: "post", url: endpoint}
34
+ action = { method: 'post', url: endpoint }
48
35
  @client.call_adyen_api(@service, action, request, headers, @version)
49
36
  end
50
37
 
51
- def get_terminal_details(request, headers: {} )
52
- """
53
- Get the details of a terminal
54
- """
55
- endpoint = "/getTerminalDetails".gsub(/{.+?}/, '%s')
56
- endpoint = endpoint.gsub(/^\//, "")
57
- endpoint = endpoint % []
38
+ def get_terminal_details(request, headers: {})
39
+ endpoint = '/getTerminalDetails'.gsub(/{.+?}/, '%s')
40
+ endpoint = endpoint.gsub(%r{^/}, '')
41
+ endpoint = format(endpoint)
58
42
 
59
- action = { method: "post", url: endpoint}
43
+ action = { method: 'post', url: endpoint }
60
44
  @client.call_adyen_api(@service, action, request, headers, @version)
61
45
  end
62
46
 
63
- def get_terminals_under_account(request, headers: {} )
64
- """
65
- Get the list of terminals
66
- """
67
- endpoint = "/getTerminalsUnderAccount".gsub(/{.+?}/, '%s')
68
- endpoint = endpoint.gsub(/^\//, "")
69
- endpoint = endpoint % []
47
+ def get_terminals_under_account(request, headers: {})
48
+ endpoint = '/getTerminalsUnderAccount'.gsub(/{.+?}/, '%s')
49
+ endpoint = endpoint.gsub(%r{^/}, '')
50
+ endpoint = format(endpoint)
70
51
 
71
- action = { method: "post", url: endpoint}
52
+ action = { method: 'post', url: endpoint }
72
53
  @client.call_adyen_api(@service, action, request, headers, @version)
73
54
  end
74
55
 
@@ -1,86 +1,64 @@
1
1
  require_relative './service'
2
2
  module Adyen
3
-
4
-
5
3
  class Recurring < Service
6
4
  attr_accessor :service, :version
7
- DEFAULT_VERSION = 68
8
5
 
6
+ DEFAULT_VERSION = 68
9
7
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = "Recurring"
11
- @client = client
12
- @version = version
8
+ super(client, version, 'Recurring')
13
9
  end
14
10
 
15
- def create_permit(request, headers: {} )
16
- """
17
- Create new permits linked to a recurring contract.
18
- """
19
- endpoint = "/createPermit".gsub(/{.+?}/, '%s')
20
- endpoint = endpoint.gsub(/^\//, "")
21
- endpoint = endpoint % []
11
+ def create_permit(request, headers: {})
12
+ endpoint = '/createPermit'.gsub(/{.+?}/, '%s')
13
+ endpoint = endpoint.gsub(%r{^/}, '')
14
+ endpoint = format(endpoint)
22
15
 
23
- action = { method: "post", url: endpoint}
16
+ action = { method: 'post', url: endpoint }
24
17
  @client.call_adyen_api(@service, action, request, headers, @version)
25
18
  end
26
19
 
27
- def disable(request, headers: {} )
28
- """
29
- Disable stored payment details
30
- """
31
- endpoint = "/disable".gsub(/{.+?}/, '%s')
32
- endpoint = endpoint.gsub(/^\//, "")
33
- endpoint = endpoint % []
20
+ def disable(request, headers: {})
21
+ endpoint = '/disable'.gsub(/{.+?}/, '%s')
22
+ endpoint = endpoint.gsub(%r{^/}, '')
23
+ endpoint = format(endpoint)
34
24
 
35
- action = { method: "post", url: endpoint}
25
+ action = { method: 'post', url: endpoint }
36
26
  @client.call_adyen_api(@service, action, request, headers, @version)
37
27
  end
38
28
 
39
- def disable_permit(request, headers: {} )
40
- """
41
- Disable an existing permit.
42
- """
43
- endpoint = "/disablePermit".gsub(/{.+?}/, '%s')
44
- endpoint = endpoint.gsub(/^\//, "")
45
- endpoint = endpoint % []
29
+ def disable_permit(request, headers: {})
30
+ endpoint = '/disablePermit'.gsub(/{.+?}/, '%s')
31
+ endpoint = endpoint.gsub(%r{^/}, '')
32
+ endpoint = format(endpoint)
46
33
 
47
- action = { method: "post", url: endpoint}
34
+ action = { method: 'post', url: endpoint }
48
35
  @client.call_adyen_api(@service, action, request, headers, @version)
49
36
  end
50
37
 
51
- def list_recurring_details(request, headers: {} )
52
- """
53
- Get stored payment details
54
- """
55
- endpoint = "/listRecurringDetails".gsub(/{.+?}/, '%s')
56
- endpoint = endpoint.gsub(/^\//, "")
57
- endpoint = endpoint % []
38
+ def list_recurring_details(request, headers: {})
39
+ endpoint = '/listRecurringDetails'.gsub(/{.+?}/, '%s')
40
+ endpoint = endpoint.gsub(%r{^/}, '')
41
+ endpoint = format(endpoint)
58
42
 
59
- action = { method: "post", url: endpoint}
43
+ action = { method: 'post', url: endpoint }
60
44
  @client.call_adyen_api(@service, action, request, headers, @version)
61
45
  end
62
46
 
63
- def notify_shopper(request, headers: {} )
64
- """
65
- Ask issuer to notify the shopper
66
- """
67
- endpoint = "/notifyShopper".gsub(/{.+?}/, '%s')
68
- endpoint = endpoint.gsub(/^\//, "")
69
- endpoint = endpoint % []
47
+ def notify_shopper(request, headers: {})
48
+ endpoint = '/notifyShopper'.gsub(/{.+?}/, '%s')
49
+ endpoint = endpoint.gsub(%r{^/}, '')
50
+ endpoint = format(endpoint)
70
51
 
71
- action = { method: "post", url: endpoint}
52
+ action = { method: 'post', url: endpoint }
72
53
  @client.call_adyen_api(@service, action, request, headers, @version)
73
54
  end
74
55
 
75
- def schedule_account_updater(request, headers: {} )
76
- """
77
- Schedule running the Account Updater
78
- """
79
- endpoint = "/scheduleAccountUpdater".gsub(/{.+?}/, '%s')
80
- endpoint = endpoint.gsub(/^\//, "")
81
- endpoint = endpoint % []
56
+ def schedule_account_updater(request, headers: {})
57
+ endpoint = '/scheduleAccountUpdater'.gsub(/{.+?}/, '%s')
58
+ endpoint = endpoint.gsub(%r{^/}, '')
59
+ endpoint = format(endpoint)
82
60
 
83
- action = { method: "post", url: endpoint}
61
+ action = { method: 'post', url: endpoint }
84
62
  @client.call_adyen_api(@service, action, request, headers, @version)
85
63
  end
86
64
 
@@ -1,6 +1,6 @@
1
1
  module Adyen
2
2
  class Service
3
- attr_accessor :service, :version, :create_query_string
3
+ attr_accessor :service, :version
4
4
 
5
5
  # add snake case to camel case converter to String
6
6
  # to convert rubinic method names to Adyen API methods
@@ -11,7 +11,7 @@ module Adyen
11
11
  method_name.to_s.gsub(/_./) { |x| x[1].upcase }
12
12
  end
13
13
 
14
- def initialize(client, version, service, method_names, with_application_info = [])
14
+ def initialize(client, version, service, method_names = [], with_application_info = [])
15
15
  @client = client
16
16
  @version = version
17
17
  @service = service
@@ -20,14 +20,15 @@ module Adyen
20
20
  method_names.each do |method_name|
21
21
  define_singleton_method method_name do |request, headers = {}|
22
22
  action = self.class.action_for_method_name(method_name)
23
- @client.call_adyen_api(@service, action, request, headers, @version, with_application_info.include?(method_name))
23
+ @client.call_adyen_api(@service, action, request, headers, @version,
24
+ _with_application_info: with_application_info.include?(method_name))
24
25
  end
25
26
  end
26
27
  end
27
28
 
28
29
  # create query parameter from a hash
29
30
  def create_query_string(arr)
30
- "?" + URI.encode_www_form(arr)
31
+ "?#{URI.encode_www_form(arr)}"
31
32
  end
32
33
  end
33
34
  end