@paybyrd/devagent-test-js 1.0.0

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 ADDED
@@ -0,0 +1,12 @@
1
+ # @paybyrd/devagent-test-js
2
+
3
+ Sandbox for testing the Paybyrd dev agent (`development-workflow-agent`). **Not production code, and not for use**:
4
+ the package published to npm has no real functionality.
5
+
6
+ A small TypeScript library (`validatePayment`) published to npm as `@paybyrd/devagent-test-js`. It is set up like
7
+ `card-collect-js` and `antifraud-device-intelligence-sdk`: same pipeline (an `X.Y.Z` tag publishes `X.Y.Z`; feature
8
+ branches and PRs publish prereleases), and the version in `package.json` stays `1.0.0` (the pipeline replaces it).
9
+
10
+ Used by `devagent-test-service` (Azure DevOps): `web/` (npm) and `widget/` (Yarn).
11
+
12
+ Build and test: `npm ci && npm test`.
@@ -0,0 +1,9 @@
1
+ export interface PaymentRequest {
2
+ amount: number;
3
+ reference: string;
4
+ }
5
+ export interface ValidationResult {
6
+ valid: boolean;
7
+ errors: string[];
8
+ }
9
+ export declare function validatePayment(request: PaymentRequest): ValidationResult;
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatePayment = validatePayment;
4
+ function validatePayment(request) {
5
+ const errors = [];
6
+ if (!(request.amount > 0)) {
7
+ errors.push("amount must be greater than 0");
8
+ }
9
+ if (!request.reference || request.reference.trim() === "") {
10
+ errors.push("reference is required");
11
+ }
12
+ else if (request.reference.length > 50) {
13
+ errors.push("reference must be at most 50 characters");
14
+ }
15
+ return { valid: errors.length === 0, errors };
16
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@paybyrd/devagent-test-js",
3
+ "version": "1.0.0",
4
+ "description": "Test package for the Paybyrd dev agent sandbox. Not for use: it has no real functionality.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "tsc && node --test test/*.test.js"
13
+ },
14
+ "license": "UNLICENSED",
15
+ "devDependencies": {
16
+ "typescript": "5.6.3"
17
+ }
18
+ }