adyen-ruby-api-library 7.0.1 → 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 +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/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 +573 -524
  101. data/spec/client_spec.rb +117 -70
  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,73 +1,54 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class PaymentInstrumentsApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "BalancePlatform"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'BalancePlatform')
12
8
  end
13
9
 
14
- def get_payment_instrument(id, headers: {} )
15
- """
16
- Get a payment instrument
17
- """
18
- endpoint = "/paymentInstruments/{id}".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % [id]
10
+ def get_payment_instrument(id, headers: {})
11
+ endpoint = '/paymentInstruments/{id}'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint, id)
21
14
 
22
- action = { method: "get", url: endpoint}
15
+ action = { method: 'get', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, {}, headers, @version)
24
17
  end
25
18
 
26
- def get_pan_of_payment_instrument(id, headers: {} )
27
- """
28
- Get the PAN of a payment instrument
29
- """
30
- endpoint = "/paymentInstruments/{id}/reveal".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % [id]
19
+ def get_pan_of_payment_instrument(id, headers: {})
20
+ endpoint = '/paymentInstruments/{id}/reveal'.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
 
38
- def get_all_transaction_rules_for_payment_instrument(id, headers: {} )
39
- """
40
- Get all transaction rules for a payment instrument
41
- """
42
- endpoint = "/paymentInstruments/{id}/transactionRules".gsub(/{.+?}/, '%s')
43
- endpoint = endpoint.gsub(/^\//, "")
44
- endpoint = endpoint % [id]
28
+ def get_all_transaction_rules_for_payment_instrument(id, headers: {})
29
+ endpoint = '/paymentInstruments/{id}/transactionRules'.gsub(/{.+?}/, '%s')
30
+ endpoint = endpoint.gsub(%r{^/}, '')
31
+ endpoint = format(endpoint, id)
45
32
 
46
- action = { method: "get", url: endpoint}
33
+ action = { method: 'get', url: endpoint }
47
34
  @client.call_adyen_api(@service, action, {}, headers, @version)
48
35
  end
49
36
 
50
- def update_payment_instrument(request, id, headers: {} )
51
- """
52
- Update a payment instrument
53
- """
54
- endpoint = "/paymentInstruments/{id}".gsub(/{.+?}/, '%s')
55
- endpoint = endpoint.gsub(/^\//, "")
56
- endpoint = endpoint % [id]
37
+ def update_payment_instrument(request, id, headers: {})
38
+ endpoint = '/paymentInstruments/{id}'.gsub(/{.+?}/, '%s')
39
+ endpoint = endpoint.gsub(%r{^/}, '')
40
+ endpoint = format(endpoint, id)
57
41
 
58
- action = { method: "patch", url: endpoint}
42
+ action = { method: 'patch', url: endpoint }
59
43
  @client.call_adyen_api(@service, action, request, headers, @version)
60
44
  end
61
45
 
62
- def create_payment_instrument(request, headers: {} )
63
- """
64
- Create a payment instrument
65
- """
66
- endpoint = "/paymentInstruments".gsub(/{.+?}/, '%s')
67
- endpoint = endpoint.gsub(/^\//, "")
68
- endpoint = endpoint % []
46
+ def create_payment_instrument(request, headers: {})
47
+ endpoint = '/paymentInstruments'.gsub(/{.+?}/, '%s')
48
+ endpoint = endpoint.gsub(%r{^/}, '')
49
+ endpoint = format(endpoint)
69
50
 
70
- action = { method: "post", url: endpoint}
51
+ action = { method: 'post', url: endpoint }
71
52
  @client.call_adyen_api(@service, action, request, headers, @version)
72
53
  end
73
54
 
@@ -1,37 +1,27 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class PlatformApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "BalancePlatform"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'BalancePlatform')
12
8
  end
13
9
 
14
- def get_balance_platform(id, headers: {} )
15
- """
16
- Get a balance platform
17
- """
18
- endpoint = "/balancePlatforms/{id}".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % [id]
10
+ def get_balance_platform(id, headers: {})
11
+ endpoint = '/balancePlatforms/{id}'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint, id)
21
14
 
22
- action = { method: "get", url: endpoint}
15
+ action = { method: 'get', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, {}, headers, @version)
24
17
  end
25
18
 
26
- def get_all_account_holders_under_balance_platform(id, headers: {} , queryParams: {})
27
- """
28
- Get all account holders under a balance platform
29
- """
30
- endpoint = "/balancePlatforms/{id}/accountHolders".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % [id]
33
- endpoint = endpoint + create_query_string(queryParams)
34
- action = { method: "get", url: endpoint}
19
+ def get_all_account_holders_under_balance_platform(id, headers: {}, query_params: {})
20
+ endpoint = '/balancePlatforms/{id}/accountHolders'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint, id)
23
+ endpoint += create_query_string(query_params)
24
+ action = { method: 'get', url: endpoint }
35
25
  @client.call_adyen_api(@service, action, {}, headers, @version)
36
26
  end
37
27
 
@@ -1,61 +1,45 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class TransactionRulesApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "BalancePlatform"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'BalancePlatform')
12
8
  end
13
9
 
14
- def delete_transaction_rule(transactionRuleId, headers: {} )
15
- """
16
- Delete a transaction rule
17
- """
18
- endpoint = "/transactionRules/{transactionRuleId}".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % [transactionRuleId]
10
+ def delete_transaction_rule(transaction_rule_id, headers: {})
11
+ endpoint = '/transactionRules/{transactionRuleId}'.gsub(/{.+?}/, '%s')
12
+ endpoint = endpoint.gsub(%r{^/}, '')
13
+ endpoint = format(endpoint, transaction_rule_id)
21
14
 
22
- action = { method: "delete", url: endpoint}
15
+ action = { method: 'delete', url: endpoint }
23
16
  @client.call_adyen_api(@service, action, {}, headers, @version)
24
17
  end
25
18
 
26
- def get_transaction_rule(transactionRuleId, headers: {} )
27
- """
28
- Get a transaction rule
29
- """
30
- endpoint = "/transactionRules/{transactionRuleId}".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % [transactionRuleId]
19
+ def get_transaction_rule(transaction_rule_id, headers: {})
20
+ endpoint = '/transactionRules/{transactionRuleId}'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint, transaction_rule_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
 
38
- def update_transaction_rule(request, transactionRuleId, headers: {} )
39
- """
40
- Update a transaction rule
41
- """
42
- endpoint = "/transactionRules/{transactionRuleId}".gsub(/{.+?}/, '%s')
43
- endpoint = endpoint.gsub(/^\//, "")
44
- endpoint = endpoint % [transactionRuleId]
28
+ def update_transaction_rule(request, transaction_rule_id, headers: {})
29
+ endpoint = '/transactionRules/{transactionRuleId}'.gsub(/{.+?}/, '%s')
30
+ endpoint = endpoint.gsub(%r{^/}, '')
31
+ endpoint = format(endpoint, transaction_rule_id)
45
32
 
46
- action = { method: "patch", url: endpoint}
33
+ action = { method: 'patch', url: endpoint }
47
34
  @client.call_adyen_api(@service, action, request, headers, @version)
48
35
  end
49
36
 
50
- def create_transaction_rule(request, headers: {} )
51
- """
52
- Create a transaction rule
53
- """
54
- endpoint = "/transactionRules".gsub(/{.+?}/, '%s')
55
- endpoint = endpoint.gsub(/^\//, "")
56
- endpoint = endpoint % []
37
+ def create_transaction_rule(request, headers: {})
38
+ endpoint = '/transactionRules'.gsub(/{.+?}/, '%s')
39
+ endpoint = endpoint.gsub(%r{^/}, '')
40
+ endpoint = format(endpoint)
57
41
 
58
- action = { method: "post", url: endpoint}
42
+ action = { method: 'post', url: endpoint }
59
43
  @client.call_adyen_api(@service, action, request, headers, @version)
60
44
  end
61
45
 
@@ -9,53 +9,51 @@ require_relative 'balancePlatform/platform_api'
9
9
  require_relative 'balancePlatform/transaction_rules_api'
10
10
 
11
11
  module Adyen
12
-
13
-
14
- class BalancePlatform
15
- attr_accessor :service, :version
16
-
17
- DEFAULT_VERSION = 2
18
- def initialize(client, version = DEFAULT_VERSION)
19
- @service = "BalancePlatform"
20
- @client = client
21
- @version = version
22
- end
23
-
24
- def account_holders_api
25
- @account_holders_api ||= Adyen::AccountHoldersApi.new(@client, @version)
26
- end
12
+ class BalancePlatform
13
+ attr_accessor :service, :version
14
+
15
+ DEFAULT_VERSION = 2
16
+ def initialize(client, version = DEFAULT_VERSION)
17
+ @service = 'BalancePlatform'
18
+ @client = client
19
+ @version = version
20
+ end
27
21
 
28
- def balance_accounts_api
29
- @balance_accounts_api ||= Adyen::BalanceAccountsApi.new(@client, @version)
30
- end
22
+ def account_holders_api
23
+ @account_holders_api ||= Adyen::AccountHoldersApi.new(@client, @version)
24
+ end
31
25
 
32
- def bank_account_validation_api
33
- @bank_account_validation_api ||= Adyen::BankAccountValidationApi.new(@client, @version)
34
- end
26
+ def balance_accounts_api
27
+ @balance_accounts_api ||= Adyen::BalanceAccountsApi.new(@client, @version)
28
+ end
35
29
 
36
- def grant_accounts_api
37
- @grant_accounts_api ||= Adyen::GrantAccountsApi.new(@client, @version)
38
- end
30
+ def bank_account_validation_api
31
+ @bank_account_validation_api ||= Adyen::BankAccountValidationApi.new(@client, @version)
32
+ end
39
33
 
40
- def grant_offers_api
41
- @grant_offers_api ||= Adyen::GrantOffersApi.new(@client, @version)
42
- end
34
+ def grant_accounts_api
35
+ @grant_accounts_api ||= Adyen::GrantAccountsApi.new(@client, @version)
36
+ end
43
37
 
44
- def payment_instrument_groups_api
45
- @payment_instrument_groups_api ||= Adyen::PaymentInstrumentGroupsApi.new(@client, @version)
46
- end
38
+ def grant_offers_api
39
+ @grant_offers_api ||= Adyen::GrantOffersApi.new(@client, @version)
40
+ end
47
41
 
48
- def payment_instruments_api
49
- @payment_instruments_api ||= Adyen::PaymentInstrumentsApi.new(@client, @version)
50
- end
42
+ def payment_instrument_groups_api
43
+ @payment_instrument_groups_api ||= Adyen::PaymentInstrumentGroupsApi.new(@client, @version)
44
+ end
51
45
 
52
- def platform_api
53
- @platform_api ||= Adyen::PlatformApi.new(@client, @version)
54
- end
46
+ def payment_instruments_api
47
+ @payment_instruments_api ||= Adyen::PaymentInstrumentsApi.new(@client, @version)
48
+ end
55
49
 
56
- def transaction_rules_api
57
- @transaction_rules_api ||= Adyen::TransactionRulesApi.new(@client, @version)
58
- end
50
+ def platform_api
51
+ @platform_api ||= Adyen::PlatformApi.new(@client, @version)
52
+ end
59
53
 
54
+ def transaction_rules_api
55
+ @transaction_rules_api ||= Adyen::TransactionRulesApi.new(@client, @version)
60
56
  end
61
- end
57
+
58
+ end
59
+ end
@@ -1,38 +1,28 @@
1
1
  require_relative './service'
2
2
  module Adyen
3
-
4
-
5
3
  class BinLookup < Service
6
4
  attr_accessor :service, :version
7
- DEFAULT_VERSION = 54
8
5
 
6
+ DEFAULT_VERSION = 54
9
7
  def initialize(client, version = DEFAULT_VERSION)
10
- @service = "BinLookup"
11
- @client = client
12
- @version = version
8
+ super(client, version, 'BinLookup')
13
9
  end
14
10
 
15
- def get3ds_availability(request, headers: {} )
16
- """
17
- Check if 3D Secure is available
18
- """
19
- endpoint = "/get3dsAvailability".gsub(/{.+?}/, '%s')
20
- endpoint = endpoint.gsub(/^\//, "")
21
- endpoint = endpoint % []
11
+ def get3ds_availability(request, headers: {})
12
+ endpoint = '/get3dsAvailability'.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 get_cost_estimate(request, headers: {} )
28
- """
29
- Get a fees cost estimate
30
- """
31
- endpoint = "/getCostEstimate".gsub(/{.+?}/, '%s')
32
- endpoint = endpoint.gsub(/^\//, "")
33
- endpoint = endpoint % []
20
+ def get_cost_estimate(request, headers: {})
21
+ endpoint = '/getCostEstimate'.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
 
@@ -1,37 +1,27 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class ClassicCheckoutSDKApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Checkout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Checkout')
12
8
  end
13
9
 
14
- def payment_session(request, headers: {} )
15
- """
16
- Create a payment session
17
- """
18
- endpoint = "/paymentSession".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def payment_session(request, headers: {})
11
+ endpoint = '/paymentSession'.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 verify_payment_result(request, headers: {} )
27
- """
28
- Verify a payment result
29
- """
30
- endpoint = "/payments/result".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % []
19
+ def verify_payment_result(request, headers: {})
20
+ endpoint = '/payments/result'.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
 
@@ -1,85 +1,63 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class ModificationsApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Checkout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Checkout')
12
8
  end
13
9
 
14
- def cancel_authorised_payment(request, headers: {} )
15
- """
16
- Cancel an authorised payment
17
- """
18
- endpoint = "/cancels".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def cancel_authorised_payment(request, headers: {})
11
+ endpoint = '/cancels'.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 update_authorised_amount(request, paymentPspReference, headers: {} )
27
- """
28
- Update an authorised amount
29
- """
30
- endpoint = "/payments/{paymentPspReference}/amountUpdates".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % [paymentPspReference]
19
+ def update_authorised_amount(request, payment_psp_reference, headers: {})
20
+ endpoint = '/payments/{paymentPspReference}/amountUpdates'.gsub(/{.+?}/, '%s')
21
+ endpoint = endpoint.gsub(%r{^/}, '')
22
+ endpoint = format(endpoint, payment_psp_reference)
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 cancel_authorised_payment_by_psp_reference(request, paymentPspReference, headers: {} )
39
- """
40
- Cancel an authorised payment
41
- """
42
- endpoint = "/payments/{paymentPspReference}/cancels".gsub(/{.+?}/, '%s')
43
- endpoint = endpoint.gsub(/^\//, "")
44
- endpoint = endpoint % [paymentPspReference]
28
+ def cancel_authorised_payment_by_psp_reference(request, payment_psp_reference, headers: {})
29
+ endpoint = '/payments/{paymentPspReference}/cancels'.gsub(/{.+?}/, '%s')
30
+ endpoint = endpoint.gsub(%r{^/}, '')
31
+ endpoint = format(endpoint, payment_psp_reference)
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
 
50
- def capture_authorised_payment(request, paymentPspReference, headers: {} )
51
- """
52
- Capture an authorised payment
53
- """
54
- endpoint = "/payments/{paymentPspReference}/captures".gsub(/{.+?}/, '%s')
55
- endpoint = endpoint.gsub(/^\//, "")
56
- endpoint = endpoint % [paymentPspReference]
37
+ def capture_authorised_payment(request, payment_psp_reference, headers: {})
38
+ endpoint = '/payments/{paymentPspReference}/captures'.gsub(/{.+?}/, '%s')
39
+ endpoint = endpoint.gsub(%r{^/}, '')
40
+ endpoint = format(endpoint, payment_psp_reference)
57
41
 
58
- action = { method: "post", url: endpoint}
42
+ action = { method: 'post', url: endpoint }
59
43
  @client.call_adyen_api(@service, action, request, headers, @version)
60
44
  end
61
45
 
62
- def refund_captured_payment(request, paymentPspReference, headers: {} )
63
- """
64
- Refund a captured payment
65
- """
66
- endpoint = "/payments/{paymentPspReference}/refunds".gsub(/{.+?}/, '%s')
67
- endpoint = endpoint.gsub(/^\//, "")
68
- endpoint = endpoint % [paymentPspReference]
46
+ def refund_captured_payment(request, payment_psp_reference, headers: {})
47
+ endpoint = '/payments/{paymentPspReference}/refunds'.gsub(/{.+?}/, '%s')
48
+ endpoint = endpoint.gsub(%r{^/}, '')
49
+ endpoint = format(endpoint, payment_psp_reference)
69
50
 
70
- action = { method: "post", url: endpoint}
51
+ action = { method: 'post', url: endpoint }
71
52
  @client.call_adyen_api(@service, action, request, headers, @version)
72
53
  end
73
54
 
74
- def refund_or_cancel_payment(request, paymentPspReference, headers: {} )
75
- """
76
- Refund or cancel a payment
77
- """
78
- endpoint = "/payments/{paymentPspReference}/reversals".gsub(/{.+?}/, '%s')
79
- endpoint = endpoint.gsub(/^\//, "")
80
- endpoint = endpoint % [paymentPspReference]
55
+ def refund_or_cancel_payment(request, payment_psp_reference, headers: {})
56
+ endpoint = '/payments/{paymentPspReference}/reversals'.gsub(/{.+?}/, '%s')
57
+ endpoint = endpoint.gsub(%r{^/}, '')
58
+ endpoint = format(endpoint, payment_psp_reference)
81
59
 
82
- action = { method: "post", url: endpoint}
60
+ action = { method: 'post', url: endpoint }
83
61
  @client.call_adyen_api(@service, action, request, headers, @version)
84
62
  end
85
63
 
@@ -1,49 +1,36 @@
1
1
  require_relative '../service'
2
2
  module Adyen
3
-
4
-
5
3
  class OrdersApi < Service
6
4
  attr_accessor :service, :version
7
5
 
8
6
  def initialize(client, version = DEFAULT_VERSION)
9
- @service = "Checkout"
10
- @client = client
11
- @version = version
7
+ super(client, version, 'Checkout')
12
8
  end
13
9
 
14
- def orders(request, headers: {} )
15
- """
16
- Create an order
17
- """
18
- endpoint = "/orders".gsub(/{.+?}/, '%s')
19
- endpoint = endpoint.gsub(/^\//, "")
20
- endpoint = endpoint % []
10
+ def orders(request, headers: {})
11
+ endpoint = '/orders'.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 cancel_order(request, headers: {} )
27
- """
28
- Cancel an order
29
- """
30
- endpoint = "/orders/cancel".gsub(/{.+?}/, '%s')
31
- endpoint = endpoint.gsub(/^\//, "")
32
- endpoint = endpoint % []
19
+ def cancel_order(request, headers: {})
20
+ endpoint = '/orders/cancel'.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 get_balance_of_gift_card(request, headers: {} )
39
- """
40
- Get the balance of a gift card
41
- """
42
- endpoint = "/paymentMethods/balance".gsub(/{.+?}/, '%s')
43
- endpoint = endpoint.gsub(/^\//, "")
44
- endpoint = endpoint % []
28
+ def get_balance_of_gift_card(request, headers: {})
29
+ endpoint = '/paymentMethods/balance'.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