diff --git a/README.md b/README.md index 4b3b924a..b987cac7 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,9 @@ adyen.checkout.version = 50 - update_notification_configuration - delete_notification_configurations +**marketpay.hop:** +- get_onboarding_url + ## Support If you have any problems, questions or suggestions, create an issue here or send your inquiry to support@adyen.com. diff --git a/lib/adyen/client.rb b/lib/adyen/client.rb index b7d46539..c3426019 100644 --- a/lib/adyen/client.rb +++ b/lib/adyen/client.rb @@ -45,7 +45,7 @@ def service_url_base(service) when "CheckoutUtility" url = "https://checkout-#{@env}.adyen.com/checkout" supports_live_url_prefix = true - when "Account", "Fund", "Notification" + when "Account", "Fund", "Notification", "Hop" url = "https://cal-#{@env}.adyen.com/cal/services" supports_live_url_prefix = false when "Recurring", "Payment", "Payout" diff --git a/lib/adyen/services/marketpay.rb b/lib/adyen/services/marketpay.rb index cc26caac..678b5fd5 100644 --- a/lib/adyen/services/marketpay.rb +++ b/lib/adyen/services/marketpay.rb @@ -21,6 +21,10 @@ def fund def notification @notification ||= Adyen::Marketpay::Notification.new(@client) end + + def hop + @hop ||= Adyen::Marketpay::Hop.new(@client) + end end class Account < Service @@ -88,5 +92,19 @@ def initialize(client, version = DEFAULT_VERSION) super(client, version, service, method_names) end end + + class Hop < Service + attr_accessor :version + DEFAULT_VERSION = 1 + + def initialize(client, version = DEFAULT_VERSION) + service = 'Hop' + method_names = [ + :get_onboarding_url + ] + + super(client, version, service, method_names) + end + end end end diff --git a/spec/hop_spec.rb b/spec/hop_spec.rb new file mode 100644 index 00000000..21c892be --- /dev/null +++ b/spec/hop_spec.rb @@ -0,0 +1,14 @@ +require "spec_helper" + +RSpec.describe Adyen::Payments, service: "marketpay hop service" do + # client instance to be used in dynamically generated tests + client = create_client(:basic) + + # methods / values to test for + # format is defined in spec_helper + test_sets = [ + ["get_onboarding_url", "pspReference", "8815850625171183"] + ] + + generate_tests(client, "Hop", test_sets, client.marketpay.hop) +end diff --git a/spec/mocks/requests/Hop/get_onboarding_url.json b/spec/mocks/requests/Hop/get_onboarding_url.json new file mode 100644 index 00000000..1ee286c5 --- /dev/null +++ b/spec/mocks/requests/Hop/get_onboarding_url.json @@ -0,0 +1,4 @@ +{ + "accountHolderCode": "YourUniqueAccountHolderCode", + "returnUrl": "https://your.return-url.com/?submerchant=123" +} \ No newline at end of file diff --git a/spec/mocks/responses/Hop/get_onboarding_url.json b/spec/mocks/responses/Hop/get_onboarding_url.json new file mode 100644 index 00000000..a2599622 --- /dev/null +++ b/spec/mocks/responses/Hop/get_onboarding_url.json @@ -0,0 +1,7 @@ +{ + "pspReference": "8815850625171183", + "resultCode": "Success", + "submittedAsync": "false", + "invalidFields": [], + "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" +} \ No newline at end of file diff --git a/spec/service_spec.rb b/spec/service_spec.rb index c8583bef..bd444c56 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -38,6 +38,7 @@ expect(described_class.action_for_method_name(:update_account_holder)).to eq 'updateAccountHolder' expect(described_class.action_for_method_name(:update_account_holder_state)).to eq 'updateAccountHolderState' expect(described_class.action_for_method_name(:upload_document)).to eq 'uploadDocument' + expect(described_class.action_for_method_name(:get_onboarding_url)).to eq 'getOnboardingUrl' end end end