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

keep common requirements in global config #49

Open
2 tasks
arjun289 opened this issue Dec 26, 2017 · 2 comments
Open
2 tasks

keep common requirements in global config #49

arjun289 opened this issue Dec 26, 2017 · 2 comments

Comments

@arjun289
Copy link
Member

arjun289 commented Dec 26, 2017

The certain requirements which are common to all the gateways e.g. currency can be kept in the global config.
These should be overridden if something else is set by the gateway.
Example
Global configuration

config :gringotts, :global_config,
    mode: :test
    default_currency: 'USD'

Gateway specific configuration

# Keep the `key` name same as the adapter name
config :gringotts, Gringotts.Gateways.Stripe,
    adapter: Gringotts.Gateways.Stripe,
    api_key: "sk_test_vIX41hayC0BKrPWQerLuOMld",
    default_currency: "EUR"

Updated Checks and modifications needed.(25th Jan)

  • All the gateways require changes for this feature; sometimes there is just one url for both test and live, some have just one.
  • Add this in the main documentation and on the getting started guide.

Updates(25th Jan):

We are just adding test mode in the global_config.

@oyeb
Copy link
Contributor

oyeb commented Dec 26, 2017

Though a default currency is required by all gateways, IMO it is unlikely that it will be same across all gateways:

  • Large multi-national merchants might use multiple gateways because some gateways offer better/cheaper service in some regions, but not in others. In that case, each of these gateways would be configured for a different currency.
  • All gateways should set a default currency (since this is truly very specific to a gateway and not merchant dependent), but where? We could do something like this or add it in the required_config for all gateways.

@pkrawat1 pkrawat1 removed this from the Release 1.6.0 milestone Jan 25, 2018
@pkrawat1
Copy link
Member

After the introduction of #62 and merges in #71 #85 it becomes evident that the lib users can use money lib to create money object.

Responsibility of creating a correct money struct lies on the developer and follows the rules and constraints of money ex_money lib.

Hence, having default_currency in the global config does not make much sense now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants