adyen-ruby-api-library 4.1.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) 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 -119
  9. data/docs/marketpay.html +2 -0
  10. data/lib/adyen-ruby-api-library.rb +3 -12
  11. data/lib/adyen/client.rb +49 -23
  12. data/lib/adyen/services/bin_lookup.rb +18 -0
  13. data/lib/adyen/services/checkout.rb +88 -8
  14. data/lib/adyen/services/{checkout_utility.rb → data_protection.rb} +4 -3
  15. data/lib/adyen/services/dispute.rb +20 -0
  16. data/lib/adyen/services/marketpay.rb +10 -7
  17. data/lib/adyen/services/payments.rb +15 -5
  18. data/lib/adyen/services/payouts.rb +3 -2
  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 +4 -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/mocks/requests/Account/check_account_holder.json +5 -0
  29. data/spec/mocks/requests/Account/delete_payout_methods.json +6 -0
  30. data/spec/mocks/requests/Account/delete_signatories.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/Payment/donate.json +10 -0
  44. data/spec/mocks/requests/Payment/get_authentication_result.json +4 -0
  45. data/spec/mocks/requests/Payment/retrieve_3ds2_result.json +4 -0
  46. data/spec/mocks/requests/Payment/technical_cancel.json +4 -0
  47. data/spec/mocks/requests/Payment/void_pending_refund.json +4 -0
  48. data/spec/mocks/requests/Payout/payout.json +8 -0
  49. data/spec/mocks/requests/Recurring/schedule_account_updater.json +12 -0
  50. data/spec/mocks/responses/Account/check_account_holder.json +3 -0
  51. data/spec/mocks/responses/Account/delete_payout_methods.json +3 -0
  52. data/spec/mocks/responses/Account/delete_signatories.json +3 -0
  53. data/spec/mocks/responses/BinLookup/get_3ds_availability.json +8 -0
  54. data/spec/mocks/responses/BinLookup/get_cost_estimate.json +8 -0
  55. data/spec/mocks/responses/Checkout/get-payment-link.json +11 -0
  56. data/spec/mocks/responses/Checkout/orders.json +8 -0
  57. data/spec/mocks/responses/Checkout/orders_cancel.json +4 -0
  58. data/spec/mocks/responses/Checkout/origin_keys.json +5 -0
  59. data/spec/mocks/responses/Checkout/payment_methods_balance.json +3 -0
  60. data/spec/mocks/responses/Checkout/update-payment-link.json +11 -0
  61. data/spec/mocks/responses/DataProtectionService/request_subject_erasure.json +3 -0
  62. data/spec/mocks/responses/DisputeService/defend_dispute.json +5 -0
  63. data/spec/mocks/responses/DisputeService/delete_dispute_defense_document.json +5 -0
  64. data/spec/mocks/responses/DisputeService/retrieve_applicable_defense_reasons.json +28 -0
  65. data/spec/mocks/responses/DisputeService/supply_defense_document.json +5 -0
  66. data/spec/mocks/responses/Fund/refund_funds_transfer.json +5 -0
  67. data/spec/mocks/responses/Payment/donate.json +4 -0
  68. data/spec/mocks/responses/Payment/get_authentication_result.json +5 -0
  69. data/spec/mocks/responses/Payment/retrieve_3ds2_result.json +5 -0
  70. data/spec/mocks/responses/Payment/technical_cancel.json +3 -0
  71. data/spec/mocks/responses/Payment/void_pending_refund.json +3 -0
  72. data/spec/mocks/responses/Payout/payout.json +3 -0
  73. data/spec/mocks/responses/Recurring/schedule_account_updater.json +4 -0
  74. data/spec/payments_spec.rb +6 -1
  75. data/spec/payouts_spec.rb +2 -1
  76. data/spec/recurring_spec.rb +2 -1
  77. data/spec/service_spec.rb +2 -0
  78. data/spec/spec_helper.rb +18 -12
  79. metadata +60 -7
  80. data/spec/checkout_utility_spec.rb +0 -29
  81. data/spec/mocks/requests/CheckoutUtility/origin_keys.json +0 -7
  82. 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)
@@ -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,6 @@
1
+ {
2
+ "accountHolderCode": "CODE_OF_ACCOUNT_HOLDER",
3
+ "signatoryCodes": [
4
+ "9188218c-576e-4cbe-8e86-72722f453920"
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,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,3 @@
1
+ {
2
+ "pspReference":"9914694372990637"
3
+ }
@@ -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,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
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "originalReference": "9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "pspReference": "9914694372990637"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "resultCode": "Success"
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "pspReference": "8815260599791117",
3
+ "result": "Success"
4
+ }
@@ -14,7 +14,12 @@ RSpec.describe Adyen::Payments, service: "payments service" do
14
14
  ["cancel", "response", "[cancel-received]"],
15
15
  ["cancel_or_refund", "response", "[cancelOrRefund-received]"],
16
16
  ["capture", "response", "[capture-received]"],
17
- ["refund", "response", "[refund-received]"]
17
+ ["refund", "response", "[refund-received]"],
18
+ ["donate", "response", "[donation-received]"],
19
+ ["get_authentication_result", "threeDS2Result", {"transStatus" => "Y"}],
20
+ ["retrieve_3ds2_result", "threeDS2Result", {"transStatus" => "Y"}],
21
+ ["technical_cancel", "originalReference", "9914694372990637"],
22
+ ["void_pending_refund", "pspReference", "9914694372990637"]
18
23
  ]
19
24
 
20
25
  generate_tests(client, "Payment", test_sets, client.payments)