adyen-ruby-api-library 4.0.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  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/.gitignore +2 -0
  8. data/README.md +72 -110
  9. data/lib/adyen-ruby-api-library.rb +4 -12
  10. data/lib/adyen/client.rb +57 -24
  11. data/lib/adyen/services/bin_lookup.rb +18 -0
  12. data/lib/adyen/services/checkout.rb +88 -8
  13. data/lib/adyen/services/{checkout_utility.rb → data_protection.rb} +4 -3
  14. data/lib/adyen/services/dispute.rb +20 -0
  15. data/lib/adyen/services/marketpay.rb +26 -6
  16. data/lib/adyen/services/payments.rb +15 -5
  17. data/lib/adyen/services/payouts.rb +3 -2
  18. data/lib/adyen/services/postfmapi.rb +19 -0
  19. data/lib/adyen/services/recurring.rb +3 -2
  20. data/lib/adyen/services/service.rb +2 -2
  21. data/lib/adyen/version.rb +1 -1
  22. data/spec/account_spec.rb +3 -1
  23. data/spec/bin_lookup_spec.rb +15 -0
  24. data/spec/checkout_spec.rb +247 -5
  25. data/spec/data_protection_spec.rb +14 -0
  26. data/spec/dispute_spec.rb +17 -0
  27. data/spec/fund_spec.rb +2 -1
  28. data/spec/hop_spec.rb +14 -0
  29. data/spec/mocks/requests/Account/check_account_holder.json +5 -0
  30. data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
  31. data/spec/mocks/requests/BinLookup/get_3ds_availability.json +4 -0
  32. data/spec/mocks/requests/BinLookup/get_cost_estimate.json +8 -0
  33. data/spec/mocks/requests/Checkout/orders.json +6 -0
  34. data/spec/mocks/requests/Checkout/orders_cancel.json +7 -0
  35. data/spec/mocks/requests/Checkout/origin_keys.json +3 -0
  36. data/spec/mocks/requests/Checkout/payment_methods_balance.json +9 -0
  37. data/spec/mocks/requests/DataProtectionService/request_subject_erasure.json +5 -0
  38. data/spec/mocks/requests/DisputeService/defend_dispute.json +5 -0
  39. data/spec/mocks/requests/DisputeService/delete_dispute_defense_document.json +5 -0
  40. data/spec/mocks/requests/DisputeService/retrieve_applicable_defense_reasons.json +4 -0
  41. data/spec/mocks/requests/DisputeService/supply_defense_document.json +11 -0
  42. data/spec/mocks/requests/Fund/refund_funds_transfer.json +7 -0
  43. data/spec/mocks/requests/Hop/get_onboarding_url.json +4 -0
  44. data/spec/mocks/requests/Payment/donate.json +10 -0
  45. data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
  46. data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
  47. data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
  48. data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
  49. data/spec/mocks/requests/Payout/payout.json +8 -0
  50. data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
  51. data/spec/mocks/requests/Terminal/assign_terminals.json +6 -0
  52. data/spec/mocks/requests/Terminal/find_terminal.json +3 -0
  53. data/spec/mocks/requests/Terminal/get_terminals_under_account.json +4 -0
  54. data/spec/mocks/responses/Account/check_account_holder.json +3 -0
  55. data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
  56. data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
  57. data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
  58. data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
  59. data/spec/mocks/responses/Checkout/orders.json +8 -0
  60. data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
  61. data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
  62. data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
  63. data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
  64. data/spec/mocks/responses/DataProtectionService/request_subject_erasure.json +3 -0
  65. data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
  66. data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
  67. data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
  68. data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
  69. data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
  70. data/spec/mocks/responses/Hop/get_onboarding_url.json +7 -0
  71. data/spec/mocks/responses/Payment/donate.json +4 -0
  72. data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
  73. data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
  74. data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
  75. data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
  76. data/spec/mocks/responses/Payout/payout.json +3 -0
  77. data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
  78. data/spec/mocks/responses/Terminal/assign_terminals.json +5 -0
  79. data/spec/mocks/responses/Terminal/find_terminal.json +6 -0
  80. data/spec/mocks/responses/Terminal/get_terminals_under_account.json +11 -0
  81. data/spec/payments_spec.rb +6 -1
  82. data/spec/payouts_spec.rb +2 -1
  83. data/spec/postfmapi_spec.rb +16 -0
  84. data/spec/recurring_spec.rb +2 -1
  85. data/spec/service_spec.rb +2 -0
  86. data/spec/spec_helper.rb +18 -12
  87. metadata +69 -7
  88. data/spec/checkout_utility_spec.rb +0 -29
  89. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
  90. data/spec/mocks/responses/CheckoutUtility/origin_keys.json +0 -7
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Adyen::DataProtection, service: "Data Protection Service" do
4
+ # client instance to be used in dynamically generated tests
5
+ client = create_client(:basic)
6
+
7
+ # methods / values to test for
8
+ # format is defined in spec_helper
9
+ test_sets = [
10
+ ["request_subject_erasure", "result", "SUCCESS"],
11
+ ]
12
+
13
+ generate_tests(client, "DataProtectionService", test_sets, client.data_protection)
14
+ end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Adyen::Dispute, service: "dispute service" do
4
+ # client instance to be used in dynamically generated tests
5
+ client = create_client(:basic)
6
+
7
+ # methods / values to test for
8
+ # format is defined in spec_helper
9
+ test_sets = [
10
+ ["retrieve_applicable_defense_reasons", "disputeServiceResult", { "success" => true }],
11
+ ["supply_defense_document", "disputeServiceResult", { "success" => true }],
12
+ ["delete_dispute_defense_document", "disputeServiceResult", { "success" => true }],
13
+ ["defend_dispute", "disputeServiceResult", { "success" => true }],
14
+ ]
15
+
16
+ generate_tests(client, "DisputeService", test_sets, client.dispute)
17
+ end
data/spec/fund_spec.rb CHANGED
@@ -12,7 +12,8 @@ RSpec.describe Adyen::Payments, service: "marketpay fund service" do
12
12
  ["account_holder_transaction_list", "pspReference", "9914721175530029"],
13
13
  ["refund_not_paid_out_transfers", "pspReference", "9915090894215323"],
14
14
  ["setup_beneficiary", "pspReference", "9914860354282596"],
15
- ["transfer_funds", "pspReference", "9915090893984580"]
15
+ ["transfer_funds", "pspReference", "9915090893984580"],
16
+ ["refund_funds_transfer", "pspReference", "9915090893984580"]
16
17
  ]
17
18
 
18
19
  generate_tests(client, "Fund", test_sets, client.marketpay.fund)
data/spec/hop_spec.rb ADDED
@@ -0,0 +1,14 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Adyen::Payments, service: "marketpay hop service" do
4
+ # client instance to be used in dynamically generated tests
5
+ client = create_client(:basic)
6
+
7
+ # methods / values to test for
8
+ # format is defined in spec_helper
9
+ test_sets = [
10
+ ["get_onboarding_url", "pspReference", "8815850625171183"]
11
+ ]
12
+
13
+ generate_tests(client, "Hop", test_sets, client.marketpay.hop)
14
+ end
@@ -0,0 +1,5 @@
1
+ {
2
+ "accountHolderCode": "CODE_OF_ACCOUNT_HOLDER",
3
+ "accountStateType": "Payout",
4
+ "tier": "2"
5
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "accountHolderCode": "CODE_OF_ACCOUNT_HOLDER",
3
+ "payoutMethodCodes": [
4
+ "mock_code"
5
+ ]
6
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "TestMerchant",
3
+ "cardNumber": "4111111111111111"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "amount": {
3
+ "currency": "EUR",
4
+ "value": 1000
5
+ },
6
+ "cardNumber": "5101180000000007",
7
+ "merchantAccount": "TestMerchant"
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "amount": {
3
+ "currency":"USD",
4
+ "value": "1000"
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "order": {
4
+ "orderData": "mocked_order_data",
5
+ "pspReference": "mocked_psp_ref"
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "originDomains": "https://adyen.com"
3
+ }
@@ -0,0 +1,9 @@
1
+
2
+ {
3
+ "paymentMethod": {
4
+ "type": "givex",
5
+ "number": "4126491073027401",
6
+ "cvc": "737"
7
+ },
8
+ "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
9
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "merchantAccount": "test_merchant",
3
+ "pspReference": "test_reference",
4
+ "forceErasure": true
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "disputePspReference": "9913486733050065",
3
+ "defenseReasonCode": "SupplyDefenseMaterial",
4
+ "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "disputePspReference": "9913486733050065",
3
+ "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT",
4
+ "defenseDocumentType": "MerchandiseDescription"
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
3
+ "disputePspReference": "9913486733050065"
4
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "defenseDocuments": [
3
+ {
4
+ "content": "JVBERi0xLjMKJcTl8uXrp...",
5
+ "contentType": "application/pdf",
6
+ "defenseDocumentTypeCode": "MerchandiseDescription"
7
+ }
8
+ ],
9
+ "disputePspReference": "9913486733050065",
10
+ "merchantAccountCode": "YOUR_MERCHANT_ACCOUNT"
11
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "originalReference": "190324759",
3
+ "amount": {
4
+ "currency": "EUR",
5
+ "value": 2000
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "accountHolderCode": "YourUniqueAccountHolderCode",
3
+ "returnUrl": "https://your.return-url.com/?submerchant=123"
4
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "originalReference": "882594077439995E",
3
+ "modificationAmount": {
4
+ "value": 100,
5
+ "currency": "USD"
6
+ },
7
+ "reference": "Donation",
8
+ "donationAccount": "TestMerchantDonations",
9
+ "merchantAccount": "TestMerchant"
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "pspReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "pspReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "originalReference": "9914694372990637"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "merchantAccount": "MERCHANT_ACCOUNT",
3
+ "originalReference": "9914694372990637"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "merchantAccount": "MERCHANT_ACCOUNT",
7
+ "reference": "9876543210"
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "card": {
3
+ "number": "4111111111111111",
4
+ "expiryMonth": "8",
5
+ "expiryYear": "2018",
6
+ "cvc": "737",
7
+ "holderName": "John Smith"
8
+ },
9
+ "reference": "Merchant Reference",
10
+ "merchantAccount": "TestMerchant",
11
+ "shopperReference": "shopperReference"
12
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "companyAccount": "TestCompany",
3
+ "merchantAccount": "TestMerchant",
4
+ "merchantInventory": false,
5
+ "terminals": ["e285-123456789"]
6
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "terminal": "e285-123456789"
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "companyAccount" : "TestCompany",
3
+ "merchantAccount" : "TestMerchant"
4
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference":"9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference": "9914694372990637"
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "binDetails": {
3
+ "issuerCountry": "NL"
4
+ },
5
+ "threeDS1Supported": true,
6
+ "threeDS2CardRangeDetails": [],
7
+ "threeDS2supported": false
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "costEstimateAmount": {
3
+ "currency": "EUR",
4
+ "value": 1000
5
+ },
6
+ "resultCode": "Success",
7
+ "surchargeType": "PASSTHROUGH"
8
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "id": "MockId",
7
+ "merchantAccount": "TestMerchant",
8
+ "reference": "Merchant Reference",
9
+ "status": "active",
10
+ "url": "https://adyen.com"
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "expiresAt": "1970-01-01",
3
+ "orderData": "mockedOrderData",
4
+ "remainingAmount": {
5
+ "currency": "USD",
6
+ "value": 100
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "pspReference": "mocked_psp_ref",
3
+ "resultCode": "cancelled"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "originKeys": {
3
+ "https://adyen.com": "mocked_origin_key"
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "balance": "100"
3
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "amount": {
3
+ "currency": "USD",
4
+ "value": 1000
5
+ },
6
+ "id": "MockId",
7
+ "merchantAccount": "TestMerchant",
8
+ "reference": "Merchant Reference",
9
+ "status": "expired",
10
+ "url": "https://adyen.com"
11
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "result": "SUCCESS"
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "disputeServiceResult": {
3
+ "success": true
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "disputeServiceResult": {
3
+ "success": true
4
+ }
5
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "defenseReasons": [
3
+ {
4
+ "defenseDocumentTypes": [
5
+ {
6
+ "available": false,
7
+ "defenseDocumentTypeCode": "TIDorInvoice",
8
+ "requirementLevel": "Optional"
9
+ },
10
+ {
11
+ "available": false,
12
+ "defenseDocumentTypeCode": "DefenseMaterial",
13
+ "requirementLevel": "Required"
14
+ },
15
+ {
16
+ "available": false,
17
+ "defenseDocumentTypeCode": "AlternativeDefenseMaterial",
18
+ "requirementLevel": "AlternativeRequired"
19
+ }
20
+ ],
21
+ "defenseReasonCode": "SupplyDefenseMaterial",
22
+ "satisfied": false
23
+ }
24
+ ],
25
+ "disputeServiceResult": {
26
+ "success": true
27
+ }
28
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "disputeServiceResult": {
3
+ "success": true
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "pspReference": "9915090893984580",
3
+ "merchantReference": "MerchantReference",
4
+ "resultCode": "Received"
5
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "pspReference": "8815850625171183",
3
+ "resultCode": "Success",
4
+ "submittedAsync": "false",
5
+ "invalidFields": [],
6
+ "redirectUrl": "https://hop-test.adyen.com/hop/view/?token=BQABAQANDBQftSiV8pqlYYFRjIZmBIhE3Ls%2FgdLQ3kcTbflt4FDPves0B9kq7aSZUqKwRciwBEN3PX23ZPqGmYXTb7QklLY5YdEXvUdEgtFnJl9uDWK09texQ3djnTPW6JKrok5svw%2FGZyGHqF1NAbuqPPPLF8o5Jzzri8AqyQKig%2BtMmEibuCuZrIvMbJjcINfDk0OBHir8bNjHgMGFiDBOXdkiww%2FB1VXP2MMqSB1yqcXiKL1o%2B12czdB9wJ5wwsQLGlcuE2Z0%2BZNIQL3MdRomkphpkIWBPFN9YmyGS0Wel6trve6ghBl4q4e1C%2B9BMQKc4P0jrC9FrkBZvhtBYoN%2BfUfrEDbgXpXjXYa1tlfU53XoD%2FsAAA1n2PuQSyfTxEf8qpwAcB9oDN%2BrbpwxYwIk42kCGztAQShTwZzx%2B4VifKpjBdtHA4bSHEqOzGPvpQ6bk4viluLn9Ealv0ylf%2FC3w%2BZCmThg8%2B2EIiABmMK8Jbfijl%2FM%2FqE43F0QN9SveJjwkN5IYGra5QbErUdAPDMfDksPjy%2FY8j%2B2XT1kMwSOLbWTCfhP%2FM%2F68Ll50RuhfJOkgfdP%2BfSxbK9i9uAmEsJ980cABWPpB4MH27asGfZ17mCM3TavaiI9d9Gs3X1HIoEZehFKWEhoaGsEaoSBQ6ut6VnZoOCCBsvssg9aqi1LJKpwwWg4CjS9Ygrw1dnSYjyFO2HeKGXf4TUS7DSCF7tpUJlBen69Xaqbwg%2BHfNfmgcCoZwSgvg%3D%3D"
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "pspReference": "882594132885209C",
3
+ "response": "[donation-received]"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "threeDS2Result": {
3
+ "transStatus": "Y"
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "threeDS2Result": {
3
+ "transStatus": "Y"
4
+ }
5
+ }