From a447b65603118b8005bcd525b7d43c15699e89e4 Mon Sep 17 00:00:00 2001 From: crrood Date: Tue, 7 Jul 2020 08:08:01 -0700 Subject: [PATCH 1/2] add /donate endpoint --- lib/adyen/services/payments.rb | 3 ++- spec/mocks/requests/Payment/donate.json | 10 ++++++++++ spec/mocks/responses/Payment/donate.json | 4 ++++ spec/payments_spec.rb | 3 ++- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 spec/mocks/requests/Payment/donate.json create mode 100644 spec/mocks/responses/Payment/donate.json diff --git a/lib/adyen/services/payments.rb b/lib/adyen/services/payments.rb index e77be6c8..f18844c9 100644 --- a/lib/adyen/services/payments.rb +++ b/lib/adyen/services/payments.rb @@ -15,7 +15,8 @@ def initialize(client, version = DEFAULT_VERSION) :cancel, :refund, :cancel_or_refund, - :adjust_authorisation + :adjust_authorisation, + :donate ] super(client, version, service, method_names) diff --git a/spec/mocks/requests/Payment/donate.json b/spec/mocks/requests/Payment/donate.json new file mode 100644 index 00000000..aa2fec87 --- /dev/null +++ b/spec/mocks/requests/Payment/donate.json @@ -0,0 +1,10 @@ +{ + "originalReference": "882594077439995E", + "modificationAmount": { + "value": 100, + "currency": "USD" + }, + "reference": "Donation", + "donationAccount": "TestMerchantDonations", + "merchantAccount": "TestMerchant" +} diff --git a/spec/mocks/responses/Payment/donate.json b/spec/mocks/responses/Payment/donate.json new file mode 100644 index 00000000..9fd2bae2 --- /dev/null +++ b/spec/mocks/responses/Payment/donate.json @@ -0,0 +1,4 @@ +{ + "pspReference": "882594132885209C", + "response": "[donation-received]" +} diff --git a/spec/payments_spec.rb b/spec/payments_spec.rb index d4a353f5..8bc532e7 100644 --- a/spec/payments_spec.rb +++ b/spec/payments_spec.rb @@ -14,7 +14,8 @@ ["cancel", "response", "[cancel-received]"], ["cancel_or_refund", "response", "[cancelOrRefund-received]"], ["capture", "response", "[capture-received]"], - ["refund", "response", "[refund-received]"] + ["refund", "response", "[refund-received]"], + ["donate", "response", "[donation-received]"] ] generate_tests(client, "Payment", test_sets, client.payments) From 73b4faed2a8bd3a26ce514fd3e388d0925c692b6 Mon Sep 17 00:00:00 2001 From: crrood Date: Tue, 7 Jul 2020 09:27:32 -0700 Subject: [PATCH 2/2] add /donate to readme, service_spec --- README.md | 1 + spec/service_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 3eb1ef52..1ba57882 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ adyen.checkout.version = 50 - refund - cancel_or_refund - adjust_authorisation +- donate **payouts:** - confirm_third_party diff --git a/spec/service_spec.rb b/spec/service_spec.rb index bd444c56..e6a436b8 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -19,6 +19,7 @@ expect(described_class.action_for_method_name(:delete_bank_accounts)).to eq 'deleteBankAccounts' expect(described_class.action_for_method_name(:delete_shareholders)).to eq 'deleteShareholders' expect(described_class.action_for_method_name(:disable)).to eq 'disable' + expect(described_class.action_for_method_name(:donate)).to eq 'donate' expect(described_class.action_for_method_name(:get_account_holder)).to eq 'getAccountHolder' expect(described_class.action_for_method_name(:get_tier_configuration)).to eq 'getTierConfiguration' expect(described_class.action_for_method_name(:get_uploaded_documents)).to eq 'getUploadedDocuments'