adyen-ruby-api-library 7.0.1 → 7.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) 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 +16 -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 +91 -75
  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.rb +67 -110
  79. data/lib/adyen/services/payout/initialization_api.rb +16 -29
  80. data/lib/adyen/services/payout/instant_payouts_api.rb +6 -13
  81. data/lib/adyen/services/payout/reviewing_api.rb +11 -21
  82. data/lib/adyen/services/payout.rb +19 -21
  83. data/lib/adyen/services/posTerminalManagement.rb +27 -46
  84. data/lib/adyen/services/recurring.rb +32 -54
  85. data/lib/adyen/services/service.rb +5 -4
  86. data/lib/adyen/services/storedValue.rb +32 -54
  87. data/lib/adyen/services/transfers/capital_api.rb +38 -0
  88. data/lib/adyen/services/transfers/transactions_api.rb +12 -22
  89. data/lib/adyen/services/transfers/transfers_api.rb +6 -13
  90. data/lib/adyen/services/transfers.rb +20 -17
  91. data/lib/adyen/utils/hmac_validator.rb +18 -7
  92. data/lib/adyen/version.rb +3 -3
  93. data/lib/adyen-ruby-api-library.rb +21 -21
  94. data/spec/account_spec.rb +20 -20
  95. data/spec/balance_control_spec.rb +28 -29
  96. data/spec/balance_platform_spec.rb +108 -102
  97. data/spec/bin_lookup_spec.rb +50 -50
  98. data/spec/checkout_spec.rb +573 -524
  99. data/spec/client_spec.rb +117 -70
  100. data/spec/data_protection_spec.rb +4 -4
  101. data/spec/dispute_spec.rb +7 -7
  102. data/spec/errors_spec.rb +37 -17
  103. data/spec/fund_spec.rb +10 -10
  104. data/spec/hash_with_accessors_spec.rb +18 -8
  105. data/spec/hop_spec.rb +4 -4
  106. data/spec/lem_spec.rb +44 -49
  107. data/spec/management_spec.rb +46 -48
  108. data/spec/notification_spec.rb +9 -9
  109. data/spec/payments_spec.rb +29 -30
  110. data/spec/payouts_spec.rb +29 -32
  111. data/spec/pos_terminal_management_spec.rb +30 -32
  112. data/spec/recurring_spec.rb +8 -8
  113. data/spec/service_spec.rb +4 -0
  114. data/spec/spec_helper.rb +37 -35
  115. data/spec/stored_value_spec.rb +28 -27
  116. data/spec/transfers_spec.rb +48 -47
  117. data/spec/utils/hmac_validator_spec.rb +15 -14
  118. data/templates/api-single.mustache +13 -15
  119. data/templates/api-small.mustache +8 -15
  120. data/templates/api.mustache +7 -14
  121. metadata +25 -18
  122. data/.github/dependabot.yml +0 -8
  123. /data/spec/mocks/responses/Webhooks/{backslash_notification.json → backslash_webhook.json} +0 -0
  124. /data/spec/mocks/responses/Webhooks/{colon_notification.json → colon_webhook.json} +0 -0
  125. /data/spec/mocks/responses/Webhooks/{forwardslash_notification.json → forwardslash_webhook.json} +0 -0
  126. /data/spec/mocks/responses/Webhooks/{mixed_notification.json → mixed_webhook.json} +0 -0
@@ -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
@@ -1,86 +1,64 @@
1
1
  require_relative './service'
2
2
  module Adyen
3
-
4
-
5
3
  class StoredValue < Service
6
4
  attr_accessor :service, :version
7
- DEFAULT_VERSION = 46
8
5
 
6
+ DEFAULT_VERSION = 46
9
7
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = "StoredValue"
11
- @client = client
12
- @version = version
8
+ super(client, version, 'StoredValue')
13
9
  end
14
10
 
15
- def change_status(request, headers: {} )
16
- """
17
- Changes the status of the payment method.
18
- """
19
- endpoint = "/changeStatus".gsub(/{.+?}/, '%s')
20
- endpoint = endpoint.gsub(/^\//, "")
21
- endpoint = endpoint % []
11
+ def change_status(request, headers: {})
12
+ endpoint = '/changeStatus'.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 check_balance(request, headers: {} )
28
- """
29
- Checks the balance.
30
- """
31
- endpoint = "/checkBalance".gsub(/{.+?}/, '%s')
32
- endpoint = endpoint.gsub(/^\//, "")
33
- endpoint = endpoint % []
20
+ def check_balance(request, headers: {})
21
+ endpoint = '/checkBalance'.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 issue(request, headers: {} )
40
- """
41
- Issues a new card.
42
- """
43
- endpoint = "/issue".gsub(/{.+?}/, '%s')
44
- endpoint = endpoint.gsub(/^\//, "")
45
- endpoint = endpoint % []
29
+ def issue(request, headers: {})
30
+ endpoint = '/issue'.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 load(request, headers: {} )
52
- """
53
- Loads the payment method.
54
- """
55
- endpoint = "/load".gsub(/{.+?}/, '%s')
56
- endpoint = endpoint.gsub(/^\//, "")
57
- endpoint = endpoint % []
38
+ def load(request, headers: {})
39
+ endpoint = '/load'.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 merge_balance(request, headers: {} )
64
- """
65
- Merge the balance of two cards.
66
- """
67
- endpoint = "/mergeBalance".gsub(/{.+?}/, '%s')
68
- endpoint = endpoint.gsub(/^\//, "")
69
- endpoint = endpoint % []
47
+ def merge_balance(request, headers: {})
48
+ endpoint = '/mergeBalance'.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 void_transaction(request, headers: {} )
76
- """
77
- Voids a transaction.
78
- """
79
- endpoint = "/voidTransaction".gsub(/{.+?}/, '%s')
80
- endpoint = endpoint.gsub(/^\//, "")
81
- endpoint = endpoint % []
56
+ def void_transaction(request, headers: {})
57
+ endpoint = '/voidTransaction'.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
 
@@ -0,0 +1,38 @@
1
+ require_relative '../service'
2
+ module Adyen
3
+ class CapitalApi < Service
4
+ attr_accessor :service, :version
5
+
6
+ def initialize(client, version = DEFAULT_VERSION)
7
+ super(client, version, 'Transfers')
8
+ end
9
+
10
+ def get_capital_account(headers: {}, query_params: {})
11
+ endpoint = '/grants'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint)
14
+ endpoint += create_query_string(query_params)
15
+ action = { method: 'get', url: endpoint }
16
+ @client.call_adyen_api(@service, action, {}, headers, @version)
17
+ end
18
+
19
+ def get_grant_reference_details(id, headers: {})
20
+ endpoint = '/grants/{id}'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint, id)
23
+
24
+ action = { method: 'get', url: endpoint }
25
+ @client.call_adyen_api(@service, action, {}, headers, @version)
26
+ end
27
+
28
+ def request_grant_payout(request, headers: {})
29
+ endpoint = '/grants'.gsub(/{.+?}/, '%s')
30
+ endpoint = endpoint.gsub(%r{^/}, '')
31
+ endpoint = format(endpoint)
32
+
33
+ action = { method: 'post', url: endpoint }
34
+ @client.call_adyen_api(@service, action, request, headers, @version)
35
+ end
36
+
37
+ end
38
+ end
@@ -1,37 +1,27 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class TransactionsApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Transfers"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Transfers')
12
8
  end
13
9
 
14
- def get_all_transactions(headers: {} , queryParams: {})
15
- """
16
- Get all transactions
17
- """
18
- endpoint = "/transactions".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
21
- endpoint = endpoint + create_query_string(queryParams)
22
- action = { method: "get", url: endpoint}
10
+ def get_all_transactions(headers: {}, query_params: {})
11
+ endpoint = '/transactions'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint)
14
+ endpoint += create_query_string(query_params)
15
+ action = { method: 'get', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, {}, headers, @version)
24
17
  end
25
18
 
26
- def get_transaction(id, headers: {} )
27
- """
28
- Get a transaction
29
- """
30
- endpoint = "/transactions/{id}".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % [id]
19
+ def get_transaction(id, headers: {})
20
+ endpoint = '/transactions/{id}'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint, id)
33
23
 
34
- action = { method: "get", url: endpoint}
24
+ action = { method: 'get', url: endpoint }
35
25
  @client.call_adyen_api(@service, action, {}, headers, @version)
36
26
  end
37
27
 
@@ -1,25 +1,18 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class TransfersApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Transfers"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Transfers')
12
8
  end
13
9
 
14
- def transfer_funds(request, headers: {} )
15
- """
16
- Transfer funds
17
- """
18
- endpoint = "/transfers".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def transfer_funds(request, headers: {})
11
+ endpoint = '/transfers'.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,26 +1,29 @@
1
+ require_relative 'transfers/capital_api'
1
2
  require_relative 'transfers/transactions_api'
2
3
  require_relative 'transfers/transfers_api'
3
4
 
4
5
  module Adyen
5
-
6
+ class Transfers
7
+ attr_accessor :service, :version
6
8
 
7
- class Transfers
8
- attr_accessor :service, :version
9
-
10
- DEFAULT_VERSION = 3
11
- def initialize(client, version = DEFAULT_VERSION)
12
- @service = "Transfers"
13
- @client = client
14
- @version = version
15
- end
9
+ DEFAULT_VERSION = 3
10
+ def initialize(client, version = DEFAULT_VERSION)
11
+ @service = 'Transfers'
12
+ @client = client
13
+ @version = version
14
+ end
16
15
 
17
- def transactions_api
18
- @transactions_api ||= Adyen::TransactionsApi.new(@client, @version)
19
- end
16
+ def capital_api
17
+ @capital_api ||= Adyen::CapitalApi.new(@client, @version)
18
+ end
20
19
 
21
- def transfers_api
22
- @transfers_api ||= Adyen::TransfersApi.new(@client, @version)
23
- end
20
+ def transactions_api
21
+ @transactions_api ||= Adyen::TransactionsApi.new(@client, @version)
22
+ end
24
23
 
24
+ def transfers_api
25
+ @transfers_api ||= Adyen::TransfersApi.new(@client, @version)
25
26
  end
26
- end
27
+
28
+ end
29
+ end
@@ -3,28 +3,39 @@ module Adyen
3
3
  class HmacValidator
4
4
  HMAC_ALGORITHM = 'sha256'.freeze
5
5
  DATA_SEPARATOR = ':'.freeze
6
- NOTIFICATION_VALIDATION_KEYS = %w[
6
+ WEBHOOK_VALIDATION_KEYS = %w[
7
7
  pspReference originalReference merchantAccountCode merchantReference
8
8
  amount.value amount.currency eventCode success
9
9
  ].freeze
10
10
 
11
+ # <b>DEPRECATED:</b> Please use valid_webhook_hmac?() instead.
11
12
  def valid_notification_hmac?(notification_request_item, hmac_key)
12
- expected_sign = calculate_notification_hmac(notification_request_item, hmac_key)
13
- merchant_sign = fetch(notification_request_item, 'additionalData.hmacSignature')
13
+ valid_webhook_hmac?(notification_request_item, hmac_key)
14
+ end
15
+
16
+ def valid_webhook_hmac?(webhook_request_item, hmac_key)
17
+ expected_sign = calculate_webhook_hmac(webhook_request_item, hmac_key)
18
+ merchant_sign = fetch(webhook_request_item, 'additionalData.hmacSignature')
14
19
 
15
20
  expected_sign == merchant_sign
16
21
  end
17
22
 
23
+ # <b>DEPRECATED:</b> Please use calculate_webhook_hmac() instead.
18
24
  def calculate_notification_hmac(notification_request_item, hmac_key)
19
- data = data_to_sign(notification_request_item)
25
+ calculate_webhook_hmac(notification_request_item, hmac_key)
26
+ end
27
+
28
+
29
+ def calculate_webhook_hmac(webhook_request_item, hmac_key)
30
+ data = data_to_sign(webhook_request_item)
20
31
 
21
32
  Base64.strict_encode64(OpenSSL::HMAC.digest(HMAC_ALGORITHM, [hmac_key].pack('H*'), data))
22
33
  end
23
34
 
24
- def data_to_sign(notification_request_item)
25
- data = NOTIFICATION_VALIDATION_KEYS.map { |key| fetch(notification_request_item, key).to_s }
35
+
36
+ def data_to_sign(webhook_request_item)
37
+ data = WEBHOOK_VALIDATION_KEYS.map { |key| fetch(webhook_request_item, key).to_s }
26
38
  .join(DATA_SEPARATOR)
27
- return data
28
39
  end
29
40
 
30
41
  private
data/lib/adyen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Adyen
2
- NAME = "adyen-ruby-api-library"
3
- VERSION = "7.0.1".freeze
4
- end
2
+ NAME = 'adyen-ruby-api-library'.freeze
3
+ VERSION = '7.0.3'.freeze
4
+ end
@@ -1,21 +1,21 @@
1
- require_relative "adyen/version"
2
- require_relative "adyen/client"
3
- require_relative "adyen/errors"
4
- require_relative "adyen/services/checkout"
5
- require_relative "adyen/services/payment"
6
- require_relative "adyen/services/payout"
7
- require_relative "adyen/services/recurring"
8
- require_relative "adyen/services/marketpay"
9
- require_relative "adyen/services/posTerminalManagement"
10
- require_relative "adyen/services/service"
11
- require_relative "adyen/services/dataProtection"
12
- require_relative "adyen/services/dispute"
13
- require_relative "adyen/services/binLookup"
14
- require_relative "adyen/hash_with_accessors"
15
- require_relative "adyen/utils/hmac_validator"
16
- require_relative "adyen/services/legalEntityManagement"
17
- require_relative "adyen/services/balancePlatform"
18
- require_relative "adyen/services/transfers"
19
- require_relative "adyen/services/management"
20
- require_relative "adyen/services/storedValue"
21
- require_relative "adyen/services/balanceControlService"
1
+ require_relative 'adyen/version'
2
+ require_relative 'adyen/client'
3
+ require_relative 'adyen/errors'
4
+ require_relative 'adyen/services/checkout'
5
+ require_relative 'adyen/services/payment'
6
+ require_relative 'adyen/services/payout'
7
+ require_relative 'adyen/services/recurring'
8
+ require_relative 'adyen/services/marketpay'
9
+ require_relative 'adyen/services/posTerminalManagement'
10
+ require_relative 'adyen/services/service'
11
+ require_relative 'adyen/services/dataProtection'
12
+ require_relative 'adyen/services/dispute'
13
+ require_relative 'adyen/services/binLookup'
14
+ require_relative 'adyen/hash_with_accessors'
15
+ require_relative 'adyen/utils/hmac_validator'
16
+ require_relative 'adyen/services/legalEntityManagement'
17
+ require_relative 'adyen/services/balancePlatform'
18
+ require_relative 'adyen/services/transfers'
19
+ require_relative 'adyen/services/management'
20
+ require_relative 'adyen/services/storedValue'
21
+ require_relative 'adyen/services/balanceControlService'
data/spec/account_spec.rb CHANGED
@@ -1,30 +1,30 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
- RSpec.describe Adyen::Payment, service: "marketpay account service" do
3
+ RSpec.describe Adyen::Payment, service: 'marketpay account service' do
4
4
  # client instance to be used in dynamically generated tests
5
5
  client = create_client(:basic)
6
6
 
7
7
  # methods / values to test for
8
8
  # format is defined in spec_helper
9
9
  test_sets = [
10
- ["create_account_holder", "accountHolderCode", "TestAccountHolder781664"],
11
- ["get_account_holder", "pspReference", "8815263414367329"],
12
- ["update_account_holder", "pspReference", "9914762676580105"],
13
- ["update_account_holder_state", "pspReference", "8515090175978108"],
14
- ["suspend_account_holder", "pspReference", "9914762643560032"],
15
- ["un_suspend_account_holder", "pspReference", "9914762644860159"],
16
- ["close_account_holder", "pspReference", "9914713476670992"],
17
- ["create_account", "status", "Active"],
18
- ["update_account", "pspReference", "9914860311410009"],
19
- ["close_account", "status", "Closed"],
20
- ["upload_document", "pspReference", "9914762681460244"],
21
- ["get_uploaded_documents", "pspReference", "9914694369860322"],
22
- ["delete_bank_accounts", "pspReference", "9914694372670551"],
23
- ["delete_shareholders", "pspReference", "9914694372990637"],
24
- ["delete_signatories", "pspReference", "9914694372990637"],
25
- ["delete_payout_methods", "pspReference", "9914694372990637"],
26
- ["check_account_holder", "pspReference", "9914694372990637"],
10
+ %w[create_account_holder accountHolderCode TestAccountHolder781664],
11
+ %w[get_account_holder pspReference 8815263414367329],
12
+ %w[update_account_holder pspReference 9914762676580105],
13
+ %w[update_account_holder_state pspReference 8515090175978108],
14
+ %w[suspend_account_holder pspReference 9914762643560032],
15
+ %w[un_suspend_account_holder pspReference 9914762644860159],
16
+ %w[close_account_holder pspReference 9914713476670992],
17
+ %w[create_account status Active],
18
+ %w[update_account pspReference 9914860311410009],
19
+ %w[close_account status Closed],
20
+ %w[upload_document pspReference 9914762681460244],
21
+ %w[get_uploaded_documents pspReference 9914694369860322],
22
+ %w[delete_bank_accounts pspReference 9914694372670551],
23
+ %w[delete_shareholders pspReference 9914694372990637],
24
+ %w[delete_signatories pspReference 9914694372990637],
25
+ %w[delete_payout_methods pspReference 9914694372990637],
26
+ %w[check_account_holder pspReference 9914694372990637]
27
27
  ]
28
28
 
29
- generate_tests(client, "Account", test_sets, client.marketpay.account)
29
+ generate_tests(client, 'Account', test_sets, client.marketpay.account)
30
30
  end
@@ -1,44 +1,43 @@
1
- require "spec_helper"
2
- require "json"
1
+ require 'spec_helper'
2
+ require 'json'
3
3
 
4
- # rubocop:disable Metrics/BlockLength
5
-
6
- RSpec.describe Adyen::BalancePlatform, service: "balancePlatform" do
4
+ RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
7
5
  before(:all) do
8
6
  @shared_values = {
9
7
  client: create_client(:api_key),
10
- service: "BalancePlatform",
8
+ service: 'BalancePlatform'
11
9
  }
12
10
  end
13
11
 
14
12
  # must be created manually because every field in the response is an array
15
- it "makes a balance transfer POST call" do
16
- request_body = JSON.parse(json_from_file("mocks/requests/BalanceControl/balance_transfer.json"))
13
+ it 'makes a balance transfer POST call' do
14
+ request_body = JSON.parse(json_from_file('mocks/requests/BalanceControl/balance_transfer.json'))
17
15
 
18
- response_body = json_from_file("mocks/responses/BalanceControl/balance_transfer.json")
16
+ response_body = json_from_file('mocks/responses/BalanceControl/balance_transfer.json')
19
17
 
20
- url = @shared_values[:client].service_url(@shared_values[:service], "balanceTransfer", @shared_values[:client].balance_control_service.version)
21
- WebMock.stub_request(:post, url).
22
- with(
23
- body: request_body,
24
- headers: {
25
- "x-api-key" => @shared_values[:client].api_key
26
- }
27
- ).
28
- to_return(
29
- body: response_body
30
- )
18
+ url = @shared_values[:client].service_url(@shared_values[:service], 'balanceTransfer',
19
+ @shared_values[:client].balance_control_service.version)
20
+ WebMock.stub_request(:post, url)
21
+ .with(
22
+ body: request_body,
23
+ headers: {
24
+ 'x-api-key' => @shared_values[:client].api_key
25
+ }
26
+ )
27
+ .to_return(
28
+ body: response_body
29
+ )
31
30
 
32
31
  result = @shared_values[:client].balance_control_service.balance_transfer(request_body)
33
32
  response_hash = result.response
34
33
 
35
- expect(result.status).
36
- to eq(200)
37
- expect(response_hash).
38
- to eq(JSON.parse(response_body))
39
- expect(response_hash).
40
- to be_a Adyen::HashWithAccessors
41
- expect(response_hash).
42
- to be_a_kind_of Hash
34
+ expect(result.status)
35
+ .to eq(200)
36
+ expect(response_hash)
37
+ .to eq(JSON.parse(response_body))
38
+ expect(response_hash)
39
+ .to be_a Adyen::HashWithAccessors
40
+ expect(response_hash)
41
+ .to be_a_kind_of Hash
43
42
  end
44
- end
43
+ end