@paybyrd/devagent-test-js 2.1.0-alpha.6 → 2.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,12 @@ Used by `devagent-test-service` (Azure DevOps): `web/` (npm) and `widget/` (Yarn
11
11
 
12
12
  Build and test: `npm ci && npm test`.
13
13
 
14
- Demo page: `demo/index.html` validates a payment with the built SDK, so run `npm run build` first (`dist/` is not
15
- committed). Then serve the repository root, e.g. `python3 -m http.server 8000`, and open
16
- `http://localhost:8000/demo/`.
14
+ ## Demo page
15
+
16
+ `demo/index.html` validates a payment in the browser with the built `dist/index.js`. Build, serve the repository
17
+ root as static files and open `/demo/`:
18
+
19
+ ```sh
20
+ npm ci && npm run build
21
+ python3 -m http.server 8000 # then open http://localhost:8000/demo/
22
+ ```
package/dist/index.js CHANGED
@@ -13,8 +13,7 @@ function validatePayment(request) {
13
13
  else if (request.reference.length > 50) {
14
14
  errors.push("reference must be at most 50 characters");
15
15
  }
16
- // null (e.g. from JSON) also means no currency, like a missing field.
17
- if (request.currency != null && !SUPPORTED_CURRENCIES.includes(request.currency)) {
16
+ if (request.currency !== undefined && !SUPPORTED_CURRENCIES.includes(request.currency)) {
18
17
  errors.push(`currency must be one of ${SUPPORTED_CURRENCIES.join(", ")}`);
19
18
  }
20
19
  return { valid: errors.length === 0, errors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paybyrd/devagent-test-js",
3
- "version": "2.1.0-alpha.6",
3
+ "version": "2.1.0-alpha.7",
4
4
  "description": "Test package for the Paybyrd dev agent sandbox. Not for use: it has no real functionality.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",