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

Support multiple sets of credentials #3

Open
nathany opened this issue Jun 20, 2016 · 6 comments
Open

Support multiple sets of credentials #3

nathany opened this issue Jun 20, 2016 · 6 comments

Comments

@nathany
Copy link

nathany commented Jun 20, 2016

I'm working on a multi-tenant app where companies will be able to select a payment processor. Each company would have different credentials for Authorize.net.

Currently elixir_authorizenet only supports credentials via config.
https://github.com/marcelog/elixir_authorizenet/blob/master/lib/elixir_authorizenet.ex

I'm wondering if there is an elegant way to allow credentials to be specified with more granularity (perhaps per request) while still supporting the config-based behaviour for most users?

@marcelog
Copy link
Owner

Hello!

Not as it is, although I see your point.

Passing a "config" object in each request "is doable" (and I would deprecate the current behavior of getting it from the application config).

I think I would prefer this over having something like "profiles" setup in the config (each one with its own options and credentials) so they can be dynamically created.

What are your thoughts? Would you be able to work on a patch? If not, I'm willing to, but I need to find some time to do it :)

Best,

@nathany
Copy link
Author

nathany commented Jun 20, 2016

Hi Marcelo,

I'd be willing to work on a patch once I have some direction. My first thought was "make Gateway an object" and then I was like "oh, right, no objects." (I've only been using Elixir for 4 months).

In our case, we would need to grab the credentials from a database, not from the config. The number of "profiles" could change while the app is running. Of course we'd still want it to be easy for people doing the more typical config-based credentials thing without specifying parameters everywhere.

Thanks.

@marcelog
Copy link
Owner

Hi @nathany,

I agree, although there will be an additional argument needed in each call so the right credentials can be used (you can send a profile id or the full credentials, but something will still have to be there :\ ).

One could send "nil" to specify the current behavior, although I think I'd prefer to just make this new parameter mandatory (i.e: nil not allowed) and just make it work always in the same way (the caller would be responsible for putting the right values there and we would deprecate the config option).

Basically every function calling Main.req will need this new argument, that could be a map that contains the values currently setup in the config section (environment, validation_mode, login_id, and transaction_key, an additional "uri" argument would help with the tests as they are right now, this is due to how the target uri is automatically chosen based on the environment).

Thoughts?

@nathany
Copy link
Author

nathany commented Jun 24, 2016

That would work for me. I may look at some other payment libraries for Elixir to see if/how they approach this.

@nathany
Copy link
Author

nathany commented Jul 6, 2016

@marcelog It looks like the client I was doing this for may not use Authorize.net, so I won't have a chance to work on this. I'll let you know if they decide to use it.

@marcelog
Copy link
Owner

marcelog commented Jul 6, 2016

No worries 👍 Thanks for letting me know!

Best!

kiere pushed a commit to kiere/elixir_authorizenet that referenced this issue Feb 26, 2019
…d-code

Always use liveMode for validating
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