@paybyrd/devagent-test-js 2.1.0-alpha.6 → 2.1.0-alpha.8
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 +9 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/package.json +1 -1
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
|
|
15
|
-
|
|
16
|
-
`
|
|
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.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,13 +7,12 @@ function validatePayment(request) {
|
|
|
7
7
|
if (!(request.amount > 0)) {
|
|
8
8
|
errors.push("amount must be greater than 0");
|
|
9
9
|
}
|
|
10
|
-
if (
|
|
10
|
+
if (typeof request.reference !== "string" || request.reference.trim() === "") {
|
|
11
11
|
errors.push("reference is required");
|
|
12
12
|
}
|
|
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
16
|
if (request.currency != null && !SUPPORTED_CURRENCIES.includes(request.currency)) {
|
|
18
17
|
errors.push(`currency must be one of ${SUPPORTED_CURRENCIES.join(", ")}`);
|
|
19
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paybyrd/devagent-test-js",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.8",
|
|
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",
|