-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
...
endAdyen Ruby API Library version
10.2.0
Ruby language version
3.4.1
Operating System
macOS
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Labels
bugSomething isn't workingSomething isn't working