Description
Initializing client skips argument checks and validations
Steps to reproduce
Call Adyen::Client.new with arguments env or live_url_prefix instead of using the env=, live_url_prefix= methods.
This allows initializing client with invalid env, which has implications later in code, e.g. checks like this(@env == :live)
Actual behavior
# This correctly raises ArgumentError, because we set "live" instead of (symbol) :live
client = Adyen::Client.new
client.env = "live"
# This should also raise ArgumentError, but doesn't:
client = Adyen::Client.new(env: "live")
(Similar case can be made for live_url_prefix.)
Expected behavior
# This should also raise ArgumentError
client = Adyen::Client.new(env: "live")
Code snippet or screenshots (if applicable)
Proposal solution: use the setter methods also in initialize.
# in client.rb
def initialize(...)
...
@env = env # <-- replace with `self.env = env`
...
@live_url_prefix = live_url_prefix # <-- replace with self.live_url_prefix = live_url_prefix
...
end
Adyen Ruby API Library version
10.2.0
Ruby language version
3.4.1
Operating System
macOS
Additional context
No response
Description
Initializing client skips argument checks and validations
Steps to reproduce
Call
Adyen::Client.newwith argumentsenvorlive_url_prefixinstead of using theenv=,live_url_prefix=methods.This allows initializing client with invalid env, which has implications later in code, e.g. checks like this
(@env == :live)Actual behavior
(Similar case can be made for
live_url_prefix.)Expected behavior
Code snippet or screenshots (if applicable)
Proposal solution: use the setter methods also in
initialize.Adyen Ruby API Library version
10.2.0
Ruby language version
3.4.1
Operating System
macOS
Additional context
No response