[Feature]: Default region for Terminal API URL
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start at the TypeScript Config logic around EnvironmentEnum.LIVE and terminalApiCloudEndpoint, comparing the proposed behavior with the Java Library example. Done when LIVE without a region uses the EU endpoint while unsupported explicit regions still produce the appropriate validation error.
Written by the indexing model from the issue text.
Description
Feature summary
Add a default region for Terminal API in LIVE
Problem statement
Currently, region need to specified for LIVE env if not, there will be no default region URL defined and this will lead to "URL Invalid" error
if (!this.config.environment) {
throw new Error("Environment must be defined");
}
// set Terminal API endpoints
if (this.config.environment === EnvironmentEnum.TEST) {
// one TEST endpoint for all regions
this.config.terminalApiCloudEndpoint = TERMINAL_API_ENDPOINT_TEST;
} else if (this.config.environment === EnvironmentEnum.LIVE) {
// region-based LIVE endpoints
if(this.config.region) {
if (!Config.isRegionValid(this.config.region)) {
throw new Error(`Invalid region provided: ${this.config.region}`);
}
this.config.terminalApiCloudEndpoint = Config.getTerminalApiEndpoint(this.config.region);
}
}
Proposed solution
Implement the same solution as seen in Java Library
// For LIVE environment, lookup the endpoint using the map
if (environment.equals(Environment.LIVE)) {
if (region == null) {
return Region.TERMINAL_API_ENDPOINTS_MAPPING.get(Region.EU);
}
if (!Region.TERMINAL_API_ENDPOINTS_MAPPING.containsKey(region)) {
throw new IllegalArgumentException(
"TerminalAPI endpoint for " + region + " is not supported yet");
}
return Region.TERMINAL_API_ENDPOINTS_MAPPING.getOrDefault(region, TERMINAL_API_ENDPOINT_LIVE);
}
Alternatives considered
No response
Additional context
No response
- Dominant language
- TypeScript
- Stars
- 138
- Forks
- 95
- Avg merge
- 18h 31m
- Merged PRs (30d)
- 30
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Adyen/adyen-node-api-library
-
bug do not stale
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Adyen/adyen-node-api-library#1742 · 11 comments ·
-
bug do not stale
Difficulty 3/5 1-2 days Newbie friendliness 62/100
Adyen/adyen-node-api-library#1658 · 2 comments ·
-
do not stale
Difficulty 4/5 3-5 days Newbie friendliness 70/100
Adyen/adyen-node-api-library#1651 · 1 reaction ·
-
do not stale Feature
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Adyen/adyen-node-api-library#1554 · 2 comments ·
-
do not stale
Difficulty 5/5 Over a week Newbie friendliness 20/100
Adyen/adyen-node-api-library#1449 · 1 comment ·
All issues in Adyen/adyen-node-api-library
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100