@paybyrd/devagent-test-js 2.1.0-alpha.7 → 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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export interface PaymentRequest {
2
2
  amount: number;
3
3
  reference: string;
4
- currency?: string;
4
+ currency?: string | null;
5
5
  }
6
6
  export interface ValidationResult {
7
7
  valid: boolean;
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ function validatePayment(request) {
7
7
  if (!(request.amount > 0)) {
8
8
  errors.push("amount must be greater than 0");
9
9
  }
10
- if (!request.reference || request.reference.trim() === "") {
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
- if (request.currency !== undefined && !SUPPORTED_CURRENCIES.includes(request.currency)) {
16
+ if (request.currency != null && !SUPPORTED_CURRENCIES.includes(request.currency)) {
17
17
  errors.push(`currency must be one of ${SUPPORTED_CURRENCIES.join(", ")}`);
18
18
  }
19
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.7",
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",