Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with $dwolla.get function and search customer with multiple statuses #57

Open
TheDevster opened this issue Mar 18, 2021 · 1 comment

Comments

@TheDevster
Copy link

According to the documentation (https://docs.dwolla.com/#list-and-search-customers), you can stack statuses for a unique query (such as getting all suspended and unverified customers). However when I use the dwolla gem, instead of sending the multiple status (as the Dwolla API documentation indicates), it overwrites and only the last one is sent.

Example: $dwolla.get "customers", status: "suspended", status: "unverified"

The result is only status=unverified gets sent.

I also tried to send the whole url as a string, same result: $dwolla.get "https://api.dwolla.com/customers?status=suspended&status=unverified"

Opened ticket with Dwolla support thinking it was an issue with the API documentation. Instead it's an issue with the Gem and its inability to handle same status without overwriting.

Is there a known workaround for this issue?

@abevoelker
Copy link

Not a Dwolla employee but I've been customizing the gem a bit lately. I think you need to customize the underlying Faraday instance in order to change the request param encoder to use the FlatParamsEncoder.

Give this a try:

$dwolla = DwollaV2::Client.new(
  key: ENV["DWOLLA_APP_KEY"],
  secret: ENV["DWOLLA_APP_SECRET"]
) do |config|
  config.faraday do |faraday|
    faraday.options.params_encoder = Faraday::FlatParamsEncoder
    faraday.adapter Faraday.default_adapter
  end
end

$dwolla.get("customers", status: ["suspended", "unverified"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants