Adyen / adyen-node-api-library

Adyen API Library for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] Improve Client Configuration Docs

tpater opened this issue · comments

Is your feature request related to a problem? Please describe.
I've been studying official docs of setting up my configuration before going live: https://docs.adyen.com/development-resources/live-endpoints/?tab=web_1#checkout-endpoints

It says I should know my live prefix generated in live environment backoffice.
Also I should initiate the client with a proper Adyen's environment name ( live, live-us, live-au etc) depending on the reqion/country my Merchant Account is being setup.
It looks like current version of Environment enum supports only TEST & LIVE values. Is this a mistake or intentional action?
https://github.com/Adyen/adyen-node-api-library/blob/main/src/typings/enums/environment.ts

Current Config class does not have documented properties so it is hard to guess what author had in mind:
https://github.com/Adyen/adyen-node-api-library/blob/main/src/config.ts

I could not find anywhere docs on which countries belong to which Adyen's live regions: e.g.
live-apse: ["SG", "HK", "TH" // any other?]

Describe the solution you'd like
Please, provide more than one official example of initialising the Client e.g. with production-like settings (region-aware)
Please, extend existing Environment enum or put appropriate info of the underlying logic (if there is one).
Please, document whether live api prefix should also be passed to Config object or in case I'm using your library it is not required.

Nice to have: static mapping files or some utility functions to be able to resolve proper environment based on the country of origin of my user. Example:

export const reqionToCountryMapping: Record<AdyenEnvironment, Country[]> = {
  [AdyenEnvironment.LIVE]: [/* european countries */],
  [AdyenEnvironment.LIVE_US]: [Country.UNITED_STATES_OF_AMERICA],
  [AdyenEnvironment.LIVE_AU]: [Country.AUSTRALIA],
  [AdyenEnvironment.LIVE_IN]: [Country.INDIA],
  [AdyenEnvironment.LIVE_APSE]: [
    Country.SINGAPORE,
    Country.HONG_KONG,
    Country.JAPAN,
    Country.MALAYSIA,
    Country.NEW_ZEALAND,
    Country.PHILIPPINES,
    Country.SOUTH_KOREA,
    Country.TAIWAN,
    Country.THAILAND,
    Country.VIETNAM,
    // which other countries?
  ],
};

Hi @tpater!

Thank you for reaching out to us and providing some suggestions!
We will start an investigation regarding this, and I'll get back to you once I know more. In the meantime, you can find an example of the client setup when going live in the README here.

Regards

Djoyke
Adyen