diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 00000000..4b456930 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,9 @@ +{ + "cliVersion": "0.0.0", + "generatorName": "fernapi/fern-typescript-node-sdk", + "generatorVersion": "3.35.8", + "generatorConfig": { + "namespaceExport": "Payabli", + "noSerdeLayer": true + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9b38f00..1c70c5bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,50 +8,71 @@ jobs: steps: - name: Checkout repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up node - uses: actions/setup-node@v3 + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile - name: Compile - run: yarn && yarn build + run: pnpm build test: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up node - uses: actions/setup-node@v3 + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 - - name: Compile - run: yarn && yarn test + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Test + run: pnpm test publish: needs: [ compile, test ] if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') runs-on: ubuntu-latest + permissions: + contents: read # Required for checkout + id-token: write # Required for OIDC steps: - name: Checkout repo - uses: actions/checkout@v4 + uses: actions/checkout@v6 + - name: Set up node - uses: actions/setup-node@v3 + uses: actions/setup-node@v6 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Install dependencies - run: yarn install + run: pnpm install --frozen-lockfile + - name: Build - run: yarn build + run: pnpm build - name: Publish to npm run: | - npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} + publish() { # use latest npm to ensure OIDC support + npx -y npm@latest publish "$@" + } if [[ ${GITHUB_REF} == *alpha* ]]; then - npm publish --access public --tag alpha + publish --access public --tag alpha elif [[ ${GITHUB_REF} == *beta* ]]; then - npm publish --access public --tag beta + publish --access public --tag beta else - npm publish --access public - fi - env: - NPM_TOKEN: ${{ secrets. }} \ No newline at end of file + publish --access public + fi \ No newline at end of file diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 6db0876c..00000000 --- a/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules -src -tests -.gitignore -.github -.fernignore -.prettierrc.yml -tsconfig.json -yarn.lock \ No newline at end of file diff --git a/.prettierrc.yml b/.prettierrc.yml deleted file mode 100644 index 0c06786b..00000000 --- a/.prettierrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -tabWidth: 4 -printWidth: 120 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..fe5bc2f7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,133 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- Node.js 20 or higher +- pnpm package manager + +### Installation + +Install the project dependencies: + +```bash +pnpm install +``` + +### Building + +Build the project: + +```bash +pnpm build +``` + +### Testing + +Run the test suite: + +```bash +pnpm test +``` + +Run specific test types: +- `pnpm test:unit` - Run unit tests +- `pnpm test:wire` - Run wire/integration tests + +### Linting and Formatting + +Check code style: + +```bash +pnpm run lint +pnpm run format:check +``` + +Fix code style issues: + +```bash +pnpm run lint:fix +pnpm run format:fix +``` + +Or use the combined check command: + +```bash +pnpm run check:fix +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- `src/api/` - API client classes and types +- `src/serialization/` - Serialization/deserialization logic +- Most TypeScript files in `src/` + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The TypeScript SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/typescript/sdk/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `pnpm test` +4. Run linting and formatting: `pnpm run check:fix` +5. Build the project: `pnpm build` +6. Commit your changes with a clear commit message +7. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses automated code formatting and linting. Run `pnpm run check:fix` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/README.md b/README.md index 2b9a0b44..def96da4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Payabli TypeScript Library [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fpayabli%2Fsdk-node) -[![npm shield](https://img.shields.io/npm/v/@payabli/sdk-node)](https://www.npmjs.com/package/@payabli/sdk-node) The Payabli TypeScript library provides convenient access to the Payabli APIs from TypeScript. @@ -42,19 +41,19 @@ A full reference for this library is available [here](https://github.com/payabli Instantiate and use the client with the following: ```typescript -import { PayabliClient } from "@payabli/sdk-node"; +import { PayabliClient } from "./src/Client"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.moneyIn.getpaid({ body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", ipaddress: "255.255.255.255", paymentDetails: { serviceFee: 0, - totalAmount: 100, + totalAmount: 100 }, paymentMethod: { cardcvv: "999", @@ -63,19 +62,19 @@ await client.moneyIn.getpaid({ cardnumber: "4111111111111111", cardzip: "12345", initiator: "payor", - method: "card", - }, - }, + method: "card" + } + } }); ``` -## Request and Response Types +## Request And Response Types The SDK exports all request and response types as TypeScript interfaces. Simply import them with the following namespace: ```typescript -import { Payabli } from "@payabli/sdk-node"; +import { Payabli } from "Payabli"; const request: Payabli.AddBillRequest = { ... @@ -88,7 +87,7 @@ When the API returns a non-success status code (4xx or 5xx response), a subclass will be thrown. ```typescript -import { PayabliError } from "@payabli/sdk-node"; +import { PayabliError } from "Payabli"; try { await client.moneyIn.getpaid(...); @@ -113,42 +112,39 @@ import * as fs from "fs"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.import.importBills("8cfec329267", { - file: fs.createReadStream("/path/to/your/file"), + file: fs.createReadStream("/path/to/your/file") }); ``` - The client accepts a variety of types for file upload parameters: - -- Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream` -- Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array` +* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream` +* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array` ### Metadata You can configure metadata when uploading a file: - ```typescript const file: Uploadable.WithMetadata = { data: createReadStream("path/to/file"), - filename: "my-file", // optional + filename: "my-file", // optional contentType: "audio/mpeg", // optional - contentLength: 1949, // optional + contentLength: 1949, // optional }; ``` Alternatively, you can upload a file directly from a file path: - ```typescript -const file: Uploadable.FromPath = { +const file : Uploadable.FromPath = { path: "path/to/file", - filename: "my-file", // optional - contentType: "audio/mpeg", // optional - contentLength: 1949, // optional + filename: "my-file", // optional + contentType: "audio/mpeg", // optional + contentLength: 1949, // optional }; ``` The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically. For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory. + ## Advanced ### Additional Headers @@ -163,6 +159,18 @@ const response = await client.moneyIn.getpaid(..., { }); ``` +### Additional Query String Parameters + +If you would like to send additional query string parameters as part of the request, use the `queryParams` request option. + +```typescript +const response = await client.moneyIn.getpaid(..., { + queryParams: { + 'customQueryParamKey': 'custom query param value' + } +}); +``` + ### Retries The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long @@ -217,10 +225,75 @@ console.log(data); console.log(rawResponse.headers['X-My-Header']); ``` +### Logging + +The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options. + +```typescript +import { PayabliClient, logging } from "Payabli"; + +const client = new PayabliClient({ + ... + logging: { + level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info + logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger + silent: false, // defaults to true, set to false to enable logging + } +}); +``` +The `logging` object can have the following properties: +- `level`: The log level to use. Defaults to `logging.LogLevel.Info`. +- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`. +- `silent`: Whether to silence the logger. Defaults to `true`. + +The `level` property can be one of the following values: +- `logging.LogLevel.Debug` +- `logging.LogLevel.Info` +- `logging.LogLevel.Warn` +- `logging.LogLevel.Error` + +To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface. + +
+Custom logger examples + +Here's an example using the popular `winston` logging library. +```ts +import winston from 'winston'; + +const winstonLogger = winston.createLogger({...}); + +const logger: logging.ILogger = { + debug: (msg, ...args) => winstonLogger.debug(msg, ...args), + info: (msg, ...args) => winstonLogger.info(msg, ...args), + warn: (msg, ...args) => winstonLogger.warn(msg, ...args), + error: (msg, ...args) => winstonLogger.error(msg, ...args), +}; +``` + +Here's an example using the popular `pino` logging library. + +```ts +import pino from 'pino'; + +const pinoLogger = pino({...}); + +const logger: logging.ILogger = { + debug: (msg, ...args) => pinoLogger.debug(args, msg), + info: (msg, ...args) => pinoLogger.info(args, msg), + warn: (msg, ...args) => pinoLogger.warn(args, msg), + error: (msg, ...args) => pinoLogger.error(args, msg), +}; +``` +
+ + ### Runtime Compatibility -The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following -runtimes: + +The SDK works in the following runtimes: + + - Node.js 18+ - Vercel @@ -235,7 +308,7 @@ The SDK provides a way for you to customize the underlying HTTP client / Fetch f unsupported environment, this provides a way for you to break glass and ensure the SDK works. ```typescript -import { PayabliClient } from "@payabli/sdk-node"; +import { PayabliClient } from "Payabli"; const client = new PayabliClient({ ... @@ -251,4 +324,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! -On the other hand, contributions to the README are always very welcome! +On the other hand, contributions to the README are always very welcome! \ No newline at end of file diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..a777468e --- /dev/null +++ b/biome.json @@ -0,0 +1,74 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.3.1/schema.json", + "root": true, + "vcs": { + "enabled": false + }, + "files": { + "ignoreUnknown": true, + "includes": [ + "**", + "!!dist", + "!!**/dist", + "!!lib", + "!!**/lib", + "!!_tmp_*", + "!!**/_tmp_*", + "!!*.tmp", + "!!**/*.tmp", + "!!.tmp/", + "!!**/.tmp/", + "!!*.log", + "!!**/*.log", + "!!**/.DS_Store", + "!!**/Thumbs.db" + ] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 4, + "lineWidth": 120 + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + }, + "assist": { + "enabled": true, + "actions": { + "source": { + "organizeImports": "on" + } + } + }, + "linter": { + "rules": { + "style": { + "useNodejsImportProtocol": "off" + }, + "suspicious": { + "noAssignInExpressions": "warn", + "noUselessEscapeInString": { + "level": "warn", + "fix": "none", + "options": {} + }, + "noThenProperty": "warn", + "useIterableCallbackReturn": "warn", + "noShadowRestrictedNames": "warn", + "noTsIgnore": { + "level": "warn", + "fix": "none", + "options": {} + }, + "noConfusingVoidType": { + "level": "warn", + "fix": "none", + "options": {} + } + } + } + } +} diff --git a/jest.browser.config.mjs b/jest.browser.config.mjs deleted file mode 100644 index f333f224..00000000 --- a/jest.browser.config.mjs +++ /dev/null @@ -1,10 +0,0 @@ -/** @type {import('jest').Config} */ -export default { - preset: "ts-jest", - testEnvironment: "/tests/BrowserTestEnvironment.ts", - testMatch: ["**/tests/**/*.browser.test.ts"], - moduleNameMapper: { - "^(\\.{1,2}/.*)\\.js$": "$1", - }, - passWithNoTests: true, -}; diff --git a/jest.config.mjs b/jest.config.mjs deleted file mode 100644 index a4a200e5..00000000 --- a/jest.config.mjs +++ /dev/null @@ -1,12 +0,0 @@ -/** @type {import('jest').Config} */ -export default { - preset: "ts-jest", - testEnvironment: "node", - moduleNameMapper: { - "^(\.{1,2}/.*)\.js$": "$1", - }, - testPathIgnorePatterns: ["/.*\\.browser\\.test\\.ts$"], - setupFilesAfterEnv: ["/tests/mock-server/setup.ts"], - - passWithNoTests: true, -}; diff --git a/package.json b/package.json index f8efefe5..41cebddf 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,5 @@ { - "name": "@payabli/sdk-node", - "version": "0.0.117", - "private": false, - "repository": "https://github.com/payabli/sdk-node", + "name": "test-package", "type": "commonjs", "main": "./dist/cjs/index.js", "module": "./dist/esm/index.mjs", @@ -24,30 +21,33 @@ }, "files": [ "dist", - "reference.md" + "reference.md", + "README.md", + "LICENSE" ], "scripts": { - "format": "prettier . --write --ignore-unknown", - "build": "yarn build:cjs && yarn build:esm", + "format": "biome format --write --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "format:check": "biome format --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "lint": "biome lint --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "lint:fix": "biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "check": "biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "check:fix": "biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none", + "build": "pnpm build:cjs && pnpm build:esm", "build:cjs": "tsc --project ./tsconfig.cjs.json", "build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm", - "test": "jest tests/unit", - "test:browser": "jest --config jest.browser.config.mjs", - "test:wire": "jest tests/wire", - "wire:test": "yarn test:wire" + "test": "vitest", + "test:unit": "vitest --project unit", + "test:wire": "vitest --project wire" }, + "dependencies": {}, "devDependencies": { "webpack": "^5.97.1", "ts-loader": "^9.5.1", - "jest": "^29.7.0", - "@jest/globals": "^29.7.0", - "@types/jest": "^29.5.14", - "ts-jest": "^29.3.4", - "jest-environment-jsdom": "^29.7.0", - "msw": "^2.8.4", + "vitest": "^3.2.4", + "msw": "2.11.2", "@types/node": "^18.19.70", - "prettier": "^3.4.2", - "typescript": "~5.7.2" + "typescript": "~5.7.2", + "@biomejs/biome": "2.3.1" }, "browser": { "fs": false, @@ -55,5 +55,9 @@ "path": false, "stream": false }, - "packageManager": "yarn@1.22.22" + "packageManager": "pnpm@10.20.0", + "engines": { + "node": ">=18.0.0" + }, + "sideEffects": false } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..7a489b0d --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,2132 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@biomejs/biome': + specifier: 2.3.1 + version: 2.3.1 + '@types/node': + specifier: ^18.19.70 + version: 18.19.130 + msw: + specifier: 2.11.2 + version: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) + ts-loader: + specifier: ^9.5.1 + version: 9.5.4(typescript@5.7.3)(webpack@5.103.0) + typescript: + specifier: ~5.7.2 + version: 5.7.3 + vitest: + specifier: ^3.2.4 + version: 3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.44.1) + webpack: + specifier: ^5.97.1 + version: 5.103.0 + +packages: + + '@biomejs/biome@2.3.1': + resolution: {integrity: sha512-A29evf1R72V5bo4o2EPxYMm5mtyGvzp2g+biZvRFx29nWebGyyeOSsDWGx3tuNNMFRepGwxmA9ZQ15mzfabK2w==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@2.3.1': + resolution: {integrity: sha512-ombSf3MnTUueiYGN1SeI9tBCsDUhpWzOwS63Dove42osNh0PfE1cUtHFx6eZ1+MYCCLwXzlFlYFdrJ+U7h6LcA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@2.3.1': + resolution: {integrity: sha512-pcOfwyoQkrkbGvXxRvZNe5qgD797IowpJPovPX5biPk2FwMEV+INZqfCaz4G5bVq9hYnjwhRMamg11U4QsRXrQ==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@2.3.1': + resolution: {integrity: sha512-+DZYv8l7FlUtTrWs1Tdt1KcNCAmRO87PyOnxKGunbWm5HKg1oZBSbIIPkjrCtDZaeqSG1DiGx7qF+CPsquQRcg==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-arm64@2.3.1': + resolution: {integrity: sha512-td5O8pFIgLs8H1sAZsD6v+5quODihyEw4nv2R8z7swUfIK1FKk+15e4eiYVLcAE4jUqngvh4j3JCNgg0Y4o4IQ==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-x64-musl@2.3.1': + resolution: {integrity: sha512-Y3Ob4nqgv38Mh+6EGHltuN+Cq8aj/gyMTJYzkFZV2AEj+9XzoXB9VNljz9pjfFNHUxvLEV4b55VWyxozQTBaUQ==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-linux-x64@2.3.1': + resolution: {integrity: sha512-PYWgEO7up7XYwSAArOpzsVCiqxBCXy53gsReAb1kKYIyXaoAlhBaBMvxR/k2Rm9aTuZ662locXUmPk/Aj+Xu+Q==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-win32-arm64@2.3.1': + resolution: {integrity: sha512-RHIG/zgo+69idUqVvV3n8+j58dKYABRpMyDmfWu2TITC+jwGPiEaT0Q3RKD+kQHiS80mpBrST0iUGeEXT0bU9A==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@2.3.1': + resolution: {integrity: sha512-izl30JJ5Dp10mi90Eko47zhxE6pYyWPcnX1NQxKpL/yMhXxf95oLTzfpu4q+MDBh/gemNqyJEwjBpe0MT5iWPA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + + '@bundled-es-modules/cookie@2.0.1': + resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==} + + '@bundled-es-modules/statuses@1.0.1': + resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==} + + '@esbuild/aix-ppc64@0.25.12': + resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.12': + resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.12': + resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.12': + resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.12': + resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.12': + resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.12': + resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.12': + resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.12': + resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.12': + resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.12': + resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.12': + resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.12': + resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.12': + resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.12': + resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.12': + resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.12': + resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.12': + resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.12': + resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.12': + resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.12': + resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.12': + resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.25.12': + resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.12': + resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.12': + resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.12': + resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@inquirer/ansi@1.0.2': + resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} + engines: {node: '>=18'} + + '@inquirer/confirm@5.1.21': + resolution: {integrity: sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/core@10.3.2': + resolution: {integrity: sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/figures@1.0.15': + resolution: {integrity: sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==} + engines: {node: '>=18'} + + '@inquirer/type@3.0.10': + resolution: {integrity: sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@mswjs/interceptors@0.39.8': + resolution: {integrity: sha512-2+BzZbjRO7Ct61k8fMNHEtoKjeWI9pIlHFTqBwZ5icHpqszIgEZbjb1MW5Z0+bITTCTl3gk4PDBxs9tA/csXvA==} + engines: {node: '>=18'} + + '@open-draft/deferred-promise@2.2.0': + resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==} + + '@open-draft/logger@0.3.0': + resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==} + + '@open-draft/until@2.1.0': + resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==} + + '@rollup/rollup-android-arm-eabi@4.53.3': + resolution: {integrity: sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.53.3': + resolution: {integrity: sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.53.3': + resolution: {integrity: sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.53.3': + resolution: {integrity: sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.53.3': + resolution: {integrity: sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.53.3': + resolution: {integrity: sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.53.3': + resolution: {integrity: sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.53.3': + resolution: {integrity: sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.53.3': + resolution: {integrity: sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.53.3': + resolution: {integrity: sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.53.3': + resolution: {integrity: sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.53.3': + resolution: {integrity: sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.53.3': + resolution: {integrity: sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-riscv64-musl@4.53.3': + resolution: {integrity: sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.53.3': + resolution: {integrity: sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==} + cpu: [s390x] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.53.3': + resolution: {integrity: sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.53.3': + resolution: {integrity: sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openharmony-arm64@4.53.3': + resolution: {integrity: sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.53.3': + resolution: {integrity: sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.53.3': + resolution: {integrity: sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.53.3': + resolution: {integrity: sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.53.3': + resolution: {integrity: sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==} + cpu: [x64] + os: [win32] + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/cookie@0.6.0': + resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/eslint-scope@3.7.7': + resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} + + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} + + '@types/estree@1.0.8': + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@18.19.130': + resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==} + + '@types/statuses@2.0.6': + resolution: {integrity: sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA==} + + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} + + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} + + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} + + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} + + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} + + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} + + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + acorn-import-phases@1.0.4: + resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==} + engines: {node: '>=10.13.0'} + peerDependencies: + acorn: ^8.14.0 + + acorn@8.15.0: + resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} + engines: {node: '>=0.4.0'} + hasBin: true + + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + + ajv@8.17.1: + resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + baseline-browser-mapping@2.8.32: + resolution: {integrity: sha512-OPz5aBThlyLFgxyhdwf/s2+8ab3OvT7AdTNvKHBwpXomIYeXqpUUuT8LrdtxZSsWJ4R4CU1un4XGh5Ez3nlTpw==} + hasBin: true + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + browserslist@4.28.0: + resolution: {integrity: sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + caniuse-lite@1.0.30001757: + resolution: {integrity: sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==} + + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + cli-width@4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + + electron-to-chromium@1.5.263: + resolution: {integrity: sha512-DrqJ11Knd+lo+dv+lltvfMDLU27g14LMdH2b0O3Pio4uk0x+z7OR+JrmyacTPN2M8w3BrZ7/RTwG3R9B7irPlg==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + enhanced-resolve@5.18.3: + resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==} + engines: {node: '>=10.13.0'} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + esbuild@0.25.12: + resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} + engines: {node: '>=18'} + hasBin: true + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + expect-type@1.2.2: + resolution: {integrity: sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==} + engines: {node: '>=12.0.0'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-uri@3.1.0: + resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + graphql@16.12.0: + resolution: {integrity: sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ==} + engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + headers-polyfill@4.0.3: + resolution: {integrity: sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-node-process@1.2.0: + resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + loader-runner@4.3.1: + resolution: {integrity: sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==} + engines: {node: '>=6.11.5'} + + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + msw@2.11.2: + resolution: {integrity: sha512-MI54hLCsrMwiflkcqlgYYNJJddY5/+S0SnONvhv1owOplvqohKSQyGejpNdUGyCwgs4IH7PqaNbPw/sKOEze9Q==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + typescript: '>= 4.8.x' + peerDependenciesMeta: + typescript: + optional: true + + mute-stream@2.0.0: + resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} + engines: {node: ^18.17.0 || >=20.5.0} + + nanoid@3.3.11: + resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + node-releases@2.0.27: + resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} + + outvariant@1.4.3: + resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} + + path-to-regexp@6.3.0: + resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + picomatch@4.0.3: + resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} + engines: {node: '>=12'} + + postcss@8.5.6: + resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==} + engines: {node: ^10 || ^12 || >=14} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + rettime@0.7.0: + resolution: {integrity: sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw==} + + rollup@4.53.3: + resolution: {integrity: sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} + + semver@7.7.3: + resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} + engines: {node: '>=10'} + hasBin: true + + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.6: + resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} + engines: {node: '>= 12'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + strict-event-emitter@0.5.1: + resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + tapable@2.3.0: + resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} + engines: {node: '>=6'} + + terser-webpack-plugin@5.3.14: + resolution: {integrity: sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@swc/core': '*' + esbuild: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@swc/core': + optional: true + esbuild: + optional: true + uglify-js: + optional: true + + terser@5.44.1: + resolution: {integrity: sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==} + engines: {node: '>=10'} + hasBin: true + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.15: + resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} + engines: {node: '>=14.0.0'} + + tldts-core@7.0.19: + resolution: {integrity: sha512-lJX2dEWx0SGH4O6p+7FPwYmJ/bu1JbcGJ8RLaG9b7liIgZ85itUVEPbMtWRVrde/0fnDPEPHW10ZsKW3kVsE9A==} + + tldts@7.0.19: + resolution: {integrity: sha512-8PWx8tvC4jDB39BQw1m4x8y5MH1BcQ5xHeL2n7UVFulMPH/3Q0uiamahFJ3lXA0zO2SUyRXuVVbWSDmstlt9YA==} + hasBin: true + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tough-cookie@6.0.0: + resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==} + engines: {node: '>=16'} + + ts-loader@9.5.4: + resolution: {integrity: sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ==} + engines: {node: '>=12.0.0'} + peerDependencies: + typescript: '*' + webpack: ^5.0.0 + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + update-browserslist-db@1.1.4: + resolution: {integrity: sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + + vite@7.2.6: + resolution: {integrity: sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + watchpack@2.4.4: + resolution: {integrity: sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==} + engines: {node: '>=10.13.0'} + + webpack-sources@3.3.3: + resolution: {integrity: sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==} + engines: {node: '>=10.13.0'} + + webpack@5.103.0: + resolution: {integrity: sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + + yoctocolors-cjs@2.1.3: + resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} + engines: {node: '>=18'} + +snapshots: + + '@biomejs/biome@2.3.1': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 2.3.1 + '@biomejs/cli-darwin-x64': 2.3.1 + '@biomejs/cli-linux-arm64': 2.3.1 + '@biomejs/cli-linux-arm64-musl': 2.3.1 + '@biomejs/cli-linux-x64': 2.3.1 + '@biomejs/cli-linux-x64-musl': 2.3.1 + '@biomejs/cli-win32-arm64': 2.3.1 + '@biomejs/cli-win32-x64': 2.3.1 + + '@biomejs/cli-darwin-arm64@2.3.1': + optional: true + + '@biomejs/cli-darwin-x64@2.3.1': + optional: true + + '@biomejs/cli-linux-arm64-musl@2.3.1': + optional: true + + '@biomejs/cli-linux-arm64@2.3.1': + optional: true + + '@biomejs/cli-linux-x64-musl@2.3.1': + optional: true + + '@biomejs/cli-linux-x64@2.3.1': + optional: true + + '@biomejs/cli-win32-arm64@2.3.1': + optional: true + + '@biomejs/cli-win32-x64@2.3.1': + optional: true + + '@bundled-es-modules/cookie@2.0.1': + dependencies: + cookie: 0.7.2 + + '@bundled-es-modules/statuses@1.0.1': + dependencies: + statuses: 2.0.2 + + '@esbuild/aix-ppc64@0.25.12': + optional: true + + '@esbuild/android-arm64@0.25.12': + optional: true + + '@esbuild/android-arm@0.25.12': + optional: true + + '@esbuild/android-x64@0.25.12': + optional: true + + '@esbuild/darwin-arm64@0.25.12': + optional: true + + '@esbuild/darwin-x64@0.25.12': + optional: true + + '@esbuild/freebsd-arm64@0.25.12': + optional: true + + '@esbuild/freebsd-x64@0.25.12': + optional: true + + '@esbuild/linux-arm64@0.25.12': + optional: true + + '@esbuild/linux-arm@0.25.12': + optional: true + + '@esbuild/linux-ia32@0.25.12': + optional: true + + '@esbuild/linux-loong64@0.25.12': + optional: true + + '@esbuild/linux-mips64el@0.25.12': + optional: true + + '@esbuild/linux-ppc64@0.25.12': + optional: true + + '@esbuild/linux-riscv64@0.25.12': + optional: true + + '@esbuild/linux-s390x@0.25.12': + optional: true + + '@esbuild/linux-x64@0.25.12': + optional: true + + '@esbuild/netbsd-arm64@0.25.12': + optional: true + + '@esbuild/netbsd-x64@0.25.12': + optional: true + + '@esbuild/openbsd-arm64@0.25.12': + optional: true + + '@esbuild/openbsd-x64@0.25.12': + optional: true + + '@esbuild/openharmony-arm64@0.25.12': + optional: true + + '@esbuild/sunos-x64@0.25.12': + optional: true + + '@esbuild/win32-arm64@0.25.12': + optional: true + + '@esbuild/win32-ia32@0.25.12': + optional: true + + '@esbuild/win32-x64@0.25.12': + optional: true + + '@inquirer/ansi@1.0.2': {} + + '@inquirer/confirm@5.1.21(@types/node@18.19.130)': + dependencies: + '@inquirer/core': 10.3.2(@types/node@18.19.130) + '@inquirer/type': 3.0.10(@types/node@18.19.130) + optionalDependencies: + '@types/node': 18.19.130 + + '@inquirer/core@10.3.2(@types/node@18.19.130)': + dependencies: + '@inquirer/ansi': 1.0.2 + '@inquirer/figures': 1.0.15 + '@inquirer/type': 3.0.10(@types/node@18.19.130) + cli-width: 4.1.0 + mute-stream: 2.0.0 + signal-exit: 4.1.0 + wrap-ansi: 6.2.0 + yoctocolors-cjs: 2.1.3 + optionalDependencies: + '@types/node': 18.19.130 + + '@inquirer/figures@1.0.15': {} + + '@inquirer/type@3.0.10(@types/node@18.19.130)': + optionalDependencies: + '@types/node': 18.19.130 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.5.5': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@mswjs/interceptors@0.39.8': + dependencies: + '@open-draft/deferred-promise': 2.2.0 + '@open-draft/logger': 0.3.0 + '@open-draft/until': 2.1.0 + is-node-process: 1.2.0 + outvariant: 1.4.3 + strict-event-emitter: 0.5.1 + + '@open-draft/deferred-promise@2.2.0': {} + + '@open-draft/logger@0.3.0': + dependencies: + is-node-process: 1.2.0 + outvariant: 1.4.3 + + '@open-draft/until@2.1.0': {} + + '@rollup/rollup-android-arm-eabi@4.53.3': + optional: true + + '@rollup/rollup-android-arm64@4.53.3': + optional: true + + '@rollup/rollup-darwin-arm64@4.53.3': + optional: true + + '@rollup/rollup-darwin-x64@4.53.3': + optional: true + + '@rollup/rollup-freebsd-arm64@4.53.3': + optional: true + + '@rollup/rollup-freebsd-x64@4.53.3': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.53.3': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.53.3': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.53.3': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.53.3': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.53.3': + optional: true + + '@rollup/rollup-linux-x64-musl@4.53.3': + optional: true + + '@rollup/rollup-openharmony-arm64@4.53.3': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.53.3': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.53.3': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.53.3': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.53.3': + optional: true + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/cookie@0.6.0': {} + + '@types/deep-eql@4.0.2': {} + + '@types/eslint-scope@3.7.7': + dependencies: + '@types/eslint': 9.6.1 + '@types/estree': 1.0.8 + + '@types/eslint@9.6.1': + dependencies: + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + + '@types/estree@1.0.8': {} + + '@types/json-schema@7.0.15': {} + + '@types/node@18.19.130': + dependencies: + undici-types: 5.26.5 + + '@types/statuses@2.0.6': {} + + '@vitest/expect@3.2.4': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.2.6(@types/node@18.19.130)(terser@5.44.1))': + dependencies: + '@vitest/spy': 3.2.4 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + msw: 2.11.2(@types/node@18.19.130)(typescript@5.7.3) + vite: 7.2.6(@types/node@18.19.130)(terser@5.44.1) + + '@vitest/pretty-format@3.2.4': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.4': + dependencies: + '@vitest/utils': 3.2.4 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.4': + dependencies: + tinyspy: 4.0.4 + + '@vitest/utils@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + + '@webassemblyjs/ast@1.14.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + + '@webassemblyjs/helper-wasm-section@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + acorn-import-phases@1.0.4(acorn@8.15.0): + dependencies: + acorn: 8.15.0 + + acorn@8.15.0: {} + + ajv-formats@2.1.1(ajv@8.17.1): + optionalDependencies: + ajv: 8.17.1 + + ajv-keywords@5.1.0(ajv@8.17.1): + dependencies: + ajv: 8.17.1 + fast-deep-equal: 3.1.3 + + ajv@8.17.1: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.0 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + assertion-error@2.0.1: {} + + baseline-browser-mapping@2.8.32: {} + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browserslist@4.28.0: + dependencies: + baseline-browser-mapping: 2.8.32 + caniuse-lite: 1.0.30001757 + electron-to-chromium: 1.5.263 + node-releases: 2.0.27 + update-browserslist-db: 1.1.4(browserslist@4.28.0) + + buffer-from@1.1.2: {} + + cac@6.7.14: {} + + caniuse-lite@1.0.30001757: {} + + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + check-error@2.1.1: {} + + chrome-trace-event@1.0.4: {} + + cli-width@4.1.0: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@2.20.3: {} + + cookie@0.7.2: {} + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + deep-eql@5.0.2: {} + + electron-to-chromium@1.5.263: {} + + emoji-regex@8.0.0: {} + + enhanced-resolve@5.18.3: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.0 + + es-module-lexer@1.7.0: {} + + esbuild@0.25.12: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.12 + '@esbuild/android-arm': 0.25.12 + '@esbuild/android-arm64': 0.25.12 + '@esbuild/android-x64': 0.25.12 + '@esbuild/darwin-arm64': 0.25.12 + '@esbuild/darwin-x64': 0.25.12 + '@esbuild/freebsd-arm64': 0.25.12 + '@esbuild/freebsd-x64': 0.25.12 + '@esbuild/linux-arm': 0.25.12 + '@esbuild/linux-arm64': 0.25.12 + '@esbuild/linux-ia32': 0.25.12 + '@esbuild/linux-loong64': 0.25.12 + '@esbuild/linux-mips64el': 0.25.12 + '@esbuild/linux-ppc64': 0.25.12 + '@esbuild/linux-riscv64': 0.25.12 + '@esbuild/linux-s390x': 0.25.12 + '@esbuild/linux-x64': 0.25.12 + '@esbuild/netbsd-arm64': 0.25.12 + '@esbuild/netbsd-x64': 0.25.12 + '@esbuild/openbsd-arm64': 0.25.12 + '@esbuild/openbsd-x64': 0.25.12 + '@esbuild/openharmony-arm64': 0.25.12 + '@esbuild/sunos-x64': 0.25.12 + '@esbuild/win32-arm64': 0.25.12 + '@esbuild/win32-ia32': 0.25.12 + '@esbuild/win32-x64': 0.25.12 + + escalade@3.2.0: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.8 + + events@3.3.0: {} + + expect-type@1.2.2: {} + + fast-deep-equal@3.1.3: {} + + fast-uri@3.1.0: {} + + fdir@6.5.0(picomatch@4.0.3): + optionalDependencies: + picomatch: 4.0.3 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + fsevents@2.3.3: + optional: true + + get-caller-file@2.0.5: {} + + glob-to-regexp@0.4.1: {} + + graceful-fs@4.2.11: {} + + graphql@16.12.0: {} + + has-flag@4.0.0: {} + + headers-polyfill@4.0.3: {} + + is-fullwidth-code-point@3.0.0: {} + + is-node-process@1.2.0: {} + + is-number@7.0.0: {} + + jest-worker@27.5.1: + dependencies: + '@types/node': 18.19.130 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + js-tokens@9.0.1: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@1.0.0: {} + + loader-runner@4.3.1: {} + + loupe@3.2.1: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + + merge-stream@2.0.0: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + ms@2.1.3: {} + + msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3): + dependencies: + '@bundled-es-modules/cookie': 2.0.1 + '@bundled-es-modules/statuses': 1.0.1 + '@inquirer/confirm': 5.1.21(@types/node@18.19.130) + '@mswjs/interceptors': 0.39.8 + '@open-draft/deferred-promise': 2.2.0 + '@open-draft/until': 2.1.0 + '@types/cookie': 0.6.0 + '@types/statuses': 2.0.6 + graphql: 16.12.0 + headers-polyfill: 4.0.3 + is-node-process: 1.2.0 + outvariant: 1.4.3 + path-to-regexp: 6.3.0 + picocolors: 1.1.1 + rettime: 0.7.0 + strict-event-emitter: 0.5.1 + tough-cookie: 6.0.0 + type-fest: 4.41.0 + yargs: 17.7.2 + optionalDependencies: + typescript: 5.7.3 + transitivePeerDependencies: + - '@types/node' + + mute-stream@2.0.0: {} + + nanoid@3.3.11: {} + + neo-async@2.6.2: {} + + node-releases@2.0.27: {} + + outvariant@1.4.3: {} + + path-to-regexp@6.3.0: {} + + pathe@2.0.3: {} + + pathval@2.0.1: {} + + picocolors@1.1.1: {} + + picomatch@2.3.1: {} + + picomatch@4.0.3: {} + + postcss@8.5.6: + dependencies: + nanoid: 3.3.11 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + rettime@0.7.0: {} + + rollup@4.53.3: + dependencies: + '@types/estree': 1.0.8 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.53.3 + '@rollup/rollup-android-arm64': 4.53.3 + '@rollup/rollup-darwin-arm64': 4.53.3 + '@rollup/rollup-darwin-x64': 4.53.3 + '@rollup/rollup-freebsd-arm64': 4.53.3 + '@rollup/rollup-freebsd-x64': 4.53.3 + '@rollup/rollup-linux-arm-gnueabihf': 4.53.3 + '@rollup/rollup-linux-arm-musleabihf': 4.53.3 + '@rollup/rollup-linux-arm64-gnu': 4.53.3 + '@rollup/rollup-linux-arm64-musl': 4.53.3 + '@rollup/rollup-linux-loong64-gnu': 4.53.3 + '@rollup/rollup-linux-ppc64-gnu': 4.53.3 + '@rollup/rollup-linux-riscv64-gnu': 4.53.3 + '@rollup/rollup-linux-riscv64-musl': 4.53.3 + '@rollup/rollup-linux-s390x-gnu': 4.53.3 + '@rollup/rollup-linux-x64-gnu': 4.53.3 + '@rollup/rollup-linux-x64-musl': 4.53.3 + '@rollup/rollup-openharmony-arm64': 4.53.3 + '@rollup/rollup-win32-arm64-msvc': 4.53.3 + '@rollup/rollup-win32-ia32-msvc': 4.53.3 + '@rollup/rollup-win32-x64-gnu': 4.53.3 + '@rollup/rollup-win32-x64-msvc': 4.53.3 + fsevents: 2.3.3 + + safe-buffer@5.2.1: {} + + schema-utils@4.3.3: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 8.17.1 + ajv-formats: 2.1.1(ajv@8.17.1) + ajv-keywords: 5.1.0(ajv@8.17.1) + + semver@7.7.3: {} + + serialize-javascript@6.0.2: + dependencies: + randombytes: 2.1.0 + + siginfo@2.0.0: {} + + signal-exit@4.1.0: {} + + source-map-js@1.2.1: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.6: {} + + stackback@0.0.2: {} + + statuses@2.0.2: {} + + std-env@3.10.0: {} + + strict-event-emitter@0.5.1: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + tapable@2.3.0: {} + + terser-webpack-plugin@5.3.14(webpack@5.103.0): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + serialize-javascript: 6.0.2 + terser: 5.44.1 + webpack: 5.103.0 + + terser@5.44.1: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.15.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + + tinyglobby@0.2.15: + dependencies: + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.4: {} + + tldts-core@7.0.19: {} + + tldts@7.0.19: + dependencies: + tldts-core: 7.0.19 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tough-cookie@6.0.0: + dependencies: + tldts: 7.0.19 + + ts-loader@9.5.4(typescript@5.7.3)(webpack@5.103.0): + dependencies: + chalk: 4.1.2 + enhanced-resolve: 5.18.3 + micromatch: 4.0.8 + semver: 7.7.3 + source-map: 0.7.6 + typescript: 5.7.3 + webpack: 5.103.0 + + type-fest@4.41.0: {} + + typescript@5.7.3: {} + + undici-types@5.26.5: {} + + update-browserslist-db@1.1.4(browserslist@4.28.0): + dependencies: + browserslist: 4.28.0 + escalade: 3.2.0 + picocolors: 1.1.1 + + vite-node@3.2.4(@types/node@18.19.130)(terser@5.44.1): + dependencies: + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.2.6(@types/node@18.19.130)(terser@5.44.1) + transitivePeerDependencies: + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.2.6(@types/node@18.19.130)(terser@5.44.1): + dependencies: + esbuild: 0.25.12 + fdir: 6.5.0(picomatch@4.0.3) + picomatch: 4.0.3 + postcss: 8.5.6 + rollup: 4.53.3 + tinyglobby: 0.2.15 + optionalDependencies: + '@types/node': 18.19.130 + fsevents: 2.3.3 + terser: 5.44.1 + + vitest@3.2.4(@types/node@18.19.130)(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(terser@5.44.1): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(msw@2.11.2(@types/node@18.19.130)(typescript@5.7.3))(vite@7.2.6(@types/node@18.19.130)(terser@5.44.1)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.2.2 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.3 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.15 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.2.6(@types/node@18.19.130)(terser@5.44.1) + vite-node: 3.2.4(@types/node@18.19.130)(terser@5.44.1) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 18.19.130 + transitivePeerDependencies: + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + watchpack@2.4.4: + dependencies: + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + + webpack-sources@3.3.3: {} + + webpack@5.103.0: + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.8 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.15.0 + acorn-import-phases: 1.0.4(acorn@8.15.0) + browserslist: 4.28.0 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.18.3 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.1 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.0 + terser-webpack-plugin: 5.3.14(webpack@5.103.0) + watchpack: 2.4.4 + webpack-sources: 3.3.3 + transitivePeerDependencies: + - '@swc/core' + - esbuild + - uglify-js + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + y18n@5.0.8: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.2: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + + yoctocolors-cjs@2.1.3: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..6e4c3951 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1 @@ +packages: ['.'] \ No newline at end of file diff --git a/reference.md b/reference.md index 6ae58ec8..0a3876a0 100644 --- a/reference.md +++ b/reference.md @@ -1,7 +1,5 @@ # Reference - ## Bill -
client.bill.addBill(entry, { ...params }) -> Payabli.BillResponse
@@ -15,7 +13,6 @@
Creates a bill in an entrypoint. -
@@ -37,8 +34,7 @@ await client.bill.addBill("8cfec329267", { billDate: "2024-07-01", dueDate: "2024-07-01", comments: "Deposit for materials", - billItems: [ - { + billItems: [{ itemProductCode: "M-DEPOSIT", itemProductName: "Materials deposit", itemDescription: "Deposit for materials", @@ -50,29 +46,26 @@ await client.bill.addBill("8cfec329267", { itemCategories: ["deposits"], itemTotalAmount: 123, itemTaxAmount: 7, - itemTaxRate: 0.075, - }, - ], + itemTaxRate: 0.075 + }], mode: 0, accountingField1: "MyInternalId", vendor: { - vendorNumber: "1234-A", + vendorNumber: "1234-A" }, endDate: "2024-07-01", frequency: "monthly", terms: "NET30", status: -99, - attachments: [ - { + attachments: [{ ftype: "pdf", filename: "my-doc.pdf", - furl: "https://mysite.com/my-doc.pdf", - }, - ], - }, + furl: "https://mysite.com/my-doc.pdf" + }] + } }); -``` +``` @@ -87,28 +80,29 @@ await client.bill.addBill("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.AddBillRequest` - +**request:** `Payabli.AddBillRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+
@@ -126,7 +120,6 @@ await client.bill.addBill("8cfec329267", {
Delete a file attached to a bill. -
@@ -142,8 +135,8 @@ Delete a file attached to a bill. ```typescript await client.bill.deleteAttachedFromBill(285, "0_Bill.pdf"); -``` +``` @@ -158,18 +151,18 @@ await client.bill.deleteAttachedFromBill(285, "0_Bill.pdf");
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**filename:** `string` +**filename:** `string` The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is -`0_Bill.pdf`. +`0_Bill.pdf`. ```json "DocumentsRef": { @@ -182,29 +175,30 @@ request to `/api/Invoice/{idInvoice}`. Here, the filename is } ] } -``` - + ``` +
-**request:** `Payabli.DeleteAttachedFromBillRequest` - +**request:** `Payabli.DeleteAttachedFromBillRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -222,7 +216,6 @@ request to `/api/Invoice/{idInvoice}`. Here, the filename is
Deletes a bill by ID. -
@@ -238,8 +231,8 @@ Deletes a bill by ID. ```typescript await client.bill.deleteBill(285); -``` +``` @@ -254,20 +247,21 @@ await client.bill.deleteBill(285);
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -285,7 +279,6 @@ await client.bill.deleteBill(285);
Updates a bill by ID. -
@@ -302,10 +295,10 @@ Updates a bill by ID. ```typescript await client.bill.editBill(285, { netAmount: 3762.87, - billDate: "2025-07-01", + billDate: "2025-07-01" }); -``` +``` @@ -320,28 +313,29 @@ await client.bill.editBill(285, {
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**request:** `Payabli.BillOutData` - +**request:** `Payabli.BillOutData` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -359,7 +353,6 @@ await client.bill.editBill(285, {
Retrieves a file attached to a bill, either as a binary file or as a Base64-encoded string. -
@@ -375,10 +368,10 @@ Retrieves a file attached to a bill, either as a binary file or as a Base64-enco ```typescript await client.bill.getAttachedFromBill(285, "0_Bill.pdf", { - returnObject: true, + returnObject: true }); -``` +``` @@ -393,48 +386,49 @@ await client.bill.getAttachedFromBill(285, "0_Bill.pdf", {
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**filename:** `string` +**filename:** `string` -The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. +The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. "DocumentsRef": { -"zipfile": "inva_269.zip", -"filelist": [ -{ -"originalName": "Bill.pdf", -"zipName": "0_Bill.pdf", -"descriptor": null + "zipfile": "inva_269.zip", + "filelist": [ + { + "originalName": "Bill.pdf", + "zipName": "0_Bill.pdf", + "descriptor": null + } + ] } -] -} - +
-**request:** `Payabli.GetAttachedFromBillRequest` - +**request:** `Payabli.GetAttachedFromBillRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -452,7 +446,6 @@ The filename in Payabli. Filename is `zipName` in response to a request to `/api
Retrieves a bill by ID from an entrypoint. -
@@ -468,8 +461,8 @@ Retrieves a bill by ID from an entrypoint. ```typescript await client.bill.getBill(285); -``` +``` @@ -484,20 +477,21 @@ await client.bill.getBill(285);
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -515,7 +509,6 @@ await client.bill.getBill(285);
Retrieve a list of bills for an entrypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -533,10 +526,10 @@ Retrieve a list of bills for an entrypoint. Use filters to limit results. Includ await client.bill.listBills("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -551,28 +544,29 @@ await client.bill.listBills("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListBillsRequest` - +**request:** `Payabli.ListBillsRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -590,7 +584,6 @@ await client.bill.listBills("8cfec329267", {
Retrieve a list of bills for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -608,10 +601,10 @@ Retrieve a list of bills for an organization. Use filters to limit results. Incl await client.bill.listBillsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -626,28 +619,29 @@ await client.bill.listBillsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListBillsOrgRequest` - +**request:** `Payabli.ListBillsOrgRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -665,7 +659,6 @@ await client.bill.listBillsOrg(123, {
Modify the list of users the bill is sent to for approval. -
@@ -681,8 +674,8 @@ Modify the list of users the bill is sent to for approval. ```typescript await client.bill.modifyApprovalBill(285, ["string"]); -``` +``` @@ -697,28 +690,29 @@ await client.bill.modifyApprovalBill(285, ["string"]);
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**request:** `string[]` - +**request:** `string[]` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -736,7 +730,6 @@ await client.bill.modifyApprovalBill(285, ["string"]);
Send a bill to a user or list of users to approve. -
@@ -753,10 +746,10 @@ Send a bill to a user or list of users to approve. ```typescript await client.bill.sendToApprovalBill(285, { idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", - body: ["string"], + body: ["string"] }); -``` +``` @@ -771,28 +764,29 @@ await client.bill.sendToApprovalBill(285, {
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
-**request:** `Payabli.SendToApprovalBillRequest` - +**request:** `Payabli.SendToApprovalBillRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ @@ -810,7 +804,6 @@ await client.bill.sendToApprovalBill(285, {
Approve or disapprove a bill by ID. -
@@ -826,8 +819,8 @@ Approve or disapprove a bill by ID. ```typescript await client.bill.setApprovedBill(285, "true"); -``` +``` @@ -842,7 +835,7 @@ await client.bill.setApprovedBill(285, "true");
**idBill:** `number` — Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - +
@@ -850,34 +843,34 @@ await client.bill.setApprovedBill(285, "true");
**approved:** `string` — String representing the approved status. Accepted values: 'true' or 'false'. - +
-**request:** `Payabli.SetApprovedBillRequest` - +**request:** `Payabli.SetApprovedBillRequest` +
-**requestOptions:** `Bill.RequestOptions` - +**requestOptions:** `BillClient.RequestOptions` +
+ ## Boarding -
client.boarding.addApplication({ ...params }) -> Payabli.PayabliApiResponse00Responsedatanonobject
@@ -891,7 +884,6 @@ await client.bill.setApprovedBill(285, "true");
Creates a boarding application in an organization. This endpoint requires an application API token. -
@@ -913,8 +905,8 @@ await client.boarding.addApplication({ acceptAmex: true, acceptDiscover: true, acceptMastercard: true, - acceptVisa: true, - }, + acceptVisa: true + } }, annualRevenue: 1000, averageBillSize: "500", @@ -932,14 +924,12 @@ await client.boarding.addApplication({ bsummary: "Brick and mortar store that sells office supplies", btype: "Limited Liability Company", bzip: "33000", - contacts: [ - { + contacts: [{ contactEmail: "herman@hermanscoatings.com", contactName: "Herman Martinez", contactPhone: "3055550000", - contactTitle: "Owner", - }, - ], + contactTitle: "Owner" + }], creditLimit: "creditLimit", dbaName: "Sunshine Gutters", ein: "123456789", @@ -956,8 +946,7 @@ await client.boarding.addApplication({ mstate: "TN", mzip: "37615", orgId: 123, - ownership: [ - { + ownership: [{ oaddress: "33 North St", ocity: "Any City", ocountry: "US", @@ -972,9 +961,8 @@ await client.boarding.addApplication({ ownerphone2: "555888111", ownerssn: "123456789", ownertitle: "CEO", - ozip: "55555", - }, - ], + ozip: "55555" + }], phonenumber: "1234567890", processingRegion: "US", recipientEmail: "josephray@example.com", @@ -996,8 +984,7 @@ await client.boarding.addApplication({ signedDocumentReference: "https://example.com/signed-document.pdf", attestationDate: "04/20/2025", signDate: "04/20/2025", - additionalData: - '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + additionalData: "{\"deviceId\":\"499585-389fj484-3jcj8hj3\",\"session\":\"fifji4-fiu443-fn4843\",\"timeWithCompany\":\"6 Years\"}" }, startdate: "01/01/1990", taxFillName: "Sunshine LLC", @@ -1007,10 +994,10 @@ await client.boarding.addApplication({ whenCharged: "When Service Provided", whenDelivered: "Over 30 Days", whenProvided: "30 Days or Less", - whenRefunded: "30 Days or Less", + whenRefunded: "30 Days or Less" }); -``` +``` @@ -1024,21 +1011,22 @@ await client.boarding.addApplication({
-**request:** `Payabli.AddApplicationRequest` - +**request:** `Payabli.AddApplicationRequest` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+
@@ -1056,7 +1044,6 @@ await client.boarding.addApplication({
Deletes a boarding application by ID. -
@@ -1072,8 +1059,8 @@ Deletes a boarding application by ID. ```typescript await client.boarding.deleteApplication(352); -``` +``` @@ -1087,21 +1074,22 @@ await client.boarding.deleteApplication(352);
-**appId:** `number` — Boarding application ID. - +**appId:** `number` — Boarding application ID. +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1118,8 +1106,7 @@ await client.boarding.deleteApplication(352);
-Retrieves the details for a boarding application by ID. - +Retrieves the details for a boarding application by ID.
@@ -1135,8 +1122,8 @@ Retrieves the details for a boarding application by ID. ```typescript await client.boarding.getApplication(352); -``` +``` @@ -1151,20 +1138,21 @@ await client.boarding.getApplication(352);
**appId:** `number` — Boarding application ID. - +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1181,8 +1169,7 @@ await client.boarding.getApplication(352);
-Gets a boarding application by authentication information. This endpoint requires an `application` API token. - +Gets a boarding application by authentication information. This endpoint requires an `application` API token.
@@ -1199,10 +1186,10 @@ Gets a boarding application by authentication information. This endpoint require ```typescript await client.boarding.getApplicationByAuth("17E", { email: "admin@email.com", - referenceId: "n6UCd1f1ygG7", + referenceId: "n6UCd1f1ygG7" }); -``` +``` @@ -1216,29 +1203,30 @@ await client.boarding.getApplicationByAuth("17E", {
-**xId:** `string` — The application ID in Hex format. Find this at the end of the boarding link URL returned in a call to api/Boarding/applink/{appId}/{mail2}. For example in: `https://boarding-sandbox.payabli.com/boarding/externalapp/load/17E`, the xId is `17E`. - +**xId:** `string` — The application ID in Hex format. Find this at the end of the boarding link URL returned in a call to api/Boarding/applink/{appId}/{mail2}. For example in: `https://boarding-sandbox.payabli.com/boarding/externalapp/load/17E`, the xId is `17E`. +
-**request:** `Payabli.RequestAppByAuth` - +**request:** `Payabli.RequestAppByAuth` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1255,8 +1243,7 @@ await client.boarding.getApplicationByAuth("17E", {
-Retrieves details for a boarding link, by ID. - +Retrieves details for a boarding link, by ID.
@@ -1272,8 +1259,8 @@ Retrieves details for a boarding link, by ID. ```typescript await client.boarding.getByIdLinkApplication(91); -``` +``` @@ -1288,20 +1275,21 @@ await client.boarding.getByIdLinkApplication(91);
**boardingLinkId:** `number` — The boarding link ID. You can find this at the end of the boarding link reference name. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`. The ID is `91`. - +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1319,7 +1307,6 @@ await client.boarding.getByIdLinkApplication(91);
Get details for a boarding link using the boarding template ID. This endpoint requires an application API token. -
@@ -1335,8 +1322,8 @@ Get details for a boarding link using the boarding template ID. This endpoint re ```typescript await client.boarding.getByTemplateIdLinkApplication(80); -``` +``` @@ -1351,20 +1338,21 @@ await client.boarding.getByTemplateIdLinkApplication(80);
**templateId:** `number` — The boarding template ID. You can find this at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1382,7 +1370,6 @@ await client.boarding.getByTemplateIdLinkApplication(80);
Retrieves a link and the verification code used to log into an existing boarding application. You can also use this endpoint to send a link and referenceId for an existing boarding application to an email address. The recipient can use the referenceId and email address to access and edit the application. -
@@ -1398,8 +1385,8 @@ Retrieves a link and the verification code used to log into an existing boarding ```typescript await client.boarding.getExternalApplication(352, "mail2"); -``` +``` @@ -1413,8 +1400,8 @@ await client.boarding.getExternalApplication(352, "mail2");
-**appId:** `number` — Boarding application ID. - +**appId:** `number` — Boarding application ID. +
@@ -1422,28 +1409,29 @@ await client.boarding.getExternalApplication(352, "mail2");
**mail2:** `string` — Email address used to access the application. If `sendEmail` parameter is true, a link to the application is sent to this email address. - +
-**request:** `Payabli.GetExternalApplicationRequest` - +**request:** `Payabli.GetExternalApplicationRequest` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1461,7 +1449,6 @@ await client.boarding.getExternalApplication(352, "mail2");
Retrieves the details for a boarding link, by reference name. This endpoint requires an application API token. -
@@ -1477,8 +1464,8 @@ Retrieves the details for a boarding link, by reference name. This endpoint requ ```typescript await client.boarding.getLinkApplication("myorgaccountname-00091"); -``` +``` @@ -1493,20 +1480,21 @@ await client.boarding.getLinkApplication("myorgaccountname-00091");
**boardingLinkReference:** `string` — The boarding link reference name. You can find this at the end of the boarding link URL. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091` - +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1524,7 +1512,6 @@ await client.boarding.getLinkApplication("myorgaccountname-00091");
Returns a list of boarding applications for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -1542,10 +1529,10 @@ Returns a list of boarding applications for an organization. Use filters to limi await client.boarding.listApplications(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -1560,28 +1547,29 @@ await client.boarding.listApplications(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListApplicationsRequest` - +**request:** `Payabli.ListApplicationsRequest` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1599,7 +1587,6 @@ await client.boarding.listApplications(123, {
Return a list of boarding links for an organization. Use filters to limit results. -
@@ -1617,10 +1604,10 @@ Return a list of boarding links for an organization. Use filters to limit result await client.boarding.listBoardingLinks(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -1635,28 +1622,29 @@ await client.boarding.listBoardingLinks(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListBoardingLinksRequest` - +**request:** `Payabli.ListBoardingLinksRequest` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ @@ -1674,7 +1662,6 @@ await client.boarding.listBoardingLinks(123, {
Updates a boarding application by ID. This endpoint requires an application API token. -
@@ -1690,8 +1677,8 @@ Updates a boarding application by ID. This endpoint requires an application API ```typescript await client.boarding.updateApplication(352, {}); -``` +``` @@ -1705,36 +1692,36 @@ await client.boarding.updateApplication(352, {});
-**appId:** `number` — Boarding application ID. - +**appId:** `number` — Boarding application ID. +
-**request:** `Payabli.ApplicationData` - +**request:** `Payabli.ApplicationData` +
-**requestOptions:** `Boarding.RequestOptions` - +**requestOptions:** `BoardingClient.RequestOptions` +
+ ## ChargeBacks - -
client.chargeBacks.addResponse(id, { ...params }) -> Payabli.AddResponseResponse +
client.chargeBacks.addResponse(Id, { ...params }) -> Payabli.AddResponseResponse
@@ -1747,7 +1734,6 @@ await client.boarding.updateApplication(352, {});
Add a response to a chargeback or ACH return. -
@@ -1763,10 +1749,10 @@ Add a response to a chargeback or ACH return. ```typescript await client.chargeBacks.addResponse(1000000, { - idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", + idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA" }); -``` +``` @@ -1780,34 +1766,35 @@ await client.chargeBacks.addResponse(1000000, {
-**id:** `number` — ID of the chargeback or return record. - +**Id:** `number` — ID of the chargeback or return record. +
-**request:** `Payabli.ResponseChargeBack` - +**request:** `Payabli.ResponseChargeBack` +
-**requestOptions:** `ChargeBacks.RequestOptions` - +**requestOptions:** `ChargeBacksClient.RequestOptions` +
+
-
client.chargeBacks.getChargeback(id) -> Payabli.ChargebackQueryRecords +
client.chargeBacks.getChargeback(Id) -> Payabli.ChargebackQueryRecords
@@ -1820,7 +1807,6 @@ await client.chargeBacks.addResponse(1000000, {
Retrieves a chargeback record and its details. -
@@ -1836,8 +1822,8 @@ Retrieves a chargeback record and its details. ```typescript await client.chargeBacks.getChargeback(1000000); -``` +``` @@ -1851,26 +1837,27 @@ await client.chargeBacks.getChargeback(1000000);
-**id:** `number` — ID of the chargeback or return record. This is returned as `chargebackId` in the [RecievedChargeback](/developers/developer-guides/webhook-payloads#receivedChargeback) and [ReceivedAchReturn](/developers/developer-guides/webhook-payloads#receivedachreturn) webhook notifications. - +**Id:** `number` — ID of the chargeback or return record. This is returned as `chargebackId` in the [RecievedChargeback](/developers/developer-guides/webhook-payloads#receivedChargeback) and [ReceivedAchReturn](/developers/developer-guides/webhook-payloads#receivedachreturn) webhook notifications. +
-**requestOptions:** `ChargeBacks.RequestOptions` - +**requestOptions:** `ChargeBacksClient.RequestOptions` +
+
-
client.chargeBacks.getChargebackAttachment(id, fileName) -> string +
client.chargeBacks.getChargebackAttachment(Id, fileName) -> string
@@ -1883,7 +1870,6 @@ await client.chargeBacks.getChargeback(1000000);
Retrieves a chargeback attachment file by its file name. -
@@ -1899,8 +1885,8 @@ Retrieves a chargeback attachment file by its file name. ```typescript await client.chargeBacks.getChargebackAttachment(1000000, "fileName"); -``` +``` @@ -1914,8 +1900,8 @@ await client.chargeBacks.getChargebackAttachment(1000000, "fileName");
-**id:** `number` — The ID of chargeback or return record. - +**Id:** `number` — The ID of chargeback or return record. +
@@ -1923,26 +1909,26 @@ await client.chargeBacks.getChargebackAttachment(1000000, "fileName");
**fileName:** `string` — The chargeback attachment's file name. - +
-**requestOptions:** `ChargeBacks.RequestOptions` - +**requestOptions:** `ChargeBacksClient.RequestOptions` +
+
## CheckCapture -
client.checkCapture.checkProcessing({ ...params }) -> Payabli.CheckCaptureResponse
@@ -1956,7 +1942,6 @@ await client.chargeBacks.getChargebackAttachment(1000000, "fileName");
Captures a check for Remote Deposit Capture (RDC) using the provided check images and details. This endpoint handles the OCR extraction of check data including MICR, routing number, account number, and amount. See the [RDC guide](/developers/developer-guides/pay-in-rdc) for more details. -
@@ -1975,10 +1960,10 @@ await client.checkCapture.checkProcessing({ entryPoint: "47abcfea12", frontImage: "/9j/4AAQSkZJRgABAQEASABIAAD...", rearImage: "/9j/4AAQSkZJRgABAQEASABIAAD...", - checkAmount: 12550, + checkAmount: 12550 }); -``` +``` @@ -1992,27 +1977,27 @@ await client.checkCapture.checkProcessing({
-**request:** `Payabli.CheckCaptureRequestBody` - +**request:** `Payabli.CheckCaptureRequestBody` +
-**requestOptions:** `CheckCapture.RequestOptions` - +**requestOptions:** `CheckCaptureClient.RequestOptions` +
+
## Cloud -
client.cloud.addDevice(entry, { ...params }) -> Payabli.AddDeviceResponse
@@ -2026,7 +2011,6 @@ await client.checkCapture.checkProcessing({
Register a cloud device to an entrypoint. See [Devices Quickstart](/developers/developer-guides/devices-quickstart#devices-quickstart) for a complete guide. -
@@ -2043,10 +2027,10 @@ Register a cloud device to an entrypoint. See [Devices Quickstart](/developers/d ```typescript await client.cloud.addDevice("8cfec329267", { registrationCode: "YS7DS5", - description: "Front Desk POS", + description: "Front Desk POS" }); -``` +``` @@ -2061,28 +2045,29 @@ await client.cloud.addDevice("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.DeviceEntry` - +**request:** `Payabli.DeviceEntry` +
-**requestOptions:** `Cloud.RequestOptions` - +**requestOptions:** `CloudClient.RequestOptions` +
+
@@ -2099,8 +2084,7 @@ await client.cloud.addDevice("8cfec329267", {
-Retrieve the registration history for a device. - +Retrieve the registration history for a device.
@@ -2116,8 +2100,8 @@ Retrieve the registration history for a device. ```typescript await client.cloud.historyDevice("8cfec329267", "WXGDWB"); -``` +``` @@ -2132,28 +2116,29 @@ await client.cloud.historyDevice("8cfec329267", "WXGDWB");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**deviceId:** `string` — ID of the cloud device. - +**deviceId:** `string` — ID of the cloud device. +
-**requestOptions:** `Cloud.RequestOptions` - +**requestOptions:** `CloudClient.RequestOptions` +
+
@@ -2171,7 +2156,6 @@ await client.cloud.historyDevice("8cfec329267", "WXGDWB");
Get a list of cloud devices registered to an entrypoint. -
@@ -2187,8 +2171,8 @@ Get a list of cloud devices registered to an entrypoint. ```typescript await client.cloud.listDevice("8cfec329267"); -``` +``` @@ -2203,28 +2187,29 @@ await client.cloud.listDevice("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListDeviceRequest` - +**request:** `Payabli.ListDeviceRequest` +
-**requestOptions:** `Cloud.RequestOptions` - +**requestOptions:** `CloudClient.RequestOptions` +
+
@@ -2242,7 +2227,6 @@ await client.cloud.listDevice("8cfec329267");
Remove a cloud device from an entrypoint. -
@@ -2258,8 +2242,8 @@ Remove a cloud device from an entrypoint. ```typescript await client.cloud.removeDevice("8cfec329267", "6c361c7d-674c-44cc-b790-382b75d1xxx"); -``` +``` @@ -2274,34 +2258,34 @@ await client.cloud.removeDevice("8cfec329267", "6c361c7d-674c-44cc-b790-382b75d1
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**deviceId:** `string` — ID of the cloud device. - +**deviceId:** `string` — ID of the cloud device. +
-**requestOptions:** `Cloud.RequestOptions` - +**requestOptions:** `CloudClient.RequestOptions` +
+
## Customer -
client.customer.addCustomer(entry, { ...params }) -> Payabli.PayabliApiResponseCustomerQuery
@@ -2314,9 +2298,8 @@ await client.cloud.removeDevice("8cfec329267", "6c361c7d-674c-44cc-b790-382b75d1
-Creates a customer in an entrypoint. An identifier is required to create customer records. Change your identifier settings in Settings > Custom Fields in PartnerHub. +Creates a customer in an entrypoint. An identifier is required to create customer records. Change your identifier settings in Settings > Custom Fields in PartnerHub. If you don't include an identifier, the record is rejected. -
@@ -2343,11 +2326,11 @@ await client.customer.addCustomer("8cfec329267", { country: "US", email: "irene@canizalesconcrete.com", identifierFields: ["email"], - timeZone: -5, - }, + timeZone: -5 + } }); -``` +```
@@ -2361,29 +2344,30 @@ await client.customer.addCustomer("8cfec329267", {
-**entry:** `Payabli.Entrypointfield` - +**entry:** `Payabli.Entrypointfield` +
-**request:** `Payabli.AddCustomerRequest` - +**request:** `Payabli.AddCustomerRequest` +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+
@@ -2401,7 +2385,6 @@ await client.customer.addCustomer("8cfec329267", {
Delete a customer record. -
@@ -2417,8 +2400,8 @@ Delete a customer record. ```typescript await client.customer.deleteCustomer(998); -``` +``` @@ -2432,21 +2415,22 @@ await client.customer.deleteCustomer(998);
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+ @@ -2464,7 +2448,6 @@ await client.customer.deleteCustomer(998);
Retrieves a customer's record and details. -
@@ -2480,8 +2463,8 @@ Retrieves a customer's record and details. ```typescript await client.customer.getCustomer(998); -``` +``` @@ -2495,21 +2478,22 @@ await client.customer.getCustomer(998);
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+ @@ -2527,7 +2511,6 @@ await client.customer.getCustomer(998);
Links a customer to a transaction by ID. -
@@ -2543,8 +2526,8 @@ Links a customer to a transaction by ID. ```typescript await client.customer.linkCustomerTransaction(998, "45-as456777hhhhhhhhhh77777777-324"); -``` +``` @@ -2558,8 +2541,8 @@ await client.customer.linkCustomerTransaction(998, "45-as456777hhhhhhhhhh7777777
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
@@ -2567,20 +2550,21 @@ await client.customer.linkCustomerTransaction(998, "45-as456777hhhhhhhhhh7777777
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+ @@ -2598,7 +2582,6 @@ await client.customer.linkCustomerTransaction(998, "45-as456777hhhhhhhhhh7777777
Sends the consent opt-in email to the customer email address in the customer record. -
@@ -2614,8 +2597,8 @@ Sends the consent opt-in email to the customer email address in the customer rec ```typescript await client.customer.requestConsent(998); -``` +``` @@ -2629,21 +2612,22 @@ await client.customer.requestConsent(998);
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+ @@ -2661,7 +2645,6 @@ await client.customer.requestConsent(998);
Update a customer record. Include only the fields you want to change. -
@@ -2683,10 +2666,10 @@ await client.customer.updateCustomer(998, { city: "Mountain City", state: "TN", zip: "37612", - country: "US", + country: "US" }); -``` +``` @@ -2700,35 +2683,35 @@ await client.customer.updateCustomer(998, {
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
-**request:** `Payabli.CustomerData` - +**request:** `Payabli.CustomerData` +
-**requestOptions:** `Customer.RequestOptions` - +**requestOptions:** `CustomerClient.RequestOptions` +
+ ## Export -
client.export.exportApplications(format, orgId, { ...params }) -> Payabli.File_
@@ -2742,7 +2725,6 @@ await client.customer.updateCustomer(998, {
Export a list of boarding applications for an organization. Use filters to limit results. -
@@ -2760,10 +2742,10 @@ Export a list of boarding applications for an organization. Use filters to limit await client.export.exportApplications("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -2777,8 +2759,8 @@ await client.export.exportApplications("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -2786,28 +2768,29 @@ await client.export.exportApplications("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportApplicationsRequest` - +**request:** `Payabli.ExportApplicationsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+
@@ -2825,7 +2808,6 @@ await client.export.exportApplications("csv", 123, {
This endpoint is deprecated. Export batch details for a paypoint. Use filters to limit results. -
@@ -2843,10 +2825,10 @@ This endpoint is deprecated. Export batch details for a paypoint. Use filters to await client.export.exportBatchDetails("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -2860,8 +2842,8 @@ await client.export.exportBatchDetails("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -2869,28 +2851,29 @@ await client.export.exportBatchDetails("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportBatchDetailsRequest` - +**request:** `Payabli.ExportBatchDetailsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -2908,7 +2891,6 @@ await client.export.exportBatchDetails("csv", "8cfec329267", {
This endpoint is deprecated. Export batch details for an organization. Use filters to limit results. -
@@ -2926,10 +2908,10 @@ This endpoint is deprecated. Export batch details for an organization. Use filte await client.export.exportBatchDetailsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -2943,8 +2925,8 @@ await client.export.exportBatchDetailsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -2952,28 +2934,29 @@ await client.export.exportBatchDetailsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportBatchDetailsOrgRequest` - +**request:** `Payabli.ExportBatchDetailsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -2991,7 +2974,6 @@ await client.export.exportBatchDetailsOrg("csv", 123, {
Export a list of batches for an entrypoint. Use filters to limit results. -
@@ -3009,10 +2991,10 @@ Export a list of batches for an entrypoint. Use filters to limit results. await client.export.exportBatches("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3026,8 +3008,8 @@ await client.export.exportBatches("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3035,28 +3017,29 @@ await client.export.exportBatches("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportBatchesRequest` - +**request:** `Payabli.ExportBatchesRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3074,7 +3057,6 @@ await client.export.exportBatches("csv", "8cfec329267", {
Export a list of batches for an organization. Use filters to limit results. -
@@ -3092,10 +3074,10 @@ Export a list of batches for an organization. Use filters to limit results. await client.export.exportBatchesOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3109,8 +3091,8 @@ await client.export.exportBatchesOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3118,28 +3100,29 @@ await client.export.exportBatchesOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportBatchesOrgRequest` - +**request:** `Payabli.ExportBatchesOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3157,7 +3140,6 @@ await client.export.exportBatchesOrg("csv", 123, {
Export a list of money out batches for a paypoint. Use filters to limit results. -
@@ -3175,10 +3157,10 @@ Export a list of money out batches for a paypoint. Use filters to limit results. await client.export.exportBatchesOut("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3192,8 +3174,8 @@ await client.export.exportBatchesOut("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3201,28 +3183,29 @@ await client.export.exportBatchesOut("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportBatchesOutRequest` - +**request:** `Payabli.ExportBatchesOutRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3240,7 +3223,6 @@ await client.export.exportBatchesOut("csv", "8cfec329267", {
Export a list of money out batches for an organization. Use filters to limit results. -
@@ -3258,10 +3240,10 @@ Export a list of money out batches for an organization. Use filters to limit res await client.export.exportBatchesOutOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3275,8 +3257,8 @@ await client.export.exportBatchesOutOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3284,28 +3266,29 @@ await client.export.exportBatchesOutOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportBatchesOutOrgRequest` - +**request:** `Payabli.ExportBatchesOutOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3323,7 +3306,6 @@ await client.export.exportBatchesOutOrg("csv", 123, {
Export a list of bills for an entrypoint. Use filters to limit results. -
@@ -3341,10 +3323,10 @@ Export a list of bills for an entrypoint. Use filters to limit results. await client.export.exportBills("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3358,8 +3340,8 @@ await client.export.exportBills("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3367,28 +3349,29 @@ await client.export.exportBills("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportBillsRequest` - +**request:** `Payabli.ExportBillsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3406,7 +3389,6 @@ await client.export.exportBills("csv", "8cfec329267", {
Export a list of bills for an organization. Use filters to limit results. -
@@ -3424,10 +3406,10 @@ Export a list of bills for an organization. Use filters to limit results. await client.export.exportBillsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3441,8 +3423,8 @@ await client.export.exportBillsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3450,28 +3432,29 @@ await client.export.exportBillsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportBillsOrgRequest` - +**request:** `Payabli.ExportBillsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3489,7 +3472,6 @@ await client.export.exportBillsOrg("csv", 123, {
Export a list of chargebacks and ACH returns for an entrypoint. Use filters to limit results. -
@@ -3507,10 +3489,10 @@ Export a list of chargebacks and ACH returns for an entrypoint. Use filters to l await client.export.exportChargebacks("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3524,8 +3506,8 @@ await client.export.exportChargebacks("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3533,28 +3515,29 @@ await client.export.exportChargebacks("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportChargebacksRequest` - +**request:** `Payabli.ExportChargebacksRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3572,7 +3555,6 @@ await client.export.exportChargebacks("csv", "8cfec329267", {
Export a list of chargebacks and ACH returns for an organization. Use filters to limit results. -
@@ -3590,10 +3572,10 @@ Export a list of chargebacks and ACH returns for an organization. Use filters to await client.export.exportChargebacksOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3607,8 +3589,8 @@ await client.export.exportChargebacksOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3616,28 +3598,29 @@ await client.export.exportChargebacksOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportChargebacksOrgRequest` - +**request:** `Payabli.ExportChargebacksOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3655,7 +3638,6 @@ await client.export.exportChargebacksOrg("csv", 123, {
Export a list of customers for an entrypoint. Use filters to limit results. -
@@ -3673,10 +3655,10 @@ Export a list of customers for an entrypoint. Use filters to limit results. await client.export.exportCustomers("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3690,8 +3672,8 @@ await client.export.exportCustomers("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3699,28 +3681,29 @@ await client.export.exportCustomers("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportCustomersRequest` - +**request:** `Payabli.ExportCustomersRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3738,7 +3721,6 @@ await client.export.exportCustomers("csv", "8cfec329267", {
Exports a list of customers for an organization. Use filters to limit results. -
@@ -3756,10 +3738,10 @@ Exports a list of customers for an organization. Use filters to limit results. await client.export.exportCustomersOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3773,8 +3755,8 @@ await client.export.exportCustomersOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3782,28 +3764,29 @@ await client.export.exportCustomersOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportCustomersOrgRequest` - +**request:** `Payabli.ExportCustomersOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3821,7 +3804,6 @@ await client.export.exportCustomersOrg("csv", 123, {
Export list of invoices for an entrypoint. Use filters to limit results. -
@@ -3839,10 +3821,10 @@ Export list of invoices for an entrypoint. Use filters to limit results. await client.export.exportInvoices("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3856,8 +3838,8 @@ await client.export.exportInvoices("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3865,28 +3847,29 @@ await client.export.exportInvoices("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportInvoicesRequest` - +**request:** `Payabli.ExportInvoicesRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3904,7 +3887,6 @@ await client.export.exportInvoices("csv", "8cfec329267", {
Export a list of invoices for an organization. Use filters to limit results. -
@@ -3922,10 +3904,10 @@ Export a list of invoices for an organization. Use filters to limit results. await client.export.exportInvoicesOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -3939,8 +3921,8 @@ await client.export.exportInvoicesOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -3948,28 +3930,29 @@ await client.export.exportInvoicesOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportInvoicesOrgRequest` - +**request:** `Payabli.ExportInvoicesOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -3987,7 +3970,6 @@ await client.export.exportInvoicesOrg("csv", 123, {
Export a list of child organizations (suborganizations) for a parent organization. -
@@ -4005,10 +3987,10 @@ Export a list of child organizations (suborganizations) for a parent organizatio await client.export.exportOrganizations("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4022,8 +4004,8 @@ await client.export.exportOrganizations("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4031,28 +4013,29 @@ await client.export.exportOrganizations("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportOrganizationsRequest` - +**request:** `Payabli.ExportOrganizationsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4070,7 +4053,6 @@ await client.export.exportOrganizations("csv", 123, {
Export a list of payouts and their statuses for an entrypoint. Use filters to limit results. -
@@ -4088,10 +4070,10 @@ Export a list of payouts and their statuses for an entrypoint. Use filters to li await client.export.exportPayout("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4105,8 +4087,8 @@ await client.export.exportPayout("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4114,28 +4096,29 @@ await client.export.exportPayout("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportPayoutRequest` - +**request:** `Payabli.ExportPayoutRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4153,7 +4136,6 @@ await client.export.exportPayout("csv", "8cfec329267", {
Export a list of payouts and their details for an organization. Use filters to limit results. -
@@ -4171,10 +4153,10 @@ Export a list of payouts and their details for an organization. Use filters to l await client.export.exportPayoutOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4188,8 +4170,8 @@ await client.export.exportPayoutOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4197,28 +4179,29 @@ await client.export.exportPayoutOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportPayoutOrgRequest` - +**request:** `Payabli.ExportPayoutOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4236,7 +4219,6 @@ await client.export.exportPayoutOrg("csv", 123, {
Export a list of paypoints in an organization. Use filters to limit results. -
@@ -4254,10 +4236,10 @@ Export a list of paypoints in an organization. Use filters to limit results. await client.export.exportPaypoints("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4271,8 +4253,8 @@ await client.export.exportPaypoints("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4280,28 +4262,29 @@ await client.export.exportPaypoints("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportPaypointsRequest` - +**request:** `Payabli.ExportPaypointsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4319,7 +4302,6 @@ await client.export.exportPaypoints("csv", 123, {
Export a list of settled transactions for an entrypoint. Use filters to limit results. -
@@ -4337,10 +4319,10 @@ Export a list of settled transactions for an entrypoint. Use filters to limit re await client.export.exportSettlements("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4354,8 +4336,8 @@ await client.export.exportSettlements("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4363,28 +4345,29 @@ await client.export.exportSettlements("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportSettlementsRequest` - +**request:** `Payabli.ExportSettlementsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4402,7 +4385,6 @@ await client.export.exportSettlements("csv", "8cfec329267", {
Export a list of settled transactions for an organization. Use filters to limit results. -
@@ -4420,10 +4402,10 @@ Export a list of settled transactions for an organization. Use filters to limit await client.export.exportSettlementsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4437,8 +4419,8 @@ await client.export.exportSettlementsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4446,28 +4428,29 @@ await client.export.exportSettlementsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportSettlementsOrgRequest` - +**request:** `Payabli.ExportSettlementsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4485,7 +4468,6 @@ await client.export.exportSettlementsOrg("csv", 123, {
Export a list of subscriptions for an entrypoint. Use filters to limit results. -
@@ -4503,10 +4485,10 @@ Export a list of subscriptions for an entrypoint. Use filters to limit results. await client.export.exportSubscriptions("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4520,8 +4502,8 @@ await client.export.exportSubscriptions("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4529,28 +4511,29 @@ await client.export.exportSubscriptions("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportSubscriptionsRequest` - +**request:** `Payabli.ExportSubscriptionsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4568,7 +4551,6 @@ await client.export.exportSubscriptions("csv", "8cfec329267", {
Export a list of subscriptions for an organization. Use filters to limit results. -
@@ -4586,10 +4568,10 @@ Export a list of subscriptions for an organization. Use filters to limit results await client.export.exportSubscriptionsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4603,8 +4585,8 @@ await client.export.exportSubscriptionsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4612,28 +4594,29 @@ await client.export.exportSubscriptionsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportSubscriptionsOrgRequest` - +**request:** `Payabli.ExportSubscriptionsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4651,7 +4634,6 @@ await client.export.exportSubscriptionsOrg("csv", 123, {
Export a list of transactions for an entrypoint in a file in XLXS or CSV format. Use filters to limit results. If you don't specify a date range in the request, the last two months of data are returned. -
@@ -4669,10 +4651,10 @@ Export a list of transactions for an entrypoint in a file in XLXS or CSV format. await client.export.exportTransactions("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4686,8 +4668,8 @@ await client.export.exportTransactions("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4695,28 +4677,29 @@ await client.export.exportTransactions("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportTransactionsRequest` - +**request:** `Payabli.ExportTransactionsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4734,7 +4717,6 @@ await client.export.exportTransactions("csv", "8cfec329267", {
Export a list of transactions for an org in a file in XLSX or CSV format. Use filters to limit results. If you don't specify a date range in the request, the last two months of data are returned. -
@@ -4752,10 +4734,10 @@ Export a list of transactions for an org in a file in XLSX or CSV format. Use fi await client.export.exportTransactionsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -4769,8 +4751,8 @@ await client.export.exportTransactionsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4778,28 +4760,29 @@ await client.export.exportTransactionsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportTransactionsOrgRequest` - +**request:** `Payabli.ExportTransactionsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4817,7 +4800,6 @@ await client.export.exportTransactionsOrg("csv", 123, {
Export a list of transfer details for an entrypoint. Use filters to limit results. -
@@ -4836,10 +4818,10 @@ await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -4853,8 +4835,8 @@ await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -4862,7 +4844,7 @@ await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
@@ -4870,28 +4852,29 @@ await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, {
**transferId:** `number` — Transfer identifier. - +
-**request:** `Payabli.ExportTransferDetailsRequest` - +**request:** `Payabli.ExportTransferDetailsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4909,7 +4892,6 @@ await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, {
Get a list of transfers for an entrypoint. Use filters to limit results. -
@@ -4928,10 +4910,10 @@ await client.export.exportTransfers("8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -4946,28 +4928,29 @@ await client.export.exportTransfers("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportTransfersRequest` - +**request:** `Payabli.ExportTransfersRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -4985,7 +4968,6 @@ await client.export.exportTransfers("8cfec329267", {
Export a list of vendors for an entrypoint. Use filters to limit results. -
@@ -5003,10 +4985,10 @@ Export a list of vendors for an entrypoint. Use filters to limit results. await client.export.exportVendors("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -5020,8 +5002,8 @@ await client.export.exportVendors("csv", "8cfec329267", {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -5029,28 +5011,29 @@ await client.export.exportVendors("csv", "8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ExportVendorsRequest` - +**request:** `Payabli.ExportVendorsRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ @@ -5068,7 +5051,6 @@ await client.export.exportVendors("csv", "8cfec329267", {
Export a list of vendors for an organization. Use filters to limit results. -
@@ -5086,10 +5068,10 @@ Export a list of vendors for an organization. Use filters to limit results. await client.export.exportVendorsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, - limitRecord: 1000, + limitRecord: 1000 }); -``` +``` @@ -5103,8 +5085,8 @@ await client.export.exportVendorsOrg("csv", 123, {
-**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. - +**format:** `Payabli.ExportFormat1` — Format for the export, either XLSX or CSV. +
@@ -5112,34 +5094,34 @@ await client.export.exportVendorsOrg("csv", 123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ExportVendorsOrgRequest` - +**request:** `Payabli.ExportVendorsOrgRequest` +
-**requestOptions:** `Export.RequestOptions` - +**requestOptions:** `ExportClient.RequestOptions` +
+ ## HostedPaymentPages -
client.hostedPaymentPages.loadPage(entry, subdomain) -> Payabli.PayabliPages
@@ -5153,7 +5135,6 @@ await client.export.exportVendorsOrg("csv", 123, {
Loads all of a payment page's details including `pageIdentifier` and `validationCode`. This endpoint requires an `application` API token. -
@@ -5169,8 +5150,8 @@ Loads all of a payment page's details including `pageIdentifier` and `validation ```typescript await client.hostedPaymentPages.loadPage("8cfec329267", "pay-your-fees-1"); -``` +``` @@ -5185,7 +5166,7 @@ await client.hostedPaymentPages.loadPage("8cfec329267", "pay-your-fees-1");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
@@ -5193,20 +5174,21 @@ await client.hostedPaymentPages.loadPage("8cfec329267", "pay-your-fees-1");
**subdomain:** `string` — Payment page identifier. The subdomain value is the last part of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - +
-**requestOptions:** `HostedPaymentPages.RequestOptions` - +**requestOptions:** `HostedPaymentPagesClient.RequestOptions` +
+
@@ -5223,9 +5205,9 @@ await client.hostedPaymentPages.loadPage("8cfec329267", "pay-your-fees-1");
-Creates a new payment page for a paypoint. -Note: this operation doesn't create a new paypoint, just a payment page for an existing paypoint. Paypoints are created by the Payabli team when a boarding application is approved. +Creates a new payment page for a paypoint. +Note: this operation doesn't create a new paypoint, just a payment page for an existing paypoint. Paypoints are created by the Payabli team when a boarding application is approved.
@@ -5242,10 +5224,10 @@ Note: this operation doesn't create a new paypoint, just a payment page for an e ```typescript await client.hostedPaymentPages.newPage("8cfec329267", { idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", - body: {}, + body: {} }); -``` +``` @@ -5260,28 +5242,29 @@ await client.hostedPaymentPages.newPage("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.NewPageRequest` - +**request:** `Payabli.NewPageRequest` +
-**requestOptions:** `HostedPaymentPages.RequestOptions` - +**requestOptions:** `HostedPaymentPagesClient.RequestOptions` +
+ @@ -5299,7 +5282,6 @@ await client.hostedPaymentPages.newPage("8cfec329267", {
Updates a payment page in a paypoint. -
@@ -5315,8 +5297,8 @@ Updates a payment page in a paypoint. ```typescript await client.hostedPaymentPages.savePage("8cfec329267", "pay-your-fees-1", {}); -``` +``` @@ -5331,7 +5313,7 @@ await client.hostedPaymentPages.savePage("8cfec329267", "pay-your-fees-1", {});
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
@@ -5339,34 +5321,34 @@ await client.hostedPaymentPages.savePage("8cfec329267", "pay-your-fees-1", {});
**subdomain:** `string` — Payment page identifier. The subdomain value is the last part of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - +
-**request:** `Payabli.PayabliPages` - +**request:** `Payabli.PayabliPages` +
-**requestOptions:** `HostedPaymentPages.RequestOptions` - +**requestOptions:** `HostedPaymentPagesClient.RequestOptions` +
+ ## Import -
client.import.importBills(entry, { ...params }) -> Payabli.PayabliApiResponseImport
@@ -5380,7 +5362,6 @@ await client.hostedPaymentPages.savePage("8cfec329267", "pay-your-fees-1", {});
Import a list of bills from a CSV file. See the [Import Guide](/developers/developer-guides/bills-add#import-bills) for more help and an example file. -
@@ -5396,10 +5377,10 @@ Import a list of bills from a CSV file. See the [Import Guide](/developers/devel ```typescript await client.import.importBills("8cfec329267", { - file: fs.createReadStream("/path/to/your/file"), + file: fs.createReadStream("/path/to/your/file") }); -``` +``` @@ -5413,29 +5394,30 @@ await client.import.importBills("8cfec329267", {
-**entry:** `string` - +**entry:** `string` +
-**request:** `Payabli.ImportBillsRequest` - +**request:** `Payabli.ImportBillsRequest` +
-**requestOptions:** `Import.RequestOptions` - +**requestOptions:** `ImportClient.RequestOptions` +
+
@@ -5453,7 +5435,6 @@ await client.import.importBills("8cfec329267", {
Import a list of customers from a CSV file. See the [Import Guide](/developers/developer-guides/entities-customers#import-customers) for more help and example files. -
@@ -5469,10 +5450,10 @@ Import a list of customers from a CSV file. See the [Import Guide](/developers/d ```typescript await client.import.importCustomer("8cfec329267", { - file: fs.createReadStream("/path/to/your/file"), + file: fs.createReadStream("/path/to/your/file") }); -``` +``` @@ -5486,29 +5467,30 @@ await client.import.importCustomer("8cfec329267", {
-**entry:** `Payabli.Entrypointfield` - +**entry:** `Payabli.Entrypointfield` +
-**request:** `Payabli.ImportCustomerRequest` - +**request:** `Payabli.ImportCustomerRequest` +
-**requestOptions:** `Import.RequestOptions` - +**requestOptions:** `ImportClient.RequestOptions` +
+ @@ -5526,7 +5508,6 @@ await client.import.importCustomer("8cfec329267", {
Import a list of vendors from a CSV file. See the [Import Guide](/developers/developer-guides/entities-vendors#import-vendors) for more help and example files. -
@@ -5542,10 +5523,10 @@ Import a list of vendors from a CSV file. See the [Import Guide](/developers/dev ```typescript await client.import.importVendor("8cfec329267", { - file: fs.createReadStream("/path/to/your/file"), + file: fs.createReadStream("/path/to/your/file") }); -``` +``` @@ -5559,35 +5540,35 @@ await client.import.importVendor("8cfec329267", {
-**entry:** `Payabli.Entrypointfield` - +**entry:** `Payabli.Entrypointfield` +
-**request:** `Payabli.ImportVendorRequest` - +**request:** `Payabli.ImportVendorRequest` +
-**requestOptions:** `Import.RequestOptions` - +**requestOptions:** `ImportClient.RequestOptions` +
+ ## Invoice -
client.invoice.addInvoice(entry, { ...params }) -> Payabli.InvoiceResponseWithoutData
@@ -5601,7 +5582,6 @@ await client.import.importVendor("8cfec329267", {
Creates an invoice in an entrypoint. -
@@ -5621,36 +5601,33 @@ await client.invoice.addInvoice("8cfec329267", { customerData: { firstName: "Tamara", lastName: "Bagratoni", - customerNumber: "3", + customerNumber: "3" }, invoiceData: { - items: [ - { + items: [{ itemProductName: "Adventure Consult", itemDescription: "Consultation for Georgian tours", itemCost: 100, itemQty: 1, - itemMode: 1, - }, - { + itemMode: 1 + }, { itemProductName: "Deposit ", itemDescription: "Deposit for trip planning", itemCost: 882.37, - itemQty: 1, - }, - ], + itemQty: 1 + }], invoiceDate: "2025-10-19", invoiceType: 0, invoiceStatus: 1, frequency: "one-time", invoiceAmount: 982.37, discount: 10, - invoiceNumber: "INV-3", - }, - }, + invoiceNumber: "INV-3" + } + } }); -``` +``` @@ -5665,28 +5642,29 @@ await client.invoice.addInvoice("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.AddInvoiceRequest` - +**request:** `Payabli.AddInvoiceRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+
@@ -5704,7 +5682,6 @@ await client.invoice.addInvoice("8cfec329267", {
Deletes an invoice that's attached to a file. -
@@ -5720,8 +5697,8 @@ Deletes an invoice that's attached to a file. ```typescript await client.invoice.deleteAttachedFromInvoice(23548884, "0_Bill.pdf"); -``` +``` @@ -5736,40 +5713,41 @@ await client.invoice.deleteAttachedFromInvoice(23548884, "0_Bill.pdf");
**idInvoice:** `number` — Invoice ID - +
-**filename:** `string` +**filename:** `string` -The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. +The filename in Payabli. Filename is `zipName` in response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. "DocumentsRef": { -"zipfile": "inva_269.zip", -"filelist": [ -{ -"originalName": "Bill.pdf", -"zipName": "0_Bill.pdf", -"descriptor": null -} -] + "zipfile": "inva_269.zip", + "filelist": [ + { + "originalName": "Bill.pdf", + "zipName": "0_Bill.pdf", + "descriptor": null + } + ] } - +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -5787,7 +5765,6 @@ The filename in Payabli. Filename is `zipName` in response to a request to `/api
Deletes a single invoice from an entrypoint. -
@@ -5803,8 +5780,8 @@ Deletes a single invoice from an entrypoint. ```typescript await client.invoice.deleteInvoice(23548884); -``` +``` @@ -5819,20 +5796,21 @@ await client.invoice.deleteInvoice(23548884);
**idInvoice:** `number` — Invoice ID - +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -5850,7 +5828,6 @@ await client.invoice.deleteInvoice(23548884);
Updates details for a single invoice in an entrypoint. -
@@ -5868,22 +5845,20 @@ Updates details for a single invoice in an entrypoint. await client.invoice.editInvoice(332, { body: { invoiceData: { - items: [ - { + items: [{ itemProductName: "Deposit", itemDescription: "Deposit for trip planning", itemCost: 882.37, - itemQty: 1, - }, - ], + itemQty: 1 + }], invoiceDate: "2025-10-19", invoiceAmount: 982.37, - invoiceNumber: "INV-6", - }, - }, + invoiceNumber: "INV-6" + } + } }); -``` +``` @@ -5898,28 +5873,29 @@ await client.invoice.editInvoice(332, {
**idInvoice:** `number` — Invoice ID - +
-**request:** `Payabli.EditInvoiceRequest` - +**request:** `Payabli.EditInvoiceRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -5937,7 +5913,6 @@ await client.invoice.editInvoice(332, {
Retrieves a file attached to an invoice. -
@@ -5953,8 +5928,8 @@ Retrieves a file attached to an invoice. ```typescript await client.invoice.getAttachedFileFromInvoice(1, "filename"); -``` +``` @@ -5969,17 +5944,16 @@ await client.invoice.getAttachedFileFromInvoice(1, "filename");
**idInvoice:** `number` — Invoice ID - +
-**filename:** `string` - -The filename in Payabli. Filename is `zipName` in the response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. +**filename:** `string` +The filename in Payabli. Filename is `zipName` in the response to a request to `/api/Invoice/{idInvoice}`. Here, the filename is `0_Bill.pdf``. ``` "DocumentsRef": { "zipfile": "inva_269.zip", @@ -5991,29 +5965,30 @@ The filename in Payabli. Filename is `zipName` in the response to a request to ` } ] } -``` - + ``` +
-**request:** `Payabli.GetAttachedFileFromInvoiceRequest` - +**request:** `Payabli.GetAttachedFileFromInvoiceRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6031,7 +6006,6 @@ The filename in Payabli. Filename is `zipName` in the response to a request to `
Retrieves a single invoice by ID. -
@@ -6047,8 +6021,8 @@ Retrieves a single invoice by ID. ```typescript await client.invoice.getInvoice(23548884); -``` +``` @@ -6063,20 +6037,21 @@ await client.invoice.getInvoice(23548884);
**idInvoice:** `number` — Invoice ID - +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6094,7 +6069,6 @@ await client.invoice.getInvoice(23548884);
Retrieves the next available invoice number for a paypoint. -
@@ -6110,8 +6084,8 @@ Retrieves the next available invoice number for a paypoint. ```typescript await client.invoice.getInvoiceNumber("8cfec329267"); -``` +``` @@ -6126,20 +6100,21 @@ await client.invoice.getInvoiceNumber("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6157,7 +6132,6 @@ await client.invoice.getInvoiceNumber("8cfec329267");
Returns a list of invoices for an entrypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -6175,10 +6149,10 @@ Returns a list of invoices for an entrypoint. Use filters to limit results. Incl await client.invoice.listInvoices("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -6193,28 +6167,29 @@ await client.invoice.listInvoices("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListInvoicesRequest` - +**request:** `Payabli.ListInvoicesRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6232,7 +6207,6 @@ await client.invoice.listInvoices("8cfec329267", {
Returns a list of invoices for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -6250,10 +6224,10 @@ Returns a list of invoices for an org. Use filters to limit results. Include the await client.invoice.listInvoicesOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -6268,28 +6242,29 @@ await client.invoice.listInvoicesOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListInvoicesOrgRequest` - +**request:** `Payabli.ListInvoicesOrgRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6307,7 +6282,6 @@ await client.invoice.listInvoicesOrg(123, {
Sends an invoice from an entrypoint via email. -
@@ -6324,10 +6298,10 @@ Sends an invoice from an entrypoint via email. ```typescript await client.invoice.sendInvoice(23548884, { attachfile: true, - mail2: "tamara@example.com", + mail2: "tamara@example.com" }); -``` +``` @@ -6342,28 +6316,29 @@ await client.invoice.sendInvoice(23548884, {
**idInvoice:** `number` — Invoice ID - +
-**request:** `Payabli.SendInvoiceRequest` - +**request:** `Payabli.SendInvoiceRequest` +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ @@ -6381,7 +6356,6 @@ await client.invoice.sendInvoice(23548884, {
Export a single invoice in PDF format. -
@@ -6397,8 +6371,8 @@ Export a single invoice in PDF format. ```typescript await client.invoice.getInvoicePdf(23548884); -``` +``` @@ -6413,26 +6387,26 @@ await client.invoice.getInvoicePdf(23548884);
**idInvoice:** `number` — Invoice ID - +
-**requestOptions:** `Invoice.RequestOptions` - +**requestOptions:** `InvoiceClient.RequestOptions` +
+ ## LineItem -
client.lineItem.addItem(entry, { ...params }) -> Payabli.PayabliApiResponse6
@@ -6446,7 +6420,6 @@ await client.invoice.getInvoicePdf(23548884);
Adds products and services to an entrypoint's catalog. These are used as line items for invoicing and transactions. In the response, "responseData" displays the item's code. -
@@ -6470,11 +6443,11 @@ await client.lineItem.addItem("47cae3d74", { itemUnitOfMeasure: "SqFt", itemCost: 12.45, itemQty: 1, - itemMode: 0, - }, + itemMode: 0 + } }); -``` +``` @@ -6489,28 +6462,29 @@ await client.lineItem.addItem("47cae3d74", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.AddItemRequest` - +**request:** `Payabli.AddItemRequest` +
-**requestOptions:** `LineItem.RequestOptions` - +**requestOptions:** `LineItemClient.RequestOptions` +
+
@@ -6528,7 +6502,6 @@ await client.lineItem.addItem("47cae3d74", {
Deletes an item. -
@@ -6544,8 +6517,8 @@ Deletes an item. ```typescript await client.lineItem.deleteItem(700); -``` +``` @@ -6560,20 +6533,21 @@ await client.lineItem.deleteItem(700);
**lineItemId:** `number` — ID for the line item (also known as a product, service, or item). - +
-**requestOptions:** `LineItem.RequestOptions` - +**requestOptions:** `LineItemClient.RequestOptions` +
+ @@ -6590,8 +6564,7 @@ await client.lineItem.deleteItem(700);
-Gets an item by ID. - +Gets an item by ID.
@@ -6607,8 +6580,8 @@ Gets an item by ID. ```typescript await client.lineItem.getItem(700); -``` +``` @@ -6623,20 +6596,21 @@ await client.lineItem.getItem(700);
**lineItemId:** `number` — ID for the line item (also known as a product, service, or item). - +
-**requestOptions:** `LineItem.RequestOptions` - +**requestOptions:** `LineItemClient.RequestOptions` +
+ @@ -6654,7 +6628,6 @@ await client.lineItem.getItem(700);
Retrieves a list of line items and their details from an entrypoint. Line items are also known as items, products, and services. Use filters to limit results. -
@@ -6672,10 +6645,10 @@ Retrieves a list of line items and their details from an entrypoint. Line items await client.lineItem.listLineItems("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -6690,28 +6663,29 @@ await client.lineItem.listLineItems("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListLineItemsRequest` - +**request:** `Payabli.ListLineItemsRequest` +
-**requestOptions:** `LineItem.RequestOptions` - +**requestOptions:** `LineItemClient.RequestOptions` +
+ @@ -6729,7 +6703,6 @@ await client.lineItem.listLineItems("8cfec329267", {
Updates an item. -
@@ -6746,10 +6719,10 @@ Updates an item. ```typescript await client.lineItem.updateItem(700, { itemCost: 12.45, - itemQty: 1, + itemQty: 1 }); -``` +``` @@ -6764,34 +6737,34 @@ await client.lineItem.updateItem(700, {
**lineItemId:** `number` — ID for the line item (also known as a product, service, or item). - +
-**request:** `Payabli.LineItem` - +**request:** `Payabli.LineItem` +
-**requestOptions:** `LineItem.RequestOptions` - +**requestOptions:** `LineItemClient.RequestOptions` +
+ ## MoneyIn -
client.moneyIn.authorize({ ...params }) -> Payabli.AuthResponse
@@ -6807,7 +6780,6 @@ await client.lineItem.updateItem(700, { Authorize a card transaction. This returns an authorization code and reserves funds for the merchant. Authorized transactions aren't flagged for settlement until [captured](/api-reference/moneyin/capture-an-authorized-transaction). **Note**: Only card transactions can be authorized. This endpoint can't be used for ACH transactions. -
@@ -6825,13 +6797,13 @@ Authorize a card transaction. This returns an authorization code and reserves fu await client.moneyIn.authorize({ body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", ipaddress: "255.255.255.255", paymentDetails: { serviceFee: 0, - totalAmount: 100, + totalAmount: 100 }, paymentMethod: { cardcvv: "999", @@ -6840,12 +6812,12 @@ await client.moneyIn.authorize({ cardnumber: "4111111111111111", cardzip: "12345", initiator: "payor", - method: "card", - }, - }, + method: "card" + } + } }); -``` +``` @@ -6859,21 +6831,22 @@ await client.moneyIn.authorize({
-**request:** `Payabli.RequestPaymentAuthorize` - +**request:** `Payabli.RequestPaymentAuthorize` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+
@@ -6911,8 +6884,8 @@ transaction](/api-reference/moneyin/authorize-a-transaction) to complete the tra ```typescript await client.moneyIn.capture("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", 0); -``` +``` @@ -6927,7 +6900,7 @@ await client.moneyIn.capture("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", 0);
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
@@ -6935,20 +6908,21 @@ await client.moneyIn.capture("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", 0);
**amount:** `number` — Amount to be captured. The amount can't be greater the original total amount of the transaction. `0` captures the total amount authorized in the transaction. Partial captures aren't supported. - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -6965,10 +6939,9 @@ await client.moneyIn.capture("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", 0);
-Capture an [authorized transaction](/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the customer to merchant account. +Capture an [authorized transaction](/api-reference/moneyin/authorize-a-transaction) to complete the transaction and move funds from the customer to merchant account. You can use this endpoint to capture both full and partial amounts of the original authorized transaction. See [Capture an authorized transaction](/developers/developer-guides/pay-in-auth-and-capture) for more information about this endpoint. -
@@ -6986,11 +6959,11 @@ You can use this endpoint to capture both full and partial amounts of the origin await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", { paymentDetails: { totalAmount: 105, - serviceFee: 5, - }, + serviceFee: 5 + } }); -``` +``` @@ -7005,28 +6978,29 @@ await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", {
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**request:** `Payabli.CaptureRequest` - +**request:** `Payabli.CaptureRequest` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7045,8 +7019,7 @@ await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", { Make a temporary microdeposit in a customer account to verify the customer's ownership and access to the target account. Reverse the microdeposit with `reverseCredit`. -This feature must be enabled by Payabli on a per-merchant basis. Contact support for help. - +This feature must be enabled by Payabli on a per-merchant basis. Contact support for help. @@ -7065,23 +7038,23 @@ await client.moneyIn.credit({ idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", customerData: { billingAddress1: "5127 Linkwood ave", - customerNumber: "100", + customerNumber: "100" }, entrypoint: "my-entrypoint", paymentDetails: { serviceFee: 0, - totalAmount: 1, + totalAmount: 1 }, paymentMethod: { achAccount: "88354454", achAccountType: "Checking", achHolder: "John Smith", achRouting: "021000021", - method: "ach", - }, + method: "ach" + } }); -``` +``` @@ -7095,21 +7068,22 @@ await client.moneyIn.credit({
-**request:** `Payabli.RequestCredit` - +**request:** `Payabli.RequestCredit` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7127,7 +7101,6 @@ await client.moneyIn.credit({
Retrieve a processed transaction's details. -
@@ -7143,8 +7116,8 @@ Retrieve a processed transaction's details. ```typescript await client.moneyIn.details("45-as456777hhhhhhhhhh77777777-324"); -``` +``` @@ -7159,20 +7132,21 @@ await client.moneyIn.details("45-as456777hhhhhhhhhh77777777-324");
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7190,7 +7164,6 @@ await client.moneyIn.details("45-as456777hhhhhhhhhh77777777-324");
Make a single transaction. This method authorizes and captures a payment in one step. -
@@ -7208,13 +7181,13 @@ Make a single transaction. This method authorizes and captures a payment in one await client.moneyIn.getpaid({ body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", ipaddress: "255.255.255.255", paymentDetails: { serviceFee: 0, - totalAmount: 100, + totalAmount: 100 }, paymentMethod: { cardcvv: "999", @@ -7223,12 +7196,12 @@ await client.moneyIn.getpaid({ cardnumber: "4111111111111111", cardzip: "12345", initiator: "payor", - method: "card", - }, - }, + method: "card" + } + } }); -``` +``` @@ -7242,21 +7215,22 @@ await client.moneyIn.getpaid({
-**request:** `Payabli.RequestPayment` - +**request:** `Payabli.RequestPayment` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7274,7 +7248,6 @@ await client.moneyIn.getpaid({
A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not. -
@@ -7290,8 +7263,8 @@ A reversal either refunds or voids a transaction independent of the transaction' ```typescript await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0); -``` +``` @@ -7306,34 +7279,36 @@ await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0);
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**amount:** `number` +**amount:** `number` + Amount to reverse from original transaction, minus any service fees charged on the original transaction. -The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90. +The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90. An amount equal to zero will refunds the total amount authorized minus any service fee. - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7351,7 +7326,6 @@ An amount equal to zero will refunds the total amount authorized minus any servi
Refund a transaction that has settled and send money back to the account holder. If a transaction hasn't been settled, void it instead. -
@@ -7367,8 +7341,8 @@ Refund a transaction that has settled and send money back to the account holder. ```typescript await client.moneyIn.refund("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0); -``` +``` @@ -7383,34 +7357,36 @@ await client.moneyIn.refund("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0);
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**amount:** `number` +**amount:** `number` -Amount to refund from original transaction, minus any service fees charged on the original transaction. + +Amount to refund from original transaction, minus any service fees charged on the original transaction. The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was \$90 plus a \$10 service fee, you can refund up to \$90. An amount equal to zero will refund the total amount authorized minus any service fee. - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7428,7 +7404,6 @@ An amount equal to zero will refund the total amount authorized minus any servic
Refunds a settled transaction with split instructions. -
@@ -7449,24 +7424,21 @@ await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7 orderDescription: "Materials deposit", amount: 100, refundDetails: { - splitRefunding: [ - { + splitRefunding: [{ originationEntryPoint: "7f1a381696", accountId: "187-342", description: "Refunding undelivered materials", - amount: 60, - }, - { + amount: 60 + }, { originationEntryPoint: "7f1a381696", accountId: "187-343", description: "Refunding deposit for undelivered materials", - amount: 40, - }, - ], - }, + amount: 40 + }] + } }); -``` +``` @@ -7481,28 +7453,29 @@ await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**request:** `Payabli.RequestRefund` - +**request:** `Payabli.RequestRefund` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7520,7 +7493,6 @@ await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7
Reverse microdeposits that are used to verify customer account ownership and access. The `transId` value is returned in the success response for the original credit transaction made with `api/MoneyIn/makecredit`. -
@@ -7536,8 +7508,8 @@ Reverse microdeposits that are used to verify customer account ownership and acc ```typescript await client.moneyIn.reverseCredit("45-as456777hhhhhhhhhh77777777-324"); -``` +``` @@ -7552,20 +7524,21 @@ await client.moneyIn.reverseCredit("45-as456777hhhhhhhhhh77777777-324");
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7583,7 +7556,6 @@ await client.moneyIn.reverseCredit("45-as456777hhhhhhhhhh77777777-324");
Send a payment receipt for a transaction. -
@@ -7599,10 +7571,10 @@ Send a payment receipt for a transaction. ```typescript await client.moneyIn.sendReceipt2Trans("45-as456777hhhhhhhhhh77777777-324", { - email: "example@email.com", + email: "example@email.com" }); -``` +``` @@ -7617,28 +7589,29 @@ await client.moneyIn.sendReceipt2Trans("45-as456777hhhhhhhhhh77777777-324", {
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**request:** `Payabli.SendReceipt2TransRequest` - +**request:** `Payabli.SendReceipt2TransRequest` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7656,7 +7629,6 @@ await client.moneyIn.sendReceipt2Trans("45-as456777hhhhhhhhhh77777777-324", {
Validates a card number without running a transaction or authorizing a charge. -
@@ -7679,11 +7651,11 @@ await client.moneyIn.validate({ cardnumber: "4360000001000005", cardexp: "12/29", cardzip: "14602-8328", - cardHolder: "Dianne Becker-Smith", - }, + cardHolder: "Dianne Becker-Smith" + } }); -``` +``` @@ -7697,21 +7669,22 @@ await client.moneyIn.validate({
-**request:** `Payabli.RequestPaymentValidate` - +**request:** `Payabli.RequestPaymentValidate` +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ @@ -7729,7 +7702,6 @@ await client.moneyIn.validate({
Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures. If a transaction has been settled, refund it instead. -
@@ -7745,8 +7717,8 @@ Cancel a transaction that hasn't been settled yet. Voiding non-captured authoriz ```typescript await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723"); -``` +``` @@ -7761,26 +7733,26 @@ await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**requestOptions:** `MoneyIn.RequestOptions` - +**requestOptions:** `MoneyInClient.RequestOptions` +
+ ## MoneyOut -
client.moneyOut.authorizeOut({ ...params }) -> Payabli.AuthCapturePayoutResponse
@@ -7793,8 +7765,7 @@ await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
-Authorizes transaction for payout. Authorized transactions aren't flagged for settlement until captured. Use `referenceId` returned in the response to capture the transaction. - +Authorizes transaction for payout. Authorized transactions aren't flagged for settlement until captured. Use `referenceId` returned in the response to capture the transaction.
@@ -7812,26 +7783,24 @@ Authorizes transaction for payout. Authorized transactions aren't flagged for se await client.moneyOut.authorizeOut({ body: { entryPoint: "48acde49", - invoiceData: [ - { - billId: 54323, - }, - ], + invoiceData: [{ + billId: 54323 + }], orderDescription: "Window Painting", paymentDetails: { totalAmount: 47, - unbundled: false, + unbundled: false }, paymentMethod: { - method: "managed", + method: "managed" }, vendorData: { - vendorNumber: "7895433", - }, - }, + vendorNumber: "7895433" + } + } }); -``` +```
@@ -7845,21 +7814,22 @@ await client.moneyOut.authorizeOut({
-**request:** `Payabli.MoneyOutTypesRequestOutAuthorize` - +**request:** `Payabli.MoneyOutTypesRequestOutAuthorize` +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+
@@ -7877,7 +7847,6 @@ await client.moneyOut.authorizeOut({
Cancels an array of payout transactions. -
@@ -7893,8 +7862,8 @@ Cancels an array of payout transactions. ```typescript await client.moneyOut.cancelAllOut(["2-29", "2-28", "2-27"]); -``` +``` @@ -7908,21 +7877,22 @@ await client.moneyOut.cancelAllOut(["2-29", "2-28", "2-27"]);
-**request:** `string[]` - +**request:** `string[]` +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -7940,7 +7910,6 @@ await client.moneyOut.cancelAllOut(["2-29", "2-28", "2-27"]);
Cancel a payout transaction by ID. -
@@ -7956,8 +7925,8 @@ Cancel a payout transaction by ID. ```typescript await client.moneyOut.cancelOutGet("129-219"); -``` +``` @@ -7971,21 +7940,22 @@ await client.moneyOut.cancelOutGet("129-219");
-**referenceId:** `string` — The ID for the payout transaction. - +**referenceId:** `string` — The ID for the payout transaction. +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8003,7 +7973,6 @@ await client.moneyOut.cancelOutGet("129-219");
Cancel a payout transaction by ID. -
@@ -8019,8 +7988,8 @@ Cancel a payout transaction by ID. ```typescript await client.moneyOut.cancelOutDelete("129-219"); -``` +``` @@ -8034,21 +8003,22 @@ await client.moneyOut.cancelOutDelete("129-219");
-**referenceId:** `string` — The ID for the payout transaction. - +**referenceId:** `string` — The ID for the payout transaction. +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8066,7 +8036,6 @@ await client.moneyOut.cancelOutDelete("129-219");
Captures an array of authorized payout transactions for settlement. The maximum number of transactions that can be captured in a single request is 500. -
@@ -8082,10 +8051,10 @@ Captures an array of authorized payout transactions for settlement. The maximum ```typescript await client.moneyOut.captureAllOut({ - body: ["2-29", "2-28", "2-27"], + body: ["2-29", "2-28", "2-27"] }); -``` +``` @@ -8099,21 +8068,22 @@ await client.moneyOut.captureAllOut({
-**request:** `Payabli.CaptureAllOutRequest` - +**request:** `Payabli.CaptureAllOutRequest` +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8131,7 +8101,6 @@ await client.moneyOut.captureAllOut({
Captures a single authorized payout transaction by ID. -
@@ -8147,8 +8116,8 @@ Captures a single authorized payout transaction by ID. ```typescript await client.moneyOut.captureOut("129-219"); -``` +``` @@ -8162,29 +8131,30 @@ await client.moneyOut.captureOut("129-219");
-**referenceId:** `string` — The ID for the payout transaction. - +**referenceId:** `string` — The ID for the payout transaction. +
-**request:** `Payabli.CaptureOutRequest` - +**request:** `Payabli.CaptureOutRequest` +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8202,7 +8172,6 @@ await client.moneyOut.captureOut("129-219");
Returns details for a processed money out transaction. -
@@ -8218,8 +8187,8 @@ Returns details for a processed money out transaction. ```typescript await client.moneyOut.payoutDetails("45-as456777hhhhhhhhhh77777777-324"); -``` +``` @@ -8234,20 +8203,21 @@ await client.moneyOut.payoutDetails("45-as456777hhhhhhhhhh77777777-324");
**transId:** `string` — ReferenceId for the transaction (PaymentId). - +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8265,7 +8235,6 @@ await client.moneyOut.payoutDetails("45-as456777hhhhhhhhhh77777777-324");
Retrieves vCard details for a single card in an entrypoint. -
@@ -8281,8 +8250,8 @@ Retrieves vCard details for a single card in an entrypoint. ```typescript await client.moneyOut.vCardGet("20230403315245421165"); -``` +``` @@ -8297,20 +8266,21 @@ await client.moneyOut.vCardGet("20230403315245421165");
**cardToken:** `string` — ID for a virtual card. - +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8328,7 +8298,6 @@ await client.moneyOut.vCardGet("20230403315245421165");
Sends a virtual card link via email to the vendor associated with the `transId`. -
@@ -8344,10 +8313,10 @@ Sends a virtual card link via email to the vendor associated with the `transId`. ```typescript await client.moneyOut.sendVCardLink({ - transId: "01K33Z6YQZ6GD5QVKZ856MJBSC", + transId: "01K33Z6YQZ6GD5QVKZ856MJBSC" }); -``` +``` @@ -8361,21 +8330,22 @@ await client.moneyOut.sendVCardLink({
-**request:** `Payabli.SendVCardLinkRequest` - +**request:** `Payabli.SendVCardLinkRequest` +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ @@ -8392,10 +8362,9 @@ await client.moneyOut.sendVCardLink({
-Retrieve the image of a check associated with a processed transaction. -The check image is returned in the response body as a base64-encoded string. +Retrieve the image of a check associated with a processed transaction. +The check image is returned in the response body as a base64-encoded string. The check image is only available for payouts that have been processed. -
@@ -8411,8 +8380,8 @@ The check image is only available for payouts that have been processed. ```typescript await client.moneyOut.getCheckImage("check133832686289732320_01JKBNZ5P32JPTZY8XXXX000000.pdf"); -``` +``` @@ -8426,11 +8395,10 @@ await client.moneyOut.getCheckImage("check133832686289732320_01JKBNZ5P32JPTZY8XX
-**assetName:** `string` +**assetName:** `string` -Name of the check asset to retrieve. This is returned as `filename` in the `CheckData` object +Name of the check asset to retrieve. This is returned as `filename` in the `CheckData` object in the response when you make a GET request to `/MoneyOut/details/{transId}`. - ``` "CheckData": { "ftype": "PDF", @@ -8439,26 +8407,26 @@ in the response when you make a GET request to `/MoneyOut/details/{transId}`. "fContent": "" } ``` - +
-**requestOptions:** `MoneyOut.RequestOptions` - +**requestOptions:** `MoneyOutClient.RequestOptions` +
+ ## Notification -
client.notification.addNotification({ ...params }) -> Payabli.PayabliApiResponseNotifications
@@ -8471,8 +8439,7 @@ in the response when you make a GET request to `/MoneyOut/details/{transId}`.
-Create a new notification or autogenerated report. - +Create a new notification or autogenerated report.
@@ -8489,17 +8456,17 @@ Create a new notification or autogenerated report. ```typescript await client.notification.addNotification({ content: { - eventType: "CreatedApplication", + eventType: "CreatedApplication" }, frequency: "untilcancelled", method: "web", ownerId: "236", ownerType: 0, status: 1, - target: "https://webhook.site/2871b8f8-edc7-441a-b376-98d8c8e33275", + target: "https://webhook.site/2871b8f8-edc7-441a-b376-98d8c8e33275" }); -``` +```
@@ -8513,21 +8480,22 @@ await client.notification.addNotification({
-**request:** `Payabli.AddNotificationRequest` - +**request:** `Payabli.AddNotificationRequest` +
-**requestOptions:** `Notification.RequestOptions` - +**requestOptions:** `NotificationClient.RequestOptions` +
+
@@ -8545,7 +8513,6 @@ await client.notification.addNotification({
Deletes a single notification or autogenerated report. -
@@ -8561,8 +8528,8 @@ Deletes a single notification or autogenerated report. ```typescript await client.notification.deleteNotification("1717"); -``` +``` @@ -8576,21 +8543,22 @@ await client.notification.deleteNotification("1717");
-**nId:** `string` — Notification ID. - +**nId:** `string` — Notification ID. +
-**requestOptions:** `Notification.RequestOptions` - +**requestOptions:** `NotificationClient.RequestOptions` +
+ @@ -8608,7 +8576,6 @@ await client.notification.deleteNotification("1717");
Retrieves a single notification or autogenerated report's details. -
@@ -8624,8 +8591,8 @@ Retrieves a single notification or autogenerated report's details. ```typescript await client.notification.getNotification("1717"); -``` +``` @@ -8639,21 +8606,22 @@ await client.notification.getNotification("1717");
-**nId:** `string` — Notification ID. - +**nId:** `string` — Notification ID. +
-**requestOptions:** `Notification.RequestOptions` - +**requestOptions:** `NotificationClient.RequestOptions` +
+ @@ -8670,8 +8638,7 @@ await client.notification.getNotification("1717");
-Update a notification or autogenerated report. - +Update a notification or autogenerated report.
@@ -8688,17 +8655,17 @@ Update a notification or autogenerated report. ```typescript await client.notification.updateNotification("1717", { content: { - eventType: "ApprovedPayment", + eventType: "ApprovedPayment" }, frequency: "untilcancelled", method: "email", ownerId: "136", ownerType: 0, status: 1, - target: "newemail@email.com", + target: "newemail@email.com" }); -``` +``` @@ -8712,34 +8679,35 @@ await client.notification.updateNotification("1717", {
-**nId:** `string` — Notification ID. - +**nId:** `string` — Notification ID. +
-**request:** `Payabli.UpdateNotificationRequest` - +**request:** `Payabli.UpdateNotificationRequest` +
-**requestOptions:** `Notification.RequestOptions` - +**requestOptions:** `NotificationClient.RequestOptions` +
+ -
client.notification.getReportFile(id) -> Payabli.File_ +
client.notification.getReportFile(Id) -> Payabli.File_
@@ -8752,7 +8720,6 @@ await client.notification.updateNotification("1717", {
Gets a copy of a generated report by ID. -
@@ -8768,8 +8735,8 @@ Gets a copy of a generated report by ID. ```typescript await client.notification.getReportFile(1000000); -``` +``` @@ -8783,27 +8750,27 @@ await client.notification.getReportFile(1000000);
-**id:** `number` — Report ID - +**Id:** `number` — Report ID +
-**requestOptions:** `Notification.RequestOptions` - +**requestOptions:** `NotificationClient.RequestOptions` +
+
## Notificationlogs -
client.notificationlogs.searchNotificationLogs({ ...params }) -> Payabli.NotificationLog[]
@@ -8817,12 +8784,10 @@ await client.notification.getReportFile(1000000);
Search notification logs with filtering and pagination. - -- Start date and end date cannot be more than 30 days apart -- Either `orgId` or `paypointId` must be provided + - Start date and end date cannot be more than 30 days apart + - Either `orgId` or `paypointId` must be provided This endpoint requires the `notifications_create` OR `notifications_read` permission. -
@@ -8844,11 +8809,11 @@ await client.notificationlogs.searchNotificationLogs({ endDate: "2024-01-31T23:59:59Z", orgId: 12345, notificationEvent: "ActivatedMerchant", - succeeded: true, - }, + succeeded: true + } }); -``` +``` @@ -8862,21 +8827,22 @@ await client.notificationlogs.searchNotificationLogs({
-**request:** `Payabli.SearchNotificationLogsRequest` - +**request:** `Payabli.SearchNotificationLogsRequest` +
-**requestOptions:** `Notificationlogs.RequestOptions` - +**requestOptions:** `NotificationlogsClient.RequestOptions` +
+
@@ -8895,7 +8861,6 @@ await client.notificationlogs.searchNotificationLogs({ Get detailed information for a specific notification log entry. This endpoint requires the `notifications_create` OR `notifications_read` permission. - @@ -8911,8 +8876,8 @@ This endpoint requires the `notifications_create` OR `notifications_read` permis ```typescript await client.notificationlogs.getNotificationLog("550e8400-e29b-41d4-a716-446655440000"); -``` +``` @@ -8927,20 +8892,21 @@ await client.notificationlogs.getNotificationLog("550e8400-e29b-41d4-a716-446655
**uuid:** `string` — The notification log entry. - +
-**requestOptions:** `Notificationlogs.RequestOptions` - +**requestOptions:** `NotificationlogsClient.RequestOptions` +
+
@@ -8960,7 +8926,6 @@ await client.notificationlogs.getNotificationLog("550e8400-e29b-41d4-a716-446655 Retry sending a specific notification. **Permissions:** notifications_create - @@ -8976,8 +8941,8 @@ Retry sending a specific notification. ```typescript await client.notificationlogs.retryNotificationLog("550e8400-e29b-41d4-a716-446655440000"); -``` +``` @@ -8992,20 +8957,21 @@ await client.notificationlogs.retryNotificationLog("550e8400-e29b-41d4-a716-4466
**uuid:** `string` — Unique id - +
-**requestOptions:** `Notificationlogs.RequestOptions` - +**requestOptions:** `NotificationlogsClient.RequestOptions` +
+ @@ -9026,7 +8992,6 @@ Retry sending multiple notifications (maximum 50 IDs). This is an async process, so use the search endpoint again to check the notification status. This endpoint requires the `notifications_create` permission. - @@ -9041,13 +9006,9 @@ This endpoint requires the `notifications_create` permission.
```typescript -await client.notificationlogs.bulkRetryNotificationLogs([ - "550e8400-e29b-41d4-a716-446655440000", - "550e8400-e29b-41d4-a716-446655440001", - "550e8400-e29b-41d4-a716-446655440002", -]); -``` +await client.notificationlogs.bulkRetryNotificationLogs(["550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440001", "550e8400-e29b-41d4-a716-446655440002"]); +```
@@ -9061,27 +9022,27 @@ await client.notificationlogs.bulkRetryNotificationLogs([
-**request:** `Payabli.BulkRetryRequest` - +**request:** `Payabli.BulkRetryRequest` +
-**requestOptions:** `Notificationlogs.RequestOptions` - +**requestOptions:** `NotificationlogsClient.RequestOptions` +
+ ## Ocr -
client.ocr.ocrDocumentForm(typeResult, { ...params }) -> Payabli.PayabliApiResponseOcr
@@ -9095,7 +9056,6 @@ await client.notificationlogs.bulkRetryNotificationLogs([
Use this endpoint to upload an image file for OCR processing. The accepted file formats include PDF, JPG, JPEG, PNG, and GIF. Specify the desired type of result (either 'bill' or 'invoice') in the path parameter `typeResult`. The response will contain the OCR processing results, including extracted data such as bill number, vendor information, bill items, and more. -
@@ -9110,14 +9070,9 @@ Use this endpoint to upload an image file for OCR processing. The accepted file
```typescript -await client.ocr.ocrDocumentForm("typeResult", { - ftype: undefined, - filename: undefined, - furl: undefined, - fContent: undefined, -}); -``` +await client.ocr.ocrDocumentForm("typeResult", {}); +```
@@ -9131,29 +9086,30 @@ await client.ocr.ocrDocumentForm("typeResult", {
-**typeResult:** `Payabli.TypeResult` - +**typeResult:** `Payabli.TypeResult` +
-**request:** `Payabli.FileContentImageOnly` - +**request:** `Payabli.FileContentImageOnly` +
-**requestOptions:** `Ocr.RequestOptions` - +**requestOptions:** `OcrClient.RequestOptions` +
+
@@ -9171,7 +9127,6 @@ await client.ocr.ocrDocumentForm("typeResult", {
Use this endpoint to submit a Base64-encoded image file for OCR processing. The accepted file formats include PDF, JPG, JPEG, PNG, and GIF. Specify the desired type of result (either 'bill' or 'invoice') in the path parameter `typeResult`. The response will contain the OCR processing results, including extracted data such as bill number, vendor information, bill items, and more. -
@@ -9186,14 +9141,9 @@ Use this endpoint to submit a Base64-encoded image file for OCR processing. The
```typescript -await client.ocr.ocrDocumentJson("typeResult", { - ftype: undefined, - filename: undefined, - furl: undefined, - fContent: undefined, -}); -``` +await client.ocr.ocrDocumentJson("typeResult", {}); +```
@@ -9207,35 +9157,35 @@ await client.ocr.ocrDocumentJson("typeResult", {
-**typeResult:** `Payabli.TypeResult` - +**typeResult:** `Payabli.TypeResult` +
-**request:** `Payabli.FileContentImageOnly` - +**request:** `Payabli.FileContentImageOnly` +
-**requestOptions:** `Ocr.RequestOptions` - +**requestOptions:** `OcrClient.RequestOptions` +
+ ## Organization -
client.organization.addOrganization({ ...params }) -> Payabli.AddOrganizationResponse
@@ -9249,7 +9199,6 @@ await client.ocr.ocrDocumentJson("typeResult", {
Creates an organization under a parent organization. This is also referred to as a suborganization. -
@@ -9273,16 +9222,14 @@ await client.organization.addOrganization({ billingCity: "Johnson City", billingCountry: "US", billingState: "TN", - billingZip: "37615", + billingZip: "37615" }, - contacts: [ - { + contacts: [{ contactEmail: "herman@hermanscoatings.com", contactName: "Herman Martinez", contactPhone: "3055550000", - contactTitle: "Owner", - }, - ], + contactTitle: "Owner" + }], hasBilling: true, hasResidual: true, orgAddress: "123 Walnut Street", @@ -9294,7 +9241,7 @@ await client.organization.addOrganization({ fContent: "TXkgdGVzdCBmaWxlHJ==...", filename: "my-doc.pdf", ftype: "pdf", - furl: "https://mysite.com/my-doc.pdf", + furl: "https://mysite.com/my-doc.pdf" }, orgName: "Pilgrim Planner", orgParentId: 236, @@ -9303,10 +9250,10 @@ await client.organization.addOrganization({ orgType: 0, orgWebsite: "www.pilgrimageplanner.com", orgZip: "37615", - replyToEmail: "email@example.com", + replyToEmail: "email@example.com" }); -``` +``` @@ -9320,21 +9267,22 @@ await client.organization.addOrganization({
-**request:** `Payabli.AddOrganizationRequest` - +**request:** `Payabli.AddOrganizationRequest` +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+
@@ -9351,8 +9299,7 @@ await client.organization.addOrganization({
-Delete an organization by ID. - +Delete an organization by ID.
@@ -9368,8 +9315,8 @@ Delete an organization by ID. ```typescript await client.organization.deleteOrganization(123); -``` +``` @@ -9384,20 +9331,21 @@ await client.organization.deleteOrganization(123);
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ @@ -9415,7 +9363,6 @@ await client.organization.deleteOrganization(123);
Updates an organization's details by ID. -
@@ -9431,14 +9378,12 @@ Updates an organization's details by ID. ```typescript await client.organization.editOrganization(123, { - contacts: [ - { + contacts: [{ contactEmail: "herman@hermanscoatings.com", contactName: "Herman Martinez", contactPhone: "3055550000", - contactTitle: "Owner", - }, - ], + contactTitle: "Owner" + }], orgAddress: "123 Walnut Street", orgCity: "Johnson City", orgCountry: "US", @@ -9449,10 +9394,10 @@ await client.organization.editOrganization(123, { orgTimezone: -5, orgType: 0, orgWebsite: "www.pilgrimageplanner.com", - orgZip: "37615", + orgZip: "37615" }); -``` +``` @@ -9467,28 +9412,29 @@ await client.organization.editOrganization(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.OrganizationData` - +**request:** `Payabli.OrganizationData` +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ @@ -9506,7 +9452,6 @@ await client.organization.editOrganization(123, {
Gets an organization's basic information by entry name (entrypoint identifier). -
@@ -9522,8 +9467,8 @@ Gets an organization's basic information by entry name (entrypoint identifier). ```typescript await client.organization.getBasicOrganization("8cfec329267"); -``` +``` @@ -9538,20 +9483,21 @@ await client.organization.getBasicOrganization("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ @@ -9569,7 +9515,6 @@ await client.organization.getBasicOrganization("8cfec329267");
Gets an organizations basic details by org ID. -
@@ -9585,8 +9530,8 @@ Gets an organizations basic details by org ID. ```typescript await client.organization.getBasicOrganizationById(123); -``` +``` @@ -9601,20 +9546,21 @@ await client.organization.getBasicOrganizationById(123);
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ @@ -9631,8 +9577,7 @@ await client.organization.getBasicOrganizationById(123);
-Retrieves details for an organization by ID. - +Retrieves details for an organization by ID.
@@ -9648,8 +9593,8 @@ Retrieves details for an organization by ID. ```typescript await client.organization.getOrganization(123); -``` +``` @@ -9664,20 +9609,21 @@ await client.organization.getOrganization(123);
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ @@ -9695,7 +9641,6 @@ await client.organization.getOrganization(123);
Retrieves an organization's settings. -
@@ -9711,8 +9656,8 @@ Retrieves an organization's settings. ```typescript await client.organization.getSettingsOrganization(123); -``` +``` @@ -9727,26 +9672,26 @@ await client.organization.getSettingsOrganization(123);
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**requestOptions:** `Organization.RequestOptions` - +**requestOptions:** `OrganizationClient.RequestOptions` +
+ ## PaymentLink -
client.paymentLink.addPayLinkFromInvoice(idInvoice, { ...params }) -> Payabli.PayabliApiResponsePaymentLinks
@@ -9759,8 +9704,7 @@ await client.organization.getSettingsOrganization(123);
-Generates a payment link for an invoice from the invoice ID. - +Generates a payment link for an invoice from the invoice ID.
@@ -9784,48 +9728,48 @@ await client.paymentLink.addPayLinkFromInvoice(23548884, { header: "Contact Us", order: 0, paymentIcons: true, - phoneLabel: "Phone", + phoneLabel: "Phone" }, invoices: { enabled: true, invoiceLink: { enabled: true, label: "View Invoice", - order: 0, + order: 0 }, order: 0, viewInvoiceDetails: { enabled: true, label: "Invoice Details", - order: 0, - }, + order: 0 + } }, logo: { enabled: true, - order: 0, + order: 0 }, messageBeforePaying: { enabled: true, label: "Please review your payment details", - order: 0, + order: 0 }, notes: { enabled: true, header: "Additional Notes", order: 0, placeholder: "Enter any additional notes here", - value: "", + value: "" }, page: { description: "Complete your payment securely", enabled: true, header: "Payment Page", - order: 0, + order: 0 }, paymentButton: { enabled: true, label: "Pay Now", - order: 0, + order: 0 }, paymentMethods: { allMethodsChecked: true, @@ -9837,21 +9781,20 @@ await client.paymentLink.addPayLinkFromInvoice(23548884, { discover: true, eCheck: true, mastercard: true, - visa: true, + visa: true }, order: 0, settings: { applePay: { buttonStyle: "black", buttonType: "pay", - language: "en-US", - }, - }, + language: "en-US" + } + } }, payor: { enabled: true, - fields: [ - { + fields: [{ display: true, fixed: true, identifier: true, @@ -9861,35 +9804,33 @@ await client.paymentLink.addPayLinkFromInvoice(23548884, { required: true, validation: "^[a-zA-Z ]+$", value: "", - width: 0, - }, - ], + width: 0 + }], header: "Payor Information", - order: 0, + order: 0 }, review: { enabled: true, header: "Review Payment", - order: 0, + order: 0 }, settings: { color: "#000000", customCssUrl: "https://example.com/custom.css", language: "en", pageLogo: { - fContent: - "PHN2ZyB2aWV3Qm94PSIwIDAgODAwIDEwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPCEtLSBCYWNrZ3JvdW5kIC0tPgogIDxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iMTAwMCIgZmlsbD0id2hpdGUiLz4KICAKICA8IS0tIENvbXBhbnkgSGVhZGVyIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI2MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjI0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+R3J1enlhIEFkdmVudHVyZSBPdXRmaXR0ZXJzPC90ZXh0PgogIDxsaW5lIHgxPSI0MCIgeTE9IjgwIiB4Mj0iNzYwIiB5Mj0iODAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgCiAgPCEtLSBDb21wYW55IERldGFpbHMgLS0+CiAgPHRleHQgeD0iNDAiIHk9IjExMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4xMjMgTW91bnRhaW4gVmlldyBSb2FkPC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxMzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGJpbGlzaSwgR2VvcmdpYSAwMTA1PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxNTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGVsOiArOTk1IDMyIDEyMyA0NTY3PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxNzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+RW1haWw6IGluZm9AZ3J1enlhYWR2ZW50dXJlcy5jb208L3RleHQ+CgogIDwhLS0gSW52b2ljZSBUaXRsZSAtLT4KICA8dGV4dCB4PSI2MDAiIHk9IjExMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjI0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+SU5WT0lDRTwvdGV4dD4KICA8dGV4dCB4PSI2MDAiIHk9IjE0MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5EYXRlOiAxMi8xMS8yMDI0PC90ZXh0PgogIDx0ZXh0IHg9IjYwMCIgeT0iMTYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPkludm9pY2UgIzogR1JaLTIwMjQtMTEyMzwvdGV4dD4KCiAgPCEtLSBCaWxsIFRvIFNlY3Rpb24gLS0+CiAgPHRleHQgeD0iNDAiIHk9IjIyMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE2IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+QklMTCBUTzo8L3RleHQ+CiAgPHJlY3QgeD0iNDAiIHk9IjIzNSIgd2lkdGg9IjMwMCIgaGVpZ2h0PSI4MCIgZmlsbD0iI2Y3ZjlmYSIvPgogIDx0ZXh0IHg9IjUwIiB5PSIyNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+W0N1c3RvbWVyIE5hbWVdPC90ZXh0PgogIDx0ZXh0IHg9IjUwIiB5PSIyODAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+W0FkZHJlc3MgTGluZSAxXTwvdGV4dD4KICA8dGV4dCB4PSI1MCIgeT0iMzAwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPltDaXR5LCBDb3VudHJ5XTwvdGV4dD4KCiAgPCEtLSBUYWJsZSBIZWFkZXJzIC0tPgogIDxyZWN0IHg9IjQwIiB5PSIzNDAiIHdpZHRoPSI3MjAiIGhlaWdodD0iMzAiIGZpbGw9IiMyYzNlNTAiLz4KICA8dGV4dCB4PSI1MCIgeT0iMzYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSJ3aGl0ZSI+RGVzY3JpcHRpb248L3RleHQ+CiAgPHRleHQgeD0iNDUwIiB5PSIzNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IndoaXRlIj5RdWFudGl0eTwvdGV4dD4KICA8dGV4dCB4PSI1NTAiIHk9IjM2MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0id2hpdGUiPlJhdGU8L3RleHQ+CiAgPHRleHQgeD0iNjgwIiB5PSIzNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IndoaXRlIj5BbW91bnQ8L3RleHQ+CgogIDwhLS0gVGFibGUgUm93cyAtLT4KICA8cmVjdCB4PSI0MCIgeT0iMzcwIiB3aWR0aD0iNzIwIiBoZWlnaHQ9IjMwIiBmaWxsPSIjZjdmOWZhIi8+CiAgPHRleHQgeD0iNTAiIHk9IjM5MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5Nb3VudGFpbiBDbGltYmluZyBFcXVpcG1lbnQgUmVudGFsPC90ZXh0PgogIDx0ZXh0IHg9IjQ1MCIgeT0iMzkwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPjE8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSIzOTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDI1MC4wMDwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjM5MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kMjUwLjAwPC90ZXh0PgoKICA8cmVjdCB4PSI0MCIgeT0iNDAwIiB3aWR0aD0iNzIwIiBoZWlnaHQ9IjMwIiBmaWxsPSJ3aGl0ZSIvPgogIDx0ZXh0IHg9IjUwIiB5PSI0MjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+R3VpZGVkIFRyZWsgUGFja2FnZSAtIDIgRGF5czwvdGV4dD4KICA8dGV4dCB4PSI0NTAiIHk9IjQyMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4xPC90ZXh0PgogIDx0ZXh0IHg9IjU1MCIgeT0iNDIwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPiQ0MDAuMDA8L3RleHQ+CiAgPHRleHQgeD0iNjgwIiB5PSI0MjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDQwMC4wMDwvdGV4dD4KCiAgPHJlY3QgeD0iNDAiIHk9IjQzMCIgd2lkdGg9IjcyMCIgaGVpZ2h0PSIzMCIgZmlsbD0iI2Y3ZjlmYSIvPgogIDx0ZXh0IHg9IjUwIiB5PSI0NTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+U2FmZXR5IEVxdWlwbWVudCBQYWNrYWdlPC90ZXh0PgogIDx0ZXh0IHg9IjQ1MCIgeT0iNDUwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPjE8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSI0NTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDE1MC4wMDwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjQ1MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kMTUwLjAwPC90ZXh0PgoKICA8IS0tIFRvdGFscyAtLT4KICA8bGluZSB4MT0iNDAiIHkxPSI0ODAiIHgyPSI3NjAiIHkyPSI0ODAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIxIi8+CiAgPHRleHQgeD0iNTUwIiB5PSI1MTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMzNDQ5NWUiPlN1YnRvdGFsOjwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjUxMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kODAwLjAwPC90ZXh0PgogIDx0ZXh0IHg9IjU1MCIgeT0iNTM1IiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSIjMzQ0OTVlIj5UYXggKDE4JSk6PC90ZXh0PgogIDx0ZXh0IHg9IjY4MCIgeT0iNTM1IiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPiQxNDQuMDA8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSI1NzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPlRvdGFsOjwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjU3MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE2IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+JDk0NC4wMDwvdGV4dD4KCiAgPCEtLSBQYXltZW50IFRlcm1zIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI2NDAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPlBheW1lbnQgVGVybXM8L3RleHQ+CiAgPHRleHQgeD0iNDAiIHk9IjY3MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5QYXltZW50IGlzIGR1ZSB3aXRoaW4gMzAgZGF5czwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNjkwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPlBsZWFzZSBpbmNsdWRlIGludm9pY2UgbnVtYmVyIG9uIHBheW1lbnQ8L3RleHQ+CgogIDwhLS0gQmFuayBEZXRhaWxzIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI3MzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPkJhbmsgRGV0YWlsczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPkJhbms6IEJhbmsgb2YgR2VvcmdpYTwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzgwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPklCQU46IEdFMTIzNDU2Nzg5MDEyMzQ1Njc4PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSI4MDAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+U1dJRlQ6IEJBR0FHRTIyPC90ZXh0PgoKICA8IS0tIEZvb3RlciAtLT4KICA8bGluZSB4MT0iNDAiIHkxPSI5MDAiIHgyPSI3NjAiIHkyPSI5MDAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIxIi8+CiAgPHRleHQgeD0iNDAiIHk9IjkzMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjEyIiBmaWxsPSIjN2Y4YzhkIj5UaGFuayB5b3UgZm9yIGNob29zaW5nIEdydXp5YSBBZHZlbnR1cmUgT3V0Zml0dGVyczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iOTUwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTIiIGZpbGw9IiM3ZjhjOGQiPnd3dy5ncnV6eWFhZHZlbnR1cmVzLmNvbTwvdGV4dD4KPC9zdmc+Cg==", + fContent: "PHN2ZyB2aWV3Qm94PSIwIDAgODAwIDEwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPCEtLSBCYWNrZ3JvdW5kIC0tPgogIDxyZWN0IHdpZHRoPSI4MDAiIGhlaWdodD0iMTAwMCIgZmlsbD0id2hpdGUiLz4KICAKICA8IS0tIENvbXBhbnkgSGVhZGVyIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI2MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjI0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+R3J1enlhIEFkdmVudHVyZSBPdXRmaXR0ZXJzPC90ZXh0PgogIDxsaW5lIHgxPSI0MCIgeTE9IjgwIiB4Mj0iNzYwIiB5Mj0iODAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgCiAgPCEtLSBDb21wYW55IERldGFpbHMgLS0+CiAgPHRleHQgeD0iNDAiIHk9IjExMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4xMjMgTW91bnRhaW4gVmlldyBSb2FkPC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxMzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGJpbGlzaSwgR2VvcmdpYSAwMTA1PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxNTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+VGVsOiArOTk1IDMyIDEyMyA0NTY3PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSIxNzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+RW1haWw6IGluZm9AZ3J1enlhYWR2ZW50dXJlcy5jb208L3RleHQ+CgogIDwhLS0gSW52b2ljZSBUaXRsZSAtLT4KICA8dGV4dCB4PSI2MDAiIHk9IjExMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjI0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+SU5WT0lDRTwvdGV4dD4KICA8dGV4dCB4PSI2MDAiIHk9IjE0MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5EYXRlOiAxMi8xMS8yMDI0PC90ZXh0PgogIDx0ZXh0IHg9IjYwMCIgeT0iMTYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPkludm9pY2UgIzogR1JaLTIwMjQtMTEyMzwvdGV4dD4KCiAgPCEtLSBCaWxsIFRvIFNlY3Rpb24gLS0+CiAgPHRleHQgeD0iNDAiIHk9IjIyMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE2IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+QklMTCBUTzo8L3RleHQ+CiAgPHJlY3QgeD0iNDAiIHk9IjIzNSIgd2lkdGg9IjMwMCIgaGVpZ2h0PSI4MCIgZmlsbD0iI2Y3ZjlmYSIvPgogIDx0ZXh0IHg9IjUwIiB5PSIyNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+W0N1c3RvbWVyIE5hbWVdPC90ZXh0PgogIDx0ZXh0IHg9IjUwIiB5PSIyODAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+W0FkZHJlc3MgTGluZSAxXTwvdGV4dD4KICA8dGV4dCB4PSI1MCIgeT0iMzAwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPltDaXR5LCBDb3VudHJ5XTwvdGV4dD4KCiAgPCEtLSBUYWJsZSBIZWFkZXJzIC0tPgogIDxyZWN0IHg9IjQwIiB5PSIzNDAiIHdpZHRoPSI3MjAiIGhlaWdodD0iMzAiIGZpbGw9IiMyYzNlNTAiLz4KICA8dGV4dCB4PSI1MCIgeT0iMzYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSJ3aGl0ZSI+RGVzY3JpcHRpb248L3RleHQ+CiAgPHRleHQgeD0iNDUwIiB5PSIzNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IndoaXRlIj5RdWFudGl0eTwvdGV4dD4KICA8dGV4dCB4PSI1NTAiIHk9IjM2MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0id2hpdGUiPlJhdGU8L3RleHQ+CiAgPHRleHQgeD0iNjgwIiB5PSIzNjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IndoaXRlIj5BbW91bnQ8L3RleHQ+CgogIDwhLS0gVGFibGUgUm93cyAtLT4KICA8cmVjdCB4PSI0MCIgeT0iMzcwIiB3aWR0aD0iNzIwIiBoZWlnaHQ9IjMwIiBmaWxsPSIjZjdmOWZhIi8+CiAgPHRleHQgeD0iNTAiIHk9IjM5MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5Nb3VudGFpbiBDbGltYmluZyBFcXVpcG1lbnQgUmVudGFsPC90ZXh0PgogIDx0ZXh0IHg9IjQ1MCIgeT0iMzkwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPjE8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSIzOTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDI1MC4wMDwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjM5MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kMjUwLjAwPC90ZXh0PgoKICA8cmVjdCB4PSI0MCIgeT0iNDAwIiB3aWR0aD0iNzIwIiBoZWlnaHQ9IjMwIiBmaWxsPSJ3aGl0ZSIvPgogIDx0ZXh0IHg9IjUwIiB5PSI0MjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+R3VpZGVkIFRyZWsgUGFja2FnZSAtIDIgRGF5czwvdGV4dD4KICA8dGV4dCB4PSI0NTAiIHk9IjQyMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4xPC90ZXh0PgogIDx0ZXh0IHg9IjU1MCIgeT0iNDIwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPiQ0MDAuMDA8L3RleHQ+CiAgPHRleHQgeD0iNjgwIiB5PSI0MjAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDQwMC4wMDwvdGV4dD4KCiAgPHJlY3QgeD0iNDAiIHk9IjQzMCIgd2lkdGg9IjcyMCIgaGVpZ2h0PSIzMCIgZmlsbD0iI2Y3ZjlmYSIvPgogIDx0ZXh0IHg9IjUwIiB5PSI0NTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+U2FmZXR5IEVxdWlwbWVudCBQYWNrYWdlPC90ZXh0PgogIDx0ZXh0IHg9IjQ1MCIgeT0iNDUwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPjE8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSI0NTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+JDE1MC4wMDwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjQ1MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kMTUwLjAwPC90ZXh0PgoKICA8IS0tIFRvdGFscyAtLT4KICA8bGluZSB4MT0iNDAiIHkxPSI0ODAiIHgyPSI3NjAiIHkyPSI0ODAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIxIi8+CiAgPHRleHQgeD0iNTUwIiB5PSI1MTAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMzNDQ5NWUiPlN1YnRvdGFsOjwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjUxMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj4kODAwLjAwPC90ZXh0PgogIDx0ZXh0IHg9IjU1MCIgeT0iNTM1IiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZvbnQtd2VpZ2h0PSJib2xkIiBmaWxsPSIjMzQ0OTVlIj5UYXggKDE4JSk6PC90ZXh0PgogIDx0ZXh0IHg9IjY4MCIgeT0iNTM1IiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPiQxNDQuMDA8L3RleHQ+CiAgPHRleHQgeD0iNTUwIiB5PSI1NzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPlRvdGFsOjwvdGV4dD4KICA8dGV4dCB4PSI2ODAiIHk9IjU3MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE2IiBmb250LXdlaWdodD0iYm9sZCIgZmlsbD0iIzJjM2U1MCI+JDk0NC4wMDwvdGV4dD4KCiAgPCEtLSBQYXltZW50IFRlcm1zIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI2NDAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPlBheW1lbnQgVGVybXM8L3RleHQ+CiAgPHRleHQgeD0iNDAiIHk9IjY3MCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0IiBmaWxsPSIjMzQ0OTVlIj5QYXltZW50IGlzIGR1ZSB3aXRoaW4gMzAgZGF5czwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNjkwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPlBsZWFzZSBpbmNsdWRlIGludm9pY2UgbnVtYmVyIG9uIHBheW1lbnQ8L3RleHQ+CgogIDwhLS0gQmFuayBEZXRhaWxzIC0tPgogIDx0ZXh0IHg9IjQwIiB5PSI3MzAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNiIgZm9udC13ZWlnaHQ9ImJvbGQiIGZpbGw9IiMyYzNlNTAiPkJhbmsgRGV0YWlsczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzYwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPkJhbms6IEJhbmsgb2YgR2VvcmdpYTwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iNzgwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTQiIGZpbGw9IiMzNDQ5NWUiPklCQU46IEdFMTIzNDU2Nzg5MDEyMzQ1Njc4PC90ZXh0PgogIDx0ZXh0IHg9IjQwIiB5PSI4MDAiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzM0NDk1ZSI+U1dJRlQ6IEJBR0FHRTIyPC90ZXh0PgoKICA8IS0tIEZvb3RlciAtLT4KICA8bGluZSB4MT0iNDAiIHkxPSI5MDAiIHgyPSI3NjAiIHkyPSI5MDAiIHN0cm9rZT0iIzJjM2U1MCIgc3Ryb2tlLXdpZHRoPSIxIi8+CiAgPHRleHQgeD0iNDAiIHk9IjkzMCIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjEyIiBmaWxsPSIjN2Y4YzhkIj5UaGFuayB5b3UgZm9yIGNob29zaW5nIEdydXp5YSBBZHZlbnR1cmUgT3V0Zml0dGVyczwvdGV4dD4KICA8dGV4dCB4PSI0MCIgeT0iOTUwIiBmb250LWZhbWlseT0iQXJpYWwiIGZvbnQtc2l6ZT0iMTIiIGZpbGw9IiM3ZjhjOGQiPnd3dy5ncnV6eWFhZHZlbnR1cmVzLmNvbTwvdGV4dD4KPC9zdmc+Cg==", filename: "logo.jpg", ftype: "jpg", - furl: "", + furl: "" }, redirectAfterApprove: true, - redirectAfterApproveUrl: "https://example.com/success", - }, - }, + redirectAfterApproveUrl: "https://example.com/success" + } + } }); -``` +```
@@ -9904,28 +9845,29 @@ await client.paymentLink.addPayLinkFromInvoice(23548884, {
**idInvoice:** `number` — Invoice ID - +
-**request:** `Payabli.PayLinkDataInvoice` - +**request:** `Payabli.PayLinkDataInvoice` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+
@@ -9942,8 +9884,7 @@ await client.paymentLink.addPayLinkFromInvoice(23548884, {
-Generates a payment link for a bill from the bill ID. - +Generates a payment link for a bill from the bill ID.
@@ -9967,34 +9908,34 @@ await client.paymentLink.addPayLinkFromBill(23548884, { header: "Contact Us", order: 0, paymentIcons: true, - phoneLabel: "Phone", + phoneLabel: "Phone" }, logo: { enabled: true, - order: 0, + order: 0 }, messageBeforePaying: { enabled: true, label: "Please review your payment details", - order: 0, + order: 0 }, notes: { enabled: true, header: "Additional Notes", order: 0, placeholder: "Enter any additional notes here", - value: "", + value: "" }, page: { description: "Get paid securely", enabled: true, header: "Payment Page", - order: 0, + order: 0 }, paymentButton: { enabled: true, label: "Pay Now", - order: 0, + order: 0 }, paymentMethods: { allMethodsChecked: true, @@ -10006,14 +9947,13 @@ await client.paymentLink.addPayLinkFromBill(23548884, { discover: true, eCheck: true, mastercard: true, - visa: true, + visa: true }, - order: 0, + order: 0 }, payor: { enabled: true, - fields: [ - { + fields: [{ display: true, fixed: true, identifier: true, @@ -10023,25 +9963,24 @@ await client.paymentLink.addPayLinkFromBill(23548884, { required: true, validation: "^[a-zA-Z ]+$", value: "", - width: 0, - }, - ], + width: 0 + }], header: "Payor Information", - order: 0, + order: 0 }, review: { enabled: true, header: "Review Payment", - order: 0, + order: 0 }, settings: { color: "#000000", - language: "en", - }, - }, + language: "en" + } + } }); -``` +``` @@ -10056,28 +9995,29 @@ await client.paymentLink.addPayLinkFromBill(23548884, {
**billId:** `number` — The Payabli ID for the bill. - +
-**request:** `Payabli.PayLinkDataBill` - +**request:** `Payabli.PayLinkDataBill` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10095,7 +10035,6 @@ await client.paymentLink.addPayLinkFromBill(23548884, {
Deletes a payment link by ID. -
@@ -10111,8 +10050,8 @@ Deletes a payment link by ID. ```typescript await client.paymentLink.deletePayLinkFromId("payLinkId"); -``` +``` @@ -10127,20 +10066,21 @@ await client.paymentLink.deletePayLinkFromId("payLinkId");
**payLinkId:** `string` — ID for the payment link. - +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10158,7 +10098,6 @@ await client.paymentLink.deletePayLinkFromId("payLinkId");
Retrieves a payment link by ID. -
@@ -10174,8 +10113,8 @@ Retrieves a payment link by ID. ```typescript await client.paymentLink.getPayLinkFromId("paylinkId"); -``` +``` @@ -10190,20 +10129,21 @@ await client.paymentLink.getPayLinkFromId("paylinkId");
**paylinkId:** `string` — ID for payment link - +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10221,7 +10161,6 @@ await client.paymentLink.getPayLinkFromId("paylinkId");
Send a payment link to the specified email addresses or phone numbers. -
@@ -10237,10 +10176,10 @@ Send a payment link to the specified email addresses or phone numbers. ```typescript await client.paymentLink.pushPayLinkFromId("payLinkId", { - channel: "sms", + channel: "sms" }); -``` +``` @@ -10255,28 +10194,29 @@ await client.paymentLink.pushPayLinkFromId("payLinkId", {
**payLinkId:** `string` — ID for the payment link. - +
-**request:** `Payabli.PushPayLinkRequest` - +**request:** `Payabli.PushPayLinkRequest` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10294,7 +10234,6 @@ await client.paymentLink.pushPayLinkFromId("payLinkId", {
Refresh a payment link's content after an update. -
@@ -10310,8 +10249,8 @@ Refresh a payment link's content after an update. ```typescript await client.paymentLink.refreshPayLinkFromId("payLinkId"); -``` +``` @@ -10326,28 +10265,29 @@ await client.paymentLink.refreshPayLinkFromId("payLinkId");
**payLinkId:** `string` — ID for the payment link. - +
-**request:** `Payabli.RefreshPayLinkFromIdRequest` - +**request:** `Payabli.RefreshPayLinkFromIdRequest` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10364,8 +10304,7 @@ await client.paymentLink.refreshPayLinkFromId("payLinkId");
-Sends a payment link to the specified email addresses. - +Sends a payment link to the specified email addresses.
@@ -10381,10 +10320,10 @@ Sends a payment link to the specified email addresses. ```typescript await client.paymentLink.sendPayLinkFromId("payLinkId", { - mail2: "jo@example.com; ceo@example.com", + mail2: "jo@example.com; ceo@example.com" }); -``` +``` @@ -10399,28 +10338,29 @@ await client.paymentLink.sendPayLinkFromId("payLinkId", {
**payLinkId:** `string` — ID for the payment link. - +
-**request:** `Payabli.SendPayLinkFromIdRequest` - +**request:** `Payabli.SendPayLinkFromIdRequest` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10438,7 +10378,6 @@ await client.paymentLink.sendPayLinkFromId("payLinkId", {
Updates a payment link's details. -
@@ -10459,16 +10398,16 @@ await client.paymentLink.updatePayLinkFromId("332-c277b704-1301", { header: "Additional Notes", order: 0, placeholder: "Enter any additional notes here", - value: "", + value: "" }, paymentButton: { enabled: true, label: "Pay Now", - order: 0, - }, + order: 0 + } }); -``` +``` @@ -10483,28 +10422,29 @@ await client.paymentLink.updatePayLinkFromId("332-c277b704-1301", {
**payLinkId:** `string` — ID for the payment link. - +
-**request:** `Payabli.PayLinkUpdateData` - +**request:** `Payabli.PayLinkUpdateData` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ @@ -10522,7 +10462,6 @@ await client.paymentLink.updatePayLinkFromId("332-c277b704-1301", {
Generates a vendor payment link for a specific bill lot number. This allows you to pay all bills with the same lot number for a vendor with a single payment link. -
@@ -10549,34 +10488,34 @@ await client.paymentLink.addPayLinkFromBillLotNumber("LOT-2024-001", { header: "Contact Us", order: 0, paymentIcons: true, - phoneLabel: "Phone", + phoneLabel: "Phone" }, logo: { enabled: true, - order: 0, + order: 0 }, messageBeforePaying: { enabled: true, label: "Please review your payment details", - order: 0, + order: 0 }, notes: { enabled: true, header: "Additional Notes", order: 0, placeholder: "Enter any additional notes here", - value: "", + value: "" }, page: { description: "Get paid securely", enabled: true, header: "Payment Page", - order: 0, + order: 0 }, paymentButton: { enabled: true, label: "Pay Now", - order: 0, + order: 0 }, paymentMethods: { allMethodsChecked: true, @@ -10588,14 +10527,13 @@ await client.paymentLink.addPayLinkFromBillLotNumber("LOT-2024-001", { discover: true, eCheck: true, mastercard: true, - visa: true, + visa: true }, - order: 0, + order: 0 }, payor: { enabled: true, - fields: [ - { + fields: [{ display: true, fixed: true, identifier: true, @@ -10605,25 +10543,24 @@ await client.paymentLink.addPayLinkFromBillLotNumber("LOT-2024-001", { required: true, validation: "^[a-zA-Z ]+$", value: "", - width: 0, - }, - ], + width: 0 + }], header: "Payor Information", - order: 0, + order: 0 }, review: { enabled: true, header: "Review Payment", - order: 0, + order: 0 }, settings: { color: "#000000", - language: "en", - }, - }, + language: "en" + } + } }); -``` +``` @@ -10638,34 +10575,34 @@ await client.paymentLink.addPayLinkFromBillLotNumber("LOT-2024-001", {
**lotNumber:** `string` — Lot number of the bills to pay. All bills with this lot number will be included. - +
-**request:** `Payabli.PayLinkDataOut` - +**request:** `Payabli.PayLinkDataOut` +
-**requestOptions:** `PaymentLink.RequestOptions` - +**requestOptions:** `PaymentLinkClient.RequestOptions` +
+ ## PaymentMethodDomain -
client.paymentMethodDomain.addPaymentMethodDomain({ ...params }) -> Payabli.AddPaymentMethodDomainApiResponse
@@ -10679,7 +10616,6 @@ await client.paymentLink.addPayLinkFromBillLotNumber("LOT-2024-001", {
Add a payment method domain to an organization or paypoint. -
@@ -10699,14 +10635,14 @@ await client.paymentMethodDomain.addPaymentMethodDomain({ entityId: 109, entityType: "paypoint", applePay: { - isEnabled: true, + isEnabled: true }, googlePay: { - isEnabled: true, - }, + isEnabled: true + } }); -``` +``` @@ -10720,21 +10656,22 @@ await client.paymentMethodDomain.addPaymentMethodDomain({
-**request:** `Payabli.AddPaymentMethodDomainRequest` - +**request:** `Payabli.AddPaymentMethodDomainRequest` +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+
@@ -10752,7 +10689,6 @@ await client.paymentMethodDomain.addPaymentMethodDomain({
Cascades a payment method domain to all child entities. All paypoints and suborganization under this parent will inherit this domain and its settings. -
@@ -10768,8 +10704,8 @@ Cascades a payment method domain to all child entities. All paypoints and suborg ```typescript await client.paymentMethodDomain.cascadePaymentMethodDomain("pmd_b8237fa45c964d8a9ef27160cd42b8c5"); -``` +``` @@ -10784,20 +10720,21 @@ await client.paymentMethodDomain.cascadePaymentMethodDomain("pmd_b8237fa45c964d8
**domainId:** `string` — The payment method domain's ID in Payabli. - +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ @@ -10815,7 +10752,6 @@ await client.paymentMethodDomain.cascadePaymentMethodDomain("pmd_b8237fa45c964d8
Delete a payment method domain. You can't delete an inherited domain, you must delete a domain at the organization level. -
@@ -10831,8 +10767,8 @@ Delete a payment method domain. You can't delete an inherited domain, you must d ```typescript await client.paymentMethodDomain.deletePaymentMethodDomain("pmd_b8237fa45c964d8a9ef27160cd42b8c5"); -``` +``` @@ -10847,20 +10783,21 @@ await client.paymentMethodDomain.deletePaymentMethodDomain("pmd_b8237fa45c964d8a
**domainId:** `string` — The payment method domain's ID in Payabli. - +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ @@ -10878,7 +10815,6 @@ await client.paymentMethodDomain.deletePaymentMethodDomain("pmd_b8237fa45c964d8a
Get the details for a payment method domain. -
@@ -10894,8 +10830,8 @@ Get the details for a payment method domain. ```typescript await client.paymentMethodDomain.getPaymentMethodDomain("pmd_b8237fa45c964d8a9ef27160cd42b8c5"); -``` +``` @@ -10910,20 +10846,21 @@ await client.paymentMethodDomain.getPaymentMethodDomain("pmd_b8237fa45c964d8a9ef
**domainId:** `string` — The payment method domain's ID in Payabli. - +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ @@ -10941,7 +10878,6 @@ await client.paymentMethodDomain.getPaymentMethodDomain("pmd_b8237fa45c964d8a9ef
Get a list of payment method domains that belong to a PSP, organization, or paypoint. -
@@ -10958,10 +10894,10 @@ Get a list of payment method domains that belong to a PSP, organization, or payp ```typescript await client.paymentMethodDomain.listPaymentMethodDomains({ entityId: 1147, - entityType: "paypoint", + entityType: "paypoint" }); -``` +``` @@ -10975,21 +10911,22 @@ await client.paymentMethodDomain.listPaymentMethodDomains({
-**request:** `Payabli.ListPaymentMethodDomainsRequest` - +**request:** `Payabli.ListPaymentMethodDomainsRequest` +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ @@ -11007,7 +10944,6 @@ await client.paymentMethodDomain.listPaymentMethodDomains({
Update a payment method domain's configuration values. -
@@ -11024,14 +10960,14 @@ Update a payment method domain's configuration values. ```typescript await client.paymentMethodDomain.updatePaymentMethodDomain("pmd_b8237fa45c964d8a9ef27160cd42b8c5", { applePay: { - isEnabled: false, + isEnabled: false }, googlePay: { - isEnabled: false, - }, + isEnabled: false + } }); -``` +``` @@ -11046,28 +10982,29 @@ await client.paymentMethodDomain.updatePaymentMethodDomain("pmd_b8237fa45c964d8a
**domainId:** `string` — The payment method domain's ID in Payabli. - +
-**request:** `Payabli.UpdatePaymentMethodDomainRequest` - +**request:** `Payabli.UpdatePaymentMethodDomainRequest` +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ @@ -11085,7 +11022,6 @@ await client.paymentMethodDomain.updatePaymentMethodDomain("pmd_b8237fa45c964d8a
Verify a new payment method domain. If verification is successful, Apple Pay is automatically activated for the domain. -
@@ -11101,8 +11037,8 @@ Verify a new payment method domain. If verification is successful, Apple Pay is ```typescript await client.paymentMethodDomain.verifyPaymentMethodDomain("pmd_b8237fa45c964d8a9ef27160cd42b8c5"); -``` +``` @@ -11117,26 +11053,26 @@ await client.paymentMethodDomain.verifyPaymentMethodDomain("pmd_b8237fa45c964d8a
**domainId:** `string` — The payment method domain's ID in Payabli. - +
-**requestOptions:** `PaymentMethodDomain.RequestOptions` - +**requestOptions:** `PaymentMethodDomainClient.RequestOptions` +
+ ## Paypoint -
client.paypoint.getBasicEntry(entry) -> Payabli.GetBasicEntryResponse
@@ -11150,7 +11086,6 @@ await client.paymentMethodDomain.verifyPaymentMethodDomain("pmd_b8237fa45c964d8a
Gets the basic details for a paypoint. -
@@ -11166,8 +11101,8 @@ Gets the basic details for a paypoint. ```typescript await client.paypoint.getBasicEntry("8cfec329267"); -``` +``` @@ -11182,25 +11117,26 @@ await client.paypoint.getBasicEntry("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+
-
client.paypoint.getBasicEntryById(idPaypoint) -> Payabli.GetBasicEntryByIdResponse +
client.paypoint.getBasicEntryById(IdPaypoint) -> Payabli.GetBasicEntryByIdResponse
@@ -11212,8 +11148,7 @@ await client.paypoint.getBasicEntry("8cfec329267");
-Retrieves the basic details for a paypoint by ID. - +Retrieves the basic details for a paypoint by ID.
@@ -11229,8 +11164,8 @@ Retrieves the basic details for a paypoint by ID. ```typescript await client.paypoint.getBasicEntryById("198"); -``` +```
@@ -11244,21 +11179,22 @@ await client.paypoint.getBasicEntryById("198");
-**idPaypoint:** `string` — Paypoint ID. You can find this value by querying `/api/Query/paypoints/{orgId}` - +**IdPaypoint:** `string` — Paypoint ID. You can find this value by querying `/api/Query/paypoints/{orgId}` +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+
@@ -11276,7 +11212,6 @@ await client.paypoint.getBasicEntryById("198");
Gets the details for a single paypoint. -
@@ -11292,8 +11227,8 @@ Gets the details for a single paypoint. ```typescript await client.paypoint.getEntryConfig("8cfec329267"); -``` +``` @@ -11308,28 +11243,29 @@ await client.paypoint.getEntryConfig("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.GetEntryConfigRequest` - +**request:** `Payabli.GetEntryConfigRequest` +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+
@@ -11346,8 +11282,7 @@ await client.paypoint.getEntryConfig("8cfec329267");
-Gets the details for single payment page for a paypoint. - +Gets the details for single payment page for a paypoint.
@@ -11363,8 +11298,8 @@ Gets the details for single payment page for a paypoint. ```typescript await client.paypoint.getPage("8cfec329267", "pay-your-fees-1"); -``` +``` @@ -11379,7 +11314,7 @@ await client.paypoint.getPage("8cfec329267", "pay-your-fees-1");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
@@ -11387,20 +11322,21 @@ await client.paypoint.getPage("8cfec329267", "pay-your-fees-1");
**subdomain:** `string` — Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+ @@ -11418,7 +11354,6 @@ await client.paypoint.getPage("8cfec329267", "pay-your-fees-1");
Deletes a payment page in a paypoint. -
@@ -11434,8 +11369,8 @@ Deletes a payment page in a paypoint. ```typescript await client.paypoint.removePage("8cfec329267", "pay-your-fees-1"); -``` +``` @@ -11450,7 +11385,7 @@ await client.paypoint.removePage("8cfec329267", "pay-your-fees-1");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
@@ -11458,20 +11393,21 @@ await client.paypoint.removePage("8cfec329267", "pay-your-fees-1");
**subdomain:** `string` — Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+ @@ -11488,8 +11424,7 @@ await client.paypoint.removePage("8cfec329267", "pay-your-fees-1");
-Updates a paypoint logo. - +Updates a paypoint logo.
@@ -11505,8 +11440,8 @@ Updates a paypoint logo. ```typescript await client.paypoint.saveLogo("8cfec329267", {}); -``` +``` @@ -11521,28 +11456,29 @@ await client.paypoint.saveLogo("8cfec329267", {});
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.FileContent` - +**request:** `Payabli.FileContent` +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+ @@ -11560,7 +11496,6 @@ await client.paypoint.saveLogo("8cfec329267", {});
Retrieves an paypoint's basic settings like custom fields, identifiers, and invoicing settings. -
@@ -11576,8 +11511,8 @@ Retrieves an paypoint's basic settings like custom fields, identifiers, and invo ```typescript await client.paypoint.settingsPage("8cfec329267"); -``` +``` @@ -11592,20 +11527,21 @@ await client.paypoint.settingsPage("8cfec329267");
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+ @@ -11623,7 +11559,6 @@ await client.paypoint.settingsPage("8cfec329267");
Migrates a paypoint to a new parent organization. -
@@ -11643,16 +11578,14 @@ await client.paypoint.migrate({ newParentOrganizationId: 123, notificationRequest: { notificationUrl: "https://webhook-test.yoursie.com", - webHeaderParameters: [ - { + webHeaderParameters: [{ key: "testheader", - value: "1234567890", - }, - ], - }, + value: "1234567890" + }] + } }); -``` +``` @@ -11666,27 +11599,27 @@ await client.paypoint.migrate({
-**request:** `Payabli.PaypointMoveRequest` - +**request:** `Payabli.PaypointMoveRequest` +
-**requestOptions:** `Paypoint.RequestOptions` - +**requestOptions:** `PaypointClient.RequestOptions` +
+ ## Query -
client.query.listBatchDetails(entry, { ...params }) -> Payabli.QueryBatchesDetailResponse
@@ -11700,8 +11633,7 @@ await client.paypoint.migrate({
Retrieve a list of batches and their details, including settled and -unsettled transactions for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. - +unsettled transactions for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response.
@@ -11719,10 +11651,10 @@ unsettled transactions for a paypoint. Use filters to limit results. Include the await client.query.listBatchDetails("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -11736,29 +11668,30 @@ await client.query.listBatchDetails("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListBatchDetailsRequest` - +**request:** `Payabli.ListBatchDetailsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+
@@ -11776,7 +11709,6 @@ await client.query.listBatchDetails("8cfec329267", {
Retrieve a list of batches and their details, including settled and unsettled transactions for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -11794,10 +11726,10 @@ Retrieve a list of batches and their details, including settled and unsettled tr await client.query.listBatchDetailsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -11812,28 +11744,29 @@ await client.query.listBatchDetailsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListBatchDetailsOrgRequest` - +**request:** `Payabli.ListBatchDetailsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -11851,7 +11784,6 @@ await client.query.listBatchDetailsOrg(123, {
Retrieve a list of batches for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -11869,10 +11801,10 @@ Retrieve a list of batches for a paypoint. Use filters to limit results. Include await client.query.listBatches("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -11886,29 +11818,30 @@ await client.query.listBatches("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListBatchesRequest` - +**request:** `Payabli.ListBatchesRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -11926,7 +11859,6 @@ await client.query.listBatches("8cfec329267", {
Retrieve a list of batches for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -11944,10 +11876,10 @@ Retrieve a list of batches for an org. Use filters to limit results. Include the await client.query.listBatchesOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -11962,28 +11894,29 @@ await client.query.listBatchesOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListBatchesOrgRequest` - +**request:** `Payabli.ListBatchesOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12001,7 +11934,6 @@ await client.query.listBatchesOrg(123, {
Retrieve a list of MoneyOut batches for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12019,10 +11951,10 @@ Retrieve a list of MoneyOut batches for a paypoint. Use filters to limit results await client.query.listBatchesOut("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12036,29 +11968,30 @@ await client.query.listBatchesOut("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListBatchesOutRequest` - +**request:** `Payabli.ListBatchesOutRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12076,7 +12009,6 @@ await client.query.listBatchesOut("8cfec329267", {
Retrieve a list of MoneyOut batches for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12094,10 +12026,10 @@ Retrieve a list of MoneyOut batches for an org. Use filters to limit results. In await client.query.listBatchesOutOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12112,28 +12044,29 @@ await client.query.listBatchesOutOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListBatchesOutOrgRequest` - +**request:** `Payabli.ListBatchesOutOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12151,7 +12084,6 @@ await client.query.listBatchesOutOrg(123, {
Retrieves a list of chargebacks and returned transactions for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12169,10 +12101,10 @@ Retrieves a list of chargebacks and returned transactions for a paypoint. Use fi await client.query.listChargebacks("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12186,29 +12118,30 @@ await client.query.listChargebacks("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListChargebacksRequest` - +**request:** `Payabli.ListChargebacksRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12226,7 +12159,6 @@ await client.query.listChargebacks("8cfec329267", {
Retrieve a list of chargebacks and returned transactions for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12244,10 +12176,10 @@ Retrieve a list of chargebacks and returned transactions for an org. Use filters await client.query.listChargebacksOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12262,28 +12194,29 @@ await client.query.listChargebacksOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListChargebacksOrgRequest` - +**request:** `Payabli.ListChargebacksOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12301,7 +12234,6 @@ await client.query.listChargebacksOrg(123, {
Retrieves a list of customers for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12319,10 +12251,10 @@ Retrieves a list of customers for a paypoint. Use filters to limit results. Incl await client.query.listCustomers("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12336,29 +12268,30 @@ await client.query.listCustomers("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListCustomersRequest` - +**request:** `Payabli.ListCustomersRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12376,7 +12309,6 @@ await client.query.listCustomers("8cfec329267", {
Retrieves a list of customers for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12394,10 +12326,10 @@ Retrieves a list of customers for an org. Use filters to limit results. Include await client.query.listCustomersOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12412,28 +12344,29 @@ await client.query.listCustomersOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListCustomersOrgRequest` - +**request:** `Payabli.ListCustomersOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12451,7 +12384,6 @@ await client.query.listCustomersOrg(123, {
Returns a list of all reports generated in the last 60 days for a single entrypoint. Use filters to limit results. -
@@ -12469,10 +12401,10 @@ Returns a list of all reports generated in the last 60 days for a single entrypo await client.query.listNotificationReports("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12486,29 +12418,30 @@ await client.query.listNotificationReports("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListNotificationReportsRequest` - +**request:** `Payabli.ListNotificationReportsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12526,7 +12459,6 @@ await client.query.listNotificationReports("8cfec329267", {
Returns a list of all reports generated in the last 60 days for an organization. Use filters to limit results. -
@@ -12544,10 +12476,10 @@ Returns a list of all reports generated in the last 60 days for an organization. await client.query.listNotificationReportsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12562,28 +12494,29 @@ await client.query.listNotificationReportsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListNotificationReportsOrgRequest` - +**request:** `Payabli.ListNotificationReportsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12601,7 +12534,6 @@ await client.query.listNotificationReportsOrg(123, {
Returns a list of notifications for an entrypoint. Use filters to limit results. -
@@ -12619,10 +12551,10 @@ Returns a list of notifications for an entrypoint. Use filters to limit results. await client.query.listNotifications("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12636,29 +12568,30 @@ await client.query.listNotifications("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListNotificationsRequest` - +**request:** `Payabli.ListNotificationsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12676,7 +12609,6 @@ await client.query.listNotifications("8cfec329267", {
Return a list of notifications for an organization. Use filters to limit results. -
@@ -12694,10 +12626,10 @@ Return a list of notifications for an organization. Use filters to limit results await client.query.listNotificationsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12712,28 +12644,29 @@ await client.query.listNotificationsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListNotificationsOrgRequest` - +**request:** `Payabli.ListNotificationsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12751,7 +12684,6 @@ await client.query.listNotificationsOrg(123, {
Retrieves a list of an organization's suborganizations and their full details such as orgId, users, and settings. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12769,10 +12701,10 @@ Retrieves a list of an organization's suborganizations and their full details su await client.query.listOrganizations(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12787,28 +12719,29 @@ await client.query.listOrganizations(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListOrganizationsRequest` - +**request:** `Payabli.ListOrganizationsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12826,7 +12759,6 @@ await client.query.listOrganizations(123, {
Retrieves a list of money out transactions (payouts) for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12844,10 +12776,10 @@ Retrieves a list of money out transactions (payouts) for a paypoint. Use filters await client.query.listPayout("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12861,29 +12793,30 @@ await client.query.listPayout("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListPayoutRequest` - +**request:** `Payabli.ListPayoutRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12901,7 +12834,6 @@ await client.query.listPayout("8cfec329267", {
Retrieves a list of money out transactions (payouts) for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12919,10 +12851,10 @@ Retrieves a list of money out transactions (payouts) for an organization. Use fi await client.query.listPayoutOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -12937,28 +12869,29 @@ await client.query.listPayoutOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListPayoutOrgRequest` - +**request:** `Payabli.ListPayoutOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -12976,7 +12909,6 @@ await client.query.listPayoutOrg(123, {
Returns a list of paypoints in an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -12994,10 +12926,10 @@ Returns a list of paypoints in an organization. Use filters to limit results. In await client.query.listPaypoints(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13012,28 +12944,29 @@ await client.query.listPaypoints(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListPaypointsRequest` - +**request:** `Payabli.ListPaypointsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13051,7 +12984,6 @@ await client.query.listPaypoints(123, {
Retrieve a list of settled transactions for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13069,10 +13001,10 @@ Retrieve a list of settled transactions for a paypoint. Use filters to limit res await client.query.listSettlements("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13086,29 +13018,30 @@ await client.query.listSettlements("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListSettlementsRequest` - +**request:** `Payabli.ListSettlementsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13126,7 +13059,6 @@ await client.query.listSettlements("8cfec329267", {
Retrieve a list of settled transactions for an organization. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13144,10 +13076,10 @@ Retrieve a list of settled transactions for an organization. Include the `export await client.query.listSettlementsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13162,28 +13094,29 @@ await client.query.listSettlementsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListSettlementsOrgRequest` - +**request:** `Payabli.ListSettlementsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13201,7 +13134,6 @@ await client.query.listSettlementsOrg(123, {
Returns a list of subscriptions for a single paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13219,10 +13151,10 @@ Returns a list of subscriptions for a single paypoint. Use filters to limit resu await client.query.listSubscriptions("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13236,29 +13168,30 @@ await client.query.listSubscriptions("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListSubscriptionsRequest` - +**request:** `Payabli.ListSubscriptionsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13276,7 +13209,6 @@ await client.query.listSubscriptions("8cfec329267", {
Returns a list of subscriptions for a single org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13294,10 +13226,10 @@ Returns a list of subscriptions for a single org. Use filters to limit results. await client.query.listSubscriptionsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13312,28 +13244,29 @@ await client.query.listSubscriptionsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListSubscriptionsOrgRequest` - +**request:** `Payabli.ListSubscriptionsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13352,14 +13285,12 @@ await client.query.listSubscriptionsOrg(123, { Retrieve a list of transactions for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. By default, this endpoint returns only transactions from the last 60 days. To query transactions outside of this period, include `transactionDate` filters. -For example, this request parameters filter for transactions between April 01, 2024 and April 09, 2024. - -```curl --request GET \ +For example, this request parameters filter for transactions between April 01, 2024 and April 09, 2024. +``` curl --request GET \ --url https://sandbox.payabli.com/api/Query/transactions/org/1?limitRecord=20&fromRecord=0&transactionDate(ge)=2024-04-01T00:00:00&transactionDate(le)=2024-04-09T23:59:59\ --header 'requestToken: ' -``` - + ``` @@ -13377,10 +13308,10 @@ For example, this request parameters filter for transactions between April 01, 2 await client.query.listTransactions("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13394,29 +13325,30 @@ await client.query.listTransactions("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListTransactionsRequest` - +**request:** `Payabli.ListTransactionsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13433,20 +13365,21 @@ await client.query.listTransactions("8cfec329267", {
+ Retrieve a list of transactions for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. + By default, this endpoint returns only transactions from the last 60 days. To query transactions outside of this period, include `transactionDate` filters. -For example, this request parameters filter for transactions between April 01, 2024 and April 09, 2024. +For example, this request parameters filter for transactions between April 01, 2024 and April 09, 2024. ``` curl --request GET \ --url https://sandbox.payabli.com/api/Query/transactions/org/1?limitRecord=20&fromRecord=0&transactionDate(ge)=2024-04-01T00:00:00&transactionDate(le)=2024-04-09T23:59:59\ --header 'requestToken: ' -``` - + ```
@@ -13464,10 +13397,10 @@ curl --request GET \ await client.query.listTransactionsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13482,28 +13415,29 @@ await client.query.listTransactionsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListTransactionsOrgRequest` - +**request:** `Payabli.ListTransactionsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13521,7 +13455,6 @@ await client.query.listTransactionsOrg(123, {
Retrieve a list of transfer details records for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13537,8 +13470,8 @@ Retrieve a list of transfer details records for a paypoint. Use filters to limit ```typescript await client.query.listTransferDetails("47862acd", 123456); -``` +``` @@ -13552,8 +13485,8 @@ await client.query.listTransferDetails("47862acd", 123456);
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
@@ -13561,28 +13494,29 @@ await client.query.listTransferDetails("47862acd", 123456);
**transferId:** `number` — The numeric identifier for the transfer, assigned by Payabli. - +
-**request:** `Payabli.ListTransfersPaypointRequest` - +**request:** `Payabli.ListTransfersPaypointRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13600,7 +13534,6 @@ await client.query.listTransferDetails("47862acd", 123456);
Retrieve a list of transfers for a paypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13617,10 +13550,10 @@ Retrieve a list of transfers for a paypoint. Use filters to limit results. Inclu ```typescript await client.query.listTransfers("47862acd", { fromRecord: 0, - limitRecord: 20, + limitRecord: 20 }); -``` +``` @@ -13634,29 +13567,30 @@ await client.query.listTransfers("47862acd", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListTransfersRequest` - +**request:** `Payabli.ListTransfersRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13674,7 +13608,6 @@ await client.query.listTransfers("47862acd", {
Retrieve a list of transfers for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13692,10 +13625,10 @@ Retrieve a list of transfers for an org. Use filters to limit results. Include t await client.query.listTransfersOrg({ orgId: 123, fromRecord: 0, - limitRecord: 20, + limitRecord: 20 }); -``` +``` @@ -13709,21 +13642,22 @@ await client.query.listTransfersOrg({
-**request:** `Payabli.ListTransfersRequestOrg` - +**request:** `Payabli.ListTransfersRequestOrg` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13741,7 +13675,6 @@ await client.query.listTransfersOrg({
Get list of users for an org. Use filters to limit results. -
@@ -13759,10 +13692,10 @@ Get list of users for an org. Use filters to limit results. await client.query.listUsersOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13777,28 +13710,29 @@ await client.query.listUsersOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListUsersOrgRequest` - +**request:** `Payabli.ListUsersOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13816,7 +13750,6 @@ await client.query.listUsersOrg(123, {
Get list of users for a paypoint. Use filters to limit results. -
@@ -13834,10 +13767,10 @@ Get list of users for a paypoint. Use filters to limit results. await client.query.listUsersPaypoint("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13852,28 +13785,29 @@ await client.query.listUsersPaypoint("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListUsersPaypointRequest` - +**request:** `Payabli.ListUsersPaypointRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13891,7 +13825,6 @@ await client.query.listUsersPaypoint("8cfec329267", {
Retrieve a list of vendors for an entrypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13909,10 +13842,10 @@ Retrieve a list of vendors for an entrypoint. Use filters to limit results. Incl await client.query.listVendors("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -13927,28 +13860,29 @@ await client.query.listVendors("8cfec329267", {
**entry:** `string` — The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - +
-**request:** `Payabli.ListVendorsRequest` - +**request:** `Payabli.ListVendorsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -13966,7 +13900,6 @@ await client.query.listVendors("8cfec329267", {
Retrieve a list of vendors for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -13984,10 +13917,10 @@ Retrieve a list of vendors for an organization. Use filters to limit results. In await client.query.listVendorsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -14002,28 +13935,29 @@ await client.query.listVendorsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListVendorsOrgRequest` - +**request:** `Payabli.ListVendorsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -14041,7 +13975,6 @@ await client.query.listVendorsOrg(123, {
Retrieve a list of vcards (virtual credit cards) issued for an entrypoint. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -14059,10 +13992,10 @@ Retrieve a list of vcards (virtual credit cards) issued for an entrypoint. Use f await client.query.listVcards("8cfec329267", { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -14076,29 +14009,30 @@ await client.query.listVcards("8cfec329267", {
-**entry:** `Payabli.Entry` - +**entry:** `Payabli.Entry` +
-**request:** `Payabli.ListVcardsRequest` - +**request:** `Payabli.ListVcardsRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ @@ -14116,7 +14050,6 @@ await client.query.listVcards("8cfec329267", {
Retrieve a list of vcards (virtual credit cards) issued for an organization. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. -
@@ -14134,10 +14067,10 @@ Retrieve a list of vcards (virtual credit cards) issued for an organization. Use await client.query.listVcardsOrg(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -14152,34 +14085,34 @@ await client.query.listVcardsOrg(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListVcardsOrgRequest` - +**request:** `Payabli.ListVcardsOrgRequest` +
-**requestOptions:** `Query.RequestOptions` - +**requestOptions:** `QueryClient.RequestOptions` +
+ ## Statistic -
client.statistic.basicStats(mode, freq, level, entryId, { ...params }) -> Payabli.StatBasicExtendedQueryRecord[]
@@ -14192,8 +14125,7 @@ await client.query.listVcardsOrg(123, {
-Retrieves the basic statistics for an organization or a paypoint, for a given time period, grouped by a particular frequency. - +Retrieves the basic statistics for an organization or a paypoint, for a given time period, grouped by a particular frequency.
@@ -14210,10 +14142,10 @@ Retrieves the basic statistics for an organization or a paypoint, for a given ti ```typescript await client.statistic.basicStats("ytd", "m", 1, 1000000, { endDate: "2025-11-01", - startDate: "2025-11-30", + startDate: "2025-11-30" }); -``` +```
@@ -14227,7 +14159,7 @@ await client.statistic.basicStats("ytd", "m", 1, 1000000, {
-**mode:** `string` +**mode:** `string` Mode for the request. Allowed values: @@ -14243,14 +14175,15 @@ Mode for the request. Allowed values: - `lastm` - Last Month - `lastw` - Last Week - `yesterday` - Last Day - + +
-**freq:** `string` +**freq:** `string` Frequency to group series. Allowed values: @@ -14260,20 +14193,19 @@ Frequency to group series. Allowed values: - `h` - hourly For example, `w` groups the results by week. - +
-**level:** `number` - -The entry level for the request: - -- 0 for Organization -- 2 for Paypoint +**level:** `number` +The entry level for the request: + - 0 for Organization + - 2 for Paypoint +
@@ -14281,28 +14213,29 @@ The entry level for the request:
**entryId:** `number` — Identifier in Payabli for the entity. - +
-**request:** `Payabli.BasicStatsRequest` - +**request:** `Payabli.BasicStatsRequest` +
-**requestOptions:** `Statistic.RequestOptions` - +**requestOptions:** `StatisticClient.RequestOptions` +
+
@@ -14319,8 +14252,7 @@ The entry level for the request:
-Retrieves the basic statistics for a customer for a specific time period, grouped by a selected frequency. - +Retrieves the basic statistics for a customer for a specific time period, grouped by a selected frequency.
@@ -14336,8 +14268,8 @@ Retrieves the basic statistics for a customer for a specific time period, groupe ```typescript await client.statistic.customerBasicStats("ytd", "m", 998); -``` +``` @@ -14351,7 +14283,7 @@ await client.statistic.customerBasicStats("ytd", "m", 998);
-**mode:** `string` +**mode:** `string` Mode for request. Allowed values: @@ -14366,14 +14298,14 @@ Mode for request. Allowed values: - `lastm` - Last Month - `lastw` - Last Week - `yesterday` - Last Day - +
-**freq:** `string` +**freq:** `string` Frequency to group series. Allowed values: @@ -14383,36 +14315,37 @@ Frequency to group series. Allowed values: - `h` - hourly For example, `w` groups the results by week. - +
-**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - +**customerId:** `number` — Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. +
-**request:** `Payabli.CustomerBasicStatsRequest` - +**request:** `Payabli.CustomerBasicStatsRequest` +
-**requestOptions:** `Statistic.RequestOptions` - +**requestOptions:** `StatisticClient.RequestOptions` +
+ @@ -14430,7 +14363,6 @@ For example, `w` groups the results by week.
Retrieves the subscription statistics for a given interval for a paypoint or organization. -
@@ -14446,8 +14378,8 @@ Retrieves the subscription statistics for a given interval for a paypoint or org ```typescript await client.statistic.subStats("30", 1, 1000000); -``` +``` @@ -14461,7 +14393,7 @@ await client.statistic.subStats("30", 1, 1000000);
-**interval:** `string` +**interval:** `string` Interval to get the data. Allowed values: @@ -14470,20 +14402,19 @@ Interval to get the data. Allowed values: - `60` - 31-60 days - `90` - 61-90 days - `plus` - +90 days - +
-**level:** `number` - -The entry level for the request: - -- 0 for Organization -- 2 for Paypoint +**level:** `number` +The entry level for the request: + - 0 for Organization + - 2 for Paypoint +
@@ -14491,28 +14422,29 @@ The entry level for the request:
**entryId:** `number` — Identifier in Payabli for the entity. - +
-**request:** `Payabli.SubStatsRequest` - +**request:** `Payabli.SubStatsRequest` +
-**requestOptions:** `Statistic.RequestOptions` - +**requestOptions:** `StatisticClient.RequestOptions` +
+ @@ -14529,8 +14461,7 @@ The entry level for the request:
-Retrieve the basic statistics about a vendor for a given time period, grouped by frequency. - +Retrieve the basic statistics about a vendor for a given time period, grouped by frequency.
@@ -14546,8 +14477,8 @@ Retrieve the basic statistics about a vendor for a given time period, grouped by ```typescript await client.statistic.vendorBasicStats("ytd", "m", 1); -``` +``` @@ -14561,7 +14492,7 @@ await client.statistic.vendorBasicStats("ytd", "m", 1);
-**mode:** `string` +**mode:** `string` Mode for request. Allowed values: @@ -14576,14 +14507,14 @@ Mode for request. Allowed values: - `lastm` - Last Month - `lastw` - Last Week - `yesterday` - Last Day - +
-**freq:** `string` +**freq:** `string` Frequency to group series. Allowed values: @@ -14593,7 +14524,7 @@ Frequency to group series. Allowed values: - `h` - hourly For example, `w` groups the results by week. - +
@@ -14601,34 +14532,34 @@ For example, `w` groups the results by week.
**idVendor:** `number` — Vendor ID. - +
-**request:** `Payabli.VendorBasicStatsRequest` - +**request:** `Payabli.VendorBasicStatsRequest` +
-**requestOptions:** `Statistic.RequestOptions` - +**requestOptions:** `StatisticClient.RequestOptions` +
+ ## Subscription -
client.subscription.getSubscription(subId) -> Payabli.SubscriptionQueryRecords
@@ -14642,7 +14573,6 @@ For example, `w` groups the results by week.
Retrieves a single subscription's details. -
@@ -14658,8 +14588,8 @@ Retrieves a single subscription's details. ```typescript await client.subscription.getSubscription(263); -``` +``` @@ -14673,21 +14603,22 @@ await client.subscription.getSubscription(263);
-**subId:** `number` — The subscription ID. - +**subId:** `number` — The subscription ID. +
-**requestOptions:** `Subscription.RequestOptions` - +**requestOptions:** `SubscriptionClient.RequestOptions` +
+
@@ -14704,8 +14635,7 @@ await client.subscription.getSubscription(263);
-Creates a subscription or scheduled payment to run at a specified time and frequency. - +Creates a subscription or scheduled payment to run at a specified time and frequency.
@@ -14723,12 +14653,12 @@ Creates a subscription or scheduled payment to run at a specified time and frequ await client.subscription.newSubscription({ body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", paymentDetails: { serviceFee: 0, - totalAmount: 100, + totalAmount: 100 }, paymentMethod: { cardcvv: "123", @@ -14737,18 +14667,18 @@ await client.subscription.newSubscription({ cardnumber: "4111111111111111", cardzip: "37615", initiator: "payor", - method: "card", + method: "card" }, scheduleDetails: { endDate: "03-20-2025", frequency: "weekly", planId: 1, - startDate: "09-20-2024", - }, - }, + startDate: "09-20-2024" + } + } }); -``` +``` @@ -14762,21 +14692,22 @@ await client.subscription.newSubscription({
-**request:** `Payabli.RequestSchedule` - +**request:** `Payabli.RequestSchedule` +
-**requestOptions:** `Subscription.RequestOptions` - +**requestOptions:** `SubscriptionClient.RequestOptions` +
+ @@ -14794,7 +14725,6 @@ await client.subscription.newSubscription({
Deletes a subscription, autopay, or recurring payment and prevents future charges. -
@@ -14810,8 +14740,8 @@ Deletes a subscription, autopay, or recurring payment and prevents future charge ```typescript await client.subscription.removeSubscription(396); -``` +``` @@ -14825,21 +14755,22 @@ await client.subscription.removeSubscription(396);
-**subId:** `number` — The subscription ID. - +**subId:** `number` — The subscription ID. +
-**requestOptions:** `Subscription.RequestOptions` - +**requestOptions:** `SubscriptionClient.RequestOptions` +
+ @@ -14857,7 +14788,6 @@ await client.subscription.removeSubscription(396);
Updates a subscription's details. -
@@ -14873,10 +14803,10 @@ Updates a subscription's details. ```typescript await client.subscription.updateSubscription(231, { - setPause: true, + setPause: true }); -``` +``` @@ -14890,35 +14820,35 @@ await client.subscription.updateSubscription(231, {
-**subId:** `number` — The subscription ID. - +**subId:** `number` — The subscription ID. +
-**request:** `Payabli.RequestUpdateSchedule` - +**request:** `Payabli.RequestUpdateSchedule` +
-**requestOptions:** `Subscription.RequestOptions` - +**requestOptions:** `SubscriptionClient.RequestOptions` +
+ ## Templates -
client.templates.deleteTemplate(templateId) -> Payabli.PayabliApiResponseTemplateId
@@ -14931,8 +14861,7 @@ await client.subscription.updateSubscription(231, {
-Deletes a template by ID. - +Deletes a template by ID.
@@ -14948,8 +14877,8 @@ Deletes a template by ID. ```typescript await client.templates.deleteTemplate(80); -``` +```
@@ -14964,20 +14893,21 @@ await client.templates.deleteTemplate(80);
**templateId:** `number` — The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - +
-**requestOptions:** `Templates.RequestOptions` - +**requestOptions:** `TemplatesClient.RequestOptions` +
+
@@ -14995,7 +14925,6 @@ await client.templates.deleteTemplate(80);
Generates a boarding link from a boarding template. -
@@ -15011,8 +14940,8 @@ Generates a boarding link from a boarding template. ```typescript await client.templates.getlinkTemplate(80, true); -``` +``` @@ -15027,7 +14956,7 @@ await client.templates.getlinkTemplate(80, true);
**templateId:** `number` — The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - +
@@ -15035,20 +14964,21 @@ await client.templates.getlinkTemplate(80, true);
**ignoreEmpty:** `boolean` — Ignore read-only and empty fields Default is `false`. If `ignoreEmpty` = `false` and any field is empty, then the request returns a failure response. If `ignoreEmpty` = `true`, the request returns the boarding link name regardless of whether fields are empty. - +
-**requestOptions:** `Templates.RequestOptions` - +**requestOptions:** `TemplatesClient.RequestOptions` +
+ @@ -15066,7 +14996,6 @@ await client.templates.getlinkTemplate(80, true);
Retrieves a boarding template's details by ID. -
@@ -15082,8 +15011,8 @@ Retrieves a boarding template's details by ID. ```typescript await client.templates.getTemplate(80); -``` +``` @@ -15098,20 +15027,21 @@ await client.templates.getTemplate(80);
**templateId:** `number` — The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - +
-**requestOptions:** `Templates.RequestOptions` - +**requestOptions:** `TemplatesClient.RequestOptions` +
+ @@ -15129,7 +15059,6 @@ await client.templates.getTemplate(80);
Retrieves a list of boarding templates for an organization. Use filters to limit results. You can't make a request that includes filters from the API console in the documentation. The response won't be filtered. Instead, copy the request, remove `parameters=` and run the request in a different client. -
@@ -15147,10 +15076,10 @@ Retrieves a list of boarding templates for an organization. Use filters to limit await client.templates.listTemplates(123, { fromRecord: 251, limitRecord: 0, - sortBy: "desc(field_name)", + sortBy: "desc(field_name)" }); -``` +``` @@ -15165,34 +15094,34 @@ await client.templates.listTemplates(123, {
**orgId:** `number` — The numeric identifier for organization, assigned by Payabli. - +
-**request:** `Payabli.ListTemplatesRequest` - +**request:** `Payabli.ListTemplatesRequest` +
-**requestOptions:** `Templates.RequestOptions` - +**requestOptions:** `TemplatesClient.RequestOptions` +
+ ## TokenStorage -
client.tokenStorage.addMethod({ ...params }) -> Payabli.AddMethodResponse
@@ -15206,7 +15135,6 @@ await client.templates.listTemplates(123, {
Saves a payment method for reuse. This call exchanges sensitive payment information for a token that can be used to process future transactions. The `ReferenceId` value in the response is the `storedMethodId` to use with transactions. -
@@ -15224,7 +15152,7 @@ Saves a payment method for reuse. This call exchanges sensitive payment informat await client.tokenStorage.addMethod({ body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", fallbackAuth: true, @@ -15234,12 +15162,12 @@ await client.tokenStorage.addMethod({ cardHolder: "John Doe", cardnumber: "4111111111111111", cardzip: "12345", - method: "card", - }, - }, + method: "card" + } + } }); -``` +``` @@ -15253,21 +15181,22 @@ await client.tokenStorage.addMethod({
-**request:** `Payabli.AddMethodRequest` - +**request:** `Payabli.AddMethodRequest` +
-**requestOptions:** `TokenStorage.RequestOptions` - +**requestOptions:** `TokenStorageClient.RequestOptions` +
+
@@ -15285,7 +15214,6 @@ await client.tokenStorage.addMethod({
Retrieves details for a saved payment method. -
@@ -15302,10 +15230,10 @@ Retrieves details for a saved payment method. ```typescript await client.tokenStorage.getMethod("32-8877drt00045632-678", { cardExpirationFormat: 1, - includeTemporary: false, + includeTemporary: false }); -``` +``` @@ -15320,28 +15248,29 @@ await client.tokenStorage.getMethod("32-8877drt00045632-678", {
**methodId:** `string` — The saved payment method ID. - +
-**request:** `Payabli.GetMethodRequest` - +**request:** `Payabli.GetMethodRequest` +
-**requestOptions:** `TokenStorage.RequestOptions` - +**requestOptions:** `TokenStorageClient.RequestOptions` +
+ @@ -15359,7 +15288,6 @@ await client.tokenStorage.getMethod("32-8877drt00045632-678", {
Deletes a saved payment method. -
@@ -15375,8 +15303,8 @@ Deletes a saved payment method. ```typescript await client.tokenStorage.removeMethod("32-8877drt00045632-678"); -``` +``` @@ -15391,20 +15319,21 @@ await client.tokenStorage.removeMethod("32-8877drt00045632-678");
**methodId:** `string` — The saved payment method ID. - +
-**requestOptions:** `TokenStorage.RequestOptions` - +**requestOptions:** `TokenStorageClient.RequestOptions` +
+ @@ -15422,7 +15351,6 @@ await client.tokenStorage.removeMethod("32-8877drt00045632-678");
Updates a saved payment method. -
@@ -15440,7 +15368,7 @@ Updates a saved payment method. await client.tokenStorage.updateMethod("32-8877drt00045632-678", { body: { customerData: { - customerId: 4440, + customerId: 4440 }, entryPoint: "f743aed24a", fallbackAuth: true, @@ -15450,12 +15378,12 @@ await client.tokenStorage.updateMethod("32-8877drt00045632-678", { cardHolder: "John Doe", cardnumber: "4111111111111111", cardzip: "12345", - method: "card", - }, - }, + method: "card" + } + } }); -``` +``` @@ -15470,34 +15398,34 @@ await client.tokenStorage.updateMethod("32-8877drt00045632-678", {
**methodId:** `string` — The saved payment method ID. - +
-**request:** `Payabli.UpdateMethodRequest` - +**request:** `Payabli.UpdateMethodRequest` +
-**requestOptions:** `TokenStorage.RequestOptions` - +**requestOptions:** `TokenStorageClient.RequestOptions` +
+ ## User -
client.user.addUser({ ...params }) -> Payabli.AddUserResponse
@@ -15511,7 +15439,6 @@ await client.tokenStorage.updateMethod("32-8877drt00045632-678", {
Use this endpoint to add a new user to an organization. -
@@ -15527,8 +15454,8 @@ Use this endpoint to add a new user to an organization. ```typescript await client.user.addUser({}); -``` +``` @@ -15542,21 +15469,22 @@ await client.user.addUser({});
-**request:** `Payabli.UserData` - +**request:** `Payabli.UserData` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+
@@ -15574,7 +15502,6 @@ await client.user.addUser({});
Use this endpoint to refresh the authentication token for a user within an organization. -
@@ -15590,8 +15517,8 @@ Use this endpoint to refresh the authentication token for a user within an organ ```typescript await client.user.authRefreshUser(); -``` +``` @@ -15605,13 +15532,14 @@ await client.user.authRefreshUser();
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15629,7 +15557,6 @@ await client.user.authRefreshUser();
Use this endpoint to initiate a password reset for a user within an organization. -
@@ -15645,8 +15572,8 @@ Use this endpoint to initiate a password reset for a user within an organization ```typescript await client.user.authResetUser(); -``` +``` @@ -15660,21 +15587,22 @@ await client.user.authResetUser();
-**request:** `Payabli.UserAuthResetRequest` - +**request:** `Payabli.UserAuthResetRequest` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15692,7 +15620,6 @@ await client.user.authResetUser();
This endpoint requires an application API token. -
@@ -15708,8 +15635,8 @@ This endpoint requires an application API token. ```typescript await client.user.authUser("provider"); -``` +``` @@ -15724,28 +15651,29 @@ await client.user.authUser("provider");
**provider:** `string` — Auth provider. This fields is optional and defaults to null for the built-in provider. - +
-**request:** `Payabli.UserAuthRequest` - +**request:** `Payabli.UserAuthRequest` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15763,7 +15691,6 @@ await client.user.authUser("provider");
Use this endpoint to change the password for a user within an organization. -
@@ -15779,8 +15706,8 @@ Use this endpoint to change the password for a user within an organization. ```typescript await client.user.changePswUser(); -``` +``` @@ -15794,21 +15721,22 @@ await client.user.changePswUser();
-**request:** `Payabli.UserAuthPswResetRequest` - +**request:** `Payabli.UserAuthPswResetRequest` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15826,7 +15754,6 @@ await client.user.changePswUser();
Use this endpoint to delete a specific user within an organization. -
@@ -15842,8 +15769,8 @@ Use this endpoint to delete a specific user within an organization. ```typescript await client.user.deleteUser(1000000); -``` +``` @@ -15858,20 +15785,21 @@ await client.user.deleteUser(1000000);
**userId:** `number` — The Payabli-generated `userId` value. - +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15889,7 +15817,6 @@ await client.user.deleteUser(1000000);
Use this endpoint to enable or disable multi-factor authentication (MFA) for a user within an organization. -
@@ -15905,8 +15832,8 @@ Use this endpoint to enable or disable multi-factor authentication (MFA) for a u ```typescript await client.user.editMfaUser(1000000, {}); -``` +``` @@ -15921,28 +15848,29 @@ await client.user.editMfaUser(1000000, {});
**userId:** `number` — User Identifier - +
-**request:** `Payabli.MfaData` - +**request:** `Payabli.MfaData` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -15960,7 +15888,6 @@ await client.user.editMfaUser(1000000, {});
Use this endpoint to modify the details of a specific user within an organization. -
@@ -15976,8 +15903,8 @@ Use this endpoint to modify the details of a specific user within an organizatio ```typescript await client.user.editUser(1000000, {}); -``` +``` @@ -15992,28 +15919,29 @@ await client.user.editUser(1000000, {});
**userId:** `number` — User Identifier - +
-**request:** `Payabli.UserData` - +**request:** `Payabli.UserData` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -16031,7 +15959,6 @@ await client.user.editUser(1000000, {});
Use this endpoint to retrieve information about a specific user within an organization. -
@@ -16047,10 +15974,10 @@ Use this endpoint to retrieve information about a specific user within an organi ```typescript await client.user.getUser(1000000, { - entry: "478ae1234", + entry: "478ae1234" }); -``` +``` @@ -16065,28 +15992,29 @@ await client.user.getUser(1000000, {
**userId:** `number` — The Payabli-generated `userId` value. - +
-**request:** `Payabli.GetUserRequest` - +**request:** `Payabli.GetUserRequest` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ @@ -16104,7 +16032,6 @@ await client.user.getUser(1000000, {
Use this endpoint to log a user out from the system. -
@@ -16120,8 +16047,8 @@ Use this endpoint to log a user out from the system. ```typescript await client.user.logoutUser(); -``` +``` @@ -16135,18 +16062,19 @@ await client.user.logoutUser();
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+ -
client.user.resendMfaCode(usrname, entry, entryType) -> Payabli.PayabliApiResponseMfaBasic +
client.user.resendMfaCode(usrname, Entry, EntryType) -> Payabli.PayabliApiResponseMfaBasic
@@ -16159,7 +16087,6 @@ await client.user.logoutUser();
Resends the MFA code to the user via the selected MFA mode (email or SMS). -
@@ -16175,8 +16102,8 @@ Resends the MFA code to the user via the selected MFA mode (email or SMS). ```typescript await client.user.resendMfaCode("usrname", "Entry", 1); -``` +``` @@ -16190,37 +16117,38 @@ await client.user.resendMfaCode("usrname", "Entry", 1);
-**usrname:** `string` — - +**usrname:** `string` — +
-**entry:** `string` — - +**Entry:** `string` — +
-**entryType:** `number` — - +**EntryType:** `number` — +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+
@@ -16238,7 +16166,6 @@ await client.user.resendMfaCode("usrname", "Entry", 1);
Use this endpoint to validate the multi-factor authentication (MFA) code for a user within an organization. -
@@ -16254,8 +16181,8 @@ Use this endpoint to validate the multi-factor authentication (MFA) code for a u ```typescript await client.user.validateMfaUser(); -``` +``` @@ -16269,27 +16196,27 @@ await client.user.validateMfaUser();
-**request:** `Payabli.MfaValidationData` - +**request:** `Payabli.MfaValidationData` +
-**requestOptions:** `User.RequestOptions` - +**requestOptions:** `UserClient.RequestOptions` +
+
## Vendor -
client.vendor.addVendor(entry, { ...params }) -> Payabli.PayabliApiResponseVendors
@@ -16303,7 +16230,6 @@ await client.user.validateMfaUser();
Creates a vendor in an entrypoint. -
@@ -16333,14 +16259,12 @@ await client.vendor.addVendor("8cfec329267", { country: "US", mcc: "7777", locationCode: "MIA123", - contacts: [ - { + contacts: [{ contactName: "Herman Martinez", contactEmail: "example@email.com", contactTitle: "Owner", - contactPhone: "3055550000", - }, - ], + contactPhone: "3055550000" + }], billingData: { id: 123, bankName: "Country Bank", @@ -16349,7 +16273,7 @@ await client.vendor.addVendor("8cfec329267", { typeAccount: "Checking", bankAccountHolderName: "Gruzya Adventure Outfitters LLC", bankAccountHolderType: "Business", - bankAccountFunction: 0, + bankAccountFunction: 0 }, paymentMethod: "managed", vendorStatus: 1, @@ -16362,10 +16286,10 @@ await client.vendor.addVendor("8cfec329267", { payeeName1: "", payeeName2: "", customerVendorAccount: "A-37622", - internalReferenceId: 123, + internalReferenceId: 123 }); -``` +``` @@ -16380,28 +16304,29 @@ await client.vendor.addVendor("8cfec329267", {
**entry:** `string` — Entrypoint identifier. - +
-**request:** `Payabli.VendorData` - +**request:** `Payabli.VendorData` +
-**requestOptions:** `Vendor.RequestOptions` - +**requestOptions:** `VendorClient.RequestOptions` +
+
@@ -16418,8 +16343,7 @@ await client.vendor.addVendor("8cfec329267", {
-Delete a vendor. - +Delete a vendor.
@@ -16435,8 +16359,8 @@ Delete a vendor. ```typescript await client.vendor.deleteVendor(1); -``` +``` @@ -16451,20 +16375,21 @@ await client.vendor.deleteVendor(1);
**idVendor:** `number` — Vendor ID. - +
-**requestOptions:** `Vendor.RequestOptions` - +**requestOptions:** `VendorClient.RequestOptions` +
+ @@ -16482,7 +16407,6 @@ await client.vendor.deleteVendor(1);
Updates a vendor's information. Send only the fields you need to update. -
@@ -16498,10 +16422,10 @@ Updates a vendor's information. Send only the fields you need to update. ```typescript await client.vendor.editVendor(1, { - name1: "Theodore's Janitorial", + name1: "Theodore's Janitorial" }); -``` +``` @@ -16516,28 +16440,29 @@ await client.vendor.editVendor(1, {
**idVendor:** `number` — Vendor ID. - +
-**request:** `Payabli.VendorData` - +**request:** `Payabli.VendorData` +
-**requestOptions:** `Vendor.RequestOptions` - +**requestOptions:** `VendorClient.RequestOptions` +
+ @@ -16555,7 +16480,6 @@ await client.vendor.editVendor(1, {
Retrieves a vendor's details. -
@@ -16571,8 +16495,8 @@ Retrieves a vendor's details. ```typescript await client.vendor.getVendor(1); -``` +``` @@ -16587,26 +16511,26 @@ await client.vendor.getVendor(1);
**idVendor:** `number` — Vendor ID. - +
-**requestOptions:** `Vendor.RequestOptions` - +**requestOptions:** `VendorClient.RequestOptions` +
+ ## Wallet -
client.wallet.configureApplePayOrganization({ ...params }) -> Payabli.ConfigureApplePayOrganizationApiResponse
@@ -16620,7 +16544,6 @@ await client.vendor.getVendor(1);
Configure and activate Apple Pay for a Payabli organization -
@@ -16638,10 +16561,10 @@ Configure and activate Apple Pay for a Payabli organization await client.wallet.configureApplePayOrganization({ cascade: true, isEnabled: true, - orgId: 901, + orgId: 901 }); -``` +``` @@ -16655,21 +16578,22 @@ await client.wallet.configureApplePayOrganization({
-**request:** `Payabli.ConfigureOrganizationRequestApplePay` - +**request:** `Payabli.ConfigureOrganizationRequestApplePay` +
-**requestOptions:** `Wallet.RequestOptions` - +**requestOptions:** `WalletClient.RequestOptions` +
+
@@ -16687,7 +16611,6 @@ await client.wallet.configureApplePayOrganization({
Configure and activate Apple Pay for a Payabli paypoint -
@@ -16704,10 +16627,10 @@ Configure and activate Apple Pay for a Payabli paypoint ```typescript await client.wallet.configureApplePayPaypoint({ entry: "8cfec329267", - isEnabled: true, + isEnabled: true }); -``` +``` @@ -16721,21 +16644,22 @@ await client.wallet.configureApplePayPaypoint({
-**request:** `Payabli.ConfigurePaypointRequestApplePay` - +**request:** `Payabli.ConfigurePaypointRequestApplePay` +
-**requestOptions:** `Wallet.RequestOptions` - +**requestOptions:** `WalletClient.RequestOptions` +
+ @@ -16753,7 +16677,6 @@ await client.wallet.configureApplePayPaypoint({
Configure and activate Google Pay for a Payabli organization -
@@ -16771,10 +16694,10 @@ Configure and activate Google Pay for a Payabli organization await client.wallet.configureGooglePayOrganization({ cascade: true, isEnabled: true, - orgId: 901, + orgId: 901 }); -``` +``` @@ -16788,21 +16711,22 @@ await client.wallet.configureGooglePayOrganization({
-**request:** `Payabli.ConfigureOrganizationRequestGooglePay` - +**request:** `Payabli.ConfigureOrganizationRequestGooglePay` +
-**requestOptions:** `Wallet.RequestOptions` - +**requestOptions:** `WalletClient.RequestOptions` +
+ @@ -16820,7 +16744,6 @@ await client.wallet.configureGooglePayOrganization({
Configure and activate Google Pay for a Payabli paypoint -
@@ -16837,10 +16760,10 @@ Configure and activate Google Pay for a Payabli paypoint ```typescript await client.wallet.configureGooglePayPaypoint({ entry: "8cfec329267", - isEnabled: true, + isEnabled: true }); -``` +``` @@ -16854,21 +16777,22 @@ await client.wallet.configureGooglePayPaypoint({
-**request:** `Payabli.ConfigurePaypointRequestGooglePay` - +**request:** `Payabli.ConfigurePaypointRequestGooglePay` +
-**requestOptions:** `Wallet.RequestOptions` - +**requestOptions:** `WalletClient.RequestOptions` +
+ diff --git a/src/BaseClient.ts b/src/BaseClient.ts new file mode 100644 index 00000000..2f33f27c --- /dev/null +++ b/src/BaseClient.ts @@ -0,0 +1,81 @@ +// This file was auto-generated by Fern from our API Definition. + +import { HeaderAuthProvider } from "./auth/HeaderAuthProvider.js"; +import { mergeHeaders } from "./core/headers.js"; +import * as core from "./core/index.js"; +import type * as environments from "./environments.js"; + +export interface BaseClientOptions { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + apiKey?: core.Supplier; + /** Additional headers to include in requests. */ + headers?: Record | null | undefined>; + /** The default maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The default number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */ + fetch?: typeof fetch; + /** Configure logging for the client. */ + logging?: core.logging.LogConfig | core.logging.Logger; +} + +export interface BaseRequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional query string parameters to include in the request. */ + queryParams?: Record; + /** Additional headers to include in the request. */ + headers?: Record | null | undefined>; +} + +export type NormalizedClientOptions = T & { + logging: core.logging.Logger; + authProvider?: core.AuthProvider; +}; + +export type NormalizedClientOptionsWithAuth = NormalizedClientOptions & { + authProvider: core.AuthProvider; +}; + +export function normalizeClientOptions(options: T): NormalizedClientOptions { + const headers = mergeHeaders( + { + "X-Fern-Language": "JavaScript", + "User-Agent": "@payabli/sdk-node/0.0.117", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + }, + options?.headers, + ); + + return { + ...options, + logging: core.logging.createLogger(options?.logging), + headers, + } as NormalizedClientOptions; +} + +export function normalizeClientOptionsWithAuth( + options: T, +): NormalizedClientOptionsWithAuth { + const normalized = normalizeClientOptions(options) as NormalizedClientOptionsWithAuth; + const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized); + normalized.authProvider ??= new HeaderAuthProvider(normalizedWithNoOpAuthProvider); + return normalized; +} + +function withNoOpAuthProvider( + options: NormalizedClientOptions, +): NormalizedClientOptionsWithAuth { + return { + ...options, + authProvider: new core.NoOpAuthProvider(), + }; +} diff --git a/src/Client.ts b/src/Client.ts index 57137090..dafb7220 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -1,218 +1,186 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as environments from "./environments.js"; -import * as core from "./core/index.js"; -import { mergeHeaders } from "./core/headers.js"; -import { Bill } from "./api/resources/bill/client/Client.js"; -import { Boarding } from "./api/resources/boarding/client/Client.js"; -import { ChargeBacks } from "./api/resources/chargeBacks/client/Client.js"; -import { CheckCapture } from "./api/resources/checkCapture/client/Client.js"; -import { Cloud } from "./api/resources/cloud/client/Client.js"; -import { Customer } from "./api/resources/customer/client/Client.js"; -import { Export } from "./api/resources/export/client/Client.js"; -import { HostedPaymentPages } from "./api/resources/hostedPaymentPages/client/Client.js"; -import { Import } from "./api/resources/import/client/Client.js"; -import { Invoice } from "./api/resources/invoice/client/Client.js"; -import { LineItem } from "./api/resources/lineItem/client/Client.js"; -import { MoneyIn } from "./api/resources/moneyIn/client/Client.js"; -import { MoneyOut } from "./api/resources/moneyOut/client/Client.js"; -import { Notification } from "./api/resources/notification/client/Client.js"; -import { Notificationlogs } from "./api/resources/notificationlogs/client/Client.js"; -import { Ocr } from "./api/resources/ocr/client/Client.js"; -import { Organization } from "./api/resources/organization/client/Client.js"; -import { PaymentLink } from "./api/resources/paymentLink/client/Client.js"; -import { PaymentMethodDomain } from "./api/resources/paymentMethodDomain/client/Client.js"; -import { Paypoint } from "./api/resources/paypoint/client/Client.js"; -import { Query } from "./api/resources/query/client/Client.js"; -import { Statistic } from "./api/resources/statistic/client/Client.js"; -import { Subscription } from "./api/resources/subscription/client/Client.js"; -import { Templates } from "./api/resources/templates/client/Client.js"; -import { TokenStorage } from "./api/resources/tokenStorage/client/Client.js"; -import { User } from "./api/resources/user/client/Client.js"; -import { Vendor } from "./api/resources/vendor/client/Client.js"; -import { Wallet } from "./api/resources/wallet/client/Client.js"; +// This file was auto-generated by Fern from our API Definition. + +import { BillClient } from "./api/resources/bill/client/Client.js"; +import { BoardingClient } from "./api/resources/boarding/client/Client.js"; +import { ChargeBacksClient } from "./api/resources/chargeBacks/client/Client.js"; +import { CheckCaptureClient } from "./api/resources/checkCapture/client/Client.js"; +import { CloudClient } from "./api/resources/cloud/client/Client.js"; +import { CustomerClient } from "./api/resources/customer/client/Client.js"; +import { ExportClient } from "./api/resources/export/client/Client.js"; +import { HostedPaymentPagesClient } from "./api/resources/hostedPaymentPages/client/Client.js"; +import { ImportClient } from "./api/resources/import/client/Client.js"; +import { InvoiceClient } from "./api/resources/invoice/client/Client.js"; +import { LineItemClient } from "./api/resources/lineItem/client/Client.js"; +import { MoneyInClient } from "./api/resources/moneyIn/client/Client.js"; +import { MoneyOutClient } from "./api/resources/moneyOut/client/Client.js"; +import { NotificationClient } from "./api/resources/notification/client/Client.js"; +import { NotificationlogsClient } from "./api/resources/notificationlogs/client/Client.js"; +import { OcrClient } from "./api/resources/ocr/client/Client.js"; +import { OrganizationClient } from "./api/resources/organization/client/Client.js"; +import { PaymentLinkClient } from "./api/resources/paymentLink/client/Client.js"; +import { PaymentMethodDomainClient } from "./api/resources/paymentMethodDomain/client/Client.js"; +import { PaypointClient } from "./api/resources/paypoint/client/Client.js"; +import { QueryClient } from "./api/resources/query/client/Client.js"; +import { StatisticClient } from "./api/resources/statistic/client/Client.js"; +import { SubscriptionClient } from "./api/resources/subscription/client/Client.js"; +import { TemplatesClient } from "./api/resources/templates/client/Client.js"; +import { TokenStorageClient } from "./api/resources/tokenStorage/client/Client.js"; +import { UserClient } from "./api/resources/user/client/Client.js"; +import { VendorClient } from "./api/resources/vendor/client/Client.js"; +import { WalletClient } from "./api/resources/wallet/client/Client.js"; +import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "./BaseClient.js"; export declare namespace PayabliClient { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } - - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface Options extends BaseClientOptions {} + + export interface RequestOptions extends BaseRequestOptions {} } export class PayabliClient { - protected readonly _options: PayabliClient.Options; - protected _bill: Bill | undefined; - protected _boarding: Boarding | undefined; - protected _chargeBacks: ChargeBacks | undefined; - protected _checkCapture: CheckCapture | undefined; - protected _cloud: Cloud | undefined; - protected _customer: Customer | undefined; - protected _export: Export | undefined; - protected _hostedPaymentPages: HostedPaymentPages | undefined; - protected _import: Import | undefined; - protected _invoice: Invoice | undefined; - protected _lineItem: LineItem | undefined; - protected _moneyIn: MoneyIn | undefined; - protected _moneyOut: MoneyOut | undefined; - protected _notification: Notification | undefined; - protected _notificationlogs: Notificationlogs | undefined; - protected _ocr: Ocr | undefined; - protected _organization: Organization | undefined; - protected _paymentLink: PaymentLink | undefined; - protected _paymentMethodDomain: PaymentMethodDomain | undefined; - protected _paypoint: Paypoint | undefined; - protected _query: Query | undefined; - protected _statistic: Statistic | undefined; - protected _subscription: Subscription | undefined; - protected _templates: Templates | undefined; - protected _tokenStorage: TokenStorage | undefined; - protected _user: User | undefined; - protected _vendor: Vendor | undefined; - protected _wallet: Wallet | undefined; + protected readonly _options: NormalizedClientOptionsWithAuth; + protected _bill: BillClient | undefined; + protected _boarding: BoardingClient | undefined; + protected _chargeBacks: ChargeBacksClient | undefined; + protected _checkCapture: CheckCaptureClient | undefined; + protected _cloud: CloudClient | undefined; + protected _customer: CustomerClient | undefined; + protected _export: ExportClient | undefined; + protected _hostedPaymentPages: HostedPaymentPagesClient | undefined; + protected _import: ImportClient | undefined; + protected _invoice: InvoiceClient | undefined; + protected _lineItem: LineItemClient | undefined; + protected _moneyIn: MoneyInClient | undefined; + protected _moneyOut: MoneyOutClient | undefined; + protected _notification: NotificationClient | undefined; + protected _notificationlogs: NotificationlogsClient | undefined; + protected _ocr: OcrClient | undefined; + protected _organization: OrganizationClient | undefined; + protected _paymentLink: PaymentLinkClient | undefined; + protected _paymentMethodDomain: PaymentMethodDomainClient | undefined; + protected _paypoint: PaypointClient | undefined; + protected _query: QueryClient | undefined; + protected _statistic: StatisticClient | undefined; + protected _subscription: SubscriptionClient | undefined; + protected _templates: TemplatesClient | undefined; + protected _tokenStorage: TokenStorageClient | undefined; + protected _user: UserClient | undefined; + protected _vendor: VendorClient | undefined; + protected _wallet: WalletClient | undefined; - constructor(_options: PayabliClient.Options = {}) { - this._options = { - ..._options, - headers: mergeHeaders( - { - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "@payabli/sdk-node", - "X-Fern-SDK-Version": "0.0.117", - "User-Agent": "@payabli/sdk-node/0.0.117", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - }, - _options?.headers, - ), - }; + constructor(options: PayabliClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } - public get bill(): Bill { - return (this._bill ??= new Bill(this._options)); + public get bill(): BillClient { + return (this._bill ??= new BillClient(this._options)); } - public get boarding(): Boarding { - return (this._boarding ??= new Boarding(this._options)); + public get boarding(): BoardingClient { + return (this._boarding ??= new BoardingClient(this._options)); } - public get chargeBacks(): ChargeBacks { - return (this._chargeBacks ??= new ChargeBacks(this._options)); + public get chargeBacks(): ChargeBacksClient { + return (this._chargeBacks ??= new ChargeBacksClient(this._options)); } - public get checkCapture(): CheckCapture { - return (this._checkCapture ??= new CheckCapture(this._options)); + public get checkCapture(): CheckCaptureClient { + return (this._checkCapture ??= new CheckCaptureClient(this._options)); } - public get cloud(): Cloud { - return (this._cloud ??= new Cloud(this._options)); + public get cloud(): CloudClient { + return (this._cloud ??= new CloudClient(this._options)); } - public get customer(): Customer { - return (this._customer ??= new Customer(this._options)); + public get customer(): CustomerClient { + return (this._customer ??= new CustomerClient(this._options)); } - public get export(): Export { - return (this._export ??= new Export(this._options)); + public get export(): ExportClient { + return (this._export ??= new ExportClient(this._options)); } - public get hostedPaymentPages(): HostedPaymentPages { - return (this._hostedPaymentPages ??= new HostedPaymentPages(this._options)); + public get hostedPaymentPages(): HostedPaymentPagesClient { + return (this._hostedPaymentPages ??= new HostedPaymentPagesClient(this._options)); } - public get import(): Import { - return (this._import ??= new Import(this._options)); + public get import(): ImportClient { + return (this._import ??= new ImportClient(this._options)); } - public get invoice(): Invoice { - return (this._invoice ??= new Invoice(this._options)); + public get invoice(): InvoiceClient { + return (this._invoice ??= new InvoiceClient(this._options)); } - public get lineItem(): LineItem { - return (this._lineItem ??= new LineItem(this._options)); + public get lineItem(): LineItemClient { + return (this._lineItem ??= new LineItemClient(this._options)); } - public get moneyIn(): MoneyIn { - return (this._moneyIn ??= new MoneyIn(this._options)); + public get moneyIn(): MoneyInClient { + return (this._moneyIn ??= new MoneyInClient(this._options)); } - public get moneyOut(): MoneyOut { - return (this._moneyOut ??= new MoneyOut(this._options)); + public get moneyOut(): MoneyOutClient { + return (this._moneyOut ??= new MoneyOutClient(this._options)); } - public get notification(): Notification { - return (this._notification ??= new Notification(this._options)); + public get notification(): NotificationClient { + return (this._notification ??= new NotificationClient(this._options)); } - public get notificationlogs(): Notificationlogs { - return (this._notificationlogs ??= new Notificationlogs(this._options)); + public get notificationlogs(): NotificationlogsClient { + return (this._notificationlogs ??= new NotificationlogsClient(this._options)); } - public get ocr(): Ocr { - return (this._ocr ??= new Ocr(this._options)); + public get ocr(): OcrClient { + return (this._ocr ??= new OcrClient(this._options)); } - public get organization(): Organization { - return (this._organization ??= new Organization(this._options)); + public get organization(): OrganizationClient { + return (this._organization ??= new OrganizationClient(this._options)); } - public get paymentLink(): PaymentLink { - return (this._paymentLink ??= new PaymentLink(this._options)); + public get paymentLink(): PaymentLinkClient { + return (this._paymentLink ??= new PaymentLinkClient(this._options)); } - public get paymentMethodDomain(): PaymentMethodDomain { - return (this._paymentMethodDomain ??= new PaymentMethodDomain(this._options)); + public get paymentMethodDomain(): PaymentMethodDomainClient { + return (this._paymentMethodDomain ??= new PaymentMethodDomainClient(this._options)); } - public get paypoint(): Paypoint { - return (this._paypoint ??= new Paypoint(this._options)); + public get paypoint(): PaypointClient { + return (this._paypoint ??= new PaypointClient(this._options)); } - public get query(): Query { - return (this._query ??= new Query(this._options)); + public get query(): QueryClient { + return (this._query ??= new QueryClient(this._options)); } - public get statistic(): Statistic { - return (this._statistic ??= new Statistic(this._options)); + public get statistic(): StatisticClient { + return (this._statistic ??= new StatisticClient(this._options)); } - public get subscription(): Subscription { - return (this._subscription ??= new Subscription(this._options)); + public get subscription(): SubscriptionClient { + return (this._subscription ??= new SubscriptionClient(this._options)); } - public get templates(): Templates { - return (this._templates ??= new Templates(this._options)); + public get templates(): TemplatesClient { + return (this._templates ??= new TemplatesClient(this._options)); } - public get tokenStorage(): TokenStorage { - return (this._tokenStorage ??= new TokenStorage(this._options)); + public get tokenStorage(): TokenStorageClient { + return (this._tokenStorage ??= new TokenStorageClient(this._options)); } - public get user(): User { - return (this._user ??= new User(this._options)); + public get user(): UserClient { + return (this._user ??= new UserClient(this._options)); } - public get vendor(): Vendor { - return (this._vendor ??= new Vendor(this._options)); + public get vendor(): VendorClient { + return (this._vendor ??= new VendorClient(this._options)); } - public get wallet(): Wallet { - return (this._wallet ??= new Wallet(this._options)); + public get wallet(): WalletClient { + return (this._wallet ??= new WalletClient(this._options)); } } diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 88f4b4c9..b2740e22 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class BadRequestError extends errors.PayabliError { constructor(body?: unknown, rawResponse?: core.RawResponse) { diff --git a/src/api/errors/ConflictError.ts b/src/api/errors/ConflictError.ts index 0a097140..89d1a505 100644 --- a/src/api/errors/ConflictError.ts +++ b/src/api/errors/ConflictError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Payabli from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Payabli from "../index.js"; export class ConflictError extends errors.PayabliError { constructor(body: Payabli.PayabliApiResponsePaylinks, rawResponse?: core.RawResponse) { diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts index c557cf97..ccaa5ad6 100644 --- a/src/api/errors/ForbiddenError.ts +++ b/src/api/errors/ForbiddenError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Payabli from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Payabli from "../index.js"; export class ForbiddenError extends errors.PayabliError { constructor(body: Payabli.PayabliApiResponsePaylinks, rawResponse?: core.RawResponse) { diff --git a/src/api/errors/InternalServerError.ts b/src/api/errors/InternalServerError.ts index 1a0e4b4f..49156d2f 100644 --- a/src/api/errors/InternalServerError.ts +++ b/src/api/errors/InternalServerError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class InternalServerError extends errors.PayabliError { constructor(body?: unknown, rawResponse?: core.RawResponse) { diff --git a/src/api/errors/ServiceUnavailableError.ts b/src/api/errors/ServiceUnavailableError.ts index 84881685..c1e19615 100644 --- a/src/api/errors/ServiceUnavailableError.ts +++ b/src/api/errors/ServiceUnavailableError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as Payabli from "../index.js"; -import * as core from "../../core/index.js"; +import type * as Payabli from "../index.js"; export class ServiceUnavailableError extends errors.PayabliError { constructor(body: Payabli.PayabliApiResponse, rawResponse?: core.RawResponse) { diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts index 76647219..ec59f7f4 100644 --- a/src/api/errors/UnauthorizedError.ts +++ b/src/api/errors/UnauthorizedError.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../core/index.js"; import * as errors from "../../errors/index.js"; -import * as core from "../../core/index.js"; export class UnauthorizedError extends errors.PayabliError { constructor(body?: unknown, rawResponse?: core.RawResponse) { diff --git a/src/api/index.ts b/src/api/index.ts index b42fc445..6ed44b0b 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,3 +1,3 @@ -export * from "./types/index.js"; -export * from "./resources/index.js"; export * from "./errors/index.js"; +export * from "./resources/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/bill/client/Client.ts b/src/api/resources/bill/client/Client.ts index e914674a..1a684e04 100644 --- a/src/api/resources/bill/client/Client.ts +++ b/src/api/resources/bill/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as errors from "../../../../errors/index.js"; +import * as core from "../../../../core/index.js"; import { toJson } from "../../../../core/json.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Bill { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace BillClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Bill { - protected readonly _options: Bill.Options; +export class BillClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Bill.Options = {}) { - this._options = _options; + constructor(options: BillClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +28,7 @@ export class Bill { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.AddBillRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -92,7 +77,7 @@ export class Bill { public addBill( entry: string, request: Payabli.AddBillRequest, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addBill(entry, request, requestOptions)); } @@ -100,31 +85,34 @@ export class Bill { private async __addBill( entry: string, request: Payabli.AddBillRequest, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { idempotencyKey, body: _body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/single/${encodeURIComponent(entry)}`, + `Bill/single/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillResponse, rawResponse: _response.rawResponse }; @@ -152,21 +140,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Bill/single/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Bill/single/{entry}"); } /** @@ -190,7 +164,7 @@ export class Bill { * } * ``` * @param {Payabli.DeleteAttachedFromBillRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -204,7 +178,7 @@ export class Bill { idBill: number, filename: string, request: Payabli.DeleteAttachedFromBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__deleteAttachedFromBill(idBill, filename, request, requestOptions), @@ -215,31 +189,35 @@ export class Bill { idBill: number, filename: string, request: Payabli.DeleteAttachedFromBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { returnObject } = request; const _queryParams: Record = {}; if (returnObject != null) { - _queryParams["returnObject"] = returnObject.toString(); + _queryParams.returnObject = returnObject.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/attachedFileFromBill/${encodeURIComponent(idBill)}/${encodeURIComponent(filename)}`, + `Bill/attachedFileFromBill/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(filename)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillResponse, rawResponse: _response.rawResponse }; @@ -267,30 +245,19 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /Bill/attachedFileFromBill/{idBill}/{filename}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/Bill/attachedFileFromBill/{idBill}/{filename}", + ); } /** * Deletes a bill by ID. * * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -302,31 +269,36 @@ export class Bill { */ public deleteBill( idBill: number, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteBill(idBill, requestOptions)); } private async __deleteBill( idBill: number, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/${encodeURIComponent(idBill)}`, + `Bill/${core.url.encodePathParam(idBill)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillResponse, rawResponse: _response.rawResponse }; @@ -354,21 +326,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Bill/{idBill}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Bill/{idBill}"); } /** @@ -376,7 +334,7 @@ export class Bill { * * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. * @param {Payabli.BillOutData} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -392,7 +350,7 @@ export class Bill { public editBill( idBill: number, request: Payabli.BillOutData, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editBill(idBill, request, requestOptions)); } @@ -400,27 +358,32 @@ export class Bill { private async __editBill( idBill: number, request: Payabli.BillOutData, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/${encodeURIComponent(idBill)}`, + `Bill/${core.url.encodePathParam(idBill)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.EditBillResponse, rawResponse: _response.rawResponse }; @@ -448,21 +411,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Bill/{idBill}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Bill/{idBill}"); } /** @@ -481,7 +430,7 @@ export class Bill { * ] * } * @param {Payabli.GetAttachedFromBillRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -497,7 +446,7 @@ export class Bill { idBill: number, filename: string, request: Payabli.GetAttachedFromBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__getAttachedFromBill(idBill, filename, request, requestOptions), @@ -508,31 +457,35 @@ export class Bill { idBill: number, filename: string, request: Payabli.GetAttachedFromBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { returnObject } = request; const _queryParams: Record = {}; if (returnObject != null) { - _queryParams["returnObject"] = returnObject.toString(); + _queryParams.returnObject = returnObject.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/attachedFileFromBill/${encodeURIComponent(idBill)}/${encodeURIComponent(filename)}`, + `Bill/attachedFileFromBill/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(filename)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.FileContent, rawResponse: _response.rawResponse }; @@ -560,30 +513,19 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Bill/attachedFileFromBill/{idBill}/{filename}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Bill/attachedFileFromBill/{idBill}/{filename}", + ); } /** * Retrieves a bill by ID from an entrypoint. * * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -595,31 +537,36 @@ export class Bill { */ public getBill( idBill: number, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getBill(idBill, requestOptions)); } private async __getBill( idBill: number, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/${encodeURIComponent(idBill)}`, + `Bill/${core.url.encodePathParam(idBill)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetBillResponse, rawResponse: _response.rawResponse }; @@ -647,21 +594,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Bill/{idBill}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Bill/{idBill}"); } /** @@ -669,7 +602,7 @@ export class Bill { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListBillsRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -686,7 +619,7 @@ export class Bill { public listBills( entry: string, request: Payabli.ListBillsRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBills(entry, request, requestOptions)); } @@ -694,47 +627,51 @@ export class Bill { private async __listBills( entry: string, request: Payabli.ListBillsRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/bills/${encodeURIComponent(entry)}`, + `Query/bills/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillQueryResponse, rawResponse: _response.rawResponse }; @@ -762,21 +699,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/bills/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/bills/{entry}"); } /** @@ -784,7 +707,7 @@ export class Bill { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListBillsOrgRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -801,7 +724,7 @@ export class Bill { public listBillsOrg( orgId: number, request: Payabli.ListBillsOrgRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBillsOrg(orgId, request, requestOptions)); } @@ -809,47 +732,51 @@ export class Bill { private async __listBillsOrg( orgId: number, request: Payabli.ListBillsOrgRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/bills/org/${encodeURIComponent(orgId)}`, + `Query/bills/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillQueryResponse, rawResponse: _response.rawResponse }; @@ -877,21 +804,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/bills/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/bills/org/{orgId}"); } /** @@ -899,7 +812,7 @@ export class Bill { * * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. * @param {string[]} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -912,7 +825,7 @@ export class Bill { public modifyApprovalBill( idBill: number, request: string[], - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__modifyApprovalBill(idBill, request, requestOptions)); } @@ -920,27 +833,32 @@ export class Bill { private async __modifyApprovalBill( idBill: number, request: string[], - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/approval/${encodeURIComponent(idBill)}`, + `Bill/approval/${core.url.encodePathParam(idBill)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ModifyApprovalBillResponse, rawResponse: _response.rawResponse }; @@ -968,21 +886,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Bill/approval/{idBill}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Bill/approval/{idBill}"); } /** @@ -990,7 +894,7 @@ export class Bill { * * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. * @param {Payabli.SendToApprovalBillRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1006,7 +910,7 @@ export class Bill { public sendToApprovalBill( idBill: number, request: Payabli.SendToApprovalBillRequest, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sendToApprovalBill(idBill, request, requestOptions)); } @@ -1014,37 +918,39 @@ export class Bill { private async __sendToApprovalBill( idBill: number, request: Payabli.SendToApprovalBillRequest, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { autocreateUser, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (autocreateUser != null) { - _queryParams["autocreateUser"] = autocreateUser.toString(); + _queryParams.autocreateUser = autocreateUser.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/approval/${encodeURIComponent(idBill)}`, + `Bill/approval/${core.url.encodePathParam(idBill)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillResponse, rawResponse: _response.rawResponse }; @@ -1072,21 +978,7 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Bill/approval/{idBill}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Bill/approval/{idBill}"); } /** @@ -1095,7 +987,7 @@ export class Bill { * @param {number} idBill - Payabli ID for the bill. Get this ID by querying `/api/Query/bills/` for the entrypoint or the organization. * @param {string} approved - String representing the approved status. Accepted values: 'true' or 'false'. * @param {Payabli.SetApprovedBillRequest} request - * @param {Bill.RequestOptions} requestOptions - Request-specific configuration. + * @param {BillClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1109,7 +1001,7 @@ export class Bill { idBill: number, approved: string, request: Payabli.SetApprovedBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__setApprovedBill(idBill, approved, request, requestOptions)); } @@ -1118,31 +1010,35 @@ export class Bill { idBill: number, approved: string, request: Payabli.SetApprovedBillRequest = {}, - requestOptions?: Bill.RequestOptions, + requestOptions?: BillClient.RequestOptions, ): Promise> { const { email } = request; const _queryParams: Record = {}; if (email != null) { - _queryParams["email"] = email; + _queryParams.email = email; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Bill/approval/${encodeURIComponent(idBill)}/${encodeURIComponent(approved)}`, + `Bill/approval/${core.url.encodePathParam(idBill)}/${core.url.encodePathParam(approved)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.SetApprovedBillResponse, rawResponse: _response.rawResponse }; @@ -1170,27 +1066,11 @@ export class Bill { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Bill/approval/{idBill}/{approved}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Bill/approval/{idBill}/{approved}", + ); } } diff --git a/src/api/resources/bill/client/index.ts b/src/api/resources/bill/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/bill/client/index.ts +++ b/src/api/resources/bill/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/bill/client/requests/AddBillRequest.ts b/src/api/resources/bill/client/requests/AddBillRequest.ts index 6b4a08b6..b9ca7efd 100644 --- a/src/api/resources/bill/client/requests/AddBillRequest.ts +++ b/src/api/resources/bill/client/requests/AddBillRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/bill/client/requests/DeleteAttachedFromBillRequest.ts b/src/api/resources/bill/client/requests/DeleteAttachedFromBillRequest.ts index 22fac1fe..5fdc415c 100644 --- a/src/api/resources/bill/client/requests/DeleteAttachedFromBillRequest.ts +++ b/src/api/resources/bill/client/requests/DeleteAttachedFromBillRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface DeleteAttachedFromBillRequest { - /** - * When `true`, the request returns the file content as a Base64-encoded string. - */ + /** When `true`, the request returns the file content as a Base64-encoded string. */ returnObject?: boolean; } diff --git a/src/api/resources/bill/client/requests/GetAttachedFromBillRequest.ts b/src/api/resources/bill/client/requests/GetAttachedFromBillRequest.ts index aa4e00c0..d087bb23 100644 --- a/src/api/resources/bill/client/requests/GetAttachedFromBillRequest.ts +++ b/src/api/resources/bill/client/requests/GetAttachedFromBillRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -9,8 +7,6 @@ * } */ export interface GetAttachedFromBillRequest { - /** - * When `true`, the request returns the file content as a Base64-encoded string. - */ + /** When `true`, the request returns the file content as a Base64-encoded string. */ returnObject?: boolean; } diff --git a/src/api/resources/bill/client/requests/ListBillsOrgRequest.ts b/src/api/resources/bill/client/requests/ListBillsOrgRequest.ts index f6f307d4..0232344e 100644 --- a/src/api/resources/bill/client/requests/ListBillsOrgRequest.ts +++ b/src/api/resources/bill/client/requests/ListBillsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBillsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -68,8 +62,6 @@ export interface ListBillsOrgRequest { * Example: totalAmount(gt)=20 return all records with totalAmount greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/bill/client/requests/ListBillsRequest.ts b/src/api/resources/bill/client/requests/ListBillsRequest.ts index 59631e21..70a89628 100644 --- a/src/api/resources/bill/client/requests/ListBillsRequest.ts +++ b/src/api/resources/bill/client/requests/ListBillsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBillsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -68,8 +62,6 @@ export interface ListBillsRequest { * Example: `totalAmount(gt)=20` returns all records with a `totalAmount` that's greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/bill/client/requests/SendToApprovalBillRequest.ts b/src/api/resources/bill/client/requests/SendToApprovalBillRequest.ts index 56661886..54e2be6c 100644 --- a/src/api/resources/bill/client/requests/SendToApprovalBillRequest.ts +++ b/src/api/resources/bill/client/requests/SendToApprovalBillRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -12,9 +10,7 @@ import * as Payabli from "../../../../index.js"; * } */ export interface SendToApprovalBillRequest { - /** - * Automatically create the target user for approval if they don't exist. - */ + /** Automatically create the target user for approval if they don't exist. */ autocreateUser?: boolean; idempotencyKey?: Payabli.IdempotencyKey; body: string[]; diff --git a/src/api/resources/bill/client/requests/SetApprovedBillRequest.ts b/src/api/resources/bill/client/requests/SetApprovedBillRequest.ts index 54885697..46e1d799 100644 --- a/src/api/resources/bill/client/requests/SetApprovedBillRequest.ts +++ b/src/api/resources/bill/client/requests/SetApprovedBillRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface SetApprovedBillRequest { - /** - * Email or username of user modifying approval status. - */ + /** Email or username of user modifying approval status. */ email?: string; } diff --git a/src/api/resources/bill/client/requests/index.ts b/src/api/resources/bill/client/requests/index.ts index 14e1c62a..23fae4d1 100644 --- a/src/api/resources/bill/client/requests/index.ts +++ b/src/api/resources/bill/client/requests/index.ts @@ -1,7 +1,7 @@ -export { type AddBillRequest } from "./AddBillRequest.js"; -export { type DeleteAttachedFromBillRequest } from "./DeleteAttachedFromBillRequest.js"; -export { type GetAttachedFromBillRequest } from "./GetAttachedFromBillRequest.js"; -export { type ListBillsRequest } from "./ListBillsRequest.js"; -export { type ListBillsOrgRequest } from "./ListBillsOrgRequest.js"; -export { type SendToApprovalBillRequest } from "./SendToApprovalBillRequest.js"; -export { type SetApprovedBillRequest } from "./SetApprovedBillRequest.js"; +export type { AddBillRequest } from "./AddBillRequest.js"; +export type { DeleteAttachedFromBillRequest } from "./DeleteAttachedFromBillRequest.js"; +export type { GetAttachedFromBillRequest } from "./GetAttachedFromBillRequest.js"; +export type { ListBillsOrgRequest } from "./ListBillsOrgRequest.js"; +export type { ListBillsRequest } from "./ListBillsRequest.js"; +export type { SendToApprovalBillRequest } from "./SendToApprovalBillRequest.js"; +export type { SetApprovedBillRequest } from "./SetApprovedBillRequest.js"; diff --git a/src/api/resources/bill/index.ts b/src/api/resources/bill/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/bill/index.ts +++ b/src/api/resources/bill/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/bill/types/BillOutData.ts b/src/api/resources/bill/types/BillOutData.ts index 26c123fa..fe3f363d 100644 --- a/src/api/resources/bill/types/BillOutData.ts +++ b/src/api/resources/bill/types/BillOutData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface BillOutData { accountingField1?: Payabli.AccountingField; diff --git a/src/api/resources/bill/types/BillOutDataScheduledOptions.ts b/src/api/resources/bill/types/BillOutDataScheduledOptions.ts index fe5ca0fd..d84a89a8 100644 --- a/src/api/resources/bill/types/BillOutDataScheduledOptions.ts +++ b/src/api/resources/bill/types/BillOutDataScheduledOptions.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface BillOutDataScheduledOptions { /** The ID of the stored payment method to use for the bill. */ diff --git a/src/api/resources/bill/types/BillResponse.ts b/src/api/resources/bill/types/BillResponse.ts index acbd5e88..5b56c780 100644 --- a/src/api/resources/bill/types/BillResponse.ts +++ b/src/api/resources/bill/types/BillResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface BillResponse { responseCode?: Payabli.Responsecode; diff --git a/src/api/resources/bill/types/BillResponseData.ts b/src/api/resources/bill/types/BillResponseData.ts index 06de8179..813d9c96 100644 --- a/src/api/resources/bill/types/BillResponseData.ts +++ b/src/api/resources/bill/types/BillResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface BillResponseData { IdBill?: Payabli.BillId; diff --git a/src/api/resources/bill/types/EditBillResponse.ts b/src/api/resources/bill/types/EditBillResponse.ts index ad1eb567..6e49d842 100644 --- a/src/api/resources/bill/types/EditBillResponse.ts +++ b/src/api/resources/bill/types/EditBillResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface EditBillResponse { responseCode?: Payabli.Responsecode; diff --git a/src/api/resources/bill/types/GetBillResponse.ts b/src/api/resources/bill/types/GetBillResponse.ts index eb514ceb..5d63664d 100644 --- a/src/api/resources/bill/types/GetBillResponse.ts +++ b/src/api/resources/bill/types/GetBillResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * A successful response returns a bill object with all its details. If the bill isn't found, the response will contain an error message. diff --git a/src/api/resources/bill/types/ModifyApprovalBillResponse.ts b/src/api/resources/bill/types/ModifyApprovalBillResponse.ts index f068451b..2bba8ca2 100644 --- a/src/api/resources/bill/types/ModifyApprovalBillResponse.ts +++ b/src/api/resources/bill/types/ModifyApprovalBillResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ModifyApprovalBillResponse extends Payabli.PayabliApiResponseGeneric2Part { /** If `isSuccess` = true, this contains the bill identifier. If `isSuccess` = false, this contains the reason for the error. */ diff --git a/src/api/resources/bill/types/SetApprovedBillResponse.ts b/src/api/resources/bill/types/SetApprovedBillResponse.ts index e570aa93..d3be1afc 100644 --- a/src/api/resources/bill/types/SetApprovedBillResponse.ts +++ b/src/api/resources/bill/types/SetApprovedBillResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface SetApprovedBillResponse extends Payabli.PayabliApiResponseGeneric2Part { /** If `isSuccess` = true, this contains the bill identifier. If `isSuccess` = false, this contains the reason for the error. */ diff --git a/src/api/resources/bill/types/index.ts b/src/api/resources/bill/types/index.ts index 62acbcb7..bc044639 100644 --- a/src/api/resources/bill/types/index.ts +++ b/src/api/resources/bill/types/index.ts @@ -1,8 +1,8 @@ +export * from "./BillOutData.js"; +export * from "./BillOutDataScheduledOptions.js"; +export * from "./BillResponse.js"; +export * from "./BillResponseData.js"; export * from "./EditBillResponse.js"; export * from "./GetBillResponse.js"; -export * from "./BillResponseData.js"; export * from "./ModifyApprovalBillResponse.js"; export * from "./SetApprovedBillResponse.js"; -export * from "./BillOutData.js"; -export * from "./BillOutDataScheduledOptions.js"; -export * from "./BillResponse.js"; diff --git a/src/api/resources/boarding/client/Client.ts b/src/api/resources/boarding/client/Client.ts index e91cb753..7afc0d96 100644 --- a/src/api/resources/boarding/client/Client.ts +++ b/src/api/resources/boarding/client/Client.ts @@ -1,48 +1,33 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as errors from "../../../../errors/index.js"; import { toJson } from "../../../../core/json.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Boarding { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace BoardingClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Boarding { - protected readonly _options: Boarding.Options; +export class BoardingClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Boarding.Options = {}) { - this._options = _options; + constructor(options: BoardingClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Creates a boarding application in an organization. This endpoint requires an application API token. * * @param {Payabli.AddApplicationRequest} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -526,15 +511,21 @@ export class Boarding { */ public addApplication( request: Payabli.AddApplicationRequest, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addApplication(request, requestOptions)); } private async __addApplication( request: Payabli.AddApplicationRequest, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -543,17 +534,16 @@ export class Boarding { "Boarding/app", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -584,28 +574,14 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Boarding/app."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Boarding/app"); } /** * Deletes a boarding application by ID. * * @param {number} appId - Boarding application ID. - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -617,31 +593,36 @@ export class Boarding { */ public deleteApplication( appId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteApplication(appId, requestOptions)); } private async __deleteApplication( appId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/app/${encodeURIComponent(appId)}`, + `Boarding/app/${core.url.encodePathParam(appId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -672,28 +653,14 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Boarding/app/{appId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Boarding/app/{appId}"); } /** * Retrieves the details for a boarding application by ID. * * @param {number} appId - Boarding application ID. - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -705,31 +672,36 @@ export class Boarding { */ public getApplication( appId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getApplication(appId, requestOptions)); } private async __getApplication( appId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/read/${encodeURIComponent(appId)}`, + `Boarding/read/${core.url.encodePathParam(appId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ApplicationDetailsRecord, rawResponse: _response.rawResponse }; @@ -757,21 +729,7 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Boarding/read/{appId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Boarding/read/{appId}"); } /** @@ -779,7 +737,7 @@ export class Boarding { * * @param {string} xId - The application ID in Hex format. Find this at the end of the boarding link URL returned in a call to api/Boarding/applink/{appId}/{mail2}. For example in: `https://boarding-sandbox.payabli.com/boarding/externalapp/load/17E`, the xId is `17E`. * @param {Payabli.RequestAppByAuth} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -795,7 +753,7 @@ export class Boarding { public getApplicationByAuth( xId: string, request: Payabli.RequestAppByAuth = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getApplicationByAuth(xId, request, requestOptions)); } @@ -803,27 +761,32 @@ export class Boarding { private async __getApplicationByAuth( xId: string, request: Payabli.RequestAppByAuth = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/read/${encodeURIComponent(xId)}`, + `Boarding/read/${core.url.encodePathParam(xId)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ApplicationQueryRecord, rawResponse: _response.rawResponse }; @@ -851,28 +814,14 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Boarding/read/{xId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Boarding/read/{xId}"); } /** * Retrieves details for a boarding link, by ID. * * @param {number} boardingLinkId - The boarding link ID. You can find this at the end of the boarding link reference name. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`. The ID is `91`. - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -884,31 +833,36 @@ export class Boarding { */ public getByIdLinkApplication( boardingLinkId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getByIdLinkApplication(boardingLinkId, requestOptions)); } private async __getByIdLinkApplication( boardingLinkId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/linkbyId/${encodeURIComponent(boardingLinkId)}`, + `Boarding/linkbyId/${core.url.encodePathParam(boardingLinkId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BoardingLinkQueryRecord, rawResponse: _response.rawResponse }; @@ -936,30 +890,19 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Boarding/linkbyId/{boardingLinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Boarding/linkbyId/{boardingLinkId}", + ); } /** * Get details for a boarding link using the boarding template ID. This endpoint requires an application API token. * * @param {number} templateId - The boarding template ID. You can find this at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -971,31 +914,36 @@ export class Boarding { */ public getByTemplateIdLinkApplication( templateId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getByTemplateIdLinkApplication(templateId, requestOptions)); } private async __getByTemplateIdLinkApplication( templateId: number, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/linkbyTemplate/${encodeURIComponent(templateId)}`, + `Boarding/linkbyTemplate/${core.url.encodePathParam(templateId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BoardingLinkQueryRecord, rawResponse: _response.rawResponse }; @@ -1023,23 +971,12 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Boarding/linkbyTemplate/{templateId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Boarding/linkbyTemplate/{templateId}", + ); } /** @@ -1048,7 +985,7 @@ export class Boarding { * @param {number} appId - Boarding application ID. * @param {string} mail2 - Email address used to access the application. If `sendEmail` parameter is true, a link to the application is sent to this email address. * @param {Payabli.GetExternalApplicationRequest} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1062,7 +999,7 @@ export class Boarding { appId: number, mail2: string, request: Payabli.GetExternalApplicationRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__getExternalApplication(appId, mail2, request, requestOptions), @@ -1073,31 +1010,35 @@ export class Boarding { appId: number, mail2: string, request: Payabli.GetExternalApplicationRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { const { sendEmail } = request; const _queryParams: Record = {}; if (sendEmail != null) { - _queryParams["sendEmail"] = sendEmail.toString(); + _queryParams.sendEmail = sendEmail.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/applink/${encodeURIComponent(appId)}/${encodeURIComponent(mail2)}`, + `Boarding/applink/${core.url.encodePathParam(appId)}/${core.url.encodePathParam(mail2)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse00, rawResponse: _response.rawResponse }; @@ -1125,30 +1066,19 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling PUT /Boarding/applink/{appId}/{mail2}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PUT", + "/Boarding/applink/{appId}/{mail2}", + ); } /** * Retrieves the details for a boarding link, by reference name. This endpoint requires an application API token. * * @param {string} boardingLinkReference - The boarding link reference name. You can find this at the end of the boarding link URL. For example `https://boarding.payabli.com/boarding/app/myorgaccountname-00091` - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1160,31 +1090,36 @@ export class Boarding { */ public getLinkApplication( boardingLinkReference: string, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getLinkApplication(boardingLinkReference, requestOptions)); } private async __getLinkApplication( boardingLinkReference: string, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/link/${encodeURIComponent(boardingLinkReference)}`, + `Boarding/link/${core.url.encodePathParam(boardingLinkReference)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BoardingLinkQueryRecord, rawResponse: _response.rawResponse }; @@ -1212,23 +1147,12 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Boarding/link/{boardingLinkReference}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Boarding/link/{boardingLinkReference}", + ); } /** @@ -1236,7 +1160,7 @@ export class Boarding { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListApplicationsRequest} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1253,7 +1177,7 @@ export class Boarding { public listApplications( orgId: number, request: Payabli.ListApplicationsRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listApplications(orgId, request, requestOptions)); } @@ -1261,47 +1185,51 @@ export class Boarding { private async __listApplications( orgId: number, request: Payabli.ListApplicationsRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/boarding/${encodeURIComponent(orgId)}`, + `Query/boarding/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1332,21 +1260,7 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/boarding/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/boarding/{orgId}"); } /** @@ -1354,7 +1268,7 @@ export class Boarding { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListBoardingLinksRequest} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1371,7 +1285,7 @@ export class Boarding { public listBoardingLinks( orgId: number, request: Payabli.ListBoardingLinksRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBoardingLinks(orgId, request, requestOptions)); } @@ -1379,43 +1293,47 @@ export class Boarding { private async __listBoardingLinks( orgId: number, request: Payabli.ListBoardingLinksRequest = {}, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/boardinglinks/${encodeURIComponent(orgId)}`, + `Query/boardinglinks/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBoardingLinksResponse, rawResponse: _response.rawResponse }; @@ -1443,21 +1361,7 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/boardinglinks/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/boardinglinks/{orgId}"); } /** @@ -1465,7 +1369,7 @@ export class Boarding { * * @param {number} appId - Boarding application ID. * @param {Payabli.ApplicationData} request - * @param {Boarding.RequestOptions} requestOptions - Request-specific configuration. + * @param {BoardingClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1478,7 +1382,7 @@ export class Boarding { public updateApplication( appId: number, request: Payabli.ApplicationData, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateApplication(appId, request, requestOptions)); } @@ -1486,27 +1390,32 @@ export class Boarding { private async __updateApplication( appId: number, request: Payabli.ApplicationData, - requestOptions?: Boarding.RequestOptions, + requestOptions?: BoardingClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Boarding/app/${encodeURIComponent(appId)}`, + `Boarding/app/${core.url.encodePathParam(appId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1537,25 +1446,6 @@ export class Boarding { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Boarding/app/{appId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Boarding/app/{appId}"); } } diff --git a/src/api/resources/boarding/client/index.ts b/src/api/resources/boarding/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/boarding/client/index.ts +++ b/src/api/resources/boarding/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/boarding/client/requests/GetExternalApplicationRequest.ts b/src/api/resources/boarding/client/requests/GetExternalApplicationRequest.ts index 31e6d4f0..4685b331 100644 --- a/src/api/resources/boarding/client/requests/GetExternalApplicationRequest.ts +++ b/src/api/resources/boarding/client/requests/GetExternalApplicationRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface GetExternalApplicationRequest { - /** - * If `true`, sends an email that includes the link to the application to the `mail2` address. Defaults to `false`. - */ + /** If `true`, sends an email that includes the link to the application to the `mail2` address. Defaults to `false`. */ sendEmail?: boolean; } diff --git a/src/api/resources/boarding/client/requests/ListApplicationsRequest.ts b/src/api/resources/boarding/client/requests/ListApplicationsRequest.ts index f41a1caf..9f7a00ed 100644 --- a/src/api/resources/boarding/client/requests/ListApplicationsRequest.ts +++ b/src/api/resources/boarding/client/requests/ListApplicationsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListApplicationsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -60,8 +54,6 @@ export interface ListApplicationsRequest { * - nin => not inside array */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/boarding/client/requests/ListBoardingLinksRequest.ts b/src/api/resources/boarding/client/requests/ListBoardingLinksRequest.ts index 16fbdf8f..34b2685b 100644 --- a/src/api/resources/boarding/client/requests/ListBoardingLinksRequest.ts +++ b/src/api/resources/boarding/client/requests/ListBoardingLinksRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListBoardingLinksRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -53,8 +47,6 @@ export interface ListBoardingLinksRequest { * Example: templateName(ct)=hoa return all records with template title containing "hoa" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/boarding/client/requests/RequestAppByAuth.ts b/src/api/resources/boarding/client/requests/RequestAppByAuth.ts index 8a7df076..507363b4 100644 --- a/src/api/resources/boarding/client/requests/RequestAppByAuth.ts +++ b/src/api/resources/boarding/client/requests/RequestAppByAuth.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/boarding/client/requests/index.ts b/src/api/resources/boarding/client/requests/index.ts index 881c96c7..241541b6 100644 --- a/src/api/resources/boarding/client/requests/index.ts +++ b/src/api/resources/boarding/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type RequestAppByAuth } from "./RequestAppByAuth.js"; -export { type GetExternalApplicationRequest } from "./GetExternalApplicationRequest.js"; -export { type ListApplicationsRequest } from "./ListApplicationsRequest.js"; -export { type ListBoardingLinksRequest } from "./ListBoardingLinksRequest.js"; +export type { GetExternalApplicationRequest } from "./GetExternalApplicationRequest.js"; +export type { ListApplicationsRequest } from "./ListApplicationsRequest.js"; +export type { ListBoardingLinksRequest } from "./ListBoardingLinksRequest.js"; +export type { RequestAppByAuth } from "./RequestAppByAuth.js"; diff --git a/src/api/resources/boarding/index.ts b/src/api/resources/boarding/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/boarding/index.ts +++ b/src/api/resources/boarding/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/boarding/types/AddApplicationRequest.ts b/src/api/resources/boarding/types/AddApplicationRequest.ts index 8cec9a4d..19fdd653 100644 --- a/src/api/resources/boarding/types/AddApplicationRequest.ts +++ b/src/api/resources/boarding/types/AddApplicationRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export type AddApplicationRequest = /** diff --git a/src/api/resources/chargeBacks/client/Client.ts b/src/api/resources/chargeBacks/client/Client.ts index 04385129..eae363ee 100644 --- a/src/api/resources/chargeBacks/client/Client.ts +++ b/src/api/resources/chargeBacks/client/Client.ts @@ -1,48 +1,33 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace ChargeBacks { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace ChargeBacksClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class ChargeBacks { - protected readonly _options: ChargeBacks.Options; +export class ChargeBacksClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: ChargeBacks.Options = {}) { - this._options = _options; + constructor(options: ChargeBacksClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Add a response to a chargeback or ACH return. * - * @param {number} id - ID of the chargeback or return record. + * @param {number} Id - ID of the chargeback or return record. * @param {Payabli.ResponseChargeBack} request - * @param {ChargeBacks.RequestOptions} requestOptions - Request-specific configuration. + * @param {ChargeBacksClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -55,41 +40,44 @@ export class ChargeBacks { * }) */ public addResponse( - id: number, + Id: number, request: Payabli.ResponseChargeBack = {}, - requestOptions?: ChargeBacks.RequestOptions, + requestOptions?: ChargeBacksClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__addResponse(id, request, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__addResponse(Id, request, requestOptions)); } private async __addResponse( - id: number, + Id: number, request: Payabli.ResponseChargeBack = {}, - requestOptions?: ChargeBacks.RequestOptions, + requestOptions?: ChargeBacksClient.RequestOptions, ): Promise> { const { idempotencyKey, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `ChargeBacks/response/${encodeURIComponent(id)}`, + `ChargeBacks/response/${core.url.encodePathParam(Id)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddResponseResponse, rawResponse: _response.rawResponse }; @@ -117,28 +105,14 @@ export class ChargeBacks { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /ChargeBacks/response/{Id}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/ChargeBacks/response/{Id}"); } /** * Retrieves a chargeback record and its details. * - * @param {number} id - ID of the chargeback or return record. This is returned as `chargebackId` in the [RecievedChargeback](/developers/developer-guides/webhook-payloads#receivedChargeback) and [ReceivedAchReturn](/developers/developer-guides/webhook-payloads#receivedachreturn) webhook notifications. - * @param {ChargeBacks.RequestOptions} requestOptions - Request-specific configuration. + * @param {number} Id - ID of the chargeback or return record. This is returned as `chargebackId` in the [RecievedChargeback](/developers/developer-guides/webhook-payloads#receivedChargeback) and [ReceivedAchReturn](/developers/developer-guides/webhook-payloads#receivedachreturn) webhook notifications. + * @param {ChargeBacksClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -149,32 +123,37 @@ export class ChargeBacks { * await client.chargeBacks.getChargeback(1000000) */ public getChargeback( - id: number, - requestOptions?: ChargeBacks.RequestOptions, + Id: number, + requestOptions?: ChargeBacksClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getChargeback(id, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__getChargeback(Id, requestOptions)); } private async __getChargeback( - id: number, - requestOptions?: ChargeBacks.RequestOptions, + Id: number, + requestOptions?: ChargeBacksClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `ChargeBacks/read/${encodeURIComponent(id)}`, + `ChargeBacks/read/${core.url.encodePathParam(Id)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ChargebackQueryRecords, rawResponse: _response.rawResponse }; @@ -202,29 +181,15 @@ export class ChargeBacks { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /ChargeBacks/read/{Id}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/ChargeBacks/read/{Id}"); } /** * Retrieves a chargeback attachment file by its file name. * - * @param {number} id - The ID of chargeback or return record. + * @param {number} Id - The ID of chargeback or return record. * @param {string} fileName - The chargeback attachment's file name. - * @param {ChargeBacks.RequestOptions} requestOptions - Request-specific configuration. + * @param {ChargeBacksClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -235,35 +200,40 @@ export class ChargeBacks { * await client.chargeBacks.getChargebackAttachment(1000000, "fileName") */ public getChargebackAttachment( - id: number, + Id: number, fileName: string, - requestOptions?: ChargeBacks.RequestOptions, + requestOptions?: ChargeBacksClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getChargebackAttachment(id, fileName, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__getChargebackAttachment(Id, fileName, requestOptions)); } private async __getChargebackAttachment( - id: number, + Id: number, fileName: string, - requestOptions?: ChargeBacks.RequestOptions, + requestOptions?: ChargeBacksClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `ChargeBacks/getChargebackAttachments/${encodeURIComponent(id)}/${encodeURIComponent(fileName)}`, + `ChargeBacks/getChargebackAttachments/${core.url.encodePathParam(Id)}/${core.url.encodePathParam(fileName)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, + queryParameters: requestOptions?.queryParams, responseType: "text", - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as string, rawResponse: _response.rawResponse }; @@ -291,27 +261,11 @@ export class ChargeBacks { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /ChargeBacks/getChargebackAttachments/{Id}/{fileName}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/ChargeBacks/getChargebackAttachments/{Id}/{fileName}", + ); } } diff --git a/src/api/resources/chargeBacks/client/index.ts b/src/api/resources/chargeBacks/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/chargeBacks/client/index.ts +++ b/src/api/resources/chargeBacks/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/chargeBacks/client/requests/ResponseChargeBack.ts b/src/api/resources/chargeBacks/client/requests/ResponseChargeBack.ts index b6e9c283..db481fb3 100644 --- a/src/api/resources/chargeBacks/client/requests/ResponseChargeBack.ts +++ b/src/api/resources/chargeBacks/client/requests/ResponseChargeBack.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/chargeBacks/client/requests/index.ts b/src/api/resources/chargeBacks/client/requests/index.ts index 71c725e8..abdb66fd 100644 --- a/src/api/resources/chargeBacks/client/requests/index.ts +++ b/src/api/resources/chargeBacks/client/requests/index.ts @@ -1 +1 @@ -export { type ResponseChargeBack } from "./ResponseChargeBack.js"; +export type { ResponseChargeBack } from "./ResponseChargeBack.js"; diff --git a/src/api/resources/chargeBacks/index.ts b/src/api/resources/chargeBacks/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/chargeBacks/index.ts +++ b/src/api/resources/chargeBacks/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/chargeBacks/types/AddResponseResponse.ts b/src/api/resources/chargeBacks/types/AddResponseResponse.ts index 69b70ec7..e0c6de20 100644 --- a/src/api/resources/chargeBacks/types/AddResponseResponse.ts +++ b/src/api/resources/chargeBacks/types/AddResponseResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AddResponseResponse extends Payabli.PayabliApiResponseGeneric2Part { /** If `isSuccess` = true, this contains the chargeback identifier. If `isSuccess` = false, this contains the reason for the error. */ diff --git a/src/api/resources/chargeBacks/types/ChargeBackResponse.ts b/src/api/resources/chargeBacks/types/ChargeBackResponse.ts index 7860ceb1..24679184 100644 --- a/src/api/resources/chargeBacks/types/ChargeBackResponse.ts +++ b/src/api/resources/chargeBacks/types/ChargeBackResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ChargeBackResponse { /** Object with attached files to response */ diff --git a/src/api/resources/chargeBacks/types/ChargebackMessage.ts b/src/api/resources/chargeBacks/types/ChargebackMessage.ts index 6f14e817..51bf483c 100644 --- a/src/api/resources/chargeBacks/types/ChargebackMessage.ts +++ b/src/api/resources/chargeBacks/types/ChargebackMessage.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface ChargebackMessage { /** Message identifier. */ diff --git a/src/api/resources/chargeBacks/types/ChargebackQueryRecords.ts b/src/api/resources/chargeBacks/types/ChargebackQueryRecords.ts index bf5b0dcd..cb6e89f9 100644 --- a/src/api/resources/chargeBacks/types/ChargebackQueryRecords.ts +++ b/src/api/resources/chargeBacks/types/ChargebackQueryRecords.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ChargebackQueryRecords { /** Identifier of chargeback or return. */ diff --git a/src/api/resources/chargeBacks/types/index.ts b/src/api/resources/chargeBacks/types/index.ts index eb597c16..cba20a99 100644 --- a/src/api/resources/chargeBacks/types/index.ts +++ b/src/api/resources/chargeBacks/types/index.ts @@ -1,4 +1,4 @@ export * from "./AddResponseResponse.js"; -export * from "./ChargebackQueryRecords.js"; -export * from "./ChargebackMessage.js"; export * from "./ChargeBackResponse.js"; +export * from "./ChargebackMessage.js"; +export * from "./ChargebackQueryRecords.js"; diff --git a/src/api/resources/checkCapture/client/Client.ts b/src/api/resources/checkCapture/client/Client.ts index f39e6e54..532a8fce 100644 --- a/src/api/resources/checkCapture/client/Client.ts +++ b/src/api/resources/checkCapture/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace CheckCapture { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace CheckCaptureClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class CheckCapture { - protected readonly _options: CheckCapture.Options; +export class CheckCaptureClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: CheckCapture.Options = {}) { - this._options = _options; + constructor(options: CheckCaptureClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Captures a check for Remote Deposit Capture (RDC) using the provided check images and details. This endpoint handles the OCR extraction of check data including MICR, routing number, account number, and amount. See the [RDC guide](/developers/developer-guides/pay-in-rdc) for more details. * * @param {Payabli.CheckCaptureRequestBody} request - * @param {CheckCapture.RequestOptions} requestOptions - Request-specific configuration. + * @param {CheckCaptureClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -58,15 +43,21 @@ export class CheckCapture { */ public checkProcessing( request: Payabli.CheckCaptureRequestBody, - requestOptions?: CheckCapture.RequestOptions, + requestOptions?: CheckCaptureClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__checkProcessing(request, requestOptions)); } private async __checkProcessing( request: Payabli.CheckCaptureRequestBody, - requestOptions?: CheckCapture.RequestOptions, + requestOptions?: CheckCaptureClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -75,17 +66,16 @@ export class CheckCapture { "CheckCapture/CheckProcessing", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CheckCaptureResponse, rawResponse: _response.rawResponse }; @@ -113,27 +103,11 @@ export class CheckCapture { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /CheckCapture/CheckProcessing.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/CheckCapture/CheckProcessing", + ); } } diff --git a/src/api/resources/checkCapture/client/index.ts b/src/api/resources/checkCapture/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/checkCapture/client/index.ts +++ b/src/api/resources/checkCapture/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/checkCapture/client/requests/CheckCaptureRequestBody.ts b/src/api/resources/checkCapture/client/requests/CheckCaptureRequestBody.ts index ebd296f6..f0f86f71 100644 --- a/src/api/resources/checkCapture/client/requests/CheckCaptureRequestBody.ts +++ b/src/api/resources/checkCapture/client/requests/CheckCaptureRequestBody.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/checkCapture/client/requests/index.ts b/src/api/resources/checkCapture/client/requests/index.ts index 8db9eb02..8d113689 100644 --- a/src/api/resources/checkCapture/client/requests/index.ts +++ b/src/api/resources/checkCapture/client/requests/index.ts @@ -1 +1 @@ -export { type CheckCaptureRequestBody } from "./CheckCaptureRequestBody.js"; +export type { CheckCaptureRequestBody } from "./CheckCaptureRequestBody.js"; diff --git a/src/api/resources/checkCapture/index.ts b/src/api/resources/checkCapture/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/checkCapture/index.ts +++ b/src/api/resources/checkCapture/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/checkCapture/types/CheckCaptureRequest.ts b/src/api/resources/checkCapture/types/CheckCaptureRequest.ts index 990f9192..fef6e751 100644 --- a/src/api/resources/checkCapture/types/CheckCaptureRequest.ts +++ b/src/api/resources/checkCapture/types/CheckCaptureRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Request model for check capture processing. diff --git a/src/api/resources/checkCapture/types/CheckCaptureResponse.ts b/src/api/resources/checkCapture/types/CheckCaptureResponse.ts index 67a64342..b49be3c3 100644 --- a/src/api/resources/checkCapture/types/CheckCaptureResponse.ts +++ b/src/api/resources/checkCapture/types/CheckCaptureResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response model for check capture processing. diff --git a/src/api/resources/cloud/client/Client.ts b/src/api/resources/cloud/client/Client.ts index 8ad161eb..7c5a6b83 100644 --- a/src/api/resources/cloud/client/Client.ts +++ b/src/api/resources/cloud/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Cloud { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace CloudClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Cloud { - protected readonly _options: Cloud.Options; +export class CloudClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Cloud.Options = {}) { - this._options = _options; + constructor(options: CloudClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -42,7 +27,7 @@ export class Cloud { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.DeviceEntry} request - * @param {Cloud.RequestOptions} requestOptions - Request-specific configuration. + * @param {CloudClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -58,7 +43,7 @@ export class Cloud { public addDevice( entry: string, request: Payabli.DeviceEntry = {}, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addDevice(entry, request, requestOptions)); } @@ -66,31 +51,34 @@ export class Cloud { private async __addDevice( entry: string, request: Payabli.DeviceEntry = {}, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): Promise> { const { idempotencyKey, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Cloud/register/${encodeURIComponent(entry)}`, + `Cloud/register/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddDeviceResponse, rawResponse: _response.rawResponse }; @@ -118,21 +106,7 @@ export class Cloud { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Cloud/register/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Cloud/register/{entry}"); } /** @@ -140,7 +114,7 @@ export class Cloud { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} deviceId - ID of the cloud device. - * @param {Cloud.RequestOptions} requestOptions - Request-specific configuration. + * @param {CloudClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -153,7 +127,7 @@ export class Cloud { public historyDevice( entry: string, deviceId: string, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__historyDevice(entry, deviceId, requestOptions)); } @@ -161,24 +135,29 @@ export class Cloud { private async __historyDevice( entry: string, deviceId: string, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Cloud/history/${encodeURIComponent(entry)}/${encodeURIComponent(deviceId)}`, + `Cloud/history/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(deviceId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CloudQueryApiResponse, rawResponse: _response.rawResponse }; @@ -206,23 +185,12 @@ export class Cloud { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Cloud/history/{entry}/{deviceId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Cloud/history/{entry}/{deviceId}", + ); } /** @@ -230,7 +198,7 @@ export class Cloud { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListDeviceRequest} request - * @param {Cloud.RequestOptions} requestOptions - Request-specific configuration. + * @param {CloudClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -243,7 +211,7 @@ export class Cloud { public listDevice( entry: string, request: Payabli.ListDeviceRequest = {}, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listDevice(entry, request, requestOptions)); } @@ -251,31 +219,35 @@ export class Cloud { private async __listDevice( entry: string, request: Payabli.ListDeviceRequest = {}, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): Promise> { const { forceRefresh } = request; const _queryParams: Record = {}; if (forceRefresh != null) { - _queryParams["forceRefresh"] = forceRefresh.toString(); + _queryParams.forceRefresh = forceRefresh.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Cloud/list/${encodeURIComponent(entry)}`, + `Cloud/list/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CloudQueryApiResponse, rawResponse: _response.rawResponse }; @@ -303,21 +275,7 @@ export class Cloud { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Cloud/list/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Cloud/list/{entry}"); } /** @@ -325,7 +283,7 @@ export class Cloud { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} deviceId - ID of the cloud device. - * @param {Cloud.RequestOptions} requestOptions - Request-specific configuration. + * @param {CloudClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -338,7 +296,7 @@ export class Cloud { public removeDevice( entry: string, deviceId: string, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__removeDevice(entry, deviceId, requestOptions)); } @@ -346,24 +304,29 @@ export class Cloud { private async __removeDevice( entry: string, deviceId: string, - requestOptions?: Cloud.RequestOptions, + requestOptions?: CloudClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Cloud/register/${encodeURIComponent(entry)}/${encodeURIComponent(deviceId)}`, + `Cloud/register/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(deviceId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.RemoveDeviceResponse, rawResponse: _response.rawResponse }; @@ -391,27 +354,11 @@ export class Cloud { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /Cloud/register/{entry}/{deviceId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/Cloud/register/{entry}/{deviceId}", + ); } } diff --git a/src/api/resources/cloud/client/index.ts b/src/api/resources/cloud/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/cloud/client/index.ts +++ b/src/api/resources/cloud/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/cloud/client/requests/DeviceEntry.ts b/src/api/resources/cloud/client/requests/DeviceEntry.ts index 449f94fe..0a27f5f3 100644 --- a/src/api/resources/cloud/client/requests/DeviceEntry.ts +++ b/src/api/resources/cloud/client/requests/DeviceEntry.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/cloud/client/requests/ListDeviceRequest.ts b/src/api/resources/cloud/client/requests/ListDeviceRequest.ts index 5c6988ab..13d50193 100644 --- a/src/api/resources/cloud/client/requests/ListDeviceRequest.ts +++ b/src/api/resources/cloud/client/requests/ListDeviceRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface ListDeviceRequest { - /** - * When `true`, the request retrieves an updated list of devices from the processor instead of returning a cached list of devices. - */ + /** When `true`, the request retrieves an updated list of devices from the processor instead of returning a cached list of devices. */ forceRefresh?: boolean; } diff --git a/src/api/resources/cloud/client/requests/index.ts b/src/api/resources/cloud/client/requests/index.ts index b2448f97..0760d152 100644 --- a/src/api/resources/cloud/client/requests/index.ts +++ b/src/api/resources/cloud/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type DeviceEntry } from "./DeviceEntry.js"; -export { type ListDeviceRequest } from "./ListDeviceRequest.js"; +export type { DeviceEntry } from "./DeviceEntry.js"; +export type { ListDeviceRequest } from "./ListDeviceRequest.js"; diff --git a/src/api/resources/cloud/index.ts b/src/api/resources/cloud/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/cloud/index.ts +++ b/src/api/resources/cloud/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/cloud/types/AddDeviceResponse.ts b/src/api/resources/cloud/types/AddDeviceResponse.ts index f8a2e687..ea11cc5b 100644 --- a/src/api/resources/cloud/types/AddDeviceResponse.ts +++ b/src/api/resources/cloud/types/AddDeviceResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AddDeviceResponse extends Payabli.PayabliApiResponseGeneric2Part { pageIdentifier?: Payabli.PageIdentifier; diff --git a/src/api/resources/cloud/types/RemoveDeviceResponse.ts b/src/api/resources/cloud/types/RemoveDeviceResponse.ts index 3847352c..85152c99 100644 --- a/src/api/resources/cloud/types/RemoveDeviceResponse.ts +++ b/src/api/resources/cloud/types/RemoveDeviceResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface RemoveDeviceResponse extends Payabli.PayabliApiResponseGeneric2Part { pageIdentifier?: Payabli.PageIdentifier; diff --git a/src/api/resources/customer/client/Client.ts b/src/api/resources/customer/client/Client.ts index 58f30894..3de264fd 100644 --- a/src/api/resources/customer/client/Client.ts +++ b/src/api/resources/customer/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Customer { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace CustomerClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Customer { - protected readonly _options: Customer.Options; +export class CustomerClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Customer.Options = {}) { - this._options = _options; + constructor(options: CustomerClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +28,7 @@ export class Customer { * * @param {Payabli.Entrypointfield} entry * @param {Payabli.AddCustomerRequest} request - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -70,7 +55,7 @@ export class Customer { public addCustomer( entry: Payabli.Entrypointfield, request: Payabli.AddCustomerRequest, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addCustomer(entry, request, requestOptions)); } @@ -78,41 +63,43 @@ export class Customer { private async __addCustomer( entry: Payabli.Entrypointfield, request: Payabli.AddCustomerRequest, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { const { forceCustomerCreation, replaceExisting, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } if (replaceExisting != null) { - _queryParams["replaceExisting"] = replaceExisting.toString(); + _queryParams.replaceExisting = replaceExisting.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/single/${encodeURIComponent(entry)}`, + `Customer/single/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -143,28 +130,14 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Customer/single/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Customer/single/{entry}"); } /** * Delete a customer record. * * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -176,31 +149,36 @@ export class Customer { */ public deleteCustomer( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteCustomer(customerId, requestOptions)); } private async __deleteCustomer( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/${encodeURIComponent(customerId)}`, + `Customer/${core.url.encodePathParam(customerId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -231,28 +209,14 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Customer/{customerId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Customer/{customerId}"); } /** * Retrieves a customer's record and details. * * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -264,31 +228,36 @@ export class Customer { */ public getCustomer( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getCustomer(customerId, requestOptions)); } private async __getCustomer( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/${encodeURIComponent(customerId)}`, + `Customer/${core.url.encodePathParam(customerId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CustomerQueryRecords, rawResponse: _response.rawResponse }; @@ -316,21 +285,7 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Customer/{customerId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Customer/{customerId}"); } /** @@ -338,7 +293,7 @@ export class Customer { * * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. * @param {string} transId - ReferenceId for the transaction (PaymentId). - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -351,7 +306,7 @@ export class Customer { public linkCustomerTransaction( customerId: number, transId: string, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__linkCustomerTransaction(customerId, transId, requestOptions), @@ -361,24 +316,29 @@ export class Customer { private async __linkCustomerTransaction( customerId: number, transId: string, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/link/${encodeURIComponent(customerId)}/${encodeURIComponent(transId)}`, + `Customer/link/${core.url.encodePathParam(customerId)}/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -409,30 +369,19 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Customer/link/{customerId}/{transId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Customer/link/{customerId}/{transId}", + ); } /** * Sends the consent opt-in email to the customer email address in the customer record. * * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -444,31 +393,36 @@ export class Customer { */ public requestConsent( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__requestConsent(customerId, requestOptions)); } private async __requestConsent( customerId: number, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/${encodeURIComponent(customerId)}/consent`, + `Customer/${core.url.encodePathParam(customerId)}/consent`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -499,23 +453,12 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Customer/{customerId}/consent.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Customer/{customerId}/consent", + ); } /** @@ -523,7 +466,7 @@ export class Customer { * * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. * @param {Payabli.CustomerData} request - * @param {Customer.RequestOptions} requestOptions - Request-specific configuration. + * @param {CustomerClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -544,7 +487,7 @@ export class Customer { public updateCustomer( customerId: number, request: Payabli.CustomerData, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateCustomer(customerId, request, requestOptions)); } @@ -552,27 +495,32 @@ export class Customer { private async __updateCustomer( customerId: number, request: Payabli.CustomerData, - requestOptions?: Customer.RequestOptions, + requestOptions?: CustomerClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Customer/${encodeURIComponent(customerId)}`, + `Customer/${core.url.encodePathParam(customerId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -603,25 +551,6 @@ export class Customer { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Customer/{customerId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Customer/{customerId}"); } } diff --git a/src/api/resources/customer/client/index.ts b/src/api/resources/customer/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/customer/client/index.ts +++ b/src/api/resources/customer/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/customer/client/requests/AddCustomerRequest.ts b/src/api/resources/customer/client/requests/AddCustomerRequest.ts index 3647418f..7d2b448c 100644 --- a/src/api/resources/customer/client/requests/AddCustomerRequest.ts +++ b/src/api/resources/customer/client/requests/AddCustomerRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -23,13 +21,9 @@ import * as Payabli from "../../../../index.js"; * } */ export interface AddCustomerRequest { - /** - * When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. - */ + /** When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. */ forceCustomerCreation?: boolean; - /** - * Flag indicating to replace existing customer with a new record. Possible values: 0 (don't replace), 1 (replace). Default is `0`. - */ + /** Flag indicating to replace existing customer with a new record. Possible values: 0 (don't replace), 1 (replace). Default is `0`. */ replaceExisting?: number; idempotencyKey?: Payabli.IdempotencyKey; body: Payabli.CustomerData; diff --git a/src/api/resources/customer/client/requests/index.ts b/src/api/resources/customer/client/requests/index.ts index 4c1a7ddb..6081b396 100644 --- a/src/api/resources/customer/client/requests/index.ts +++ b/src/api/resources/customer/client/requests/index.ts @@ -1 +1 @@ -export { type AddCustomerRequest } from "./AddCustomerRequest.js"; +export type { AddCustomerRequest } from "./AddCustomerRequest.js"; diff --git a/src/api/resources/export/client/Client.ts b/src/api/resources/export/client/Client.ts index 1c98bf0e..4c5df2e4 100644 --- a/src/api/resources/export/client/Client.ts +++ b/src/api/resources/export/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; import { toJson } from "../../../../core/json.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Export { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace ExportClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Export { - protected readonly _options: Export.Options; +export class ExportClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Export.Options = {}) { - this._options = _options; + constructor(options: ExportClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -44,7 +29,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportApplicationsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -62,7 +47,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportApplicationsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportApplications(format, orgId, request, requestOptions)); } @@ -71,43 +56,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportApplicationsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/boarding/${encodeURIComponent(format)}/${encodeURIComponent(orgId)}`, + `Export/boarding/${core.url.encodePathParam(format)}/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -135,23 +124,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/boarding/{format}/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/boarding/{format}/{orgId}", + ); } /** @@ -160,7 +138,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportBatchDetailsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -178,7 +156,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchDetailsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBatchDetails(format, entry, request, requestOptions)); } @@ -187,43 +165,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchDetailsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batchDetails/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/batchDetails/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -251,23 +233,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batchDetails/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batchDetails/{format}/{entry}", + ); } /** @@ -276,7 +247,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportBatchDetailsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -294,7 +265,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchDetailsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportBatchDetailsOrg(format, orgId, request, requestOptions), @@ -305,43 +276,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchDetailsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batchDetails/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/batchDetails/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -369,23 +344,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batchDetails/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batchDetails/{format}/org/{orgId}", + ); } /** @@ -394,7 +358,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportBatchesRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -412,7 +376,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchesRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBatches(format, entry, request, requestOptions)); } @@ -421,43 +385,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchesRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batches/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/batches/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -485,23 +453,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batches/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batches/{format}/{entry}", + ); } /** @@ -510,7 +467,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportBatchesOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -528,7 +485,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchesOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBatchesOrg(format, orgId, request, requestOptions)); } @@ -537,43 +494,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchesOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batches/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/batches/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -601,23 +562,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batches/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batches/{format}/org/{orgId}", + ); } /** @@ -626,7 +576,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportBatchesOutRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -644,7 +594,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchesOutRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBatchesOut(format, entry, request, requestOptions)); } @@ -653,43 +603,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBatchesOutRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batchesOut/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/batchesOut/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -717,23 +671,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batchesOut/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batchesOut/{format}/{entry}", + ); } /** @@ -742,7 +685,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportBatchesOutOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -760,7 +703,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchesOutOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBatchesOutOrg(format, orgId, request, requestOptions)); } @@ -769,43 +712,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBatchesOutOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/batchesOut/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/batchesOut/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -833,23 +780,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/batchesOut/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/batchesOut/{format}/org/{orgId}", + ); } /** @@ -858,7 +794,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportBillsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -876,7 +812,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBillsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBills(format, entry, request, requestOptions)); } @@ -885,43 +821,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportBillsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/bills/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/bills/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -949,23 +889,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/bills/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/bills/{format}/{entry}", + ); } /** @@ -974,7 +903,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportBillsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -992,7 +921,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBillsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportBillsOrg(format, orgId, request, requestOptions)); } @@ -1001,43 +930,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportBillsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/bills/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/bills/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1065,23 +998,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/bills/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/bills/{format}/org/{orgId}", + ); } /** @@ -1090,7 +1012,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportChargebacksRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1108,7 +1030,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportChargebacksRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportChargebacks(format, entry, request, requestOptions)); } @@ -1117,43 +1039,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportChargebacksRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/chargebacks/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/chargebacks/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1181,23 +1107,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/chargebacks/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/chargebacks/{format}/{entry}", + ); } /** @@ -1206,7 +1121,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportChargebacksOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1224,7 +1139,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportChargebacksOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportChargebacksOrg(format, orgId, request, requestOptions), @@ -1235,43 +1150,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportChargebacksOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/chargebacks/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/chargebacks/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1299,23 +1218,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/chargebacks/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/chargebacks/{format}/org/{orgId}", + ); } /** @@ -1324,7 +1232,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportCustomersRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1342,7 +1250,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportCustomersRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportCustomers(format, entry, request, requestOptions)); } @@ -1351,43 +1259,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportCustomersRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/customers/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/customers/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1415,23 +1327,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/customers/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/customers/{format}/{entry}", + ); } /** @@ -1440,7 +1341,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportCustomersOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1458,7 +1359,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportCustomersOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportCustomersOrg(format, orgId, request, requestOptions)); } @@ -1467,43 +1368,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportCustomersOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/customers/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/customers/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1531,23 +1436,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/customers/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/customers/{format}/org/{orgId}", + ); } /** @@ -1556,7 +1450,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportInvoicesRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1574,7 +1468,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportInvoicesRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportInvoices(format, entry, request, requestOptions)); } @@ -1583,43 +1477,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportInvoicesRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/invoices/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/invoices/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1647,23 +1545,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/invoices/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/invoices/{format}/{entry}", + ); } /** @@ -1672,7 +1559,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportInvoicesOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1690,7 +1577,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportInvoicesOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportInvoicesOrg(format, orgId, request, requestOptions)); } @@ -1699,43 +1586,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportInvoicesOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/invoices/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/invoices/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1763,23 +1654,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/invoices/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/invoices/{format}/org/{orgId}", + ); } /** @@ -1788,7 +1668,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportOrganizationsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1806,7 +1686,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportOrganizationsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportOrganizations(format, orgId, request, requestOptions)); } @@ -1815,43 +1695,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportOrganizationsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/organizations/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/organizations/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1879,23 +1763,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/organizations/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/organizations/{format}/org/{orgId}", + ); } /** @@ -1904,7 +1777,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportPayoutRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1922,7 +1795,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportPayoutRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportPayout(format, entry, request, requestOptions)); } @@ -1931,43 +1804,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportPayoutRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/payouts/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/payouts/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1995,23 +1872,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/payouts/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/payouts/{format}/{entry}", + ); } /** @@ -2020,7 +1886,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportPayoutOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2038,7 +1904,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportPayoutOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportPayoutOrg(format, orgId, request, requestOptions)); } @@ -2047,43 +1913,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportPayoutOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/payouts/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/payouts/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2111,23 +1981,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/payouts/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/payouts/{format}/org/{orgId}", + ); } /** @@ -2136,7 +1995,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportPaypointsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2154,7 +2013,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportPaypointsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportPaypoints(format, orgId, request, requestOptions)); } @@ -2163,43 +2022,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportPaypointsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/paypoints/${encodeURIComponent(format)}/${encodeURIComponent(orgId)}`, + `Export/paypoints/${core.url.encodePathParam(format)}/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2227,23 +2090,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/paypoints/{format}/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/paypoints/{format}/{orgId}", + ); } /** @@ -2252,7 +2104,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportSettlementsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2270,7 +2122,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportSettlementsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportSettlements(format, entry, request, requestOptions)); } @@ -2279,43 +2131,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportSettlementsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/settlements/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/settlements/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2343,23 +2199,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/settlements/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/settlements/{format}/{entry}", + ); } /** @@ -2368,7 +2213,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportSettlementsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2386,7 +2231,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportSettlementsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportSettlementsOrg(format, orgId, request, requestOptions), @@ -2397,43 +2242,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportSettlementsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/settlements/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/settlements/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2461,23 +2310,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/settlements/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/settlements/{format}/org/{orgId}", + ); } /** @@ -2486,7 +2324,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportSubscriptionsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2504,7 +2342,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportSubscriptionsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportSubscriptions(format, entry, request, requestOptions)); } @@ -2513,43 +2351,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportSubscriptionsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/subscriptions/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/subscriptions/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2577,23 +2419,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/subscriptions/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/subscriptions/{format}/{entry}", + ); } /** @@ -2602,7 +2433,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportSubscriptionsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2620,7 +2451,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportSubscriptionsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportSubscriptionsOrg(format, orgId, request, requestOptions), @@ -2631,43 +2462,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportSubscriptionsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/subscriptions/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/subscriptions/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2695,23 +2530,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/subscriptions/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/subscriptions/{format}/org/{orgId}", + ); } /** @@ -2720,7 +2544,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportTransactionsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2738,7 +2562,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportTransactionsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportTransactions(format, entry, request, requestOptions)); } @@ -2747,43 +2571,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportTransactionsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/transactions/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/transactions/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2811,23 +2639,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/transactions/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/transactions/{format}/{entry}", + ); } /** @@ -2836,7 +2653,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportTransactionsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2854,7 +2671,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportTransactionsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportTransactionsOrg(format, orgId, request, requestOptions), @@ -2865,43 +2682,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportTransactionsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/transactions/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/transactions/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -2929,23 +2750,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/transactions/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/transactions/{format}/org/{orgId}", + ); } /** @@ -2955,7 +2765,7 @@ export class Export { * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {number} transferId - Transfer identifier. * @param {Payabli.ExportTransferDetailsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2975,7 +2785,7 @@ export class Export { entry: string, transferId: number, request: Payabli.ExportTransferDetailsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__exportTransferDetails(format, entry, transferId, request, requestOptions), @@ -2987,47 +2797,51 @@ export class Export { entry: string, transferId: number, request: Payabli.ExportTransferDetailsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/transferDetails/${encodeURIComponent(format)}/${encodeURIComponent(entry)}/${encodeURIComponent(transferId)}`, + `Export/transferDetails/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(transferId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -3055,23 +2869,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/transferDetails/{format}/{entry}/{transferId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/transferDetails/{format}/{entry}/{transferId}", + ); } /** @@ -3079,7 +2882,7 @@ export class Export { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportTransfersRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3097,7 +2900,7 @@ export class Export { public exportTransfers( entry: string, request: Payabli.ExportTransfersRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportTransfers(entry, request, requestOptions)); } @@ -3105,47 +2908,51 @@ export class Export { private async __exportTransfers( entry: string, request: Payabli.ExportTransfersRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/transfers/${encodeURIComponent(entry)}`, + `Export/transfers/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -3173,21 +2980,7 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Export/transfers/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Export/transfers/{entry}"); } /** @@ -3196,7 +2989,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ExportVendorsRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3214,7 +3007,7 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportVendorsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportVendors(format, entry, request, requestOptions)); } @@ -3223,43 +3016,47 @@ export class Export { format: Payabli.ExportFormat1, entry: string, request: Payabli.ExportVendorsRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/vendors/${encodeURIComponent(format)}/${encodeURIComponent(entry)}`, + `Export/vendors/${core.url.encodePathParam(format)}/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -3287,23 +3084,12 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/vendors/{format}/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/vendors/{format}/{entry}", + ); } /** @@ -3312,7 +3098,7 @@ export class Export { * @param {Payabli.ExportFormat1} format - Format for the export, either XLSX or CSV. * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ExportVendorsOrgRequest} request - * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3330,7 +3116,7 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportVendorsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__exportVendorsOrg(format, orgId, request, requestOptions)); } @@ -3339,43 +3125,47 @@ export class Export { format: Payabli.ExportFormat1, orgId: number, request: Payabli.ExportVendorsOrgRequest = {}, - requestOptions?: Export.RequestOptions, + requestOptions?: ExportClient.RequestOptions, ): Promise> { const { columnsExport, fromRecord, limitRecord, parameters } = request; const _queryParams: Record = {}; if (columnsExport != null) { - _queryParams["columnsExport"] = columnsExport; + _queryParams.columnsExport = columnsExport; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/vendors/${encodeURIComponent(format)}/org/${encodeURIComponent(orgId)}`, + `Export/vendors/${core.url.encodePathParam(format)}/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -3403,27 +3193,11 @@ export class Export { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/vendors/{format}/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/vendors/{format}/org/{orgId}", + ); } } diff --git a/src/api/resources/export/client/index.ts b/src/api/resources/export/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/export/client/index.ts +++ b/src/api/resources/export/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/export/client/requests/ExportApplicationsRequest.ts b/src/api/resources/export/client/requests/ExportApplicationsRequest.ts index 58498434..6d4f183e 100644 --- a/src/api/resources/export/client/requests/ExportApplicationsRequest.ts +++ b/src/api/resources/export/client/requests/ExportApplicationsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportApplicationsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchDetailsOrgRequest.ts b/src/api/resources/export/client/requests/ExportBatchDetailsOrgRequest.ts index 65e72bde..469f9353 100644 --- a/src/api/resources/export/client/requests/ExportBatchDetailsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchDetailsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchDetailsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchDetailsRequest.ts b/src/api/resources/export/client/requests/ExportBatchDetailsRequest.ts index efd0264b..00ebb2f8 100644 --- a/src/api/resources/export/client/requests/ExportBatchDetailsRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchDetailsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchDetailsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchesOrgRequest.ts b/src/api/resources/export/client/requests/ExportBatchesOrgRequest.ts index 32dae162..d716352f 100644 --- a/src/api/resources/export/client/requests/ExportBatchesOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchesOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchesOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchesOutOrgRequest.ts b/src/api/resources/export/client/requests/ExportBatchesOutOrgRequest.ts index 39319ecf..49d9cd2c 100644 --- a/src/api/resources/export/client/requests/ExportBatchesOutOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchesOutOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchesOutOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchesOutRequest.ts b/src/api/resources/export/client/requests/ExportBatchesOutRequest.ts index 093c49c3..1f6271f9 100644 --- a/src/api/resources/export/client/requests/ExportBatchesOutRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchesOutRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchesOutRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBatchesRequest.ts b/src/api/resources/export/client/requests/ExportBatchesRequest.ts index 71ff5ab2..5305a9cf 100644 --- a/src/api/resources/export/client/requests/ExportBatchesRequest.ts +++ b/src/api/resources/export/client/requests/ExportBatchesRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBatchesRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBillsOrgRequest.ts b/src/api/resources/export/client/requests/ExportBillsOrgRequest.ts index 7c721844..0d12d504 100644 --- a/src/api/resources/export/client/requests/ExportBillsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportBillsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBillsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportBillsRequest.ts b/src/api/resources/export/client/requests/ExportBillsRequest.ts index 637ef1bf..446fc6a8 100644 --- a/src/api/resources/export/client/requests/ExportBillsRequest.ts +++ b/src/api/resources/export/client/requests/ExportBillsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportBillsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportChargebacksOrgRequest.ts b/src/api/resources/export/client/requests/ExportChargebacksOrgRequest.ts index 37296a44..1b5e6c12 100644 --- a/src/api/resources/export/client/requests/ExportChargebacksOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportChargebacksOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportChargebacksOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportChargebacksRequest.ts b/src/api/resources/export/client/requests/ExportChargebacksRequest.ts index a0dd40c8..0e109bee 100644 --- a/src/api/resources/export/client/requests/ExportChargebacksRequest.ts +++ b/src/api/resources/export/client/requests/ExportChargebacksRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportChargebacksRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportCustomersOrgRequest.ts b/src/api/resources/export/client/requests/ExportCustomersOrgRequest.ts index 7e264b54..a44fd775 100644 --- a/src/api/resources/export/client/requests/ExportCustomersOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportCustomersOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportCustomersOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportCustomersRequest.ts b/src/api/resources/export/client/requests/ExportCustomersRequest.ts index 426d9ffa..62920541 100644 --- a/src/api/resources/export/client/requests/ExportCustomersRequest.ts +++ b/src/api/resources/export/client/requests/ExportCustomersRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportCustomersRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportInvoicesOrgRequest.ts b/src/api/resources/export/client/requests/ExportInvoicesOrgRequest.ts index b2d4baf4..7291ff1c 100644 --- a/src/api/resources/export/client/requests/ExportInvoicesOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportInvoicesOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportInvoicesOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportInvoicesRequest.ts b/src/api/resources/export/client/requests/ExportInvoicesRequest.ts index bf71ff3f..3607ee4f 100644 --- a/src/api/resources/export/client/requests/ExportInvoicesRequest.ts +++ b/src/api/resources/export/client/requests/ExportInvoicesRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportInvoicesRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportOrganizationsRequest.ts b/src/api/resources/export/client/requests/ExportOrganizationsRequest.ts index 3e82d159..c06c2607 100644 --- a/src/api/resources/export/client/requests/ExportOrganizationsRequest.ts +++ b/src/api/resources/export/client/requests/ExportOrganizationsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportOrganizationsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportPayoutOrgRequest.ts b/src/api/resources/export/client/requests/ExportPayoutOrgRequest.ts index dcf17f9b..116ff1d8 100644 --- a/src/api/resources/export/client/requests/ExportPayoutOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportPayoutOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportPayoutOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportPayoutRequest.ts b/src/api/resources/export/client/requests/ExportPayoutRequest.ts index e00d462c..e351c956 100644 --- a/src/api/resources/export/client/requests/ExportPayoutRequest.ts +++ b/src/api/resources/export/client/requests/ExportPayoutRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportPayoutRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportPaypointsRequest.ts b/src/api/resources/export/client/requests/ExportPaypointsRequest.ts index 4f7b72e0..4a0567c1 100644 --- a/src/api/resources/export/client/requests/ExportPaypointsRequest.ts +++ b/src/api/resources/export/client/requests/ExportPaypointsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportPaypointsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportSettlementsOrgRequest.ts b/src/api/resources/export/client/requests/ExportSettlementsOrgRequest.ts index 63d0501a..e941b55d 100644 --- a/src/api/resources/export/client/requests/ExportSettlementsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportSettlementsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportSettlementsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportSettlementsRequest.ts b/src/api/resources/export/client/requests/ExportSettlementsRequest.ts index 834848cf..4cd211e4 100644 --- a/src/api/resources/export/client/requests/ExportSettlementsRequest.ts +++ b/src/api/resources/export/client/requests/ExportSettlementsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportSettlementsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportSubscriptionsOrgRequest.ts b/src/api/resources/export/client/requests/ExportSubscriptionsOrgRequest.ts index 4276ab67..a1666c90 100644 --- a/src/api/resources/export/client/requests/ExportSubscriptionsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportSubscriptionsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportSubscriptionsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportSubscriptionsRequest.ts b/src/api/resources/export/client/requests/ExportSubscriptionsRequest.ts index 48fb7d24..18f2ab81 100644 --- a/src/api/resources/export/client/requests/ExportSubscriptionsRequest.ts +++ b/src/api/resources/export/client/requests/ExportSubscriptionsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportSubscriptionsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportTransactionsOrgRequest.ts b/src/api/resources/export/client/requests/ExportTransactionsOrgRequest.ts index 1e28f508..cdf93778 100644 --- a/src/api/resources/export/client/requests/ExportTransactionsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportTransactionsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportTransactionsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportTransactionsRequest.ts b/src/api/resources/export/client/requests/ExportTransactionsRequest.ts index 0130d93d..9f7e4da9 100644 --- a/src/api/resources/export/client/requests/ExportTransactionsRequest.ts +++ b/src/api/resources/export/client/requests/ExportTransactionsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportTransactionsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query diff --git a/src/api/resources/export/client/requests/ExportTransferDetailsRequest.ts b/src/api/resources/export/client/requests/ExportTransferDetailsRequest.ts index 8bdbeff4..ce5b4a4c 100644 --- a/src/api/resources/export/client/requests/ExportTransferDetailsRequest.ts +++ b/src/api/resources/export/client/requests/ExportTransferDetailsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -13,13 +11,9 @@ */ export interface ExportTransferDetailsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -65,8 +59,6 @@ export interface ExportTransferDetailsRequest { * - `method` (eq, ne, in, nin) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/export/client/requests/ExportTransfersRequest.ts b/src/api/resources/export/client/requests/ExportTransfersRequest.ts index 86e98fb3..0b7a8fdf 100644 --- a/src/api/resources/export/client/requests/ExportTransfersRequest.ts +++ b/src/api/resources/export/client/requests/ExportTransfersRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -13,13 +11,9 @@ */ export interface ExportTransfersRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -66,8 +60,6 @@ export interface ExportTransfersRequest { * - `batchId` (ne, eq, in, nin) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/export/client/requests/ExportVendorsOrgRequest.ts b/src/api/resources/export/client/requests/ExportVendorsOrgRequest.ts index 3882746a..76b73d80 100644 --- a/src/api/resources/export/client/requests/ExportVendorsOrgRequest.ts +++ b/src/api/resources/export/client/requests/ExportVendorsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportVendorsOrgRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/ExportVendorsRequest.ts b/src/api/resources/export/client/requests/ExportVendorsRequest.ts index 3d70da38..3de3e814 100644 --- a/src/api/resources/export/client/requests/ExportVendorsRequest.ts +++ b/src/api/resources/export/client/requests/ExportVendorsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -12,13 +10,9 @@ */ export interface ExportVendorsRequest { columnsExport?: string; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. - */ + /** The number of records to return for the query. The maximum is 30,000 records. When this parameter isn't sent, the API returns up to 25,000 records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. diff --git a/src/api/resources/export/client/requests/index.ts b/src/api/resources/export/client/requests/index.ts index 100cf6ae..664fcc3a 100644 --- a/src/api/resources/export/client/requests/index.ts +++ b/src/api/resources/export/client/requests/index.ts @@ -1,29 +1,29 @@ -export { type ExportApplicationsRequest } from "./ExportApplicationsRequest.js"; -export { type ExportBatchDetailsRequest } from "./ExportBatchDetailsRequest.js"; -export { type ExportBatchDetailsOrgRequest } from "./ExportBatchDetailsOrgRequest.js"; -export { type ExportBatchesRequest } from "./ExportBatchesRequest.js"; -export { type ExportBatchesOrgRequest } from "./ExportBatchesOrgRequest.js"; -export { type ExportBatchesOutRequest } from "./ExportBatchesOutRequest.js"; -export { type ExportBatchesOutOrgRequest } from "./ExportBatchesOutOrgRequest.js"; -export { type ExportBillsRequest } from "./ExportBillsRequest.js"; -export { type ExportBillsOrgRequest } from "./ExportBillsOrgRequest.js"; -export { type ExportChargebacksRequest } from "./ExportChargebacksRequest.js"; -export { type ExportChargebacksOrgRequest } from "./ExportChargebacksOrgRequest.js"; -export { type ExportCustomersRequest } from "./ExportCustomersRequest.js"; -export { type ExportCustomersOrgRequest } from "./ExportCustomersOrgRequest.js"; -export { type ExportInvoicesRequest } from "./ExportInvoicesRequest.js"; -export { type ExportInvoicesOrgRequest } from "./ExportInvoicesOrgRequest.js"; -export { type ExportOrganizationsRequest } from "./ExportOrganizationsRequest.js"; -export { type ExportPayoutRequest } from "./ExportPayoutRequest.js"; -export { type ExportPayoutOrgRequest } from "./ExportPayoutOrgRequest.js"; -export { type ExportPaypointsRequest } from "./ExportPaypointsRequest.js"; -export { type ExportSettlementsRequest } from "./ExportSettlementsRequest.js"; -export { type ExportSettlementsOrgRequest } from "./ExportSettlementsOrgRequest.js"; -export { type ExportSubscriptionsRequest } from "./ExportSubscriptionsRequest.js"; -export { type ExportSubscriptionsOrgRequest } from "./ExportSubscriptionsOrgRequest.js"; -export { type ExportTransactionsRequest } from "./ExportTransactionsRequest.js"; -export { type ExportTransactionsOrgRequest } from "./ExportTransactionsOrgRequest.js"; -export { type ExportTransferDetailsRequest } from "./ExportTransferDetailsRequest.js"; -export { type ExportTransfersRequest } from "./ExportTransfersRequest.js"; -export { type ExportVendorsRequest } from "./ExportVendorsRequest.js"; -export { type ExportVendorsOrgRequest } from "./ExportVendorsOrgRequest.js"; +export type { ExportApplicationsRequest } from "./ExportApplicationsRequest.js"; +export type { ExportBatchDetailsOrgRequest } from "./ExportBatchDetailsOrgRequest.js"; +export type { ExportBatchDetailsRequest } from "./ExportBatchDetailsRequest.js"; +export type { ExportBatchesOrgRequest } from "./ExportBatchesOrgRequest.js"; +export type { ExportBatchesOutOrgRequest } from "./ExportBatchesOutOrgRequest.js"; +export type { ExportBatchesOutRequest } from "./ExportBatchesOutRequest.js"; +export type { ExportBatchesRequest } from "./ExportBatchesRequest.js"; +export type { ExportBillsOrgRequest } from "./ExportBillsOrgRequest.js"; +export type { ExportBillsRequest } from "./ExportBillsRequest.js"; +export type { ExportChargebacksOrgRequest } from "./ExportChargebacksOrgRequest.js"; +export type { ExportChargebacksRequest } from "./ExportChargebacksRequest.js"; +export type { ExportCustomersOrgRequest } from "./ExportCustomersOrgRequest.js"; +export type { ExportCustomersRequest } from "./ExportCustomersRequest.js"; +export type { ExportInvoicesOrgRequest } from "./ExportInvoicesOrgRequest.js"; +export type { ExportInvoicesRequest } from "./ExportInvoicesRequest.js"; +export type { ExportOrganizationsRequest } from "./ExportOrganizationsRequest.js"; +export type { ExportPayoutOrgRequest } from "./ExportPayoutOrgRequest.js"; +export type { ExportPayoutRequest } from "./ExportPayoutRequest.js"; +export type { ExportPaypointsRequest } from "./ExportPaypointsRequest.js"; +export type { ExportSettlementsOrgRequest } from "./ExportSettlementsOrgRequest.js"; +export type { ExportSettlementsRequest } from "./ExportSettlementsRequest.js"; +export type { ExportSubscriptionsOrgRequest } from "./ExportSubscriptionsOrgRequest.js"; +export type { ExportSubscriptionsRequest } from "./ExportSubscriptionsRequest.js"; +export type { ExportTransactionsOrgRequest } from "./ExportTransactionsOrgRequest.js"; +export type { ExportTransactionsRequest } from "./ExportTransactionsRequest.js"; +export type { ExportTransferDetailsRequest } from "./ExportTransferDetailsRequest.js"; +export type { ExportTransfersRequest } from "./ExportTransfersRequest.js"; +export type { ExportVendorsOrgRequest } from "./ExportVendorsOrgRequest.js"; +export type { ExportVendorsRequest } from "./ExportVendorsRequest.js"; diff --git a/src/api/resources/export/index.ts b/src/api/resources/export/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/export/index.ts +++ b/src/api/resources/export/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/export/types/ExportFormat1.ts b/src/api/resources/export/types/ExportFormat1.ts index e1b5ba87..3acb0b48 100644 --- a/src/api/resources/export/types/ExportFormat1.ts +++ b/src/api/resources/export/types/ExportFormat1.ts @@ -1,9 +1,7 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -export type ExportFormat1 = "csv" | "xlsx"; export const ExportFormat1 = { Csv: "csv", Xlsx: "xlsx", } as const; +export type ExportFormat1 = (typeof ExportFormat1)[keyof typeof ExportFormat1]; diff --git a/src/api/resources/hostedPaymentPages/client/Client.ts b/src/api/resources/hostedPaymentPages/client/Client.ts index 3c8a57c5..fc9593ae 100644 --- a/src/api/resources/hostedPaymentPages/client/Client.ts +++ b/src/api/resources/hostedPaymentPages/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace HostedPaymentPages { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace HostedPaymentPagesClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class HostedPaymentPages { - protected readonly _options: HostedPaymentPages.Options; +export class HostedPaymentPagesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: HostedPaymentPages.Options = {}) { - this._options = _options; + constructor(options: HostedPaymentPagesClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -42,7 +27,7 @@ export class HostedPaymentPages { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} subdomain - Payment page identifier. The subdomain value is the last part of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - * @param {HostedPaymentPages.RequestOptions} requestOptions - Request-specific configuration. + * @param {HostedPaymentPagesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -55,7 +40,7 @@ export class HostedPaymentPages { public loadPage( entry: string, subdomain: string, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__loadPage(entry, subdomain, requestOptions)); } @@ -63,24 +48,29 @@ export class HostedPaymentPages { private async __loadPage( entry: string, subdomain: string, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/load/${encodeURIComponent(entry)}/${encodeURIComponent(subdomain)}`, + `Paypoint/load/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(subdomain)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliPages, rawResponse: _response.rawResponse }; @@ -108,23 +98,12 @@ export class HostedPaymentPages { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Paypoint/load/{entry}/{subdomain}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Paypoint/load/{entry}/{subdomain}", + ); } /** @@ -134,7 +113,7 @@ export class HostedPaymentPages { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.NewPageRequest} request - * @param {HostedPaymentPages.RequestOptions} requestOptions - Request-specific configuration. + * @param {HostedPaymentPagesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -150,7 +129,7 @@ export class HostedPaymentPages { public newPage( entry: string, request: Payabli.NewPageRequest, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__newPage(entry, request, requestOptions)); } @@ -158,31 +137,34 @@ export class HostedPaymentPages { private async __newPage( entry: string, request: Payabli.NewPageRequest, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): Promise> { const { idempotencyKey, body: _body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/${encodeURIComponent(entry)}`, + `Paypoint/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -213,21 +195,7 @@ export class HostedPaymentPages { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Paypoint/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Paypoint/{entry}"); } /** @@ -236,7 +204,7 @@ export class HostedPaymentPages { * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} subdomain - Payment page identifier. The subdomain value is the last part of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. * @param {Payabli.PayabliPages} request - * @param {HostedPaymentPages.RequestOptions} requestOptions - Request-specific configuration. + * @param {HostedPaymentPagesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -250,7 +218,7 @@ export class HostedPaymentPages { entry: string, subdomain: string, request: Payabli.PayabliPages, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__savePage(entry, subdomain, request, requestOptions)); } @@ -259,27 +227,32 @@ export class HostedPaymentPages { entry: string, subdomain: string, request: Payabli.PayabliPages, - requestOptions?: HostedPaymentPages.RequestOptions, + requestOptions?: HostedPaymentPagesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/${encodeURIComponent(entry)}/${encodeURIComponent(subdomain)}`, + `Paypoint/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(subdomain)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -310,27 +283,6 @@ export class HostedPaymentPages { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling PUT /Paypoint/{entry}/{subdomain}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Paypoint/{entry}/{subdomain}"); } } diff --git a/src/api/resources/hostedPaymentPages/client/index.ts b/src/api/resources/hostedPaymentPages/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/hostedPaymentPages/client/index.ts +++ b/src/api/resources/hostedPaymentPages/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/hostedPaymentPages/client/requests/NewPageRequest.ts b/src/api/resources/hostedPaymentPages/client/requests/NewPageRequest.ts index cbf9c3f5..8345bb9b 100644 --- a/src/api/resources/hostedPaymentPages/client/requests/NewPageRequest.ts +++ b/src/api/resources/hostedPaymentPages/client/requests/NewPageRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/hostedPaymentPages/client/requests/index.ts b/src/api/resources/hostedPaymentPages/client/requests/index.ts index 2f72f896..1d19ff0c 100644 --- a/src/api/resources/hostedPaymentPages/client/requests/index.ts +++ b/src/api/resources/hostedPaymentPages/client/requests/index.ts @@ -1 +1 @@ -export { type NewPageRequest } from "./NewPageRequest.js"; +export type { NewPageRequest } from "./NewPageRequest.js"; diff --git a/src/api/resources/import/client/Client.ts b/src/api/resources/import/client/Client.ts index 80b5d689..4d05aec9 100644 --- a/src/api/resources/import/client/Client.ts +++ b/src/api/resources/import/client/Client.ts @@ -1,41 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import * as fs from "fs"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Import { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace ImportClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Import { - protected readonly _options: Import.Options; +export class ImportClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Import.Options = {}) { - this._options = _options; + constructor(options: ImportClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +27,7 @@ export class Import { * * @param {string} entry * @param {Payabli.ImportBillsRequest} request - * @param {Import.RequestOptions} requestOptions - Request-specific configuration. + * @param {ImportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -51,6 +35,7 @@ export class Import { * @throws {@link Payabli.ServiceUnavailableError} * * @example + * import { createReadStream } from "fs"; * await client.import.importBills("8cfec329267", { * file: fs.createReadStream("/path/to/your/file") * }) @@ -58,7 +43,7 @@ export class Import { public importBills( entry: string, request: Payabli.ImportBillsRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__importBills(entry, request, requestOptions)); } @@ -66,33 +51,36 @@ export class Import { private async __importBills( entry: string, request: Payabli.ImportBillsRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): Promise> { const _request = await core.newFormData(); await _request.appendFile("file", request.file); const _maybeEncodedRequest = await _request.getRequest(); + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ ..._maybeEncodedRequest.headers }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Import/billsForm/${encodeURIComponent(entry)}`, + `Import/billsForm/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - ...(await this._getCustomAuthorizationHeaders()), - ..._maybeEncodedRequest.headers, - }), - requestOptions?.headers, - ), + headers: _headers, + queryParameters: requestOptions?.queryParams, requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseImport, rawResponse: _response.rawResponse }; @@ -120,21 +108,7 @@ export class Import { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Import/billsForm/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Import/billsForm/{entry}"); } /** @@ -142,7 +116,7 @@ export class Import { * * @param {Payabli.Entrypointfield} entry * @param {Payabli.ImportCustomerRequest} request - * @param {Import.RequestOptions} requestOptions - Request-specific configuration. + * @param {ImportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -150,6 +124,7 @@ export class Import { * @throws {@link Payabli.ServiceUnavailableError} * * @example + * import { createReadStream } from "fs"; * await client.import.importCustomer("8cfec329267", { * file: fs.createReadStream("/path/to/your/file") * }) @@ -157,7 +132,7 @@ export class Import { public importCustomer( entry: Payabli.Entrypointfield, request: Payabli.ImportCustomerRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__importCustomer(entry, request, requestOptions)); } @@ -165,39 +140,41 @@ export class Import { private async __importCustomer( entry: Payabli.Entrypointfield, request: Payabli.ImportCustomerRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): Promise> { const _queryParams: Record = {}; if (request.replaceExisting != null) { - _queryParams["replaceExisting"] = request.replaceExisting.toString(); + _queryParams.replaceExisting = request.replaceExisting.toString(); } const _request = await core.newFormData(); await _request.appendFile("file", request.file); const _maybeEncodedRequest = await _request.getRequest(); + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ ..._maybeEncodedRequest.headers }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Import/customersForm/${encodeURIComponent(entry)}`, + `Import/customersForm/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - ...(await this._getCustomAuthorizationHeaders()), - ..._maybeEncodedRequest.headers, - }), - requestOptions?.headers, - ), - queryParameters: _queryParams, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseImport, rawResponse: _response.rawResponse }; @@ -225,23 +202,12 @@ export class Import { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Import/customersForm/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Import/customersForm/{entry}", + ); } /** @@ -249,7 +215,7 @@ export class Import { * * @param {Payabli.Entrypointfield} entry * @param {Payabli.ImportVendorRequest} request - * @param {Import.RequestOptions} requestOptions - Request-specific configuration. + * @param {ImportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -257,6 +223,7 @@ export class Import { * @throws {@link Payabli.ServiceUnavailableError} * * @example + * import { createReadStream } from "fs"; * await client.import.importVendor("8cfec329267", { * file: fs.createReadStream("/path/to/your/file") * }) @@ -264,7 +231,7 @@ export class Import { public importVendor( entry: Payabli.Entrypointfield, request: Payabli.ImportVendorRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__importVendor(entry, request, requestOptions)); } @@ -272,33 +239,36 @@ export class Import { private async __importVendor( entry: Payabli.Entrypointfield, request: Payabli.ImportVendorRequest, - requestOptions?: Import.RequestOptions, + requestOptions?: ImportClient.RequestOptions, ): Promise> { const _request = await core.newFormData(); await _request.appendFile("file", request.file); const _maybeEncodedRequest = await _request.getRequest(); + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ ..._maybeEncodedRequest.headers }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Import/vendorsForm/${encodeURIComponent(entry)}`, + `Import/vendorsForm/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - ...(await this._getCustomAuthorizationHeaders()), - ..._maybeEncodedRequest.headers, - }), - requestOptions?.headers, - ), + headers: _headers, + queryParameters: requestOptions?.queryParams, requestType: "file", duplex: _maybeEncodedRequest.duplex, body: _maybeEncodedRequest.body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseImport, rawResponse: _response.rawResponse }; @@ -326,25 +296,6 @@ export class Import { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Import/vendorsForm/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Import/vendorsForm/{entry}"); } } diff --git a/src/api/resources/import/client/index.ts b/src/api/resources/import/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/import/client/index.ts +++ b/src/api/resources/import/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/import/client/requests/ImportBillsRequest.ts b/src/api/resources/import/client/requests/ImportBillsRequest.ts index faae6d49..ce81441f 100644 --- a/src/api/resources/import/client/requests/ImportBillsRequest.ts +++ b/src/api/resources/import/client/requests/ImportBillsRequest.ts @@ -1,9 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as fs from "fs"; -import * as core from "../../../../../core/index.js"; +import type * as core from "../../../../../core/index.js"; /** * @example @@ -12,5 +9,6 @@ import * as core from "../../../../../core/index.js"; * } */ export interface ImportBillsRequest { - file: core.FileLike; + /** The file to be imported. The file must be a CSV file with the correct format. See the [Import Guide](/developers/developer-guides/bills-add#import-bills) for more help and example files. */ + file: core.file.Uploadable; } diff --git a/src/api/resources/import/client/requests/ImportCustomerRequest.ts b/src/api/resources/import/client/requests/ImportCustomerRequest.ts index 712aa3fc..5bd94ad9 100644 --- a/src/api/resources/import/client/requests/ImportCustomerRequest.ts +++ b/src/api/resources/import/client/requests/ImportCustomerRequest.ts @@ -1,9 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as fs from "fs"; -import * as core from "../../../../../core/index.js"; +import type * as core from "../../../../../core/index.js"; /** * @example @@ -12,9 +9,7 @@ import * as core from "../../../../../core/index.js"; * } */ export interface ImportCustomerRequest { - /** - * Flag indicating to replace existing customer with a new record. Possible values: 0 (do not replace), 1 (replace). Default is 0 - */ + /** Flag indicating to replace existing customer with a new record. Possible values: 0 (do not replace), 1 (replace). Default is 0 */ replaceExisting?: number; - file: core.FileLike; + file: core.file.Uploadable; } diff --git a/src/api/resources/import/client/requests/ImportVendorRequest.ts b/src/api/resources/import/client/requests/ImportVendorRequest.ts index e9db4fc8..abcc5d26 100644 --- a/src/api/resources/import/client/requests/ImportVendorRequest.ts +++ b/src/api/resources/import/client/requests/ImportVendorRequest.ts @@ -1,9 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as fs from "fs"; -import * as core from "../../../../../core/index.js"; +import type * as core from "../../../../../core/index.js"; /** * @example @@ -12,5 +9,5 @@ import * as core from "../../../../../core/index.js"; * } */ export interface ImportVendorRequest { - file: core.FileLike; + file: core.file.Uploadable; } diff --git a/src/api/resources/import/client/requests/index.ts b/src/api/resources/import/client/requests/index.ts index 9c9e8ced..5e79963b 100644 --- a/src/api/resources/import/client/requests/index.ts +++ b/src/api/resources/import/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type ImportBillsRequest } from "./ImportBillsRequest.js"; -export { type ImportCustomerRequest } from "./ImportCustomerRequest.js"; -export { type ImportVendorRequest } from "./ImportVendorRequest.js"; +export type { ImportBillsRequest } from "./ImportBillsRequest.js"; +export type { ImportCustomerRequest } from "./ImportCustomerRequest.js"; +export type { ImportVendorRequest } from "./ImportVendorRequest.js"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 20b7cdb0..4a9bfc75 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,78 +1,78 @@ -export * as moneyOutTypes from "./moneyOutTypes/index.js"; -export * from "./moneyOutTypes/types/index.js"; -export * as queryTypes from "./queryTypes/index.js"; -export * from "./queryTypes/types/index.js"; +export * from "./bill/client/requests/index.js"; export * as bill from "./bill/index.js"; export * from "./bill/types/index.js"; +export * from "./boarding/client/requests/index.js"; export * as boarding from "./boarding/index.js"; export * from "./boarding/types/index.js"; +export * from "./chargeBacks/client/requests/index.js"; export * as chargeBacks from "./chargeBacks/index.js"; export * from "./chargeBacks/types/index.js"; +export * from "./checkCapture/client/requests/index.js"; export * as checkCapture from "./checkCapture/index.js"; export * from "./checkCapture/types/index.js"; +export * from "./cloud/client/requests/index.js"; export * as cloud from "./cloud/index.js"; export * from "./cloud/types/index.js"; +export * from "./customer/client/requests/index.js"; +export * as customer from "./customer/index.js"; +export * from "./export/client/requests/index.js"; export * as export_ from "./export/index.js"; export * from "./export/types/index.js"; +export * from "./hostedPaymentPages/client/requests/index.js"; +export * as hostedPaymentPages from "./hostedPaymentPages/index.js"; +export * from "./import/client/requests/index.js"; +export * as import_ from "./import/index.js"; +export * from "./invoice/client/requests/index.js"; export * as invoice from "./invoice/index.js"; export * from "./invoice/types/index.js"; +export * from "./lineItem/client/requests/index.js"; export * as lineItem from "./lineItem/index.js"; export * from "./lineItem/types/index.js"; +export * from "./moneyIn/client/requests/index.js"; +export * from "./moneyIn/errors/index.js"; export * as moneyIn from "./moneyIn/index.js"; export * from "./moneyIn/types/index.js"; +export * from "./moneyOut/client/requests/index.js"; +export * as moneyOut from "./moneyOut/index.js"; +export * as moneyOutTypes from "./moneyOutTypes/index.js"; +export * from "./moneyOutTypes/types/index.js"; export * as notification from "./notification/index.js"; export * from "./notification/types/index.js"; +export * from "./notificationlogs/client/requests/index.js"; export * as notificationlogs from "./notificationlogs/index.js"; export * from "./notificationlogs/types/index.js"; export * as ocr from "./ocr/index.js"; export * from "./ocr/types/index.js"; +export * from "./organization/client/requests/index.js"; export * as organization from "./organization/index.js"; export * from "./organization/types/index.js"; +export * from "./paymentLink/client/requests/index.js"; export * as paymentLink from "./paymentLink/index.js"; export * from "./paymentLink/types/index.js"; +export * from "./paymentMethodDomain/client/requests/index.js"; export * as paymentMethodDomain from "./paymentMethodDomain/index.js"; export * from "./paymentMethodDomain/types/index.js"; +export * from "./paypoint/client/requests/index.js"; export * as paypoint from "./paypoint/index.js"; export * from "./paypoint/types/index.js"; +export * from "./query/client/requests/index.js"; +export * as query from "./query/index.js"; +export * as queryTypes from "./queryTypes/index.js"; +export * from "./queryTypes/types/index.js"; +export * from "./statistic/client/requests/index.js"; export * as statistic from "./statistic/index.js"; export * from "./statistic/types/index.js"; +export * from "./subscription/client/requests/index.js"; export * as subscription from "./subscription/index.js"; export * from "./subscription/types/index.js"; +export * from "./templates/client/requests/index.js"; +export * as templates from "./templates/index.js"; +export * from "./tokenStorage/client/requests/index.js"; export * as tokenStorage from "./tokenStorage/index.js"; export * from "./tokenStorage/types/index.js"; +export * from "./user/client/requests/index.js"; export * as user from "./user/index.js"; export * from "./user/types/index.js"; -export * from "./moneyIn/errors/index.js"; -export * as customer from "./customer/index.js"; -export * as hostedPaymentPages from "./hostedPaymentPages/index.js"; -export * as import_ from "./import/index.js"; -export * as moneyOut from "./moneyOut/index.js"; -export * as query from "./query/index.js"; -export * as templates from "./templates/index.js"; export * as vendor from "./vendor/index.js"; -export * as wallet from "./wallet/index.js"; -export * from "./bill/client/requests/index.js"; -export * from "./boarding/client/requests/index.js"; -export * from "./chargeBacks/client/requests/index.js"; -export * from "./checkCapture/client/requests/index.js"; -export * from "./cloud/client/requests/index.js"; -export * from "./customer/client/requests/index.js"; -export * from "./export/client/requests/index.js"; -export * from "./hostedPaymentPages/client/requests/index.js"; -export * from "./import/client/requests/index.js"; -export * from "./invoice/client/requests/index.js"; -export * from "./lineItem/client/requests/index.js"; -export * from "./moneyIn/client/requests/index.js"; -export * from "./moneyOut/client/requests/index.js"; -export * from "./notificationlogs/client/requests/index.js"; -export * from "./organization/client/requests/index.js"; -export * from "./paymentLink/client/requests/index.js"; -export * from "./paymentMethodDomain/client/requests/index.js"; -export * from "./paypoint/client/requests/index.js"; -export * from "./query/client/requests/index.js"; -export * from "./statistic/client/requests/index.js"; -export * from "./subscription/client/requests/index.js"; -export * from "./templates/client/requests/index.js"; -export * from "./tokenStorage/client/requests/index.js"; -export * from "./user/client/requests/index.js"; export * from "./wallet/client/requests/index.js"; +export * as wallet from "./wallet/index.js"; diff --git a/src/api/resources/invoice/client/Client.ts b/src/api/resources/invoice/client/Client.ts index d8d5570c..e2465925 100644 --- a/src/api/resources/invoice/client/Client.ts +++ b/src/api/resources/invoice/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as errors from "../../../../errors/index.js"; +import * as core from "../../../../core/index.js"; import { toJson } from "../../../../core/json.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Invoice { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace InvoiceClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Invoice { - protected readonly _options: Invoice.Options; +export class InvoiceClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Invoice.Options = {}) { - this._options = _options; + constructor(options: InvoiceClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +28,7 @@ export class Invoice { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.AddInvoiceRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -85,7 +70,7 @@ export class Invoice { public addInvoice( entry: string, request: Payabli.AddInvoiceRequest, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addInvoice(entry, request, requestOptions)); } @@ -93,37 +78,39 @@ export class Invoice { private async __addInvoice( entry: string, request: Payabli.AddInvoiceRequest, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { forceCustomerCreation, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/${encodeURIComponent(entry)}`, + `Invoice/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.InvoiceResponseWithoutData, rawResponse: _response.rawResponse }; @@ -151,21 +138,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Invoice/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Invoice/{entry}"); } /** @@ -183,7 +156,7 @@ export class Invoice { * } * ] * } - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -196,7 +169,7 @@ export class Invoice { public deleteAttachedFromInvoice( idInvoice: number, filename: string, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__deleteAttachedFromInvoice(idInvoice, filename, requestOptions), @@ -206,24 +179,29 @@ export class Invoice { private async __deleteAttachedFromInvoice( idInvoice: number, filename: string, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/attachedFileFromInvoice/${encodeURIComponent(idInvoice)}/${encodeURIComponent(filename)}`, + `Invoice/attachedFileFromInvoice/${core.url.encodePathParam(idInvoice)}/${core.url.encodePathParam(filename)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.InvoiceResponseWithoutData, rawResponse: _response.rawResponse }; @@ -251,30 +229,19 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}", + ); } /** * Deletes a single invoice from an entrypoint. * * @param {number} idInvoice - Invoice ID - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -286,31 +253,36 @@ export class Invoice { */ public deleteInvoice( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteInvoice(idInvoice, requestOptions)); } private async __deleteInvoice( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/${encodeURIComponent(idInvoice)}`, + `Invoice/${core.url.encodePathParam(idInvoice)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.InvoiceResponseWithoutData, rawResponse: _response.rawResponse }; @@ -338,21 +310,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Invoice/{idInvoice}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Invoice/{idInvoice}"); } /** @@ -360,7 +318,7 @@ export class Invoice { * * @param {number} idInvoice - Invoice ID * @param {Payabli.EditInvoiceRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -387,7 +345,7 @@ export class Invoice { public editInvoice( idInvoice: number, request: Payabli.EditInvoiceRequest, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editInvoice(idInvoice, request, requestOptions)); } @@ -395,34 +353,38 @@ export class Invoice { private async __editInvoice( idInvoice: number, request: Payabli.EditInvoiceRequest, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { forceCustomerCreation, body: _body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/${encodeURIComponent(idInvoice)}`, + `Invoice/${core.url.encodePathParam(idInvoice)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.InvoiceResponseWithoutData, rawResponse: _response.rawResponse }; @@ -450,21 +412,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Invoice/{idInvoice}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Invoice/{idInvoice}"); } /** @@ -485,7 +433,7 @@ export class Invoice { * } * ``` * @param {Payabli.GetAttachedFileFromInvoiceRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -499,7 +447,7 @@ export class Invoice { idInvoice: number, filename: string, request: Payabli.GetAttachedFileFromInvoiceRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__getAttachedFileFromInvoice(idInvoice, filename, request, requestOptions), @@ -510,31 +458,35 @@ export class Invoice { idInvoice: number, filename: string, request: Payabli.GetAttachedFileFromInvoiceRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { returnObject } = request; const _queryParams: Record = {}; if (returnObject != null) { - _queryParams["returnObject"] = returnObject.toString(); + _queryParams.returnObject = returnObject.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/attachedFileFromInvoice/${encodeURIComponent(idInvoice)}/${encodeURIComponent(filename)}`, + `Invoice/attachedFileFromInvoice/${core.url.encodePathParam(idInvoice)}/${core.url.encodePathParam(filename)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.FileContent, rawResponse: _response.rawResponse }; @@ -562,30 +514,19 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Invoice/attachedFileFromInvoice/{idInvoice}/{filename}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Invoice/attachedFileFromInvoice/{idInvoice}/{filename}", + ); } /** * Retrieves a single invoice by ID. * * @param {number} idInvoice - Invoice ID - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -597,31 +538,36 @@ export class Invoice { */ public getInvoice( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getInvoice(idInvoice, requestOptions)); } private async __getInvoice( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/${encodeURIComponent(idInvoice)}`, + `Invoice/${core.url.encodePathParam(idInvoice)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetInvoiceRecord, rawResponse: _response.rawResponse }; @@ -649,28 +595,14 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/{idInvoice}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/{idInvoice}"); } /** * Retrieves the next available invoice number for a paypoint. * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -682,31 +614,36 @@ export class Invoice { */ public getInvoiceNumber( entry: string, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getInvoiceNumber(entry, requestOptions)); } private async __getInvoiceNumber( entry: string, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/getNumber/${encodeURIComponent(entry)}`, + `Invoice/getNumber/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.InvoiceNumberResponse, rawResponse: _response.rawResponse }; @@ -734,21 +671,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/getNumber/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/getNumber/{entry}"); } /** @@ -756,7 +679,7 @@ export class Invoice { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListInvoicesRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -773,7 +696,7 @@ export class Invoice { public listInvoices( entry: string, request: Payabli.ListInvoicesRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listInvoices(entry, request, requestOptions)); } @@ -781,47 +704,51 @@ export class Invoice { private async __listInvoices( entry: string, request: Payabli.ListInvoicesRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/invoices/${encodeURIComponent(entry)}`, + `Query/invoices/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryInvoiceResponse, rawResponse: _response.rawResponse }; @@ -849,21 +776,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/invoices/{entry}"); } /** @@ -871,7 +784,7 @@ export class Invoice { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListInvoicesOrgRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -888,7 +801,7 @@ export class Invoice { public listInvoicesOrg( orgId: number, request: Payabli.ListInvoicesOrgRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listInvoicesOrg(orgId, request, requestOptions)); } @@ -896,47 +809,51 @@ export class Invoice { private async __listInvoicesOrg( orgId: number, request: Payabli.ListInvoicesOrgRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/invoices/org/${encodeURIComponent(orgId)}`, + `Query/invoices/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryInvoiceResponse, rawResponse: _response.rawResponse }; @@ -964,21 +881,7 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/invoices/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/invoices/org/{orgId}"); } /** @@ -986,7 +889,7 @@ export class Invoice { * * @param {number} idInvoice - Invoice ID * @param {Payabli.SendInvoiceRequest} request - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1002,7 +905,7 @@ export class Invoice { public sendInvoice( idInvoice: number, request: Payabli.SendInvoiceRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sendInvoice(idInvoice, request, requestOptions)); } @@ -1010,35 +913,39 @@ export class Invoice { private async __sendInvoice( idInvoice: number, request: Payabli.SendInvoiceRequest = {}, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { const { attachfile, mail2 } = request; const _queryParams: Record = {}; if (attachfile != null) { - _queryParams["attachfile"] = attachfile.toString(); + _queryParams.attachfile = attachfile.toString(); } if (mail2 != null) { - _queryParams["mail2"] = mail2; + _queryParams.mail2 = mail2; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Invoice/send/${encodeURIComponent(idInvoice)}`, + `Invoice/send/${core.url.encodePathParam(idInvoice)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.SendInvoiceResponse, rawResponse: _response.rawResponse }; @@ -1066,28 +973,14 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Invoice/send/{idInvoice}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Invoice/send/{idInvoice}"); } /** * Export a single invoice in PDF format. * * @param {number} idInvoice - Invoice ID - * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. + * @param {InvoiceClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1099,31 +992,36 @@ export class Invoice { */ public getInvoicePdf( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getInvoicePdf(idInvoice, requestOptions)); } private async __getInvoicePdf( idInvoice: number, - requestOptions?: Invoice.RequestOptions, + requestOptions?: InvoiceClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/invoicePdf/${encodeURIComponent(idInvoice)}`, + `Export/invoicePdf/${core.url.encodePathParam(idInvoice)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -1151,27 +1049,11 @@ export class Invoice { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/invoicePdf/{idInvoice}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/invoicePdf/{idInvoice}", + ); } } diff --git a/src/api/resources/invoice/client/index.ts b/src/api/resources/invoice/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/invoice/client/index.ts +++ b/src/api/resources/invoice/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/invoice/client/requests/AddInvoiceRequest.ts b/src/api/resources/invoice/client/requests/AddInvoiceRequest.ts index a41c1d39..54dcea94 100644 --- a/src/api/resources/invoice/client/requests/AddInvoiceRequest.ts +++ b/src/api/resources/invoice/client/requests/AddInvoiceRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/invoice/client/requests/EditInvoiceRequest.ts b/src/api/resources/invoice/client/requests/EditInvoiceRequest.ts index e451adfd..e1f51dd5 100644 --- a/src/api/resources/invoice/client/requests/EditInvoiceRequest.ts +++ b/src/api/resources/invoice/client/requests/EditInvoiceRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -23,9 +21,7 @@ import * as Payabli from "../../../../index.js"; * } */ export interface EditInvoiceRequest { - /** - * When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. - */ + /** When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. */ forceCustomerCreation?: boolean; body: Payabli.InvoiceDataRequest; } diff --git a/src/api/resources/invoice/client/requests/GetAttachedFileFromInvoiceRequest.ts b/src/api/resources/invoice/client/requests/GetAttachedFileFromInvoiceRequest.ts index 3c8c9914..efd0bd06 100644 --- a/src/api/resources/invoice/client/requests/GetAttachedFileFromInvoiceRequest.ts +++ b/src/api/resources/invoice/client/requests/GetAttachedFileFromInvoiceRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface GetAttachedFileFromInvoiceRequest { - /** - * When `true`, the request returns the file content as a Base64-encoded string. - */ + /** When `true`, the request returns the file content as a Base64-encoded string. */ returnObject?: boolean; } diff --git a/src/api/resources/invoice/client/requests/ListInvoicesOrgRequest.ts b/src/api/resources/invoice/client/requests/ListInvoicesOrgRequest.ts index 66c3b0c5..4a9bd7bf 100644 --- a/src/api/resources/invoice/client/requests/ListInvoicesOrgRequest.ts +++ b/src/api/resources/invoice/client/requests/ListInvoicesOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListInvoicesOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -88,8 +82,6 @@ export interface ListInvoicesOrgRequest { * Example: totalAmount(gt)=20 return all records with totalAmount greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/invoice/client/requests/ListInvoicesRequest.ts b/src/api/resources/invoice/client/requests/ListInvoicesRequest.ts index 03139189..d32a02b6 100644 --- a/src/api/resources/invoice/client/requests/ListInvoicesRequest.ts +++ b/src/api/resources/invoice/client/requests/ListInvoicesRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListInvoicesRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -88,8 +82,6 @@ export interface ListInvoicesRequest { * Example: totalAmount(gt)=20 return all records with totalAmount greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/invoice/client/requests/SendInvoiceRequest.ts b/src/api/resources/invoice/client/requests/SendInvoiceRequest.ts index 2580d492..75b22fde 100644 --- a/src/api/resources/invoice/client/requests/SendInvoiceRequest.ts +++ b/src/api/resources/invoice/client/requests/SendInvoiceRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -10,12 +8,8 @@ * } */ export interface SendInvoiceRequest { - /** - * When `true`, attaches a PDF version of invoice to the email. - */ + /** When `true`, attaches a PDF version of invoice to the email. */ attachfile?: boolean; - /** - * Email address where the invoice will be sent to. If this parameter isn't included, Payabli uses the email address on file for the customer owner of the invoice. - */ + /** Email address where the invoice will be sent to. If this parameter isn't included, Payabli uses the email address on file for the customer owner of the invoice. */ mail2?: string; } diff --git a/src/api/resources/invoice/client/requests/index.ts b/src/api/resources/invoice/client/requests/index.ts index d950787e..4c6b4ba0 100644 --- a/src/api/resources/invoice/client/requests/index.ts +++ b/src/api/resources/invoice/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type AddInvoiceRequest } from "./AddInvoiceRequest.js"; -export { type EditInvoiceRequest } from "./EditInvoiceRequest.js"; -export { type GetAttachedFileFromInvoiceRequest } from "./GetAttachedFileFromInvoiceRequest.js"; -export { type ListInvoicesRequest } from "./ListInvoicesRequest.js"; -export { type ListInvoicesOrgRequest } from "./ListInvoicesOrgRequest.js"; -export { type SendInvoiceRequest } from "./SendInvoiceRequest.js"; +export type { AddInvoiceRequest } from "./AddInvoiceRequest.js"; +export type { EditInvoiceRequest } from "./EditInvoiceRequest.js"; +export type { GetAttachedFileFromInvoiceRequest } from "./GetAttachedFileFromInvoiceRequest.js"; +export type { ListInvoicesOrgRequest } from "./ListInvoicesOrgRequest.js"; +export type { ListInvoicesRequest } from "./ListInvoicesRequest.js"; +export type { SendInvoiceRequest } from "./SendInvoiceRequest.js"; diff --git a/src/api/resources/invoice/index.ts b/src/api/resources/invoice/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/invoice/index.ts +++ b/src/api/resources/invoice/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/invoice/types/GetInvoiceRecord.ts b/src/api/resources/invoice/types/GetInvoiceRecord.ts index 2ec139c4..dc7ea930 100644 --- a/src/api/resources/invoice/types/GetInvoiceRecord.ts +++ b/src/api/resources/invoice/types/GetInvoiceRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetInvoiceRecord { invoiceId: Payabli.InvoiceId; diff --git a/src/api/resources/invoice/types/InvoiceDataRequest.ts b/src/api/resources/invoice/types/InvoiceDataRequest.ts index 40953d8f..90be28c3 100644 --- a/src/api/resources/invoice/types/InvoiceDataRequest.ts +++ b/src/api/resources/invoice/types/InvoiceDataRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface InvoiceDataRequest { /** Object describing the customer/payor. Required for POST requests. Which fields are required depends on the paypoint's custom identifier settings. */ diff --git a/src/api/resources/invoice/types/InvoiceId.ts b/src/api/resources/invoice/types/InvoiceId.ts index bdceb66a..8f1182fd 100644 --- a/src/api/resources/invoice/types/InvoiceId.ts +++ b/src/api/resources/invoice/types/InvoiceId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of invoice. diff --git a/src/api/resources/invoice/types/InvoiceNumberResponse.ts b/src/api/resources/invoice/types/InvoiceNumberResponse.ts index 69838175..fed65867 100644 --- a/src/api/resources/invoice/types/InvoiceNumberResponse.ts +++ b/src/api/resources/invoice/types/InvoiceNumberResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response schema for operations for sending invoices or getting next invoice number. diff --git a/src/api/resources/invoice/types/InvoicePaidAmount.ts b/src/api/resources/invoice/types/InvoicePaidAmount.ts index 2c67f5c0..baf0f7a1 100644 --- a/src/api/resources/invoice/types/InvoicePaidAmount.ts +++ b/src/api/resources/invoice/types/InvoicePaidAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Amount partially paid to the invoice. diff --git a/src/api/resources/invoice/types/InvoiceResponseWithoutData.ts b/src/api/resources/invoice/types/InvoiceResponseWithoutData.ts index f779836c..a5f97f98 100644 --- a/src/api/resources/invoice/types/InvoiceResponseWithoutData.ts +++ b/src/api/resources/invoice/types/InvoiceResponseWithoutData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response schema for invoice operations. diff --git a/src/api/resources/invoice/types/QueryInvoiceResponse.ts b/src/api/resources/invoice/types/QueryInvoiceResponse.ts index b87095f6..55d907a5 100644 --- a/src/api/resources/invoice/types/QueryInvoiceResponse.ts +++ b/src/api/resources/invoice/types/QueryInvoiceResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface QueryInvoiceResponse { Records: QueryInvoiceResponse.Records.Item[]; diff --git a/src/api/resources/invoice/types/SendInvoiceResponse.ts b/src/api/resources/invoice/types/SendInvoiceResponse.ts index b3e8861c..8ed710a2 100644 --- a/src/api/resources/invoice/types/SendInvoiceResponse.ts +++ b/src/api/resources/invoice/types/SendInvoiceResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface SendInvoiceResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/invoice/types/index.ts b/src/api/resources/invoice/types/index.ts index 49f2c866..c290cdf3 100644 --- a/src/api/resources/invoice/types/index.ts +++ b/src/api/resources/invoice/types/index.ts @@ -1,8 +1,8 @@ -export * from "./InvoicePaidAmount.js"; -export * from "./InvoiceId.js"; -export * from "./InvoiceDataRequest.js"; export * from "./GetInvoiceRecord.js"; -export * from "./QueryInvoiceResponse.js"; +export * from "./InvoiceDataRequest.js"; +export * from "./InvoiceId.js"; +export * from "./InvoiceNumberResponse.js"; +export * from "./InvoicePaidAmount.js"; export * from "./InvoiceResponseWithoutData.js"; +export * from "./QueryInvoiceResponse.js"; export * from "./SendInvoiceResponse.js"; -export * from "./InvoiceNumberResponse.js"; diff --git a/src/api/resources/lineItem/client/Client.ts b/src/api/resources/lineItem/client/Client.ts index e8a54608..b665df96 100644 --- a/src/api/resources/lineItem/client/Client.ts +++ b/src/api/resources/lineItem/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as errors from "../../../../errors/index.js"; +import * as core from "../../../../core/index.js"; import { toJson } from "../../../../core/json.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace LineItem { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace LineItemClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class LineItem { - protected readonly _options: LineItem.Options; +export class LineItemClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: LineItem.Options = {}) { - this._options = _options; + constructor(options: LineItemClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +28,7 @@ export class LineItem { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.AddItemRequest} request - * @param {LineItem.RequestOptions} requestOptions - Request-specific configuration. + * @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -67,7 +52,7 @@ export class LineItem { public addItem( entry: string, request: Payabli.AddItemRequest, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addItem(entry, request, requestOptions)); } @@ -75,31 +60,34 @@ export class LineItem { private async __addItem( entry: string, request: Payabli.AddItemRequest, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): Promise> { const { idempotencyKey, body: _body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `LineItem/${encodeURIComponent(entry)}`, + `LineItem/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse6, rawResponse: _response.rawResponse }; @@ -127,28 +115,14 @@ export class LineItem { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /LineItem/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/LineItem/{entry}"); } /** * Deletes an item. * * @param {number} lineItemId - ID for the line item (also known as a product, service, or item). - * @param {LineItem.RequestOptions} requestOptions - Request-specific configuration. + * @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -160,31 +134,36 @@ export class LineItem { */ public deleteItem( lineItemId: number, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteItem(lineItemId, requestOptions)); } private async __deleteItem( lineItemId: number, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `LineItem/${encodeURIComponent(lineItemId)}`, + `LineItem/${core.url.encodePathParam(lineItemId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.DeleteItemResponse, rawResponse: _response.rawResponse }; @@ -212,28 +191,14 @@ export class LineItem { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /LineItem/{lineItemId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/LineItem/{lineItemId}"); } /** * Gets an item by ID. * * @param {number} lineItemId - ID for the line item (also known as a product, service, or item). - * @param {LineItem.RequestOptions} requestOptions - Request-specific configuration. + * @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -245,31 +210,36 @@ export class LineItem { */ public getItem( lineItemId: number, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getItem(lineItemId, requestOptions)); } private async __getItem( lineItemId: number, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `LineItem/${encodeURIComponent(lineItemId)}`, + `LineItem/${core.url.encodePathParam(lineItemId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.LineItemQueryRecord, rawResponse: _response.rawResponse }; @@ -297,21 +267,7 @@ export class LineItem { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /LineItem/{lineItemId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/LineItem/{lineItemId}"); } /** @@ -319,7 +275,7 @@ export class LineItem { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListLineItemsRequest} request - * @param {LineItem.RequestOptions} requestOptions - Request-specific configuration. + * @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -336,7 +292,7 @@ export class LineItem { public listLineItems( entry: string, request: Payabli.ListLineItemsRequest = {}, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listLineItems(entry, request, requestOptions)); } @@ -344,43 +300,47 @@ export class LineItem { private async __listLineItems( entry: string, request: Payabli.ListLineItemsRequest = {}, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/lineitems/${encodeURIComponent(entry)}`, + `Query/lineitems/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseItems, rawResponse: _response.rawResponse }; @@ -408,21 +368,7 @@ export class LineItem { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/lineitems/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/lineitems/{entry}"); } /** @@ -430,7 +376,7 @@ export class LineItem { * * @param {number} lineItemId - ID for the line item (also known as a product, service, or item). * @param {Payabli.LineItem} request - * @param {LineItem.RequestOptions} requestOptions - Request-specific configuration. + * @param {LineItemClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -446,7 +392,7 @@ export class LineItem { public updateItem( lineItemId: number, request: Payabli.LineItem, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateItem(lineItemId, request, requestOptions)); } @@ -454,27 +400,32 @@ export class LineItem { private async __updateItem( lineItemId: number, request: Payabli.LineItem, - requestOptions?: LineItem.RequestOptions, + requestOptions?: LineItemClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `LineItem/${encodeURIComponent(lineItemId)}`, + `LineItem/${core.url.encodePathParam(lineItemId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse6, rawResponse: _response.rawResponse }; @@ -502,25 +453,6 @@ export class LineItem { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /LineItem/{lineItemId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/LineItem/{lineItemId}"); } } diff --git a/src/api/resources/lineItem/client/index.ts b/src/api/resources/lineItem/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/lineItem/client/index.ts +++ b/src/api/resources/lineItem/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/lineItem/client/requests/AddItemRequest.ts b/src/api/resources/lineItem/client/requests/AddItemRequest.ts index b0dee8ce..30c55cc0 100644 --- a/src/api/resources/lineItem/client/requests/AddItemRequest.ts +++ b/src/api/resources/lineItem/client/requests/AddItemRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -20,9 +18,7 @@ import * as Payabli from "../../../../index.js"; * } */ export interface AddItemRequest { - /** - * A unique ID you can include to prevent duplicating objects or transactions if a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. - */ + /** A unique ID you can include to prevent duplicating objects or transactions if a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. */ idempotencyKey?: string; body: Payabli.LineItem; } diff --git a/src/api/resources/lineItem/client/requests/ListLineItemsRequest.ts b/src/api/resources/lineItem/client/requests/ListLineItemsRequest.ts index 2eb78dba..cc0aa2e2 100644 --- a/src/api/resources/lineItem/client/requests/ListLineItemsRequest.ts +++ b/src/api/resources/lineItem/client/requests/ListLineItemsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,16 +9,11 @@ * } */ export interface ListLineItemsRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -77,8 +70,6 @@ export interface ListLineItemsRequest { * Example: name(ct)=john return all records with name containing john */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/lineItem/client/requests/index.ts b/src/api/resources/lineItem/client/requests/index.ts index 46c222c1..2e47ea57 100644 --- a/src/api/resources/lineItem/client/requests/index.ts +++ b/src/api/resources/lineItem/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type AddItemRequest } from "./AddItemRequest.js"; -export { type ListLineItemsRequest } from "./ListLineItemsRequest.js"; +export type { AddItemRequest } from "./AddItemRequest.js"; +export type { ListLineItemsRequest } from "./ListLineItemsRequest.js"; diff --git a/src/api/resources/lineItem/index.ts b/src/api/resources/lineItem/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/lineItem/index.ts +++ b/src/api/resources/lineItem/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/lineItem/types/DeleteItemResponse.ts b/src/api/resources/lineItem/types/DeleteItemResponse.ts index 0e54b1cf..efe9631d 100644 --- a/src/api/resources/lineItem/types/DeleteItemResponse.ts +++ b/src/api/resources/lineItem/types/DeleteItemResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface DeleteItemResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/moneyIn/client/Client.ts b/src/api/resources/moneyIn/client/Client.ts index 92c41180..3081aa0c 100644 --- a/src/api/resources/moneyIn/client/Client.ts +++ b/src/api/resources/moneyIn/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace MoneyIn { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace MoneyInClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class MoneyIn { - protected readonly _options: MoneyIn.Options; +export class MoneyInClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: MoneyIn.Options = {}) { - this._options = _options; + constructor(options: MoneyInClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -43,7 +28,7 @@ export class MoneyIn { * **Note**: Only card transactions can be authorized. This endpoint can't be used for ACH transactions. * * @param {Payabli.RequestPaymentAuthorize} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -76,21 +61,28 @@ export class MoneyIn { */ public authorize( request: Payabli.RequestPaymentAuthorize, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__authorize(request, requestOptions)); } private async __authorize( request: Payabli.RequestPaymentAuthorize, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { forceCustomerCreation, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -99,21 +91,16 @@ export class MoneyIn { "MoneyIn/authorize", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AuthResponse, rawResponse: _response.rawResponse }; @@ -141,21 +128,7 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/authorize."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/authorize"); } /** @@ -168,7 +141,7 @@ export class MoneyIn { * * @param {string} transId - ReferenceId for the transaction (PaymentId). * @param {number} amount - Amount to be captured. The amount can't be greater the original total amount of the transaction. `0` captures the total amount authorized in the transaction. Partial captures aren't supported. - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -181,7 +154,7 @@ export class MoneyIn { public capture( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__capture(transId, amount, requestOptions)); } @@ -189,24 +162,29 @@ export class MoneyIn { private async __capture( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/capture/${encodeURIComponent(transId)}/${encodeURIComponent(amount)}`, + `MoneyIn/capture/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CaptureResponse, rawResponse: _response.rawResponse }; @@ -234,23 +212,12 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyIn/capture/{transId}/{amount}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyIn/capture/{transId}/{amount}", + ); } /** @@ -260,7 +227,7 @@ export class MoneyIn { * * @param {string} transId - ReferenceId for the transaction (PaymentId). * @param {Payabli.CaptureRequest} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -293,7 +260,7 @@ export class MoneyIn { public captureAuth( transId: string, request: Payabli.CaptureRequest, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__captureAuth(transId, request, requestOptions)); } @@ -301,27 +268,32 @@ export class MoneyIn { private async __captureAuth( transId: string, request: Payabli.CaptureRequest, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/capture/${encodeURIComponent(transId)}`, + `MoneyIn/capture/${core.url.encodePathParam(transId)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CaptureResponse, rawResponse: _response.rawResponse }; @@ -349,21 +321,7 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/capture/{transId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/capture/{transId}"); } /** @@ -372,7 +330,7 @@ export class MoneyIn { * This feature must be enabled by Payabli on a per-merchant basis. Contact support for help. * * @param {Payabli.RequestCredit} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -428,21 +386,28 @@ export class MoneyIn { */ public credit( request: Payabli.RequestCredit, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__credit(request, requestOptions)); } private async __credit( request: Payabli.RequestCredit, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { forceCustomerCreation, idempotencyKey, ..._body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -451,21 +416,16 @@ export class MoneyIn { "MoneyIn/makecredit", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse0, rawResponse: _response.rawResponse }; @@ -493,28 +453,14 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/makecredit."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/makecredit"); } /** * Retrieve a processed transaction's details. * * @param {string} transId - ReferenceId for the transaction (PaymentId). - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -526,31 +472,36 @@ export class MoneyIn { */ public details( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__details(transId, requestOptions)); } private async __details( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/details/${encodeURIComponent(transId)}`, + `MoneyIn/details/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -581,28 +532,14 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/details/{transId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/MoneyIn/details/{transId}"); } /** * Make a single transaction. This method authorizes and captures a payment in one step. * * @param {Payabli.RequestPayment} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -762,14 +699,14 @@ export class MoneyIn { */ public getpaid( request: Payabli.RequestPayment, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getpaid(request, requestOptions)); } private async __getpaid( request: Payabli.RequestPayment, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { achValidation, @@ -781,17 +718,27 @@ export class MoneyIn { } = request; const _queryParams: Record = {}; if (achValidation != null) { - _queryParams["achValidation"] = achValidation.toString(); + _queryParams.achValidation = achValidation.toString(); } if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } if (includeDetails != null) { - _queryParams["includeDetails"] = includeDetails.toString(); + _queryParams.includeDetails = includeDetails.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ + idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, + validationCode: validationCode != null ? validationCode : undefined, + }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -800,22 +747,16 @@ export class MoneyIn { "MoneyIn/getpaid", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - validationCode: validationCode != null ? validationCode : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseGetPaid, rawResponse: _response.rawResponse }; @@ -843,21 +784,7 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/getpaid."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/getpaid"); } /** @@ -870,7 +797,7 @@ export class MoneyIn { * The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90. * * An amount equal to zero will refunds the total amount authorized minus any service fee. - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -886,7 +813,7 @@ export class MoneyIn { public reverse( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__reverse(transId, amount, requestOptions)); } @@ -894,24 +821,29 @@ export class MoneyIn { private async __reverse( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/reverse/${encodeURIComponent(transId)}/${encodeURIComponent(amount)}`, + `MoneyIn/reverse/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ReverseResponse, rawResponse: _response.rawResponse }; @@ -939,23 +871,12 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyIn/reverse/{transId}/{amount}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyIn/reverse/{transId}/{amount}", + ); } /** @@ -968,7 +889,7 @@ export class MoneyIn { * The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was \$90 plus a \$10 service fee, you can refund up to \$90. * * An amount equal to zero will refund the total amount authorized minus any service fee. - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -984,7 +905,7 @@ export class MoneyIn { public refund( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__refund(transId, amount, requestOptions)); } @@ -992,24 +913,29 @@ export class MoneyIn { private async __refund( transId: string, amount: number, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/refund/${encodeURIComponent(transId)}/${encodeURIComponent(amount)}`, + `MoneyIn/refund/${core.url.encodePathParam(transId)}/${core.url.encodePathParam(amount)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.RefundResponse, rawResponse: _response.rawResponse }; @@ -1037,23 +963,12 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyIn/refund/{transId}/{amount}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyIn/refund/{transId}/{amount}", + ); } /** @@ -1061,7 +976,7 @@ export class MoneyIn { * * @param {string} transId - ReferenceId for the transaction (PaymentId). * @param {Payabli.RequestRefund} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1113,7 +1028,7 @@ export class MoneyIn { public refundWithInstructions( transId: string, request: Payabli.RequestRefund = {}, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__refundWithInstructions(transId, request, requestOptions)); } @@ -1121,31 +1036,34 @@ export class MoneyIn { private async __refundWithInstructions( transId: string, request: Payabli.RequestRefund = {}, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { idempotencyKey, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/refund/${encodeURIComponent(transId)}`, + `MoneyIn/refund/${core.url.encodePathParam(transId)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1176,28 +1094,14 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/refund/{transId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/refund/{transId}"); } /** * Reverse microdeposits that are used to verify customer account ownership and access. The `transId` value is returned in the success response for the original credit transaction made with `api/MoneyIn/makecredit`. * * @param {string} transId - ReferenceId for the transaction (PaymentId). - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1209,31 +1113,36 @@ export class MoneyIn { */ public reverseCredit( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__reverseCredit(transId, requestOptions)); } private async __reverseCredit( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/reverseCredit/${encodeURIComponent(transId)}`, + `MoneyIn/reverseCredit/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse, rawResponse: _response.rawResponse }; @@ -1261,23 +1170,12 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyIn/reverseCredit/{transId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyIn/reverseCredit/{transId}", + ); } /** @@ -1285,7 +1183,7 @@ export class MoneyIn { * * @param {string} transId - ReferenceId for the transaction (PaymentId). * @param {Payabli.SendReceipt2TransRequest} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1300,7 +1198,7 @@ export class MoneyIn { public sendReceipt2Trans( transId: string, request: Payabli.SendReceipt2TransRequest = {}, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sendReceipt2Trans(transId, request, requestOptions)); } @@ -1308,31 +1206,35 @@ export class MoneyIn { private async __sendReceipt2Trans( transId: string, request: Payabli.SendReceipt2TransRequest = {}, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { email } = request; const _queryParams: Record = {}; if (email != null) { - _queryParams["email"] = email; + _queryParams.email = email; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/sendreceipt/${encodeURIComponent(transId)}`, + `MoneyIn/sendreceipt/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ReceiptResponse, rawResponse: _response.rawResponse }; @@ -1360,30 +1262,19 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyIn/sendreceipt/{transId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyIn/sendreceipt/{transId}", + ); } /** * Validates a card number without running a transaction or authorizing a charge. * * @param {Payabli.RequestPaymentValidate} request - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1405,16 +1296,23 @@ export class MoneyIn { */ public validate( request: Payabli.RequestPaymentValidate, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__validate(request, requestOptions)); } private async __validate( request: Payabli.RequestPaymentValidate, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { const { idempotencyKey, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -1423,20 +1321,16 @@ export class MoneyIn { "MoneyIn/validate", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ValidateResponse, rawResponse: _response.rawResponse }; @@ -1464,28 +1358,14 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyIn/validate."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyIn/validate"); } /** * Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures. If a transaction has been settled, refund it instead. * * @param {string} transId - ReferenceId for the transaction (PaymentId). - * @param {MoneyIn.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyInClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1497,31 +1377,36 @@ export class MoneyIn { */ public void( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__void(transId, requestOptions)); } private async __void( transId: string, - requestOptions?: MoneyIn.RequestOptions, + requestOptions?: MoneyInClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyIn/void/${encodeURIComponent(transId)}`, + `MoneyIn/void/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.VoidResponse, rawResponse: _response.rawResponse }; @@ -1549,25 +1434,6 @@ export class MoneyIn { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyIn/void/{transId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/MoneyIn/void/{transId}"); } } diff --git a/src/api/resources/moneyIn/client/index.ts b/src/api/resources/moneyIn/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/moneyIn/client/index.ts +++ b/src/api/resources/moneyIn/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/moneyIn/client/requests/RequestCredit.ts b/src/api/resources/moneyIn/client/requests/RequestCredit.ts index 63f31be4..03e32de6 100644 --- a/src/api/resources/moneyIn/client/requests/RequestCredit.ts +++ b/src/api/resources/moneyIn/client/requests/RequestCredit.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/moneyIn/client/requests/RequestPayment.ts b/src/api/resources/moneyIn/client/requests/RequestPayment.ts index 397afd0b..155b8489 100644 --- a/src/api/resources/moneyIn/client/requests/RequestPayment.ts +++ b/src/api/resources/moneyIn/client/requests/RequestPayment.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -183,14 +181,10 @@ import * as Payabli from "../../../../index.js"; export interface RequestPayment { achValidation?: Payabli.AchValidation | undefined; forceCustomerCreation?: Payabli.ForceCustomerCreation | undefined; - /** - * When `true`, transactionDetails object is returned in the response. See a full example of the `transactionDetails` object in the [Transaction integration guide](/developers/developer-guides/money-in-transaction-add#includedetailstrue-response). - */ + /** When `true`, transactionDetails object is returned in the response. See a full example of the `transactionDetails` object in the [Transaction integration guide](/developers/developer-guides/money-in-transaction-add#includedetailstrue-response). */ includeDetails?: boolean; idempotencyKey?: Payabli.IdempotencyKey; - /** - * Value obtained from user when an API generated CAPTCHA is used in payment page - */ + /** Value obtained from user when an API generated CAPTCHA is used in payment page */ validationCode?: string; body: Payabli.TransRequestBody; } diff --git a/src/api/resources/moneyIn/client/requests/RequestPaymentAuthorize.ts b/src/api/resources/moneyIn/client/requests/RequestPaymentAuthorize.ts index b8c736c2..f0171828 100644 --- a/src/api/resources/moneyIn/client/requests/RequestPaymentAuthorize.ts +++ b/src/api/resources/moneyIn/client/requests/RequestPaymentAuthorize.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/moneyIn/client/requests/RequestPaymentValidate.ts b/src/api/resources/moneyIn/client/requests/RequestPaymentValidate.ts index e33ce9c3..7019c337 100644 --- a/src/api/resources/moneyIn/client/requests/RequestPaymentValidate.ts +++ b/src/api/resources/moneyIn/client/requests/RequestPaymentValidate.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -41,13 +39,11 @@ export namespace RequestPaymentValidate { } export namespace PaymentMethod { - /** - * The card validation method. - */ - export type Method = "card" | "cloud"; + /** The card validation method. */ export const Method = { Card: "card", Cloud: "cloud", } as const; + export type Method = (typeof Method)[keyof typeof Method]; } } diff --git a/src/api/resources/moneyIn/client/requests/RequestRefund.ts b/src/api/resources/moneyIn/client/requests/RequestRefund.ts index 427088b9..6be44984 100644 --- a/src/api/resources/moneyIn/client/requests/RequestRefund.ts +++ b/src/api/resources/moneyIn/client/requests/RequestRefund.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/moneyIn/client/requests/SendReceipt2TransRequest.ts b/src/api/resources/moneyIn/client/requests/SendReceipt2TransRequest.ts index 635de1f4..88f174d1 100644 --- a/src/api/resources/moneyIn/client/requests/SendReceipt2TransRequest.ts +++ b/src/api/resources/moneyIn/client/requests/SendReceipt2TransRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example diff --git a/src/api/resources/moneyIn/client/requests/index.ts b/src/api/resources/moneyIn/client/requests/index.ts index b9118873..3eb9767e 100644 --- a/src/api/resources/moneyIn/client/requests/index.ts +++ b/src/api/resources/moneyIn/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type RequestPaymentAuthorize } from "./RequestPaymentAuthorize.js"; -export { type RequestCredit } from "./RequestCredit.js"; -export { type RequestPayment } from "./RequestPayment.js"; -export { type RequestRefund } from "./RequestRefund.js"; -export { type SendReceipt2TransRequest } from "./SendReceipt2TransRequest.js"; -export { type RequestPaymentValidate } from "./RequestPaymentValidate.js"; +export type { RequestCredit } from "./RequestCredit.js"; +export type { RequestPayment } from "./RequestPayment.js"; +export type { RequestPaymentAuthorize } from "./RequestPaymentAuthorize.js"; +export type { RequestPaymentValidate } from "./RequestPaymentValidate.js"; +export type { RequestRefund } from "./RequestRefund.js"; +export type { SendReceipt2TransRequest } from "./SendReceipt2TransRequest.js"; diff --git a/src/api/resources/moneyIn/errors/CaptureError.ts b/src/api/resources/moneyIn/errors/CaptureError.ts index 6929a841..52913b6d 100644 --- a/src/api/resources/moneyIn/errors/CaptureError.ts +++ b/src/api/resources/moneyIn/errors/CaptureError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../../../core/index.js"; import * as errors from "../../../../errors/index.js"; -import * as Payabli from "../../../index.js"; -import * as core from "../../../../core/index.js"; +import type * as Payabli from "../../../index.js"; export class CaptureError extends errors.PayabliError { constructor(body: Payabli.PayabliApiResponseError400, rawResponse?: core.RawResponse) { diff --git a/src/api/resources/moneyIn/errors/InvalidTransStatusError.ts b/src/api/resources/moneyIn/errors/InvalidTransStatusError.ts index 814c8db0..0d84e52f 100644 --- a/src/api/resources/moneyIn/errors/InvalidTransStatusError.ts +++ b/src/api/resources/moneyIn/errors/InvalidTransStatusError.ts @@ -1,10 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. +import type * as core from "../../../../core/index.js"; import * as errors from "../../../../errors/index.js"; -import * as Payabli from "../../../index.js"; -import * as core from "../../../../core/index.js"; +import type * as Payabli from "../../../index.js"; export class InvalidTransStatusError extends errors.PayabliError { constructor(body: Payabli.InvalidTransStatusErrorType, rawResponse?: core.RawResponse) { diff --git a/src/api/resources/moneyIn/errors/index.ts b/src/api/resources/moneyIn/errors/index.ts index 11c63d8c..a136c795 100644 --- a/src/api/resources/moneyIn/errors/index.ts +++ b/src/api/resources/moneyIn/errors/index.ts @@ -1,2 +1,2 @@ -export * from "./InvalidTransStatusError.js"; export * from "./CaptureError.js"; +export * from "./InvalidTransStatusError.js"; diff --git a/src/api/resources/moneyIn/index.ts b/src/api/resources/moneyIn/index.ts index f63e7d18..b90a45b3 100644 --- a/src/api/resources/moneyIn/index.ts +++ b/src/api/resources/moneyIn/index.ts @@ -1,3 +1,3 @@ -export * from "./types/index.js"; -export * from "./errors/index.js"; export * from "./client/index.js"; +export * from "./errors/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/moneyIn/types/AuthResponse.ts b/src/api/resources/moneyIn/types/AuthResponse.ts index 0e859442..6fcf87e0 100644 --- a/src/api/resources/moneyIn/types/AuthResponse.ts +++ b/src/api/resources/moneyIn/types/AuthResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response for MoneyIn/authorize. diff --git a/src/api/resources/moneyIn/types/AuthResponseResponseData.ts b/src/api/resources/moneyIn/types/AuthResponseResponseData.ts index a464e22d..2afe86fd 100644 --- a/src/api/resources/moneyIn/types/AuthResponseResponseData.ts +++ b/src/api/resources/moneyIn/types/AuthResponseResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AuthResponseResponseData { authCode: Payabli.Authcode; diff --git a/src/api/resources/moneyIn/types/CapturePaymentDetails.ts b/src/api/resources/moneyIn/types/CapturePaymentDetails.ts index 153cc8c1..3bdd0130 100644 --- a/src/api/resources/moneyIn/types/CapturePaymentDetails.ts +++ b/src/api/resources/moneyIn/types/CapturePaymentDetails.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CapturePaymentDetails { /** diff --git a/src/api/resources/moneyIn/types/CaptureRequest.ts b/src/api/resources/moneyIn/types/CaptureRequest.ts index bae59541..9c69a1e0 100644 --- a/src/api/resources/moneyIn/types/CaptureRequest.ts +++ b/src/api/resources/moneyIn/types/CaptureRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface CaptureRequest { paymentDetails: Payabli.CapturePaymentDetails; diff --git a/src/api/resources/moneyIn/types/CaptureResponse.ts b/src/api/resources/moneyIn/types/CaptureResponse.ts index 09f6f14d..a6158ec8 100644 --- a/src/api/resources/moneyIn/types/CaptureResponse.ts +++ b/src/api/resources/moneyIn/types/CaptureResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response for MoneyIn/capture endpoint diff --git a/src/api/resources/moneyIn/types/CaptureResponseData.ts b/src/api/resources/moneyIn/types/CaptureResponseData.ts index a947de83..adea8a01 100644 --- a/src/api/resources/moneyIn/types/CaptureResponseData.ts +++ b/src/api/resources/moneyIn/types/CaptureResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response data for capture transactions diff --git a/src/api/resources/moneyIn/types/GetPaidResponseData.ts b/src/api/resources/moneyIn/types/GetPaidResponseData.ts index 43b7aae0..4bea128d 100644 --- a/src/api/resources/moneyIn/types/GetPaidResponseData.ts +++ b/src/api/resources/moneyIn/types/GetPaidResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response data for GetPaid transactions diff --git a/src/api/resources/moneyIn/types/InvalidTransStatusErrorType.ts b/src/api/resources/moneyIn/types/InvalidTransStatusErrorType.ts index c9aa1a33..3ba4411d 100644 --- a/src/api/resources/moneyIn/types/InvalidTransStatusErrorType.ts +++ b/src/api/resources/moneyIn/types/InvalidTransStatusErrorType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface InvalidTransStatusErrorType { /** Error message describing the reason for the decline */ diff --git a/src/api/resources/moneyIn/types/PayabliApiResponseGetPaid.ts b/src/api/resources/moneyIn/types/PayabliApiResponseGetPaid.ts index b1d43224..8c786e86 100644 --- a/src/api/resources/moneyIn/types/PayabliApiResponseGetPaid.ts +++ b/src/api/resources/moneyIn/types/PayabliApiResponseGetPaid.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * General response for GetPaid endpoint supporting multiple payment methods diff --git a/src/api/resources/moneyIn/types/ReceiptResponse.ts b/src/api/resources/moneyIn/types/ReceiptResponse.ts index 86985236..25d7b9c6 100644 --- a/src/api/resources/moneyIn/types/ReceiptResponse.ts +++ b/src/api/resources/moneyIn/types/ReceiptResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response for SendReceipt endpoint. diff --git a/src/api/resources/moneyIn/types/RefundResponse.ts b/src/api/resources/moneyIn/types/RefundResponse.ts index 6e9a8a6b..b0fd9b6a 100644 --- a/src/api/resources/moneyIn/types/RefundResponse.ts +++ b/src/api/resources/moneyIn/types/RefundResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface RefundResponse { responseText: Payabli.ResponseText; diff --git a/src/api/resources/moneyIn/types/RefundWithInstructionsResponse.ts b/src/api/resources/moneyIn/types/RefundWithInstructionsResponse.ts index 44afed38..b6814dc7 100644 --- a/src/api/resources/moneyIn/types/RefundWithInstructionsResponse.ts +++ b/src/api/resources/moneyIn/types/RefundWithInstructionsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface RefundWithInstructionsResponse { responseText: Payabli.ResponseText; diff --git a/src/api/resources/moneyIn/types/ResponseDataRefunds.ts b/src/api/resources/moneyIn/types/ResponseDataRefunds.ts index d75c782c..2e4c6ac7 100644 --- a/src/api/resources/moneyIn/types/ResponseDataRefunds.ts +++ b/src/api/resources/moneyIn/types/ResponseDataRefunds.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ResponseDataRefunds { authCode: Payabli.Authcode; diff --git a/src/api/resources/moneyIn/types/ReverseResponse.ts b/src/api/resources/moneyIn/types/ReverseResponse.ts index e6d3ffb6..d44d6ccb 100644 --- a/src/api/resources/moneyIn/types/ReverseResponse.ts +++ b/src/api/resources/moneyIn/types/ReverseResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ReverseResponse { responseCode: Payabli.Responsecode; diff --git a/src/api/resources/moneyIn/types/TransRequestBody.ts b/src/api/resources/moneyIn/types/TransRequestBody.ts index d2cacbfd..0b7dd04e 100644 --- a/src/api/resources/moneyIn/types/TransRequestBody.ts +++ b/src/api/resources/moneyIn/types/TransRequestBody.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * @example diff --git a/src/api/resources/moneyIn/types/TransactionDetailCustomer.ts b/src/api/resources/moneyIn/types/TransactionDetailCustomer.ts index cca99d83..075bd160 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailCustomer.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailCustomer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Customer information associated with the transaction diff --git a/src/api/resources/moneyIn/types/TransactionDetailEvent.ts b/src/api/resources/moneyIn/types/TransactionDetailEvent.ts index b72e3925..e0184e42 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailEvent.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailEvent.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Event associated with transaction processing diff --git a/src/api/resources/moneyIn/types/TransactionDetailInvoiceData.ts b/src/api/resources/moneyIn/types/TransactionDetailInvoiceData.ts index f492c680..4f0d085b 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailInvoiceData.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailInvoiceData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Invoice information if transaction is associated with an invoice diff --git a/src/api/resources/moneyIn/types/TransactionDetailPaymentData.ts b/src/api/resources/moneyIn/types/TransactionDetailPaymentData.ts index e1aa15c8..02f66c66 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailPaymentData.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailPaymentData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Payment method and transaction details diff --git a/src/api/resources/moneyIn/types/TransactionDetailPaymentDetails.ts b/src/api/resources/moneyIn/types/TransactionDetailPaymentDetails.ts index 2e0f94b2..186e1ddc 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailPaymentDetails.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailPaymentDetails.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Detailed breakdown of payment amounts and identifiers diff --git a/src/api/resources/moneyIn/types/TransactionDetailRecord.ts b/src/api/resources/moneyIn/types/TransactionDetailRecord.ts index 9d12abec..e16a453f 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailRecord.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Complete transaction details including payment information, customer data, and processing metadata. This is returned when includeDetails=true. diff --git a/src/api/resources/moneyIn/types/TransactionDetailRecordMethod.ts b/src/api/resources/moneyIn/types/TransactionDetailRecordMethod.ts index 7a995326..aba5322a 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailRecordMethod.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailRecordMethod.ts @@ -1,12 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Payment method used for the transaction - */ -export type TransactionDetailRecordMethod = "ach" | "card"; +/** Payment method used for the transaction */ export const TransactionDetailRecordMethod = { Ach: "ach", Card: "card", } as const; +export type TransactionDetailRecordMethod = + (typeof TransactionDetailRecordMethod)[keyof typeof TransactionDetailRecordMethod]; diff --git a/src/api/resources/moneyIn/types/TransactionDetailResponseData.ts b/src/api/resources/moneyIn/types/TransactionDetailResponseData.ts index d0ab0675..9cf34172 100644 --- a/src/api/resources/moneyIn/types/TransactionDetailResponseData.ts +++ b/src/api/resources/moneyIn/types/TransactionDetailResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response data from payment processor diff --git a/src/api/resources/moneyIn/types/ValidateResponse.ts b/src/api/resources/moneyIn/types/ValidateResponse.ts index c1706e70..b22f7fa2 100644 --- a/src/api/resources/moneyIn/types/ValidateResponse.ts +++ b/src/api/resources/moneyIn/types/ValidateResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response for card validation endpoint diff --git a/src/api/resources/moneyIn/types/ValidateResponseData.ts b/src/api/resources/moneyIn/types/ValidateResponseData.ts index 3d7aaa82..822398a8 100644 --- a/src/api/resources/moneyIn/types/ValidateResponseData.ts +++ b/src/api/resources/moneyIn/types/ValidateResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response data for card validation diff --git a/src/api/resources/moneyIn/types/VoidResponse.ts b/src/api/resources/moneyIn/types/VoidResponse.ts index f8e0de4b..6a5ba384 100644 --- a/src/api/resources/moneyIn/types/VoidResponse.ts +++ b/src/api/resources/moneyIn/types/VoidResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response for MoneyIn/void endpoint diff --git a/src/api/resources/moneyIn/types/VoidResponseData.ts b/src/api/resources/moneyIn/types/VoidResponseData.ts index e559acc1..aa9caf03 100644 --- a/src/api/resources/moneyIn/types/VoidResponseData.ts +++ b/src/api/resources/moneyIn/types/VoidResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response data for void transactions diff --git a/src/api/resources/moneyIn/types/index.ts b/src/api/resources/moneyIn/types/index.ts index 70f6afca..9d512dec 100644 --- a/src/api/resources/moneyIn/types/index.ts +++ b/src/api/resources/moneyIn/types/index.ts @@ -1,27 +1,27 @@ -export * from "./InvalidTransStatusErrorType.js"; -export * from "./ReceiptResponse.js"; +export * from "./AuthResponse.js"; +export * from "./AuthResponseResponseData.js"; +export * from "./CapturePaymentDetails.js"; +export * from "./CaptureRequest.js"; export * from "./CaptureResponse.js"; export * from "./CaptureResponseData.js"; -export * from "./PayabliApiResponseGetPaid.js"; export * from "./GetPaidResponseData.js"; -export * from "./TransRequestBody.js"; -export * from "./AuthResponse.js"; -export * from "./AuthResponseResponseData.js"; -export * from "./ReverseResponse.js"; +export * from "./InvalidTransStatusErrorType.js"; +export * from "./PayabliApiResponseGetPaid.js"; +export * from "./ReceiptResponse.js"; export * from "./RefundResponse.js"; export * from "./RefundWithInstructionsResponse.js"; export * from "./ResponseDataRefunds.js"; -export * from "./VoidResponse.js"; -export * from "./VoidResponseData.js"; -export * from "./ValidateResponse.js"; -export * from "./ValidateResponseData.js"; -export * from "./CaptureRequest.js"; -export * from "./CapturePaymentDetails.js"; -export * from "./TransactionDetailRecord.js"; -export * from "./TransactionDetailRecordMethod.js"; +export * from "./ReverseResponse.js"; +export * from "./TransactionDetailCustomer.js"; +export * from "./TransactionDetailEvent.js"; +export * from "./TransactionDetailInvoiceData.js"; export * from "./TransactionDetailPaymentData.js"; export * from "./TransactionDetailPaymentDetails.js"; +export * from "./TransactionDetailRecord.js"; +export * from "./TransactionDetailRecordMethod.js"; export * from "./TransactionDetailResponseData.js"; -export * from "./TransactionDetailInvoiceData.js"; -export * from "./TransactionDetailCustomer.js"; -export * from "./TransactionDetailEvent.js"; +export * from "./TransRequestBody.js"; +export * from "./ValidateResponse.js"; +export * from "./ValidateResponseData.js"; +export * from "./VoidResponse.js"; +export * from "./VoidResponseData.js"; diff --git a/src/api/resources/moneyOut/client/Client.ts b/src/api/resources/moneyOut/client/Client.ts index 4e167f00..863666e7 100644 --- a/src/api/resources/moneyOut/client/Client.ts +++ b/src/api/resources/moneyOut/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace MoneyOut { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace MoneyOutClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class MoneyOut { - protected readonly _options: MoneyOut.Options; +export class MoneyOutClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: MoneyOut.Options = {}) { - this._options = _options; + constructor(options: MoneyOutClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Authorizes transaction for payout. Authorized transactions aren't flagged for settlement until captured. Use `referenceId` returned in the response to capture the transaction. * * @param {Payabli.MoneyOutTypesRequestOutAuthorize} request - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -170,29 +155,36 @@ export class MoneyOut { */ public authorizeOut( request: Payabli.MoneyOutTypesRequestOutAuthorize, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__authorizeOut(request, requestOptions)); } private async __authorizeOut( request: Payabli.MoneyOutTypesRequestOutAuthorize, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { const { allowDuplicatedBills, doNotCreateBills, forceVendorCreation, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (allowDuplicatedBills != null) { - _queryParams["allowDuplicatedBills"] = allowDuplicatedBills.toString(); + _queryParams.allowDuplicatedBills = allowDuplicatedBills.toString(); } if (doNotCreateBills != null) { - _queryParams["doNotCreateBills"] = doNotCreateBills.toString(); + _queryParams.doNotCreateBills = doNotCreateBills.toString(); } if (forceVendorCreation != null) { - _queryParams["forceVendorCreation"] = forceVendorCreation.toString(); + _queryParams.forceVendorCreation = forceVendorCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -201,21 +193,16 @@ export class MoneyOut { "MoneyOut/authorize", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AuthCapturePayoutResponse, rawResponse: _response.rawResponse }; @@ -243,28 +230,14 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyOut/authorize."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyOut/authorize"); } /** * Cancels an array of payout transactions. * * @param {string[]} request - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -276,15 +249,21 @@ export class MoneyOut { */ public cancelAllOut( request: string[], - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__cancelAllOut(request, requestOptions)); } private async __cancelAllOut( request: string[], - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -293,17 +272,16 @@ export class MoneyOut { "MoneyOut/cancelAll", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CaptureAllOutResponse, rawResponse: _response.rawResponse }; @@ -331,28 +309,14 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyOut/cancelAll."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyOut/cancelAll"); } /** * Cancel a payout transaction by ID. * * @param {string} referenceId - The ID for the payout transaction. - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -364,31 +328,36 @@ export class MoneyOut { */ public cancelOutGet( referenceId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__cancelOutGet(referenceId, requestOptions)); } private async __cancelOutGet( referenceId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/cancel/${encodeURIComponent(referenceId)}`, + `MoneyOut/cancel/${core.url.encodePathParam(referenceId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse0000, rawResponse: _response.rawResponse }; @@ -416,30 +385,19 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyOut/cancel/{referenceId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyOut/cancel/{referenceId}", + ); } /** * Cancel a payout transaction by ID. * * @param {string} referenceId - The ID for the payout transaction. - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -451,31 +409,36 @@ export class MoneyOut { */ public cancelOutDelete( referenceId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__cancelOutDelete(referenceId, requestOptions)); } private async __cancelOutDelete( referenceId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/cancel/${encodeURIComponent(referenceId)}`, + `MoneyOut/cancel/${core.url.encodePathParam(referenceId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse0000, rawResponse: _response.rawResponse }; @@ -503,30 +466,19 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /MoneyOut/cancel/{referenceId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/MoneyOut/cancel/{referenceId}", + ); } /** * Captures an array of authorized payout transactions for settlement. The maximum number of transactions that can be captured in a single request is 500. * * @param {Payabli.CaptureAllOutRequest} request - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -540,16 +492,23 @@ export class MoneyOut { */ public captureAllOut( request: Payabli.CaptureAllOutRequest, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__captureAllOut(request, requestOptions)); } private async __captureAllOut( request: Payabli.CaptureAllOutRequest, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { const { idempotencyKey, body: _body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -558,20 +517,16 @@ export class MoneyOut { "MoneyOut/captureAll", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.CaptureAllOutResponse, rawResponse: _response.rawResponse }; @@ -599,21 +554,7 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /MoneyOut/captureAll."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/MoneyOut/captureAll"); } /** @@ -621,7 +562,7 @@ export class MoneyOut { * * @param {string} referenceId - The ID for the payout transaction. * @param {Payabli.CaptureOutRequest} request - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -634,7 +575,7 @@ export class MoneyOut { public captureOut( referenceId: string, request: Payabli.CaptureOutRequest = {}, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__captureOut(referenceId, request, requestOptions)); } @@ -642,28 +583,31 @@ export class MoneyOut { private async __captureOut( referenceId: string, request: Payabli.CaptureOutRequest = {}, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { const { idempotencyKey } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/capture/${encodeURIComponent(referenceId)}`, + `MoneyOut/capture/${core.url.encodePathParam(referenceId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AuthCapturePayoutResponse, rawResponse: _response.rawResponse }; @@ -691,30 +635,19 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyOut/capture/{referenceId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyOut/capture/{referenceId}", + ); } /** * Returns details for a processed money out transaction. * * @param {string} transId - ReferenceId for the transaction (PaymentId). - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -726,31 +659,36 @@ export class MoneyOut { */ public payoutDetails( transId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__payoutDetails(transId, requestOptions)); } private async __payoutDetails( transId: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/details/${encodeURIComponent(transId)}`, + `MoneyOut/details/${core.url.encodePathParam(transId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BillDetailResponse, rawResponse: _response.rawResponse }; @@ -778,28 +716,14 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyOut/details/{transId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/MoneyOut/details/{transId}"); } /** * Retrieves vCard details for a single card in an entrypoint. * * @param {string} cardToken - ID for a virtual card. - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -811,31 +735,36 @@ export class MoneyOut { */ public vCardGet( cardToken: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__vCardGet(cardToken, requestOptions)); } private async __vCardGet( cardToken: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/vcard/${encodeURIComponent(cardToken)}`, + `MoneyOut/vcard/${core.url.encodePathParam(cardToken)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.VCardGetResponse, rawResponse: _response.rawResponse }; @@ -863,28 +792,14 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /MoneyOut/vcard/{cardToken}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/MoneyOut/vcard/{cardToken}"); } /** * Sends a virtual card link via email to the vendor associated with the `transId`. * * @param {Payabli.SendVCardLinkRequest} request - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -898,15 +813,21 @@ export class MoneyOut { */ public sendVCardLink( request: Payabli.SendVCardLinkRequest, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sendVCardLink(request, requestOptions)); } private async __sendVCardLink( request: Payabli.SendVCardLinkRequest, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -915,17 +836,16 @@ export class MoneyOut { "vcard/send-card-link", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.OperationResult, rawResponse: _response.rawResponse }; @@ -953,21 +873,7 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /vcard/send-card-link."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/vcard/send-card-link"); } /** @@ -985,7 +891,7 @@ export class MoneyOut { * "fContent": "" * } * ``` - * @param {MoneyOut.RequestOptions} requestOptions - Request-specific configuration. + * @param {MoneyOutClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -997,31 +903,36 @@ export class MoneyOut { */ public getCheckImage( assetName: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getCheckImage(assetName, requestOptions)); } private async __getCheckImage( assetName: string, - requestOptions?: MoneyOut.RequestOptions, + requestOptions?: MoneyOutClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `MoneyOut/checkimage/${encodeURIComponent(assetName)}`, + `MoneyOut/checkimage/${core.url.encodePathParam(assetName)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as string, rawResponse: _response.rawResponse }; @@ -1049,27 +960,11 @@ export class MoneyOut { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /MoneyOut/checkimage/{assetName}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/MoneyOut/checkimage/{assetName}", + ); } } diff --git a/src/api/resources/moneyOut/client/index.ts b/src/api/resources/moneyOut/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/moneyOut/client/index.ts +++ b/src/api/resources/moneyOut/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/moneyOut/client/requests/CaptureAllOutRequest.ts b/src/api/resources/moneyOut/client/requests/CaptureAllOutRequest.ts index 324e9c2e..239abffd 100644 --- a/src/api/resources/moneyOut/client/requests/CaptureAllOutRequest.ts +++ b/src/api/resources/moneyOut/client/requests/CaptureAllOutRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -12,8 +10,6 @@ import * as Payabli from "../../../../index.js"; */ export interface CaptureAllOutRequest { idempotencyKey?: Payabli.IdempotencyKey; - /** - * Array of identifiers of payout transactions to capture. - */ + /** Array of identifiers of payout transactions to capture. */ body: string[]; } diff --git a/src/api/resources/moneyOut/client/requests/CaptureOutRequest.ts b/src/api/resources/moneyOut/client/requests/CaptureOutRequest.ts index e6be3822..90b04c05 100644 --- a/src/api/resources/moneyOut/client/requests/CaptureOutRequest.ts +++ b/src/api/resources/moneyOut/client/requests/CaptureOutRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.ts b/src/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.ts index 0a1ccd9f..a4874bb7 100644 --- a/src/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.ts +++ b/src/api/resources/moneyOut/client/requests/MoneyOutTypesRequestOutAuthorize.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -126,17 +124,11 @@ import * as Payabli from "../../../../index.js"; * } */ export interface MoneyOutTypesRequestOutAuthorize { - /** - * When `true`, the authorization bypasses the requirement for unique bills, identified by vendor invoice number. This allows you to make more than one payout authorization for a bill, like a split payment. - */ + /** When `true`, the authorization bypasses the requirement for unique bills, identified by vendor invoice number. This allows you to make more than one payout authorization for a bill, like a split payment. */ allowDuplicatedBills?: boolean; - /** - * When `true`, Payabli won't automatically create a bill for this payout transaction. - */ + /** When `true`, Payabli won't automatically create a bill for this payout transaction. */ doNotCreateBills?: boolean; - /** - * When `true`, the request creates a new vendor record, regardless of whether the vendor already exists. - */ + /** When `true`, the request creates a new vendor record, regardless of whether the vendor already exists. */ forceVendorCreation?: boolean; idempotencyKey?: Payabli.IdempotencyKey; body: Payabli.AuthorizePayoutBody; diff --git a/src/api/resources/moneyOut/client/requests/SendVCardLinkRequest.ts b/src/api/resources/moneyOut/client/requests/SendVCardLinkRequest.ts index 968536f1..632bde21 100644 --- a/src/api/resources/moneyOut/client/requests/SendVCardLinkRequest.ts +++ b/src/api/resources/moneyOut/client/requests/SendVCardLinkRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example diff --git a/src/api/resources/moneyOut/client/requests/index.ts b/src/api/resources/moneyOut/client/requests/index.ts index c76bcb73..8dc4d271 100644 --- a/src/api/resources/moneyOut/client/requests/index.ts +++ b/src/api/resources/moneyOut/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type MoneyOutTypesRequestOutAuthorize } from "./MoneyOutTypesRequestOutAuthorize.js"; -export { type CaptureAllOutRequest } from "./CaptureAllOutRequest.js"; -export { type CaptureOutRequest } from "./CaptureOutRequest.js"; -export { type SendVCardLinkRequest } from "./SendVCardLinkRequest.js"; +export type { CaptureAllOutRequest } from "./CaptureAllOutRequest.js"; +export type { CaptureOutRequest } from "./CaptureOutRequest.js"; +export type { MoneyOutTypesRequestOutAuthorize } from "./MoneyOutTypesRequestOutAuthorize.js"; +export type { SendVCardLinkRequest } from "./SendVCardLinkRequest.js"; diff --git a/src/api/resources/moneyOutTypes/types/AuthCapturePayoutResponse.ts b/src/api/resources/moneyOutTypes/types/AuthCapturePayoutResponse.ts index e7cd9295..43ea0d96 100644 --- a/src/api/resources/moneyOutTypes/types/AuthCapturePayoutResponse.ts +++ b/src/api/resources/moneyOutTypes/types/AuthCapturePayoutResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * @example diff --git a/src/api/resources/moneyOutTypes/types/AuthorizePaymentMethod.ts b/src/api/resources/moneyOutTypes/types/AuthorizePaymentMethod.ts index 0ed289a0..fbedc775 100644 --- a/src/api/resources/moneyOutTypes/types/AuthorizePaymentMethod.ts +++ b/src/api/resources/moneyOutTypes/types/AuthorizePaymentMethod.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Payment method object for vendor payouts. diff --git a/src/api/resources/moneyOutTypes/types/AuthorizePayoutBody.ts b/src/api/resources/moneyOutTypes/types/AuthorizePayoutBody.ts index 9c644f5b..e8b879bd 100644 --- a/src/api/resources/moneyOutTypes/types/AuthorizePayoutBody.ts +++ b/src/api/resources/moneyOutTypes/types/AuthorizePayoutBody.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AuthorizePayoutBody { entryPoint: Payabli.Entrypointfield; diff --git a/src/api/resources/moneyOutTypes/types/CaptureAllOutResponse.ts b/src/api/resources/moneyOutTypes/types/CaptureAllOutResponse.ts index b4775210..45f1347d 100644 --- a/src/api/resources/moneyOutTypes/types/CaptureAllOutResponse.ts +++ b/src/api/resources/moneyOutTypes/types/CaptureAllOutResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface CaptureAllOutResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/moneyOutTypes/types/LotNumber.ts b/src/api/resources/moneyOutTypes/types/LotNumber.ts index 6b667977..43f8faa8 100644 --- a/src/api/resources/moneyOutTypes/types/LotNumber.ts +++ b/src/api/resources/moneyOutTypes/types/LotNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Lot number associated with the bill. diff --git a/src/api/resources/moneyOutTypes/types/OperationResult.ts b/src/api/resources/moneyOutTypes/types/OperationResult.ts index 3cb069c8..fc8b5976 100644 --- a/src/api/resources/moneyOutTypes/types/OperationResult.ts +++ b/src/api/resources/moneyOutTypes/types/OperationResult.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OperationResult { /** Message describing the result. If the virtual card link was sent successfully, this contains the email address to which the link was sent. */ diff --git a/src/api/resources/moneyOutTypes/types/VCardGetResponse.ts b/src/api/resources/moneyOutTypes/types/VCardGetResponse.ts index b918866d..cf5ccba6 100644 --- a/src/api/resources/moneyOutTypes/types/VCardGetResponse.ts +++ b/src/api/resources/moneyOutTypes/types/VCardGetResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface VCardGetResponse { /** Indicates if the virtual card was sent. */ diff --git a/src/api/resources/moneyOutTypes/types/index.ts b/src/api/resources/moneyOutTypes/types/index.ts index daf4e148..45ebee7e 100644 --- a/src/api/resources/moneyOutTypes/types/index.ts +++ b/src/api/resources/moneyOutTypes/types/index.ts @@ -1,7 +1,7 @@ -export * from "./LotNumber.js"; -export * from "./AuthorizePayoutBody.js"; -export * from "./AuthorizePaymentMethod.js"; export * from "./AuthCapturePayoutResponse.js"; +export * from "./AuthorizePaymentMethod.js"; +export * from "./AuthorizePayoutBody.js"; export * from "./CaptureAllOutResponse.js"; -export * from "./VCardGetResponse.js"; +export * from "./LotNumber.js"; export * from "./OperationResult.js"; +export * from "./VCardGetResponse.js"; diff --git a/src/api/resources/notification/client/Client.ts b/src/api/resources/notification/client/Client.ts index 52d10055..45ca8b77 100644 --- a/src/api/resources/notification/client/Client.ts +++ b/src/api/resources/notification/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Notification { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace NotificationClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Notification { - protected readonly _options: Notification.Options; +export class NotificationClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Notification.Options = {}) { - this._options = _options; + constructor(options: NotificationClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Create a new notification or autogenerated report. * * @param {Payabli.AddNotificationRequest} request - * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -80,15 +65,21 @@ export class Notification { */ public addNotification( request: Payabli.AddNotificationRequest, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addNotification(request, requestOptions)); } private async __addNotification( request: Payabli.AddNotificationRequest, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -97,17 +88,16 @@ export class Notification { "Notification", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -138,28 +128,14 @@ export class Notification { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Notification."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Notification"); } /** * Deletes a single notification or autogenerated report. * * @param {string} nId - Notification ID. - * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -171,31 +147,36 @@ export class Notification { */ public deleteNotification( nId: string, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteNotification(nId, requestOptions)); } private async __deleteNotification( nId: string, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Notification/${encodeURIComponent(nId)}`, + `Notification/${core.url.encodePathParam(nId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -226,28 +207,14 @@ export class Notification { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Notification/{nId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Notification/{nId}"); } /** * Retrieves a single notification or autogenerated report's details. * * @param {string} nId - Notification ID. - * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -259,31 +226,36 @@ export class Notification { */ public getNotification( nId: string, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getNotification(nId, requestOptions)); } private async __getNotification( nId: string, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Notification/${encodeURIComponent(nId)}`, + `Notification/${core.url.encodePathParam(nId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.NotificationQueryRecord, rawResponse: _response.rawResponse }; @@ -311,21 +283,7 @@ export class Notification { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Notification/{nId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Notification/{nId}"); } /** @@ -333,7 +291,7 @@ export class Notification { * * @param {string} nId - Notification ID. * @param {Payabli.UpdateNotificationRequest} request - * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -356,7 +314,7 @@ export class Notification { public updateNotification( nId: string, request: Payabli.UpdateNotificationRequest, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateNotification(nId, request, requestOptions)); } @@ -364,27 +322,32 @@ export class Notification { private async __updateNotification( nId: string, request: Payabli.UpdateNotificationRequest, - requestOptions?: Notification.RequestOptions, + requestOptions?: NotificationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Notification/${encodeURIComponent(nId)}`, + `Notification/${core.url.encodePathParam(nId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -415,28 +378,14 @@ export class Notification { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Notification/{nId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Notification/{nId}"); } /** * Gets a copy of a generated report by ID. * - * @param {number} id - Report ID - * @param {Notification.RequestOptions} requestOptions - Request-specific configuration. + * @param {number} Id - Report ID + * @param {NotificationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -447,32 +396,37 @@ export class Notification { * await client.notification.getReportFile(1000000) */ public getReportFile( - id: number, - requestOptions?: Notification.RequestOptions, + Id: number, + requestOptions?: NotificationClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getReportFile(id, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__getReportFile(Id, requestOptions)); } private async __getReportFile( - id: number, - requestOptions?: Notification.RequestOptions, + Id: number, + requestOptions?: NotificationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Export/notificationReport/${encodeURIComponent(id)}`, + `Export/notificationReport/${core.url.encodePathParam(Id)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.File_, rawResponse: _response.rawResponse }; @@ -500,27 +454,11 @@ export class Notification { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Export/notificationReport/{Id}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Export/notificationReport/{Id}", + ); } } diff --git a/src/api/resources/notification/index.ts b/src/api/resources/notification/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/notification/index.ts +++ b/src/api/resources/notification/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/notification/types/AddNotificationRequest.ts b/src/api/resources/notification/types/AddNotificationRequest.ts index 1b9a2953..e03cc84a 100644 --- a/src/api/resources/notification/types/AddNotificationRequest.ts +++ b/src/api/resources/notification/types/AddNotificationRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export type AddNotificationRequest = /** diff --git a/src/api/resources/notification/types/UpdateNotificationRequest.ts b/src/api/resources/notification/types/UpdateNotificationRequest.ts index 8439337b..41951d76 100644 --- a/src/api/resources/notification/types/UpdateNotificationRequest.ts +++ b/src/api/resources/notification/types/UpdateNotificationRequest.ts @@ -1,7 +1,5 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export type UpdateNotificationRequest = Payabli.NotificationStandardRequest | Payabli.NotificationReportRequest; diff --git a/src/api/resources/notificationlogs/client/Client.ts b/src/api/resources/notificationlogs/client/Client.ts index f8fa67cc..15610c59 100644 --- a/src/api/resources/notificationlogs/client/Client.ts +++ b/src/api/resources/notificationlogs/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Notificationlogs { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace NotificationlogsClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Notificationlogs { - protected readonly _options: Notificationlogs.Options; +export class NotificationlogsClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Notificationlogs.Options = {}) { - this._options = _options; + constructor(options: NotificationlogsClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -45,7 +30,7 @@ export class Notificationlogs { * This endpoint requires the `notifications_create` OR `notifications_read` permission. * * @param {Payabli.SearchNotificationLogsRequest} request - * @param {Notificationlogs.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationlogsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -66,25 +51,31 @@ export class Notificationlogs { */ public searchNotificationLogs( request: Payabli.SearchNotificationLogsRequest, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__searchNotificationLogs(request, requestOptions)); } private async __searchNotificationLogs( request: Payabli.SearchNotificationLogsRequest, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): Promise> { const { PageSize: pageSize, Page: page, body: _body } = request; const _queryParams: Record = {}; if (pageSize != null) { - _queryParams["PageSize"] = pageSize.toString(); + _queryParams.PageSize = pageSize.toString(); } if (page != null) { - _queryParams["Page"] = page.toString(); + _queryParams.Page = page.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -93,18 +84,16 @@ export class Notificationlogs { "/v2/notificationlogs", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.NotificationLog[], rawResponse: _response.rawResponse }; @@ -132,21 +121,7 @@ export class Notificationlogs { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /v2/notificationlogs."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/notificationlogs"); } /** @@ -154,7 +129,7 @@ export class Notificationlogs { * This endpoint requires the `notifications_create` OR `notifications_read` permission. * * @param {string} uuid - The notification log entry. - * @param {Notificationlogs.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationlogsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -166,31 +141,36 @@ export class Notificationlogs { */ public getNotificationLog( uuid: string, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getNotificationLog(uuid, requestOptions)); } private async __getNotificationLog( uuid: string, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `/v2/notificationlogs/${encodeURIComponent(uuid)}`, + `/v2/notificationlogs/${core.url.encodePathParam(uuid)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.NotificationLogDetail, rawResponse: _response.rawResponse }; @@ -218,21 +198,7 @@ export class Notificationlogs { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /v2/notificationlogs/{uuid}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/notificationlogs/{uuid}"); } /** @@ -241,7 +207,7 @@ export class Notificationlogs { * **Permissions:** notifications_create * * @param {string} uuid - Unique id - * @param {Notificationlogs.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationlogsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -253,31 +219,36 @@ export class Notificationlogs { */ public retryNotificationLog( uuid: string, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__retryNotificationLog(uuid, requestOptions)); } private async __retryNotificationLog( uuid: string, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `/v2/notificationlogs/${encodeURIComponent(uuid)}/retry`, + `/v2/notificationlogs/${core.url.encodePathParam(uuid)}/retry`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.NotificationLogDetail, rawResponse: _response.rawResponse }; @@ -305,23 +276,12 @@ export class Notificationlogs { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /v2/notificationlogs/{uuid}/retry.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/v2/notificationlogs/{uuid}/retry", + ); } /** @@ -331,7 +291,7 @@ export class Notificationlogs { * This endpoint requires the `notifications_create` permission. * * @param {Payabli.BulkRetryRequest} request - * @param {Notificationlogs.RequestOptions} requestOptions - Request-specific configuration. + * @param {NotificationlogsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -343,15 +303,21 @@ export class Notificationlogs { */ public bulkRetryNotificationLogs( request: Payabli.BulkRetryRequest, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__bulkRetryNotificationLogs(request, requestOptions)); } private async __bulkRetryNotificationLogs( request: Payabli.BulkRetryRequest, - requestOptions?: Notificationlogs.RequestOptions, + requestOptions?: NotificationlogsClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -360,17 +326,16 @@ export class Notificationlogs { "/v2/notificationlogs/retry", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; @@ -398,25 +363,6 @@ export class Notificationlogs { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /v2/notificationlogs/retry."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/notificationlogs/retry"); } } diff --git a/src/api/resources/notificationlogs/client/index.ts b/src/api/resources/notificationlogs/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/notificationlogs/client/index.ts +++ b/src/api/resources/notificationlogs/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/notificationlogs/client/requests/SearchNotificationLogsRequest.ts b/src/api/resources/notificationlogs/client/requests/SearchNotificationLogsRequest.ts index 6625dfd9..b4f94041 100644 --- a/src/api/resources/notificationlogs/client/requests/SearchNotificationLogsRequest.ts +++ b/src/api/resources/notificationlogs/client/requests/SearchNotificationLogsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -19,9 +17,7 @@ import * as Payabli from "../../../../index.js"; */ export interface SearchNotificationLogsRequest { PageSize?: Payabli.Pagesize; - /** - * The page number to retrieve. Defaults to 1 if not provided. - */ + /** The page number to retrieve. Defaults to 1 if not provided. */ Page?: number; body: Payabli.NotificationLogSearchRequest; } diff --git a/src/api/resources/notificationlogs/client/requests/index.ts b/src/api/resources/notificationlogs/client/requests/index.ts index cdfe1e3d..97c24be5 100644 --- a/src/api/resources/notificationlogs/client/requests/index.ts +++ b/src/api/resources/notificationlogs/client/requests/index.ts @@ -1 +1 @@ -export { type SearchNotificationLogsRequest } from "./SearchNotificationLogsRequest.js"; +export type { SearchNotificationLogsRequest } from "./SearchNotificationLogsRequest.js"; diff --git a/src/api/resources/notificationlogs/index.ts b/src/api/resources/notificationlogs/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/notificationlogs/index.ts +++ b/src/api/resources/notificationlogs/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/notificationlogs/types/BulkRetryRequest.ts b/src/api/resources/notificationlogs/types/BulkRetryRequest.ts index b914fe77..d1ca6dbc 100644 --- a/src/api/resources/notificationlogs/types/BulkRetryRequest.ts +++ b/src/api/resources/notificationlogs/types/BulkRetryRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A list of notification log IDs to retry. The maximum number of IDs that can be retried in a single request is 50. diff --git a/src/api/resources/notificationlogs/types/KeyValueArray.ts b/src/api/resources/notificationlogs/types/KeyValueArray.ts index c3aa6e81..2371a4a4 100644 --- a/src/api/resources/notificationlogs/types/KeyValueArray.ts +++ b/src/api/resources/notificationlogs/types/KeyValueArray.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface KeyValueArray { key?: string; diff --git a/src/api/resources/notificationlogs/types/NotificationLog.ts b/src/api/resources/notificationlogs/types/NotificationLog.ts index 1b28a288..623ccf8f 100644 --- a/src/api/resources/notificationlogs/types/NotificationLog.ts +++ b/src/api/resources/notificationlogs/types/NotificationLog.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface NotificationLog { /** The unique identifier for the notification. */ diff --git a/src/api/resources/notificationlogs/types/NotificationLogDetail.ts b/src/api/resources/notificationlogs/types/NotificationLogDetail.ts index e7302d6b..cf1bfe84 100644 --- a/src/api/resources/notificationlogs/types/NotificationLogDetail.ts +++ b/src/api/resources/notificationlogs/types/NotificationLogDetail.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface NotificationLogDetail extends Payabli.NotificationLog { webHeaders?: Payabli.StringStringKeyValuePair[]; diff --git a/src/api/resources/notificationlogs/types/NotificationLogSearchRequest.ts b/src/api/resources/notificationlogs/types/NotificationLogSearchRequest.ts index 8cfeff9d..927cc213 100644 --- a/src/api/resources/notificationlogs/types/NotificationLogSearchRequest.ts +++ b/src/api/resources/notificationlogs/types/NotificationLogSearchRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface NotificationLogSearchRequest { /** The start date for the search. */ diff --git a/src/api/resources/notificationlogs/types/StringStringKeyValuePair.ts b/src/api/resources/notificationlogs/types/StringStringKeyValuePair.ts index 64185fe8..9c6bcdf6 100644 --- a/src/api/resources/notificationlogs/types/StringStringKeyValuePair.ts +++ b/src/api/resources/notificationlogs/types/StringStringKeyValuePair.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StringStringKeyValuePair { key?: string; diff --git a/src/api/resources/notificationlogs/types/index.ts b/src/api/resources/notificationlogs/types/index.ts index 16ceefd5..9567d866 100644 --- a/src/api/resources/notificationlogs/types/index.ts +++ b/src/api/resources/notificationlogs/types/index.ts @@ -1,6 +1,6 @@ +export * from "./BulkRetryRequest.js"; +export * from "./KeyValueArray.js"; export * from "./NotificationLog.js"; export * from "./NotificationLogDetail.js"; -export * from "./StringStringKeyValuePair.js"; -export * from "./KeyValueArray.js"; export * from "./NotificationLogSearchRequest.js"; -export * from "./BulkRetryRequest.js"; +export * from "./StringStringKeyValuePair.js"; diff --git a/src/api/resources/ocr/client/Client.ts b/src/api/resources/ocr/client/Client.ts index 18d6b09a..bd617ea8 100644 --- a/src/api/resources/ocr/client/Client.ts +++ b/src/api/resources/ocr/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Ocr { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace OcrClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Ocr { - protected readonly _options: Ocr.Options; +export class OcrClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Ocr.Options = {}) { - this._options = _options; + constructor(options: OcrClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -42,7 +27,7 @@ export class Ocr { * * @param {Payabli.TypeResult} typeResult * @param {Payabli.FileContentImageOnly} request - * @param {Ocr.RequestOptions} requestOptions - Request-specific configuration. + * @param {OcrClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -50,17 +35,12 @@ export class Ocr { * @throws {@link Payabli.ServiceUnavailableError} * * @example - * await client.ocr.ocrDocumentForm("typeResult", { - * ftype: undefined, - * filename: undefined, - * furl: undefined, - * fContent: undefined - * }) + * await client.ocr.ocrDocumentForm("typeResult", {}) */ public ocrDocumentForm( typeResult: Payabli.TypeResult, request: Payabli.FileContentImageOnly, - requestOptions?: Ocr.RequestOptions, + requestOptions?: OcrClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__ocrDocumentForm(typeResult, request, requestOptions)); } @@ -68,27 +48,32 @@ export class Ocr { private async __ocrDocumentForm( typeResult: Payabli.TypeResult, request: Payabli.FileContentImageOnly, - requestOptions?: Ocr.RequestOptions, + requestOptions?: OcrClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `/Import/ocrDocumentForm/${encodeURIComponent(typeResult)}`, + `/Import/ocrDocumentForm/${core.url.encodePathParam(typeResult)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseOcr, rawResponse: _response.rawResponse }; @@ -116,23 +101,12 @@ export class Ocr { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Import/ocrDocumentForm/{typeResult}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Import/ocrDocumentForm/{typeResult}", + ); } /** @@ -140,7 +114,7 @@ export class Ocr { * * @param {Payabli.TypeResult} typeResult * @param {Payabli.FileContentImageOnly} request - * @param {Ocr.RequestOptions} requestOptions - Request-specific configuration. + * @param {OcrClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -148,17 +122,12 @@ export class Ocr { * @throws {@link Payabli.ServiceUnavailableError} * * @example - * await client.ocr.ocrDocumentJson("typeResult", { - * ftype: undefined, - * filename: undefined, - * furl: undefined, - * fContent: undefined - * }) + * await client.ocr.ocrDocumentJson("typeResult", {}) */ public ocrDocumentJson( typeResult: Payabli.TypeResult, request: Payabli.FileContentImageOnly, - requestOptions?: Ocr.RequestOptions, + requestOptions?: OcrClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__ocrDocumentJson(typeResult, request, requestOptions)); } @@ -166,27 +135,32 @@ export class Ocr { private async __ocrDocumentJson( typeResult: Payabli.TypeResult, request: Payabli.FileContentImageOnly, - requestOptions?: Ocr.RequestOptions, + requestOptions?: OcrClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `/Import/ocrDocumentJson/${encodeURIComponent(typeResult)}`, + `/Import/ocrDocumentJson/${core.url.encodePathParam(typeResult)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseOcr, rawResponse: _response.rawResponse }; @@ -214,27 +188,11 @@ export class Ocr { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Import/ocrDocumentJson/{typeResult}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Import/ocrDocumentJson/{typeResult}", + ); } } diff --git a/src/api/resources/ocr/index.ts b/src/api/resources/ocr/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/ocr/index.ts +++ b/src/api/resources/ocr/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/ocr/types/FileContentImageOnly.ts b/src/api/resources/ocr/types/FileContentImageOnly.ts index daa90204..4cd6dccb 100644 --- a/src/api/resources/ocr/types/FileContentImageOnly.ts +++ b/src/api/resources/ocr/types/FileContentImageOnly.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FileContentImageOnly { ftype?: FileContentImageOnly.Ftype; @@ -13,10 +11,7 @@ export interface FileContentImageOnly { } export namespace FileContentImageOnly { - /** - * The MIME type of the file (if content is provided) - */ - export type Ftype = "pdf" | "doc" | "docx" | "jpg" | "jpeg" | "png" | "gif" | "txt"; + /** The MIME type of the file (if content is provided) */ export const Ftype = { Pdf: "pdf", Doc: "doc", @@ -27,4 +22,5 @@ export namespace FileContentImageOnly { Gif: "gif", Txt: "txt", } as const; + export type Ftype = (typeof Ftype)[keyof typeof Ftype]; } diff --git a/src/api/resources/ocr/types/OcrAttachment.ts b/src/api/resources/ocr/types/OcrAttachment.ts index 34d83f03..60936e0e 100644 --- a/src/api/resources/ocr/types/OcrAttachment.ts +++ b/src/api/resources/ocr/types/OcrAttachment.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OcrAttachment { ftype?: string; diff --git a/src/api/resources/ocr/types/OcrBillItem.ts b/src/api/resources/ocr/types/OcrBillItem.ts index 08c42851..61136954 100644 --- a/src/api/resources/ocr/types/OcrBillItem.ts +++ b/src/api/resources/ocr/types/OcrBillItem.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OcrBillItem { itemTotalAmount?: number; diff --git a/src/api/resources/ocr/types/OcrBillItemAdditionalData.ts b/src/api/resources/ocr/types/OcrBillItemAdditionalData.ts index b22664b8..f3de6ed2 100644 --- a/src/api/resources/ocr/types/OcrBillItemAdditionalData.ts +++ b/src/api/resources/ocr/types/OcrBillItemAdditionalData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OcrBillItemAdditionalData { category?: string; diff --git a/src/api/resources/ocr/types/OcrResponseData.ts b/src/api/resources/ocr/types/OcrResponseData.ts index d194a4b4..a0323fa3 100644 --- a/src/api/resources/ocr/types/OcrResponseData.ts +++ b/src/api/resources/ocr/types/OcrResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface OcrResponseData { resultData?: Payabli.OcrResultData; diff --git a/src/api/resources/ocr/types/OcrResultData.ts b/src/api/resources/ocr/types/OcrResultData.ts index 903331c9..fd7a5462 100644 --- a/src/api/resources/ocr/types/OcrResultData.ts +++ b/src/api/resources/ocr/types/OcrResultData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface OcrResultData { billNumber?: string; diff --git a/src/api/resources/ocr/types/OcrVendor.ts b/src/api/resources/ocr/types/OcrVendor.ts index 02ec4a3c..8d7c7cda 100644 --- a/src/api/resources/ocr/types/OcrVendor.ts +++ b/src/api/resources/ocr/types/OcrVendor.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface OcrVendor { vendorNumber?: string; diff --git a/src/api/resources/ocr/types/OcrVendorAdditionalData.ts b/src/api/resources/ocr/types/OcrVendorAdditionalData.ts index 8ba9eb44..77019ee9 100644 --- a/src/api/resources/ocr/types/OcrVendorAdditionalData.ts +++ b/src/api/resources/ocr/types/OcrVendorAdditionalData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OcrVendorAdditionalData { web?: string; diff --git a/src/api/resources/ocr/types/OcrVendorBillingData.ts b/src/api/resources/ocr/types/OcrVendorBillingData.ts index afb3055a..d1c0f226 100644 --- a/src/api/resources/ocr/types/OcrVendorBillingData.ts +++ b/src/api/resources/ocr/types/OcrVendorBillingData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OcrVendorBillingData { id?: number; diff --git a/src/api/resources/ocr/types/PayabliApiResponseOcr.ts b/src/api/resources/ocr/types/PayabliApiResponseOcr.ts index 9775c610..f6ffa368 100644 --- a/src/api/resources/ocr/types/PayabliApiResponseOcr.ts +++ b/src/api/resources/ocr/types/PayabliApiResponseOcr.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface PayabliApiResponseOcr { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/ocr/types/TypeResult.ts b/src/api/resources/ocr/types/TypeResult.ts index fbff1dac..2e55d7b5 100644 --- a/src/api/resources/ocr/types/TypeResult.ts +++ b/src/api/resources/ocr/types/TypeResult.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The type of object to create in Payabli. Accepted values are `bill` and `invoice`. diff --git a/src/api/resources/ocr/types/index.ts b/src/api/resources/ocr/types/index.ts index fd83e595..17a92b04 100644 --- a/src/api/resources/ocr/types/index.ts +++ b/src/api/resources/ocr/types/index.ts @@ -1,11 +1,11 @@ -export * from "./TypeResult.js"; -export * from "./PayabliApiResponseOcr.js"; -export * from "./OcrResponseData.js"; export * from "./FileContentImageOnly.js"; -export * from "./OcrVendorBillingData.js"; -export * from "./OcrVendorAdditionalData.js"; -export * from "./OcrVendor.js"; -export * from "./OcrBillItemAdditionalData.js"; -export * from "./OcrBillItem.js"; export * from "./OcrAttachment.js"; +export * from "./OcrBillItem.js"; +export * from "./OcrBillItemAdditionalData.js"; +export * from "./OcrResponseData.js"; export * from "./OcrResultData.js"; +export * from "./OcrVendor.js"; +export * from "./OcrVendorAdditionalData.js"; +export * from "./OcrVendorBillingData.js"; +export * from "./PayabliApiResponseOcr.js"; +export * from "./TypeResult.js"; diff --git a/src/api/resources/organization/client/Client.ts b/src/api/resources/organization/client/Client.ts index 19b60cee..96bcfd22 100644 --- a/src/api/resources/organization/client/Client.ts +++ b/src/api/resources/organization/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Organization { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace OrganizationClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Organization { - protected readonly _options: Organization.Options; +export class OrganizationClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Organization.Options = {}) { - this._options = _options; + constructor(options: OrganizationClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Creates an organization under a parent organization. This is also referred to as a suborganization. * * @param {Payabli.AddOrganizationRequest} request - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -91,16 +76,23 @@ export class Organization { */ public addOrganization( request: Payabli.AddOrganizationRequest, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addOrganization(request, requestOptions)); } private async __addOrganization( request: Payabli.AddOrganizationRequest, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { const { idempotencyKey, ..._body } = request; + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -109,20 +101,16 @@ export class Organization { "Organization", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddOrganizationResponse, rawResponse: _response.rawResponse }; @@ -150,28 +138,14 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Organization."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Organization"); } /** * Delete an organization by ID. * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -183,31 +157,36 @@ export class Organization { */ public deleteOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteOrganization(orgId, requestOptions)); } private async __deleteOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/${encodeURIComponent(orgId)}`, + `Organization/${core.url.encodePathParam(orgId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.DeleteOrganizationResponse, rawResponse: _response.rawResponse }; @@ -235,21 +214,7 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Organization/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Organization/{orgId}"); } /** @@ -257,7 +222,7 @@ export class Organization { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.OrganizationData} request - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -288,7 +253,7 @@ export class Organization { public editOrganization( orgId: number, request: Payabli.OrganizationData = {}, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editOrganization(orgId, request, requestOptions)); } @@ -296,27 +261,32 @@ export class Organization { private async __editOrganization( orgId: number, request: Payabli.OrganizationData = {}, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/${encodeURIComponent(orgId)}`, + `Organization/${core.url.encodePathParam(orgId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.EditOrganizationResponse, rawResponse: _response.rawResponse }; @@ -344,28 +314,14 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Organization/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Organization/{orgId}"); } /** * Gets an organization's basic information by entry name (entrypoint identifier). * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -377,31 +333,36 @@ export class Organization { */ public getBasicOrganization( entry: string, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getBasicOrganization(entry, requestOptions)); } private async __getBasicOrganization( entry: string, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/basic/${encodeURIComponent(entry)}`, + `Organization/basic/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.OrganizationQueryRecord, rawResponse: _response.rawResponse }; @@ -429,28 +390,14 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/basic/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Organization/basic/{entry}"); } /** * Gets an organizations basic details by org ID. * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -462,31 +409,36 @@ export class Organization { */ public getBasicOrganizationById( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getBasicOrganizationById(orgId, requestOptions)); } private async __getBasicOrganizationById( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/basicById/${encodeURIComponent(orgId)}`, + `Organization/basicById/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.OrganizationQueryRecord, rawResponse: _response.rawResponse }; @@ -514,30 +466,19 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Organization/basicById/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Organization/basicById/{orgId}", + ); } /** * Retrieves details for an organization by ID. * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -549,31 +490,36 @@ export class Organization { */ public getOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getOrganization(orgId, requestOptions)); } private async __getOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/read/${encodeURIComponent(orgId)}`, + `Organization/read/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.OrganizationQueryRecord, rawResponse: _response.rawResponse }; @@ -601,28 +547,14 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Organization/read/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Organization/read/{orgId}"); } /** * Retrieves an organization's settings. * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. - * @param {Organization.RequestOptions} requestOptions - Request-specific configuration. + * @param {OrganizationClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -634,31 +566,36 @@ export class Organization { */ public getSettingsOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getSettingsOrganization(orgId, requestOptions)); } private async __getSettingsOrganization( orgId: number, - requestOptions?: Organization.RequestOptions, + requestOptions?: OrganizationClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Organization/settings/${encodeURIComponent(orgId)}`, + `Organization/settings/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.SettingsQueryRecord, rawResponse: _response.rawResponse }; @@ -686,27 +623,11 @@ export class Organization { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Organization/settings/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Organization/settings/{orgId}", + ); } } diff --git a/src/api/resources/organization/client/index.ts b/src/api/resources/organization/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/organization/client/index.ts +++ b/src/api/resources/organization/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/organization/client/requests/AddOrganizationRequest.ts b/src/api/resources/organization/client/requests/AddOrganizationRequest.ts index d88821e0..54fdfde5 100644 --- a/src/api/resources/organization/client/requests/AddOrganizationRequest.ts +++ b/src/api/resources/organization/client/requests/AddOrganizationRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/organization/client/requests/OrganizationData.ts b/src/api/resources/organization/client/requests/OrganizationData.ts index 298af97e..1aef0426 100644 --- a/src/api/resources/organization/client/requests/OrganizationData.ts +++ b/src/api/resources/organization/client/requests/OrganizationData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/organization/client/requests/index.ts b/src/api/resources/organization/client/requests/index.ts index 56d9c58a..aef59700 100644 --- a/src/api/resources/organization/client/requests/index.ts +++ b/src/api/resources/organization/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type AddOrganizationRequest } from "./AddOrganizationRequest.js"; -export { type OrganizationData } from "./OrganizationData.js"; +export type { AddOrganizationRequest } from "./AddOrganizationRequest.js"; +export type { OrganizationData } from "./OrganizationData.js"; diff --git a/src/api/resources/organization/index.ts b/src/api/resources/organization/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/organization/index.ts +++ b/src/api/resources/organization/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/organization/types/AddOrganizationResponse.ts b/src/api/resources/organization/types/AddOrganizationResponse.ts index d01bf457..a182264e 100644 --- a/src/api/resources/organization/types/AddOrganizationResponse.ts +++ b/src/api/resources/organization/types/AddOrganizationResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AddOrganizationResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/organization/types/DeleteOrganizationResponse.ts b/src/api/resources/organization/types/DeleteOrganizationResponse.ts index 922d8221..09d492e1 100644 --- a/src/api/resources/organization/types/DeleteOrganizationResponse.ts +++ b/src/api/resources/organization/types/DeleteOrganizationResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface DeleteOrganizationResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/organization/types/EditOrganizationResponse.ts b/src/api/resources/organization/types/EditOrganizationResponse.ts index 309d75a7..e622f84e 100644 --- a/src/api/resources/organization/types/EditOrganizationResponse.ts +++ b/src/api/resources/organization/types/EditOrganizationResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface EditOrganizationResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/paymentLink/client/Client.ts b/src/api/resources/paymentLink/client/Client.ts index 9926d238..c1391f9e 100644 --- a/src/api/resources/paymentLink/client/Client.ts +++ b/src/api/resources/paymentLink/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace PaymentLink { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace PaymentLinkClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class PaymentLink { - protected readonly _options: PaymentLink.Options; +export class PaymentLinkClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: PaymentLink.Options = {}) { - this._options = _options; + constructor(options: PaymentLinkClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -42,7 +27,7 @@ export class PaymentLink { * * @param {number} idInvoice - Invoice ID * @param {Payabli.PayLinkDataInvoice} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -164,7 +149,7 @@ export class PaymentLink { public addPayLinkFromInvoice( idInvoice: number, request: Payabli.PayLinkDataInvoice, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addPayLinkFromInvoice(idInvoice, request, requestOptions)); } @@ -172,41 +157,43 @@ export class PaymentLink { private async __addPayLinkFromInvoice( idInvoice: number, request: Payabli.PayLinkDataInvoice, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { const { amountFixed, mail2, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (amountFixed != null) { - _queryParams["amountFixed"] = amountFixed.toString(); + _queryParams.amountFixed = amountFixed.toString(); } if (mail2 != null) { - _queryParams["mail2"] = mail2; + _queryParams.mail2 = mail2; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/${encodeURIComponent(idInvoice)}`, + `PaymentLink/${core.url.encodePathParam(idInvoice)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -237,21 +224,7 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /PaymentLink/{idInvoice}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/PaymentLink/{idInvoice}"); } /** @@ -259,7 +232,7 @@ export class PaymentLink { * * @param {number} billId - The Payabli ID for the bill. * @param {Payabli.PayLinkDataBill} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -351,7 +324,7 @@ export class PaymentLink { public addPayLinkFromBill( billId: number, request: Payabli.PayLinkDataBill, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addPayLinkFromBill(billId, request, requestOptions)); } @@ -359,41 +332,43 @@ export class PaymentLink { private async __addPayLinkFromBill( billId: number, request: Payabli.PayLinkDataBill, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { const { amountFixed, mail2, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (amountFixed != null) { - _queryParams["amountFixed"] = amountFixed.toString(); + _queryParams.amountFixed = amountFixed.toString(); } if (mail2 != null) { - _queryParams["mail2"] = mail2; + _queryParams.mail2 = mail2; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/bill/${encodeURIComponent(billId)}`, + `PaymentLink/bill/${core.url.encodePathParam(billId)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -424,28 +399,14 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /PaymentLink/bill/{billId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/PaymentLink/bill/{billId}"); } /** * Deletes a payment link by ID. * * @param {string} payLinkId - ID for the payment link. - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -457,31 +418,36 @@ export class PaymentLink { */ public deletePayLinkFromId( payLinkId: string, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deletePayLinkFromId(payLinkId, requestOptions)); } private async __deletePayLinkFromId( payLinkId: string, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/${encodeURIComponent(payLinkId)}`, + `PaymentLink/${core.url.encodePathParam(payLinkId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -512,28 +478,14 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /PaymentLink/{payLinkId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/PaymentLink/{payLinkId}"); } /** * Retrieves a payment link by ID. * * @param {string} paylinkId - ID for payment link - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -545,31 +497,36 @@ export class PaymentLink { */ public getPayLinkFromId( paylinkId: string, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getPayLinkFromId(paylinkId, requestOptions)); } private async __getPayLinkFromId( paylinkId: string, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/load/${encodeURIComponent(paylinkId)}`, + `PaymentLink/load/${core.url.encodePathParam(paylinkId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetPayLinkFromIdResponse, rawResponse: _response.rawResponse }; @@ -597,23 +554,7 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /PaymentLink/load/{paylinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/PaymentLink/load/{paylinkId}"); } /** @@ -621,7 +562,7 @@ export class PaymentLink { * * @param {string} payLinkId - ID for the payment link. * @param {Payabli.PushPayLinkRequest} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -643,7 +584,7 @@ export class PaymentLink { public pushPayLinkFromId( payLinkId: string, request: Payabli.PushPayLinkRequest, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__pushPayLinkFromId(payLinkId, request, requestOptions)); } @@ -651,27 +592,32 @@ export class PaymentLink { private async __pushPayLinkFromId( payLinkId: string, request: Payabli.PushPayLinkRequest, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/push/${encodeURIComponent(payLinkId)}`, + `PaymentLink/push/${core.url.encodePathParam(payLinkId)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -702,23 +648,12 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /PaymentLink/push/{payLinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/PaymentLink/push/{payLinkId}", + ); } /** @@ -726,7 +661,7 @@ export class PaymentLink { * * @param {string} payLinkId - ID for the payment link. * @param {Payabli.RefreshPayLinkFromIdRequest} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -739,7 +674,7 @@ export class PaymentLink { public refreshPayLinkFromId( payLinkId: string, request: Payabli.RefreshPayLinkFromIdRequest = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__refreshPayLinkFromId(payLinkId, request, requestOptions)); } @@ -747,31 +682,35 @@ export class PaymentLink { private async __refreshPayLinkFromId( payLinkId: string, request: Payabli.RefreshPayLinkFromIdRequest = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { const { amountFixed } = request; const _queryParams: Record = {}; if (amountFixed != null) { - _queryParams["amountFixed"] = amountFixed.toString(); + _queryParams.amountFixed = amountFixed.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/refresh/${encodeURIComponent(payLinkId)}`, + `PaymentLink/refresh/${core.url.encodePathParam(payLinkId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -802,23 +741,12 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /PaymentLink/refresh/{payLinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/PaymentLink/refresh/{payLinkId}", + ); } /** @@ -826,7 +754,7 @@ export class PaymentLink { * * @param {string} payLinkId - ID for the payment link. * @param {Payabli.SendPayLinkFromIdRequest} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -841,7 +769,7 @@ export class PaymentLink { public sendPayLinkFromId( payLinkId: string, request: Payabli.SendPayLinkFromIdRequest = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__sendPayLinkFromId(payLinkId, request, requestOptions)); } @@ -849,35 +777,39 @@ export class PaymentLink { private async __sendPayLinkFromId( payLinkId: string, request: Payabli.SendPayLinkFromIdRequest = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { const { attachfile, mail2 } = request; const _queryParams: Record = {}; if (attachfile != null) { - _queryParams["attachfile"] = attachfile.toString(); + _queryParams.attachfile = attachfile.toString(); } if (mail2 != null) { - _queryParams["mail2"] = mail2; + _queryParams.mail2 = mail2; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/send/${encodeURIComponent(payLinkId)}`, + `PaymentLink/send/${core.url.encodePathParam(payLinkId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -908,23 +840,7 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /PaymentLink/send/{payLinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/PaymentLink/send/{payLinkId}"); } /** @@ -932,7 +848,7 @@ export class PaymentLink { * * @param {string} payLinkId - ID for the payment link. * @param {Payabli.PayLinkUpdateData} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -958,7 +874,7 @@ export class PaymentLink { public updatePayLinkFromId( payLinkId: string, request: Payabli.PayLinkUpdateData = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updatePayLinkFromId(payLinkId, request, requestOptions)); } @@ -966,27 +882,32 @@ export class PaymentLink { private async __updatePayLinkFromId( payLinkId: string, request: Payabli.PayLinkUpdateData = {}, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/update/${encodeURIComponent(payLinkId)}`, + `PaymentLink/update/${core.url.encodePathParam(payLinkId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1017,23 +938,12 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling PUT /PaymentLink/update/{payLinkId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PUT", + "/PaymentLink/update/{payLinkId}", + ); } /** @@ -1041,7 +951,7 @@ export class PaymentLink { * * @param {string} lotNumber - Lot number of the bills to pay. All bills with this lot number will be included. * @param {Payabli.PayLinkDataOut} request - * @param {PaymentLink.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentLinkClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1136,7 +1046,7 @@ export class PaymentLink { public addPayLinkFromBillLotNumber( lotNumber: string, request: Payabli.PayLinkDataOut, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__addPayLinkFromBillLotNumber(lotNumber, request, requestOptions), @@ -1146,40 +1056,44 @@ export class PaymentLink { private async __addPayLinkFromBillLotNumber( lotNumber: string, request: Payabli.PayLinkDataOut, - requestOptions?: PaymentLink.RequestOptions, + requestOptions?: PaymentLinkClient.RequestOptions, ): Promise> { const { entryPoint, vendorNumber, mail2, amountFixed, body: _body } = request; const _queryParams: Record = {}; - _queryParams["entryPoint"] = entryPoint; - _queryParams["vendorNumber"] = vendorNumber; + _queryParams.entryPoint = entryPoint; + _queryParams.vendorNumber = vendorNumber; if (mail2 != null) { - _queryParams["mail2"] = mail2; + _queryParams.mail2 = mail2; } if (amountFixed != null) { - _queryParams["amountFixed"] = amountFixed; + _queryParams.amountFixed = amountFixed; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentLink/bill/lotNumber/${encodeURIComponent(lotNumber)}`, + `PaymentLink/bill/lotNumber/${core.url.encodePathParam(lotNumber)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1210,27 +1124,11 @@ export class PaymentLink { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /PaymentLink/bill/lotNumber/{lotNumber}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/PaymentLink/bill/lotNumber/{lotNumber}", + ); } } diff --git a/src/api/resources/paymentLink/client/index.ts b/src/api/resources/paymentLink/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/paymentLink/client/index.ts +++ b/src/api/resources/paymentLink/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/paymentLink/client/requests/PayLinkDataBill.ts b/src/api/resources/paymentLink/client/requests/PayLinkDataBill.ts index 8ba9f73e..62f4c230 100644 --- a/src/api/resources/paymentLink/client/requests/PayLinkDataBill.ts +++ b/src/api/resources/paymentLink/client/requests/PayLinkDataBill.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -88,13 +86,9 @@ import * as Payabli from "../../../../index.js"; * } */ export interface PayLinkDataBill { - /** - * Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. - */ + /** Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. */ amountFixed?: boolean; - /** - * List of recipient email addresses. When there is more than one, separate them by a semicolon (;). - */ + /** List of recipient email addresses. When there is more than one, separate them by a semicolon (;). */ mail2?: string; idempotencyKey?: Payabli.IdempotencyKey; body: Payabli.PaymentPageRequestBody; diff --git a/src/api/resources/paymentLink/client/requests/PayLinkDataInvoice.ts b/src/api/resources/paymentLink/client/requests/PayLinkDataInvoice.ts index c75e9afc..9727abe8 100644 --- a/src/api/resources/paymentLink/client/requests/PayLinkDataInvoice.ts +++ b/src/api/resources/paymentLink/client/requests/PayLinkDataInvoice.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -118,13 +116,9 @@ import * as Payabli from "../../../../index.js"; * } */ export interface PayLinkDataInvoice { - /** - * Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. - */ + /** Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. */ amountFixed?: boolean; - /** - * List of recipient email addresses. When there is more than one, separate them by a semicolon (;). - */ + /** List of recipient email addresses. When there is more than one, separate them by a semicolon (;). */ mail2?: string; idempotencyKey?: Payabli.IdempotencyKey; body: Payabli.PaymentPageRequestBody; diff --git a/src/api/resources/paymentLink/client/requests/PayLinkDataOut.ts b/src/api/resources/paymentLink/client/requests/PayLinkDataOut.ts index 45364a2c..f43e6c1f 100644 --- a/src/api/resources/paymentLink/client/requests/PayLinkDataOut.ts +++ b/src/api/resources/paymentLink/client/requests/PayLinkDataOut.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -92,17 +90,11 @@ import * as Payabli from "../../../../index.js"; */ export interface PayLinkDataOut { entryPoint: Payabli.Entry; - /** - * The vendor number for the vendor being paid with this payment link. - */ + /** The vendor number for the vendor being paid with this payment link. */ vendorNumber: string; - /** - * List of recipient email addresses. When there is more than one, separate them by a semicolon (;). - */ + /** List of recipient email addresses. When there is more than one, separate them by a semicolon (;). */ mail2?: string; - /** - * Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. - */ + /** Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. */ amountFixed?: string; body: Payabli.PaymentPageRequestBody; } diff --git a/src/api/resources/paymentLink/client/requests/PayLinkUpdateData.ts b/src/api/resources/paymentLink/client/requests/PayLinkUpdateData.ts index b1a0a0f9..e45d5e61 100644 --- a/src/api/resources/paymentLink/client/requests/PayLinkUpdateData.ts +++ b/src/api/resources/paymentLink/client/requests/PayLinkUpdateData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/paymentLink/client/requests/RefreshPayLinkFromIdRequest.ts b/src/api/resources/paymentLink/client/requests/RefreshPayLinkFromIdRequest.ts index bedeaf1a..f29ff7a2 100644 --- a/src/api/resources/paymentLink/client/requests/RefreshPayLinkFromIdRequest.ts +++ b/src/api/resources/paymentLink/client/requests/RefreshPayLinkFromIdRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface RefreshPayLinkFromIdRequest { - /** - * Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. - */ + /** Indicates whether customer can modify the payment amount. A value of `true` means the amount isn't modifiable, a value `false` means the payor can modify the amount to pay. */ amountFixed?: boolean; } diff --git a/src/api/resources/paymentLink/client/requests/SendPayLinkFromIdRequest.ts b/src/api/resources/paymentLink/client/requests/SendPayLinkFromIdRequest.ts index e89428da..28923c78 100644 --- a/src/api/resources/paymentLink/client/requests/SendPayLinkFromIdRequest.ts +++ b/src/api/resources/paymentLink/client/requests/SendPayLinkFromIdRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -9,12 +7,8 @@ * } */ export interface SendPayLinkFromIdRequest { - /** - * When `true`, attaches a PDF version of invoice to the email. - */ + /** When `true`, attaches a PDF version of invoice to the email. */ attachfile?: boolean; - /** - * List of recipient email addresses. When there is more than one, separate them by a semicolon (;). - */ + /** List of recipient email addresses. When there is more than one, separate them by a semicolon (;). */ mail2?: string; } diff --git a/src/api/resources/paymentLink/client/requests/index.ts b/src/api/resources/paymentLink/client/requests/index.ts index c95d5c3a..0ba35af4 100644 --- a/src/api/resources/paymentLink/client/requests/index.ts +++ b/src/api/resources/paymentLink/client/requests/index.ts @@ -1,6 +1,6 @@ -export { type PayLinkDataInvoice } from "./PayLinkDataInvoice.js"; -export { type PayLinkDataBill } from "./PayLinkDataBill.js"; -export { type RefreshPayLinkFromIdRequest } from "./RefreshPayLinkFromIdRequest.js"; -export { type SendPayLinkFromIdRequest } from "./SendPayLinkFromIdRequest.js"; -export { type PayLinkUpdateData } from "./PayLinkUpdateData.js"; -export { type PayLinkDataOut } from "./PayLinkDataOut.js"; +export type { PayLinkDataBill } from "./PayLinkDataBill.js"; +export type { PayLinkDataInvoice } from "./PayLinkDataInvoice.js"; +export type { PayLinkDataOut } from "./PayLinkDataOut.js"; +export type { PayLinkUpdateData } from "./PayLinkUpdateData.js"; +export type { RefreshPayLinkFromIdRequest } from "./RefreshPayLinkFromIdRequest.js"; +export type { SendPayLinkFromIdRequest } from "./SendPayLinkFromIdRequest.js"; diff --git a/src/api/resources/paymentLink/index.ts b/src/api/resources/paymentLink/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/paymentLink/index.ts +++ b/src/api/resources/paymentLink/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/paymentLink/types/GetPayLinkFromIdResponse.ts b/src/api/resources/paymentLink/types/GetPayLinkFromIdResponse.ts index cf831ae7..26b45368 100644 --- a/src/api/resources/paymentLink/types/GetPayLinkFromIdResponse.ts +++ b/src/api/resources/paymentLink/types/GetPayLinkFromIdResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetPayLinkFromIdResponse extends Payabli.PayabliApiResponseGeneric2Part { responseData?: GetPayLinkFromIdResponse.ResponseData; diff --git a/src/api/resources/paymentLink/types/PayabliApiResponsePaymentLinks.ts b/src/api/resources/paymentLink/types/PayabliApiResponsePaymentLinks.ts index b0dec44c..79cccb31 100644 --- a/src/api/resources/paymentLink/types/PayabliApiResponsePaymentLinks.ts +++ b/src/api/resources/paymentLink/types/PayabliApiResponsePaymentLinks.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface PayabliApiResponsePaymentLinks { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paymentLink/types/PaymentPageRequestBody.ts b/src/api/resources/paymentLink/types/PaymentPageRequestBody.ts index da135771..aec25be4 100644 --- a/src/api/resources/paymentLink/types/PaymentPageRequestBody.ts +++ b/src/api/resources/paymentLink/types/PaymentPageRequestBody.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * @example diff --git a/src/api/resources/paymentLink/types/index.ts b/src/api/resources/paymentLink/types/index.ts index 56f9a3c0..9eaa5910 100644 --- a/src/api/resources/paymentLink/types/index.ts +++ b/src/api/resources/paymentLink/types/index.ts @@ -1,3 +1,3 @@ -export * from "./PaymentPageRequestBody.js"; export * from "./GetPayLinkFromIdResponse.js"; export * from "./PayabliApiResponsePaymentLinks.js"; +export * from "./PaymentPageRequestBody.js"; diff --git a/src/api/resources/paymentMethodDomain/client/Client.ts b/src/api/resources/paymentMethodDomain/client/Client.ts index f2f35a4b..5e93f1b5 100644 --- a/src/api/resources/paymentMethodDomain/client/Client.ts +++ b/src/api/resources/paymentMethodDomain/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace PaymentMethodDomain { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace PaymentMethodDomainClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class PaymentMethodDomain { - protected readonly _options: PaymentMethodDomain.Options; +export class PaymentMethodDomainClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: PaymentMethodDomain.Options = {}) { - this._options = _options; + constructor(options: PaymentMethodDomainClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Add a payment method domain to an organization or paypoint. * * @param {Payabli.AddPaymentMethodDomainRequest} request - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -63,15 +48,21 @@ export class PaymentMethodDomain { */ public addPaymentMethodDomain( request: Payabli.AddPaymentMethodDomainRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addPaymentMethodDomain(request, requestOptions)); } private async __addPaymentMethodDomain( request: Payabli.AddPaymentMethodDomainRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -80,17 +71,16 @@ export class PaymentMethodDomain { "PaymentMethodDomain", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -121,28 +111,14 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /PaymentMethodDomain."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/PaymentMethodDomain"); } /** * Cascades a payment method domain to all child entities. All paypoints and suborganization under this parent will inherit this domain and its settings. * * @param {string} domainId - The payment method domain's ID in Payabli. - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -154,31 +130,36 @@ export class PaymentMethodDomain { */ public cascadePaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__cascadePaymentMethodDomain(domainId, requestOptions)); } private async __cascadePaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentMethodDomain/${encodeURIComponent(domainId)}/cascade`, + `PaymentMethodDomain/${core.url.encodePathParam(domainId)}/cascade`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -209,30 +190,19 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /PaymentMethodDomain/{domainId}/cascade.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/PaymentMethodDomain/{domainId}/cascade", + ); } /** * Delete a payment method domain. You can't delete an inherited domain, you must delete a domain at the organization level. * * @param {string} domainId - The payment method domain's ID in Payabli. - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -244,31 +214,36 @@ export class PaymentMethodDomain { */ public deletePaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deletePaymentMethodDomain(domainId, requestOptions)); } private async __deletePaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentMethodDomain/${encodeURIComponent(domainId)}`, + `PaymentMethodDomain/${core.url.encodePathParam(domainId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -299,30 +274,19 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /PaymentMethodDomain/{domainId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/PaymentMethodDomain/{domainId}", + ); } /** * Get the details for a payment method domain. * * @param {string} domainId - The payment method domain's ID in Payabli. - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -334,31 +298,36 @@ export class PaymentMethodDomain { */ public getPaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getPaymentMethodDomain(domainId, requestOptions)); } private async __getPaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentMethodDomain/${encodeURIComponent(domainId)}`, + `PaymentMethodDomain/${core.url.encodePathParam(domainId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -389,30 +358,19 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /PaymentMethodDomain/{domainId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/PaymentMethodDomain/{domainId}", + ); } /** * Get a list of payment method domains that belong to a PSP, organization, or paypoint. * * @param {Payabli.ListPaymentMethodDomainsRequest} request - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -433,33 +391,39 @@ export class PaymentMethodDomain { */ public listPaymentMethodDomains( request: Payabli.ListPaymentMethodDomainsRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listPaymentMethodDomains(request, requestOptions)); } private async __listPaymentMethodDomains( request: Payabli.ListPaymentMethodDomainsRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { const { entityId, entityType, fromRecord, limitRecord } = request; const _queryParams: Record = {}; if (entityId != null) { - _queryParams["entityId"] = entityId.toString(); + _queryParams.entityId = entityId.toString(); } if (entityType != null) { - _queryParams["entityType"] = entityType; + _queryParams.entityType = entityType; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -468,15 +432,13 @@ export class PaymentMethodDomain { "PaymentMethodDomain/list", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -507,21 +469,7 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /PaymentMethodDomain/list."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/PaymentMethodDomain/list"); } /** @@ -529,7 +477,7 @@ export class PaymentMethodDomain { * * @param {string} domainId - The payment method domain's ID in Payabli. * @param {Payabli.UpdatePaymentMethodDomainRequest} request - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -549,7 +497,7 @@ export class PaymentMethodDomain { public updatePaymentMethodDomain( domainId: string, request: Payabli.UpdatePaymentMethodDomainRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__updatePaymentMethodDomain(domainId, request, requestOptions), @@ -559,27 +507,32 @@ export class PaymentMethodDomain { private async __updatePaymentMethodDomain( domainId: string, request: Payabli.UpdatePaymentMethodDomainRequest = {}, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentMethodDomain/${encodeURIComponent(domainId)}`, + `PaymentMethodDomain/${core.url.encodePathParam(domainId)}`, ), method: "PATCH", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -610,30 +563,19 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling PATCH /PaymentMethodDomain/{domainId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PATCH", + "/PaymentMethodDomain/{domainId}", + ); } /** * Verify a new payment method domain. If verification is successful, Apple Pay is automatically activated for the domain. * * @param {string} domainId - The payment method domain's ID in Payabli. - * @param {PaymentMethodDomain.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaymentMethodDomainClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -645,31 +587,36 @@ export class PaymentMethodDomain { */ public verifyPaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__verifyPaymentMethodDomain(domainId, requestOptions)); } private async __verifyPaymentMethodDomain( domainId: string, - requestOptions?: PaymentMethodDomain.RequestOptions, + requestOptions?: PaymentMethodDomainClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `PaymentMethodDomain/${encodeURIComponent(domainId)}/verify`, + `PaymentMethodDomain/${core.url.encodePathParam(domainId)}/verify`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -700,27 +647,11 @@ export class PaymentMethodDomain { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /PaymentMethodDomain/{domainId}/verify.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/PaymentMethodDomain/{domainId}/verify", + ); } } diff --git a/src/api/resources/paymentMethodDomain/client/index.ts b/src/api/resources/paymentMethodDomain/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/paymentMethodDomain/client/index.ts +++ b/src/api/resources/paymentMethodDomain/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/paymentMethodDomain/client/requests/AddPaymentMethodDomainRequest.ts b/src/api/resources/paymentMethodDomain/client/requests/AddPaymentMethodDomainRequest.ts index ccda95be..2075f061 100644 --- a/src/api/resources/paymentMethodDomain/client/requests/AddPaymentMethodDomainRequest.ts +++ b/src/api/resources/paymentMethodDomain/client/requests/AddPaymentMethodDomainRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/paymentMethodDomain/client/requests/ListPaymentMethodDomainsRequest.ts b/src/api/resources/paymentMethodDomain/client/requests/ListPaymentMethodDomainsRequest.ts index 0b0f0cb8..50abbafe 100644 --- a/src/api/resources/paymentMethodDomain/client/requests/ListPaymentMethodDomainsRequest.ts +++ b/src/api/resources/paymentMethodDomain/client/requests/ListPaymentMethodDomainsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -28,12 +26,8 @@ export interface ListPaymentMethodDomainsRequest { * - psp */ entityType?: string; - /** - * Number of records to skip. Defaults to `0`. - */ + /** Number of records to skip. Defaults to `0`. */ fromRecord?: number; - /** - * Max number of records for query response. Defaults to `20`. - */ + /** Max number of records for query response. Defaults to `20`. */ limitRecord?: number; } diff --git a/src/api/resources/paymentMethodDomain/client/requests/UpdatePaymentMethodDomainRequest.ts b/src/api/resources/paymentMethodDomain/client/requests/UpdatePaymentMethodDomainRequest.ts index c7d1d047..5133cfdd 100644 --- a/src/api/resources/paymentMethodDomain/client/requests/UpdatePaymentMethodDomainRequest.ts +++ b/src/api/resources/paymentMethodDomain/client/requests/UpdatePaymentMethodDomainRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/paymentMethodDomain/client/requests/index.ts b/src/api/resources/paymentMethodDomain/client/requests/index.ts index 318bb41b..285457c4 100644 --- a/src/api/resources/paymentMethodDomain/client/requests/index.ts +++ b/src/api/resources/paymentMethodDomain/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type AddPaymentMethodDomainRequest } from "./AddPaymentMethodDomainRequest.js"; -export { type ListPaymentMethodDomainsRequest } from "./ListPaymentMethodDomainsRequest.js"; -export { type UpdatePaymentMethodDomainRequest } from "./UpdatePaymentMethodDomainRequest.js"; +export type { AddPaymentMethodDomainRequest } from "./AddPaymentMethodDomainRequest.js"; +export type { ListPaymentMethodDomainsRequest } from "./ListPaymentMethodDomainsRequest.js"; +export type { UpdatePaymentMethodDomainRequest } from "./UpdatePaymentMethodDomainRequest.js"; diff --git a/src/api/resources/paymentMethodDomain/index.ts b/src/api/resources/paymentMethodDomain/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/paymentMethodDomain/index.ts +++ b/src/api/resources/paymentMethodDomain/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/paymentMethodDomain/types/DeletePaymentMethodDomainResponse.ts b/src/api/resources/paymentMethodDomain/types/DeletePaymentMethodDomainResponse.ts index f5901d9a..f5b186f1 100644 --- a/src/api/resources/paymentMethodDomain/types/DeletePaymentMethodDomainResponse.ts +++ b/src/api/resources/paymentMethodDomain/types/DeletePaymentMethodDomainResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface DeletePaymentMethodDomainResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paymentMethodDomain/types/ListPaymentMethodDomainsResponse.ts b/src/api/resources/paymentMethodDomain/types/ListPaymentMethodDomainsResponse.ts index b02ac109..4d44986f 100644 --- a/src/api/resources/paymentMethodDomain/types/ListPaymentMethodDomainsResponse.ts +++ b/src/api/resources/paymentMethodDomain/types/ListPaymentMethodDomainsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ListPaymentMethodDomainsResponse { records: Payabli.PaymentMethodDomainApiResponse[]; diff --git a/src/api/resources/paypoint/client/Client.ts b/src/api/resources/paypoint/client/Client.ts index ef40b160..d7634015 100644 --- a/src/api/resources/paypoint/client/Client.ts +++ b/src/api/resources/paypoint/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Paypoint { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace PaypointClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Paypoint { - protected readonly _options: Paypoint.Options; +export class PaypointClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Paypoint.Options = {}) { - this._options = _options; + constructor(options: PaypointClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Gets the basic details for a paypoint. * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -53,31 +38,36 @@ export class Paypoint { */ public getBasicEntry( entry: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getBasicEntry(entry, requestOptions)); } private async __getBasicEntry( entry: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/basic/${encodeURIComponent(entry)}`, + `Paypoint/basic/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetBasicEntryResponse, rawResponse: _response.rawResponse }; @@ -105,28 +95,14 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Paypoint/basic/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Paypoint/basic/{entry}"); } /** * Retrieves the basic details for a paypoint by ID. * - * @param {string} idPaypoint - Paypoint ID. You can find this value by querying `/api/Query/paypoints/{orgId}` - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {string} IdPaypoint - Paypoint ID. You can find this value by querying `/api/Query/paypoints/{orgId}` + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -137,32 +113,37 @@ export class Paypoint { * await client.paypoint.getBasicEntryById("198") */ public getBasicEntryById( - idPaypoint: string, - requestOptions?: Paypoint.RequestOptions, + IdPaypoint: string, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__getBasicEntryById(idPaypoint, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__getBasicEntryById(IdPaypoint, requestOptions)); } private async __getBasicEntryById( - idPaypoint: string, - requestOptions?: Paypoint.RequestOptions, + IdPaypoint: string, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/basicById/${encodeURIComponent(idPaypoint)}`, + `Paypoint/basicById/${core.url.encodePathParam(IdPaypoint)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetBasicEntryByIdResponse, rawResponse: _response.rawResponse }; @@ -190,23 +171,12 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Paypoint/basicById/{IdPaypoint}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Paypoint/basicById/{IdPaypoint}", + ); } /** @@ -214,7 +184,7 @@ export class Paypoint { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.GetEntryConfigRequest} request - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -227,7 +197,7 @@ export class Paypoint { public getEntryConfig( entry: string, request: Payabli.GetEntryConfigRequest = {}, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getEntryConfig(entry, request, requestOptions)); } @@ -235,31 +205,35 @@ export class Paypoint { private async __getEntryConfig( entry: string, request: Payabli.GetEntryConfigRequest = {}, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { const { entrypages } = request; const _queryParams: Record = {}; if (entrypages != null) { - _queryParams["entrypages"] = entrypages; + _queryParams.entrypages = entrypages; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/${encodeURIComponent(entry)}`, + `Paypoint/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetEntryConfigResponse, rawResponse: _response.rawResponse }; @@ -287,21 +261,7 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Paypoint/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Paypoint/{entry}"); } /** @@ -309,7 +269,7 @@ export class Paypoint { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} subdomain - Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -322,7 +282,7 @@ export class Paypoint { public getPage( entry: string, subdomain: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getPage(entry, subdomain, requestOptions)); } @@ -330,24 +290,29 @@ export class Paypoint { private async __getPage( entry: string, subdomain: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/${encodeURIComponent(entry)}/${encodeURIComponent(subdomain)}`, + `Paypoint/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(subdomain)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliPages, rawResponse: _response.rawResponse }; @@ -375,23 +340,7 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Paypoint/{entry}/{subdomain}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Paypoint/{entry}/{subdomain}"); } /** @@ -399,7 +348,7 @@ export class Paypoint { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {string} subdomain - Payment page identifier. The subdomain value is the last portion of the payment page URL. For example, in`https://paypages-sandbox.payabli.com/513823dc10/pay-your-fees-1`, the subdomain is `pay-your-fees-1`. - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -412,7 +361,7 @@ export class Paypoint { public removePage( entry: string, subdomain: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__removePage(entry, subdomain, requestOptions)); } @@ -420,24 +369,29 @@ export class Paypoint { private async __removePage( entry: string, subdomain: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/${encodeURIComponent(entry)}/${encodeURIComponent(subdomain)}`, + `Paypoint/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(subdomain)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -468,23 +422,12 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling DELETE /Paypoint/{entry}/{subdomain}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "DELETE", + "/Paypoint/{entry}/{subdomain}", + ); } /** @@ -492,7 +435,7 @@ export class Paypoint { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.FileContent} request - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -505,7 +448,7 @@ export class Paypoint { public saveLogo( entry: string, request: Payabli.FileContent, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__saveLogo(entry, request, requestOptions)); } @@ -513,27 +456,32 @@ export class Paypoint { private async __saveLogo( entry: string, request: Payabli.FileContent, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/logo/${encodeURIComponent(entry)}`, + `Paypoint/logo/${core.url.encodePathParam(entry)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -564,28 +512,14 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Paypoint/logo/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Paypoint/logo/{entry}"); } /** * Retrieves an paypoint's basic settings like custom fields, identifiers, and invoicing settings. * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -597,31 +531,36 @@ export class Paypoint { */ public settingsPage( entry: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__settingsPage(entry, requestOptions)); } private async __settingsPage( entry: string, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Paypoint/settings/${encodeURIComponent(entry)}`, + `Paypoint/settings/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.SettingsQueryRecord, rawResponse: _response.rawResponse }; @@ -649,28 +588,14 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Paypoint/settings/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Paypoint/settings/{entry}"); } /** * Migrates a paypoint to a new parent organization. * * @param {Payabli.PaypointMoveRequest} request - * @param {Paypoint.RequestOptions} requestOptions - Request-specific configuration. + * @param {PaypointClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -692,15 +617,21 @@ export class Paypoint { */ public migrate( request: Payabli.PaypointMoveRequest, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__migrate(request, requestOptions)); } private async __migrate( request: Payabli.PaypointMoveRequest, - requestOptions?: Paypoint.RequestOptions, + requestOptions?: PaypointClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -709,17 +640,16 @@ export class Paypoint { "Paypoint/migrate", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.MigratePaypointResponse, rawResponse: _response.rawResponse }; @@ -747,25 +677,6 @@ export class Paypoint { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Paypoint/migrate."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Paypoint/migrate"); } } diff --git a/src/api/resources/paypoint/client/index.ts b/src/api/resources/paypoint/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/paypoint/client/index.ts +++ b/src/api/resources/paypoint/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/paypoint/client/requests/GetEntryConfigRequest.ts b/src/api/resources/paypoint/client/requests/GetEntryConfigRequest.ts index 3da62bf7..61da7bcb 100644 --- a/src/api/resources/paypoint/client/requests/GetEntryConfigRequest.ts +++ b/src/api/resources/paypoint/client/requests/GetEntryConfigRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example diff --git a/src/api/resources/paypoint/client/requests/index.ts b/src/api/resources/paypoint/client/requests/index.ts index 1770beb9..4591647d 100644 --- a/src/api/resources/paypoint/client/requests/index.ts +++ b/src/api/resources/paypoint/client/requests/index.ts @@ -1 +1 @@ -export { type GetEntryConfigRequest } from "./GetEntryConfigRequest.js"; +export type { GetEntryConfigRequest } from "./GetEntryConfigRequest.js"; diff --git a/src/api/resources/paypoint/index.ts b/src/api/resources/paypoint/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/paypoint/index.ts +++ b/src/api/resources/paypoint/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/paypoint/types/GetBasicEntryByIdResponse.ts b/src/api/resources/paypoint/types/GetBasicEntryByIdResponse.ts index 4c7d926d..4d6ddfd3 100644 --- a/src/api/resources/paypoint/types/GetBasicEntryByIdResponse.ts +++ b/src/api/resources/paypoint/types/GetBasicEntryByIdResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetBasicEntryByIdResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paypoint/types/GetBasicEntryResponse.ts b/src/api/resources/paypoint/types/GetBasicEntryResponse.ts index 3847c555..eebddfb3 100644 --- a/src/api/resources/paypoint/types/GetBasicEntryResponse.ts +++ b/src/api/resources/paypoint/types/GetBasicEntryResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetBasicEntryResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paypoint/types/GetEntryConfigResponse.ts b/src/api/resources/paypoint/types/GetEntryConfigResponse.ts index e0964f20..8019e213 100644 --- a/src/api/resources/paypoint/types/GetEntryConfigResponse.ts +++ b/src/api/resources/paypoint/types/GetEntryConfigResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetEntryConfigResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paypoint/types/MigratePaypointResponse.ts b/src/api/resources/paypoint/types/MigratePaypointResponse.ts index 0885273d..903275de 100644 --- a/src/api/resources/paypoint/types/MigratePaypointResponse.ts +++ b/src/api/resources/paypoint/types/MigratePaypointResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface MigratePaypointResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/resources/paypoint/types/NotificationRequest.ts b/src/api/resources/paypoint/types/NotificationRequest.ts index eee0ce2c..a61f0592 100644 --- a/src/api/resources/paypoint/types/NotificationRequest.ts +++ b/src/api/resources/paypoint/types/NotificationRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface NotificationRequest { /** Complete HTTP URL receiving the notification */ diff --git a/src/api/resources/paypoint/types/PaypointMoveRequest.ts b/src/api/resources/paypoint/types/PaypointMoveRequest.ts index 521920f1..ec48670e 100644 --- a/src/api/resources/paypoint/types/PaypointMoveRequest.ts +++ b/src/api/resources/paypoint/types/PaypointMoveRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface PaypointMoveRequest { entryPoint: Payabli.Entrypointfield; diff --git a/src/api/resources/paypoint/types/WebHeaderParameter.ts b/src/api/resources/paypoint/types/WebHeaderParameter.ts index f0fce477..2f0dbca1 100644 --- a/src/api/resources/paypoint/types/WebHeaderParameter.ts +++ b/src/api/resources/paypoint/types/WebHeaderParameter.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface WebHeaderParameter { key: string; diff --git a/src/api/resources/paypoint/types/index.ts b/src/api/resources/paypoint/types/index.ts index d0be722a..651ab1e0 100644 --- a/src/api/resources/paypoint/types/index.ts +++ b/src/api/resources/paypoint/types/index.ts @@ -1,7 +1,7 @@ export * from "./GetBasicEntryByIdResponse.js"; export * from "./GetBasicEntryResponse.js"; export * from "./GetEntryConfigResponse.js"; -export * from "./PaypointMoveRequest.js"; +export * from "./MigratePaypointResponse.js"; export * from "./NotificationRequest.js"; +export * from "./PaypointMoveRequest.js"; export * from "./WebHeaderParameter.js"; -export * from "./MigratePaypointResponse.js"; diff --git a/src/api/resources/query/client/Client.ts b/src/api/resources/query/client/Client.ts index 8f5924d3..ebd7cfe1 100644 --- a/src/api/resources/query/client/Client.ts +++ b/src/api/resources/query/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; import { toJson } from "../../../../core/json.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Query { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } - - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } +export declare namespace QueryClient { + export interface Options extends BaseClientOptions {} + + export interface RequestOptions extends BaseRequestOptions {} } -export class Query { - protected readonly _options: Query.Options; +export class QueryClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Query.Options = {}) { - this._options = _options; + constructor(options: QueryClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -44,7 +29,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListBatchDetailsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -61,7 +46,7 @@ export class Query { public listBatchDetails( entry: Payabli.Entry, request: Payabli.ListBatchDetailsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatchDetails(entry, request, requestOptions)); } @@ -69,47 +54,51 @@ export class Query { private async __listBatchDetails( entry: Payabli.Entry, request: Payabli.ListBatchDetailsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batchDetails/${encodeURIComponent(entry)}`, + `Query/batchDetails/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBatchesDetailResponse, rawResponse: _response.rawResponse }; @@ -137,21 +126,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchDetails/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchDetails/{entry}"); } /** @@ -159,7 +134,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListBatchDetailsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -176,7 +151,7 @@ export class Query { public listBatchDetailsOrg( orgId: number, request: Payabli.ListBatchDetailsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatchDetailsOrg(orgId, request, requestOptions)); } @@ -184,47 +159,51 @@ export class Query { private async __listBatchDetailsOrg( orgId: number, request: Payabli.ListBatchDetailsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batchDetails/org/${encodeURIComponent(orgId)}`, + `Query/batchDetails/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseSettlements, rawResponse: _response.rawResponse }; @@ -252,23 +231,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/batchDetails/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/batchDetails/org/{orgId}", + ); } /** @@ -276,7 +244,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListBatchesRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -293,7 +261,7 @@ export class Query { public listBatches( entry: Payabli.Entry, request: Payabli.ListBatchesRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatches(entry, request, requestOptions)); } @@ -301,47 +269,51 @@ export class Query { private async __listBatches( entry: Payabli.Entry, request: Payabli.ListBatchesRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batches/${encodeURIComponent(entry)}`, + `Query/batches/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBatchesResponse, rawResponse: _response.rawResponse }; @@ -369,21 +341,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batches/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batches/{entry}"); } /** @@ -391,7 +349,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListBatchesOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -408,7 +366,7 @@ export class Query { public listBatchesOrg( orgId: number, request: Payabli.ListBatchesOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatchesOrg(orgId, request, requestOptions)); } @@ -416,47 +374,51 @@ export class Query { private async __listBatchesOrg( orgId: number, request: Payabli.ListBatchesOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batches/org/${encodeURIComponent(orgId)}`, + `Query/batches/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBatchesResponse, rawResponse: _response.rawResponse }; @@ -484,21 +446,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batches/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batches/org/{orgId}"); } /** @@ -506,7 +454,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListBatchesOutRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -523,7 +471,7 @@ export class Query { public listBatchesOut( entry: Payabli.Entry, request: Payabli.ListBatchesOutRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatchesOut(entry, request, requestOptions)); } @@ -531,47 +479,51 @@ export class Query { private async __listBatchesOut( entry: Payabli.Entry, request: Payabli.ListBatchesOutRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batchesOut/${encodeURIComponent(entry)}`, + `Query/batchesOut/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBatchesOutResponse, rawResponse: _response.rawResponse }; @@ -599,21 +551,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/batchesOut/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchesOut/{entry}"); } /** @@ -621,7 +559,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListBatchesOutOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -638,7 +576,7 @@ export class Query { public listBatchesOutOrg( orgId: number, request: Payabli.ListBatchesOutOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listBatchesOutOrg(orgId, request, requestOptions)); } @@ -646,47 +584,51 @@ export class Query { private async __listBatchesOutOrg( orgId: number, request: Payabli.ListBatchesOutOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/batchesOut/org/${encodeURIComponent(orgId)}`, + `Query/batchesOut/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryBatchesOutResponse, rawResponse: _response.rawResponse }; @@ -714,23 +656,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/batchesOut/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/batchesOut/org/{orgId}"); } /** @@ -738,7 +664,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListChargebacksRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -755,7 +681,7 @@ export class Query { public listChargebacks( entry: Payabli.Entry, request: Payabli.ListChargebacksRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listChargebacks(entry, request, requestOptions)); } @@ -763,47 +689,51 @@ export class Query { private async __listChargebacks( entry: Payabli.Entry, request: Payabli.ListChargebacksRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/chargebacks/${encodeURIComponent(entry)}`, + `Query/chargebacks/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryChargebacksResponse, rawResponse: _response.rawResponse }; @@ -831,21 +761,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/chargebacks/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/chargebacks/{entry}"); } /** @@ -853,7 +769,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListChargebacksOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -870,7 +786,7 @@ export class Query { public listChargebacksOrg( orgId: number, request: Payabli.ListChargebacksOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listChargebacksOrg(orgId, request, requestOptions)); } @@ -878,47 +794,51 @@ export class Query { private async __listChargebacksOrg( orgId: number, request: Payabli.ListChargebacksOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/chargebacks/org/${encodeURIComponent(orgId)}`, + `Query/chargebacks/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryChargebacksResponse, rawResponse: _response.rawResponse }; @@ -946,23 +866,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/chargebacks/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/chargebacks/org/{orgId}", + ); } /** @@ -970,7 +879,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListCustomersRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -987,7 +896,7 @@ export class Query { public listCustomers( entry: Payabli.Entry, request: Payabli.ListCustomersRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listCustomers(entry, request, requestOptions)); } @@ -995,47 +904,51 @@ export class Query { private async __listCustomers( entry: Payabli.Entry, request: Payabli.ListCustomersRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/customers/${encodeURIComponent(entry)}`, + `Query/customers/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryCustomerResponse, rawResponse: _response.rawResponse }; @@ -1063,21 +976,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/customers/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/customers/{entry}"); } /** @@ -1085,7 +984,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListCustomersOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1102,7 +1001,7 @@ export class Query { public listCustomersOrg( orgId: number, request: Payabli.ListCustomersOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listCustomersOrg(orgId, request, requestOptions)); } @@ -1110,47 +1009,51 @@ export class Query { private async __listCustomersOrg( orgId: number, request: Payabli.ListCustomersOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/customers/org/${encodeURIComponent(orgId)}`, + `Query/customers/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryCustomerResponse, rawResponse: _response.rawResponse }; @@ -1178,21 +1081,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/customers/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/customers/org/{orgId}"); } /** @@ -1200,7 +1089,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListNotificationReportsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1217,7 +1106,7 @@ export class Query { public listNotificationReports( entry: Payabli.Entry, request: Payabli.ListNotificationReportsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listNotificationReports(entry, request, requestOptions)); } @@ -1225,43 +1114,47 @@ export class Query { private async __listNotificationReports( entry: Payabli.Entry, request: Payabli.ListNotificationReportsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/notificationReports/${encodeURIComponent(entry)}`, + `Query/notificationReports/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1292,23 +1185,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/notificationReports/{entry}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/notificationReports/{entry}", + ); } /** @@ -1316,7 +1198,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListNotificationReportsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1333,7 +1215,7 @@ export class Query { public listNotificationReportsOrg( orgId: number, request: Payabli.ListNotificationReportsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listNotificationReportsOrg(orgId, request, requestOptions)); } @@ -1341,43 +1223,47 @@ export class Query { private async __listNotificationReportsOrg( orgId: number, request: Payabli.ListNotificationReportsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/notificationReports/org/${encodeURIComponent(orgId)}`, + `Query/notificationReports/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -1408,23 +1294,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/notificationReports/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/notificationReports/org/{orgId}", + ); } /** @@ -1432,7 +1307,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListNotificationsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1449,7 +1324,7 @@ export class Query { public listNotifications( entry: Payabli.Entry, request: Payabli.ListNotificationsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listNotifications(entry, request, requestOptions)); } @@ -1457,43 +1332,47 @@ export class Query { private async __listNotifications( entry: Payabli.Entry, request: Payabli.ListNotificationsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/notifications/${encodeURIComponent(entry)}`, + `Query/notifications/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseNotifications, rawResponse: _response.rawResponse }; @@ -1521,21 +1400,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/notifications/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/notifications/{entry}"); } /** @@ -1543,7 +1408,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListNotificationsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1560,7 +1425,7 @@ export class Query { public listNotificationsOrg( orgId: number, request: Payabli.ListNotificationsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listNotificationsOrg(orgId, request, requestOptions)); } @@ -1568,43 +1433,47 @@ export class Query { private async __listNotificationsOrg( orgId: number, request: Payabli.ListNotificationsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/notifications/org/${encodeURIComponent(orgId)}`, + `Query/notifications/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseNotifications, rawResponse: _response.rawResponse }; @@ -1632,23 +1501,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/notifications/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/notifications/org/{orgId}", + ); } /** @@ -1656,7 +1514,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListOrganizationsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1673,7 +1531,7 @@ export class Query { public listOrganizations( orgId: number, request: Payabli.ListOrganizationsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listOrganizations(orgId, request, requestOptions)); } @@ -1681,47 +1539,51 @@ export class Query { private async __listOrganizations( orgId: number, request: Payabli.ListOrganizationsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/organizations/${encodeURIComponent(orgId)}`, + `Query/organizations/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ListOrganizationsResponse, rawResponse: _response.rawResponse }; @@ -1749,21 +1611,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/organizations/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/organizations/{orgId}"); } /** @@ -1771,7 +1619,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListPayoutRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1788,7 +1636,7 @@ export class Query { public listPayout( entry: Payabli.Entry, request: Payabli.ListPayoutRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listPayout(entry, request, requestOptions)); } @@ -1796,47 +1644,51 @@ export class Query { private async __listPayout( entry: Payabli.Entry, request: Payabli.ListPayoutRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/payouts/${encodeURIComponent(entry)}`, + `Query/payouts/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryPayoutTransaction, rawResponse: _response.rawResponse }; @@ -1864,21 +1716,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/payouts/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/payouts/{entry}"); } /** @@ -1886,7 +1724,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListPayoutOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1903,7 +1741,7 @@ export class Query { public listPayoutOrg( orgId: number, request: Payabli.ListPayoutOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listPayoutOrg(orgId, request, requestOptions)); } @@ -1911,47 +1749,51 @@ export class Query { private async __listPayoutOrg( orgId: number, request: Payabli.ListPayoutOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/payouts/org/${encodeURIComponent(orgId)}`, + `Query/payouts/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryPayoutTransaction, rawResponse: _response.rawResponse }; @@ -1979,21 +1821,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/payouts/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/payouts/org/{orgId}"); } /** @@ -2001,7 +1829,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListPaypointsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2018,7 +1846,7 @@ export class Query { public listPaypoints( orgId: number, request: Payabli.ListPaypointsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listPaypoints(orgId, request, requestOptions)); } @@ -2026,47 +1854,51 @@ export class Query { private async __listPaypoints( orgId: number, request: Payabli.ListPaypointsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/paypoints/${encodeURIComponent(orgId)}`, + `Query/paypoints/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryEntrypointResponse, rawResponse: _response.rawResponse }; @@ -2094,21 +1926,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/paypoints/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/paypoints/{orgId}"); } /** @@ -2116,7 +1934,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListSettlementsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2133,7 +1951,7 @@ export class Query { public listSettlements( entry: Payabli.Entry, request: Payabli.ListSettlementsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listSettlements(entry, request, requestOptions)); } @@ -2141,47 +1959,51 @@ export class Query { private async __listSettlements( entry: Payabli.Entry, request: Payabli.ListSettlementsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/settlements/${encodeURIComponent(entry)}`, + `Query/settlements/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseSettlements, rawResponse: _response.rawResponse }; @@ -2209,21 +2031,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/settlements/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/settlements/{entry}"); } /** @@ -2231,7 +2039,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListSettlementsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2248,7 +2056,7 @@ export class Query { public listSettlementsOrg( orgId: number, request: Payabli.ListSettlementsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listSettlementsOrg(orgId, request, requestOptions)); } @@ -2256,47 +2064,51 @@ export class Query { private async __listSettlementsOrg( orgId: number, request: Payabli.ListSettlementsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/settlements/org/${encodeURIComponent(orgId)}`, + `Query/settlements/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseSettlements, rawResponse: _response.rawResponse }; @@ -2324,23 +2136,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/settlements/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/settlements/org/{orgId}", + ); } /** @@ -2348,7 +2149,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListSubscriptionsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2365,7 +2166,7 @@ export class Query { public listSubscriptions( entry: Payabli.Entry, request: Payabli.ListSubscriptionsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listSubscriptions(entry, request, requestOptions)); } @@ -2373,47 +2174,51 @@ export class Query { private async __listSubscriptions( entry: Payabli.Entry, request: Payabli.ListSubscriptionsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/subscriptions/${encodeURIComponent(entry)}`, + `Query/subscriptions/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QuerySubscriptionResponse, rawResponse: _response.rawResponse }; @@ -2441,21 +2246,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/subscriptions/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/subscriptions/{entry}"); } /** @@ -2463,7 +2254,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListSubscriptionsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2480,7 +2271,7 @@ export class Query { public listSubscriptionsOrg( orgId: number, request: Payabli.ListSubscriptionsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listSubscriptionsOrg(orgId, request, requestOptions)); } @@ -2488,47 +2279,51 @@ export class Query { private async __listSubscriptionsOrg( orgId: number, request: Payabli.ListSubscriptionsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/subscriptions/org/${encodeURIComponent(orgId)}`, + `Query/subscriptions/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QuerySubscriptionResponse, rawResponse: _response.rawResponse }; @@ -2556,23 +2351,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/subscriptions/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/subscriptions/org/{orgId}", + ); } /** @@ -2587,7 +2371,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListTransactionsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2604,7 +2388,7 @@ export class Query { public listTransactions( entry: Payabli.Entry, request: Payabli.ListTransactionsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listTransactions(entry, request, requestOptions)); } @@ -2612,47 +2396,51 @@ export class Query { private async __listTransactions( entry: Payabli.Entry, request: Payabli.ListTransactionsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/transactions/${encodeURIComponent(entry)}`, + `Query/transactions/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseTransactions, rawResponse: _response.rawResponse }; @@ -2680,21 +2468,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transactions/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transactions/{entry}"); } /** @@ -2716,7 +2490,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListTransactionsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2733,7 +2507,7 @@ export class Query { public listTransactionsOrg( orgId: number, request: Payabli.ListTransactionsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listTransactionsOrg(orgId, request, requestOptions)); } @@ -2741,47 +2515,51 @@ export class Query { private async __listTransactionsOrg( orgId: number, request: Payabli.ListTransactionsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/transactions/org/${encodeURIComponent(orgId)}`, + `Query/transactions/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseTransactions, rawResponse: _response.rawResponse }; @@ -2809,23 +2587,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/transactions/org/{orgId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/transactions/org/{orgId}", + ); } /** @@ -2834,7 +2601,7 @@ export class Query { * @param {Payabli.Entry} entry * @param {number} transferId - The numeric identifier for the transfer, assigned by Payabli. * @param {Payabli.ListTransfersPaypointRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2848,7 +2615,7 @@ export class Query { entry: Payabli.Entry, transferId: number, request: Payabli.ListTransfersPaypointRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__listTransferDetails(entry, transferId, request, requestOptions), @@ -2859,47 +2626,51 @@ export class Query { entry: Payabli.Entry, transferId: number, request: Payabli.ListTransfersPaypointRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/transferDetails/${encodeURIComponent(entry)}/${encodeURIComponent(transferId)}`, + `Query/transferDetails/${core.url.encodePathParam(entry)}/${core.url.encodePathParam(transferId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryTransferDetailResponse, rawResponse: _response.rawResponse }; @@ -2927,23 +2698,12 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Query/transferDetails/{entry}/{transferId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Query/transferDetails/{entry}/{transferId}", + ); } /** @@ -2951,7 +2711,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListTransfersRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -2967,7 +2727,7 @@ export class Query { public listTransfers( entry: Payabli.Entry, request: Payabli.ListTransfersRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listTransfers(entry, request, requestOptions)); } @@ -2975,47 +2735,46 @@ export class Query { private async __listTransfers( entry: Payabli.Entry, request: Payabli.ListTransfersRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/transfers/${encodeURIComponent(entry)}`, + `Query/transfers/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.TransferQueryResponse, rawResponse: _response.rawResponse }; @@ -3043,28 +2802,14 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transfers/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transfers/{entry}"); } /** * Retrieve a list of transfers for an org. Use filters to limit results. Include the `exportFormat` query parameter to return the results as a file instead of a JSON response. * * @param {Payabli.ListTransfersRequestOrg} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3080,54 +2825,53 @@ export class Query { */ public listTransfersOrg( request: Payabli.ListTransfersRequestOrg, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listTransfersOrg(request, requestOptions)); } private async __listTransfersOrg( request: Payabli.ListTransfersRequestOrg, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { orgId, exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _headers: core.Fetcher.Args["headers"] = mergeHeaders(this._options?.headers, requestOptions?.headers); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/transfers/org/${encodeURIComponent(orgId)}`, + `Query/transfers/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.TransferQueryResponse, rawResponse: _response.rawResponse }; @@ -3155,21 +2899,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/transfers/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/transfers/org/{orgId}"); } /** @@ -3177,7 +2907,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListUsersOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3194,7 +2924,7 @@ export class Query { public listUsersOrg( orgId: number, request: Payabli.ListUsersOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listUsersOrg(orgId, request, requestOptions)); } @@ -3202,43 +2932,47 @@ export class Query { private async __listUsersOrg( orgId: number, request: Payabli.ListUsersOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/users/org/${encodeURIComponent(orgId)}`, + `Query/users/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryUserResponse, rawResponse: _response.rawResponse }; @@ -3266,21 +3000,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/users/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/users/org/{orgId}"); } /** @@ -3288,7 +3008,7 @@ export class Query { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListUsersPaypointRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3305,7 +3025,7 @@ export class Query { public listUsersPaypoint( entry: string, request: Payabli.ListUsersPaypointRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listUsersPaypoint(entry, request, requestOptions)); } @@ -3313,43 +3033,47 @@ export class Query { private async __listUsersPaypoint( entry: string, request: Payabli.ListUsersPaypointRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/users/point/${encodeURIComponent(entry)}`, + `Query/users/point/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryUserResponse, rawResponse: _response.rawResponse }; @@ -3377,21 +3101,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/users/point/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/users/point/{entry}"); } /** @@ -3399,7 +3109,7 @@ export class Query { * * @param {string} entry - The paypoint's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) * @param {Payabli.ListVendorsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3416,7 +3126,7 @@ export class Query { public listVendors( entry: string, request: Payabli.ListVendorsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listVendors(entry, request, requestOptions)); } @@ -3424,47 +3134,51 @@ export class Query { private async __listVendors( entry: string, request: Payabli.ListVendorsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/vendors/${encodeURIComponent(entry)}`, + `Query/vendors/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseVendors, rawResponse: _response.rawResponse }; @@ -3492,21 +3206,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vendors/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vendors/{entry}"); } /** @@ -3514,7 +3214,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListVendorsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3531,7 +3231,7 @@ export class Query { public listVendorsOrg( orgId: number, request: Payabli.ListVendorsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listVendorsOrg(orgId, request, requestOptions)); } @@ -3539,47 +3239,51 @@ export class Query { private async __listVendorsOrg( orgId: number, request: Payabli.ListVendorsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/vendors/org/${encodeURIComponent(orgId)}`, + `Query/vendors/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.QueryResponseVendors, rawResponse: _response.rawResponse }; @@ -3607,21 +3311,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vendors/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vendors/org/{orgId}"); } /** @@ -3629,7 +3319,7 @@ export class Query { * * @param {Payabli.Entry} entry * @param {Payabli.ListVcardsRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3646,7 +3336,7 @@ export class Query { public listVcards( entry: Payabli.Entry, request: Payabli.ListVcardsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listVcards(entry, request, requestOptions)); } @@ -3654,47 +3344,51 @@ export class Query { private async __listVcards( entry: Payabli.Entry, request: Payabli.ListVcardsRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/vcards/${encodeURIComponent(entry)}`, + `Query/vcards/${core.url.encodePathParam(entry)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.VCardQueryResponse, rawResponse: _response.rawResponse }; @@ -3722,21 +3416,7 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vcards/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vcards/{entry}"); } /** @@ -3744,7 +3424,7 @@ export class Query { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListVcardsOrgRequest} request - * @param {Query.RequestOptions} requestOptions - Request-specific configuration. + * @param {QueryClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -3761,7 +3441,7 @@ export class Query { public listVcardsOrg( orgId: number, request: Payabli.ListVcardsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listVcardsOrg(orgId, request, requestOptions)); } @@ -3769,47 +3449,51 @@ export class Query { private async __listVcardsOrg( orgId: number, request: Payabli.ListVcardsOrgRequest = {}, - requestOptions?: Query.RequestOptions, + requestOptions?: QueryClient.RequestOptions, ): Promise> { const { exportFormat, fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (exportFormat != null) { - _queryParams["exportFormat"] = exportFormat; + _queryParams.exportFormat = exportFormat; } if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/vcards/org/${encodeURIComponent(orgId)}`, + `Query/vcards/org/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.VCardQueryResponse, rawResponse: _response.rawResponse }; @@ -3837,25 +3521,6 @@ export class Query { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/vcards/org/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/vcards/org/{orgId}"); } } diff --git a/src/api/resources/query/client/index.ts b/src/api/resources/query/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/query/client/index.ts +++ b/src/api/resources/query/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/query/client/requests/ListBatchDetailsOrgRequest.ts b/src/api/resources/query/client/requests/ListBatchDetailsOrgRequest.ts index 9ea90f5b..e1123638 100644 --- a/src/api/resources/query/client/requests/ListBatchDetailsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchDetailsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchDetailsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -100,8 +93,6 @@ export interface ListBatchDetailsOrgRequest { * Example: `settledAmount(gt)=20` returns all records with a `settledAmount` greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListBatchDetailsRequest.ts b/src/api/resources/query/client/requests/ListBatchDetailsRequest.ts index e49f02ec..2f470c2c 100644 --- a/src/api/resources/query/client/requests/ListBatchDetailsRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchDetailsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchDetailsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -101,8 +94,6 @@ export interface ListBatchDetailsRequest { * Example: `settledAmount(gt)=20` returns all records with a `settledAmount` greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListBatchesOrgRequest.ts b/src/api/resources/query/client/requests/ListBatchesOrgRequest.ts index 34874fa1..8ce3e891 100644 --- a/src/api/resources/query/client/requests/ListBatchesOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchesOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchesOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -79,8 +73,6 @@ export interface ListBatchesOrgRequest { * Example: `batchAmount(gt)=20` returns all records with a `batchAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListBatchesOutOrgRequest.ts b/src/api/resources/query/client/requests/ListBatchesOutOrgRequest.ts index cdc98cfe..6b482cbf 100644 --- a/src/api/resources/query/client/requests/ListBatchesOutOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchesOutOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchesOutOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -56,8 +49,6 @@ export interface ListBatchesOutOrgRequest { * - `externalPaypointID` (ct, nct, eq, ne) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListBatchesOutRequest.ts b/src/api/resources/query/client/requests/ListBatchesOutRequest.ts index e81d7cc9..9860286e 100644 --- a/src/api/resources/query/client/requests/ListBatchesOutRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchesOutRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchesOutRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for more information. * * **List of field names accepted**: @@ -41,8 +34,6 @@ export interface ListBatchesOutRequest { * - `externalPaypointID` (ct, nct, eq, ne) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListBatchesRequest.ts b/src/api/resources/query/client/requests/ListBatchesRequest.ts index 24d78316..8634efac 100644 --- a/src/api/resources/query/client/requests/ListBatchesRequest.ts +++ b/src/api/resources/query/client/requests/ListBatchesRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListBatchesRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -79,8 +73,6 @@ export interface ListBatchesRequest { * Example: `batchAmount(gt)=20` returns all records with a `batchAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListChargebacksOrgRequest.ts b/src/api/resources/query/client/requests/ListChargebacksOrgRequest.ts index 27970993..7db9a66f 100644 --- a/src/api/resources/query/client/requests/ListChargebacksOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListChargebacksOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListChargebacksOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -98,8 +92,6 @@ export interface ListChargebacksOrgRequest { * Example: `netAmount(gt)=20` returns all records with a `netAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListChargebacksRequest.ts b/src/api/resources/query/client/requests/ListChargebacksRequest.ts index 031cf377..67d55c86 100644 --- a/src/api/resources/query/client/requests/ListChargebacksRequest.ts +++ b/src/api/resources/query/client/requests/ListChargebacksRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListChargebacksRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -96,8 +90,6 @@ export interface ListChargebacksRequest { * Example: `netAmount(gt)=20` returns all records with a `netAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListCustomersOrgRequest.ts b/src/api/resources/query/client/requests/ListCustomersOrgRequest.ts index f85d4810..0aa990f0 100644 --- a/src/api/resources/query/client/requests/ListCustomersOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListCustomersOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListCustomersOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -90,8 +84,6 @@ export interface ListCustomersOrgRequest { * `balance(gt)=20` will return all records with a balance greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListCustomersRequest.ts b/src/api/resources/query/client/requests/ListCustomersRequest.ts index 0d31124d..dc4dd343 100644 --- a/src/api/resources/query/client/requests/ListCustomersRequest.ts +++ b/src/api/resources/query/client/requests/ListCustomersRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListCustomersRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -90,8 +84,6 @@ export interface ListCustomersRequest { * `balance(gt)=20` will return all records with a balance greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListNotificationReportsOrgRequest.ts b/src/api/resources/query/client/requests/ListNotificationReportsOrgRequest.ts index 7b77cb25..74d63739 100644 --- a/src/api/resources/query/client/requests/ListNotificationReportsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListNotificationReportsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListNotificationReportsOrgRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -58,8 +52,6 @@ export interface ListNotificationReportsOrgRequest { * Example: reportName(ct)=tr return all records containing the string "tr" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListNotificationReportsRequest.ts b/src/api/resources/query/client/requests/ListNotificationReportsRequest.ts index 5eb7cfe3..c4a3c26d 100644 --- a/src/api/resources/query/client/requests/ListNotificationReportsRequest.ts +++ b/src/api/resources/query/client/requests/ListNotificationReportsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListNotificationReportsRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -60,8 +54,6 @@ export interface ListNotificationReportsRequest { * Example: reportName(ct)=tr return all records containing the string "tr" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListNotificationsOrgRequest.ts b/src/api/resources/query/client/requests/ListNotificationsOrgRequest.ts index 1621eb16..e66864ae 100644 --- a/src/api/resources/query/client/requests/ListNotificationsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListNotificationsOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListNotificationsOrgRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -62,8 +56,6 @@ export interface ListNotificationsOrgRequest { * Example: totalAmount(gt)=20 return all records with totalAmount greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListNotificationsRequest.ts b/src/api/resources/query/client/requests/ListNotificationsRequest.ts index c1dd3985..f72dfd69 100644 --- a/src/api/resources/query/client/requests/ListNotificationsRequest.ts +++ b/src/api/resources/query/client/requests/ListNotificationsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListNotificationsRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -62,8 +56,6 @@ export interface ListNotificationsRequest { * Example: totalAmount(gt)=20 return all records with totalAmount greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListOrganizationsRequest.ts b/src/api/resources/query/client/requests/ListOrganizationsRequest.ts index ff0a7ec9..5d66e2f1 100644 --- a/src/api/resources/query/client/requests/ListOrganizationsRequest.ts +++ b/src/api/resources/query/client/requests/ListOrganizationsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListOrganizationsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -77,8 +71,6 @@ export interface ListOrganizationsRequest { * Example: `dbaname(ct)=hoa` returns all records with a `dbaname` containing "hoa" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListPayoutOrgRequest.ts b/src/api/resources/query/client/requests/ListPayoutOrgRequest.ts index cd875516..d37e25de 100644 --- a/src/api/resources/query/client/requests/ListPayoutOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListPayoutOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListPayoutOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -103,8 +97,6 @@ export interface ListPayoutOrgRequest { * Example: `sortBy=desc(netamount)` returns all records sorted by `netAmount` descending */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListPayoutRequest.ts b/src/api/resources/query/client/requests/ListPayoutRequest.ts index 41bff02c..11a253b1 100644 --- a/src/api/resources/query/client/requests/ListPayoutRequest.ts +++ b/src/api/resources/query/client/requests/ListPayoutRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListPayoutRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -104,8 +98,6 @@ export interface ListPayoutRequest { * Example: `sortBy=desc(netamount)` returns all records sorted by `netAmount` descending */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListPaypointsRequest.ts b/src/api/resources/query/client/requests/ListPaypointsRequest.ts index fc3d5ebb..e4bc47f8 100644 --- a/src/api/resources/query/client/requests/ListPaypointsRequest.ts +++ b/src/api/resources/query/client/requests/ListPaypointsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListPaypointsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -82,8 +76,6 @@ export interface ListPaypointsRequest { * Example: `dbaname(ct)=hoa` returns all records with a `dbaname` containing "hoa" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListSettlementsOrgRequest.ts b/src/api/resources/query/client/requests/ListSettlementsOrgRequest.ts index c1da82c4..5bd8e3e8 100644 --- a/src/api/resources/query/client/requests/ListSettlementsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListSettlementsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListSettlementsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -101,8 +94,6 @@ export interface ListSettlementsOrgRequest { * Example: `settledAmount(gt)=20` returns all records with a `settledAmount` greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListSettlementsRequest.ts b/src/api/resources/query/client/requests/ListSettlementsRequest.ts index 6a83e0bc..eee61083 100644 --- a/src/api/resources/query/client/requests/ListSettlementsRequest.ts +++ b/src/api/resources/query/client/requests/ListSettlementsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListSettlementsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -101,8 +94,6 @@ export interface ListSettlementsRequest { * Example: `settledAmount(gt)=20` returns all records with a `settledAmount` greater than 20.00. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListSubscriptionsOrgRequest.ts b/src/api/resources/query/client/requests/ListSubscriptionsOrgRequest.ts index 892c8b1b..fe65c457 100644 --- a/src/api/resources/query/client/requests/ListSubscriptionsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListSubscriptionsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListSubscriptionsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -101,8 +94,6 @@ export interface ListSubscriptionsOrgRequest { * - `nin` => not inside array */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListSubscriptionsRequest.ts b/src/api/resources/query/client/requests/ListSubscriptionsRequest.ts index cd0c28da..cfc4b109 100644 --- a/src/api/resources/query/client/requests/ListSubscriptionsRequest.ts +++ b/src/api/resources/query/client/requests/ListSubscriptionsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListSubscriptionsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -101,8 +94,6 @@ export interface ListSubscriptionsRequest { * - `nin` => not inside array */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListTransactionsOrgRequest.ts b/src/api/resources/query/client/requests/ListTransactionsOrgRequest.ts index 5e4d8529..08268616 100644 --- a/src/api/resources/query/client/requests/ListTransactionsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListTransactionsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListTransactionsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -109,8 +102,6 @@ export interface ListTransactionsOrgRequest { * */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListTransactionsRequest.ts b/src/api/resources/query/client/requests/ListTransactionsRequest.ts index badadb0f..6538dba5 100644 --- a/src/api/resources/query/client/requests/ListTransactionsRequest.ts +++ b/src/api/resources/query/client/requests/ListTransactionsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,16 +12,11 @@ import * as Payabli from "../../../../index.js"; */ export interface ListTransactionsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * **You must remove `parameters=` from the request before you send it, otherwise Payabli will ignore the filters.** @@ -109,8 +102,6 @@ export interface ListTransactionsRequest { * - `nin` => not inside array */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListTransfersPaypointRequest.ts b/src/api/resources/query/client/requests/ListTransfersPaypointRequest.ts index e0a5af13..2a2b37d2 100644 --- a/src/api/resources/query/client/requests/ListTransfersPaypointRequest.ts +++ b/src/api/resources/query/client/requests/ListTransfersPaypointRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -10,13 +8,10 @@ import * as Payabli from "../../../../index.js"; */ export interface ListTransfersPaypointRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; limitRecord?: Payabli.LimitRecord | undefined; /** - * * Collection of field names, conditions, and values used to filter * the query. * @@ -57,8 +52,6 @@ export interface ListTransfersPaypointRequest { * */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListTransfersRequest.ts b/src/api/resources/query/client/requests/ListTransfersRequest.ts index bd92c9ce..0ae7e02a 100644 --- a/src/api/resources/query/client/requests/ListTransfersRequest.ts +++ b/src/api/resources/query/client/requests/ListTransfersRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -13,13 +11,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListTransfersRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for more information. @@ -59,8 +53,6 @@ export interface ListTransfersRequest { * - `externalPaypointID` (ct, nct) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListTransfersRequestOrg.ts b/src/api/resources/query/client/requests/ListTransfersRequestOrg.ts index cd572661..bc4f24d2 100644 --- a/src/api/resources/query/client/requests/ListTransfersRequestOrg.ts +++ b/src/api/resources/query/client/requests/ListTransfersRequestOrg.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -15,13 +13,9 @@ import * as Payabli from "../../../../index.js"; export interface ListTransfersRequestOrg { orgId: Payabli.Orgid; exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. See [Filters and Conditions Reference](/developers/developer-guides/pay-ops-reporting-engine-overview#filters-and-conditions-reference) for more information. @@ -58,8 +52,6 @@ export interface ListTransfersRequestOrg { * - `batchCurrency` (in, nin, ne, eq) */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListUsersOrgRequest.ts b/src/api/resources/query/client/requests/ListUsersOrgRequest.ts index e014363c..4277c722 100644 --- a/src/api/resources/query/client/requests/ListUsersOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListUsersOrgRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListUsersOrgRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -64,8 +58,6 @@ export interface ListUsersOrgRequest { * Example: `name(ct)=john` return all records with name containing 'john'. */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListUsersPaypointRequest.ts b/src/api/resources/query/client/requests/ListUsersPaypointRequest.ts index 6325659a..4785c9c8 100644 --- a/src/api/resources/query/client/requests/ListUsersPaypointRequest.ts +++ b/src/api/resources/query/client/requests/ListUsersPaypointRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,13 +9,9 @@ * } */ export interface ListUsersPaypointRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -64,8 +58,6 @@ export interface ListUsersPaypointRequest { * Example: `name(ct)=john` return all records with name containing 'john' */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListVcardsOrgRequest.ts b/src/api/resources/query/client/requests/ListVcardsOrgRequest.ts index 1e935531..7267b4ef 100644 --- a/src/api/resources/query/client/requests/ListVcardsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListVcardsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListVcardsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -71,8 +65,6 @@ export interface ListVcardsOrgRequest { * - nin => not inside array separated by "|" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListVcardsRequest.ts b/src/api/resources/query/client/requests/ListVcardsRequest.ts index 76efe4da..ddc26d39 100644 --- a/src/api/resources/query/client/requests/ListVcardsRequest.ts +++ b/src/api/resources/query/client/requests/ListVcardsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListVcardsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query. @@ -71,8 +65,6 @@ export interface ListVcardsRequest { * - nin => not inside array separated by "|" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListVendorsOrgRequest.ts b/src/api/resources/query/client/requests/ListVendorsOrgRequest.ts index ef439c61..aeaf4623 100644 --- a/src/api/resources/query/client/requests/ListVendorsOrgRequest.ts +++ b/src/api/resources/query/client/requests/ListVendorsOrgRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListVendorsOrgRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -79,8 +73,6 @@ export interface ListVendorsOrgRequest { * Example: `netAmount(gt)=20` returns all records with a `netAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/ListVendorsRequest.ts b/src/api/resources/query/client/requests/ListVendorsRequest.ts index b34f0c2f..1e71e8e5 100644 --- a/src/api/resources/query/client/requests/ListVendorsRequest.ts +++ b/src/api/resources/query/client/requests/ListVendorsRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example @@ -14,13 +12,9 @@ import * as Payabli from "../../../../index.js"; */ export interface ListVendorsRequest { exportFormat?: Payabli.ExportFormat; - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** * Collection of field names, conditions, and values used to filter the query @@ -79,8 +73,6 @@ export interface ListVendorsRequest { * Example: `netAmount(gt)=20` returns all records with a `netAmount` greater than 20.00 */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/query/client/requests/index.ts b/src/api/resources/query/client/requests/index.ts index 122881fe..a1312358 100644 --- a/src/api/resources/query/client/requests/index.ts +++ b/src/api/resources/query/client/requests/index.ts @@ -1,33 +1,33 @@ -export { type ListBatchDetailsRequest } from "./ListBatchDetailsRequest.js"; -export { type ListBatchDetailsOrgRequest } from "./ListBatchDetailsOrgRequest.js"; -export { type ListBatchesRequest } from "./ListBatchesRequest.js"; -export { type ListBatchesOrgRequest } from "./ListBatchesOrgRequest.js"; -export { type ListBatchesOutRequest } from "./ListBatchesOutRequest.js"; -export { type ListBatchesOutOrgRequest } from "./ListBatchesOutOrgRequest.js"; -export { type ListChargebacksRequest } from "./ListChargebacksRequest.js"; -export { type ListChargebacksOrgRequest } from "./ListChargebacksOrgRequest.js"; -export { type ListCustomersRequest } from "./ListCustomersRequest.js"; -export { type ListCustomersOrgRequest } from "./ListCustomersOrgRequest.js"; -export { type ListNotificationReportsRequest } from "./ListNotificationReportsRequest.js"; -export { type ListNotificationReportsOrgRequest } from "./ListNotificationReportsOrgRequest.js"; -export { type ListNotificationsRequest } from "./ListNotificationsRequest.js"; -export { type ListNotificationsOrgRequest } from "./ListNotificationsOrgRequest.js"; -export { type ListOrganizationsRequest } from "./ListOrganizationsRequest.js"; -export { type ListPayoutRequest } from "./ListPayoutRequest.js"; -export { type ListPayoutOrgRequest } from "./ListPayoutOrgRequest.js"; -export { type ListPaypointsRequest } from "./ListPaypointsRequest.js"; -export { type ListSettlementsRequest } from "./ListSettlementsRequest.js"; -export { type ListSettlementsOrgRequest } from "./ListSettlementsOrgRequest.js"; -export { type ListSubscriptionsRequest } from "./ListSubscriptionsRequest.js"; -export { type ListSubscriptionsOrgRequest } from "./ListSubscriptionsOrgRequest.js"; -export { type ListTransactionsRequest } from "./ListTransactionsRequest.js"; -export { type ListTransactionsOrgRequest } from "./ListTransactionsOrgRequest.js"; -export { type ListTransfersPaypointRequest } from "./ListTransfersPaypointRequest.js"; -export { type ListTransfersRequest } from "./ListTransfersRequest.js"; -export { type ListTransfersRequestOrg } from "./ListTransfersRequestOrg.js"; -export { type ListUsersOrgRequest } from "./ListUsersOrgRequest.js"; -export { type ListUsersPaypointRequest } from "./ListUsersPaypointRequest.js"; -export { type ListVendorsRequest } from "./ListVendorsRequest.js"; -export { type ListVendorsOrgRequest } from "./ListVendorsOrgRequest.js"; -export { type ListVcardsRequest } from "./ListVcardsRequest.js"; -export { type ListVcardsOrgRequest } from "./ListVcardsOrgRequest.js"; +export type { ListBatchDetailsOrgRequest } from "./ListBatchDetailsOrgRequest.js"; +export type { ListBatchDetailsRequest } from "./ListBatchDetailsRequest.js"; +export type { ListBatchesOrgRequest } from "./ListBatchesOrgRequest.js"; +export type { ListBatchesOutOrgRequest } from "./ListBatchesOutOrgRequest.js"; +export type { ListBatchesOutRequest } from "./ListBatchesOutRequest.js"; +export type { ListBatchesRequest } from "./ListBatchesRequest.js"; +export type { ListChargebacksOrgRequest } from "./ListChargebacksOrgRequest.js"; +export type { ListChargebacksRequest } from "./ListChargebacksRequest.js"; +export type { ListCustomersOrgRequest } from "./ListCustomersOrgRequest.js"; +export type { ListCustomersRequest } from "./ListCustomersRequest.js"; +export type { ListNotificationReportsOrgRequest } from "./ListNotificationReportsOrgRequest.js"; +export type { ListNotificationReportsRequest } from "./ListNotificationReportsRequest.js"; +export type { ListNotificationsOrgRequest } from "./ListNotificationsOrgRequest.js"; +export type { ListNotificationsRequest } from "./ListNotificationsRequest.js"; +export type { ListOrganizationsRequest } from "./ListOrganizationsRequest.js"; +export type { ListPayoutOrgRequest } from "./ListPayoutOrgRequest.js"; +export type { ListPayoutRequest } from "./ListPayoutRequest.js"; +export type { ListPaypointsRequest } from "./ListPaypointsRequest.js"; +export type { ListSettlementsOrgRequest } from "./ListSettlementsOrgRequest.js"; +export type { ListSettlementsRequest } from "./ListSettlementsRequest.js"; +export type { ListSubscriptionsOrgRequest } from "./ListSubscriptionsOrgRequest.js"; +export type { ListSubscriptionsRequest } from "./ListSubscriptionsRequest.js"; +export type { ListTransactionsOrgRequest } from "./ListTransactionsOrgRequest.js"; +export type { ListTransactionsRequest } from "./ListTransactionsRequest.js"; +export type { ListTransfersPaypointRequest } from "./ListTransfersPaypointRequest.js"; +export type { ListTransfersRequest } from "./ListTransfersRequest.js"; +export type { ListTransfersRequestOrg } from "./ListTransfersRequestOrg.js"; +export type { ListUsersOrgRequest } from "./ListUsersOrgRequest.js"; +export type { ListUsersPaypointRequest } from "./ListUsersPaypointRequest.js"; +export type { ListVcardsOrgRequest } from "./ListVcardsOrgRequest.js"; +export type { ListVcardsRequest } from "./ListVcardsRequest.js"; +export type { ListVendorsOrgRequest } from "./ListVendorsOrgRequest.js"; +export type { ListVendorsRequest } from "./ListVendorsRequest.js"; diff --git a/src/api/resources/queryTypes/types/LimitRecord.ts b/src/api/resources/queryTypes/types/LimitRecord.ts index e479ef8c..46755a92 100644 --- a/src/api/resources/queryTypes/types/LimitRecord.ts +++ b/src/api/resources/queryTypes/types/LimitRecord.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Max number of records to return for the query. Use `0` or negative value to return all records. Defaults to 20. diff --git a/src/api/resources/queryTypes/types/ListOrganizationsResponse.ts b/src/api/resources/queryTypes/types/ListOrganizationsResponse.ts index 6c43211c..5d3544f1 100644 --- a/src/api/resources/queryTypes/types/ListOrganizationsResponse.ts +++ b/src/api/resources/queryTypes/types/ListOrganizationsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ListOrganizationsResponse { Records: Payabli.OrganizationQueryRecord[]; diff --git a/src/api/resources/queryTypes/types/QueryBatchesDetailResponse.ts b/src/api/resources/queryTypes/types/QueryBatchesDetailResponse.ts index f097efd4..5a85ec36 100644 --- a/src/api/resources/queryTypes/types/QueryBatchesDetailResponse.ts +++ b/src/api/resources/queryTypes/types/QueryBatchesDetailResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response body for queries about batch details. diff --git a/src/api/resources/queryTypes/types/QueryBatchesResponse.ts b/src/api/resources/queryTypes/types/QueryBatchesResponse.ts index 9a06b28f..90819c13 100644 --- a/src/api/resources/queryTypes/types/QueryBatchesResponse.ts +++ b/src/api/resources/queryTypes/types/QueryBatchesResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Response body for queries about batches. @@ -10,7 +8,6 @@ import * as Payabli from "../../../index.js"; * @example * { * Summary: { - * pageidentifier: undefined, * pageSize: 20, * totalAmount: 54049.71, * totalNetAmount: 0, @@ -24,8 +21,6 @@ import * as Payabli from "../../../index.js"; * EventsData: [{ * description: "Created", * eventTime: "2025-08-25T03:19:27.6190027-04:00", - * refData: undefined, - * extraData: undefined, * source: "api" * }], * ConnectorName: "GP", @@ -92,14 +87,11 @@ import * as Payabli from "../../../index.js"; * EventsData: [{ * description: "Created", * eventTime: "2023-04-14T21:01:03Z", - * refData: undefined, - * extraData: undefined, * source: "api" * }, { * description: "Closed", * eventTime: "2023-04-15T03:05:10Z", * refData: "batchId: 1012", - * extraData: undefined, * source: "worker" * }], * ConnectorName: "GP", diff --git a/src/api/resources/queryTypes/types/QueryBatchesTransfer.ts b/src/api/resources/queryTypes/types/QueryBatchesTransfer.ts index 10ee21b2..b86186c9 100644 --- a/src/api/resources/queryTypes/types/QueryBatchesTransfer.ts +++ b/src/api/resources/queryTypes/types/QueryBatchesTransfer.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Transfer details within a batch response. diff --git a/src/api/resources/queryTypes/types/QueryTransferDetailResponse.ts b/src/api/resources/queryTypes/types/QueryTransferDetailResponse.ts index 1f5bc14c..8e1c3519 100644 --- a/src/api/resources/queryTypes/types/QueryTransferDetailResponse.ts +++ b/src/api/resources/queryTypes/types/QueryTransferDetailResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface QueryTransferDetailResponse { /** List of transfer detail records */ diff --git a/src/api/resources/queryTypes/types/QueryTransferResponse.ts b/src/api/resources/queryTypes/types/QueryTransferResponse.ts index 32b15a0b..269bfb95 100644 --- a/src/api/resources/queryTypes/types/QueryTransferResponse.ts +++ b/src/api/resources/queryTypes/types/QueryTransferResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface QueryTransferResponse { /** Summary information about the transfers. */ diff --git a/src/api/resources/queryTypes/types/QueryTransferSummary.ts b/src/api/resources/queryTypes/types/QueryTransferSummary.ts index 00b89dc7..bc429437 100644 --- a/src/api/resources/queryTypes/types/QueryTransferSummary.ts +++ b/src/api/resources/queryTypes/types/QueryTransferSummary.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface QueryTransferSummary { /** ACH returns deducted from the batch. */ diff --git a/src/api/resources/queryTypes/types/index.ts b/src/api/resources/queryTypes/types/index.ts index 6b505612..55d7d9b7 100644 --- a/src/api/resources/queryTypes/types/index.ts +++ b/src/api/resources/queryTypes/types/index.ts @@ -1,8 +1,8 @@ export * from "./LimitRecord.js"; export * from "./ListOrganizationsResponse.js"; -export * from "./QueryTransferSummary.js"; -export * from "./QueryTransferResponse.js"; -export * from "./QueryTransferDetailResponse.js"; export * from "./QueryBatchesDetailResponse.js"; export * from "./QueryBatchesResponse.js"; export * from "./QueryBatchesTransfer.js"; +export * from "./QueryTransferDetailResponse.js"; +export * from "./QueryTransferResponse.js"; +export * from "./QueryTransferSummary.js"; diff --git a/src/api/resources/statistic/client/Client.ts b/src/api/resources/statistic/client/Client.ts index b7e40d04..9ba00d44 100644 --- a/src/api/resources/statistic/client/Client.ts +++ b/src/api/resources/statistic/client/Client.ts @@ -1,41 +1,26 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; import { toJson } from "../../../../core/json.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Statistic { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace StatisticClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Statistic { - protected readonly _options: Statistic.Options; +export class StatisticClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Statistic.Options = {}) { - this._options = _options; + constructor(options: StatisticClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -69,7 +54,7 @@ export class Statistic { * - 2 for Paypoint * @param {number} entryId - Identifier in Payabli for the entity. * @param {Payabli.BasicStatsRequest} request - * @param {Statistic.RequestOptions} requestOptions - Request-specific configuration. + * @param {StatisticClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -88,7 +73,7 @@ export class Statistic { level: number, entryId: number, request: Payabli.BasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__basicStats(mode, freq, level, entryId, request, requestOptions), @@ -101,39 +86,43 @@ export class Statistic { level: number, entryId: number, request: Payabli.BasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): Promise> { const { endDate, parameters, startDate } = request; const _queryParams: Record = {}; if (endDate != null) { - _queryParams["endDate"] = endDate; + _queryParams.endDate = endDate; } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (startDate != null) { - _queryParams["startDate"] = startDate; + _queryParams.startDate = startDate; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Statistic/basic/${encodeURIComponent(mode)}/${encodeURIComponent(freq)}/${encodeURIComponent(level)}/${encodeURIComponent(entryId)}`, + `Statistic/basic/${core.url.encodePathParam(mode)}/${core.url.encodePathParam(freq)}/${core.url.encodePathParam(level)}/${core.url.encodePathParam(entryId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -164,23 +153,12 @@ export class Statistic { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Statistic/basic/{mode}/{freq}/{level}/{entryId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Statistic/basic/{mode}/{freq}/{level}/{entryId}", + ); } /** @@ -209,7 +187,7 @@ export class Statistic { * For example, `w` groups the results by week. * @param {number} customerId - Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub. * @param {Payabli.CustomerBasicStatsRequest} request - * @param {Statistic.RequestOptions} requestOptions - Request-specific configuration. + * @param {StatisticClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -224,7 +202,7 @@ export class Statistic { freq: string, customerId: number, request: Payabli.CustomerBasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__customerBasicStats(mode, freq, customerId, request, requestOptions), @@ -236,31 +214,35 @@ export class Statistic { freq: string, customerId: number, request: Payabli.CustomerBasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): Promise> { const { parameters } = request; const _queryParams: Record = {}; if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Statistic/customerbasic/${encodeURIComponent(mode)}/${encodeURIComponent(freq)}/${encodeURIComponent(customerId)}`, + `Statistic/customerbasic/${core.url.encodePathParam(mode)}/${core.url.encodePathParam(freq)}/${core.url.encodePathParam(customerId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -291,23 +273,12 @@ export class Statistic { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Statistic/customerbasic/{mode}/{freq}/{customerId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Statistic/customerbasic/{mode}/{freq}/{customerId}", + ); } /** @@ -325,7 +296,7 @@ export class Statistic { * - 2 for Paypoint * @param {number} entryId - Identifier in Payabli for the entity. * @param {Payabli.SubStatsRequest} request - * @param {Statistic.RequestOptions} requestOptions - Request-specific configuration. + * @param {StatisticClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -340,7 +311,7 @@ export class Statistic { level: number, entryId: number, request: Payabli.SubStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__subStats(interval, level, entryId, request, requestOptions)); } @@ -350,31 +321,35 @@ export class Statistic { level: number, entryId: number, request: Payabli.SubStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): Promise> { const { parameters } = request; const _queryParams: Record = {}; if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Statistic/subscriptions/${encodeURIComponent(interval)}/${encodeURIComponent(level)}/${encodeURIComponent(entryId)}`, + `Statistic/subscriptions/${core.url.encodePathParam(interval)}/${core.url.encodePathParam(level)}/${core.url.encodePathParam(entryId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.StatBasicQueryRecord[], rawResponse: _response.rawResponse }; @@ -402,23 +377,12 @@ export class Statistic { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Statistic/subscriptions/{interval}/{level}/{entryId}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Statistic/subscriptions/{interval}/{level}/{entryId}", + ); } /** @@ -447,7 +411,7 @@ export class Statistic { * For example, `w` groups the results by week. * @param {number} idVendor - Vendor ID. * @param {Payabli.VendorBasicStatsRequest} request - * @param {Statistic.RequestOptions} requestOptions - Request-specific configuration. + * @param {StatisticClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -462,7 +426,7 @@ export class Statistic { freq: string, idVendor: number, request: Payabli.VendorBasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise( this.__vendorBasicStats(mode, freq, idVendor, request, requestOptions), @@ -474,31 +438,35 @@ export class Statistic { freq: string, idVendor: number, request: Payabli.VendorBasicStatsRequest = {}, - requestOptions?: Statistic.RequestOptions, + requestOptions?: StatisticClient.RequestOptions, ): Promise> { const { parameters } = request; const _queryParams: Record = {}; if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Statistic/vendorbasic/${encodeURIComponent(mode)}/${encodeURIComponent(freq)}/${encodeURIComponent(idVendor)}`, + `Statistic/vendorbasic/${core.url.encodePathParam(mode)}/${core.url.encodePathParam(freq)}/${core.url.encodePathParam(idVendor)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -529,27 +497,11 @@ export class Statistic { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Statistic/vendorbasic/{mode}/{freq}/{idVendor}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Statistic/vendorbasic/{mode}/{freq}/{idVendor}", + ); } } diff --git a/src/api/resources/statistic/client/index.ts b/src/api/resources/statistic/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/statistic/client/index.ts +++ b/src/api/resources/statistic/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/statistic/client/requests/BasicStatsRequest.ts b/src/api/resources/statistic/client/requests/BasicStatsRequest.ts index 0a3edb5a..7feacc21 100644 --- a/src/api/resources/statistic/client/requests/BasicStatsRequest.ts +++ b/src/api/resources/statistic/client/requests/BasicStatsRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -19,9 +17,7 @@ export interface BasicStatsRequest { * - mm/dd/YYYY */ endDate?: string; - /** - * List of parameters. - */ + /** List of parameters. */ parameters?: Record; /** * Used with `custom` mode. The start date for the range. diff --git a/src/api/resources/statistic/client/requests/CustomerBasicStatsRequest.ts b/src/api/resources/statistic/client/requests/CustomerBasicStatsRequest.ts index 0bd06661..c622d960 100644 --- a/src/api/resources/statistic/client/requests/CustomerBasicStatsRequest.ts +++ b/src/api/resources/statistic/client/requests/CustomerBasicStatsRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface CustomerBasicStatsRequest { - /** - * List of parameters. - */ + /** List of parameters. */ parameters?: Record; } diff --git a/src/api/resources/statistic/client/requests/SubStatsRequest.ts b/src/api/resources/statistic/client/requests/SubStatsRequest.ts index 5084f0b2..b6c03383 100644 --- a/src/api/resources/statistic/client/requests/SubStatsRequest.ts +++ b/src/api/resources/statistic/client/requests/SubStatsRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface SubStatsRequest { - /** - * List of parameters - */ + /** List of parameters */ parameters?: Record; } diff --git a/src/api/resources/statistic/client/requests/VendorBasicStatsRequest.ts b/src/api/resources/statistic/client/requests/VendorBasicStatsRequest.ts index 33875b82..82203d29 100644 --- a/src/api/resources/statistic/client/requests/VendorBasicStatsRequest.ts +++ b/src/api/resources/statistic/client/requests/VendorBasicStatsRequest.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example * {} */ export interface VendorBasicStatsRequest { - /** - * List of parameters - */ + /** List of parameters */ parameters?: Record; } diff --git a/src/api/resources/statistic/client/requests/index.ts b/src/api/resources/statistic/client/requests/index.ts index 3abc16e5..9a947597 100644 --- a/src/api/resources/statistic/client/requests/index.ts +++ b/src/api/resources/statistic/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type BasicStatsRequest } from "./BasicStatsRequest.js"; -export { type CustomerBasicStatsRequest } from "./CustomerBasicStatsRequest.js"; -export { type SubStatsRequest } from "./SubStatsRequest.js"; -export { type VendorBasicStatsRequest } from "./VendorBasicStatsRequest.js"; +export type { BasicStatsRequest } from "./BasicStatsRequest.js"; +export type { CustomerBasicStatsRequest } from "./CustomerBasicStatsRequest.js"; +export type { SubStatsRequest } from "./SubStatsRequest.js"; +export type { VendorBasicStatsRequest } from "./VendorBasicStatsRequest.js"; diff --git a/src/api/resources/statistic/index.ts b/src/api/resources/statistic/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/statistic/index.ts +++ b/src/api/resources/statistic/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/statistic/types/StatBasicExtendedQueryRecord.ts b/src/api/resources/statistic/types/StatBasicExtendedQueryRecord.ts index 9343fed4..2843a2b1 100644 --- a/src/api/resources/statistic/types/StatBasicExtendedQueryRecord.ts +++ b/src/api/resources/statistic/types/StatBasicExtendedQueryRecord.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StatBasicExtendedQueryRecord { /** The time window based on the mode and frequency used for the query. */ diff --git a/src/api/resources/statistic/types/StatBasicQueryRecord.ts b/src/api/resources/statistic/types/StatBasicQueryRecord.ts index 9dfa4217..5af6009c 100644 --- a/src/api/resources/statistic/types/StatBasicQueryRecord.ts +++ b/src/api/resources/statistic/types/StatBasicQueryRecord.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StatBasicQueryRecord { /** Statistical grouping identifier */ diff --git a/src/api/resources/statistic/types/StatisticsVendorQueryRecord.ts b/src/api/resources/statistic/types/StatisticsVendorQueryRecord.ts index 76b043d6..bc717e9d 100644 --- a/src/api/resources/statistic/types/StatisticsVendorQueryRecord.ts +++ b/src/api/resources/statistic/types/StatisticsVendorQueryRecord.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface StatisticsVendorQueryRecord { /** Statistical grouping identifier */ diff --git a/src/api/resources/statistic/types/SubscriptionStatsQueryRecord.ts b/src/api/resources/statistic/types/SubscriptionStatsQueryRecord.ts index a39f46ac..95cb6115 100644 --- a/src/api/resources/statistic/types/SubscriptionStatsQueryRecord.ts +++ b/src/api/resources/statistic/types/SubscriptionStatsQueryRecord.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface SubscriptionStatsQueryRecord { /** Time interval identifier */ diff --git a/src/api/resources/statistic/types/index.ts b/src/api/resources/statistic/types/index.ts index acf3beec..4afb9087 100644 --- a/src/api/resources/statistic/types/index.ts +++ b/src/api/resources/statistic/types/index.ts @@ -1,4 +1,4 @@ -export * from "./StatBasicQueryRecord.js"; export * from "./StatBasicExtendedQueryRecord.js"; -export * from "./SubscriptionStatsQueryRecord.js"; +export * from "./StatBasicQueryRecord.js"; export * from "./StatisticsVendorQueryRecord.js"; +export * from "./SubscriptionStatsQueryRecord.js"; diff --git a/src/api/resources/subscription/client/Client.ts b/src/api/resources/subscription/client/Client.ts index ab4d9f42..1aafe01f 100644 --- a/src/api/resources/subscription/client/Client.ts +++ b/src/api/resources/subscription/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Subscription { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace SubscriptionClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Subscription { - protected readonly _options: Subscription.Options; +export class SubscriptionClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Subscription.Options = {}) { - this._options = _options; + constructor(options: SubscriptionClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Retrieves a single subscription's details. * * @param {number} subId - The subscription ID. - * @param {Subscription.RequestOptions} requestOptions - Request-specific configuration. + * @param {SubscriptionClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -53,31 +38,36 @@ export class Subscription { */ public getSubscription( subId: number, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getSubscription(subId, requestOptions)); } private async __getSubscription( subId: number, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Subscription/${encodeURIComponent(subId)}`, + `Subscription/${core.url.encodePathParam(subId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.SubscriptionQueryRecords, rawResponse: _response.rawResponse }; @@ -105,28 +95,14 @@ export class Subscription { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Subscription/{subId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Subscription/{subId}"); } /** * Creates a subscription or scheduled payment to run at a specified time and frequency. * * @param {Payabli.RequestSchedule} request - * @param {Subscription.RequestOptions} requestOptions - Request-specific configuration. + * @param {SubscriptionClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -218,21 +194,28 @@ export class Subscription { */ public newSubscription( request: Payabli.RequestSchedule, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__newSubscription(request, requestOptions)); } private async __newSubscription( request: Payabli.RequestSchedule, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): Promise> { const { forceCustomerCreation, idempotencyKey, body: _body } = request; const _queryParams: Record = {}; if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -241,21 +224,16 @@ export class Subscription { "Subscription/add", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddSubscriptionResponse, rawResponse: _response.rawResponse }; @@ -283,28 +261,14 @@ export class Subscription { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Subscription/add."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Subscription/add"); } /** * Deletes a subscription, autopay, or recurring payment and prevents future charges. * * @param {number} subId - The subscription ID. - * @param {Subscription.RequestOptions} requestOptions - Request-specific configuration. + * @param {SubscriptionClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -316,31 +280,36 @@ export class Subscription { */ public removeSubscription( subId: number, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__removeSubscription(subId, requestOptions)); } private async __removeSubscription( subId: number, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Subscription/${encodeURIComponent(subId)}`, + `Subscription/${core.url.encodePathParam(subId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.RemoveSubscriptionResponse, rawResponse: _response.rawResponse }; @@ -368,21 +337,7 @@ export class Subscription { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Subscription/{subId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Subscription/{subId}"); } /** @@ -390,7 +345,7 @@ export class Subscription { * * @param {number} subId - The subscription ID. * @param {Payabli.RequestUpdateSchedule} request - * @param {Subscription.RequestOptions} requestOptions - Request-specific configuration. + * @param {SubscriptionClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -424,7 +379,7 @@ export class Subscription { public updateSubscription( subId: number, request: Payabli.RequestUpdateSchedule = {}, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateSubscription(subId, request, requestOptions)); } @@ -432,27 +387,32 @@ export class Subscription { private async __updateSubscription( subId: number, request: Payabli.RequestUpdateSchedule = {}, - requestOptions?: Subscription.RequestOptions, + requestOptions?: SubscriptionClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Subscription/${encodeURIComponent(subId)}`, + `Subscription/${core.url.encodePathParam(subId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.UpdateSubscriptionResponse, rawResponse: _response.rawResponse }; @@ -480,25 +440,6 @@ export class Subscription { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Subscription/{subId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Subscription/{subId}"); } } diff --git a/src/api/resources/subscription/client/index.ts b/src/api/resources/subscription/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/subscription/client/index.ts +++ b/src/api/resources/subscription/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/subscription/client/requests/RequestSchedule.ts b/src/api/resources/subscription/client/requests/RequestSchedule.ts index 556d227f..4d95ccee 100644 --- a/src/api/resources/subscription/client/requests/RequestSchedule.ts +++ b/src/api/resources/subscription/client/requests/RequestSchedule.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/subscription/client/requests/RequestUpdateSchedule.ts b/src/api/resources/subscription/client/requests/RequestUpdateSchedule.ts index 7f713b4d..4d7917ff 100644 --- a/src/api/resources/subscription/client/requests/RequestUpdateSchedule.ts +++ b/src/api/resources/subscription/client/requests/RequestUpdateSchedule.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/subscription/client/requests/index.ts b/src/api/resources/subscription/client/requests/index.ts index a61cd017..32a94574 100644 --- a/src/api/resources/subscription/client/requests/index.ts +++ b/src/api/resources/subscription/client/requests/index.ts @@ -1,2 +1,2 @@ -export { type RequestSchedule } from "./RequestSchedule.js"; -export { type RequestUpdateSchedule } from "./RequestUpdateSchedule.js"; +export type { RequestSchedule } from "./RequestSchedule.js"; +export type { RequestUpdateSchedule } from "./RequestUpdateSchedule.js"; diff --git a/src/api/resources/subscription/index.ts b/src/api/resources/subscription/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/subscription/index.ts +++ b/src/api/resources/subscription/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/subscription/types/AddSubscriptionResponse.ts b/src/api/resources/subscription/types/AddSubscriptionResponse.ts index f400a71a..7d372879 100644 --- a/src/api/resources/subscription/types/AddSubscriptionResponse.ts +++ b/src/api/resources/subscription/types/AddSubscriptionResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Success response diff --git a/src/api/resources/subscription/types/RemoveSubscriptionResponse.ts b/src/api/resources/subscription/types/RemoveSubscriptionResponse.ts index 8ec45120..e6970460 100644 --- a/src/api/resources/subscription/types/RemoveSubscriptionResponse.ts +++ b/src/api/resources/subscription/types/RemoveSubscriptionResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Success response diff --git a/src/api/resources/subscription/types/SetPause.ts b/src/api/resources/subscription/types/SetPause.ts index 7948a492..6018adee 100644 --- a/src/api/resources/subscription/types/SetPause.ts +++ b/src/api/resources/subscription/types/SetPause.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Flag indicating if subscription is paused. When a subscription is paused, no payments are processed until the subscription is unpaused, and the next payment date isn't calculated automatically. If you want to skip a payment instead, set the `totalAmount` to 0 in the `paymentDetails` object. diff --git a/src/api/resources/subscription/types/SubscriptionRequestBody.ts b/src/api/resources/subscription/types/SubscriptionRequestBody.ts index de7a3c01..2ac19672 100644 --- a/src/api/resources/subscription/types/SubscriptionRequestBody.ts +++ b/src/api/resources/subscription/types/SubscriptionRequestBody.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface SubscriptionRequestBody { /** Object describing the customer/payor. */ diff --git a/src/api/resources/subscription/types/UpdateSubscriptionResponse.ts b/src/api/resources/subscription/types/UpdateSubscriptionResponse.ts index c5ced11f..0e971ede 100644 --- a/src/api/resources/subscription/types/UpdateSubscriptionResponse.ts +++ b/src/api/resources/subscription/types/UpdateSubscriptionResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Success response diff --git a/src/api/resources/subscription/types/index.ts b/src/api/resources/subscription/types/index.ts index df818278..3b1c04ff 100644 --- a/src/api/resources/subscription/types/index.ts +++ b/src/api/resources/subscription/types/index.ts @@ -1,5 +1,5 @@ -export * from "./SetPause.js"; +export * from "./AddSubscriptionResponse.js"; export * from "./RemoveSubscriptionResponse.js"; -export * from "./UpdateSubscriptionResponse.js"; +export * from "./SetPause.js"; export * from "./SubscriptionRequestBody.js"; -export * from "./AddSubscriptionResponse.js"; +export * from "./UpdateSubscriptionResponse.js"; diff --git a/src/api/resources/templates/client/Client.ts b/src/api/resources/templates/client/Client.ts index 0a88b03a..65ae868d 100644 --- a/src/api/resources/templates/client/Client.ts +++ b/src/api/resources/templates/client/Client.ts @@ -1,48 +1,33 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; -import * as errors from "../../../../errors/index.js"; import { toJson } from "../../../../core/json.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; +import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Templates { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace TemplatesClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Templates { - protected readonly _options: Templates.Options; +export class TemplatesClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Templates.Options = {}) { - this._options = _options; + constructor(options: TemplatesClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Deletes a template by ID. * * @param {number} templateId - The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -54,31 +39,36 @@ export class Templates { */ public deleteTemplate( templateId: number, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteTemplate(templateId, requestOptions)); } private async __deleteTemplate( templateId: number, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Templates/${encodeURIComponent(templateId)}`, + `Templates/${core.url.encodePathParam(templateId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseTemplateId, rawResponse: _response.rawResponse }; @@ -106,21 +96,7 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Templates/{templateId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Templates/{templateId}"); } /** @@ -128,7 +104,7 @@ export class Templates { * * @param {number} templateId - The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. * @param {boolean} ignoreEmpty - Ignore read-only and empty fields Default is `false`. If `ignoreEmpty` = `false` and any field is empty, then the request returns a failure response. If `ignoreEmpty` = `true`, the request returns the boarding link name regardless of whether fields are empty. - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -141,7 +117,7 @@ export class Templates { public getlinkTemplate( templateId: number, ignoreEmpty: boolean, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getlinkTemplate(templateId, ignoreEmpty, requestOptions)); } @@ -149,24 +125,29 @@ export class Templates { private async __getlinkTemplate( templateId: number, ignoreEmpty: boolean, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Templates/getlink/${encodeURIComponent(templateId)}/${encodeURIComponent(ignoreEmpty)}`, + `Templates/getlink/${core.url.encodePathParam(templateId)}/${core.url.encodePathParam(ignoreEmpty)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.BoardingLinkApiResponse, rawResponse: _response.rawResponse }; @@ -194,30 +175,19 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling GET /Templates/getlink/{templateId}/{ignoreEmpty}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/Templates/getlink/{templateId}/{ignoreEmpty}", + ); } /** * Retrieves a boarding template's details by ID. * * @param {number} templateId - The boarding template ID. Can be found at the end of the boarding template URL in PartnerHub. Example: `https://partner-sandbox.payabli.com/myorganization/boarding/edittemplate/80`. Here, the template ID is `80`. - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -229,31 +199,36 @@ export class Templates { */ public getTemplate( templateId: number, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getTemplate(templateId, requestOptions)); } private async __getTemplate( templateId: number, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Templates/get/${encodeURIComponent(templateId)}`, + `Templates/get/${core.url.encodePathParam(templateId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.TemplateQueryRecord, rawResponse: _response.rawResponse }; @@ -281,21 +256,7 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Templates/get/{templateId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Templates/get/{templateId}"); } /** @@ -303,7 +264,7 @@ export class Templates { * * @param {number} orgId - The numeric identifier for organization, assigned by Payabli. * @param {Payabli.ListTemplatesRequest} request - * @param {Templates.RequestOptions} requestOptions - Request-specific configuration. + * @param {TemplatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -320,7 +281,7 @@ export class Templates { public listTemplates( orgId: number, request: Payabli.ListTemplatesRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listTemplates(orgId, request, requestOptions)); } @@ -328,43 +289,47 @@ export class Templates { private async __listTemplates( orgId: number, request: Payabli.ListTemplatesRequest = {}, - requestOptions?: Templates.RequestOptions, + requestOptions?: TemplatesClient.RequestOptions, ): Promise> { const { fromRecord, limitRecord, parameters, sortBy } = request; const _queryParams: Record = {}; if (fromRecord != null) { - _queryParams["fromRecord"] = fromRecord.toString(); + _queryParams.fromRecord = fromRecord.toString(); } if (limitRecord != null) { - _queryParams["limitRecord"] = limitRecord.toString(); + _queryParams.limitRecord = limitRecord.toString(); } if (parameters != null) { - _queryParams["parameters"] = toJson(parameters); + _queryParams.parameters = toJson(parameters); } if (sortBy != null) { - _queryParams["sortBy"] = sortBy; + _queryParams.sortBy = sortBy; } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Query/templates/${encodeURIComponent(orgId)}`, + `Query/templates/${core.url.encodePathParam(orgId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.TemplateQueryResponse, rawResponse: _response.rawResponse }; @@ -392,25 +357,6 @@ export class Templates { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Query/templates/{orgId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Query/templates/{orgId}"); } } diff --git a/src/api/resources/templates/client/index.ts b/src/api/resources/templates/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/templates/client/index.ts +++ b/src/api/resources/templates/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/templates/client/requests/ListTemplatesRequest.ts b/src/api/resources/templates/client/requests/ListTemplatesRequest.ts index facc7e48..ee22e561 100644 --- a/src/api/resources/templates/client/requests/ListTemplatesRequest.ts +++ b/src/api/resources/templates/client/requests/ListTemplatesRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -11,16 +9,11 @@ * } */ export interface ListTemplatesRequest { - /** - * The number of records to skip before starting to collect the result set. - */ + /** The number of records to skip before starting to collect the result set. */ fromRecord?: number; - /** - * Max number of records to return for the query. Use `0` or negative value to return all records. - */ + /** Max number of records to return for the query. Use `0` or negative value to return all records. */ limitRecord?: number; /** - * * Collection of field names, conditions, and values used to filter the query. * * @@ -66,8 +59,6 @@ export interface ListTemplatesRequest { * Example: title(ct)=hoa return all records with title containing "hoa" */ parameters?: Record; - /** - * The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. - */ + /** The field name to use for sorting results. Use `desc(field_name)` to sort descending by `field_name`, and use `asc(field_name)` to sort ascending by `field_name`. */ sortBy?: string; } diff --git a/src/api/resources/templates/client/requests/index.ts b/src/api/resources/templates/client/requests/index.ts index 35702ad0..afdbf77e 100644 --- a/src/api/resources/templates/client/requests/index.ts +++ b/src/api/resources/templates/client/requests/index.ts @@ -1 +1 @@ -export { type ListTemplatesRequest } from "./ListTemplatesRequest.js"; +export type { ListTemplatesRequest } from "./ListTemplatesRequest.js"; diff --git a/src/api/resources/tokenStorage/client/Client.ts b/src/api/resources/tokenStorage/client/Client.ts index 7880b205..ae113b09 100644 --- a/src/api/resources/tokenStorage/client/Client.ts +++ b/src/api/resources/tokenStorage/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; -import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as core from "../../../../core/index.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace TokenStorage { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace TokenStorageClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class TokenStorage { - protected readonly _options: TokenStorage.Options; +export class TokenStorageClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: TokenStorage.Options = {}) { - this._options = _options; + constructor(options: TokenStorageClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Saves a payment method for reuse. This call exchanges sensitive payment information for a token that can be used to process future transactions. The `ReferenceId` value in the response is the `storedMethodId` to use with transactions. * * @param {Payabli.AddMethodRequest} request - * @param {TokenStorage.RequestOptions} requestOptions - Request-specific configuration. + * @param {TokenStorageClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -122,14 +107,14 @@ export class TokenStorage { */ public addMethod( request: Payabli.AddMethodRequest, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addMethod(request, requestOptions)); } private async __addMethod( request: Payabli.AddMethodRequest, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): Promise> { const { achValidation, @@ -141,21 +126,28 @@ export class TokenStorage { } = request; const _queryParams: Record = {}; if (achValidation != null) { - _queryParams["achValidation"] = achValidation.toString(); + _queryParams.achValidation = achValidation.toString(); } if (createAnonymous != null) { - _queryParams["createAnonymous"] = createAnonymous.toString(); + _queryParams.createAnonymous = createAnonymous.toString(); } if (forceCustomerCreation != null) { - _queryParams["forceCustomerCreation"] = forceCustomerCreation.toString(); + _queryParams.forceCustomerCreation = forceCustomerCreation.toString(); } if (temporary != null) { - _queryParams["temporary"] = temporary.toString(); + _queryParams.temporary = temporary.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + mergeOnlyDefinedHeaders({ idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined }), + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -164,21 +156,16 @@ export class TokenStorage { "TokenStorage/add", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ - idempotencyKey: idempotencyKey != null ? idempotencyKey : undefined, - ...(await this._getCustomAuthorizationHeaders()), - }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddMethodResponse, rawResponse: _response.rawResponse }; @@ -206,21 +193,7 @@ export class TokenStorage { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /TokenStorage/add."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/TokenStorage/add"); } /** @@ -228,7 +201,7 @@ export class TokenStorage { * * @param {string} methodId - The saved payment method ID. * @param {Payabli.GetMethodRequest} request - * @param {TokenStorage.RequestOptions} requestOptions - Request-specific configuration. + * @param {TokenStorageClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -244,7 +217,7 @@ export class TokenStorage { public getMethod( methodId: string, request: Payabli.GetMethodRequest = {}, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getMethod(methodId, request, requestOptions)); } @@ -252,35 +225,39 @@ export class TokenStorage { private async __getMethod( methodId: string, request: Payabli.GetMethodRequest = {}, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): Promise> { const { cardExpirationFormat, includeTemporary } = request; const _queryParams: Record = {}; if (cardExpirationFormat != null) { - _queryParams["cardExpirationFormat"] = cardExpirationFormat.toString(); + _queryParams.cardExpirationFormat = cardExpirationFormat.toString(); } if (includeTemporary != null) { - _queryParams["includeTemporary"] = includeTemporary.toString(); + _queryParams.includeTemporary = includeTemporary.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `TokenStorage/${encodeURIComponent(methodId)}`, + `TokenStorage/${core.url.encodePathParam(methodId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.GetMethodResponse, rawResponse: _response.rawResponse }; @@ -308,28 +285,14 @@ export class TokenStorage { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /TokenStorage/{methodId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/TokenStorage/{methodId}"); } /** * Deletes a saved payment method. * * @param {string} methodId - The saved payment method ID. - * @param {TokenStorage.RequestOptions} requestOptions - Request-specific configuration. + * @param {TokenStorageClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -341,31 +304,36 @@ export class TokenStorage { */ public removeMethod( methodId: string, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__removeMethod(methodId, requestOptions)); } private async __removeMethod( methodId: string, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `TokenStorage/${encodeURIComponent(methodId)}`, + `TokenStorage/${core.url.encodePathParam(methodId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -396,21 +364,7 @@ export class TokenStorage { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /TokenStorage/{methodId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/TokenStorage/{methodId}"); } /** @@ -418,7 +372,7 @@ export class TokenStorage { * * @param {string} methodId - The saved payment method ID. * @param {Payabli.UpdateMethodRequest} request - * @param {TokenStorage.RequestOptions} requestOptions - Request-specific configuration. + * @param {TokenStorageClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -466,7 +420,7 @@ export class TokenStorage { public updateMethod( methodId: string, request: Payabli.UpdateMethodRequest, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateMethod(methodId, request, requestOptions)); } @@ -474,34 +428,38 @@ export class TokenStorage { private async __updateMethod( methodId: string, request: Payabli.UpdateMethodRequest, - requestOptions?: TokenStorage.RequestOptions, + requestOptions?: TokenStorageClient.RequestOptions, ): Promise> { const { achValidation, body: _body } = request; const _queryParams: Record = {}; if (achValidation != null) { - _queryParams["achValidation"] = achValidation.toString(); + _queryParams.achValidation = achValidation.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `TokenStorage/${encodeURIComponent(methodId)}`, + `TokenStorage/${core.url.encodePathParam(methodId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", - queryParameters: _queryParams, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, requestType: "json", body: _body, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -532,25 +490,6 @@ export class TokenStorage { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /TokenStorage/{methodId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/TokenStorage/{methodId}"); } } diff --git a/src/api/resources/tokenStorage/client/index.ts b/src/api/resources/tokenStorage/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/tokenStorage/client/index.ts +++ b/src/api/resources/tokenStorage/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/tokenStorage/client/requests/AddMethodRequest.ts b/src/api/resources/tokenStorage/client/requests/AddMethodRequest.ts index 6f7f1ef4..886f2759 100644 --- a/src/api/resources/tokenStorage/client/requests/AddMethodRequest.ts +++ b/src/api/resources/tokenStorage/client/requests/AddMethodRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/tokenStorage/client/requests/GetMethodRequest.ts b/src/api/resources/tokenStorage/client/requests/GetMethodRequest.ts index 29ed618a..67783892 100644 --- a/src/api/resources/tokenStorage/client/requests/GetMethodRequest.ts +++ b/src/api/resources/tokenStorage/client/requests/GetMethodRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -28,8 +26,6 @@ export interface GetMethodRequest { * - 2: MM/YY */ cardExpirationFormat?: number; - /** - * When `true`, the request will include temporary tokens in the search and return details for a matching temporary token. The default behavior searches only for permanent tokens. - */ + /** When `true`, the request will include temporary tokens in the search and return details for a matching temporary token. The default behavior searches only for permanent tokens. */ includeTemporary?: boolean; } diff --git a/src/api/resources/tokenStorage/client/requests/UpdateMethodRequest.ts b/src/api/resources/tokenStorage/client/requests/UpdateMethodRequest.ts index cd84af1d..88425131 100644 --- a/src/api/resources/tokenStorage/client/requests/UpdateMethodRequest.ts +++ b/src/api/resources/tokenStorage/client/requests/UpdateMethodRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/tokenStorage/client/requests/index.ts b/src/api/resources/tokenStorage/client/requests/index.ts index 38b01e13..576d18fe 100644 --- a/src/api/resources/tokenStorage/client/requests/index.ts +++ b/src/api/resources/tokenStorage/client/requests/index.ts @@ -1,3 +1,3 @@ -export { type AddMethodRequest } from "./AddMethodRequest.js"; -export { type GetMethodRequest } from "./GetMethodRequest.js"; -export { type UpdateMethodRequest } from "./UpdateMethodRequest.js"; +export type { AddMethodRequest } from "./AddMethodRequest.js"; +export type { GetMethodRequest } from "./GetMethodRequest.js"; +export type { UpdateMethodRequest } from "./UpdateMethodRequest.js"; diff --git a/src/api/resources/tokenStorage/index.ts b/src/api/resources/tokenStorage/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/tokenStorage/index.ts +++ b/src/api/resources/tokenStorage/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/tokenStorage/types/AddMethodResponse.ts b/src/api/resources/tokenStorage/types/AddMethodResponse.ts index 7d719ddf..985f5d1e 100644 --- a/src/api/resources/tokenStorage/types/AddMethodResponse.ts +++ b/src/api/resources/tokenStorage/types/AddMethodResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AddMethodResponse extends Payabli.PayabliApiResponseGeneric2Part { responseData?: AddMethodResponse.ResponseData; diff --git a/src/api/resources/tokenStorage/types/ConvertToken.ts b/src/api/resources/tokenStorage/types/ConvertToken.ts index 8b962278..5aee33d2 100644 --- a/src/api/resources/tokenStorage/types/ConvertToken.ts +++ b/src/api/resources/tokenStorage/types/ConvertToken.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Object containing the information needed to convert a temporary token to a permanent token. diff --git a/src/api/resources/tokenStorage/types/CreateAnonymous.ts b/src/api/resources/tokenStorage/types/CreateAnonymous.ts index bfcd355a..1be9ff29 100644 --- a/src/api/resources/tokenStorage/types/CreateAnonymous.ts +++ b/src/api/resources/tokenStorage/types/CreateAnonymous.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, creates a saved method with no associated customer information. The token will be associated with customer information the first time it's used to make a payment. Defaults to `false`. diff --git a/src/api/resources/tokenStorage/types/GetMethodResponse.ts b/src/api/resources/tokenStorage/types/GetMethodResponse.ts index 8ed1d149..918402cf 100644 --- a/src/api/resources/tokenStorage/types/GetMethodResponse.ts +++ b/src/api/resources/tokenStorage/types/GetMethodResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface GetMethodResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/tokenStorage/types/RequestTokenStorage.ts b/src/api/resources/tokenStorage/types/RequestTokenStorage.ts index 8adbb252..da3a8584 100644 --- a/src/api/resources/tokenStorage/types/RequestTokenStorage.ts +++ b/src/api/resources/tokenStorage/types/RequestTokenStorage.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface RequestTokenStorage { /** Object describing the Customer/Payor owner of payment method. Required for POST requests. Which fields are required depends on the paypoint's custom identifier settings. */ diff --git a/src/api/resources/tokenStorage/types/RequestTokenStoragePaymentMethod.ts b/src/api/resources/tokenStorage/types/RequestTokenStoragePaymentMethod.ts index b23bc382..b6ed5002 100644 --- a/src/api/resources/tokenStorage/types/RequestTokenStoragePaymentMethod.ts +++ b/src/api/resources/tokenStorage/types/RequestTokenStoragePaymentMethod.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; /** * Information about the payment method for the transaction. diff --git a/src/api/resources/tokenStorage/types/Temporary.ts b/src/api/resources/tokenStorage/types/Temporary.ts index 8d8ef11d..a20e759c 100644 --- a/src/api/resources/tokenStorage/types/Temporary.ts +++ b/src/api/resources/tokenStorage/types/Temporary.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Creates a temporary, one-time-use token for the payment method that expires in 12 hours. Defaults to `false`. diff --git a/src/api/resources/tokenStorage/types/TokenizeAch.ts b/src/api/resources/tokenStorage/types/TokenizeAch.ts index 292ac14a..123d7af0 100644 --- a/src/api/resources/tokenStorage/types/TokenizeAch.ts +++ b/src/api/resources/tokenStorage/types/TokenizeAch.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface TokenizeAch { /** The type of payment method to tokenize. For ACH, this is always `ach`. */ diff --git a/src/api/resources/tokenStorage/types/TokenizeCard.ts b/src/api/resources/tokenStorage/types/TokenizeCard.ts index b3cc4541..58ad73d5 100644 --- a/src/api/resources/tokenStorage/types/TokenizeCard.ts +++ b/src/api/resources/tokenStorage/types/TokenizeCard.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface TokenizeCard { /** The type of payment method to tokenize. For cards, this is always `card`. */ diff --git a/src/api/resources/tokenStorage/types/index.ts b/src/api/resources/tokenStorage/types/index.ts index 4646b391..8a8dea32 100644 --- a/src/api/resources/tokenStorage/types/index.ts +++ b/src/api/resources/tokenStorage/types/index.ts @@ -1,9 +1,9 @@ -export * from "./Temporary.js"; -export * from "./CreateAnonymous.js"; export * from "./AddMethodResponse.js"; +export * from "./ConvertToken.js"; +export * from "./CreateAnonymous.js"; export * from "./GetMethodResponse.js"; export * from "./RequestTokenStorage.js"; export * from "./RequestTokenStoragePaymentMethod.js"; -export * from "./TokenizeCard.js"; +export * from "./Temporary.js"; export * from "./TokenizeAch.js"; -export * from "./ConvertToken.js"; +export * from "./TokenizeCard.js"; diff --git a/src/api/resources/user/client/Client.ts b/src/api/resources/user/client/Client.ts index f5f283bb..3ce9e47c 100644 --- a/src/api/resources/user/client/Client.ts +++ b/src/api/resources/user/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace User { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace UserClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class User { - protected readonly _options: User.Options; +export class UserClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: User.Options = {}) { - this._options = _options; + constructor(options: UserClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Use this endpoint to add a new user to an organization. * * @param {Payabli.UserData} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -53,15 +38,21 @@ export class User { */ public addUser( request: Payabli.UserData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addUser(request, requestOptions)); } private async __addUser( request: Payabli.UserData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -70,17 +61,16 @@ export class User { "User", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AddUserResponse, rawResponse: _response.rawResponse }; @@ -108,27 +98,13 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/User"); } /** * Use this endpoint to refresh the authentication token for a user within an organization. * - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -139,14 +115,20 @@ export class User { * await client.user.authRefreshUser() */ public authRefreshUser( - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__authRefreshUser(requestOptions)); } private async __authRefreshUser( - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -155,14 +137,13 @@ export class User { "User/authrefresh", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseUserMfa, rawResponse: _response.rawResponse }; @@ -190,28 +171,14 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/authrefresh."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/User/authrefresh"); } /** * Use this endpoint to initiate a password reset for a user within an organization. * * @param {Payabli.UserAuthResetRequest} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -223,15 +190,21 @@ export class User { */ public authResetUser( request: Payabli.UserAuthResetRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__authResetUser(request, requestOptions)); } private async __authResetUser( request: Payabli.UserAuthResetRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -240,17 +213,16 @@ export class User { "User/authreset", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.AuthResetUserResponse, rawResponse: _response.rawResponse }; @@ -278,21 +250,7 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/authreset."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/User/authreset"); } /** @@ -300,7 +258,7 @@ export class User { * * @param {string} provider - Auth provider. This fields is optional and defaults to null for the built-in provider. * @param {Payabli.UserAuthRequest} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -313,7 +271,7 @@ export class User { public authUser( provider: string, request: Payabli.UserAuthRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__authUser(provider, request, requestOptions)); } @@ -321,27 +279,32 @@ export class User { private async __authUser( provider: string, request: Payabli.UserAuthRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/auth/${encodeURIComponent(provider)}`, + `User/auth/${core.url.encodePathParam(provider)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseMfaBasic, rawResponse: _response.rawResponse }; @@ -369,28 +332,14 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/auth/{provider}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/User/auth/{provider}"); } /** * Use this endpoint to change the password for a user within an organization. * * @param {Payabli.UserAuthPswResetRequest} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -402,15 +351,21 @@ export class User { */ public changePswUser( request: Payabli.UserAuthPswResetRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__changePswUser(request, requestOptions)); } private async __changePswUser( request: Payabli.UserAuthPswResetRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -419,17 +374,16 @@ export class User { "User/authpsw", ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.ChangePswUserResponse, rawResponse: _response.rawResponse }; @@ -457,28 +411,14 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/authpsw."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/User/authpsw"); } /** * Use this endpoint to delete a specific user within an organization. * * @param {number} userId - The Payabli-generated `userId` value. - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -490,31 +430,36 @@ export class User { */ public deleteUser( userId: number, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteUser(userId, requestOptions)); } private async __deleteUser( userId: number, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/${encodeURIComponent(userId)}`, + `User/${core.url.encodePathParam(userId)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.DeleteUserResponse, rawResponse: _response.rawResponse }; @@ -542,21 +487,7 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /User/{userId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/User/{userId}"); } /** @@ -564,7 +495,7 @@ export class User { * * @param {number} userId - User Identifier * @param {Payabli.MfaData} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -577,7 +508,7 @@ export class User { public editMfaUser( userId: number, request: Payabli.MfaData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editMfaUser(userId, request, requestOptions)); } @@ -585,27 +516,32 @@ export class User { private async __editMfaUser( userId: number, request: Payabli.MfaData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/mfa/${encodeURIComponent(userId)}`, + `User/mfa/${core.url.encodePathParam(userId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.EditMfaUserResponse, rawResponse: _response.rawResponse }; @@ -633,21 +569,7 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/mfa/{userId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/User/mfa/{userId}"); } /** @@ -655,7 +577,7 @@ export class User { * * @param {number} userId - User Identifier * @param {Payabli.UserData} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -668,7 +590,7 @@ export class User { public editUser( userId: number, request: Payabli.UserData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editUser(userId, request, requestOptions)); } @@ -676,27 +598,32 @@ export class User { private async __editUser( userId: number, request: Payabli.UserData, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/${encodeURIComponent(userId)}`, + `User/${core.url.encodePathParam(userId)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponse, rawResponse: _response.rawResponse }; @@ -724,21 +651,7 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /User/{userId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/User/{userId}"); } /** @@ -746,7 +659,7 @@ export class User { * * @param {number} userId - The Payabli-generated `userId` value. * @param {Payabli.GetUserRequest} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -761,7 +674,7 @@ export class User { public getUser( userId: number, request: Payabli.GetUserRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getUser(userId, request, requestOptions)); } @@ -769,35 +682,39 @@ export class User { private async __getUser( userId: number, request: Payabli.GetUserRequest = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { const { entry, level } = request; const _queryParams: Record = {}; if (entry != null) { - _queryParams["entry"] = entry; + _queryParams.entry = entry; } if (level != null) { - _queryParams["level"] = level.toString(); + _queryParams.level = level.toString(); } + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/${encodeURIComponent(userId)}`, + `User/${core.url.encodePathParam(userId)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - queryParameters: _queryParams, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.UserQueryRecord, rawResponse: _response.rawResponse }; @@ -825,27 +742,13 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /User/{userId}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/User/{userId}"); } /** * Use this endpoint to log a user out from the system. * - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -855,13 +758,21 @@ export class User { * @example * await client.user.logoutUser() */ - public logoutUser(requestOptions?: User.RequestOptions): core.HttpResponsePromise { + public logoutUser( + requestOptions?: UserClient.RequestOptions, + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__logoutUser(requestOptions)); } private async __logoutUser( - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -870,14 +781,13 @@ export class User { "User/authlogout", ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.LogoutUserResponse, rawResponse: _response.rawResponse }; @@ -905,30 +815,16 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /User/authlogout."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/User/authlogout"); } /** * Resends the MFA code to the user via the selected MFA mode (email or SMS). * * @param {string} usrname - - * @param {string} entry - - * @param {number} entryType - - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {string} Entry - + * @param {number} EntryType - + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -940,35 +836,40 @@ export class User { */ public resendMfaCode( usrname: string, - entry: string, - entryType: number, - requestOptions?: User.RequestOptions, + Entry: string, + EntryType: number, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__resendMfaCode(usrname, entry, entryType, requestOptions)); + return core.HttpResponsePromise.fromPromise(this.__resendMfaCode(usrname, Entry, EntryType, requestOptions)); } private async __resendMfaCode( usrname: string, - entry: string, - entryType: number, - requestOptions?: User.RequestOptions, + Entry: string, + EntryType: number, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `User/resendmfa/${encodeURIComponent(usrname)}/${encodeURIComponent(entry)}/${encodeURIComponent(entryType)}`, + `User/resendmfa/${core.url.encodePathParam(usrname)}/${core.url.encodePathParam(Entry)}/${core.url.encodePathParam(EntryType)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseMfaBasic, rawResponse: _response.rawResponse }; @@ -996,30 +897,19 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /User/resendmfa/{usrname}/{Entry}/{EntryType}.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/User/resendmfa/{usrname}/{Entry}/{EntryType}", + ); } /** * Use this endpoint to validate the multi-factor authentication (MFA) code for a user within an organization. * * @param {Payabli.MfaValidationData} request - * @param {User.RequestOptions} requestOptions - Request-specific configuration. + * @param {UserClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -1031,15 +921,21 @@ export class User { */ public validateMfaUser( request: Payabli.MfaValidationData = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__validateMfaUser(request, requestOptions)); } private async __validateMfaUser( request: Payabli.MfaValidationData = {}, - requestOptions?: User.RequestOptions, + requestOptions?: UserClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -1048,17 +944,16 @@ export class User { "User/mfa", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseUserMfa, rawResponse: _response.rawResponse }; @@ -1086,25 +981,6 @@ export class User { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /User/mfa."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/User/mfa"); } } diff --git a/src/api/resources/user/client/index.ts b/src/api/resources/user/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/user/client/index.ts +++ b/src/api/resources/user/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/user/client/requests/GetUserRequest.ts b/src/api/resources/user/client/requests/GetUserRequest.ts index 184e1d1c..ab1c1b1d 100644 --- a/src/api/resources/user/client/requests/GetUserRequest.ts +++ b/src/api/resources/user/client/requests/GetUserRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example @@ -9,12 +7,8 @@ * } */ export interface GetUserRequest { - /** - * The entrypoint identifier. - */ + /** The entrypoint identifier. */ entry?: string; - /** - * Entry level: 0 - partner, 2 - paypoint - */ + /** Entry level: 0 - partner, 2 - paypoint */ level?: number; } diff --git a/src/api/resources/user/client/requests/MfaValidationData.ts b/src/api/resources/user/client/requests/MfaValidationData.ts index 454e3aac..d3d791d4 100644 --- a/src/api/resources/user/client/requests/MfaValidationData.ts +++ b/src/api/resources/user/client/requests/MfaValidationData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/user/client/requests/UserAuthPswResetRequest.ts b/src/api/resources/user/client/requests/UserAuthPswResetRequest.ts index ff7e1ef7..b8aaa4a8 100644 --- a/src/api/resources/user/client/requests/UserAuthPswResetRequest.ts +++ b/src/api/resources/user/client/requests/UserAuthPswResetRequest.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example diff --git a/src/api/resources/user/client/requests/UserAuthRequest.ts b/src/api/resources/user/client/requests/UserAuthRequest.ts index b5a6127e..8138c5b2 100644 --- a/src/api/resources/user/client/requests/UserAuthRequest.ts +++ b/src/api/resources/user/client/requests/UserAuthRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/user/client/requests/UserAuthResetRequest.ts b/src/api/resources/user/client/requests/UserAuthResetRequest.ts index d670eb1a..6167b51d 100644 --- a/src/api/resources/user/client/requests/UserAuthResetRequest.ts +++ b/src/api/resources/user/client/requests/UserAuthResetRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/user/client/requests/index.ts b/src/api/resources/user/client/requests/index.ts index 51097d5b..cba594ec 100644 --- a/src/api/resources/user/client/requests/index.ts +++ b/src/api/resources/user/client/requests/index.ts @@ -1,5 +1,5 @@ -export { type UserAuthResetRequest } from "./UserAuthResetRequest.js"; -export { type UserAuthRequest } from "./UserAuthRequest.js"; -export { type UserAuthPswResetRequest } from "./UserAuthPswResetRequest.js"; -export { type GetUserRequest } from "./GetUserRequest.js"; -export { type MfaValidationData } from "./MfaValidationData.js"; +export type { GetUserRequest } from "./GetUserRequest.js"; +export type { MfaValidationData } from "./MfaValidationData.js"; +export type { UserAuthPswResetRequest } from "./UserAuthPswResetRequest.js"; +export type { UserAuthRequest } from "./UserAuthRequest.js"; +export type { UserAuthResetRequest } from "./UserAuthResetRequest.js"; diff --git a/src/api/resources/user/index.ts b/src/api/resources/user/index.ts index f095e147..d9adb1af 100644 --- a/src/api/resources/user/index.ts +++ b/src/api/resources/user/index.ts @@ -1,2 +1,2 @@ -export * from "./types/index.js"; export * from "./client/index.js"; +export * from "./types/index.js"; diff --git a/src/api/resources/user/types/AddUserResponse.ts b/src/api/resources/user/types/AddUserResponse.ts index dd4d7c1e..edad5309 100644 --- a/src/api/resources/user/types/AddUserResponse.ts +++ b/src/api/resources/user/types/AddUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AddUserResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/user/types/AuthResetUserResponse.ts b/src/api/resources/user/types/AuthResetUserResponse.ts index d63189fd..a0307396 100644 --- a/src/api/resources/user/types/AuthResetUserResponse.ts +++ b/src/api/resources/user/types/AuthResetUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface AuthResetUserResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/user/types/ChangePswUserResponse.ts b/src/api/resources/user/types/ChangePswUserResponse.ts index f3933635..09f2948e 100644 --- a/src/api/resources/user/types/ChangePswUserResponse.ts +++ b/src/api/resources/user/types/ChangePswUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface ChangePswUserResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/user/types/DeleteUserResponse.ts b/src/api/resources/user/types/DeleteUserResponse.ts index de570f2c..2a46ca5d 100644 --- a/src/api/resources/user/types/DeleteUserResponse.ts +++ b/src/api/resources/user/types/DeleteUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface DeleteUserResponse { responseText: Payabli.ResponseText; diff --git a/src/api/resources/user/types/EditMfaUserResponse.ts b/src/api/resources/user/types/EditMfaUserResponse.ts index 7f31da64..969dfd43 100644 --- a/src/api/resources/user/types/EditMfaUserResponse.ts +++ b/src/api/resources/user/types/EditMfaUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface EditMfaUserResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/user/types/LogoutUserResponse.ts b/src/api/resources/user/types/LogoutUserResponse.ts index bf9435ab..0acf6130 100644 --- a/src/api/resources/user/types/LogoutUserResponse.ts +++ b/src/api/resources/user/types/LogoutUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../index.js"; +import type * as Payabli from "../../../index.js"; export interface LogoutUserResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/resources/vendor/client/Client.ts b/src/api/resources/vendor/client/Client.ts index 399c8d42..99d4b3c1 100644 --- a/src/api/resources/vendor/client/Client.ts +++ b/src/api/resources/vendor/client/Client.ts @@ -1,40 +1,25 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Vendor { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace VendorClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Vendor { - protected readonly _options: Vendor.Options; +export class VendorClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Vendor.Options = {}) { - this._options = _options; + constructor(options: VendorClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** @@ -42,7 +27,7 @@ export class Vendor { * * @param {string} entry - Entrypoint identifier. * @param {Payabli.VendorData} request - * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration. + * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -98,7 +83,7 @@ export class Vendor { public addVendor( entry: string, request: Payabli.VendorData, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__addVendor(entry, request, requestOptions)); } @@ -106,27 +91,32 @@ export class Vendor { private async __addVendor( entry: string, request: Payabli.VendorData, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Vendor/single/${encodeURIComponent(entry)}`, + `Vendor/single/${core.url.encodePathParam(entry)}`, ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseVendors, rawResponse: _response.rawResponse }; @@ -154,28 +144,14 @@ export class Vendor { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling POST /Vendor/single/{entry}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/Vendor/single/{entry}"); } /** * Delete a vendor. * * @param {number} idVendor - Vendor ID. - * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration. + * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -187,31 +163,36 @@ export class Vendor { */ public deleteVendor( idVendor: number, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__deleteVendor(idVendor, requestOptions)); } private async __deleteVendor( idVendor: number, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Vendor/${encodeURIComponent(idVendor)}`, + `Vendor/${core.url.encodePathParam(idVendor)}`, ), method: "DELETE", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseVendors, rawResponse: _response.rawResponse }; @@ -239,21 +220,7 @@ export class Vendor { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling DELETE /Vendor/{idVendor}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/Vendor/{idVendor}"); } /** @@ -261,7 +228,7 @@ export class Vendor { * * @param {number} idVendor - Vendor ID. * @param {Payabli.VendorData} request - * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration. + * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -276,7 +243,7 @@ export class Vendor { public editVendor( idVendor: number, request: Payabli.VendorData, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__editVendor(idVendor, request, requestOptions)); } @@ -284,27 +251,32 @@ export class Vendor { private async __editVendor( idVendor: number, request: Payabli.VendorData, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Vendor/${encodeURIComponent(idVendor)}`, + `Vendor/${core.url.encodePathParam(idVendor)}`, ), method: "PUT", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.PayabliApiResponseVendors, rawResponse: _response.rawResponse }; @@ -332,28 +304,14 @@ export class Vendor { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling PUT /Vendor/{idVendor}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/Vendor/{idVendor}"); } /** * Retrieves a vendor's details. * * @param {number} idVendor - Vendor ID. - * @param {Vendor.RequestOptions} requestOptions - Request-specific configuration. + * @param {VendorClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -365,31 +323,36 @@ export class Vendor { */ public getVendor( idVendor: number, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__getVendor(idVendor, requestOptions)); } private async __getVendor( idVendor: number, - requestOptions?: Vendor.RequestOptions, + requestOptions?: VendorClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.PayabliEnvironment.Sandbox, - `Vendor/${encodeURIComponent(idVendor)}`, + `Vendor/${core.url.encodePathParam(idVendor)}`, ), method: "GET", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + headers: _headers, + queryParameters: requestOptions?.queryParams, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { data: _response.body as Payabli.VendorQueryRecord, rawResponse: _response.rawResponse }; @@ -417,25 +380,6 @@ export class Vendor { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError("Timeout exceeded when calling GET /Vendor/{idVendor}."); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/Vendor/{idVendor}"); } } diff --git a/src/api/resources/wallet/client/Client.ts b/src/api/resources/wallet/client/Client.ts index 806b4c2b..a79dd867 100644 --- a/src/api/resources/wallet/client/Client.ts +++ b/src/api/resources/wallet/client/Client.ts @@ -1,47 +1,32 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as environments from "../../../../environments.js"; +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; +import { mergeHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; -import * as Payabli from "../../../index.js"; -import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; +import * as environments from "../../../../environments.js"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; +import * as Payabli from "../../../index.js"; -export declare namespace Wallet { - export interface Options { - environment?: core.Supplier; - /** Specify a custom URL to connect the client to. */ - baseUrl?: core.Supplier; - apiKey?: core.Supplier; - /** Additional headers to include in requests. */ - headers?: Record | undefined>; - } +export declare namespace WalletClient { + export interface Options extends BaseClientOptions {} - export interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record | undefined>; - } + export interface RequestOptions extends BaseRequestOptions {} } -export class Wallet { - protected readonly _options: Wallet.Options; +export class WalletClient { + protected readonly _options: NormalizedClientOptionsWithAuth; - constructor(_options: Wallet.Options = {}) { - this._options = _options; + constructor(options: WalletClient.Options = {}) { + this._options = normalizeClientOptionsWithAuth(options); } /** * Configure and activate Apple Pay for a Payabli organization * * @param {Payabli.ConfigureOrganizationRequestApplePay} request - * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * @param {WalletClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -57,15 +42,21 @@ export class Wallet { */ public configureApplePayOrganization( request: Payabli.ConfigureOrganizationRequestApplePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__configureApplePayOrganization(request, requestOptions)); } private async __configureApplePayOrganization( request: Payabli.ConfigureOrganizationRequestApplePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -74,17 +65,16 @@ export class Wallet { "Wallet/applepay/configure-organization", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -115,30 +105,19 @@ export class Wallet { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Wallet/applepay/configure-organization.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Wallet/applepay/configure-organization", + ); } /** * Configure and activate Apple Pay for a Payabli paypoint * * @param {Payabli.ConfigurePaypointRequestApplePay} request - * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * @param {WalletClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -153,15 +132,21 @@ export class Wallet { */ public configureApplePayPaypoint( request: Payabli.ConfigurePaypointRequestApplePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__configureApplePayPaypoint(request, requestOptions)); } private async __configureApplePayPaypoint( request: Payabli.ConfigurePaypointRequestApplePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -170,17 +155,16 @@ export class Wallet { "Wallet/applepay/configure-paypoint", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -211,30 +195,19 @@ export class Wallet { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Wallet/applepay/configure-paypoint.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Wallet/applepay/configure-paypoint", + ); } /** * Configure and activate Google Pay for a Payabli organization * * @param {Payabli.ConfigureOrganizationRequestGooglePay} request - * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * @param {WalletClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -250,15 +223,21 @@ export class Wallet { */ public configureGooglePayOrganization( request: Payabli.ConfigureOrganizationRequestGooglePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__configureGooglePayOrganization(request, requestOptions)); } private async __configureGooglePayOrganization( request: Payabli.ConfigureOrganizationRequestGooglePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -267,17 +246,16 @@ export class Wallet { "Wallet/googlepay/configure-organization", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -308,30 +286,19 @@ export class Wallet { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Wallet/googlepay/configure-organization.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Wallet/googlepay/configure-organization", + ); } /** * Configure and activate Google Pay for a Payabli paypoint * * @param {Payabli.ConfigurePaypointRequestGooglePay} request - * @param {Wallet.RequestOptions} requestOptions - Request-specific configuration. + * @param {WalletClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Payabli.BadRequestError} * @throws {@link Payabli.UnauthorizedError} @@ -346,15 +313,21 @@ export class Wallet { */ public configureGooglePayPaypoint( request: Payabli.ConfigurePaypointRequestGooglePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__configureGooglePayPaypoint(request, requestOptions)); } private async __configureGooglePayPaypoint( request: Payabli.ConfigurePaypointRequestGooglePay = {}, - requestOptions?: Wallet.RequestOptions, + requestOptions?: WalletClient.RequestOptions, ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); const _response = await core.fetcher({ url: core.url.join( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -363,17 +336,16 @@ export class Wallet { "Wallet/googlepay/configure-paypoint", ), method: "POST", - headers: mergeHeaders( - this._options?.headers, - mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - requestOptions?.headers, - ), + headers: _headers, contentType: "application/json", + queryParameters: requestOptions?.queryParams, requestType: "json", body: request, - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - maxRetries: requestOptions?.maxRetries, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, }); if (_response.ok) { return { @@ -404,27 +376,11 @@ export class Wallet { } } - switch (_response.error.reason) { - case "non-json": - throw new errors.PayabliError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.PayabliTimeoutError( - "Timeout exceeded when calling POST /Wallet/googlepay/configure-paypoint.", - ); - case "unknown": - throw new errors.PayabliError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - - protected async _getCustomAuthorizationHeaders() { - const apiKeyValue = await core.Supplier.get(this._options.apiKey); - return { requestToken: apiKeyValue }; + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "POST", + "/Wallet/googlepay/configure-paypoint", + ); } } diff --git a/src/api/resources/wallet/client/index.ts b/src/api/resources/wallet/client/index.ts index 82648c6f..195f9aa8 100644 --- a/src/api/resources/wallet/client/index.ts +++ b/src/api/resources/wallet/client/index.ts @@ -1,2 +1 @@ -export {}; export * from "./requests/index.js"; diff --git a/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestApplePay.ts b/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestApplePay.ts index 458cb6fd..fcf3083a 100644 --- a/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestApplePay.ts +++ b/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestApplePay.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestGooglePay.ts b/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestGooglePay.ts index 10673e0a..e3a1fd27 100644 --- a/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestGooglePay.ts +++ b/src/api/resources/wallet/client/requests/ConfigureOrganizationRequestGooglePay.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/wallet/client/requests/ConfigurePaypointRequestApplePay.ts b/src/api/resources/wallet/client/requests/ConfigurePaypointRequestApplePay.ts index b47a8260..552d38e7 100644 --- a/src/api/resources/wallet/client/requests/ConfigurePaypointRequestApplePay.ts +++ b/src/api/resources/wallet/client/requests/ConfigurePaypointRequestApplePay.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/wallet/client/requests/ConfigurePaypointRequestGooglePay.ts b/src/api/resources/wallet/client/requests/ConfigurePaypointRequestGooglePay.ts index 964ff6cf..160949b4 100644 --- a/src/api/resources/wallet/client/requests/ConfigurePaypointRequestGooglePay.ts +++ b/src/api/resources/wallet/client/requests/ConfigurePaypointRequestGooglePay.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../../../../index.js"; +import type * as Payabli from "../../../../index.js"; /** * @example diff --git a/src/api/resources/wallet/client/requests/index.ts b/src/api/resources/wallet/client/requests/index.ts index 24f18233..dc3afa02 100644 --- a/src/api/resources/wallet/client/requests/index.ts +++ b/src/api/resources/wallet/client/requests/index.ts @@ -1,4 +1,4 @@ -export { type ConfigureOrganizationRequestApplePay } from "./ConfigureOrganizationRequestApplePay.js"; -export { type ConfigurePaypointRequestApplePay } from "./ConfigurePaypointRequestApplePay.js"; -export { type ConfigureOrganizationRequestGooglePay } from "./ConfigureOrganizationRequestGooglePay.js"; -export { type ConfigurePaypointRequestGooglePay } from "./ConfigurePaypointRequestGooglePay.js"; +export type { ConfigureOrganizationRequestApplePay } from "./ConfigureOrganizationRequestApplePay.js"; +export type { ConfigureOrganizationRequestGooglePay } from "./ConfigureOrganizationRequestGooglePay.js"; +export type { ConfigurePaypointRequestApplePay } from "./ConfigurePaypointRequestApplePay.js"; +export type { ConfigurePaypointRequestGooglePay } from "./ConfigurePaypointRequestGooglePay.js"; diff --git a/src/api/types/ASection.ts b/src/api/types/ASection.ts index 9e2a09ad..6f10dd51 100644 --- a/src/api/types/ASection.ts +++ b/src/api/types/ASection.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface ASection { minimumDocuments?: number; diff --git a/src/api/types/AcceptOauth.ts b/src/api/types/AcceptOauth.ts index 8e685d83..070f5f14 100644 --- a/src/api/types/AcceptOauth.ts +++ b/src/api/types/AcceptOauth.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type AcceptOauth = boolean | undefined; diff --git a/src/api/types/AcceptRegister.ts b/src/api/types/AcceptRegister.ts index 2745adf3..09b60eea 100644 --- a/src/api/types/AcceptRegister.ts +++ b/src/api/types/AcceptRegister.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type AcceptRegister = boolean | undefined; diff --git a/src/api/types/AccountNumber.ts b/src/api/types/AccountNumber.ts index 67b13569..7119224b 100644 --- a/src/api/types/AccountNumber.ts +++ b/src/api/types/AccountNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Account number for bank account. This value is returned masked in responses. diff --git a/src/api/types/Accountexp.ts b/src/api/types/Accountexp.ts index 85b56e85..a593bce6 100644 --- a/src/api/types/Accountexp.ts +++ b/src/api/types/Accountexp.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Expiration date of card used in transaction. diff --git a/src/api/types/Accountid.ts b/src/api/types/Accountid.ts index 0c0ee082..0558761d 100644 --- a/src/api/types/Accountid.ts +++ b/src/api/types/Accountid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom identifier for payment connector. diff --git a/src/api/types/AccountingField.ts b/src/api/types/AccountingField.ts index a457e470..7fd708e0 100644 --- a/src/api/types/AccountingField.ts +++ b/src/api/types/AccountingField.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Optional custom field. diff --git a/src/api/types/Accounttype.ts b/src/api/types/Accounttype.ts index 8e1f5720..616ffbfe 100644 --- a/src/api/types/Accounttype.ts +++ b/src/api/types/Accounttype.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Bank account type or card brand. diff --git a/src/api/types/Accountzip.ts b/src/api/types/Accountzip.ts index 12f5876f..fb307c8e 100644 --- a/src/api/types/Accountzip.ts +++ b/src/api/types/Accountzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ZIP code for card used in transaction. diff --git a/src/api/types/AchAbsorbSection.ts b/src/api/types/AchAbsorbSection.ts index e1094f79..81579cd4 100644 --- a/src/api/types/AchAbsorbSection.ts +++ b/src/api/types/AchAbsorbSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchAbsorbSection { multiTier?: boolean; diff --git a/src/api/types/AchAcceptanceElement.ts b/src/api/types/AchAcceptanceElement.ts index 43dc43f3..4a33c620 100644 --- a/src/api/types/AchAcceptanceElement.ts +++ b/src/api/types/AchAcceptanceElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchAcceptanceElement { types?: Payabli.AchTypes; diff --git a/src/api/types/AchFeeSection.ts b/src/api/types/AchFeeSection.ts index 8c72cf76..3ffb883a 100644 --- a/src/api/types/AchFeeSection.ts +++ b/src/api/types/AchFeeSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchFeeSection { advancedSettlementAchFee?: Payabli.TemplateElement; diff --git a/src/api/types/AchHolder.ts b/src/api/types/AchHolder.ts index f7a4a0e2..9cdb9446 100644 --- a/src/api/types/AchHolder.ts +++ b/src/api/types/AchHolder.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Bank account holder. This field is **required** when `method` is `ach` or `check`. diff --git a/src/api/types/AchHolderType.ts b/src/api/types/AchHolderType.ts index 1627272a..825b2453 100644 --- a/src/api/types/AchHolderType.ts +++ b/src/api/types/AchHolderType.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * The bank's accountholder type: personal or business. - */ -export type AchHolderType = "personal" | "business"; +/** The bank's accountholder type: personal or business. */ export const AchHolderType = { Personal: "personal", Business: "business", } as const; +export type AchHolderType = (typeof AchHolderType)[keyof typeof AchHolderType]; diff --git a/src/api/types/AchLinkTypes.ts b/src/api/types/AchLinkTypes.ts index 9ea5c15c..020be5d2 100644 --- a/src/api/types/AchLinkTypes.ts +++ b/src/api/types/AchLinkTypes.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchLinkTypes { ccd?: Payabli.LinkData; diff --git a/src/api/types/AchPassThroughSection.ts b/src/api/types/AchPassThroughSection.ts index 33a476e4..4a8aa222 100644 --- a/src/api/types/AchPassThroughSection.ts +++ b/src/api/types/AchPassThroughSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchPassThroughSection { multiTier?: boolean; diff --git a/src/api/types/AchPaymentMethod.ts b/src/api/types/AchPaymentMethod.ts index fee45772..c411b3d1 100644 --- a/src/api/types/AchPaymentMethod.ts +++ b/src/api/types/AchPaymentMethod.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ACH payment method. diff --git a/src/api/types/AchSecCode.ts b/src/api/types/AchSecCode.ts index 96fea0dc..d7d92271 100644 --- a/src/api/types/AchSecCode.ts +++ b/src/api/types/AchSecCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Standard Entry Class (SEC) code is a three letter code that describes how an ACH payment was authorized. Supported values are: diff --git a/src/api/types/AchSection.ts b/src/api/types/AchSection.ts index 3c115119..92e0c643 100644 --- a/src/api/types/AchSection.ts +++ b/src/api/types/AchSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchSection { acceptance?: Payabli.AchLinkTypes; diff --git a/src/api/types/AchService.ts b/src/api/types/AchService.ts index bdd42530..333e4231 100644 --- a/src/api/types/AchService.ts +++ b/src/api/types/AchService.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchService { achAbsorb?: Payabli.AchAbsorbSection; diff --git a/src/api/types/AchSetup.ts b/src/api/types/AchSetup.ts index fbbd86c0..ec701ea4 100644 --- a/src/api/types/AchSetup.ts +++ b/src/api/types/AchSetup.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface AchSetup { /** CCD is an ACH SEC Code that can be used in ACH transactions by the user that indicates the transaction is a Corporate Credit or Debit Entry. Options are: `true` and `false` */ diff --git a/src/api/types/AchTypes.ts b/src/api/types/AchTypes.ts index 6f3172fb..fd8af35e 100644 --- a/src/api/types/AchTypes.ts +++ b/src/api/types/AchTypes.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchTypes { ccd?: Payabli.BasicTemplateElement; diff --git a/src/api/types/AchTypesPass.ts b/src/api/types/AchTypesPass.ts index 9e82ac8a..ae8cd475 100644 --- a/src/api/types/AchTypesPass.ts +++ b/src/api/types/AchTypesPass.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchTypesPass { ccd?: Payabli.TierItemPass; diff --git a/src/api/types/AchTypesTiers.ts b/src/api/types/AchTypesTiers.ts index 6ccea226..89df9287 100644 --- a/src/api/types/AchTypesTiers.ts +++ b/src/api/types/AchTypesTiers.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AchTypesTiers { ccd?: Payabli.TierItem; diff --git a/src/api/types/AchValidation.ts b/src/api/types/AchValidation.ts index a37f5572..2f280fcb 100644 --- a/src/api/types/AchValidation.ts +++ b/src/api/types/AchValidation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, enables real-time validation of ACH account and routing numbers. This is an add-on feature, contact Payabli for more information. diff --git a/src/api/types/Achaccount.ts b/src/api/types/Achaccount.ts index 1361047c..ec8fba1d 100644 --- a/src/api/types/Achaccount.ts +++ b/src/api/types/Achaccount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Bank account number. diff --git a/src/api/types/Achaccounttype.ts b/src/api/types/Achaccounttype.ts index acaecc2b..8b006d68 100644 --- a/src/api/types/Achaccounttype.ts +++ b/src/api/types/Achaccounttype.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Bank account type: Checking or Savings. - */ -export type Achaccounttype = "Checking" | "Savings"; +/** Bank account type: Checking or Savings. */ export const Achaccounttype = { Checking: "Checking", Savings: "Savings", } as const; +export type Achaccounttype = (typeof Achaccounttype)[keyof typeof Achaccounttype]; diff --git a/src/api/types/Achrouting.ts b/src/api/types/Achrouting.ts index ccd825d3..664f39bd 100644 --- a/src/api/types/Achrouting.ts +++ b/src/api/types/Achrouting.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ABA/routing number of Bank account. diff --git a/src/api/types/AddPaymentMethodDomainApiResponse.ts b/src/api/types/AddPaymentMethodDomainApiResponse.ts index 0bcf11a2..7513829c 100644 --- a/src/api/types/AddPaymentMethodDomainApiResponse.ts +++ b/src/api/types/AddPaymentMethodDomainApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response for the add payment method domain operation. diff --git a/src/api/types/AdditionalData.ts b/src/api/types/AdditionalData.ts index 063b5ca0..bbffe857 100644 --- a/src/api/types/AdditionalData.ts +++ b/src/api/types/AdditionalData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom dictionary of key:value pairs. You can use this field to store any data related to the object or for your system. If you are using [custom identifiers](/developers/developer-guides/entities-customers), pass those in this object. Max length for a value is 100 characters. Example usage: diff --git a/src/api/types/AdditionalDataMap.ts b/src/api/types/AdditionalDataMap.ts index 6b4d4eee..03c034e4 100644 --- a/src/api/types/AdditionalDataMap.ts +++ b/src/api/types/AdditionalDataMap.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom dictionary of key:value pairs. You can use this field to store any data related to the object or for your system. diff --git a/src/api/types/AdditionalDataString.ts b/src/api/types/AdditionalDataString.ts index 07488968..d968e9b4 100644 --- a/src/api/types/AdditionalDataString.ts +++ b/src/api/types/AdditionalDataString.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom dictionary of key:value pairs. You can use this field to store any data related to the object or for your system. Example usage: diff --git a/src/api/types/AddressAddtlNullable.ts b/src/api/types/AddressAddtlNullable.ts index 06f4a987..c541ad10 100644 --- a/src/api/types/AddressAddtlNullable.ts +++ b/src/api/types/AddressAddtlNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Additional line for the address. diff --git a/src/api/types/AddressNullable.ts b/src/api/types/AddressNullable.ts index 7115a9d7..c91096ea 100644 --- a/src/api/types/AddressNullable.ts +++ b/src/api/types/AddressNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The address. diff --git a/src/api/types/AmountElement.ts b/src/api/types/AmountElement.ts index e5e4809d..c024e000 100644 --- a/src/api/types/AmountElement.ts +++ b/src/api/types/AmountElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AmountElement { categories?: Payabli.PayCategory[]; diff --git a/src/api/types/Annualrevenue.ts b/src/api/types/Annualrevenue.ts index 4ffa57dc..f181f358 100644 --- a/src/api/types/Annualrevenue.ts +++ b/src/api/types/Annualrevenue.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Annual revenue amount. diff --git a/src/api/types/AppId.ts b/src/api/types/AppId.ts index ae7f41e9..127b09f2 100644 --- a/src/api/types/AppId.ts +++ b/src/api/types/AppId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Boarding application ID. diff --git a/src/api/types/ApplePayData.ts b/src/api/types/ApplePayData.ts index d1c4f189..a216863d 100644 --- a/src/api/types/ApplePayData.ts +++ b/src/api/types/ApplePayData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the status of the Apple Pay service. diff --git a/src/api/types/ApplePayId.ts b/src/api/types/ApplePayId.ts index 8a233842..728d279e 100644 --- a/src/api/types/ApplePayId.ts +++ b/src/api/types/ApplePayId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The internal identifier for Apple Pay-related information. diff --git a/src/api/types/ApplePayMetadata.ts b/src/api/types/ApplePayMetadata.ts index 2f4dafb1..7c328b10 100644 --- a/src/api/types/ApplePayMetadata.ts +++ b/src/api/types/ApplePayMetadata.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * This metadata appears only when the domain verification check fails. It gives more information about why the check failed. diff --git a/src/api/types/ApplePayOrganizationUpdateData.ts b/src/api/types/ApplePayOrganizationUpdateData.ts index 30278a63..36cf23fc 100644 --- a/src/api/types/ApplePayOrganizationUpdateData.ts +++ b/src/api/types/ApplePayOrganizationUpdateData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplePayOrganizationUpdateData { createdAt?: Payabli.CreatedAt; diff --git a/src/api/types/ApplePayPaypointRegistrationData.ts b/src/api/types/ApplePayPaypointRegistrationData.ts index 71ab00ac..052ff5ac 100644 --- a/src/api/types/ApplePayPaypointRegistrationData.ts +++ b/src/api/types/ApplePayPaypointRegistrationData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplePayPaypointRegistrationData { entry?: Payabli.Entry; diff --git a/src/api/types/ApplePayStatusData.ts b/src/api/types/ApplePayStatusData.ts index 1603737f..75bae289 100644 --- a/src/api/types/ApplePayStatusData.ts +++ b/src/api/types/ApplePayStatusData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the Apple Pay service status. diff --git a/src/api/types/ApplePayType.ts b/src/api/types/ApplePayType.ts index 206d599c..e0f607d7 100644 --- a/src/api/types/ApplePayType.ts +++ b/src/api/types/ApplePayType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The record type. diff --git a/src/api/types/AppleWalletData.ts b/src/api/types/AppleWalletData.ts index fdc9415a..3ede0e3b 100644 --- a/src/api/types/AppleWalletData.ts +++ b/src/api/types/AppleWalletData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * The wallet data. diff --git a/src/api/types/ApplicationData.ts b/src/api/types/ApplicationData.ts index 0f1d2281..0c21de63 100644 --- a/src/api/types/ApplicationData.ts +++ b/src/api/types/ApplicationData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplicationData { services?: Payabli.Services; diff --git a/src/api/types/ApplicationDataManaged.ts b/src/api/types/ApplicationDataManaged.ts index 8453ab85..e63cdba9 100644 --- a/src/api/types/ApplicationDataManaged.ts +++ b/src/api/types/ApplicationDataManaged.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplicationDataManaged { /** Annual revenue amount. We recommend including this value. */ diff --git a/src/api/types/ApplicationDataOdp.ts b/src/api/types/ApplicationDataOdp.ts index a8a4a0a4..ef67fd6a 100644 --- a/src/api/types/ApplicationDataOdp.ts +++ b/src/api/types/ApplicationDataOdp.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplicationDataOdp { services?: Payabli.Services; diff --git a/src/api/types/ApplicationDataPayIn.ts b/src/api/types/ApplicationDataPayIn.ts index 797b7b84..7cee3656 100644 --- a/src/api/types/ApplicationDataPayIn.ts +++ b/src/api/types/ApplicationDataPayIn.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Fields for Pay In boarding applications. diff --git a/src/api/types/ApplicationDetailsRecord.ts b/src/api/types/ApplicationDetailsRecord.ts index 13c08ebc..8706772c 100644 --- a/src/api/types/ApplicationDetailsRecord.ts +++ b/src/api/types/ApplicationDetailsRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplicationDetailsRecord { annualRevenue?: Payabli.Annualrevenue | undefined; diff --git a/src/api/types/ApplicationQueryRecord.ts b/src/api/types/ApplicationQueryRecord.ts index d6134463..183c0989 100644 --- a/src/api/types/ApplicationQueryRecord.ts +++ b/src/api/types/ApplicationQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ApplicationQueryRecord { annualRevenue?: Payabli.Annualrevenue | undefined; diff --git a/src/api/types/AssociatedVendor.ts b/src/api/types/AssociatedVendor.ts index 97ff5214..4b78e115 100644 --- a/src/api/types/AssociatedVendor.ts +++ b/src/api/types/AssociatedVendor.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AssociatedVendor { VendorNumber?: Payabli.VendorNumber; diff --git a/src/api/types/Attachments.ts b/src/api/types/Attachments.ts index d5f33cac..8943e7bb 100644 --- a/src/api/types/Attachments.ts +++ b/src/api/types/Attachments.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Array of `fileContent` objects with attached documents. Max upload size is 30 MB. diff --git a/src/api/types/AttestationDate.ts b/src/api/types/AttestationDate.ts index 3d412dc8..ab6cb3eb 100644 --- a/src/api/types/AttestationDate.ts +++ b/src/api/types/AttestationDate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Date the attestation was provided for PCI Compliance (`pciAttestation`), in MM/DD/YYYY format. diff --git a/src/api/types/Authcode.ts b/src/api/types/Authcode.ts index 9edf3f79..8b82ee6a 100644 --- a/src/api/types/Authcode.ts +++ b/src/api/types/Authcode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Authorization code for the transaction. diff --git a/src/api/types/AutoElement.ts b/src/api/types/AutoElement.ts index 6ccb38d2..c15d61fb 100644 --- a/src/api/types/AutoElement.ts +++ b/src/api/types/AutoElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface AutoElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/Avgmonthly.ts b/src/api/types/Avgmonthly.ts index 790fd86f..29b7bf64 100644 --- a/src/api/types/Avgmonthly.ts +++ b/src/api/types/Avgmonthly.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Average total amount of transactions in your local currency that are processed each month. diff --git a/src/api/types/Avgticketamt.ts b/src/api/types/Avgticketamt.ts index 7cfa1c5d..156c20d7 100644 --- a/src/api/types/Avgticketamt.ts +++ b/src/api/types/Avgticketamt.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Average ticket amount. diff --git a/src/api/types/Avsresponsetext.ts b/src/api/types/Avsresponsetext.ts index 535249a2..326f11db 100644 --- a/src/api/types/Avsresponsetext.ts +++ b/src/api/types/Avsresponsetext.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Text code describing the result for address validation (applies only for card transactions). diff --git a/src/api/types/BAddress.ts b/src/api/types/BAddress.ts index 22ed3ce2..869b5c67 100644 --- a/src/api/types/BAddress.ts +++ b/src/api/types/BAddress.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BAddress { baddress?: Payabli.LinkData; diff --git a/src/api/types/BDetails.ts b/src/api/types/BDetails.ts index ea382dca..78cca11b 100644 --- a/src/api/types/BDetails.ts +++ b/src/api/types/BDetails.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BDetails { btype?: Payabli.LinkData; diff --git a/src/api/types/BSection.ts b/src/api/types/BSection.ts index 59799a67..784e7cdd 100644 --- a/src/api/types/BSection.ts +++ b/src/api/types/BSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BSection { address?: Payabli.BAddress; diff --git a/src/api/types/Baddress1.ts b/src/api/types/Baddress1.ts index e15dcece..f722f53d 100644 --- a/src/api/types/Baddress1.ts +++ b/src/api/types/Baddress1.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business address. This must be a physical address, not a P.O. box. diff --git a/src/api/types/Baddress2.ts b/src/api/types/Baddress2.ts index 3ffb12e5..ab206957 100644 --- a/src/api/types/Baddress2.ts +++ b/src/api/types/Baddress2.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business address additional line. If used, this must be the physical address of the business, not a P.O. box. diff --git a/src/api/types/Bank.ts b/src/api/types/Bank.ts index f20e0d4a..1e5a5bca 100644 --- a/src/api/types/Bank.ts +++ b/src/api/types/Bank.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Object that contains bank account details. diff --git a/src/api/types/BankAccountFunction.ts b/src/api/types/BankAccountFunction.ts index b590a8c8..a5c38303 100644 --- a/src/api/types/BankAccountFunction.ts +++ b/src/api/types/BankAccountFunction.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Indicates the function of the bank account: diff --git a/src/api/types/BankAccountHolderName.ts b/src/api/types/BankAccountHolderName.ts index eab1d6d2..66fa7462 100644 --- a/src/api/types/BankAccountHolderName.ts +++ b/src/api/types/BankAccountHolderName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The accountholder's name. diff --git a/src/api/types/BankAccountHolderType.ts b/src/api/types/BankAccountHolderType.ts index d9158b57..21c762a1 100644 --- a/src/api/types/BankAccountHolderType.ts +++ b/src/api/types/BankAccountHolderType.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Describes whether the bank is a personal or business account. - */ -export type BankAccountHolderType = "Personal" | "Business"; +/** Describes whether the bank is a personal or business account. */ export const BankAccountHolderType = { Personal: "Personal", Business: "Business", } as const; +export type BankAccountHolderType = (typeof BankAccountHolderType)[keyof typeof BankAccountHolderType]; diff --git a/src/api/types/BankData.ts b/src/api/types/BankData.ts index b86e09a3..aaaa1e3d 100644 --- a/src/api/types/BankData.ts +++ b/src/api/types/BankData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about associated bank accounts. diff --git a/src/api/types/BankName.ts b/src/api/types/BankName.ts index d34ab5af..c957460c 100644 --- a/src/api/types/BankName.ts +++ b/src/api/types/BankName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Name of bank for account. diff --git a/src/api/types/BankNickname.ts b/src/api/types/BankNickname.ts index 57164957..fe397aa0 100644 --- a/src/api/types/BankNickname.ts +++ b/src/api/types/BankNickname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * User-defined name for the bank account. diff --git a/src/api/types/BankSection.ts b/src/api/types/BankSection.ts index 32e72151..e1298f9a 100644 --- a/src/api/types/BankSection.ts +++ b/src/api/types/BankSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about a bank account. diff --git a/src/api/types/BasicTable.ts b/src/api/types/BasicTable.ts index 858b73b9..3241c6cb 100644 --- a/src/api/types/BasicTable.ts +++ b/src/api/types/BasicTable.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BasicTable { body?: Payabli.LinkRow[]; diff --git a/src/api/types/BasicTemplateElement.ts b/src/api/types/BasicTemplateElement.ts index 3f8fa68a..4d9065e0 100644 --- a/src/api/types/BasicTemplateElement.ts +++ b/src/api/types/BasicTemplateElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BasicTemplateElement { readOnly?: Payabli.ReadOnly | undefined; diff --git a/src/api/types/BatchNumber.ts b/src/api/types/BatchNumber.ts index 48b3ab23..b8f1c2fd 100644 --- a/src/api/types/BatchNumber.ts +++ b/src/api/types/BatchNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A unique identifier for the batch. This is generated by Payabli when the batch is created, and follows this format: diff --git a/src/api/types/BatchSummary.ts b/src/api/types/BatchSummary.ts index 854e8c63..ce7d91c4 100644 --- a/src/api/types/BatchSummary.ts +++ b/src/api/types/BatchSummary.ts @@ -1,13 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example * { - * pageidentifier: undefined, * pageSize: 20, * totalAmount: 0, * totalNetAmount: 0, diff --git a/src/api/types/Bcity.ts b/src/api/types/Bcity.ts index af194eab..1a916166 100644 --- a/src/api/types/Bcity.ts +++ b/src/api/types/Bcity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business city diff --git a/src/api/types/Bcountry.ts b/src/api/types/Bcountry.ts index ef4d1307..82b4b7a8 100644 --- a/src/api/types/Bcountry.ts +++ b/src/api/types/Bcountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business country in ISO-3166-1 alpha 2 format. See: https://en.wikipedia.org/wiki/ISO_3166-1 for more information. diff --git a/src/api/types/BillApprovals.ts b/src/api/types/BillApprovals.ts index 9b2c3fa5..6e563580 100644 --- a/src/api/types/BillApprovals.ts +++ b/src/api/types/BillApprovals.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Approvals associated with the bill. diff --git a/src/api/types/BillData.ts b/src/api/types/BillData.ts index b59b99c1..8135efc0 100644 --- a/src/api/types/BillData.ts +++ b/src/api/types/BillData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillData { AdditionalData?: Payabli.AdditionalDataString; @@ -99,28 +97,6 @@ export namespace BillData { * * - `50UF`: 50 days until further notice */ - export type PaymentTerms = - | "PIA" - | "CIA" - | "UR" - | "NET10" - | "NET20" - | "NET30" - | "NET45" - | "NET60" - | "NET90" - | "EOM" - | "MFI" - | "5MFI" - | "10MFI" - | "15MFI" - | "20MFI" - | "2/10NET30" - | "UF" - | "10UF" - | "20UF" - | "25UF" - | "50UF"; export const PaymentTerms = { Pia: "PIA", Cia: "CIA", @@ -144,4 +120,5 @@ export namespace BillData { TwentyFiveUf: "25UF", FiftyUf: "50UF", } as const; + export type PaymentTerms = (typeof PaymentTerms)[keyof typeof PaymentTerms]; } diff --git a/src/api/types/BillDetailResponse.ts b/src/api/types/BillDetailResponse.ts index 2d2c0ab2..e4ff65cc 100644 --- a/src/api/types/BillDetailResponse.ts +++ b/src/api/types/BillDetailResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillDetailResponse { /** Events associated to this transaction. */ diff --git a/src/api/types/BillDetailsResponse.ts b/src/api/types/BillDetailsResponse.ts index 59f4d624..53303533 100644 --- a/src/api/types/BillDetailsResponse.ts +++ b/src/api/types/BillDetailsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response object for bill details. Contains basic information about a bill. diff --git a/src/api/types/BillEvents.ts b/src/api/types/BillEvents.ts index 3e560356..3d066613 100644 --- a/src/api/types/BillEvents.ts +++ b/src/api/types/BillEvents.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Array of event objects with information related to events associated to the invoice. diff --git a/src/api/types/BillId.ts b/src/api/types/BillId.ts index 29c22bf1..c8964eca 100644 --- a/src/api/types/BillId.ts +++ b/src/api/types/BillId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The bill's ID in Payabli. This value is automatically generated by Payabli when the bill is created. diff --git a/src/api/types/BillItem.ts b/src/api/types/BillItem.ts index dfb5bdf7..0351668b 100644 --- a/src/api/types/BillItem.ts +++ b/src/api/types/BillItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillItem { /** Array of tags classifying item or product. */ diff --git a/src/api/types/BillOptions.ts b/src/api/types/BillOptions.ts index 83f675b4..3a48cb1e 100644 --- a/src/api/types/BillOptions.ts +++ b/src/api/types/BillOptions.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface BillOptions { /** Flag to indicate if the scheduled invoice includes a payment link. */ diff --git a/src/api/types/BillPayOutData.ts b/src/api/types/BillPayOutData.ts index 2cb3605c..cd8d09c6 100644 --- a/src/api/types/BillPayOutData.ts +++ b/src/api/types/BillPayOutData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillPayOutData { /** Bill ID in Payabli. */ diff --git a/src/api/types/BillPayOutDataRequest.ts b/src/api/types/BillPayOutDataRequest.ts index 10cdc443..3cdafade 100644 --- a/src/api/types/BillPayOutDataRequest.ts +++ b/src/api/types/BillPayOutDataRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillPayOutDataRequest { /** Bill ID in Payabli. */ diff --git a/src/api/types/BillQueryRecord2.ts b/src/api/types/BillQueryRecord2.ts index 3efafd8a..001cd5c0 100644 --- a/src/api/types/BillQueryRecord2.ts +++ b/src/api/types/BillQueryRecord2.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillQueryRecord2 { AccountingField1: Payabli.AccountingField | null; diff --git a/src/api/types/BillQueryRecord2BillApprovalsItem.ts b/src/api/types/BillQueryRecord2BillApprovalsItem.ts index 5508b8cb..d9fc5c8b 100644 --- a/src/api/types/BillQueryRecord2BillApprovalsItem.ts +++ b/src/api/types/BillQueryRecord2BillApprovalsItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillQueryRecord2BillApprovalsItem { /** Indicates whether the bill has been approved. `0` is false, and `1` is true. */ diff --git a/src/api/types/BillQueryRecord2PaymentMethod.ts b/src/api/types/BillQueryRecord2PaymentMethod.ts index b5884b57..00871180 100644 --- a/src/api/types/BillQueryRecord2PaymentMethod.ts +++ b/src/api/types/BillQueryRecord2PaymentMethod.ts @@ -1,11 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Preferred payment method used. - */ -export type BillQueryRecord2PaymentMethod = "vcard" | "ach" | "check" | "card" | "managed"; +/** Preferred payment method used. */ export const BillQueryRecord2PaymentMethod = { Vcard: "vcard", Ach: "ach", @@ -13,3 +8,5 @@ export const BillQueryRecord2PaymentMethod = { Card: "card", Managed: "managed", } as const; +export type BillQueryRecord2PaymentMethod = + (typeof BillQueryRecord2PaymentMethod)[keyof typeof BillQueryRecord2PaymentMethod]; diff --git a/src/api/types/BillQueryResponse.ts b/src/api/types/BillQueryResponse.ts index d1f05de2..7a3e8e54 100644 --- a/src/api/types/BillQueryResponse.ts +++ b/src/api/types/BillQueryResponse.ts @@ -1,14 +1,11 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example * { * Summary: { - * pageidentifier: undefined, * pageSize: 20, * total2approval: 1, * totalactive: 1, diff --git a/src/api/types/BillQueryResponseSummary.ts b/src/api/types/BillQueryResponseSummary.ts index 571eeaef..0ffbd770 100644 --- a/src/api/types/BillQueryResponseSummary.ts +++ b/src/api/types/BillQueryResponseSummary.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillQueryResponseSummary { pageidentifier?: Payabli.PageIdentifier; diff --git a/src/api/types/BillingAddressAddtlNullable.ts b/src/api/types/BillingAddressAddtlNullable.ts index 7fd96fa7..570f4a24 100644 --- a/src/api/types/BillingAddressAddtlNullable.ts +++ b/src/api/types/BillingAddressAddtlNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Additional line for the billing address. diff --git a/src/api/types/BillingAddressNullable.ts b/src/api/types/BillingAddressNullable.ts index fc2bfd97..99f0a519 100644 --- a/src/api/types/BillingAddressNullable.ts +++ b/src/api/types/BillingAddressNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Billing address. diff --git a/src/api/types/BillingCityNullable.ts b/src/api/types/BillingCityNullable.ts index 4d03de72..9ef6cad5 100644 --- a/src/api/types/BillingCityNullable.ts +++ b/src/api/types/BillingCityNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Billing city. diff --git a/src/api/types/BillingCountryNullable.ts b/src/api/types/BillingCountryNullable.ts index a42f5e8f..c0e164b7 100644 --- a/src/api/types/BillingCountryNullable.ts +++ b/src/api/types/BillingCountryNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Billing address country. diff --git a/src/api/types/BillingData.ts b/src/api/types/BillingData.ts index f5879ecf..cdc26c15 100644 --- a/src/api/types/BillingData.ts +++ b/src/api/types/BillingData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BillingData { /** Account number for bank account. */ diff --git a/src/api/types/BillingDataResponse.ts b/src/api/types/BillingDataResponse.ts index ce3b8c35..3573d410 100644 --- a/src/api/types/BillingDataResponse.ts +++ b/src/api/types/BillingDataResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example diff --git a/src/api/types/BillingFeeDetail.ts b/src/api/types/BillingFeeDetail.ts index aa95a092..e548810d 100644 --- a/src/api/types/BillingFeeDetail.ts +++ b/src/api/types/BillingFeeDetail.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface BillingFeeDetail { billableEvent?: string; diff --git a/src/api/types/BillingStateNullable.ts b/src/api/types/BillingStateNullable.ts index a6fe8ad0..4551b19f 100644 --- a/src/api/types/BillingStateNullable.ts +++ b/src/api/types/BillingStateNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Billing state. Must be 2-letter state code for address in US. diff --git a/src/api/types/BillingZip.ts b/src/api/types/BillingZip.ts index 8658b136..00740d6d 100644 --- a/src/api/types/BillingZip.ts +++ b/src/api/types/BillingZip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Billing address ZIP code. diff --git a/src/api/types/Billitems.ts b/src/api/types/Billitems.ts index 7f04725e..e0c189dc 100644 --- a/src/api/types/Billitems.ts +++ b/src/api/types/Billitems.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Array of `LineItems` contained in bill. diff --git a/src/api/types/Billstatus.ts b/src/api/types/Billstatus.ts index 79634407..8d536283 100644 --- a/src/api/types/Billstatus.ts +++ b/src/api/types/Billstatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * diff --git a/src/api/types/BinData.ts b/src/api/types/BinData.ts index 33afd600..27d9b9e0 100644 --- a/src/api/types/BinData.ts +++ b/src/api/types/BinData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Object containing information related to the card. This object is `null` diff --git a/src/api/types/Binperson.ts b/src/api/types/Binperson.ts index bec27896..4bcff4f0 100644 --- a/src/api/types/Binperson.ts +++ b/src/api/types/Binperson.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Numeric percent of volume processed in person. To pass validation, `binperson`, `binweb`, and `binphone` must total 100 together. diff --git a/src/api/types/Binphone.ts b/src/api/types/Binphone.ts index 1fe1e086..526b7cfa 100644 --- a/src/api/types/Binphone.ts +++ b/src/api/types/Binphone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Numeric percent of volume processed by phone. To pass validation, `binperson`, `binweb`, and `binphone` must total 100 together. diff --git a/src/api/types/Binweb.ts b/src/api/types/Binweb.ts index d54a838d..b6f3cbfe 100644 --- a/src/api/types/Binweb.ts +++ b/src/api/types/Binweb.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Numeric percent of volume processed on web. To pass validation, `binperson`, `binweb`, and `binphone` must total 100 together. diff --git a/src/api/types/Bnk.ts b/src/api/types/Bnk.ts index 2de5ad74..a4e474d7 100644 --- a/src/api/types/Bnk.ts +++ b/src/api/types/Bnk.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Bnk { accountNumber?: Payabli.LinkData; diff --git a/src/api/types/BoardingApplicationAttachments.ts b/src/api/types/BoardingApplicationAttachments.ts index 365e922a..ddfdc393 100644 --- a/src/api/types/BoardingApplicationAttachments.ts +++ b/src/api/types/BoardingApplicationAttachments.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BoardingApplicationAttachments { /** Array of objects describing files contained in the ZIP file. */ diff --git a/src/api/types/BoardingAverageBillSize.ts b/src/api/types/BoardingAverageBillSize.ts index c0e702c9..453a4822 100644 --- a/src/api/types/BoardingAverageBillSize.ts +++ b/src/api/types/BoardingAverageBillSize.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * This is the average amount of each bill you pay through our service. For example, if your business paid 3 bills for a total of \$1,500 then your average bill size is \$500. diff --git a/src/api/types/BoardingAvgMonthlyBill.ts b/src/api/types/BoardingAvgMonthlyBill.ts index 00bdebfa..2da87fba 100644 --- a/src/api/types/BoardingAvgMonthlyBill.ts +++ b/src/api/types/BoardingAvgMonthlyBill.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * This is the total number of bills the business pays each month. For example, if your business pays an electric bill of \$500, a internet bill of \$150, and various suppliers \$5,000 every month then your monthly bill volume would be \$5,650. diff --git a/src/api/types/BoardingBusinessFax.ts b/src/api/types/BoardingBusinessFax.ts index 8ca08183..a03175d6 100644 --- a/src/api/types/BoardingBusinessFax.ts +++ b/src/api/types/BoardingBusinessFax.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business's fax number. diff --git a/src/api/types/BoardingBusinessPhone.ts b/src/api/types/BoardingBusinessPhone.ts index 3756f07e..fc746976 100644 --- a/src/api/types/BoardingBusinessPhone.ts +++ b/src/api/types/BoardingBusinessPhone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business's phone number. diff --git a/src/api/types/BoardingId.ts b/src/api/types/BoardingId.ts index 811a3e79..0e179187 100644 --- a/src/api/types/BoardingId.ts +++ b/src/api/types/BoardingId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The Payabli-assigned ID of the boarding application linked to this paypoint. diff --git a/src/api/types/BoardingLinkApiResponse.ts b/src/api/types/BoardingLinkApiResponse.ts index 81ba59c0..113c45c1 100644 --- a/src/api/types/BoardingLinkApiResponse.ts +++ b/src/api/types/BoardingLinkApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * diff --git a/src/api/types/BoardingLinkId.ts b/src/api/types/BoardingLinkId.ts index abaadac0..ccd21326 100644 --- a/src/api/types/BoardingLinkId.ts +++ b/src/api/types/BoardingLinkId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The boarding link ID. This is found at the end of the boarding link reference name. For example: `https://boarding.payabli.com/boarding/app/myorgaccountname-00091`. The ID is `91`. diff --git a/src/api/types/BoardingLinkQueryRecord.ts b/src/api/types/BoardingLinkQueryRecord.ts index c414f19f..44124dae 100644 --- a/src/api/types/BoardingLinkQueryRecord.ts +++ b/src/api/types/BoardingLinkQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BoardingLinkQueryRecord { acceptOauth?: Payabli.AcceptOauth | undefined; diff --git a/src/api/types/BoardingQueryLinks.ts b/src/api/types/BoardingQueryLinks.ts index d5a5f785..62cbc602 100644 --- a/src/api/types/BoardingQueryLinks.ts +++ b/src/api/types/BoardingQueryLinks.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BoardingQueryLinks { acceptOauth?: Payabli.AcceptOauth | undefined; diff --git a/src/api/types/BoardingStatus.ts b/src/api/types/BoardingStatus.ts index 95568068..357f931e 100644 --- a/src/api/types/BoardingStatus.ts +++ b/src/api/types/BoardingStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The application's status in the merchant boarding process. See [Boarding Status Reference](/developers/references/boarding-statuses) for more. diff --git a/src/api/types/Bphone.ts b/src/api/types/Bphone.ts index 61aa273a..255c2d59 100644 --- a/src/api/types/Bphone.ts +++ b/src/api/types/Bphone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business phone number. diff --git a/src/api/types/Bstate.ts b/src/api/types/Bstate.ts index fe4c1c2e..6cdfe8ec 100644 --- a/src/api/types/Bstate.ts +++ b/src/api/types/Bstate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business state. diff --git a/src/api/types/Bsummary.ts b/src/api/types/Bsummary.ts index d76ae742..7a99836f 100644 --- a/src/api/types/Bsummary.ts +++ b/src/api/types/Bsummary.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A summary of what the business sells in terms of goods or services. diff --git a/src/api/types/BuilderData.ts b/src/api/types/BuilderData.ts index 25c968b3..a48b842a 100644 --- a/src/api/types/BuilderData.ts +++ b/src/api/types/BuilderData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface BuilderData { services?: Payabli.SSection; diff --git a/src/api/types/BusinessSection.ts b/src/api/types/BusinessSection.ts index 86068690..455d4da6 100644 --- a/src/api/types/BusinessSection.ts +++ b/src/api/types/BusinessSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about a business. diff --git a/src/api/types/Busstartdate.ts b/src/api/types/Busstartdate.ts index 00790640..053f4950 100644 --- a/src/api/types/Busstartdate.ts +++ b/src/api/types/Busstartdate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business start date. Accepted formats: diff --git a/src/api/types/ButtonElement.ts b/src/api/types/ButtonElement.ts index 1b182797..7dabd625 100644 --- a/src/api/types/ButtonElement.ts +++ b/src/api/types/ButtonElement.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface ButtonElement { /** Label for custom payment button */ @@ -10,13 +8,11 @@ export interface ButtonElement { } export namespace ButtonElement { - /** - * Specify size of custom payment button - */ - export type Size = "sm" | "md" | "lg"; + /** Specify size of custom payment button */ export const Size = { Sm: "sm", Md: "md", Lg: "lg", } as const; + export type Size = (typeof Size)[keyof typeof Size]; } diff --git a/src/api/types/Bzip.ts b/src/api/types/Bzip.ts index 66f16203..f7d0ffe9 100644 --- a/src/api/types/Bzip.ts +++ b/src/api/types/Bzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business ZIP. diff --git a/src/api/types/CList.ts b/src/api/types/CList.ts index 1be5910f..1e159b53 100644 --- a/src/api/types/CList.ts +++ b/src/api/types/CList.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CList { contactEmail?: Payabli.LinkData; diff --git a/src/api/types/CardAcceptanceElement.ts b/src/api/types/CardAcceptanceElement.ts index 655c608e..05e5ed0f 100644 --- a/src/api/types/CardAcceptanceElement.ts +++ b/src/api/types/CardAcceptanceElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardAcceptanceElement { types?: Payabli.CardTypes; diff --git a/src/api/types/CardFeeSection.ts b/src/api/types/CardFeeSection.ts index a45f692f..99282361 100644 --- a/src/api/types/CardFeeSection.ts +++ b/src/api/types/CardFeeSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardFeeSection { achBatchCardFee?: Payabli.TemplateElement; diff --git a/src/api/types/CardFlatSection.ts b/src/api/types/CardFlatSection.ts index 07a0351c..e5211c80 100644 --- a/src/api/types/CardFlatSection.ts +++ b/src/api/types/CardFlatSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardFlatSection { tiers?: Payabli.CardType[]; diff --git a/src/api/types/CardIcpSection.ts b/src/api/types/CardIcpSection.ts index 3a6a5a4e..e9765b6e 100644 --- a/src/api/types/CardIcpSection.ts +++ b/src/api/types/CardIcpSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardIcpSection { tiers?: Payabli.CardType[]; diff --git a/src/api/types/CardLinkTypes.ts b/src/api/types/CardLinkTypes.ts index 88d79bf1..2d1c2d06 100644 --- a/src/api/types/CardLinkTypes.ts +++ b/src/api/types/CardLinkTypes.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardLinkTypes { amex?: Payabli.LinkData; diff --git a/src/api/types/CardPassThroughSection.ts b/src/api/types/CardPassThroughSection.ts index fde1822a..60e56700 100644 --- a/src/api/types/CardPassThroughSection.ts +++ b/src/api/types/CardPassThroughSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardPassThroughSection { multiTier?: boolean; diff --git a/src/api/types/CardSection.ts b/src/api/types/CardSection.ts index 1476d57d..5d8dd4c8 100644 --- a/src/api/types/CardSection.ts +++ b/src/api/types/CardSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardSection { acceptance?: Payabli.CardLinkTypes; diff --git a/src/api/types/CardService.ts b/src/api/types/CardService.ts index 32ec1cd4..cb8dda96 100644 --- a/src/api/types/CardService.ts +++ b/src/api/types/CardService.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardService { /** Controls how to present the `batchCutoffTime` field on the application. If this field isn't sent, batch cut off time defaults to 5 ET. */ diff --git a/src/api/types/CardSetup.ts b/src/api/types/CardSetup.ts index 3b5deb6a..eb13d1d3 100644 --- a/src/api/types/CardSetup.ts +++ b/src/api/types/CardSetup.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface CardSetup { /** Determines whether American Express is accepted. */ diff --git a/src/api/types/CardType.ts b/src/api/types/CardType.ts index 4cd2f047..86abbba1 100644 --- a/src/api/types/CardType.ts +++ b/src/api/types/CardType.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardType { amex?: Payabli.TierItem; diff --git a/src/api/types/CardTypePass.ts b/src/api/types/CardTypePass.ts index 8d196454..04c7e094 100644 --- a/src/api/types/CardTypePass.ts +++ b/src/api/types/CardTypePass.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardTypePass { amex?: Payabli.TierItemPass; diff --git a/src/api/types/CardTypes.ts b/src/api/types/CardTypes.ts index 9096a452..d8c658ab 100644 --- a/src/api/types/CardTypes.ts +++ b/src/api/types/CardTypes.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CardTypes { amex?: Payabli.BasicTemplateElement; diff --git a/src/api/types/Cardcvv.ts b/src/api/types/Cardcvv.ts index 22b7d9b0..296bf6e6 100644 --- a/src/api/types/Cardcvv.ts +++ b/src/api/types/Cardcvv.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Card Verification Value (CVV) associated with the card number. We **strongly recommend** that you include this field when using `card` as a method. diff --git a/src/api/types/Cardexp.ts b/src/api/types/Cardexp.ts index d3c1d538..25683b57 100644 --- a/src/api/types/Cardexp.ts +++ b/src/api/types/Cardexp.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Card expiration date in format MMYY or MM/YY. Required for card transactions. diff --git a/src/api/types/Cardholder.ts b/src/api/types/Cardholder.ts index d40f3de8..0b127c8c 100644 --- a/src/api/types/Cardholder.ts +++ b/src/api/types/Cardholder.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Cardholder name. diff --git a/src/api/types/Cardnumber.ts b/src/api/types/Cardnumber.ts index 8b3ae232..933a47dd 100644 --- a/src/api/types/Cardnumber.ts +++ b/src/api/types/Cardnumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The card number. Required when method is `card` and a `storedMethodId` isn't included. diff --git a/src/api/types/Cardzip.ts b/src/api/types/Cardzip.ts index 2c10baf0..24529d2f 100644 --- a/src/api/types/Cardzip.ts +++ b/src/api/types/Cardzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ZIP or postal code for the billing address of cardholder. We **strongly recommend** that you include this field when using `card` as a method. diff --git a/src/api/types/Cascade.ts b/src/api/types/Cascade.ts index 6c4843c6..9df79fde 100644 --- a/src/api/types/Cascade.ts +++ b/src/api/types/Cascade.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the wallet service configuration cascades to all paypoints and suborganizations belonging to the parent entity. diff --git a/src/api/types/CascadeJobDetails.ts b/src/api/types/CascadeJobDetails.ts index f9c8084f..17410a8e 100644 --- a/src/api/types/CascadeJobDetails.ts +++ b/src/api/types/CascadeJobDetails.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the cascade process. diff --git a/src/api/types/Cash.ts b/src/api/types/Cash.ts index adc59ba1..3585202a 100644 --- a/src/api/types/Cash.ts +++ b/src/api/types/Cash.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface Cash { /** Method to use for the transaction. For cash transactions, use `cash`. */ diff --git a/src/api/types/Category.ts b/src/api/types/Category.ts index aa46a4a5..ed694b5e 100644 --- a/src/api/types/Category.ts +++ b/src/api/types/Category.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A field used internally by Payabli to categorize the transaction details. Values are: diff --git a/src/api/types/ChargebackId.ts b/src/api/types/ChargebackId.ts index fb99d369..183d7660 100644 --- a/src/api/types/ChargebackId.ts +++ b/src/api/types/ChargebackId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of chargeback transaction diff --git a/src/api/types/Check.ts b/src/api/types/Check.ts index d8bd20b0..6a920e32 100644 --- a/src/api/types/Check.ts +++ b/src/api/types/Check.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Check { /** The checking accountholder's name. */ diff --git a/src/api/types/CityNullable.ts b/src/api/types/CityNullable.ts index 5859846a..2e65f113 100644 --- a/src/api/types/CityNullable.ts +++ b/src/api/types/CityNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The city. diff --git a/src/api/types/CloudQueryApiResponse.ts b/src/api/types/CloudQueryApiResponse.ts index 70c8d44c..2ef3fbcd 100644 --- a/src/api/types/CloudQueryApiResponse.ts +++ b/src/api/types/CloudQueryApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Object containing details about cloud devices and their registration history. diff --git a/src/api/types/Comments.ts b/src/api/types/Comments.ts index 1aee3f08..af8ad383 100644 --- a/src/api/types/Comments.ts +++ b/src/api/types/Comments.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Any comment or description. diff --git a/src/api/types/ConfigureApplePayOrganizationApiResponse.ts b/src/api/types/ConfigureApplePayOrganizationApiResponse.ts index c0e29315..a8d03f52 100644 --- a/src/api/types/ConfigureApplePayOrganizationApiResponse.ts +++ b/src/api/types/ConfigureApplePayOrganizationApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ConfigureApplePayOrganizationApiResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/ConfigureApplePaypointApiResponse.ts b/src/api/types/ConfigureApplePaypointApiResponse.ts index d81ba158..0444a0fa 100644 --- a/src/api/types/ConfigureApplePaypointApiResponse.ts +++ b/src/api/types/ConfigureApplePaypointApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ConfigureApplePaypointApiResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/ConfigureGooglePaypointApiResponse.ts b/src/api/types/ConfigureGooglePaypointApiResponse.ts index e11e760e..ff826066 100644 --- a/src/api/types/ConfigureGooglePaypointApiResponse.ts +++ b/src/api/types/ConfigureGooglePaypointApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ConfigureGooglePaypointApiResponse { isSuccess: Payabli.IsSuccess; diff --git a/src/api/types/ContactElement.ts b/src/api/types/ContactElement.ts index 9e126451..9eff1186 100644 --- a/src/api/types/ContactElement.ts +++ b/src/api/types/ContactElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ContactElement { /** Custom content for email */ diff --git a/src/api/types/Contacts.ts b/src/api/types/Contacts.ts index d5eba605..5dcee3bf 100644 --- a/src/api/types/Contacts.ts +++ b/src/api/types/Contacts.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Contacts { /** Contact email address. */ diff --git a/src/api/types/ContactsField.ts b/src/api/types/ContactsField.ts index 31050f0a..221a40e8 100644 --- a/src/api/types/ContactsField.ts +++ b/src/api/types/ContactsField.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * List of contacts. diff --git a/src/api/types/ContactsResponse.ts b/src/api/types/ContactsResponse.ts index a7bf6627..7f6cb3bb 100644 --- a/src/api/types/ContactsResponse.ts +++ b/src/api/types/ContactsResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example diff --git a/src/api/types/CountryNullable.ts b/src/api/types/CountryNullable.ts index d2388e40..adaca741 100644 --- a/src/api/types/CountryNullable.ts +++ b/src/api/types/CountryNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference. diff --git a/src/api/types/CreatedAt.ts b/src/api/types/CreatedAt.ts index 10339f07..35d3b9a5 100644 --- a/src/api/types/CreatedAt.ts +++ b/src/api/types/CreatedAt.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timestamp of when record was created, in UTC. diff --git a/src/api/types/CustomerData.ts b/src/api/types/CustomerData.ts index 58d3645b..b17d3770 100644 --- a/src/api/types/CustomerData.ts +++ b/src/api/types/CustomerData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Data about a single customer. diff --git a/src/api/types/CustomerId.ts b/src/api/types/CustomerId.ts index 3b52e8f2..05a45c22 100644 --- a/src/api/types/CustomerId.ts +++ b/src/api/types/CustomerId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The Payabli-generated unique ID for the customer. diff --git a/src/api/types/CustomerNumberNullable.ts b/src/api/types/CustomerNumberNullable.ts index 1d652a18..a3dce121 100644 --- a/src/api/types/CustomerNumberNullable.ts +++ b/src/api/types/CustomerNumberNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * User-provided unique identifier for the customer. This is typically the customer ID from your own system. diff --git a/src/api/types/CustomerQueryRecords.ts b/src/api/types/CustomerQueryRecords.ts index 1cb2bf45..ad98c4d3 100644 --- a/src/api/types/CustomerQueryRecords.ts +++ b/src/api/types/CustomerQueryRecords.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example @@ -138,40 +136,25 @@ import * as Payabli from "../index.js"; * { * customerId: 17264, * customerNumber: "12356ACB", - * customerUsername: undefined, * customerStatus: 0, - * Company: undefined, * Firstname: "Irene", * Lastname: "Canizales", - * Phone: undefined, * Email: "irene@canizalesconcrete.com", - * Address: undefined, * Address1: "123 Bishop's Trail", * City: "Mountain City", * State: "TN", * Zip: "37612", * Country: "US", - * ShippingAddress: undefined, - * ShippingAddress1: undefined, - * ShippingCity: undefined, - * ShippingState: undefined, - * ShippingZip: undefined, - * ShippingCountry: undefined, * Balance: 0, * TimeZone: -5, * MFA: false, * MFAMode: 0, - * snProvider: undefined, - * snIdentifier: undefined, - * snData: undefined, * LastUpdated: "2024-03-13T12:49:56Z", * Created: "2024-03-13T12:49:56Z", * AdditionalFields: { * "key": "value" * }, * IdentifierFields: ["email"], - * Subscriptions: undefined, - * StoredMethods: undefined, * customerSummary: { * numberofTransactions: 30, * recentTransactions: [{ @@ -191,9 +174,7 @@ import * as Payabli from "../index.js"; * ParentOrgName: "The Pilgrim Planner", * ParentOrgId: 123, * PaypointEntryname: "41035afaa7", - * pageidentifier: "null", - * externalPaypointID: undefined, - * customerConsent: undefined + * pageidentifier: "null" * } */ export interface CustomerQueryRecords { diff --git a/src/api/types/CustomerStatus.ts b/src/api/types/CustomerStatus.ts index c1fc8e2b..ae6263e9 100644 --- a/src/api/types/CustomerStatus.ts +++ b/src/api/types/CustomerStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Customer Status. diff --git a/src/api/types/CustomerSummaryRecord.ts b/src/api/types/CustomerSummaryRecord.ts index 8b0dcc09..ba397384 100644 --- a/src/api/types/CustomerSummaryRecord.ts +++ b/src/api/types/CustomerSummaryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface CustomerSummaryRecord { /** Number total of transactions or payments */ diff --git a/src/api/types/Customeridtrans.ts b/src/api/types/Customeridtrans.ts index 118e7c65..b7ab5639 100644 --- a/src/api/types/Customeridtrans.ts +++ b/src/api/types/Customeridtrans.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payabli-generated unique ID of customer owner of transaction. Returns `0` if the transaction wasn't assigned to an existing customer or no customer was created. diff --git a/src/api/types/Cvvresponsetext.ts b/src/api/types/Cvvresponsetext.ts index 9fa81170..3de7d2c1 100644 --- a/src/api/types/Cvvresponsetext.ts +++ b/src/api/types/Cvvresponsetext.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Text code describing the result for CVV validation (applies only for card transactions). diff --git a/src/api/types/DSection.ts b/src/api/types/DSection.ts index c815b4a3..6d62caf0 100644 --- a/src/api/types/DSection.ts +++ b/src/api/types/DSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface DSection { depositAccount?: Payabli.Bnk; diff --git a/src/api/types/Datenullable.ts b/src/api/types/Datenullable.ts index 03e189f9..06be3d95 100644 --- a/src/api/types/Datenullable.ts +++ b/src/api/types/Datenullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Date in YYYY-MM-DD format. diff --git a/src/api/types/DatetimeNullable.ts b/src/api/types/DatetimeNullable.ts index 4f554838..13d93fd5 100644 --- a/src/api/types/DatetimeNullable.ts +++ b/src/api/types/DatetimeNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timestamp for operation, in UTC. diff --git a/src/api/types/Dbaname.ts b/src/api/types/Dbaname.ts index 89c40869..2e3621ef 100644 --- a/src/api/types/Dbaname.ts +++ b/src/api/types/Dbaname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The alternate or common name that this business is doing business under usually referred to as a DBA name. diff --git a/src/api/types/DepositDate.ts b/src/api/types/DepositDate.ts index 846a443d..f9d4558d 100644 --- a/src/api/types/DepositDate.ts +++ b/src/api/types/DepositDate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The date the funds were deposited. diff --git a/src/api/types/Descriptor.ts b/src/api/types/Descriptor.ts index 4b521a04..aee33834 100644 --- a/src/api/types/Descriptor.ts +++ b/src/api/types/Descriptor.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When the method is a card, this field displays card brand. When the method is ACH, this field displays the account type for ACH (checking or savings). diff --git a/src/api/types/Device.ts b/src/api/types/Device.ts index 8e60e703..d37f19df 100644 --- a/src/api/types/Device.ts +++ b/src/api/types/Device.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of registered cloud device used in the transaction. diff --git a/src/api/types/DeviceId.ts b/src/api/types/DeviceId.ts index 36e6f293..9715c343 100644 --- a/src/api/types/DeviceId.ts +++ b/src/api/types/DeviceId.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Identifier of registered cloud device used in the transaction diff --git a/src/api/types/Discount.ts b/src/api/types/Discount.ts index d3f487dc..6a2d0463 100644 --- a/src/api/types/Discount.ts +++ b/src/api/types/Discount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Discount applied to the invoice. diff --git a/src/api/types/DisplayProperty.ts b/src/api/types/DisplayProperty.ts index 9e9f5549..a8222b01 100644 --- a/src/api/types/DisplayProperty.ts +++ b/src/api/types/DisplayProperty.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface DisplayProperty { /** When `true`, the field is displayed on the receipt. */ diff --git a/src/api/types/DocumentSection.ts b/src/api/types/DocumentSection.ts index 8de2657c..76e33f60 100644 --- a/src/api/types/DocumentSection.ts +++ b/src/api/types/DocumentSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface DocumentSection { visble?: Payabli.Visible | undefined; diff --git a/src/api/types/DocumentsRef.ts b/src/api/types/DocumentsRef.ts index 3e907df4..22428b6f 100644 --- a/src/api/types/DocumentsRef.ts +++ b/src/api/types/DocumentsRef.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface DocumentsRef { /** Array of objects describing files contained in the ZIP file. */ diff --git a/src/api/types/DomainName.ts b/src/api/types/DomainName.ts index 9a54327f..b07e4fbe 100644 --- a/src/api/types/DomainName.ts +++ b/src/api/types/DomainName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The domain. For example: `subdomain.domain.com` or `domain.com`. Must be public. Can't be `localhost`, hidden by a VPN, or protected by a password. diff --git a/src/api/types/DutyAmount.ts b/src/api/types/DutyAmount.ts index 3c29629a..89547742 100644 --- a/src/api/types/DutyAmount.ts +++ b/src/api/types/DutyAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Duty amount. diff --git a/src/api/types/Ein.ts b/src/api/types/Ein.ts index 3fe139c0..4f565c49 100644 --- a/src/api/types/Ein.ts +++ b/src/api/types/Ein.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business EIN or tax ID. This value is masked in API responses, for example `XXXX6789`. diff --git a/src/api/types/Element.ts b/src/api/types/Element.ts index a20e7d70..f6e0b3a9 100644 --- a/src/api/types/Element.ts +++ b/src/api/types/Element.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Element { enabled?: Payabli.Enabled; diff --git a/src/api/types/Email.ts b/src/api/types/Email.ts index d45eba1b..11d20315 100644 --- a/src/api/types/Email.ts +++ b/src/api/types/Email.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Email address. diff --git a/src/api/types/Enabled.ts b/src/api/types/Enabled.ts index beaf53ba..936af02b 100644 --- a/src/api/types/Enabled.ts +++ b/src/api/types/Enabled.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Toggles whether the section or element is enabled. diff --git a/src/api/types/EnrollmentStatus.ts b/src/api/types/EnrollmentStatus.ts index 44e1ed79..2fcbf11b 100644 --- a/src/api/types/EnrollmentStatus.ts +++ b/src/api/types/EnrollmentStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Enrollment status of vendor in payables program. diff --git a/src/api/types/EntityId.ts b/src/api/types/EntityId.ts index a7310c78..3cdb7a58 100644 --- a/src/api/types/EntityId.ts +++ b/src/api/types/EntityId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The entity's ID in Payabli. If the entity is a paypoint, this is the diff --git a/src/api/types/EntityType.ts b/src/api/types/EntityType.ts index 07b58fb0..c9b87129 100644 --- a/src/api/types/EntityType.ts +++ b/src/api/types/EntityType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The entity type. Available values: diff --git a/src/api/types/Entry.ts b/src/api/types/Entry.ts index f1471b37..67b331da 100644 --- a/src/api/types/Entry.ts +++ b/src/api/types/Entry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The entity's entrypoint identifier. [Learn more](/api-reference/api-overview#entrypoint-vs-entry) diff --git a/src/api/types/EntryAttributes.ts b/src/api/types/EntryAttributes.ts index 4630cae4..aaee99b7 100644 --- a/src/api/types/EntryAttributes.ts +++ b/src/api/types/EntryAttributes.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type EntryAttributes = string; diff --git a/src/api/types/EntrypageId.ts b/src/api/types/EntrypageId.ts index 7d046e04..5b8ede77 100644 --- a/src/api/types/EntrypageId.ts +++ b/src/api/types/EntrypageId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * If applicable, the internal reference ID to the payment page capturing the payment. diff --git a/src/api/types/Entrypointfield.ts b/src/api/types/Entrypointfield.ts index df8d8dd8..4873a427 100644 --- a/src/api/types/Entrypointfield.ts +++ b/src/api/types/Entrypointfield.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The entrypoint identifier. diff --git a/src/api/types/ExpectedDepositDate.ts b/src/api/types/ExpectedDepositDate.ts index ed9adbb2..549fccc6 100644 --- a/src/api/types/ExpectedDepositDate.ts +++ b/src/api/types/ExpectedDepositDate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The date the funds are expected to be deposited. diff --git a/src/api/types/ExpectedProcessingDateTime.ts b/src/api/types/ExpectedProcessingDateTime.ts index eda9b0d3..aec9cfd4 100644 --- a/src/api/types/ExpectedProcessingDateTime.ts +++ b/src/api/types/ExpectedProcessingDateTime.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The expected time that the refund will be processed. This value only appears when the `resultCode` is `10`, which means that the refund has been initiated and is queued for processing. See [Enhanced Refund Flow](/guides/pay-in-enhanced-refund-flow) for more information about refund processing. diff --git a/src/api/types/ExportFormat.ts b/src/api/types/ExportFormat.ts index dd0a6d6d..0897aeb3 100644 --- a/src/api/types/ExportFormat.ts +++ b/src/api/types/ExportFormat.ts @@ -1,18 +1,12 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Export format for file downloads. When specified, returns data as a file instead of JSON. - */ -export type ExportFormat = +/** Export format for file downloads. When specified, returns data as a file instead of JSON. */ +export const ExportFormat = { /** * Comma-separated values file */ - | "csv" + Csv: "csv", /** * Excel spreadsheet file */ - | "xlsx"; -export const ExportFormat = { - Csv: "csv", Xlsx: "xlsx", } as const; +export type ExportFormat = (typeof ExportFormat)[keyof typeof ExportFormat]; diff --git a/src/api/types/ExternalPaypointId.ts b/src/api/types/ExternalPaypointId.ts index 0b5f4b8b..6a51626b 100644 --- a/src/api/types/ExternalPaypointId.ts +++ b/src/api/types/ExternalPaypointId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A custom identifier for the paypoint, if applicable. Like `entrypoint` is the Payabli identifier for the merchant, `externalPaypointId` is a custom field you can use to include the merchant's ID from your own systems. diff --git a/src/api/types/ExternalProcessorInformation.ts b/src/api/types/ExternalProcessorInformation.ts index 91484835..4ae6f158 100644 --- a/src/api/types/ExternalProcessorInformation.ts +++ b/src/api/types/ExternalProcessorInformation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Processor information, used for troubleshooting and reporting. This field contains a value when the API key used to make the request has management permissions. diff --git a/src/api/types/FaxNumber.ts b/src/api/types/FaxNumber.ts index f9f9987b..9771a136 100644 --- a/src/api/types/FaxNumber.ts +++ b/src/api/types/FaxNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Fax number. diff --git a/src/api/types/FeeAmount.ts b/src/api/types/FeeAmount.ts index 12c550ac..f9aa8232 100644 --- a/src/api/types/FeeAmount.ts +++ b/src/api/types/FeeAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Service fee or sub-charge applied. diff --git a/src/api/types/FileContent.ts b/src/api/types/FileContent.ts index 3907bad4..e0ec5c98 100644 --- a/src/api/types/FileContent.ts +++ b/src/api/types/FileContent.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Contains details about a file. Max upload size is 30 MB. @@ -17,10 +15,7 @@ export interface FileContent { } export namespace FileContent { - /** - * The MIME type of the file (if content is provided) - */ - export type Ftype = "pdf" | "doc" | "docx" | "jpg" | "jpeg" | "png" | "gif" | "txt"; + /** The MIME type of the file (if content is provided) */ export const Ftype = { Pdf: "pdf", Doc: "doc", @@ -31,4 +26,5 @@ export namespace FileContent { Gif: "gif", Txt: "txt", } as const; + export type Ftype = (typeof Ftype)[keyof typeof Ftype]; } diff --git a/src/api/types/File_.ts b/src/api/types/File_.ts index 440ab244..cd7737a2 100644 --- a/src/api/types/File_.ts +++ b/src/api/types/File_.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A file containing the response data, in the format specified in the request. diff --git a/src/api/types/Finishtype.ts b/src/api/types/Finishtype.ts index aa0c424b..90fb9ddf 100644 --- a/src/api/types/Finishtype.ts +++ b/src/api/types/Finishtype.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface Finishtype { /** Flag to enable 'calendar' option */ diff --git a/src/api/types/ForceCustomerCreation.ts b/src/api/types/ForceCustomerCreation.ts index 911da5d9..b2583d79 100644 --- a/src/api/types/ForceCustomerCreation.ts +++ b/src/api/types/ForceCustomerCreation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer. Defaults to `false`. diff --git a/src/api/types/FreightAmount.ts b/src/api/types/FreightAmount.ts index 2032600b..79faf375 100644 --- a/src/api/types/FreightAmount.ts +++ b/src/api/types/FreightAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Freight/shipping amount. diff --git a/src/api/types/Frequency.ts b/src/api/types/Frequency.ts index f64dc93c..67de63ea 100644 --- a/src/api/types/Frequency.ts +++ b/src/api/types/Frequency.ts @@ -1,18 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Frequency for operation. - */ -export type Frequency = - | "one-time" - | "weekly" - | "every2weeks" - | "every6months" - | "monthly" - | "every3months" - | "annually"; +/** Frequency for operation. */ export const Frequency = { OneTime: "one-time", Weekly: "weekly", @@ -22,3 +10,4 @@ export const Frequency = { Every3Months: "every3months", Annually: "annually", } as const; +export type Frequency = (typeof Frequency)[keyof typeof Frequency]; diff --git a/src/api/types/FrequencyList.ts b/src/api/types/FrequencyList.ts index bc181242..246c07f1 100644 --- a/src/api/types/FrequencyList.ts +++ b/src/api/types/FrequencyList.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface FrequencyList { /** Enable or disable frequency */ diff --git a/src/api/types/Frequencynotification.ts b/src/api/types/Frequencynotification.ts index 7dc8e33e..7c8ac739 100644 --- a/src/api/types/Frequencynotification.ts +++ b/src/api/types/Frequencynotification.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Frequency for notification. @@ -18,16 +16,6 @@ * - `semiannually` * - `annually` */ -export type Frequencynotification = - | "one-time" - | "daily" - | "weekly" - | "biweekly" - | "monthly" - | "quarterly" - | "semiannually" - | "annually" - | "untilcancelled"; export const Frequencynotification = { OneTime: "one-time", Daily: "daily", @@ -39,3 +27,4 @@ export const Frequencynotification = { Annually: "annually", Untilcancelled: "untilcancelled", } as const; +export type Frequencynotification = (typeof Frequencynotification)[keyof typeof Frequencynotification]; diff --git a/src/api/types/Gatewayfield.ts b/src/api/types/Gatewayfield.ts index e38502c4..955ebd2f 100644 --- a/src/api/types/Gatewayfield.ts +++ b/src/api/types/Gatewayfield.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Gateway used to process the transaction. diff --git a/src/api/types/GeneralEvents.ts b/src/api/types/GeneralEvents.ts index e4aa73af..7b60be3b 100644 --- a/src/api/types/GeneralEvents.ts +++ b/src/api/types/GeneralEvents.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface GeneralEvents { /** Event description. */ diff --git a/src/api/types/GooglePayData.ts b/src/api/types/GooglePayData.ts index 06d60bf8..09286d8d 100644 --- a/src/api/types/GooglePayData.ts +++ b/src/api/types/GooglePayData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the status of the Google Pay service. diff --git a/src/api/types/GooglePayMetadata.ts b/src/api/types/GooglePayMetadata.ts index 429a2ff6..d11afa1f 100644 --- a/src/api/types/GooglePayMetadata.ts +++ b/src/api/types/GooglePayMetadata.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * This metadata appears only when the domain verification check fails. It gives more information about why the check failed. diff --git a/src/api/types/GooglePayPaypointRegistrationData.ts b/src/api/types/GooglePayPaypointRegistrationData.ts index 175c8bf4..4fe3f4c2 100644 --- a/src/api/types/GooglePayPaypointRegistrationData.ts +++ b/src/api/types/GooglePayPaypointRegistrationData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface GooglePayPaypointRegistrationData { entry?: Payabli.Entry; diff --git a/src/api/types/GooglePayStatusData.ts b/src/api/types/GooglePayStatusData.ts index 78985ac2..9282fd06 100644 --- a/src/api/types/GooglePayStatusData.ts +++ b/src/api/types/GooglePayStatusData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the Google Pay service status. diff --git a/src/api/types/GoogleWalletData.ts b/src/api/types/GoogleWalletData.ts index f363022f..60b8d866 100644 --- a/src/api/types/GoogleWalletData.ts +++ b/src/api/types/GoogleWalletData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The wallet data. diff --git a/src/api/types/HasVcardTransactions.ts b/src/api/types/HasVcardTransactions.ts index 9518bf2d..708e09ea 100644 --- a/src/api/types/HasVcardTransactions.ts +++ b/src/api/types/HasVcardTransactions.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type HasVcardTransactions = boolean | undefined; diff --git a/src/api/types/HeaderElement.ts b/src/api/types/HeaderElement.ts index d42ee41c..7ae2feeb 100644 --- a/src/api/types/HeaderElement.ts +++ b/src/api/types/HeaderElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface HeaderElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/Highticketamt.ts b/src/api/types/Highticketamt.ts index 3d956c19..6dd3f018 100644 --- a/src/api/types/Highticketamt.ts +++ b/src/api/types/Highticketamt.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * High ticket amount. diff --git a/src/api/types/Holdername.ts b/src/api/types/Holdername.ts index e5b1d349..72610f73 100644 --- a/src/api/types/Holdername.ts +++ b/src/api/types/Holdername.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Account holder name for the method. diff --git a/src/api/types/IdempotencyKey.ts b/src/api/types/IdempotencyKey.ts index a600be52..19f2dae2 100644 --- a/src/api/types/IdempotencyKey.ts +++ b/src/api/types/IdempotencyKey.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * _Optional but recommended_ A unique ID that you can include to prevent duplicating objects or transactions in the case that a request is sent more than once. This key isn't generated in Payabli, you must generate it yourself. This key persists for 2 minutes. After 2 minutes, you can reuse the key if needed. diff --git a/src/api/types/Identifierfields.ts b/src/api/types/Identifierfields.ts index 467f4484..38b61f00 100644 --- a/src/api/types/Identifierfields.ts +++ b/src/api/types/Identifierfields.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * List of fields acting as customer identifiers, to be used instead of CustomerNumber. diff --git a/src/api/types/Idpaypoint.ts b/src/api/types/Idpaypoint.ts index aeac2b3d..2f57b1b8 100644 --- a/src/api/types/Idpaypoint.ts +++ b/src/api/types/Idpaypoint.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Paypoint ID. diff --git a/src/api/types/Initiator.ts b/src/api/types/Initiator.ts index 881ebf95..be975cdb 100644 --- a/src/api/types/Initiator.ts +++ b/src/api/types/Initiator.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * **Strongly recommended** The cardholder-initiated transaction (CIT) or merchant-initiated transaction (MIT) indicator for the transaction. If you don't specify a value, Payabli defaults to `merchant`. diff --git a/src/api/types/Instrument.ts b/src/api/types/Instrument.ts index 8540c0dd..a0736e1d 100644 --- a/src/api/types/Instrument.ts +++ b/src/api/types/Instrument.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Instrument { achAccount: Payabli.Achaccount; diff --git a/src/api/types/InternalReferenceId.ts b/src/api/types/InternalReferenceId.ts index c86d7795..eb7e378c 100644 --- a/src/api/types/InternalReferenceId.ts +++ b/src/api/types/InternalReferenceId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Internal identifier for global vendor account. diff --git a/src/api/types/InvoiceAmount.ts b/src/api/types/InvoiceAmount.ts index 18c3b97c..73349e5f 100644 --- a/src/api/types/InvoiceAmount.ts +++ b/src/api/types/InvoiceAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Invoice total amount. diff --git a/src/api/types/InvoiceElement.ts b/src/api/types/InvoiceElement.ts index c3c6d694..5ae30fe9 100644 --- a/src/api/types/InvoiceElement.ts +++ b/src/api/types/InvoiceElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface InvoiceElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/InvoiceNumber.ts b/src/api/types/InvoiceNumber.ts index aec80d97..150f41e9 100644 --- a/src/api/types/InvoiceNumber.ts +++ b/src/api/types/InvoiceNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom number identifying the bill or invoice. Must be unique in paypoint. diff --git a/src/api/types/InvoiceType.ts b/src/api/types/InvoiceType.ts index b35e5c49..49b49784 100644 --- a/src/api/types/InvoiceType.ts +++ b/src/api/types/InvoiceType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Type of invoice. Only `0` for one-time invoices is currently supported. diff --git a/src/api/types/Invoicestatus.ts b/src/api/types/Invoicestatus.ts index 7b8152aa..57d1bc53 100644 --- a/src/api/types/Invoicestatus.ts +++ b/src/api/types/Invoicestatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Status for invoice. diff --git a/src/api/types/IpAddress.ts b/src/api/types/IpAddress.ts index 1e8184d4..b75dccf4 100644 --- a/src/api/types/IpAddress.ts +++ b/src/api/types/IpAddress.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * *Recommended*. The customer's IP address. This field is used to help prevent fraudulent transactions, and Payabli strongly recommends including this data. diff --git a/src/api/types/IsEnabled.ts b/src/api/types/IsEnabled.ts index 9a761e72..40a2662f 100644 --- a/src/api/types/IsEnabled.ts +++ b/src/api/types/IsEnabled.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the service is enabled. diff --git a/src/api/types/IsRoot.ts b/src/api/types/IsRoot.ts index cb773d76..45ac6c2f 100644 --- a/src/api/types/IsRoot.ts +++ b/src/api/types/IsRoot.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, indicates that this is the organization's root template. diff --git a/src/api/types/IsSameDayAch.ts b/src/api/types/IsSameDayAch.ts index 4551149b..afcc0696 100644 --- a/src/api/types/IsSameDayAch.ts +++ b/src/api/types/IsSameDayAch.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Indicates if the payout transaction is processed as Same Day ACH. This diff --git a/src/api/types/IsSuccess.ts b/src/api/types/IsSuccess.ts index 4d95e4c9..58f28b30 100644 --- a/src/api/types/IsSuccess.ts +++ b/src/api/types/IsSuccess.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. diff --git a/src/api/types/ItemCommodityCode.ts b/src/api/types/ItemCommodityCode.ts index 4b317d38..a8b0e705 100644 --- a/src/api/types/ItemCommodityCode.ts +++ b/src/api/types/ItemCommodityCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Item or product commodity code. Max length of 250 characters. diff --git a/src/api/types/ItemDescription.ts b/src/api/types/ItemDescription.ts index 1f5d5e52..af339b69 100644 --- a/src/api/types/ItemDescription.ts +++ b/src/api/types/ItemDescription.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Item or product description. Max length of 250 characters. diff --git a/src/api/types/ItemProductCode.ts b/src/api/types/ItemProductCode.ts index 183c2556..2653f3c7 100644 --- a/src/api/types/ItemProductCode.ts +++ b/src/api/types/ItemProductCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Item or product code. Max length of 250 characters. diff --git a/src/api/types/ItemProductName.ts b/src/api/types/ItemProductName.ts index 086db9b3..344b46b0 100644 --- a/src/api/types/ItemProductName.ts +++ b/src/api/types/ItemProductName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Item or product name. Max length of 250 characters. diff --git a/src/api/types/ItemUnitofMeasure.ts b/src/api/types/ItemUnitofMeasure.ts index 8a8561d8..d7a3bb99 100644 --- a/src/api/types/ItemUnitofMeasure.ts +++ b/src/api/types/ItemUnitofMeasure.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Unit of measurement. Max length of 100 characters. diff --git a/src/api/types/JobId.ts b/src/api/types/JobId.ts index ac3d05bf..23afa28d 100644 --- a/src/api/types/JobId.ts +++ b/src/api/types/JobId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The cascade process ID. diff --git a/src/api/types/JobStatus.ts b/src/api/types/JobStatus.ts index b913895a..1bee3668 100644 --- a/src/api/types/JobStatus.ts +++ b/src/api/types/JobStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The cascade process status. Available values: diff --git a/src/api/types/KeyValue.ts b/src/api/types/KeyValue.ts index 4ae0e711..8c2ebe51 100644 --- a/src/api/types/KeyValue.ts +++ b/src/api/types/KeyValue.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface KeyValue { /** Key name. */ diff --git a/src/api/types/KeyValueDuo.ts b/src/api/types/KeyValueDuo.ts index 9d6267e3..2cb3a18a 100644 --- a/src/api/types/KeyValueDuo.ts +++ b/src/api/types/KeyValueDuo.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface KeyValueDuo { /** Key name. */ diff --git a/src/api/types/LabelElement.ts b/src/api/types/LabelElement.ts index f63c9c2e..703474c4 100644 --- a/src/api/types/LabelElement.ts +++ b/src/api/types/LabelElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface LabelElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/Language.ts b/src/api/types/Language.ts index 7ec7e01a..1e572753 100644 --- a/src/api/types/Language.ts +++ b/src/api/types/Language.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The user's locale for PartnerHub and PayHub localization. Supported values: diff --git a/src/api/types/LastModified.ts b/src/api/types/LastModified.ts index ce8b7aec..e8211a9c 100644 --- a/src/api/types/LastModified.ts +++ b/src/api/types/LastModified.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timestamp of when record was last updated, in UTC. diff --git a/src/api/types/Legalname.ts b/src/api/types/Legalname.ts index fe14b324..bc1f0e91 100644 --- a/src/api/types/Legalname.ts +++ b/src/api/types/Legalname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business legal name. diff --git a/src/api/types/License.ts b/src/api/types/License.ts index c2321895..6c86fea7 100644 --- a/src/api/types/License.ts +++ b/src/api/types/License.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business license ID or state ID number. diff --git a/src/api/types/Licensestate.ts b/src/api/types/Licensestate.ts index c54ad3eb..9a0f2e19 100644 --- a/src/api/types/Licensestate.ts +++ b/src/api/types/Licensestate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business license issuing state or province. diff --git a/src/api/types/LineItem.ts b/src/api/types/LineItem.ts index ddd20913..465bb50a 100644 --- a/src/api/types/LineItem.ts +++ b/src/api/types/LineItem.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface LineItem { /** Array of tags classifying item or product. */ diff --git a/src/api/types/LineItemQueryRecord.ts b/src/api/types/LineItemQueryRecord.ts index 4327b104..0c3a49f3 100644 --- a/src/api/types/LineItemQueryRecord.ts +++ b/src/api/types/LineItemQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface LineItemQueryRecord { /** Timestamp of when line item was created, in UTC. */ diff --git a/src/api/types/LinkData.ts b/src/api/types/LinkData.ts index 69579b7b..3245c991 100644 --- a/src/api/types/LinkData.ts +++ b/src/api/types/LinkData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface LinkData { ro?: Payabli.ReadOnly | undefined; diff --git a/src/api/types/LinkRow.ts b/src/api/types/LinkRow.ts index d87b5e1b..19b662dd 100644 --- a/src/api/types/LinkRow.ts +++ b/src/api/types/LinkRow.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface LinkRow { columns?: Payabli.LinkData[]; diff --git a/src/api/types/LocationCode.ts b/src/api/types/LocationCode.ts index dd6dfa6f..30f6d99c 100644 --- a/src/api/types/LocationCode.ts +++ b/src/api/types/LocationCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A location code used to identify the vendor's location. diff --git a/src/api/types/Maddress.ts b/src/api/types/Maddress.ts index 51ffc90f..f4d3a7ce 100644 --- a/src/api/types/Maddress.ts +++ b/src/api/types/Maddress.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business's mailing address. diff --git a/src/api/types/Maddress1.ts b/src/api/types/Maddress1.ts index 1a3a3b2c..2f42c01f 100644 --- a/src/api/types/Maddress1.ts +++ b/src/api/types/Maddress1.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Additional line for the business's mailing address. diff --git a/src/api/types/Maskedaccount.ts b/src/api/types/Maskedaccount.ts index d15ead36..2c2ca0e5 100644 --- a/src/api/types/Maskedaccount.ts +++ b/src/api/types/Maskedaccount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Masked card or bank account used in transaction. In the case of Apple Pay, this is a masked DPAN (device primary account number). diff --git a/src/api/types/Mcc.ts b/src/api/types/Mcc.ts index 74b8926f..d7dea5d4 100644 --- a/src/api/types/Mcc.ts +++ b/src/api/types/Mcc.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business Merchant Category Code (MCC). [This resource](https://github.com/greggles/mcc-codes/blob/main/mcc_codes.csv) lists MCC codes. diff --git a/src/api/types/Mcity.ts b/src/api/types/Mcity.ts index 5dd6c5da..4f874431 100644 --- a/src/api/types/Mcity.ts +++ b/src/api/types/Mcity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business's mail city. diff --git a/src/api/types/Mcountry.ts b/src/api/types/Mcountry.ts index 4b7cc9e3..1621467c 100644 --- a/src/api/types/Mcountry.ts +++ b/src/api/types/Mcountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business mailing country. diff --git a/src/api/types/MethodElement.ts b/src/api/types/MethodElement.ts index 11f3f7fe..725c3d3f 100644 --- a/src/api/types/MethodElement.ts +++ b/src/api/types/MethodElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface MethodElement { /** Flag indicating if all allowed payment methods will be pre-selected. */ @@ -35,32 +33,14 @@ export namespace MethodElement { } export namespace ApplePay { - /** - * The Apple Pay button style. See [Apple Pay Button Style](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-button-style) for more information. - */ - export type ButtonStyle = "black" | "white-outline" | "white"; + /** The Apple Pay button style. See [Apple Pay Button Style](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-button-style) for more information. */ export const ButtonStyle = { Black: "black", WhiteOutline: "white-outline", White: "white", } as const; - /** - * The text on Apple Pay button. See [Apple Pay Button Type](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-button-type) for more information. - */ - export type ButtonType = - | "plain" - | "buy" - | "donate" - | "check-out" - | "book" - | "continue" - | "top-up" - | "order" - | "rent" - | "support" - | "contribute" - | "tip" - | "pay"; + export type ButtonStyle = (typeof ButtonStyle)[keyof typeof ButtonStyle]; + /** The text on Apple Pay button. See [Apple Pay Button Type](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-button-type) for more information. */ export const ButtonType = { Plain: "plain", Buy: "buy", @@ -76,49 +56,8 @@ export namespace MethodElement { Tip: "tip", Pay: "pay", } as const; - /** - * The Apple Pay button locale. See [Apple Pay Button Language](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-language) for more information. - */ - export type Language = - | "en-US" - | "ar-AB" - | "ca-ES" - | "zh-CN" - | "zh-HK" - | "zh-TW" - | "hr-HR" - | "cs-CZ" - | "da-DK" - | "de-DE" - | "nl-NL" - | "en-AU" - | "en-GB" - | "fi-FI" - | "fr-CA" - | "fr-FR" - | "el-GR" - | "he-IL" - | "hi-IN" - | "hu-HU" - | "id-ID" - | "it-IT" - | "ja-JP" - | "ko-KR" - | "ms-MY" - | "nb-NO" - | "pl-PL" - | "pt-BR" - | "pt-PT" - | "ro-RO" - | "ru-RU" - | "sk-SK" - | "es-MX" - | "es-ES" - | "sv-SE" - | "th-TH" - | "tr-TR" - | "uk-UA" - | "vi-VN"; + export type ButtonType = (typeof ButtonType)[keyof typeof ButtonType]; + /** The Apple Pay button locale. See [Apple Pay Button Language](/developers/developer-guides/hosted-payment-page-apple-pay#param-applepay-language) for more information. */ export const Language = { EnUs: "en-US", ArAb: "ar-AB", @@ -160,6 +99,7 @@ export namespace MethodElement { UkUa: "uk-UA", ViVn: "vi-VN", } as const; + export type Language = (typeof Language)[keyof typeof Language]; } } } diff --git a/src/api/types/MethodQueryRecords.ts b/src/api/types/MethodQueryRecords.ts index 9ace926c..0a89bee5 100644 --- a/src/api/types/MethodQueryRecords.ts +++ b/src/api/types/MethodQueryRecords.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface MethodQueryRecords { /** The bank identification number (BIN). Null when method is ACH. */ diff --git a/src/api/types/MethodReferenceId.ts b/src/api/types/MethodReferenceId.ts index 81a14824..4a6b1bba 100644 --- a/src/api/types/MethodReferenceId.ts +++ b/src/api/types/MethodReferenceId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The stored method's identifier (sometimes referred to as 'token') in Payabli. When `null`, the method wasn't created, or doesn't exist, depending on the operation performed. diff --git a/src/api/types/Methodall.ts b/src/api/types/Methodall.ts index babe1928..9467eca1 100644 --- a/src/api/types/Methodall.ts +++ b/src/api/types/Methodall.ts @@ -1,11 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Method to use for the transaction. - */ -export type Methodall = "card" | "ach" | "cloud" | "check" | "cash"; +/** Method to use for the transaction. */ export const Methodall = { Card: "card", Ach: "ach", @@ -13,3 +8,4 @@ export const Methodall = { Check: "check", Cash: "cash", } as const; +export type Methodall = (typeof Methodall)[keyof typeof Methodall]; diff --git a/src/api/types/Methodnotification.ts b/src/api/types/Methodnotification.ts index 2cf0c84f..d26c3248 100644 --- a/src/api/types/Methodnotification.ts +++ b/src/api/types/Methodnotification.ts @@ -1,11 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Method to use to send the notification to the target. - */ -export type Methodnotification = "email" | "sms" | "web" | "report-email" | "report-web"; +/** Method to use to send the notification to the target. */ export const Methodnotification = { Email: "email", Sms: "sms", @@ -13,3 +8,4 @@ export const Methodnotification = { ReportEmail: "report-email", ReportWeb: "report-web", } as const; +export type Methodnotification = (typeof Methodnotification)[keyof typeof Methodnotification]; diff --git a/src/api/types/MethodsList.ts b/src/api/types/MethodsList.ts index be19d610..db5db9d2 100644 --- a/src/api/types/MethodsList.ts +++ b/src/api/types/MethodsList.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface MethodsList { /** When `true`, American Express is accepted. */ diff --git a/src/api/types/Mfa.ts b/src/api/types/Mfa.ts index 40d52069..1113ed85 100644 --- a/src/api/types/Mfa.ts +++ b/src/api/types/Mfa.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, multi-factor authentication (MFA) is enabled. diff --git a/src/api/types/MfaData.ts b/src/api/types/MfaData.ts index 37d702cc..aa981d58 100644 --- a/src/api/types/MfaData.ts +++ b/src/api/types/MfaData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface MfaData { mfa?: boolean; diff --git a/src/api/types/MfaMode.ts b/src/api/types/MfaMode.ts index 89d62435..537dbcd6 100644 --- a/src/api/types/MfaMode.ts +++ b/src/api/types/MfaMode.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type MfaMode = number; diff --git a/src/api/types/MfaValidationCode.ts b/src/api/types/MfaValidationCode.ts index 7e14662c..1fa875f7 100644 --- a/src/api/types/MfaValidationCode.ts +++ b/src/api/types/MfaValidationCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The validation code for multi-factor authentication, typically a hash or similar encrypted format. diff --git a/src/api/types/Mstate.ts b/src/api/types/Mstate.ts index 8c41fbd8..be6ba500 100644 --- a/src/api/types/Mstate.ts +++ b/src/api/types/Mstate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business's mailing address state. diff --git a/src/api/types/Mzip.ts b/src/api/types/Mzip.ts index 324c6e70..5d2e2823 100644 --- a/src/api/types/Mzip.ts +++ b/src/api/types/Mzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business mailing ZIP. diff --git a/src/api/types/NameUser.ts b/src/api/types/NameUser.ts index 5038567e..129cb7b9 100644 --- a/src/api/types/NameUser.ts +++ b/src/api/types/NameUser.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type NameUser = string; diff --git a/src/api/types/NetAmountstring.ts b/src/api/types/NetAmountstring.ts index ce831a9a..365a655a 100644 --- a/src/api/types/NetAmountstring.ts +++ b/src/api/types/NetAmountstring.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Net Amount owed in bill. Required when adding a bill. diff --git a/src/api/types/Netamountnullable.ts b/src/api/types/Netamountnullable.ts index 22e201fc..a61259a9 100644 --- a/src/api/types/Netamountnullable.ts +++ b/src/api/types/Netamountnullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Net amount. diff --git a/src/api/types/NoteElement.ts b/src/api/types/NoteElement.ts index 9431b804..a5643c6a 100644 --- a/src/api/types/NoteElement.ts +++ b/src/api/types/NoteElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface NoteElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/NotificationContent.ts b/src/api/types/NotificationContent.ts index eec4db57..b694ab64 100644 --- a/src/api/types/NotificationContent.ts +++ b/src/api/types/NotificationContent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface NotificationContent { /** The notification's event name. */ @@ -24,89 +22,7 @@ export interface NotificationContent { } export namespace NotificationContent { - /** - * The notification's event name. - */ - export type EventType = - | "ApprovedPayment" - | "AuthorizedPayment" - | "DeclinedPayment" - | "OriginatedPayment" - | "SettledPayment" - | "SubscriptionCreated" - | "SubscriptionUpdated" - | "SubscriptionCanceled" - | "SubscriptionCompleted" - | "FundedPayment" - | "VoidedPayment" - | "RefundedPayment" - | "HoldTransaction" - | "ReleasedTransaction" - | "HoldBatch" - | "ReleasedBatch" - | "TransferDisabledCreditFund" - | "TransferDisabledDebitFund" - | "TransferNotAvailableBalance" - | "TransferReturn" - | "TransferSuccess" - | "TransferSuspended" - | "TransferError" - | "SendReceipt" - | "RecoveredTransaction" - | "CreatedApplication" - | "ApprovedApplication" - | "FailedBoardingApplication" - | "SubmittedApplication" - | "UnderWritingApplication" - | "ActivatedMerchant" - | "ReceivedChargeBack" - | "ChargebackUpdated" - | "ReceivedRetrieval" - | "RetrievalUpdated" - | "ReceivedAchReturn" - | "HoldingApplication" - | "DeclinedApplication" - | "BoardingApplication" - | "FraudAlert" - | "InvoiceSent" - | "InvoicePaid" - | "InvoiceCreated" - | "BillPaid" - | "BillApproved" - | "BillDisApproved" - | "BillCanceled" - | "BillProcessing" - | "CardCreated" - | "CardActivated" - | "CardDeactivated" - | "CardExpired" - | "CardExpiring" - | "CardLimitUpdated" - | "BatchClosed" - | "BatchNotClosed" - | "PayOutFunded" - | "PayOutProcessed" - | "PayOutCanceled" - | "PayOutPaid" - | "PayOutReturned" - | "PayoutSubscriptionCreated" - | "PayoutSubscriptionUpdated" - | "PayoutSubscriptionCanceled" - | "PayoutSubscriptionCompleted" - | "PayoutSubscriptionReminder" - | "importFileReceived" - | "importFileProcessed" - | "importFileError" - | "exportFileSent" - | "exportFileError" - | "FailedEmailNotification" - | "FailedWebNotification" - | "FailedSMSNotification" - | "UserPasswordExpiring" - | "UserPasswordExpired" - | "TransactionNotFound" - | "SystemAlert" - | "Report"; + /** The notification's event name. */ export const EventType = { ApprovedPayment: "ApprovedPayment", AuthorizedPayment: "AuthorizedPayment", @@ -188,24 +104,23 @@ export namespace NotificationContent { SystemAlert: "SystemAlert", Report: "Report", } as const; + export type EventType = (typeof EventType)[keyof typeof EventType]; /** * Indicate the format of report file to be generated by the engine. * Used for `method` = *report-email* and *report-web*. */ - export type FileFormat = "json" | "csv" | "xlsx"; export const FileFormat = { Json: "json", Csv: "csv", Xlsx: "xlsx", } as const; - /** - * The kind report to generate. For [automated reports](/developers/developer-guides/notifications-and-webhooks-overview#automated-reports) only. - */ - export type ReportName = "Transaction" | "Settlement" | "Boarding" | "Returned"; + export type FileFormat = (typeof FileFormat)[keyof typeof FileFormat]; + /** The kind report to generate. For [automated reports](/developers/developer-guides/notifications-and-webhooks-overview#automated-reports) only. */ export const ReportName = { Transaction: "Transaction", Settlement: "Settlement", Boarding: "Boarding", Returned: "Returned", } as const; + export type ReportName = (typeof ReportName)[keyof typeof ReportName]; } diff --git a/src/api/types/NotificationId.ts b/src/api/types/NotificationId.ts index 535eaab4..f93b2fa5 100644 --- a/src/api/types/NotificationId.ts +++ b/src/api/types/NotificationId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The notification's Payabli identifier. This is the ID used to manage the notification. diff --git a/src/api/types/NotificationQueryRecord.ts b/src/api/types/NotificationQueryRecord.ts index 7a531e44..7820bd69 100644 --- a/src/api/types/NotificationQueryRecord.ts +++ b/src/api/types/NotificationQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface NotificationQueryRecord { /** Notification content. */ diff --git a/src/api/types/NotificationReportRequest.ts b/src/api/types/NotificationReportRequest.ts index 6b0219a8..f22d51c9 100644 --- a/src/api/types/NotificationReportRequest.ts +++ b/src/api/types/NotificationReportRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about the report notification configuration (report-email, report-web). @@ -43,36 +41,23 @@ export namespace NotificationReportRequest { } export namespace Content { - /** - * Indicate the format of report file to be generated by the engine. - */ - export type FileFormat = "json" | "csv" | "xlsx"; + /** Indicate the format of report file to be generated by the engine. */ export const FileFormat = { Json: "json", Csv: "csv", Xlsx: "xlsx", } as const; - /** - * The kind report to generate. - */ - export type ReportName = "Transaction" | "Settlement" | "Boarding" | "Returned"; + export type FileFormat = (typeof FileFormat)[keyof typeof FileFormat]; + /** The kind report to generate. */ export const ReportName = { Transaction: "Transaction", Settlement: "Settlement", Boarding: "Boarding", Returned: "Returned", } as const; + export type ReportName = (typeof ReportName)[keyof typeof ReportName]; } - export type Frequency = - | "one-time" - | "daily" - | "weekly" - | "biweekly" - | "monthly" - | "quarterly" - | "semiannually" - | "annually"; export const Frequency = { OneTime: "one-time", Daily: "daily", @@ -83,12 +68,11 @@ export namespace NotificationReportRequest { Semiannually: "semiannually", Annually: "annually", } as const; - /** - * Automated reporting lets you gather critical reports without manually filtering and exporting the data. Get automated daily, weekly, and monthly report for daily sales, ACH returns, settlements, and more. You can send these reports via email or via webhook. See [Automated Reports](/developers/developer-guides/notifications-and-webhooks-overview#automated-reports) for more. - */ - export type Method = "report-email" | "report-web"; + export type Frequency = (typeof Frequency)[keyof typeof Frequency]; + /** Automated reporting lets you gather critical reports without manually filtering and exporting the data. Get automated daily, weekly, and monthly report for daily sales, ACH returns, settlements, and more. You can send these reports via email or via webhook. See [Automated Reports](/developers/developer-guides/notifications-and-webhooks-overview#automated-reports) for more. */ export const Method = { ReportEmail: "report-email", ReportWeb: "report-web", } as const; + export type Method = (typeof Method)[keyof typeof Method]; } diff --git a/src/api/types/NotificationStandardRequest.ts b/src/api/types/NotificationStandardRequest.ts index 852e1747..438b6fb1 100644 --- a/src/api/types/NotificationStandardRequest.ts +++ b/src/api/types/NotificationStandardRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about the standard notification configuration (email, sms, web). @@ -38,168 +36,7 @@ export namespace NotificationStandardRequest { } export namespace Content { - /** - * The notification's event name. - */ - export type EventType = - | "payin_transaction_initiated" - | "payin_transaction_authorized" - | "payin_transaction_approvedcaptured" - | "payin_transaction_declined" - | "payin_transaction_technicaldecline" - | "payin_transaction_failed" - | "payin_transaction_error" - | "payin_transaction_paid" - | "payin_transaction_returned" - | "payin_transaction_rejected" - | "payin_transaction_voidedcancelled" - | "payin_transaction_processing" - | "payin_transaction_processed" - | "payin_transaction_onhold" - | "payin_transaction_released" - | "payin_transaction_recovered" - | "payout_transaction_initiated" - | "payout_transaction_authorized" - | "payout_transaction_approvedcaptured" - | "payout_transaction_declined" - | "payout_transaction_technicaldecline" - | "payout_transaction_failed" - | "payout_transaction_error" - | "payout_transaction_paid" - | "payout_transaction_returned" - | "payout_transaction_rejected" - | "payout_transaction_voidedcancelled" - | "payout_transaction_processing" - | "payout_transaction_processed" - | "payout_transaction_onhold" - | "payout_transaction_released" - | "payout_transaction_recovered" - | "payin_batch_open" - | "payin_batch_onhold" - | "payin_batch_released" - | "payin_batch_processed" - | "payin_batch_paid" - | "payin_batch_funded" - | "payin_batch_closed" - | "payin_batch_notclosed" - | "payin_batch_fundpending" - | "payin_batch_cancelled" - | "payin_batch_transferred" - | "payin_batch_resolved" - | "payout_batch_open" - | "payout_batch_onhold" - | "payout_batch_released" - | "payout_batch_processed" - | "payout_batch_paid" - | "payout_batch_funded" - | "payout_batch_closed" - | "payout_batch_notclosed" - | "payout_batch_fundpending" - | "payout_batch_cancelled" - | "payout_batch_transferred" - | "payout_batch_resolved" - | "payin_batch_settlement_pending" - | "payin_batch_settlement_intransit" - | "payin_batch_settlement_transferred" - | "payin_batch_settlement_funded" - | "payin_batch_settlement_resolved" - | "payin_batch_settlement_exception" - | "payin_batch_settlement_achreturn" - | "payin_batch_settlement_held" - | "payin_batch_settlement_released" - | "payout_batch_settlement_pending" - | "payout_batch_settlement_intransit" - | "payout_batch_settlement_transferred" - | "payout_batch_settlement_funded" - | "payout_batch_settlement_resolved" - | "payout_batch_settlement_exception" - | "payout_batch_settlement_achreturn" - | "payout_batch_settlement_held" - | "payout_batch_settlement_released" - | "ApprovedPayment" - | "AuthorizedPayment" - | "DeclinedPayment" - | "OriginatedPayment" - | "SettledPayment" - | "SubscriptionCreated" - | "SubscriptionUpdated" - | "SubscriptionCanceled" - | "SubscriptionCompleted" - | "FundedPayment" - | "VoidedPayment" - | "RefundedPayment" - | "HoldTransaction" - | "ReleasedTransaction" - | "HoldBatch" - | "ReleasedBatch" - | "TransferAdjusted" - | "TransferDisabledCreditFund" - | "TransferDisabledDebitFund" - | "TransferNotAvailableBalance" - | "TransferReadyforRetry" - | "TransferResolved" - | "TransferReturn" - | "TransferSuccess" - | "TransferSuspended" - | "TransferError" - | "SendReceipt" - | "RecoveredTransaction" - | "CreatedApplication" - | "ApprovedApplication" - | "FailedBoardingApplication" - | "SubmittedApplication" - | "UnderWritingApplication" - | "ActivatedMerchant" - | "ReceivedChargeBack" - | "ChargebackUpdated" - | "ReceivedRetrieval" - | "RetrievalUpdated" - | "ReceivedAchReturn" - | "HoldingApplication" - | "DeclinedApplication" - | "BoardingApplication" - | "PaypointMoved" - | "FraudAlert" - | "InvoiceSent" - | "InvoicePaid" - | "InvoiceCreated" - | "BillPaid" - | "BillApproved" - | "BillDisApproved" - | "BillCanceled" - | "BillProcessing" - | "CardCreated" - | "CardActivated" - | "CardDeactivated" - | "CardExpired" - | "CardExpiring" - | "CardLimitUpdated" - | "BatchClosed" - | "BatchNotClosed" - | "PayOutFunded" - | "PayOutProcessed" - | "PayOutCanceled" - | "PayOutPaid" - | "PayOutReturned" - | "PayoutSubscriptionCreated" - | "PayoutSubscriptionUpdated" - | "PayoutSubscriptionCanceled" - | "PayoutSubscriptionCompleted" - | "PayoutSubscriptionReminder" - | "importFileReceived" - | "importFileProcessed" - | "importFileError" - | "exportFileSent" - | "exportFileError" - | "UpdatedMerchant" - | "Report" - | "FailedEmailNotification" - | "FailedWebNotification" - | "FailedSMSNotification" - | "UserPasswordExpiring" - | "UserPasswordExpired" - | "TransactionNotFound" - | "SystemAlert"; + /** The notification's event name. */ export const EventType = { PayinTransactionInitiated: "payin_transaction_initiated", PayinTransactionAuthorized: "payin_transaction_authorized", @@ -360,20 +197,19 @@ export namespace NotificationStandardRequest { TransactionNotFound: "TransactionNotFound", SystemAlert: "SystemAlert", } as const; + export type EventType = (typeof EventType)[keyof typeof EventType]; } - export type Frequency = "one-time" | "untilcancelled"; export const Frequency = { OneTime: "one-time", Untilcancelled: "untilcancelled", } as const; - /** - * Get near-instant notifications via email, SMS, or webhooks for important events like new payment disputes, merchant activations, fraud alerts, approved transactions, settlement history, vendor payouts, and more. Use webhooks with notifications to get real-time updates and automate operations based on key those key events. See [Notifications](/developers/developer-guides/notifications-and-webhooks-overview#notifications) for more. - */ - export type Method = "email" | "sms" | "web"; + export type Frequency = (typeof Frequency)[keyof typeof Frequency]; + /** Get near-instant notifications via email, SMS, or webhooks for important events like new payment disputes, merchant activations, fraud alerts, approved transactions, settlement history, vendor payouts, and more. Use webhooks with notifications to get real-time updates and automate operations based on key those key events. See [Notifications](/developers/developer-guides/notifications-and-webhooks-overview#notifications) for more. */ export const Method = { Email: "email", Sms: "sms", Web: "web", } as const; + export type Method = (typeof Method)[keyof typeof Method]; } diff --git a/src/api/types/OList.ts b/src/api/types/OList.ts index 6311d955..655681fb 100644 --- a/src/api/types/OList.ts +++ b/src/api/types/OList.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OList { oaddress?: Payabli.LinkData; diff --git a/src/api/types/OSection.ts b/src/api/types/OSection.ts index 6b56d650..695e6a70 100644 --- a/src/api/types/OSection.ts +++ b/src/api/types/OSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OSection { contact_list?: Payabli.CList; diff --git a/src/api/types/OdpSetup.ts b/src/api/types/OdpSetup.ts index 127f71e0..4002ae19 100644 --- a/src/api/types/OdpSetup.ts +++ b/src/api/types/OdpSetup.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface OdpSetup { /** Enables or disables ACH payout functionality */ @@ -18,12 +16,10 @@ export interface OdpSetup { } export namespace OdpSetup { - /** - * Region where payment processing occurs - */ - export type ProcessingRegion = "US" | "CA"; + /** Region where payment processing occurs */ export const ProcessingRegion = { Us: "US", Ca: "CA", } as const; + export type ProcessingRegion = (typeof ProcessingRegion)[keyof typeof ProcessingRegion]; } diff --git a/src/api/types/Operation.ts b/src/api/types/Operation.ts index 81be5190..03f8204e 100644 --- a/src/api/types/Operation.ts +++ b/src/api/types/Operation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The transaction's operation. diff --git a/src/api/types/OptinStatus.ts b/src/api/types/OptinStatus.ts index 177b8535..3f4bb152 100644 --- a/src/api/types/OptinStatus.ts +++ b/src/api/types/OptinStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Customer's consent status. diff --git a/src/api/types/Order.ts b/src/api/types/Order.ts index 8847fc34..7f3d9806 100644 --- a/src/api/types/Order.ts +++ b/src/api/types/Order.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Order of element or section in container. diff --git a/src/api/types/OrderId.ts b/src/api/types/OrderId.ts index 6825a607..673bfd77 100644 --- a/src/api/types/OrderId.ts +++ b/src/api/types/OrderId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom identifier for the transaction. diff --git a/src/api/types/Orderdescription.ts b/src/api/types/Orderdescription.ts index 30a8d504..ab2fe5b3 100644 --- a/src/api/types/Orderdescription.ts +++ b/src/api/types/Orderdescription.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Text description of the transaction. diff --git a/src/api/types/OrgData.ts b/src/api/types/OrgData.ts index 57a6d5a8..fb054d29 100644 --- a/src/api/types/OrgData.ts +++ b/src/api/types/OrgData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OrgData { idOrg?: Payabli.Orgid; diff --git a/src/api/types/OrgParentId.ts b/src/api/types/OrgParentId.ts index 3c7c437f..a7407358 100644 --- a/src/api/types/OrgParentId.ts +++ b/src/api/types/OrgParentId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The ID of the org's parent organization. diff --git a/src/api/types/OrgParentName.ts b/src/api/types/OrgParentName.ts index 81ee561e..60c4a952 100644 --- a/src/api/types/OrgParentName.ts +++ b/src/api/types/OrgParentName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The name of the parent organization. diff --git a/src/api/types/OrgScope.ts b/src/api/types/OrgScope.ts index 4f4a4abb..e4b0f7fc 100644 --- a/src/api/types/OrgScope.ts +++ b/src/api/types/OrgScope.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OrgScope { orgId?: Payabli.Orgid; diff --git a/src/api/types/OrgXScope.ts b/src/api/types/OrgXScope.ts index 4ee41ef9..bbe01fb1 100644 --- a/src/api/types/OrgXScope.ts +++ b/src/api/types/OrgXScope.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OrgXScope { orgEntry?: Payabli.Orgentryname; diff --git a/src/api/types/Orgaddress.ts b/src/api/types/Orgaddress.ts index 0cb4f721..8dda775b 100644 --- a/src/api/types/Orgaddress.ts +++ b/src/api/types/Orgaddress.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's address. diff --git a/src/api/types/OrganizationId.ts b/src/api/types/OrganizationId.ts index 9f2f5e1b..def5fe80 100644 --- a/src/api/types/OrganizationId.ts +++ b/src/api/types/OrganizationId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Organization ID for the target organization. diff --git a/src/api/types/OrganizationQueryRecord.ts b/src/api/types/OrganizationQueryRecord.ts index e96107b3..ca73e95a 100644 --- a/src/api/types/OrganizationQueryRecord.ts +++ b/src/api/types/OrganizationQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OrganizationQueryRecord { services?: OrganizationQueryRecord.Services.Item[]; diff --git a/src/api/types/OrganizationUpdates.ts b/src/api/types/OrganizationUpdates.ts index 993a2036..792f356c 100644 --- a/src/api/types/OrganizationUpdates.ts +++ b/src/api/types/OrganizationUpdates.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface OrganizationUpdates { cascade?: Payabli.WalletCascade; diff --git a/src/api/types/Orgcity.ts b/src/api/types/Orgcity.ts index 066e2109..dfee93b1 100644 --- a/src/api/types/Orgcity.ts +++ b/src/api/types/Orgcity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's city. diff --git a/src/api/types/Orgcountry.ts b/src/api/types/Orgcountry.ts index 3f566d3c..5b9379df 100644 --- a/src/api/types/Orgcountry.ts +++ b/src/api/types/Orgcountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's country. diff --git a/src/api/types/Orgentryname.ts b/src/api/types/Orgentryname.ts index 8ff2f25c..36d3ad2f 100644 --- a/src/api/types/Orgentryname.ts +++ b/src/api/types/Orgentryname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The entryname for the org, in string format. If you leave this blank, Payabli uses the DBA name. diff --git a/src/api/types/Orgid.ts b/src/api/types/Orgid.ts index 2512f571..496a87ba 100644 --- a/src/api/types/Orgid.ts +++ b/src/api/types/Orgid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Organization ID. Unique identifier assigned to an org by Payabli. diff --git a/src/api/types/Orgidstring.ts b/src/api/types/Orgidstring.ts index 6cfcae45..7bd22eeb 100644 --- a/src/api/types/Orgidstring.ts +++ b/src/api/types/Orgidstring.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * An alternate ID for the organization, in string format. This can be your internal identifier for an org, and is typically a name, like "My Suborganization". diff --git a/src/api/types/Orgname.ts b/src/api/types/Orgname.ts index d261a8e1..d4385c01 100644 --- a/src/api/types/Orgname.ts +++ b/src/api/types/Orgname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The name of the organization. diff --git a/src/api/types/Orgstate.ts b/src/api/types/Orgstate.ts index 82cb88c0..a97c0d00 100644 --- a/src/api/types/Orgstate.ts +++ b/src/api/types/Orgstate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's state. diff --git a/src/api/types/Orgtimezone.ts b/src/api/types/Orgtimezone.ts index 8731b72f..c690838d 100644 --- a/src/api/types/Orgtimezone.ts +++ b/src/api/types/Orgtimezone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The org's timezone, in UTC offset. For example, -5 is Eastern time. diff --git a/src/api/types/Orgtype.ts b/src/api/types/Orgtype.ts index de2bcd44..d351a2ff 100644 --- a/src/api/types/Orgtype.ts +++ b/src/api/types/Orgtype.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization type. Currently, this must be `0`. diff --git a/src/api/types/Orgwebsite.ts b/src/api/types/Orgwebsite.ts index 09374c84..37aaa31e 100644 --- a/src/api/types/Orgwebsite.ts +++ b/src/api/types/Orgwebsite.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's website. diff --git a/src/api/types/Orgzip.ts b/src/api/types/Orgzip.ts index b9810fe1..5891e1d8 100644 --- a/src/api/types/Orgzip.ts +++ b/src/api/types/Orgzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The organization's ZIP code. diff --git a/src/api/types/OwnType.ts b/src/api/types/OwnType.ts index 8e71f5bf..f4bd3729 100644 --- a/src/api/types/OwnType.ts +++ b/src/api/types/OwnType.ts @@ -1,19 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * The business ownership type. - */ -export type OwnType = - | "Limited Liability Company" - | "Non-Profit Org" - | "Partnership" - | "Private Corp" - | "Public Corp" - | "Tax Exempt" - | "Government" - | "Sole Proprietor"; +/** The business ownership type. */ export const OwnType = { LimitedLiabilityCompany: "Limited Liability Company", NonProfitOrg: "Non-Profit Org", @@ -24,3 +11,4 @@ export const OwnType = { Government: "Government", SoleProprietor: "Sole Proprietor", } as const; +export type OwnType = (typeof OwnType)[keyof typeof OwnType]; diff --git a/src/api/types/OwnerEntityId.ts b/src/api/types/OwnerEntityId.ts index 1fd6270d..98c72581 100644 --- a/src/api/types/OwnerEntityId.ts +++ b/src/api/types/OwnerEntityId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The domain's owning entity's ID in Payabli. This value might be different than the `entityId`, depending on whether the domain is cascaded and whether it's inherited.` diff --git a/src/api/types/OwnerEntityType.ts b/src/api/types/OwnerEntityType.ts index cc67b029..a585080a 100644 --- a/src/api/types/OwnerEntityType.ts +++ b/src/api/types/OwnerEntityType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The domain's owner's entity type. Available values: diff --git a/src/api/types/Ownerid.ts b/src/api/types/Ownerid.ts index 38bc4669..de72ff21 100644 --- a/src/api/types/Ownerid.ts +++ b/src/api/types/Ownerid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ID for the paypoint or organization that owns the notification. diff --git a/src/api/types/Owners.ts b/src/api/types/Owners.ts index d148c7d3..916f8ffb 100644 --- a/src/api/types/Owners.ts +++ b/src/api/types/Owners.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface Owners { /** Person who is registered as the beneficial owner of the business. This is a combination of first and last name. */ diff --git a/src/api/types/OwnersSection.ts b/src/api/types/OwnersSection.ts index b47cb4f2..cb6b72ce 100644 --- a/src/api/types/OwnersSection.ts +++ b/src/api/types/OwnersSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about a business owner. diff --git a/src/api/types/Ownership.ts b/src/api/types/Ownership.ts index d12e9b11..683d248a 100644 --- a/src/api/types/Ownership.ts +++ b/src/api/types/Ownership.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * List of Owners with at least a 25% ownership. diff --git a/src/api/types/Ownertype.ts b/src/api/types/Ownertype.ts index e1b3cded..36e63f0b 100644 --- a/src/api/types/Ownertype.ts +++ b/src/api/types/Ownertype.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Entity owner type. Accepted values: diff --git a/src/api/types/PSection.ts b/src/api/types/PSection.ts index 8176f908..f8189315 100644 --- a/src/api/types/PSection.ts +++ b/src/api/types/PSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PSection { avgmonthly?: Payabli.LinkData; diff --git a/src/api/types/PageContent.ts b/src/api/types/PageContent.ts index 86cd151e..2c3aee98 100644 --- a/src/api/types/PageContent.ts +++ b/src/api/types/PageContent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PageContent { /** Amount section of payment page */ diff --git a/src/api/types/PageElement.ts b/src/api/types/PageElement.ts index 83ce2279..52e183fa 100644 --- a/src/api/types/PageElement.ts +++ b/src/api/types/PageElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PageElement { /** Page description in header */ diff --git a/src/api/types/PageIdentifier.ts b/src/api/types/PageIdentifier.ts index 0cdb4740..a7ca61cd 100644 --- a/src/api/types/PageIdentifier.ts +++ b/src/api/types/PageIdentifier.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Auxiliary validation used internally by payment pages and components. diff --git a/src/api/types/PageSetting.ts b/src/api/types/PageSetting.ts index 5f428ccb..349ea915 100644 --- a/src/api/types/PageSetting.ts +++ b/src/api/types/PageSetting.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PageSetting { /** An HTML color code in format #RRGGBB */ diff --git a/src/api/types/PagelinkSetting.ts b/src/api/types/PagelinkSetting.ts index 5fabdafe..322195a1 100644 --- a/src/api/types/PagelinkSetting.ts +++ b/src/api/types/PagelinkSetting.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PagelinkSetting { /** An HTML color code in format #RRGGBB */ diff --git a/src/api/types/Pagesize.ts b/src/api/types/Pagesize.ts index c5f02737..042fb419 100644 --- a/src/api/types/Pagesize.ts +++ b/src/api/types/Pagesize.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Number of records on each response page. diff --git a/src/api/types/PairFiles.ts b/src/api/types/PairFiles.ts index 81bee906..f797a318 100644 --- a/src/api/types/PairFiles.ts +++ b/src/api/types/PairFiles.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PairFiles { /** Original filename */ diff --git a/src/api/types/PayCategory.ts b/src/api/types/PayCategory.ts index 23773f35..95be7835 100644 --- a/src/api/types/PayCategory.ts +++ b/src/api/types/PayCategory.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayCategory { description?: string; diff --git a/src/api/types/PayMethodBodyAllFields.ts b/src/api/types/PayMethodBodyAllFields.ts index 82abadb4..cb74a0bd 100644 --- a/src/api/types/PayMethodBodyAllFields.ts +++ b/src/api/types/PayMethodBodyAllFields.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Model for the PaymentMethod object, includes all method types. diff --git a/src/api/types/PayMethodCloud.ts b/src/api/types/PayMethodCloud.ts index e828b06e..130b9262 100644 --- a/src/api/types/PayMethodCloud.ts +++ b/src/api/types/PayMethodCloud.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayMethodCloud { device?: Payabli.Device; diff --git a/src/api/types/PayMethodCredit.ts b/src/api/types/PayMethodCredit.ts index 2c4f2b83..b8dfccd2 100644 --- a/src/api/types/PayMethodCredit.ts +++ b/src/api/types/PayMethodCredit.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayMethodCredit { cardcvv?: Payabli.Cardcvv; diff --git a/src/api/types/PayMethodStoredMethod.ts b/src/api/types/PayMethodStoredMethod.ts index b8f410ea..e8e486ee 100644 --- a/src/api/types/PayMethodStoredMethod.ts +++ b/src/api/types/PayMethodStoredMethod.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * The required and recommended fields for a payment made with a stored payment method. @@ -17,12 +15,10 @@ export interface PayMethodStoredMethod { } export namespace PayMethodStoredMethod { - /** - * Method to use for the transaction. Use either `card` or `ach`, depending on what kind of method was tokenized to use a saved payment method for this transaction. - */ - export type Method = "card" | "ach"; + /** Method to use for the transaction. Use either `card` or `ach`, depending on what kind of method was tokenized to use a saved payment method for this transaction. */ export const Method = { Card: "card", Ach: "ach", } as const; + export type Method = (typeof Method)[keyof typeof Method]; } diff --git a/src/api/types/PayabliApiResponse.ts b/src/api/types/PayabliApiResponse.ts index 5153bc3d..11b86cd5 100644 --- a/src/api/types/PayabliApiResponse.ts +++ b/src/api/types/PayabliApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponse0.ts b/src/api/types/PayabliApiResponse0.ts index cb42b740..dc9f41b2 100644 --- a/src/api/types/PayabliApiResponse0.ts +++ b/src/api/types/PayabliApiResponse0.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * General response for certain `moneyIn` and `moneyOut` endpoints. diff --git a/src/api/types/PayabliApiResponse00.ts b/src/api/types/PayabliApiResponse00.ts index e0ae6dc1..3f4aec28 100644 --- a/src/api/types/PayabliApiResponse00.ts +++ b/src/api/types/PayabliApiResponse00.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponse00 { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponse0000.ts b/src/api/types/PayabliApiResponse0000.ts index c10dad89..927a8e2c 100644 --- a/src/api/types/PayabliApiResponse0000.ts +++ b/src/api/types/PayabliApiResponse0000.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * The response for canceling a single payout transaction. diff --git a/src/api/types/PayabliApiResponse00Responsedatanonobject.ts b/src/api/types/PayabliApiResponse00Responsedatanonobject.ts index 5cc1a0af..cb8c6b27 100644 --- a/src/api/types/PayabliApiResponse00Responsedatanonobject.ts +++ b/src/api/types/PayabliApiResponse00Responsedatanonobject.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponse00Responsedatanonobject { responseCode?: Payabli.Responsecode; diff --git a/src/api/types/PayabliApiResponse6.ts b/src/api/types/PayabliApiResponse6.ts index 6b4b45fe..7e7a1637 100644 --- a/src/api/types/PayabliApiResponse6.ts +++ b/src/api/types/PayabliApiResponse6.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response schema for line item operations. diff --git a/src/api/types/PayabliApiResponseCustomerQuery.ts b/src/api/types/PayabliApiResponseCustomerQuery.ts index 1f224896..4448a134 100644 --- a/src/api/types/PayabliApiResponseCustomerQuery.ts +++ b/src/api/types/PayabliApiResponseCustomerQuery.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseCustomerQuery { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponseError400.ts b/src/api/types/PayabliApiResponseError400.ts index a000b5ae..e09deb57 100644 --- a/src/api/types/PayabliApiResponseError400.ts +++ b/src/api/types/PayabliApiResponseError400.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseError400 { /** Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. */ diff --git a/src/api/types/PayabliApiResponseGeneric2Part.ts b/src/api/types/PayabliApiResponseGeneric2Part.ts index 978bfe91..ddb7dcc0 100644 --- a/src/api/types/PayabliApiResponseGeneric2Part.ts +++ b/src/api/types/PayabliApiResponseGeneric2Part.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseGeneric2Part { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponseImport.ts b/src/api/types/PayabliApiResponseImport.ts index db569396..aa3536b6 100644 --- a/src/api/types/PayabliApiResponseImport.ts +++ b/src/api/types/PayabliApiResponseImport.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseImport { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponseMfaBasic.ts b/src/api/types/PayabliApiResponseMfaBasic.ts index 36291e09..c8b34937 100644 --- a/src/api/types/PayabliApiResponseMfaBasic.ts +++ b/src/api/types/PayabliApiResponseMfaBasic.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseMfaBasic { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponseNotifications.ts b/src/api/types/PayabliApiResponseNotifications.ts index c6a7e42b..a75d7f30 100644 --- a/src/api/types/PayabliApiResponseNotifications.ts +++ b/src/api/types/PayabliApiResponseNotifications.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseNotifications { /** diff --git a/src/api/types/PayabliApiResponsePaylinks.ts b/src/api/types/PayabliApiResponsePaylinks.ts index 5cbeb43a..7d19faed 100644 --- a/src/api/types/PayabliApiResponsePaylinks.ts +++ b/src/api/types/PayabliApiResponsePaylinks.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponsePaylinks { isSuccess: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponsePaymethodDelete.ts b/src/api/types/PayabliApiResponsePaymethodDelete.ts index 70f01b4e..5ef264ff 100644 --- a/src/api/types/PayabliApiResponsePaymethodDelete.ts +++ b/src/api/types/PayabliApiResponsePaymethodDelete.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response body for payment method deletion. diff --git a/src/api/types/PayabliApiResponseTemplateId.ts b/src/api/types/PayabliApiResponseTemplateId.ts index 42ec6abb..982cc886 100644 --- a/src/api/types/PayabliApiResponseTemplateId.ts +++ b/src/api/types/PayabliApiResponseTemplateId.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseTemplateId { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliApiResponseUserMfa.ts b/src/api/types/PayabliApiResponseUserMfa.ts index 6287f00c..b4f8b4d3 100644 --- a/src/api/types/PayabliApiResponseUserMfa.ts +++ b/src/api/types/PayabliApiResponseUserMfa.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseUserMfa { inactiveTokenTime?: number; diff --git a/src/api/types/PayabliApiResponseVendors.ts b/src/api/types/PayabliApiResponseVendors.ts index 45356f5c..8ecaf5ec 100644 --- a/src/api/types/PayabliApiResponseVendors.ts +++ b/src/api/types/PayabliApiResponseVendors.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliApiResponseVendors { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PayabliCredentials.ts b/src/api/types/PayabliCredentials.ts index 57a1e1e7..585636a9 100644 --- a/src/api/types/PayabliCredentials.ts +++ b/src/api/types/PayabliCredentials.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PayabliCredentials { accountId?: string; diff --git a/src/api/types/PayabliCredentialsPascal.ts b/src/api/types/PayabliCredentialsPascal.ts index ee6c7d76..6f438d0d 100644 --- a/src/api/types/PayabliCredentialsPascal.ts +++ b/src/api/types/PayabliCredentialsPascal.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PayabliCredentialsPascal { Service?: string; diff --git a/src/api/types/PayabliPages.ts b/src/api/types/PayabliPages.ts index d3a2f49a..c8388ee7 100644 --- a/src/api/types/PayabliPages.ts +++ b/src/api/types/PayabliPages.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayabliPages { AdditionalData?: Payabli.AdditionalData; diff --git a/src/api/types/PayeeName.ts b/src/api/types/PayeeName.ts index 64ca9b8e..dede118d 100644 --- a/src/api/types/PayeeName.ts +++ b/src/api/types/PayeeName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Alternative name used to receive paper check. diff --git a/src/api/types/PaylinkId.ts b/src/api/types/PaylinkId.ts index cf24758f..829342fd 100644 --- a/src/api/types/PaylinkId.ts +++ b/src/api/types/PaylinkId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of payment link associated to the invoice or bill. diff --git a/src/api/types/PaymentCategories.ts b/src/api/types/PaymentCategories.ts index f2fdbc55..845e794f 100644 --- a/src/api/types/PaymentCategories.ts +++ b/src/api/types/PaymentCategories.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PaymentCategories { /** Price/cost per unit of item or category. */ diff --git a/src/api/types/PaymentDetail.ts b/src/api/types/PaymentDetail.ts index 5a8be93d..a9770b92 100644 --- a/src/api/types/PaymentDetail.ts +++ b/src/api/types/PaymentDetail.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about the payment. diff --git a/src/api/types/PaymentDetailCredit.ts b/src/api/types/PaymentDetailCredit.ts index 6c688537..4e21dea1 100644 --- a/src/api/types/PaymentDetailCredit.ts +++ b/src/api/types/PaymentDetailCredit.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The PaymentDetail object for microdeposit (MakeCredit) transactions. diff --git a/src/api/types/PaymentIdString.ts b/src/api/types/PaymentIdString.ts index 6a27e0f5..2ea7d434 100644 --- a/src/api/types/PaymentIdString.ts +++ b/src/api/types/PaymentIdString.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The unique transaction ID. This value is a string representation of a long integer. diff --git a/src/api/types/PaymentMethod.ts b/src/api/types/PaymentMethod.ts index db47f294..05bc0b7d 100644 --- a/src/api/types/PaymentMethod.ts +++ b/src/api/types/PaymentMethod.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about the payment method for the transaction. diff --git a/src/api/types/PaymentMethodDomainApiResponse.ts b/src/api/types/PaymentMethodDomainApiResponse.ts index 4026c7a1..ef0d40e2 100644 --- a/src/api/types/PaymentMethodDomainApiResponse.ts +++ b/src/api/types/PaymentMethodDomainApiResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Data related to the payment method domain. diff --git a/src/api/types/PaymentMethodDomainGeneralResponse.ts b/src/api/types/PaymentMethodDomainGeneralResponse.ts index dc375cc1..eae146dc 100644 --- a/src/api/types/PaymentMethodDomainGeneralResponse.ts +++ b/src/api/types/PaymentMethodDomainGeneralResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PaymentMethodDomainGeneralResponse { isSuccess?: Payabli.IsSuccess; diff --git a/src/api/types/PaymentMethodDomainId.ts b/src/api/types/PaymentMethodDomainId.ts index 2080a07a..61b9a147 100644 --- a/src/api/types/PaymentMethodDomainId.ts +++ b/src/api/types/PaymentMethodDomainId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The payment method domain's ID in Payabli. diff --git a/src/api/types/PaymentTransStatusDescription.ts b/src/api/types/PaymentTransStatusDescription.ts index c5002bc4..239aa61d 100644 --- a/src/api/types/PaymentTransStatusDescription.ts +++ b/src/api/types/PaymentTransStatusDescription.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Description of the payment transaction status. See [the docs](/developers/references/money-in-statuses#money-in-transaction-status) for a full reference. diff --git a/src/api/types/Paymentid.ts b/src/api/types/Paymentid.ts index 3b6c389f..48939956 100644 --- a/src/api/types/Paymentid.ts +++ b/src/api/types/Paymentid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Unique transaction ID. diff --git a/src/api/types/PayorDataRequest.ts b/src/api/types/PayorDataRequest.ts index 1e17bd0e..43ab0d81 100644 --- a/src/api/types/PayorDataRequest.ts +++ b/src/api/types/PayorDataRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Customer information. May be required, depending on the paypoint's settings. Required for subscriptions. diff --git a/src/api/types/PayorDataResponse.ts b/src/api/types/PayorDataResponse.ts index ab4ad67c..db4e519d 100644 --- a/src/api/types/PayorDataResponse.ts +++ b/src/api/types/PayorDataResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Customer information. diff --git a/src/api/types/PayorElement.ts b/src/api/types/PayorElement.ts index 7fc91720..1444670e 100644 --- a/src/api/types/PayorElement.ts +++ b/src/api/types/PayorElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayorElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/PayorFields.ts b/src/api/types/PayorFields.ts index a0f9be07..859f9896 100644 --- a/src/api/types/PayorFields.ts +++ b/src/api/types/PayorFields.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PayorFields { /** Flag indicating if the input field will show in container */ diff --git a/src/api/types/PayorId.ts b/src/api/types/PayorId.ts index fae5e94d..827bf012 100644 --- a/src/api/types/PayorId.ts +++ b/src/api/types/PayorId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Unique ID for customer linked to the transaction. diff --git a/src/api/types/PayoutAverageMonthlyVolume.ts b/src/api/types/PayoutAverageMonthlyVolume.ts index cf7f3d5b..3afa7ae7 100644 --- a/src/api/types/PayoutAverageMonthlyVolume.ts +++ b/src/api/types/PayoutAverageMonthlyVolume.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The total number of bills the business pays each month. For example, if your business pays an electric bill of \$500, an internet bill of \$150, and various suppliers \$5,000 every month then your monthly bill volume would be \$5,650. diff --git a/src/api/types/PayoutAverageTicketLimit.ts b/src/api/types/PayoutAverageTicketLimit.ts index f821af30..3c402993 100644 --- a/src/api/types/PayoutAverageTicketLimit.ts +++ b/src/api/types/PayoutAverageTicketLimit.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The average amount of each bill you pay through our service. For example, if your business paid 3 bills for a total of \$1,500 then your average bill size is \$500. diff --git a/src/api/types/PayoutCreditLimit.ts b/src/api/types/PayoutCreditLimit.ts index 0b85d02c..df321948 100644 --- a/src/api/types/PayoutCreditLimit.ts +++ b/src/api/types/PayoutCreditLimit.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The maximum amount of credit that our lending partner has authorized to the business for on-demand payouts. It's the upper boundary on how much you can spend or owe on a credit account at any given time. diff --git a/src/api/types/PayoutGatewayConnector.ts b/src/api/types/PayoutGatewayConnector.ts index b4463c5c..9fff831d 100644 --- a/src/api/types/PayoutGatewayConnector.ts +++ b/src/api/types/PayoutGatewayConnector.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PayoutGatewayConnector { configuration?: string; diff --git a/src/api/types/PayoutHighTicketAmount.ts b/src/api/types/PayoutHighTicketAmount.ts index 93591e48..86550a3d 100644 --- a/src/api/types/PayoutHighTicketAmount.ts +++ b/src/api/types/PayoutHighTicketAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The largest amount for bill you will pay through our service. For example, if your business paid for 3 bills each month for \$500, \$1000, and \$5000 respectively, then your highest ticket is \$5000. diff --git a/src/api/types/PayoutProgram.ts b/src/api/types/PayoutProgram.ts index 49e90816..2365acf0 100644 --- a/src/api/types/PayoutProgram.ts +++ b/src/api/types/PayoutProgram.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The payout program associated with the transaction: managed or on-demand. diff --git a/src/api/types/PaypointData.ts b/src/api/types/PaypointData.ts index 63a1d040..1e4631ca 100644 --- a/src/api/types/PaypointData.ts +++ b/src/api/types/PaypointData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PaypointData { address1?: Payabli.AddressNullable; diff --git a/src/api/types/PaypointEntryConfig.ts b/src/api/types/PaypointEntryConfig.ts index 082a6813..cfbb3b45 100644 --- a/src/api/types/PaypointEntryConfig.ts +++ b/src/api/types/PaypointEntryConfig.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface PaypointEntryConfig { EntryComment?: string; diff --git a/src/api/types/PaypointId.ts b/src/api/types/PaypointId.ts index 7b90ee70..5808a275 100644 --- a/src/api/types/PaypointId.ts +++ b/src/api/types/PaypointId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The paypoint's ID. Note that this is different than the entryname. diff --git a/src/api/types/PaypointName.ts b/src/api/types/PaypointName.ts index b7d49768..c177827a 100644 --- a/src/api/types/PaypointName.ts +++ b/src/api/types/PaypointName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The paypoint name. diff --git a/src/api/types/PaypointSummary.ts b/src/api/types/PaypointSummary.ts index 6e57c7ab..cd0e90d7 100644 --- a/src/api/types/PaypointSummary.ts +++ b/src/api/types/PaypointSummary.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface PaypointSummary { amountSubs?: number; diff --git a/src/api/types/Paypointstatus.ts b/src/api/types/Paypointstatus.ts index c051849a..47296661 100644 --- a/src/api/types/Paypointstatus.ts +++ b/src/api/types/Paypointstatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The paypoint's status. diff --git a/src/api/types/PciAttestation.ts b/src/api/types/PciAttestation.ts index 045a7314..c422cb6e 100644 --- a/src/api/types/PciAttestation.ts +++ b/src/api/types/PciAttestation.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, indicates that the merchant acknowledges PCI responsibilities and can be enrolled in the PCI program for breach insurance diff --git a/src/api/types/PendingFeeAmount.ts b/src/api/types/PendingFeeAmount.ts index a198954b..a8631024 100644 --- a/src/api/types/PendingFeeAmount.ts +++ b/src/api/types/PendingFeeAmount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * diff --git a/src/api/types/PhoneNumber.ts b/src/api/types/PhoneNumber.ts index 065f8123..5c8985a9 100644 --- a/src/api/types/PhoneNumber.ts +++ b/src/api/types/PhoneNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Phone number. diff --git a/src/api/types/PoiDevice.ts b/src/api/types/PoiDevice.ts index a1a797e1..c1283f96 100644 --- a/src/api/types/PoiDevice.ts +++ b/src/api/types/PoiDevice.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Information about the point of interaction device (also known as a terminal or cloud device) used to process the transaction. diff --git a/src/api/types/PolicyId.ts b/src/api/types/PolicyId.ts index eae0a553..baf4550a 100644 --- a/src/api/types/PolicyId.ts +++ b/src/api/types/PolicyId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Used to identify the risk workflow used to review this account. Policy IDs must be created before using automatic underwriting, and is **required** when `method` is `automatic`. diff --git a/src/api/types/PosCol.ts b/src/api/types/PosCol.ts index f7a76a27..a3ae3502 100644 --- a/src/api/types/PosCol.ts +++ b/src/api/types/PosCol.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The element's column position. diff --git a/src/api/types/PosRow.ts b/src/api/types/PosRow.ts index 4d325886..6aad4d5b 100644 --- a/src/api/types/PosRow.ts +++ b/src/api/types/PosRow.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The element's row position. diff --git a/src/api/types/ProcessingSection.ts b/src/api/types/ProcessingSection.ts index 8bc095ea..1c92d0d0 100644 --- a/src/api/types/ProcessingSection.ts +++ b/src/api/types/ProcessingSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ProcessingSection { avgmonthly?: Payabli.TemplateElement; diff --git a/src/api/types/PurchaseOrder.ts b/src/api/types/PurchaseOrder.ts index 4ac3af2a..06af1dba 100644 --- a/src/api/types/PurchaseOrder.ts +++ b/src/api/types/PurchaseOrder.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Purchase order number. diff --git a/src/api/types/PushPayLinkRequest.ts b/src/api/types/PushPayLinkRequest.ts index 111ea99c..116a8616 100644 --- a/src/api/types/PushPayLinkRequest.ts +++ b/src/api/types/PushPayLinkRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Request body for the push paylink operation. diff --git a/src/api/types/QueryBatchesOutResponse.ts b/src/api/types/QueryBatchesOutResponse.ts index b702424b..6a7ed531 100644 --- a/src/api/types/QueryBatchesOutResponse.ts +++ b/src/api/types/QueryBatchesOutResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response body for queries about money out batches. diff --git a/src/api/types/QueryBoardingAppsListResponse.ts b/src/api/types/QueryBoardingAppsListResponse.ts index 874fec7d..205511f8 100644 --- a/src/api/types/QueryBoardingAppsListResponse.ts +++ b/src/api/types/QueryBoardingAppsListResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryBoardingAppsListResponse { Records?: Payabli.ApplicationQueryRecord[]; diff --git a/src/api/types/QueryBoardingLinksResponse.ts b/src/api/types/QueryBoardingLinksResponse.ts index 30c89efd..23a9ea00 100644 --- a/src/api/types/QueryBoardingLinksResponse.ts +++ b/src/api/types/QueryBoardingLinksResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * diff --git a/src/api/types/QueryCFeeTransaction.ts b/src/api/types/QueryCFeeTransaction.ts index 29f3eee9..849fc9fe 100644 --- a/src/api/types/QueryCFeeTransaction.ts +++ b/src/api/types/QueryCFeeTransaction.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryCFeeTransaction { cFeeTransid?: string; diff --git a/src/api/types/QueryChargebacksResponse.ts b/src/api/types/QueryChargebacksResponse.ts index e474fa2a..1fefc0c7 100644 --- a/src/api/types/QueryChargebacksResponse.ts +++ b/src/api/types/QueryChargebacksResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response body for queries about chargebacks. diff --git a/src/api/types/QueryCustomerResponse.ts b/src/api/types/QueryCustomerResponse.ts index 777c4088..c39026bb 100644 --- a/src/api/types/QueryCustomerResponse.ts +++ b/src/api/types/QueryCustomerResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryCustomerResponse { Records?: Payabli.CustomerQueryRecords[]; diff --git a/src/api/types/QueryEntrypointResponse.ts b/src/api/types/QueryEntrypointResponse.ts index b96427e7..a49f6e64 100644 --- a/src/api/types/QueryEntrypointResponse.ts +++ b/src/api/types/QueryEntrypointResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryEntrypointResponse { Records?: QueryEntrypointResponse.Records.Item[]; diff --git a/src/api/types/QueryPaymentData.ts b/src/api/types/QueryPaymentData.ts index d1c29d2d..3f4670e0 100644 --- a/src/api/types/QueryPaymentData.ts +++ b/src/api/types/QueryPaymentData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryPaymentData { AccountExp?: Payabli.Accountexp; diff --git a/src/api/types/QueryPayoutTransaction.ts b/src/api/types/QueryPayoutTransaction.ts index 15376806..0d6d6c96 100644 --- a/src/api/types/QueryPayoutTransaction.ts +++ b/src/api/types/QueryPayoutTransaction.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example diff --git a/src/api/types/QueryResponse.ts b/src/api/types/QueryResponse.ts index d2af7adc..c6a06c3a 100644 --- a/src/api/types/QueryResponse.ts +++ b/src/api/types/QueryResponse.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * diff --git a/src/api/types/QueryResponseData.ts b/src/api/types/QueryResponseData.ts index 84eb4bdb..5642613d 100644 --- a/src/api/types/QueryResponseData.ts +++ b/src/api/types/QueryResponseData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * The transaction's response data. diff --git a/src/api/types/QueryResponseItems.ts b/src/api/types/QueryResponseItems.ts index e8826db3..ff789070 100644 --- a/src/api/types/QueryResponseItems.ts +++ b/src/api/types/QueryResponseItems.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response for line item queries diff --git a/src/api/types/QueryResponseNotificationReports.ts b/src/api/types/QueryResponseNotificationReports.ts index 38b31531..1951f4fa 100644 --- a/src/api/types/QueryResponseNotificationReports.ts +++ b/src/api/types/QueryResponseNotificationReports.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryResponseNotificationReports { Records?: QueryResponseNotificationReports.Records.Item[]; diff --git a/src/api/types/QueryResponseNotifications.ts b/src/api/types/QueryResponseNotifications.ts index 17b91ed9..87d73bbc 100644 --- a/src/api/types/QueryResponseNotifications.ts +++ b/src/api/types/QueryResponseNotifications.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response payload for queries related to notifications diff --git a/src/api/types/QueryResponseSettlements.ts b/src/api/types/QueryResponseSettlements.ts index 29447fda..352f1ee2 100644 --- a/src/api/types/QueryResponseSettlements.ts +++ b/src/api/types/QueryResponseSettlements.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Describes the response for settlement queries. diff --git a/src/api/types/QueryResponseTransactions.ts b/src/api/types/QueryResponseTransactions.ts index 6c6a504a..9e0eead8 100644 --- a/src/api/types/QueryResponseTransactions.ts +++ b/src/api/types/QueryResponseTransactions.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response payload for queries related to transactions diff --git a/src/api/types/QueryResponseVendors.ts b/src/api/types/QueryResponseVendors.ts index 9c0913ae..9103f3a9 100644 --- a/src/api/types/QueryResponseVendors.ts +++ b/src/api/types/QueryResponseVendors.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Response payload for queries related to vendors. diff --git a/src/api/types/QuerySubscriptionResponse.ts b/src/api/types/QuerySubscriptionResponse.ts index f1a262b0..dad1ac0c 100644 --- a/src/api/types/QuerySubscriptionResponse.ts +++ b/src/api/types/QuerySubscriptionResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Subscription query response body. diff --git a/src/api/types/QuerySummary.ts b/src/api/types/QuerySummary.ts index f4ef1e46..e753736c 100644 --- a/src/api/types/QuerySummary.ts +++ b/src/api/types/QuerySummary.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QuerySummary { pageIdentifier?: Payabli.PageIdentifier; diff --git a/src/api/types/QuerySummaryNoAmt.ts b/src/api/types/QuerySummaryNoAmt.ts index 236d231e..a8ef758e 100644 --- a/src/api/types/QuerySummaryNoAmt.ts +++ b/src/api/types/QuerySummaryNoAmt.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QuerySummaryNoAmt { pageIdentifier?: Payabli.PageIdentifier; diff --git a/src/api/types/QueryTransactionEvents.ts b/src/api/types/QueryTransactionEvents.ts index 9594cf63..2ca89276 100644 --- a/src/api/types/QueryTransactionEvents.ts +++ b/src/api/types/QueryTransactionEvents.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface QueryTransactionEvents { /** Any data associated to the event received from processor. Contents vary by event type. */ diff --git a/src/api/types/QueryTransactionPayorData.ts b/src/api/types/QueryTransactionPayorData.ts index ac75eaad..86ef9d76 100644 --- a/src/api/types/QueryTransactionPayorData.ts +++ b/src/api/types/QueryTransactionPayorData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryTransactionPayorData { /** Array of field names to be used as identifiers. */ diff --git a/src/api/types/QueryTransactionPayorDataCustomer.ts b/src/api/types/QueryTransactionPayorDataCustomer.ts index 221e428d..bedb7833 100644 --- a/src/api/types/QueryTransactionPayorDataCustomer.ts +++ b/src/api/types/QueryTransactionPayorDataCustomer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryTransactionPayorDataCustomer { /** Array of field names to be used as identifiers. */ diff --git a/src/api/types/QueryUserResponse.ts b/src/api/types/QueryUserResponse.ts index 588dc73a..63b8806b 100644 --- a/src/api/types/QueryUserResponse.ts +++ b/src/api/types/QueryUserResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface QueryUserResponse { Records?: Payabli.UserQueryRecord[]; diff --git a/src/api/types/ReadOnly.ts b/src/api/types/ReadOnly.ts index 970b3151..939258f8 100644 --- a/src/api/types/ReadOnly.ts +++ b/src/api/types/ReadOnly.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the element is read-only. diff --git a/src/api/types/ReceiptContent.ts b/src/api/types/ReceiptContent.ts index 7a913f07..5f3f3f60 100644 --- a/src/api/types/ReceiptContent.ts +++ b/src/api/types/ReceiptContent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Object containing receipt body configuration diff --git a/src/api/types/RecipientEmailNotification.ts b/src/api/types/RecipientEmailNotification.ts index 00bd9c43..190d3b0d 100644 --- a/src/api/types/RecipientEmailNotification.ts +++ b/src/api/types/RecipientEmailNotification.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, Payabli will send the applicant a boarding link. Set this value to `false` if you are sending pre-filled applications via the API and don't want Payabli to send the applicant an email to complete the boarding application. diff --git a/src/api/types/ReferenceName.ts b/src/api/types/ReferenceName.ts index 2c679f3f..ac5edf88 100644 --- a/src/api/types/ReferenceName.ts +++ b/src/api/types/ReferenceName.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type ReferenceName = string; diff --git a/src/api/types/ReferenceTemplateId.ts b/src/api/types/ReferenceTemplateId.ts index 98cd52e5..47a0dae5 100644 --- a/src/api/types/ReferenceTemplateId.ts +++ b/src/api/types/ReferenceTemplateId.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type ReferenceTemplateId = number; diff --git a/src/api/types/Referenceidtrans.ts b/src/api/types/Referenceidtrans.ts index 34259fc3..65b68381 100644 --- a/src/api/types/Referenceidtrans.ts +++ b/src/api/types/Referenceidtrans.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The transaction identifier in Payabli. diff --git a/src/api/types/RefundDetail.ts b/src/api/types/RefundDetail.ts index 2293f6e0..27df8905 100644 --- a/src/api/types/RefundDetail.ts +++ b/src/api/types/RefundDetail.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Object containing details about the refund, including line items and optional split instructions. diff --git a/src/api/types/RefundId.ts b/src/api/types/RefundId.ts index d3c546d8..2a58cc7f 100644 --- a/src/api/types/RefundId.ts +++ b/src/api/types/RefundId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of refund transaction linked to this payment. diff --git a/src/api/types/RemitEmail.ts b/src/api/types/RemitEmail.ts index 5cc816f6..1187b3db 100644 --- a/src/api/types/RemitEmail.ts +++ b/src/api/types/RemitEmail.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance email address. Used for sending virtual cards and other information about payouts. diff --git a/src/api/types/Remitaddress1.ts b/src/api/types/Remitaddress1.ts index 99464c25..85d572cb 100644 --- a/src/api/types/Remitaddress1.ts +++ b/src/api/types/Remitaddress1.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address. Used for mailing paper checks. diff --git a/src/api/types/Remitaddress2.ts b/src/api/types/Remitaddress2.ts index f3a1d8d9..ff95ba3c 100644 --- a/src/api/types/Remitaddress2.ts +++ b/src/api/types/Remitaddress2.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address additional line. Used for mailing paper checks. diff --git a/src/api/types/Remitcity.ts b/src/api/types/Remitcity.ts index 2b6462c1..592c48f6 100644 --- a/src/api/types/Remitcity.ts +++ b/src/api/types/Remitcity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address city. Used for mailing paper checks. diff --git a/src/api/types/Remitcountry.ts b/src/api/types/Remitcountry.ts index d555f124..0464dd4f 100644 --- a/src/api/types/Remitcountry.ts +++ b/src/api/types/Remitcountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address country. Used for mailing paper checks. diff --git a/src/api/types/Remitstate.ts b/src/api/types/Remitstate.ts index e01706b2..f9b1af6b 100644 --- a/src/api/types/Remitstate.ts +++ b/src/api/types/Remitstate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address state. Used for mailing paper checks. diff --git a/src/api/types/Remitzip.ts b/src/api/types/Remitzip.ts index d554dcd6..334712b7 100644 --- a/src/api/types/Remitzip.ts +++ b/src/api/types/Remitzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Remittance address ZIP code. Used for mailing paper checks. diff --git a/src/api/types/RepCode.ts b/src/api/types/RepCode.ts index e8695484..a8c1085d 100644 --- a/src/api/types/RepCode.ts +++ b/src/api/types/RepCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Sales representative code. This is an optional field that can be used to track the sales representative associated with the application. diff --git a/src/api/types/RepName.ts b/src/api/types/RepName.ts index c080cd1b..4f708774 100644 --- a/src/api/types/RepName.ts +++ b/src/api/types/RepName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Sales representative name. This is an optional field that can be used to track the sales representative associated with the application. diff --git a/src/api/types/RepOffice.ts b/src/api/types/RepOffice.ts index 6631d38e..85112b3a 100644 --- a/src/api/types/RepOffice.ts +++ b/src/api/types/RepOffice.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Sales representative office location. This is an optional field that can be used to track the sales representative office associated with the application. diff --git a/src/api/types/ReplyToEmail.ts b/src/api/types/ReplyToEmail.ts index a9b3bd32..7c9bc7d9 100644 --- a/src/api/types/ReplyToEmail.ts +++ b/src/api/types/ReplyToEmail.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Email address for organization-level communications, such as messages about why an application was declined. This is required by commerce laws in the US. diff --git a/src/api/types/Replyby.ts b/src/api/types/Replyby.ts index 2de7efcf..26538c45 100644 --- a/src/api/types/Replyby.ts +++ b/src/api/types/Replyby.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Time that a response to a chargeback is due, in UTC. diff --git a/src/api/types/RequiredElement.ts b/src/api/types/RequiredElement.ts index 0ae93a3a..ca0d1f44 100644 --- a/src/api/types/RequiredElement.ts +++ b/src/api/types/RequiredElement.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the element is required. diff --git a/src/api/types/ResponseText.ts b/src/api/types/ResponseText.ts index 17b95a87..520df5af 100644 --- a/src/api/types/ResponseText.ts +++ b/src/api/types/ResponseText.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Response text for operation: 'Success' or 'Declined'. diff --git a/src/api/types/Responsecode.ts b/src/api/types/Responsecode.ts index b9d06494..36538a93 100644 --- a/src/api/types/Responsecode.ts +++ b/src/api/types/Responsecode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Code for the response. Learn more in [API Response Codes](/api-reference/api-responses). diff --git a/src/api/types/Responsedata.ts b/src/api/types/Responsedata.ts index 1f987a3d..e34c4029 100644 --- a/src/api/types/Responsedata.ts +++ b/src/api/types/Responsedata.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The object containing the response data. diff --git a/src/api/types/Responsedatanonobject.ts b/src/api/types/Responsedatanonobject.ts index c05bb8dd..127807e7 100644 --- a/src/api/types/Responsedatanonobject.ts +++ b/src/api/types/Responsedatanonobject.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The response data. diff --git a/src/api/types/ResultCode.ts b/src/api/types/ResultCode.ts index ab771aa4..04bc7734 100644 --- a/src/api/types/ResultCode.ts +++ b/src/api/types/ResultCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Result code for the operation. Value 1 indicates a successful operation, diff --git a/src/api/types/Resulttext.ts b/src/api/types/Resulttext.ts index 594960f8..37410653 100644 --- a/src/api/types/Resulttext.ts +++ b/src/api/types/Resulttext.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Text describing the result. If `ResultCode` = 1, will return 'Approved' or a general success message. If `ResultCode`` = 2 or 3, will contain the cause of the error or decline. diff --git a/src/api/types/Resumable.ts b/src/api/types/Resumable.ts index 36aba2b6..a8fb5565 100644 --- a/src/api/types/Resumable.ts +++ b/src/api/types/Resumable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the applicant can save an incomplete application and resume it later. When `false`, the applicant won't have an option to save their progress, and must complete the application in one session. diff --git a/src/api/types/RetrievalId.ts b/src/api/types/RetrievalId.ts index 406b41dc..03f7ac0f 100644 --- a/src/api/types/RetrievalId.ts +++ b/src/api/types/RetrievalId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of retrieval request diff --git a/src/api/types/ReturnedId.ts b/src/api/types/ReturnedId.ts index e9a1c131..ff35aa86 100644 --- a/src/api/types/ReturnedId.ts +++ b/src/api/types/ReturnedId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Identifier of return/chargeback transaction linked to this payment. diff --git a/src/api/types/RiskAction.ts b/src/api/types/RiskAction.ts index c8eaac0f..f13b8939 100644 --- a/src/api/types/RiskAction.ts +++ b/src/api/types/RiskAction.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Action taken due to risk assessment diff --git a/src/api/types/RiskActionCode.ts b/src/api/types/RiskActionCode.ts index 6e3cdf4c..e9a443c7 100644 --- a/src/api/types/RiskActionCode.ts +++ b/src/api/types/RiskActionCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Numeric code representing the risk action diff --git a/src/api/types/RiskFlagged.ts b/src/api/types/RiskFlagged.ts index 9378d6b8..8400d379 100644 --- a/src/api/types/RiskFlagged.ts +++ b/src/api/types/RiskFlagged.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Indicates if the transaction was flagged for risk diff --git a/src/api/types/RiskFlaggedOn.ts b/src/api/types/RiskFlaggedOn.ts index 51b5284b..5194d3ad 100644 --- a/src/api/types/RiskFlaggedOn.ts +++ b/src/api/types/RiskFlaggedOn.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timestamp when the transaction was flagged for risk diff --git a/src/api/types/RiskReason.ts b/src/api/types/RiskReason.ts index eba4e215..0124671d 100644 --- a/src/api/types/RiskReason.ts +++ b/src/api/types/RiskReason.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Reason for risk flagging diff --git a/src/api/types/RiskStatus.ts b/src/api/types/RiskStatus.ts index f5ee88b0..73e7b27d 100644 --- a/src/api/types/RiskStatus.ts +++ b/src/api/types/RiskStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Current risk status of the transaction diff --git a/src/api/types/RoomIdNotInUse.ts b/src/api/types/RoomIdNotInUse.ts index 93711b92..7252d6f2 100644 --- a/src/api/types/RoomIdNotInUse.ts +++ b/src/api/types/RoomIdNotInUse.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Field not in use on this endpoint. It always returns `0`. diff --git a/src/api/types/RoutingAccount.ts b/src/api/types/RoutingAccount.ts index bd24817f..c0abbfca 100644 --- a/src/api/types/RoutingAccount.ts +++ b/src/api/types/RoutingAccount.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Routing number of bank account. diff --git a/src/api/types/SSection.ts b/src/api/types/SSection.ts index 0c5f6f3f..0fd5253c 100644 --- a/src/api/types/SSection.ts +++ b/src/api/types/SSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SSection { ach?: Payabli.AchSection; diff --git a/src/api/types/SalesCode.ts b/src/api/types/SalesCode.ts index bf5af2c8..791579f5 100644 --- a/src/api/types/SalesCode.ts +++ b/src/api/types/SalesCode.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type SalesCode = string; diff --git a/src/api/types/SalesSection.ts b/src/api/types/SalesSection.ts index 7929ca6f..4a3881a4 100644 --- a/src/api/types/SalesSection.ts +++ b/src/api/types/SalesSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SalesSection { salesCode?: Payabli.SalesCode; diff --git a/src/api/types/SaveIfSuccess.ts b/src/api/types/SaveIfSuccess.ts index e1ec2863..ae7d01bc 100644 --- a/src/api/types/SaveIfSuccess.ts +++ b/src/api/types/SaveIfSuccess.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, Payabli saves the payment method if the transaction is successful. The payment method ID is returned in the response as `methodReferenceId`. Defaults to `false`. diff --git a/src/api/types/ScheduleDetail.ts b/src/api/types/ScheduleDetail.ts index 4eb0813f..1a885026 100644 --- a/src/api/types/ScheduleDetail.ts +++ b/src/api/types/ScheduleDetail.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ScheduleDetail { /** Subscription end date in any of the accepted formats: YYYY-MM-DD, MM/DD/YYYY or the value `untilcancelled` to indicate a scheduled payment with infinite cycle. */ diff --git a/src/api/types/ScheduleId.ts b/src/api/types/ScheduleId.ts index e45c8a6c..52b33c0e 100644 --- a/src/api/types/ScheduleId.ts +++ b/src/api/types/ScheduleId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ID of the recurring payment schedule associated with the transaction. diff --git a/src/api/types/Sequence.ts b/src/api/types/Sequence.ts index 96f6d6fa..88fd6e47 100644 --- a/src/api/types/Sequence.ts +++ b/src/api/types/Sequence.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The order of the transaction for cardholder-initiated transaction (CIT) and merchant-initiated transaction (MIT) purposes. This field is automatically detected and populated by Payabli. diff --git a/src/api/types/ServiceCost.ts b/src/api/types/ServiceCost.ts index 88272001..58c5ec0f 100644 --- a/src/api/types/ServiceCost.ts +++ b/src/api/types/ServiceCost.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface ServiceCost { description?: string; diff --git a/src/api/types/Services.ts b/src/api/types/Services.ts index 89f212b4..36e8b330 100644 --- a/src/api/types/Services.ts +++ b/src/api/types/Services.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Controls which services will be enabled for the merchant. diff --git a/src/api/types/ServicesSection.ts b/src/api/types/ServicesSection.ts index ed8a572f..9561669f 100644 --- a/src/api/types/ServicesSection.ts +++ b/src/api/types/ServicesSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Details about pricing and payment services for a business. diff --git a/src/api/types/SettingElement.ts b/src/api/types/SettingElement.ts index aba418db..957505f4 100644 --- a/src/api/types/SettingElement.ts +++ b/src/api/types/SettingElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SettingElement { enabled?: Payabli.Enabled; diff --git a/src/api/types/SettingsQueryRecord.ts b/src/api/types/SettingsQueryRecord.ts index 62d4c792..58924308 100644 --- a/src/api/types/SettingsQueryRecord.ts +++ b/src/api/types/SettingsQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SettingsQueryRecord { /** Any custom fields defined for the org. */ diff --git a/src/api/types/SettlementStatus.ts b/src/api/types/SettlementStatus.ts index b3182f0d..970c6f96 100644 --- a/src/api/types/SettlementStatus.ts +++ b/src/api/types/SettlementStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Settlement status for transaction. See [the docs](/developers/references/money-in-statuses#payment-funding-status) for a full reference. diff --git a/src/api/types/SettlementStatusPayout.ts b/src/api/types/SettlementStatusPayout.ts index 218d2bdb..3fa3b501 100644 --- a/src/api/types/SettlementStatusPayout.ts +++ b/src/api/types/SettlementStatusPayout.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The settlement status of the payout transaction. See [Payout Transaction Statuses](guides/money-out-statuses#payout-transaction-statuses) for a full reference. diff --git a/src/api/types/ShippingFromZip.ts b/src/api/types/ShippingFromZip.ts index 501a1d33..b6537380 100644 --- a/src/api/types/ShippingFromZip.ts +++ b/src/api/types/ShippingFromZip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Sender shipping ZIP code. diff --git a/src/api/types/Shippingaddress.ts b/src/api/types/Shippingaddress.ts index 273dcadf..429fe271 100644 --- a/src/api/types/Shippingaddress.ts +++ b/src/api/types/Shippingaddress.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The shipping address. diff --git a/src/api/types/Shippingaddressadditional.ts b/src/api/types/Shippingaddressadditional.ts index d3435dfb..36e13045 100644 --- a/src/api/types/Shippingaddressadditional.ts +++ b/src/api/types/Shippingaddressadditional.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Additional line for shipping address. diff --git a/src/api/types/Shippingcity.ts b/src/api/types/Shippingcity.ts index 10d703a2..ab74853b 100644 --- a/src/api/types/Shippingcity.ts +++ b/src/api/types/Shippingcity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Shipping city. diff --git a/src/api/types/Shippingcountry.ts b/src/api/types/Shippingcountry.ts index 2c498757..2a2229b4 100644 --- a/src/api/types/Shippingcountry.ts +++ b/src/api/types/Shippingcountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Shipping address country. diff --git a/src/api/types/Shippingstate.ts b/src/api/types/Shippingstate.ts index 98a08f57..33245944 100644 --- a/src/api/types/Shippingstate.ts +++ b/src/api/types/Shippingstate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Shipping state or province. diff --git a/src/api/types/Shippingzip.ts b/src/api/types/Shippingzip.ts index 2868adc0..a922c565 100644 --- a/src/api/types/Shippingzip.ts +++ b/src/api/types/Shippingzip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Shipping ZIP code. For Pay In functions, this field supports 5-digit and 9-digit ZIP codes and alphanumeric Canadian postal codes. For example: "37615-1234" or "37615". diff --git a/src/api/types/SignDate.ts b/src/api/types/SignDate.ts index 1c38d185..5cb6131e 100644 --- a/src/api/types/SignDate.ts +++ b/src/api/types/SignDate.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Date when the signer signed the document. Accepted formats: diff --git a/src/api/types/Signaturedata.ts b/src/api/types/Signaturedata.ts index 0e7b26ad..4bd7ad43 100644 --- a/src/api/types/Signaturedata.ts +++ b/src/api/types/Signaturedata.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type Signaturedata = string; diff --git a/src/api/types/SignedDocumentReference.ts b/src/api/types/SignedDocumentReference.ts index 0b3bd2eb..4146faf6 100644 --- a/src/api/types/SignedDocumentReference.ts +++ b/src/api/types/SignedDocumentReference.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Reference to the signed document. diff --git a/src/api/types/SignerAcceptance.ts b/src/api/types/SignerAcceptance.ts index c6ad1bee..8e02d28b 100644 --- a/src/api/types/SignerAcceptance.ts +++ b/src/api/types/SignerAcceptance.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's acceptance status. A true or false indicating an acceptance to the terms of service with the root org or provider. diff --git a/src/api/types/SignerAddress1.ts b/src/api/types/SignerAddress1.ts index 3cccc3c3..60116be1 100644 --- a/src/api/types/SignerAddress1.ts +++ b/src/api/types/SignerAddress1.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Additional line for the signer's address. If used, this must be the physical address of the signer, not a P.O. box. diff --git a/src/api/types/SignerCity.ts b/src/api/types/SignerCity.ts index f06f51e9..3afdd6ba 100644 --- a/src/api/types/SignerCity.ts +++ b/src/api/types/SignerCity.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's city. diff --git a/src/api/types/SignerCountry.ts b/src/api/types/SignerCountry.ts index 38e96f25..16cd2eb1 100644 --- a/src/api/types/SignerCountry.ts +++ b/src/api/types/SignerCountry.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's country in ISO-3166-1 alpha 2 format. See this reference for more: https://en.wikipedia.org/wiki/ISO_3166-1. diff --git a/src/api/types/SignerData.ts b/src/api/types/SignerData.ts index f3814c11..e813ce4b 100644 --- a/src/api/types/SignerData.ts +++ b/src/api/types/SignerData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about the application's signer. diff --git a/src/api/types/SignerDataRequest.ts b/src/api/types/SignerDataRequest.ts index 298e7a73..96cdb5d7 100644 --- a/src/api/types/SignerDataRequest.ts +++ b/src/api/types/SignerDataRequest.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Information about the application's signer. diff --git a/src/api/types/SignerDob.ts b/src/api/types/SignerDob.ts index 0c546f29..55f8d500 100644 --- a/src/api/types/SignerDob.ts +++ b/src/api/types/SignerDob.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's date of birth. diff --git a/src/api/types/SignerName.ts b/src/api/types/SignerName.ts index 4d63e935..aec8996b 100644 --- a/src/api/types/SignerName.ts +++ b/src/api/types/SignerName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's name. diff --git a/src/api/types/SignerPhone.ts b/src/api/types/SignerPhone.ts index d27395f7..a759254d 100644 --- a/src/api/types/SignerPhone.ts +++ b/src/api/types/SignerPhone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's phone number. diff --git a/src/api/types/SignerSection.ts b/src/api/types/SignerSection.ts index 612d650b..b4c45045 100644 --- a/src/api/types/SignerSection.ts +++ b/src/api/types/SignerSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SignerSection { visible?: Payabli.Visible | undefined; diff --git a/src/api/types/SignerSsn.ts b/src/api/types/SignerSsn.ts index 96039723..79786a15 100644 --- a/src/api/types/SignerSsn.ts +++ b/src/api/types/SignerSsn.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's SSN. diff --git a/src/api/types/SignerState.ts b/src/api/types/SignerState.ts index 8797982a..b773a538 100644 --- a/src/api/types/SignerState.ts +++ b/src/api/types/SignerState.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's state. diff --git a/src/api/types/SignerZip.ts b/src/api/types/SignerZip.ts index e15e7788..fed9c84e 100644 --- a/src/api/types/SignerZip.ts +++ b/src/api/types/SignerZip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's zip code. diff --git a/src/api/types/Signeraddress.ts b/src/api/types/Signeraddress.ts index 08499c63..4f81026c 100644 --- a/src/api/types/Signeraddress.ts +++ b/src/api/types/Signeraddress.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The signer's address. This must be the physical address of the signer, not a P.O. box. diff --git a/src/api/types/Source.ts b/src/api/types/Source.ts index a29ee4ce..2e924c89 100644 --- a/src/api/types/Source.ts +++ b/src/api/types/Source.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom identifier to indicate the transaction or request source. diff --git a/src/api/types/SplitFunding.ts b/src/api/types/SplitFunding.ts index d2119789..9023bbfd 100644 --- a/src/api/types/SplitFunding.ts +++ b/src/api/types/SplitFunding.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Split funding instructions for the transaction. The total amount of the splits must match the total amount of the transaction. diff --git a/src/api/types/SplitFundingContent.ts b/src/api/types/SplitFundingContent.ts index 0a3f8340..48a48583 100644 --- a/src/api/types/SplitFundingContent.ts +++ b/src/api/types/SplitFundingContent.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface SplitFundingContent { /** The accountId for the account the split should be sent to. */ diff --git a/src/api/types/SplitFundingRefundContent.ts b/src/api/types/SplitFundingRefundContent.ts index 2644d434..5886076c 100644 --- a/src/api/types/SplitFundingRefundContent.ts +++ b/src/api/types/SplitFundingRefundContent.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface SplitFundingRefundContent { /** The accountId for the account the transaction was routed to. */ diff --git a/src/api/types/StateNullable.ts b/src/api/types/StateNullable.ts index f99a4dc8..9a82c267 100644 --- a/src/api/types/StateNullable.ts +++ b/src/api/types/StateNullable.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The state or province. diff --git a/src/api/types/Statusnotification.ts b/src/api/types/Statusnotification.ts index b3e30a41..a674e2c1 100644 --- a/src/api/types/Statusnotification.ts +++ b/src/api/types/Statusnotification.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Status of notification: diff --git a/src/api/types/StoredMethodUsageType.ts b/src/api/types/StoredMethodUsageType.ts index ec530af6..91aa75a0 100644 --- a/src/api/types/StoredMethodUsageType.ts +++ b/src/api/types/StoredMethodUsageType.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * **Strongly recommended** The usage type for the stored method, used for merchant-initiated transactions (MIT). If you don't specify a value, Payabli defaults to `unscheduled`. diff --git a/src/api/types/Storedmethodid.ts b/src/api/types/Storedmethodid.ts index 7d72aae9..2dcf1bec 100644 --- a/src/api/types/Storedmethodid.ts +++ b/src/api/types/Storedmethodid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payabli identifier of a tokenized payment method. If this field is used in a request, the `method` field is overridden and the payment is made using the payment token. diff --git a/src/api/types/SubFooter.ts b/src/api/types/SubFooter.ts index 9f5e6ed5..3aa035dd 100644 --- a/src/api/types/SubFooter.ts +++ b/src/api/types/SubFooter.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type SubFooter = string; diff --git a/src/api/types/SubHeader.ts b/src/api/types/SubHeader.ts index 89facfe2..0cdca969 100644 --- a/src/api/types/SubHeader.ts +++ b/src/api/types/SubHeader.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type SubHeader = string; diff --git a/src/api/types/Subdomain.ts b/src/api/types/Subdomain.ts index 41ad47ea..59bd3794 100644 --- a/src/api/types/Subdomain.ts +++ b/src/api/types/Subdomain.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Refers to the payment page identifier. If provided, then the transaction is linked to the payment page. diff --git a/src/api/types/SubscriptionQueryRecords.ts b/src/api/types/SubscriptionQueryRecords.ts index b9c34103..fa911c5d 100644 --- a/src/api/types/SubscriptionQueryRecords.ts +++ b/src/api/types/SubscriptionQueryRecords.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface SubscriptionQueryRecords { /** Timestamp of when the subscription ws created, in UTC. */ diff --git a/src/api/types/Subscriptionid.ts b/src/api/types/Subscriptionid.ts index 88ced8cc..2c763899 100644 --- a/src/api/types/Subscriptionid.ts +++ b/src/api/types/Subscriptionid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payabli identifier of the subscription associated with the transaction. diff --git a/src/api/types/SummaryCommodityCode.ts b/src/api/types/SummaryCommodityCode.ts index f7f39c4d..81eb709f 100644 --- a/src/api/types/SummaryCommodityCode.ts +++ b/src/api/types/SummaryCommodityCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Commodity code. diff --git a/src/api/types/SummaryOrg.ts b/src/api/types/SummaryOrg.ts index e478606e..68da4b4d 100644 --- a/src/api/types/SummaryOrg.ts +++ b/src/api/types/SummaryOrg.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface SummaryOrg { amountSubs?: number; diff --git a/src/api/types/Target.ts b/src/api/types/Target.ts index 0d281188..438e03df 100644 --- a/src/api/types/Target.ts +++ b/src/api/types/Target.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Specify the notification target. diff --git a/src/api/types/Tax.ts b/src/api/types/Tax.ts index 4bece004..3ee7426e 100644 --- a/src/api/types/Tax.ts +++ b/src/api/types/Tax.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Tax rate in percent applied to the invoice. diff --git a/src/api/types/Taxfillname.ts b/src/api/types/Taxfillname.ts index 554b4590..c639590f 100644 --- a/src/api/types/Taxfillname.ts +++ b/src/api/types/Taxfillname.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Business name in tax document. This is only relevant if a government entity has given you an alternative name to file tax documents with. diff --git a/src/api/types/TemplateAdditionalDataField.ts b/src/api/types/TemplateAdditionalDataField.ts index 34ad95af..d157f092 100644 --- a/src/api/types/TemplateAdditionalDataField.ts +++ b/src/api/types/TemplateAdditionalDataField.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateAdditionalDataField { visible?: Payabli.Visible | undefined; diff --git a/src/api/types/TemplateAdditionalDataSection.ts b/src/api/types/TemplateAdditionalDataSection.ts index 98f4fff0..0f5691e3 100644 --- a/src/api/types/TemplateAdditionalDataSection.ts +++ b/src/api/types/TemplateAdditionalDataSection.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateAdditionalDataSection { visible?: Payabli.Visible; diff --git a/src/api/types/TemplateCode.ts b/src/api/types/TemplateCode.ts index 7a79cb14..bc5fae51 100644 --- a/src/api/types/TemplateCode.ts +++ b/src/api/types/TemplateCode.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The internal code for the template. diff --git a/src/api/types/TemplateContent.ts b/src/api/types/TemplateContent.ts index 0b876c76..cd36a77b 100644 --- a/src/api/types/TemplateContent.ts +++ b/src/api/types/TemplateContent.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateContent { businessData?: Payabli.BusinessSection; diff --git a/src/api/types/TemplateContentResponse.ts b/src/api/types/TemplateContentResponse.ts index 276edf9f..a4dfdf85 100644 --- a/src/api/types/TemplateContentResponse.ts +++ b/src/api/types/TemplateContentResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateContentResponse { businessData?: Payabli.BusinessSection; diff --git a/src/api/types/TemplateData.ts b/src/api/types/TemplateData.ts index b9993749..0af2da4f 100644 --- a/src/api/types/TemplateData.ts +++ b/src/api/types/TemplateData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Object containing the template's data. diff --git a/src/api/types/TemplateElement.ts b/src/api/types/TemplateElement.ts index bea21cba..1a60c633 100644 --- a/src/api/types/TemplateElement.ts +++ b/src/api/types/TemplateElement.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateElement { posCol?: Payabli.PosCol; diff --git a/src/api/types/TemplateId.ts b/src/api/types/TemplateId.ts index 2fb2c979..9be2b9ee 100644 --- a/src/api/types/TemplateId.ts +++ b/src/api/types/TemplateId.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The associated boarding template's ID in Payabli. diff --git a/src/api/types/TemplateName.ts b/src/api/types/TemplateName.ts index f21e075a..e13a68ed 100644 --- a/src/api/types/TemplateName.ts +++ b/src/api/types/TemplateName.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The template name. diff --git a/src/api/types/TemplateQueryRecord.ts b/src/api/types/TemplateQueryRecord.ts index 1e9abf20..9543e4aa 100644 --- a/src/api/types/TemplateQueryRecord.ts +++ b/src/api/types/TemplateQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateQueryRecord { addPrice?: boolean; diff --git a/src/api/types/TemplateQueryResponse.ts b/src/api/types/TemplateQueryResponse.ts index b9e3dc80..2565d675 100644 --- a/src/api/types/TemplateQueryResponse.ts +++ b/src/api/types/TemplateQueryResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TemplateQueryResponse { records?: Payabli.TemplateQueryRecord[]; diff --git a/src/api/types/Terms.ts b/src/api/types/Terms.ts index 041ff44e..b6995912 100644 --- a/src/api/types/Terms.ts +++ b/src/api/types/Terms.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payment terms for invoice. If no terms are defined, then response data for this field defaults to `NET30`. diff --git a/src/api/types/TermsConditions.ts b/src/api/types/TermsConditions.ts index 12ab7dc1..2109a8d1 100644 --- a/src/api/types/TermsConditions.ts +++ b/src/api/types/TermsConditions.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom terms and conditions included in the invoice. diff --git a/src/api/types/Ticketamt.ts b/src/api/types/Ticketamt.ts index cba53429..e43984b5 100644 --- a/src/api/types/Ticketamt.ts +++ b/src/api/types/Ticketamt.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The average transaction size that the business expects to process. For example, if you process \$10,000 a month across 10 transactions, that's an average ticket of \$1000. diff --git a/src/api/types/TierItem.ts b/src/api/types/TierItem.ts index d347c419..c4535678 100644 --- a/src/api/types/TierItem.ts +++ b/src/api/types/TierItem.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TierItem { amountxAuth?: number; diff --git a/src/api/types/TierItemPass.ts b/src/api/types/TierItemPass.ts index 145797d2..9cecf81b 100644 --- a/src/api/types/TierItemPass.ts +++ b/src/api/types/TierItemPass.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TierItemPass { "amountFeeone-time"?: number; diff --git a/src/api/types/Timezone.ts b/src/api/types/Timezone.ts index 314412c7..822f3b37 100644 --- a/src/api/types/Timezone.ts +++ b/src/api/types/Timezone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timezone, in UTC offset. For example, -5 is Eastern time. diff --git a/src/api/types/Totalpages.ts b/src/api/types/Totalpages.ts index a16b0f3c..e737fe64 100644 --- a/src/api/types/Totalpages.ts +++ b/src/api/types/Totalpages.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Total number of pages in response. diff --git a/src/api/types/Totalrecords.ts b/src/api/types/Totalrecords.ts index 8d0db68f..bc2c297d 100644 --- a/src/api/types/Totalrecords.ts +++ b/src/api/types/Totalrecords.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Total number of records in response. diff --git a/src/api/types/TransStatus.ts b/src/api/types/TransStatus.ts index 53862c40..abea1e7d 100644 --- a/src/api/types/TransStatus.ts +++ b/src/api/types/TransStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Status of transaction. See [the docs](/developers/references/money-in-statuses#money-in-transaction-status) for a full reference. diff --git a/src/api/types/TransactionOutQueryRecord.ts b/src/api/types/TransactionOutQueryRecord.ts index 6d2a5dcc..b7faa1dd 100644 --- a/src/api/types/TransactionOutQueryRecord.ts +++ b/src/api/types/TransactionOutQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TransactionOutQueryRecord { /** Identifier of payout transaction. */ diff --git a/src/api/types/TransactionQueryRecords.ts b/src/api/types/TransactionQueryRecords.ts index 9492be86..e695fe42 100644 --- a/src/api/types/TransactionQueryRecords.ts +++ b/src/api/types/TransactionQueryRecords.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TransactionQueryRecords { AchHolderType?: Payabli.AchHolderType; diff --git a/src/api/types/TransactionQueryRecordsCustomer.ts b/src/api/types/TransactionQueryRecordsCustomer.ts index 6b1f5b79..a444f8b2 100644 --- a/src/api/types/TransactionQueryRecordsCustomer.ts +++ b/src/api/types/TransactionQueryRecordsCustomer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TransactionQueryRecordsCustomer { AchHolderType?: Payabli.AchHolderType; diff --git a/src/api/types/TransactionTime.ts b/src/api/types/TransactionTime.ts index e567149a..eca9f207 100644 --- a/src/api/types/TransactionTime.ts +++ b/src/api/types/TransactionTime.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Timestamp when transaction was submitted, in UTC. diff --git a/src/api/types/Transfer.ts b/src/api/types/Transfer.ts index 9fb13bc8..dd3835a2 100644 --- a/src/api/types/Transfer.ts +++ b/src/api/types/Transfer.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example @@ -43,8 +41,6 @@ import * as Payabli from "../index.js"; * eventsData: [{ * description: "Transfer Created", * eventTime: "2024-11-16T08:15:33.4364067Z", - * refData: undefined, - * extraData: undefined, * source: "worker" * }], * messages: [] diff --git a/src/api/types/TransferBankAccount.ts b/src/api/types/TransferBankAccount.ts index e9431565..3400f33d 100644 --- a/src/api/types/TransferBankAccount.ts +++ b/src/api/types/TransferBankAccount.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TransferBankAccount { accountNumber: Payabli.AccountNumber; diff --git a/src/api/types/TransferIdentifier.ts b/src/api/types/TransferIdentifier.ts index f145ed37..4ba2d2d5 100644 --- a/src/api/types/TransferIdentifier.ts +++ b/src/api/types/TransferIdentifier.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Unique identifier for the transfer. diff --git a/src/api/types/TransferMessage.ts b/src/api/types/TransferMessage.ts index f6e4f93b..f86084b7 100644 --- a/src/api/types/TransferMessage.ts +++ b/src/api/types/TransferMessage.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface TransferMessage { Id: number | null; diff --git a/src/api/types/TransferMessageProperties.ts b/src/api/types/TransferMessageProperties.ts index e234ea23..2b2d16b8 100644 --- a/src/api/types/TransferMessageProperties.ts +++ b/src/api/types/TransferMessageProperties.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface TransferMessageProperties { originalTransferStatus: string | null; diff --git a/src/api/types/TransferQueryResponse.ts b/src/api/types/TransferQueryResponse.ts index b03c6ca9..b50db005 100644 --- a/src/api/types/TransferQueryResponse.ts +++ b/src/api/types/TransferQueryResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example @@ -44,8 +42,6 @@ import * as Payabli from "../index.js"; * eventsData: [{ * description: "Transfer Created", * eventTime: "2024-11-16T08:15:33.4364067Z", - * refData: undefined, - * extraData: undefined, * source: "worker" * }], * messages: [] diff --git a/src/api/types/TransferSummary.ts b/src/api/types/TransferSummary.ts index 3fb55b90..3936290a 100644 --- a/src/api/types/TransferSummary.ts +++ b/src/api/types/TransferSummary.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example diff --git a/src/api/types/TypeAccount.ts b/src/api/types/TypeAccount.ts index 8ce3064c..47887915 100644 --- a/src/api/types/TypeAccount.ts +++ b/src/api/types/TypeAccount.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Type of bank account: Checking or Savings. - */ -export type TypeAccount = "Checking" | "Savings"; +/** Type of bank account: Checking or Savings. */ export const TypeAccount = { Checking: "Checking", Savings: "Savings", } as const; +export type TypeAccount = (typeof TypeAccount)[keyof typeof TypeAccount]; diff --git a/src/api/types/UnderWritingMethod.ts b/src/api/types/UnderWritingMethod.ts index 2f09aa20..5edf82dd 100644 --- a/src/api/types/UnderWritingMethod.ts +++ b/src/api/types/UnderWritingMethod.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * This field controls which method is used to handle risk orchestration. @@ -8,9 +6,9 @@ * - `manual`: Puts the application into the pending review status. An analyst must manually change it's final status to approved or declined. * - `bypass`: The application won't go through Payabli's review, and proceeds directly to boarding products and services. */ -export type UnderWritingMethod = "automatic" | "manual" | "bypass"; export const UnderWritingMethod = { Automatic: "automatic", Manual: "manual", Bypass: "bypass", } as const; +export type UnderWritingMethod = (typeof UnderWritingMethod)[keyof typeof UnderWritingMethod]; diff --git a/src/api/types/UnderwritingData.ts b/src/api/types/UnderwritingData.ts index 2b78bdda..b9577e16 100644 --- a/src/api/types/UnderwritingData.ts +++ b/src/api/types/UnderwritingData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Underwriting data is used to manage risk orchestration in the boarding application lifecycle. diff --git a/src/api/types/UnderwritingDataResponse.ts b/src/api/types/UnderwritingDataResponse.ts index 5dc6359b..81f2e2c2 100644 --- a/src/api/types/UnderwritingDataResponse.ts +++ b/src/api/types/UnderwritingDataResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * Underwriting data is used to manage risk orchestration in the boarding application lifecycle. diff --git a/src/api/types/UserData.ts b/src/api/types/UserData.ts index c8a14718..ed825b95 100644 --- a/src/api/types/UserData.ts +++ b/src/api/types/UserData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface UserData { access?: Payabli.UsrAccess[]; diff --git a/src/api/types/UserQueryRecord.ts b/src/api/types/UserQueryRecord.ts index afe4d735..05f513c1 100644 --- a/src/api/types/UserQueryRecord.ts +++ b/src/api/types/UserQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface UserQueryRecord { Access?: Payabli.UsrAccess[]; diff --git a/src/api/types/UsrAccess.ts b/src/api/types/UsrAccess.ts index 1b568013..9d4172e2 100644 --- a/src/api/types/UsrAccess.ts +++ b/src/api/types/UsrAccess.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export interface UsrAccess { roleLabel?: string; diff --git a/src/api/types/UsrStatus.ts b/src/api/types/UsrStatus.ts index 7bd63a28..01940a57 100644 --- a/src/api/types/UsrStatus.ts +++ b/src/api/types/UsrStatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The user's status: diff --git a/src/api/types/VCardQueryResponse.ts b/src/api/types/VCardQueryResponse.ts index 5ec4403a..18123985 100644 --- a/src/api/types/VCardQueryResponse.ts +++ b/src/api/types/VCardQueryResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface VCardQueryResponse { Summary?: Payabli.VCardSummary; diff --git a/src/api/types/VCardRecord.ts b/src/api/types/VCardRecord.ts index 37ee3f5a..29e41cd8 100644 --- a/src/api/types/VCardRecord.ts +++ b/src/api/types/VCardRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example diff --git a/src/api/types/VCardSummary.ts b/src/api/types/VCardSummary.ts index 8b31f10d..8d8f6195 100644 --- a/src/api/types/VCardSummary.ts +++ b/src/api/types/VCardSummary.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface VCardSummary { totalPages: Payabli.Totalpages; diff --git a/src/api/types/ValueTemplates.ts b/src/api/types/ValueTemplates.ts index 220aff3a..8d2fec93 100644 --- a/src/api/types/ValueTemplates.ts +++ b/src/api/types/ValueTemplates.ts @@ -1,5 +1,3 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export type ValueTemplates = string; diff --git a/src/api/types/VendorCheckNumber.ts b/src/api/types/VendorCheckNumber.ts index 6ad3804c..06356e52 100644 --- a/src/api/types/VendorCheckNumber.ts +++ b/src/api/types/VendorCheckNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * A check number, between 1 and 9999, passed as a string. This value can be used for fraud prevention with the positive pay service. diff --git a/src/api/types/VendorData.ts b/src/api/types/VendorData.ts index 0ac0cc3a..818cf0f1 100644 --- a/src/api/types/VendorData.ts +++ b/src/api/types/VendorData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface VendorData { vendorNumber?: Payabli.VendorNumber; diff --git a/src/api/types/VendorDataResponse.ts b/src/api/types/VendorDataResponse.ts index 7ac3031c..41b4c5f1 100644 --- a/src/api/types/VendorDataResponse.ts +++ b/src/api/types/VendorDataResponse.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example @@ -13,7 +11,6 @@ import * as Payabli from "../index.js"; * EIN: "XXXX6789", * Phone: "5555555555", * Email: "contact@hermanscoatings.com", - * RemitEmail: undefined, * Address1: "123 Ocean Drive", * Address2: "Suite 400", * City: "Miami", @@ -30,7 +27,6 @@ import * as Payabli from "../index.js"; * }], * BillingData: { * id: 123, - * accountId: undefined, * nickname: "Checking Account", * bankName: "Country Bank", * routingAccount: "123123123", @@ -47,7 +43,6 @@ import * as Payabli from "../index.js"; * PaymentMethod: Payabli.VendorDataResponsePaymentMethod.Vcard, * VendorStatus: 1, * VendorId: 1234, - * EnrollmentStatus: undefined, * Summary: { * ActiveBills: 5, * PendingBills: 2, @@ -170,14 +165,12 @@ export interface VendorDataResponse { } export namespace VendorDataResponse { - /** - * Preferred payment method for vendor. - */ - export type PaymentMethod = "vcard" | "ach" | "check" | "card"; + /** Preferred payment method for vendor. */ export const PaymentMethod = { Vcard: "vcard", Ach: "ach", Check: "check", Card: "card", } as const; + export type PaymentMethod = (typeof PaymentMethod)[keyof typeof PaymentMethod]; } diff --git a/src/api/types/VendorEin.ts b/src/api/types/VendorEin.ts index f4ee257c..db17c0f2 100644 --- a/src/api/types/VendorEin.ts +++ b/src/api/types/VendorEin.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * EIN/Tax ID for vendor. diff --git a/src/api/types/VendorName1.ts b/src/api/types/VendorName1.ts index d5d47442..03d5fe5a 100644 --- a/src/api/types/VendorName1.ts +++ b/src/api/types/VendorName1.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Primary name for vendor. Required for new vendor. diff --git a/src/api/types/VendorName2.ts b/src/api/types/VendorName2.ts index f5749831..4d51ab5e 100644 --- a/src/api/types/VendorName2.ts +++ b/src/api/types/VendorName2.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Secondary name for vendor. diff --git a/src/api/types/VendorNumber.ts b/src/api/types/VendorNumber.ts index 7dce9d58..5bb3cf20 100644 --- a/src/api/types/VendorNumber.ts +++ b/src/api/types/VendorNumber.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Custom number identifying the vendor. Must be unique in paypoint. diff --git a/src/api/types/VendorOutData.ts b/src/api/types/VendorOutData.ts index 09b5b523..965f113b 100644 --- a/src/api/types/VendorOutData.ts +++ b/src/api/types/VendorOutData.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; export interface VendorOutData { additionalData?: Payabli.AdditionalData; diff --git a/src/api/types/VendorPaymentMethod.ts b/src/api/types/VendorPaymentMethod.ts index 0ef6f7b5..813691df 100644 --- a/src/api/types/VendorPaymentMethod.ts +++ b/src/api/types/VendorPaymentMethod.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payment method object to use for the payout. diff --git a/src/api/types/VendorPaymentMethodString.ts b/src/api/types/VendorPaymentMethodString.ts index 6be6c9bc..5c5ea6e8 100644 --- a/src/api/types/VendorPaymentMethodString.ts +++ b/src/api/types/VendorPaymentMethodString.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The vendor's preferred payment method. Can be one of: diff --git a/src/api/types/VendorPhone.ts b/src/api/types/VendorPhone.ts index f6c8a745..c14fb283 100644 --- a/src/api/types/VendorPhone.ts +++ b/src/api/types/VendorPhone.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Vendor's phone number. Phone number can't contain non-digit characters like hyphens or parentheses. diff --git a/src/api/types/VendorQueryRecord.ts b/src/api/types/VendorQueryRecord.ts index 85fd0cde..d8f003e7 100644 --- a/src/api/types/VendorQueryRecord.ts +++ b/src/api/types/VendorQueryRecord.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as Payabli from "../index.js"; +import type * as Payabli from "../index.js"; /** * @example @@ -13,7 +11,6 @@ import * as Payabli from "../index.js"; * EIN: "123456789", * Phone: "212-555-1234", * Email: "example@email.com", - * RemitEmail: undefined, * Address1: "123 Ocean Drive", * Address2: "Suite 400", * City: "Bristol", @@ -44,10 +41,8 @@ import * as Payabli from "../index.js"; * services: [], * "default": true * }, - * PaymentMethod: undefined, * VendorStatus: 1, * VendorId: 1, - * EnrollmentStatus: undefined, * Summary: { * ActiveBills: 2, * PendingBills: 4, @@ -85,7 +80,6 @@ import * as Payabli from "../index.js"; * customField2: "", * customerVendorAccount: "123-456", * InternalReferenceId: 1000000, - * additionalData: undefined, * externalPaypointID: "Paypoint-100", * StoredMethods: [] * } diff --git a/src/api/types/VendorResponseBillingData.ts b/src/api/types/VendorResponseBillingData.ts index 8e1a4f5f..13d24e85 100644 --- a/src/api/types/VendorResponseBillingData.ts +++ b/src/api/types/VendorResponseBillingData.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Object containing vendor's bank information diff --git a/src/api/types/VendorResponseStoredMethod.ts b/src/api/types/VendorResponseStoredMethod.ts index 1c218d00..6b30b0ef 100644 --- a/src/api/types/VendorResponseStoredMethod.ts +++ b/src/api/types/VendorResponseStoredMethod.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Stored payment method information diff --git a/src/api/types/VendorResponseSummary.ts b/src/api/types/VendorResponseSummary.ts index b80ffa55..03ef3faa 100644 --- a/src/api/types/VendorResponseSummary.ts +++ b/src/api/types/VendorResponseSummary.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Vendor bill summary statistics diff --git a/src/api/types/VendorSummary.ts b/src/api/types/VendorSummary.ts index 1f2c6ca7..660077b5 100644 --- a/src/api/types/VendorSummary.ts +++ b/src/api/types/VendorSummary.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * @example diff --git a/src/api/types/Vendorid.ts b/src/api/types/Vendorid.ts index 24152912..20a3bcb3 100644 --- a/src/api/types/Vendorid.ts +++ b/src/api/types/Vendorid.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Payabli identifier for vendor record. diff --git a/src/api/types/Vendorstatus.ts b/src/api/types/Vendorstatus.ts index 14858b15..b223afee 100644 --- a/src/api/types/Vendorstatus.ts +++ b/src/api/types/Vendorstatus.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * Vendor's status. diff --git a/src/api/types/Visible.ts b/src/api/types/Visible.ts index 29f5cb36..eff8249a 100644 --- a/src/api/types/Visible.ts +++ b/src/api/types/Visible.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, makes the section visible on the application. diff --git a/src/api/types/WalletCascade.ts b/src/api/types/WalletCascade.ts index 96e67e4c..0de48302 100644 --- a/src/api/types/WalletCascade.ts +++ b/src/api/types/WalletCascade.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, the wallet service configuration cascades to all paypoints and suborganizations belonging to the parent entity. diff --git a/src/api/types/WalletIsEnabled.ts b/src/api/types/WalletIsEnabled.ts index 16eaeae3..fb361dec 100644 --- a/src/api/types/WalletIsEnabled.ts +++ b/src/api/types/WalletIsEnabled.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * When `true`, wallet service is enabled. diff --git a/src/api/types/Website.ts b/src/api/types/Website.ts index 83383e95..1f440d11 100644 --- a/src/api/types/Website.ts +++ b/src/api/types/Website.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * The business website address. Include only the domain and TLD, do not enter the protocol (http/https). For example: `www.example.com` is acceptable. diff --git a/src/api/types/Whencharged.ts b/src/api/types/Whencharged.ts index 70b0d5ca..09e6df7b 100644 --- a/src/api/types/Whencharged.ts +++ b/src/api/types/Whencharged.ts @@ -1,12 +1,8 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Describes when customers are charged for goods or services. Accepted values: - */ -export type Whencharged = "When Service Provided" | "In Advance"; +/** Describes when customers are charged for goods or services. Accepted values: */ export const Whencharged = { WhenServiceProvided: "When Service Provided", InAdvance: "In Advance", } as const; +export type Whencharged = (typeof Whencharged)[keyof typeof Whencharged]; diff --git a/src/api/types/Whendelivered.ts b/src/api/types/Whendelivered.ts index b80e41ab..323dc844 100644 --- a/src/api/types/Whendelivered.ts +++ b/src/api/types/Whendelivered.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * When goods and services are delivered. - */ -export type Whendelivered = "0-7 Days" | "8-14 Days" | "15-30 Days" | "Over 30 Days"; +/** When goods and services are delivered. */ export const Whendelivered = { Zero7Days: "0-7 Days", Eight14Days: "8-14 Days", Fifteen30Days: "15-30 Days", Over30Days: "Over 30 Days", } as const; +export type Whendelivered = (typeof Whendelivered)[keyof typeof Whendelivered]; diff --git a/src/api/types/Whenprovided.ts b/src/api/types/Whenprovided.ts index eaa058db..c6cd8722 100644 --- a/src/api/types/Whenprovided.ts +++ b/src/api/types/Whenprovided.ts @@ -1,13 +1,9 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Describes when goods or services are provided, from time of transaction. - */ -export type Whenprovided = "30 Days or Less" | "31 to 60 Days" | "60+ Days"; +/** Describes when goods or services are provided, from time of transaction. */ export const Whenprovided = { ThirtyDaysOrLess: "30 Days or Less", ThirtyOneTo60Days: "31 to 60 Days", SixtyDays: "60+ Days", } as const; +export type Whenprovided = (typeof Whenprovided)[keyof typeof Whenprovided]; diff --git a/src/api/types/Whenrefunded.ts b/src/api/types/Whenrefunded.ts index bae885bb..d38c1322 100644 --- a/src/api/types/Whenrefunded.ts +++ b/src/api/types/Whenrefunded.ts @@ -1,14 +1,10 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -/** - * Describes the business refund policy. - */ -export type Whenrefunded = "Exchange Only" | "No Refund or Exchange" | "More than 30 days" | "30 Days or Less"; +/** Describes the business refund policy. */ export const Whenrefunded = { ExchangeOnly: "Exchange Only", NoRefundOrExchange: "No Refund or Exchange", MoreThan30Days: "More than 30 days", ThirtyDaysOrLess: "30 Days or Less", } as const; +export type Whenrefunded = (typeof Whenrefunded)[keyof typeof Whenrefunded]; diff --git a/src/api/types/Zip.ts b/src/api/types/Zip.ts index 15f8ea9e..a89ddcfc 100644 --- a/src/api/types/Zip.ts +++ b/src/api/types/Zip.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. /** * ZIP code for address. diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 23e78114..11e422be 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,5 +1,3 @@ -export * from "./RoomIdNotInUse.js"; -export * from "./AchValidation.js"; export * from "./AcceptOauth.js"; export * from "./AcceptRegister.js"; export * from "./Accountexp.js"; @@ -17,6 +15,7 @@ export * from "./AchHolder.js"; export * from "./AchHolderType.js"; export * from "./AchLinkTypes.js"; export * from "./AchPassThroughSection.js"; +export * from "./AchPaymentMethod.js"; export * from "./Achrouting.js"; export * from "./AchSecCode.js"; export * from "./AchSection.js"; @@ -25,8 +24,9 @@ export * from "./AchSetup.js"; export * from "./AchTypes.js"; export * from "./AchTypesPass.js"; export * from "./AchTypesTiers.js"; -export * from "./AdditionalDataMap.js"; +export * from "./AchValidation.js"; export * from "./AdditionalData.js"; +export * from "./AdditionalDataMap.js"; export * from "./AdditionalDataString.js"; export * from "./AddPaymentMethodDomainApiResponse.js"; export * from "./AddressAddtlNullable.js"; @@ -36,17 +36,12 @@ export * from "./Annualrevenue.js"; export * from "./AppId.js"; export * from "./ApplePayData.js"; export * from "./ApplePayId.js"; -export * from "./GooglePayData.js"; -export * from "./GooglePayStatusData.js"; -export * from "./GooglePayMetadata.js"; export * from "./ApplePayMetadata.js"; export * from "./ApplePayOrganizationUpdateData.js"; -export * from "./AppleWalletData.js"; -export * from "./GoogleWalletData.js"; export * from "./ApplePayPaypointRegistrationData.js"; -export * from "./GooglePayPaypointRegistrationData.js"; export * from "./ApplePayStatusData.js"; export * from "./ApplePayType.js"; +export * from "./AppleWalletData.js"; export * from "./ApplicationData.js"; export * from "./ApplicationDataManaged.js"; export * from "./ApplicationDataOdp.js"; @@ -54,7 +49,9 @@ export * from "./ApplicationDataPayIn.js"; export * from "./ApplicationDetailsRecord.js"; export * from "./ApplicationQueryRecord.js"; export * from "./ASection.js"; +export * from "./AssociatedVendor.js"; export * from "./Attachments.js"; +export * from "./AttestationDate.js"; export * from "./Authcode.js"; export * from "./AutoElement.js"; export * from "./Avgmonthly.js"; @@ -78,8 +75,13 @@ export * from "./BatchSummary.js"; export * from "./Bcity.js"; export * from "./Bcountry.js"; export * from "./BDetails.js"; +export * from "./BillApprovals.js"; export * from "./BillData.js"; +export * from "./BillDetailResponse.js"; +export * from "./BillDetailsResponse.js"; export * from "./BillEvents.js"; +export * from "./BillId.js"; +export * from "./BillItem.js"; export * from "./BillingAddressAddtlNullable.js"; export * from "./BillingAddressNullable.js"; export * from "./BillingCityNullable.js"; @@ -89,20 +91,15 @@ export * from "./BillingDataResponse.js"; export * from "./BillingFeeDetail.js"; export * from "./BillingStateNullable.js"; export * from "./BillingZip.js"; -export * from "./BillItem.js"; export * from "./Billitems.js"; export * from "./BillOptions.js"; -export * from "./BillId.js"; -export * from "./BillPayOutDataRequest.js"; -export * from "./BillDetailsResponse.js"; export * from "./BillPayOutData.js"; -export * from "./BillDetailResponse.js"; -export * from "./BillApprovals.js"; -export * from "./BillQueryResponse.js"; -export * from "./BillQueryResponseSummary.js"; +export * from "./BillPayOutDataRequest.js"; export * from "./BillQueryRecord2.js"; export * from "./BillQueryRecord2BillApprovalsItem.js"; export * from "./BillQueryRecord2PaymentMethod.js"; +export * from "./BillQueryResponse.js"; +export * from "./BillQueryResponseSummary.js"; export * from "./Billstatus.js"; export * from "./BinData.js"; export * from "./Binperson.js"; @@ -161,8 +158,8 @@ export * from "./ConfigureApplePaypointApiResponse.js"; export * from "./ConfigureGooglePaypointApiResponse.js"; export * from "./ContactElement.js"; export * from "./Contacts.js"; -export * from "./ContactsResponse.js"; export * from "./ContactsField.js"; +export * from "./ContactsResponse.js"; export * from "./CountryNullable.js"; export * from "./CreatedAt.js"; export * from "./CustomerData.js"; @@ -175,11 +172,11 @@ export * from "./CustomerSummaryRecord.js"; export * from "./Cvvresponsetext.js"; export * from "./Datenullable.js"; export * from "./DatetimeNullable.js"; -export * from "./DeviceId.js"; export * from "./Dbaname.js"; export * from "./DepositDate.js"; export * from "./Descriptor.js"; export * from "./Device.js"; +export * from "./DeviceId.js"; export * from "./Discount.js"; export * from "./DisplayProperty.js"; export * from "./DocumentSection.js"; @@ -200,9 +197,9 @@ export * from "./EntrypageId.js"; export * from "./Entrypointfield.js"; export * from "./ExpectedDepositDate.js"; export * from "./ExpectedProcessingDateTime.js"; +export * from "./ExportFormat.js"; export * from "./ExternalPaypointId.js"; export * from "./ExternalProcessorInformation.js"; -export * from "./ExportFormat.js"; export * from "./FaxNumber.js"; export * from "./FeeAmount.js"; export * from "./File_.js"; @@ -215,6 +212,11 @@ export * from "./FrequencyList.js"; export * from "./Frequencynotification.js"; export * from "./Gatewayfield.js"; export * from "./GeneralEvents.js"; +export * from "./GooglePayData.js"; +export * from "./GooglePayMetadata.js"; +export * from "./GooglePayPaypointRegistrationData.js"; +export * from "./GooglePayStatusData.js"; +export * from "./GoogleWalletData.js"; export * from "./HasVcardTransactions.js"; export * from "./HeaderElement.js"; export * from "./Highticketamt.js"; @@ -233,13 +235,13 @@ export * from "./InvoiceType.js"; export * from "./IpAddress.js"; export * from "./IsEnabled.js"; export * from "./IsRoot.js"; +export * from "./IsSameDayAch.js"; export * from "./IsSuccess.js"; export * from "./ItemCommodityCode.js"; export * from "./ItemDescription.js"; export * from "./ItemProductCode.js"; export * from "./ItemProductName.js"; export * from "./ItemUnitofMeasure.js"; -export * from "./IsSameDayAch.js"; export * from "./JobId.js"; export * from "./JobStatus.js"; export * from "./KeyValue.js"; @@ -274,8 +276,8 @@ export * from "./MfaValidationCode.js"; export * from "./Mstate.js"; export * from "./Mzip.js"; export * from "./NameUser.js"; -export * from "./Netamountnullable.js"; export * from "./NetAmountstring.js"; +export * from "./Netamountnullable.js"; export * from "./NoteElement.js"; export * from "./NotificationContent.js"; export * from "./NotificationId.js"; @@ -327,10 +329,10 @@ export * from "./Pagesize.js"; export * from "./PairFiles.js"; export * from "./PayabliApiResponse.js"; export * from "./PayabliApiResponse0.js"; +export * from "./PayabliApiResponse6.js"; export * from "./PayabliApiResponse00.js"; -export * from "./PayabliApiResponse0000.js"; export * from "./PayabliApiResponse00Responsedatanonobject.js"; -export * from "./PayabliApiResponse6.js"; +export * from "./PayabliApiResponse0000.js"; export * from "./PayabliApiResponseCustomerQuery.js"; export * from "./PayabliApiResponseError400.js"; export * from "./PayabliApiResponseGeneric2Part.js"; @@ -343,41 +345,43 @@ export * from "./PayabliApiResponseTemplateId.js"; export * from "./PayabliApiResponseUserMfa.js"; export * from "./PayabliApiResponseVendors.js"; export * from "./PayabliCredentials.js"; +export * from "./PayabliCredentialsPascal.js"; export * from "./PayabliPages.js"; export * from "./PayCategory.js"; export * from "./PayeeName.js"; export * from "./PaylinkId.js"; +export * from "./PayMethodBodyAllFields.js"; +export * from "./PayMethodCloud.js"; +export * from "./PayMethodCredit.js"; +export * from "./PayMethodStoredMethod.js"; export * from "./PaymentCategories.js"; export * from "./PaymentDetail.js"; export * from "./PaymentDetailCredit.js"; -export * from "./Paymentid.js"; export * from "./PaymentIdString.js"; +export * from "./Paymentid.js"; export * from "./PaymentMethod.js"; -export * from "./PayMethodBodyAllFields.js"; -export * from "./PayMethodCredit.js"; -export * from "./PayMethodCloud.js"; -export * from "./PayMethodStoredMethod.js"; export * from "./PaymentMethodDomainApiResponse.js"; export * from "./PaymentMethodDomainGeneralResponse.js"; export * from "./PaymentMethodDomainId.js"; +export * from "./PaymentTransStatusDescription.js"; export * from "./PayorDataRequest.js"; export * from "./PayorDataResponse.js"; -export * from "./PayorId.js"; export * from "./PayorElement.js"; export * from "./PayorFields.js"; +export * from "./PayorId.js"; export * from "./PayoutAverageMonthlyVolume.js"; export * from "./PayoutAverageTicketLimit.js"; export * from "./PayoutCreditLimit.js"; -export * from "./PayoutHighTicketAmount.js"; export * from "./PayoutGatewayConnector.js"; +export * from "./PayoutHighTicketAmount.js"; export * from "./PayoutProgram.js"; export * from "./PaypointData.js"; export * from "./PaypointEntryConfig.js"; -export * from "./PayabliCredentialsPascal.js"; export * from "./PaypointId.js"; export * from "./PaypointName.js"; -export * from "./Paypointstatus.js"; export * from "./PaypointSummary.js"; +export * from "./Paypointstatus.js"; +export * from "./PciAttestation.js"; export * from "./PendingFeeAmount.js"; export * from "./PhoneNumber.js"; export * from "./PoiDevice.js"; @@ -424,14 +428,14 @@ export * from "./Remitaddress1.js"; export * from "./Remitaddress2.js"; export * from "./Remitcity.js"; export * from "./Remitcountry.js"; +export * from "./RemitEmail.js"; export * from "./Remitstate.js"; export * from "./Remitzip.js"; -export * from "./RemitEmail.js"; export * from "./RepCode.js"; -export * from "./RepName.js"; -export * from "./RepOffice.js"; export * from "./Replyby.js"; export * from "./ReplyToEmail.js"; +export * from "./RepName.js"; +export * from "./RepOffice.js"; export * from "./RequiredElement.js"; export * from "./Responsecode.js"; export * from "./Responsedata.js"; @@ -442,12 +446,13 @@ export * from "./Resulttext.js"; export * from "./Resumable.js"; export * from "./RetrievalId.js"; export * from "./ReturnedId.js"; +export * from "./RiskAction.js"; +export * from "./RiskActionCode.js"; export * from "./RiskFlagged.js"; export * from "./RiskFlaggedOn.js"; -export * from "./RiskStatus.js"; export * from "./RiskReason.js"; -export * from "./RiskAction.js"; -export * from "./RiskActionCode.js"; +export * from "./RiskStatus.js"; +export * from "./RoomIdNotInUse.js"; export * from "./RoutingAccount.js"; export * from "./SalesCode.js"; export * from "./SalesSection.js"; @@ -460,8 +465,8 @@ export * from "./Services.js"; export * from "./ServicesSection.js"; export * from "./SettingElement.js"; export * from "./SettingsQueryRecord.js"; -export * from "./SettlementStatusPayout.js"; export * from "./SettlementStatus.js"; +export * from "./SettlementStatusPayout.js"; export * from "./Shippingaddress.js"; export * from "./Shippingaddressadditional.js"; export * from "./Shippingcity.js"; @@ -470,24 +475,22 @@ export * from "./ShippingFromZip.js"; export * from "./Shippingstate.js"; export * from "./Shippingzip.js"; export * from "./Signaturedata.js"; +export * from "./SignDate.js"; +export * from "./SignedDocumentReference.js"; export * from "./SignerAcceptance.js"; -export * from "./Signeraddress.js"; export * from "./SignerAddress1.js"; +export * from "./Signeraddress.js"; export * from "./SignerCity.js"; export * from "./SignerCountry.js"; export * from "./SignerData.js"; export * from "./SignerDataRequest.js"; -export * from "./SignedDocumentReference.js"; -export * from "./AttestationDate.js"; -export * from "./PciAttestation.js"; export * from "./SignerDob.js"; export * from "./SignerName.js"; export * from "./SignerPhone.js"; +export * from "./SignerSection.js"; export * from "./SignerSsn.js"; export * from "./SignerState.js"; export * from "./SignerZip.js"; -export * from "./SignDate.js"; -export * from "./SignerSection.js"; export * from "./Source.js"; export * from "./SplitFunding.js"; export * from "./SplitFundingContent.js"; @@ -495,8 +498,8 @@ export * from "./SplitFundingRefundContent.js"; export * from "./SSection.js"; export * from "./StateNullable.js"; export * from "./Statusnotification.js"; -export * from "./Storedmethodid.js"; export * from "./StoredMethodUsageType.js"; +export * from "./Storedmethodid.js"; export * from "./Subdomain.js"; export * from "./SubFooter.js"; export * from "./SubHeader.js"; @@ -507,8 +510,8 @@ export * from "./SummaryOrg.js"; export * from "./Target.js"; export * from "./Tax.js"; export * from "./Taxfillname.js"; -export * from "./TemplateAdditionalDataSection.js"; export * from "./TemplateAdditionalDataField.js"; +export * from "./TemplateAdditionalDataSection.js"; export * from "./TemplateCode.js"; export * from "./TemplateContent.js"; export * from "./TemplateContentResponse.js"; @@ -530,47 +533,44 @@ export * from "./TransactionOutQueryRecord.js"; export * from "./TransactionQueryRecords.js"; export * from "./TransactionQueryRecordsCustomer.js"; export * from "./TransactionTime.js"; -export * from "./TransferIdentifier.js"; export * from "./Transfer.js"; export * from "./TransferBankAccount.js"; +export * from "./TransferIdentifier.js"; export * from "./TransferMessage.js"; export * from "./TransferMessageProperties.js"; -export * from "./TransferSummary.js"; export * from "./TransferQueryResponse.js"; +export * from "./TransferSummary.js"; export * from "./TransStatus.js"; -export * from "./PaymentTransStatusDescription.js"; export * from "./TypeAccount.js"; +export * from "./UnderWritingMethod.js"; export * from "./UnderwritingData.js"; export * from "./UnderwritingDataResponse.js"; -export * from "./UnderWritingMethod.js"; export * from "./UserData.js"; export * from "./UserQueryRecord.js"; export * from "./UsrAccess.js"; export * from "./UsrStatus.js"; export * from "./ValueTemplates.js"; -export * from "./VCardSummary.js"; -export * from "./AssociatedVendor.js"; -export * from "./VCardRecord.js"; export * from "./VCardQueryResponse.js"; +export * from "./VCardRecord.js"; +export * from "./VCardSummary.js"; export * from "./VendorCheckNumber.js"; export * from "./VendorData.js"; export * from "./VendorDataResponse.js"; -export * from "./VendorResponseSummary.js"; -export * from "./VendorResponseStoredMethod.js"; -export * from "./VendorResponseBillingData.js"; export * from "./VendorEin.js"; export * from "./Vendorid.js"; export * from "./VendorName1.js"; export * from "./VendorName2.js"; export * from "./VendorNumber.js"; export * from "./VendorOutData.js"; -export * from "./VendorPaymentMethodString.js"; export * from "./VendorPaymentMethod.js"; -export * from "./AchPaymentMethod.js"; +export * from "./VendorPaymentMethodString.js"; export * from "./VendorPhone.js"; export * from "./VendorQueryRecord.js"; -export * from "./Vendorstatus.js"; +export * from "./VendorResponseBillingData.js"; +export * from "./VendorResponseStoredMethod.js"; +export * from "./VendorResponseSummary.js"; export * from "./VendorSummary.js"; +export * from "./Vendorstatus.js"; export * from "./Visible.js"; export * from "./WalletCascade.js"; export * from "./WalletIsEnabled.js"; diff --git a/src/auth/HeaderAuthProvider.ts b/src/auth/HeaderAuthProvider.ts new file mode 100644 index 00000000..e7b7fb98 --- /dev/null +++ b/src/auth/HeaderAuthProvider.ts @@ -0,0 +1,37 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as core from "../core/index.js"; +import * as errors from "../errors/index.js"; + +export namespace HeaderAuthProvider { + export interface Options { + apiKey?: core.Supplier; + } +} + +export class HeaderAuthProvider implements core.AuthProvider { + private readonly headerValue: core.Supplier; + + constructor(options: HeaderAuthProvider.Options) { + this.headerValue = options.apiKey; + } + + public static canCreate(options: HeaderAuthProvider.Options): boolean { + return options.apiKey != null; + } + + public async getAuthRequest(_arg?: { endpointMetadata?: core.EndpointMetadata }): Promise { + const apiKey = await core.Supplier.get(this.headerValue); + if (apiKey == null) { + throw new errors.PayabliError({ + message: "Please specify a apiKey by passing it in to the constructor", + }); + } + + const headerValue = apiKey; + + return { + headers: { requestToken: headerValue }, + }; + } +} diff --git a/src/auth/index.ts b/src/auth/index.ts new file mode 100644 index 00000000..c3485ef1 --- /dev/null +++ b/src/auth/index.ts @@ -0,0 +1 @@ +export { HeaderAuthProvider } from "./HeaderAuthProvider.js"; diff --git a/src/core/auth/AuthProvider.ts b/src/core/auth/AuthProvider.ts new file mode 100644 index 00000000..895a50ff --- /dev/null +++ b/src/core/auth/AuthProvider.ts @@ -0,0 +1,6 @@ +import type { EndpointMetadata } from "../fetcher/EndpointMetadata.js"; +import type { AuthRequest } from "./AuthRequest.js"; + +export interface AuthProvider { + getAuthRequest(arg?: { endpointMetadata?: EndpointMetadata }): Promise; +} diff --git a/src/core/auth/AuthRequest.ts b/src/core/auth/AuthRequest.ts new file mode 100644 index 00000000..f6218b42 --- /dev/null +++ b/src/core/auth/AuthRequest.ts @@ -0,0 +1,9 @@ +/** + * Request parameters for authentication requests. + */ +export interface AuthRequest { + /** + * The headers to be included in the request. + */ + headers: Record; +} diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts new file mode 100644 index 00000000..a6423591 --- /dev/null +++ b/src/core/auth/BasicAuth.ts @@ -0,0 +1,32 @@ +import { base64Decode, base64Encode } from "../base64.js"; + +export interface BasicAuth { + username: string; + password: string; +} + +const BASIC_AUTH_HEADER_PREFIX = /^Basic /i; + +export const BasicAuth = { + toAuthorizationHeader: (basicAuth: BasicAuth | undefined): string | undefined => { + if (basicAuth == null) { + return undefined; + } + const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`); + return `Basic ${token}`; + }, + fromAuthorizationHeader: (header: string): BasicAuth => { + const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, ""); + const decoded = base64Decode(credentials); + const [username, ...passwordParts] = decoded.split(":"); + const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined; + + if (username == null || password == null) { + throw new Error("Invalid basic auth"); + } + return { + username, + password, + }; + }, +}; diff --git a/src/core/auth/BearerToken.ts b/src/core/auth/BearerToken.ts new file mode 100644 index 00000000..c44a06c3 --- /dev/null +++ b/src/core/auth/BearerToken.ts @@ -0,0 +1,20 @@ +export type BearerToken = string; + +const BEARER_AUTH_HEADER_PREFIX = /^Bearer /i; + +function toAuthorizationHeader(token: string | undefined): string | undefined { + if (token == null) { + return undefined; + } + return `Bearer ${token}`; +} + +export const BearerToken: { + toAuthorizationHeader: typeof toAuthorizationHeader; + fromAuthorizationHeader: (header: string) => BearerToken; +} = { + toAuthorizationHeader: toAuthorizationHeader, + fromAuthorizationHeader: (header: string): BearerToken => { + return header.replace(BEARER_AUTH_HEADER_PREFIX, "").trim() as BearerToken; + }, +}; diff --git a/src/core/auth/NoOpAuthProvider.ts b/src/core/auth/NoOpAuthProvider.ts new file mode 100644 index 00000000..5b7acfd2 --- /dev/null +++ b/src/core/auth/NoOpAuthProvider.ts @@ -0,0 +1,8 @@ +import type { AuthProvider } from "./AuthProvider.js"; +import type { AuthRequest } from "./AuthRequest.js"; + +export class NoOpAuthProvider implements AuthProvider { + public getAuthRequest(): Promise { + return Promise.resolve({ headers: {} }); + } +} diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts new file mode 100644 index 00000000..2215b227 --- /dev/null +++ b/src/core/auth/index.ts @@ -0,0 +1,5 @@ +export type { AuthProvider } from "./AuthProvider.js"; +export type { AuthRequest } from "./AuthRequest.js"; +export { BasicAuth } from "./BasicAuth.js"; +export { BearerToken } from "./BearerToken.js"; +export { NoOpAuthProvider } from "./NoOpAuthProvider.js"; diff --git a/src/core/base64.ts b/src/core/base64.ts new file mode 100644 index 00000000..448a0db6 --- /dev/null +++ b/src/core/base64.ts @@ -0,0 +1,27 @@ +function base64ToBytes(base64: string): Uint8Array { + const binString = atob(base64); + return Uint8Array.from(binString, (m) => m.codePointAt(0)!); +} + +function bytesToBase64(bytes: Uint8Array): string { + const binString = String.fromCodePoint(...bytes); + return btoa(binString); +} + +export function base64Encode(input: string): string { + if (typeof Buffer !== "undefined") { + return Buffer.from(input, "utf8").toString("base64"); + } + + const bytes = new TextEncoder().encode(input); + return bytesToBase64(bytes); +} + +export function base64Decode(input: string): string { + if (typeof Buffer !== "undefined") { + return Buffer.from(input, "base64").toString("utf8"); + } + + const bytes = base64ToBytes(input); + return new TextDecoder().decode(bytes); +} diff --git a/src/core/exports.ts b/src/core/exports.ts new file mode 100644 index 00000000..358d1fb9 --- /dev/null +++ b/src/core/exports.ts @@ -0,0 +1,2 @@ +export * from "./file/exports.js"; +export * from "./logging/exports.js"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index dd4b9466..97ab83c2 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -1,4 +1,4 @@ -import { RawResponse } from "./RawResponse.js"; +import type { RawResponse } from "./RawResponse.js"; /** * The response of an API call. diff --git a/src/core/fetcher/BinaryResponse.ts b/src/core/fetcher/BinaryResponse.ts index 8c134bc3..bca7f4c7 100644 --- a/src/core/fetcher/BinaryResponse.ts +++ b/src/core/fetcher/BinaryResponse.ts @@ -1,29 +1,34 @@ -import { ResponseWithBody } from "./ResponseWithBody.js"; - -export interface BinaryResponse { +export type BinaryResponse = { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ - bodyUsed: boolean; + bodyUsed: Response["bodyUsed"]; /** * Returns a ReadableStream of the response body. * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ - stream: () => ReadableStream; + stream: () => Response["body"]; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ - arrayBuffer: () => Promise; + arrayBuffer: () => ReturnType; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ - blob: () => Promise; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */ - bytes(): Promise; -} + blob: () => ReturnType; + /** + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) + * Some versions of the Fetch API may not support this method. + */ + bytes?(): ReturnType; +}; -export function getBinaryResponse(response: ResponseWithBody): BinaryResponse { - return { +export function getBinaryResponse(response: Response): BinaryResponse { + const binaryResponse: BinaryResponse = { get bodyUsed() { return response.bodyUsed; }, stream: () => response.body, arrayBuffer: response.arrayBuffer.bind(response), blob: response.blob.bind(response), - bytes: response.bytes.bind(response), }; + if ("bytes" in response && typeof response.bytes === "function") { + binaryResponse.bytes = response.bytes.bind(response); + } + + return binaryResponse; } diff --git a/src/core/fetcher/EndpointMetadata.ts b/src/core/fetcher/EndpointMetadata.ts new file mode 100644 index 00000000..998d68f5 --- /dev/null +++ b/src/core/fetcher/EndpointMetadata.ts @@ -0,0 +1,13 @@ +export type SecuritySchemeKey = string; +/** + * A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme. + * All schemes in the collection must be satisfied for authentication to be successful. + */ +export type SecuritySchemeCollection = Record; +export type AuthScope = string; +export type EndpointMetadata = { + /** + * An array of security scheme collections. Each collection represents an alternative way to authenticate. + */ + security?: SecuritySchemeCollection[]; +}; diff --git a/src/core/fetcher/EndpointSupplier.ts b/src/core/fetcher/EndpointSupplier.ts new file mode 100644 index 00000000..8079841c --- /dev/null +++ b/src/core/fetcher/EndpointSupplier.ts @@ -0,0 +1,14 @@ +import type { EndpointMetadata } from "./EndpointMetadata.js"; +import type { Supplier } from "./Supplier.js"; + +type EndpointSupplierFn = (arg: { endpointMetadata: EndpointMetadata }) => T | Promise; +export type EndpointSupplier = Supplier | EndpointSupplierFn; +export const EndpointSupplier = { + get: async (supplier: EndpointSupplier, arg: { endpointMetadata: EndpointMetadata }): Promise => { + if (typeof supplier === "function") { + return (supplier as EndpointSupplierFn)(arg); + } else { + return supplier; + } + }, +}; diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 5f3ba763..58bb0e3e 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,12 +1,16 @@ import { toJson } from "../json.js"; -import { APIResponse } from "./APIResponse.js"; -import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; -import { Supplier } from "./Supplier.js"; +import { createLogger, type LogConfig, type Logger } from "../logging/logger.js"; +import type { APIResponse } from "./APIResponse.js"; import { createRequestUrl } from "./createRequestUrl.js"; +import type { EndpointMetadata } from "./EndpointMetadata.js"; +import { EndpointSupplier } from "./EndpointSupplier.js"; +import { getErrorResponseBody } from "./getErrorResponseBody.js"; import { getFetchFn } from "./getFetchFn.js"; import { getRequestBody } from "./getRequestBody.js"; import { getResponseBody } from "./getResponseBody.js"; +import { Headers } from "./Headers.js"; import { makeRequest } from "./makeRequest.js"; +import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; import { requestWithRetries } from "./requestWithRetries.js"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -16,19 +20,22 @@ export declare namespace Fetcher { url: string; method: string; contentType?: string; - headers?: Record | undefined>; - queryParameters?: Record; + headers?: Record | null | undefined>; + queryParameters?: Record; body?: unknown; timeoutMs?: number; maxRetries?: number; withCredentials?: boolean; abortSignal?: AbortSignal; - requestType?: "json" | "file" | "bytes"; + requestType?: "json" | "file" | "bytes" | "form" | "other"; responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response"; duplex?: "half"; + endpointMetadata?: EndpointMetadata; + fetchFn?: typeof fetch; + logging?: LogConfig | Logger; } - export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; + export type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError; export interface FailedStatusCodeError { reason: "status-code"; @@ -42,6 +49,11 @@ export declare namespace Fetcher { rawBody: string; } + export interface BodyIsNullError { + reason: "body-is-null"; + statusCode: number; + } + export interface TimeoutError { reason: "timeout"; } @@ -52,10 +64,164 @@ export declare namespace Fetcher { } } -async function getHeaders(args: Fetcher.Args): Promise> { - const newHeaders: Record = {}; +const SENSITIVE_HEADERS = new Set([ + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "cookie", + "set-cookie", + "proxy-authorization", + "proxy-authenticate", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token", +]); + +function redactHeaders(headers: Headers | Record): Record { + const filtered: Record = {}; + for (const [key, value] of headers instanceof Headers ? headers.entries() : Object.entries(headers)) { + if (SENSITIVE_HEADERS.has(key.toLowerCase())) { + filtered[key] = "[REDACTED]"; + } else { + filtered[key] = value; + } + } + return filtered; +} + +const SENSITIVE_QUERY_PARAMS = new Set([ + "api_key", + "api-key", + "apikey", + "token", + "access_token", + "access-token", + "auth_token", + "auth-token", + "password", + "passwd", + "secret", + "api_secret", + "api-secret", + "apisecret", + "key", + "session", + "session_id", + "session-id", +]); + +function redactQueryParameters(queryParameters?: Record): Record | undefined { + if (queryParameters == null) { + return queryParameters; + } + const redacted: Record = {}; + for (const [key, value] of Object.entries(queryParameters)) { + if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) { + redacted[key] = "[REDACTED]"; + } else { + redacted[key] = value; + } + } + return redacted; +} + +function redactUrl(url: string): string { + const protocolIndex = url.indexOf("://"); + if (protocolIndex === -1) return url; + + const afterProtocol = protocolIndex + 3; + + // Find the first delimiter that marks the end of the authority section + const pathStart = url.indexOf("/", afterProtocol); + let queryStart = url.indexOf("?", afterProtocol); + let fragmentStart = url.indexOf("#", afterProtocol); + + const firstDelimiter = Math.min( + pathStart === -1 ? url.length : pathStart, + queryStart === -1 ? url.length : queryStart, + fragmentStart === -1 ? url.length : fragmentStart, + ); + + // Find the LAST @ before the delimiter (handles multiple @ in credentials) + let atIndex = -1; + for (let i = afterProtocol; i < firstDelimiter; i++) { + if (url[i] === "@") { + atIndex = i; + } + } + + if (atIndex !== -1) { + url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`; + } + + // Recalculate queryStart since url might have changed + queryStart = url.indexOf("?"); + if (queryStart === -1) return url; + + fragmentStart = url.indexOf("#", queryStart); + const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length; + const queryString = url.slice(queryStart + 1, queryEnd); + + if (queryString.length === 0) return url; + + // FAST PATH: Quick check if any sensitive keywords present + // Using indexOf is faster than regex for simple substring matching + const lower = queryString.toLowerCase(); + const hasSensitive = + lower.includes("token") || + lower.includes("key") || + lower.includes("password") || + lower.includes("passwd") || + lower.includes("secret") || + lower.includes("session") || + lower.includes("auth"); + + if (!hasSensitive) { + return url; + } + + // SLOW PATH: Parse and redact + const redactedParams: string[] = []; + const params = queryString.split("&"); + + for (const param of params) { + const equalIndex = param.indexOf("="); + if (equalIndex === -1) { + redactedParams.push(param); + continue; + } + + const key = param.slice(0, equalIndex); + let shouldRedact = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()); + + if (!shouldRedact && key.includes("%")) { + try { + const decodedKey = decodeURIComponent(key); + shouldRedact = SENSITIVE_QUERY_PARAMS.has(decodedKey.toLowerCase()); + } catch {} + } + + redactedParams.push(shouldRedact ? `${key}=[REDACTED]` : param); + } + + return url.slice(0, queryStart + 1) + redactedParams.join("&") + url.slice(queryEnd); +} + +async function getHeaders(args: Fetcher.Args): Promise { + const newHeaders: Headers = new Headers(); + + newHeaders.set( + "Accept", + args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : "*/*", + ); if (args.body !== undefined && args.contentType != null) { - newHeaders["Content-Type"] = args.contentType; + newHeaders.set("Content-Type", args.contentType); } if (args.headers == null) { @@ -63,15 +229,15 @@ async function getHeaders(args: Fetcher.Args): Promise> { } for (const [key, value] of Object.entries(args.headers)) { - const result = await Supplier.get(value); + const result = await EndpointSupplier.get(value, { endpointMetadata: args.endpointMetadata ?? {} }); if (typeof result === "string") { - newHeaders[key] = result; + newHeaders.set(key, result); continue; } if (result == null) { continue; } - newHeaders[key] = `${result}`; + newHeaders.set(key, `${result}`); } return newHeaders; } @@ -80,9 +246,22 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise= 200 && response.status < 400) { + if (logger.isDebug()) { + const metadata = { + method: args.method, + url: redactUrl(url), + statusCode: response.status, + responseHeaders: redactHeaders(response.headers), + }; + logger.debug("HTTP request succeeded", metadata); + } + const body = await getResponseBody(response, args.responseType); return { ok: true, - body: responseBody as R, + body: body as R, headers: response.headers, rawResponse: toRawResponse(response), }; } else { + if (logger.isError()) { + const metadata = { + method: args.method, + url: redactUrl(url), + statusCode: response.status, + responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries())), + }; + logger.error("HTTP request failed with error status", metadata); + } return { ok: false, error: { reason: "status-code", statusCode: response.status, - body: responseBody, + body: await getErrorResponseBody(response), }, rawResponse: toRawResponse(response), }; } } catch (error) { - if (args.abortSignal != null && args.abortSignal.aborted) { + if (args.abortSignal?.aborted) { + if (logger.isError()) { + const metadata = { + method: args.method, + url: redactUrl(url), + }; + logger.error("HTTP request was aborted", metadata); + } return { ok: false, error: { @@ -131,6 +335,14 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise; -}; - -export function isResponseWithBody(response: Response): response is ResponseWithBody { - return (response as ResponseWithBody).body != null; -} diff --git a/src/core/fetcher/getErrorResponseBody.ts b/src/core/fetcher/getErrorResponseBody.ts new file mode 100644 index 00000000..7cf4e623 --- /dev/null +++ b/src/core/fetcher/getErrorResponseBody.ts @@ -0,0 +1,33 @@ +import { fromJson } from "../json.js"; +import { getResponseBody } from "./getResponseBody.js"; + +export async function getErrorResponseBody(response: Response): Promise { + let contentType = response.headers.get("Content-Type")?.toLowerCase(); + if (contentType == null || contentType.length === 0) { + return getResponseBody(response); + } + + if (contentType.indexOf(";") !== -1) { + contentType = contentType.split(";")[0]?.trim() ?? ""; + } + switch (contentType) { + case "application/hal+json": + case "application/json": + case "application/ld+json": + case "application/problem+json": + case "application/vnd.api+json": + case "text/json": { + const text = await response.text(); + return text.length > 0 ? fromJson(text) : undefined; + } + default: + if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) { + const text = await response.text(); + return text.length > 0 ? fromJson(text) : undefined; + } + + // Fallback to plain text if content type is not recognized + // Even if no body is present, the response will be an empty string + return await response.text(); + } +} diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts index e38457c5..91d9d81f 100644 --- a/src/core/fetcher/getRequestBody.ts +++ b/src/core/fetcher/getRequestBody.ts @@ -1,13 +1,17 @@ import { toJson } from "../json.js"; +import { toQueryString } from "../url/qs.js"; export declare namespace GetRequestBody { interface Args { body: unknown; - type: "json" | "file" | "bytes" | "other"; + type: "json" | "file" | "bytes" | "form" | "other"; } } export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { + if (type === "form") { + return toQueryString(body, { arrayFormat: "repeat", encode: true }); + } if (type.includes("json")) { return toJson(body); } else { diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts index 44a7ebfd..708d5572 100644 --- a/src/core/fetcher/getResponseBody.ts +++ b/src/core/fetcher/getResponseBody.ts @@ -1,10 +1,7 @@ +import { fromJson } from "../json.js"; import { getBinaryResponse } from "./BinaryResponse.js"; -import { isResponseWithBody } from "./ResponseWithBody.js"; export async function getResponseBody(response: Response, responseType?: string): Promise { - if (!isResponseWithBody(response)) { - return undefined; - } switch (responseType) { case "binary-response": return getBinaryResponse(response); @@ -13,8 +10,27 @@ export async function getResponseBody(response: Response, responseType?: string) case "arrayBuffer": return await response.arrayBuffer(); case "sse": + if (response.body == null) { + return { + ok: false, + error: { + reason: "body-is-null", + statusCode: response.status, + }, + }; + } return response.body; case "streaming": + if (response.body == null) { + return { + ok: false, + error: { + reason: "body-is-null", + statusCode: response.status, + }, + }; + } + return response.body; case "text": @@ -25,9 +41,9 @@ export async function getResponseBody(response: Response, responseType?: string) const text = await response.text(); if (text.length > 0) { try { - let responseBody = JSON.parse(text); + const responseBody = fromJson(text); return responseBody; - } catch (err) { + } catch (_err) { return { ok: false, error: { diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 49e13932..c3bc6da2 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,9 +1,11 @@ export type { APIResponse } from "./APIResponse.js"; -export { fetcher } from "./Fetcher.js"; +export type { BinaryResponse } from "./BinaryResponse.js"; +export type { EndpointMetadata } from "./EndpointMetadata.js"; +export { EndpointSupplier } from "./EndpointSupplier.js"; export type { Fetcher, FetchFunction } from "./Fetcher.js"; +export { fetcher } from "./Fetcher.js"; export { getHeader } from "./getHeader.js"; -export { Supplier } from "./Supplier.js"; -export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; -export type { RawResponse, WithRawResponse } from "./RawResponse.js"; export { HttpResponsePromise } from "./HttpResponsePromise.js"; -export { BinaryResponse } from "./BinaryResponse.js"; +export type { RawResponse, WithRawResponse } from "./RawResponse.js"; +export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +export { Supplier } from "./Supplier.js"; diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 1a5ffd3c..921565eb 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -4,7 +4,7 @@ export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, url: string, method: string, - headers: Record, + headers: Headers | Record, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, @@ -13,19 +13,17 @@ export const makeRequest = async ( ): Promise => { const signals: AbortSignal[] = []; - // Add timeout signal - let timeoutAbortId: NodeJS.Timeout | undefined = undefined; + let timeoutAbortId: ReturnType | undefined; if (timeoutMs != null) { const { signal, abortId } = getTimeoutSignal(timeoutMs); timeoutAbortId = abortId; signals.push(signal); } - // Add arbitrary signal if (abortSignal != null) { signals.push(abortSignal); } - let newSignals = anySignal(signals); + const newSignals = anySignal(signals); const response = await fetchFn(url, { method: method, headers, diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index add3cce0..1f689688 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -3,12 +3,47 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds const DEFAULT_MAX_RETRIES = 2; const JITTER_FACTOR = 0.2; // 20% random jitter -function addJitter(delay: number): number { - // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR - const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR; +function addPositiveJitter(delay: number): number { + const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR; return delay * jitterMultiplier; } +function addSymmetricJitter(delay: number): number { + const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR; + return delay * jitterMultiplier; +} + +function getRetryDelayFromHeaders(response: Response, retryAttempt: number): number { + const retryAfter = response.headers.get("Retry-After"); + if (retryAfter) { + const retryAfterSeconds = parseInt(retryAfter, 10); + if (!Number.isNaN(retryAfterSeconds) && retryAfterSeconds > 0) { + return Math.min(retryAfterSeconds * 1000, MAX_RETRY_DELAY); + } + + const retryAfterDate = new Date(retryAfter); + if (!Number.isNaN(retryAfterDate.getTime())) { + const delay = retryAfterDate.getTime() - Date.now(); + if (delay > 0) { + return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY); + } + } + } + + const rateLimitReset = response.headers.get("X-RateLimit-Reset"); + if (rateLimitReset) { + const resetTime = parseInt(rateLimitReset, 10); + if (!Number.isNaN(resetTime)) { + const delay = resetTime * 1000 - Date.now(); + if (delay > 0) { + return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY)); + } + } + } + + return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * 2 ** retryAttempt, MAX_RETRY_DELAY)); +} + export async function requestWithRetries( requestFn: () => Promise, maxRetries: number = DEFAULT_MAX_RETRIES, @@ -17,13 +52,9 @@ export async function requestWithRetries( for (let i = 0; i < maxRetries; ++i) { if ([408, 429].includes(response.status) || response.status >= 500) { - // Calculate base delay using exponential backoff (in milliseconds) - const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); - - // Add jitter to the delay - const delayWithJitter = addJitter(baseDelay); + const delay = getRetryDelayFromHeaders(response, i); - await new Promise((resolve) => setTimeout(resolve, delayWithJitter)); + await new Promise((resolve) => setTimeout(resolve, delay)); response = await requestFn(); } else { break; diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts index a8d32a2e..7bd3757e 100644 --- a/src/core/fetcher/signals.ts +++ b/src/core/fetcher/signals.ts @@ -1,34 +1,22 @@ const TIMEOUT = "timeout"; -export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: NodeJS.Timeout } { +export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: ReturnType } { const controller = new AbortController(); const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs); return { signal: controller.signal, abortId }; } -/** - * Returns an abort signal that is getting aborted when - * at least one of the specified abort signals is aborted. - * - * Requires at least node.js 18. - */ export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { - // Allowing signals to be passed either as array - // of signals or as multiple arguments. const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as AbortSignal[]; const controller = new AbortController(); for (const signal of signals) { if (signal.aborted) { - // Exiting early if one of the signals - // is already aborted. controller.abort((signal as any)?.reason); break; } - // Listening for signals and removing the listeners - // when at least one symbol is aborted. signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { signal: controller.signal, }); diff --git a/src/core/file.ts b/src/core/file.ts deleted file mode 100644 index 57e7539d..00000000 --- a/src/core/file.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type FileLike = - | ArrayBuffer - | Uint8Array - | import("buffer").Buffer - | import("buffer").Blob - | import("buffer").File - | import("stream").Readable - | import("stream/web").ReadableStream - | globalThis.Blob - | globalThis.File - | ReadableStream; diff --git a/src/core/file/exports.ts b/src/core/file/exports.ts new file mode 100644 index 00000000..3b0b3967 --- /dev/null +++ b/src/core/file/exports.ts @@ -0,0 +1 @@ +export type { Uploadable } from "./types.js"; diff --git a/src/core/file/file.ts b/src/core/file/file.ts new file mode 100644 index 00000000..0bacc484 --- /dev/null +++ b/src/core/file/file.ts @@ -0,0 +1,217 @@ +import type { Uploadable } from "./types.js"; + +export async function toBinaryUploadRequest( + file: Uploadable, +): Promise<{ body: Uploadable.FileLike; headers?: Record }> { + const { data, filename, contentLength, contentType } = await getFileWithMetadata(file); + const request = { + body: data, + headers: {} as Record, + }; + if (filename) { + request.headers["Content-Disposition"] = `attachment; filename="${filename}"`; + } + if (contentType) { + request.headers["Content-Type"] = contentType; + } + if (contentLength != null) { + request.headers["Content-Length"] = contentLength.toString(); + } + return request; +} + +export async function toMultipartDataPart( + file: Uploadable, +): Promise<{ data: Uploadable.FileLike; filename?: string; contentType?: string }> { + const { data, filename, contentType } = await getFileWithMetadata(file, { + noSniffFileSize: true, + }); + return { + data, + filename, + contentType, + }; +} + +async function getFileWithMetadata( + file: Uploadable, + { noSniffFileSize }: { noSniffFileSize?: boolean } = {}, +): Promise { + if (isFileLike(file)) { + return getFileWithMetadata( + { + data: file, + }, + { noSniffFileSize }, + ); + } + + if ("path" in file) { + const fs = await import("fs"); + if (!fs || !fs.createReadStream) { + throw new Error("File path uploads are not supported in this environment."); + } + const data = fs.createReadStream(file.path); + const contentLength = + file.contentLength ?? (noSniffFileSize === true ? undefined : await tryGetFileSizeFromPath(file.path)); + const filename = file.filename ?? getNameFromPath(file.path); + return { + data, + filename, + contentType: file.contentType, + contentLength, + }; + } + if ("data" in file) { + const data = file.data; + const contentLength = + file.contentLength ?? + (await tryGetContentLengthFromFileLike(data, { + noSniffFileSize, + })); + const filename = file.filename ?? tryGetNameFromFileLike(data); + return { + data, + filename, + contentType: file.contentType ?? tryGetContentTypeFromFileLike(data), + contentLength, + }; + } + + throw new Error(`Invalid FileUpload of type ${typeof file}: ${JSON.stringify(file)}`); +} + +function isFileLike(value: unknown): value is Uploadable.FileLike { + return ( + isBuffer(value) || + isArrayBufferView(value) || + isArrayBuffer(value) || + isUint8Array(value) || + isBlob(value) || + isFile(value) || + isStreamLike(value) || + isReadableStream(value) + ); +} + +async function tryGetFileSizeFromPath(path: string): Promise { + try { + const fs = await import("fs"); + if (!fs || !fs.promises || !fs.promises.stat) { + return undefined; + } + const fileStat = await fs.promises.stat(path); + return fileStat.size; + } catch (_fallbackError) { + return undefined; + } +} + +function tryGetNameFromFileLike(data: Uploadable.FileLike): string | undefined { + if (isNamedValue(data)) { + return data.name; + } + if (isPathedValue(data)) { + return getNameFromPath(data.path.toString()); + } + return undefined; +} + +async function tryGetContentLengthFromFileLike( + data: Uploadable.FileLike, + { noSniffFileSize }: { noSniffFileSize?: boolean } = {}, +): Promise { + if (isBuffer(data)) { + return data.length; + } + if (isArrayBufferView(data)) { + return data.byteLength; + } + if (isArrayBuffer(data)) { + return data.byteLength; + } + if (isBlob(data)) { + return data.size; + } + if (isFile(data)) { + return data.size; + } + if (noSniffFileSize === true) { + return undefined; + } + if (isPathedValue(data)) { + return await tryGetFileSizeFromPath(data.path.toString()); + } + return undefined; +} + +function tryGetContentTypeFromFileLike(data: Uploadable.FileLike): string | undefined { + if (isBlob(data)) { + return data.type; + } + if (isFile(data)) { + return data.type; + } + + return undefined; +} + +function getNameFromPath(path: string): string | undefined { + const lastForwardSlash = path.lastIndexOf("/"); + const lastBackSlash = path.lastIndexOf("\\"); + const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash); + return lastSlashIndex >= 0 ? path.substring(lastSlashIndex + 1) : path; +} + +type NamedValue = { + name: string; +} & unknown; + +type PathedValue = { + path: string | { toString(): string }; +} & unknown; + +type StreamLike = { + read?: () => unknown; + pipe?: (dest: unknown) => unknown; +} & unknown; + +function isNamedValue(value: unknown): value is NamedValue { + return typeof value === "object" && value != null && "name" in value; +} + +function isPathedValue(value: unknown): value is PathedValue { + return typeof value === "object" && value != null && "path" in value; +} + +function isStreamLike(value: unknown): value is StreamLike { + return typeof value === "object" && value != null && ("read" in value || "pipe" in value); +} + +function isReadableStream(value: unknown): value is ReadableStream { + return typeof value === "object" && value != null && "getReader" in value; +} + +function isBuffer(value: unknown): value is Buffer { + return typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(value); +} + +function isArrayBufferView(value: unknown): value is ArrayBufferView { + return typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(value); +} + +function isArrayBuffer(value: unknown): value is ArrayBuffer { + return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer; +} + +function isUint8Array(value: unknown): value is Uint8Array { + return typeof Uint8Array !== "undefined" && value instanceof Uint8Array; +} + +function isBlob(value: unknown): value is Blob { + return typeof Blob !== "undefined" && value instanceof Blob; +} + +function isFile(value: unknown): value is File { + return typeof File !== "undefined" && value instanceof File; +} diff --git a/src/core/file/index.ts b/src/core/file/index.ts new file mode 100644 index 00000000..fc16dd52 --- /dev/null +++ b/src/core/file/index.ts @@ -0,0 +1,2 @@ +export * from "./file.js"; +export * from "./types.js"; diff --git a/src/core/file/types.ts b/src/core/file/types.ts new file mode 100644 index 00000000..531b6927 --- /dev/null +++ b/src/core/file/types.ts @@ -0,0 +1,81 @@ +/** + * A file that can be uploaded. Can be a file-like object (stream, buffer, blob, etc.), + * a path to a file, or an object with a file-like object and metadata. + */ +export type Uploadable = Uploadable.FileLike | Uploadable.FromPath | Uploadable.WithMetadata; + +export namespace Uploadable { + /** + * Various file-like objects that can be used to upload a file. + */ + export type FileLike = + | ArrayBuffer + | ArrayBufferLike + | ArrayBufferView + | Uint8Array + | import("buffer").Buffer + | import("buffer").Blob + | import("buffer").File + | import("stream").Readable + | import("stream/web").ReadableStream + | globalThis.Blob + | globalThis.File + | ReadableStream; + + /** + * A file path with optional metadata, used for uploading a file from the file system. + */ + export type FromPath = { + /** The path to the file to upload */ + path: string; + /** + * Optional override for the file name (defaults to basename of path). + * This is used to set the `Content-Disposition` header in upload requests. + */ + filename?: string; + /** + * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain'). + * This is used to set the `Content-Type` header in upload requests. + */ + contentType?: string; + /** + * Optional file size in bytes. + * If not provided, the file size will be determined from the file system. + * The content length is used to set the `Content-Length` header in upload requests. + */ + contentLength?: number; + }; + + /** + * A file-like object with metadata, used for uploading files. + */ + export type WithMetadata = { + /** The file data */ + data: FileLike; + /** + * Optional override for the file name (defaults to basename of path). + * This is used to set the `Content-Disposition` header in upload requests. + */ + filename?: string; + /** + * Optional MIME type of the file (e.g., 'image/jpeg', 'text/plain'). + * This is used to set the `Content-Type` header in upload requests. + * + * If not provided, the content type may be determined from the data itself. + * * If the data is a `File`, `Blob`, or similar, the content type will be determined from the file itself, if the type is set. + * * Any other data type will not have a content type set, and the upload request will use `Content-Type: application/octet-stream` instead. + */ + contentType?: string; + /** + * Optional file size in bytes. + * The content length is used to set the `Content-Length` header in upload requests. + * If the content length is not provided and cannot be determined, the upload request will not include the `Content-Length` header, but will use `Transfer-Encoding: chunked` instead. + * + * If not provided, the file size will be determined depending on the data type. + * * If the data is of type `fs.ReadStream` (`createReadStream`), the size will be determined from the file system. + * * If the data is a `Buffer`, `ArrayBuffer`, `Uint8Array`, `Blob`, `File`, or similar, the size will be determined from the data itself. + * * If the data is a `Readable` or `ReadableStream`, the size will not be determined. + */ + contentLength?: number; + }; +} diff --git a/src/core/form-data-utils/FormDataWrapper.ts b/src/core/form-data-utils/FormDataWrapper.ts index fa1ca9b9..bea0cf82 100644 --- a/src/core/form-data-utils/FormDataWrapper.ts +++ b/src/core/form-data-utils/FormDataWrapper.ts @@ -1,27 +1,52 @@ +import { toMultipartDataPart, type Uploadable } from "../../core/file/index.js"; import { toJson } from "../../core/json.js"; import { RUNTIME } from "../runtime/index.js"; -type NamedValue = { - name: string; -} & unknown; +interface FormDataRequest { + body: Body; + headers: Record; + duplex?: "half"; +} -type PathedValue = { - path: string | { toString(): string }; -} & unknown; +export async function newFormData(): Promise { + return new FormDataWrapper(); +} + +export class FormDataWrapper { + private fd: FormData = new FormData(); + + public async setup(): Promise { + // noop + } + + public append(key: string, value: unknown): void { + this.fd.append(key, String(value)); + } + + public async appendFile(key: string, value: Uploadable): Promise { + const { data, filename, contentType } = await toMultipartDataPart(value); + const blob = await convertToBlob(data, contentType); + if (filename) { + this.fd.append(key, blob, filename); + } else { + this.fd.append(key, blob); + } + } + + public getRequest(): FormDataRequest { + return { + body: this.fd, + headers: {}, + duplex: "half" as const, + }; + } +} type StreamLike = { read?: () => unknown; pipe?: (dest: unknown) => unknown; } & unknown; -function isNamedValue(value: unknown): value is NamedValue { - return typeof value === "object" && value != null && "name" in value; -} - -function isPathedValue(value: unknown): value is PathedValue { - return typeof value === "object" && value != null && "path" in value; -} - function isStreamLike(value: unknown): value is StreamLike { return typeof value === "object" && value != null && ("read" in value || "pipe" in value); } @@ -38,19 +63,6 @@ function isArrayBufferView(value: unknown): value is ArrayBufferView { return ArrayBuffer.isView(value); } -interface FormDataRequest { - body: Body; - headers: Record; - duplex?: "half"; -} - -function getLastPathSegment(pathStr: string): string { - const lastForwardSlash = pathStr.lastIndexOf("/"); - const lastBackSlash = pathStr.lastIndexOf("\\"); - const lastSlashIndex = Math.max(lastForwardSlash, lastBackSlash); - return lastSlashIndex >= 0 ? pathStr.substring(lastSlashIndex + 1) : pathStr; -} - async function streamToBuffer(stream: unknown): Promise { if (RUNTIME.type === "node") { const { Readable } = await import("stream"); @@ -90,87 +102,39 @@ async function streamToBuffer(stream: unknown): Promise { } throw new Error( - "Unsupported stream type: " + typeof stream + ". Expected Node.js Readable stream or Web ReadableStream.", + `Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`, ); } -export async function newFormData(): Promise { - return new FormDataWrapper(); -} - -export class FormDataWrapper { - private fd: FormData = new FormData(); - - public async setup(): Promise { - // noop +async function convertToBlob(value: unknown, contentType?: string): Promise { + if (isStreamLike(value) || isReadableStream(value)) { + const buffer = await streamToBuffer(value); + return new Blob([buffer], { type: contentType }); } - public append(key: string, value: unknown): void { - this.fd.append(key, String(value)); + if (value instanceof Blob) { + return value; } - private getFileName(value: unknown, filename?: string): string | undefined { - if (filename != null) { - return filename; - } - if (isNamedValue(value)) { - return value.name; - } - if (isPathedValue(value) && value.path) { - return getLastPathSegment(value.path.toString()); - } - return undefined; + if (isBuffer(value)) { + return new Blob([value], { type: contentType }); } - private async convertToBlob(value: unknown): Promise { - if (isStreamLike(value) || isReadableStream(value)) { - const buffer = await streamToBuffer(value); - return new Blob([buffer]); - } - - if (value instanceof Blob) { - return value; - } - - if (isBuffer(value)) { - return new Blob([value]); - } - - if (value instanceof ArrayBuffer) { - return new Blob([value]); - } - - if (isArrayBufferView(value)) { - return new Blob([value]); - } - - if (typeof value === "string") { - return new Blob([value]); - } - - if (typeof value === "object" && value !== null) { - return new Blob([toJson(value)], { type: "application/json" }); - } - - return new Blob([String(value)]); + if (value instanceof ArrayBuffer) { + return new Blob([value], { type: contentType }); } - public async appendFile(key: string, value: unknown, fileName?: string): Promise { - fileName = this.getFileName(value, fileName); - const blob = await this.convertToBlob(value); + if (isArrayBufferView(value)) { + return new Blob([value], { type: contentType }); + } - if (fileName) { - this.fd.append(key, blob, fileName); - } else { - this.fd.append(key, blob); - } + if (typeof value === "string") { + return new Blob([value], { type: contentType }); } - public getRequest(): FormDataRequest { - return { - body: this.fd, - headers: {}, - duplex: "half" as const, - }; + if (typeof value === "object" && value !== null) { + return new Blob([toJson(value)], { type: contentType ?? "application/json" }); } + + return new Blob([String(value)], { type: contentType }); } diff --git a/src/core/headers.ts b/src/core/headers.ts index 561314d2..78ed8b50 100644 --- a/src/core/headers.ts +++ b/src/core/headers.ts @@ -1,33 +1,33 @@ -import * as core from "./index.js"; - -export function mergeHeaders( - ...headersArray: (Record | undefined> | undefined)[] -): Record> { - const result: Record> = {}; +export function mergeHeaders( + ...headersArray: (Record | null | undefined)[] +): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) .flatMap((headers) => Object.entries(headers))) { + const insensitiveKey = key.toLowerCase(); if (value != null) { - result[key] = value; - } else if (key in result) { - delete result[key]; + result[insensitiveKey] = value; + } else if (insensitiveKey in result) { + delete result[insensitiveKey]; } } return result; } -export function mergeOnlyDefinedHeaders( - ...headersArray: (Record | undefined> | undefined)[] -): Record> { - const result: Record> = {}; +export function mergeOnlyDefinedHeaders( + ...headersArray: (Record | null | undefined)[] +): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) .flatMap((headers) => Object.entries(headers))) { + const insensitiveKey = key.toLowerCase(); if (value != null) { - result[key] = value; + result[insensitiveKey] = value; } } diff --git a/src/core/index.ts b/src/core/index.ts index 2598f294..4e377ed4 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,5 +1,8 @@ +export * from "./auth/index.js"; +export * from "./base64.js"; export * from "./fetcher/index.js"; +export * as file from "./file/index.js"; +export * from "./form-data-utils/index.js"; +export * as logging from "./logging/index.js"; export * from "./runtime/index.js"; export * as url from "./url/index.js"; -export * from "./form-data-utils/index.js"; -export * from "./file.js"; diff --git a/src/core/logging/exports.ts b/src/core/logging/exports.ts new file mode 100644 index 00000000..88f6c00d --- /dev/null +++ b/src/core/logging/exports.ts @@ -0,0 +1,19 @@ +import * as logger from "./logger.js"; + +export namespace logging { + /** + * Configuration for logger instances. + */ + export type LogConfig = logger.LogConfig; + export type LogLevel = logger.LogLevel; + export const LogLevel: typeof logger.LogLevel = logger.LogLevel; + export type ILogger = logger.ILogger; + /** + * Console logger implementation that outputs to the console. + */ + export type ConsoleLogger = logger.ConsoleLogger; + /** + * Console logger implementation that outputs to the console. + */ + export const ConsoleLogger: typeof logger.ConsoleLogger = logger.ConsoleLogger; +} diff --git a/src/core/logging/index.ts b/src/core/logging/index.ts new file mode 100644 index 00000000..d81cc32c --- /dev/null +++ b/src/core/logging/index.ts @@ -0,0 +1 @@ +export * from "./logger.js"; diff --git a/src/core/logging/logger.ts b/src/core/logging/logger.ts new file mode 100644 index 00000000..a3f3673c --- /dev/null +++ b/src/core/logging/logger.ts @@ -0,0 +1,203 @@ +export const LogLevel = { + Debug: "debug", + Info: "info", + Warn: "warn", + Error: "error", +} as const; +export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel]; +const logLevelMap: Record = { + [LogLevel.Debug]: 1, + [LogLevel.Info]: 2, + [LogLevel.Warn]: 3, + [LogLevel.Error]: 4, +}; + +export interface ILogger { + /** + * Logs a debug message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + debug(message: string, ...args: unknown[]): void; + /** + * Logs an info message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + info(message: string, ...args: unknown[]): void; + /** + * Logs a warning message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + warn(message: string, ...args: unknown[]): void; + /** + * Logs an error message. + * @param message - The message to log + * @param args - Additional arguments to log + */ + error(message: string, ...args: unknown[]): void; +} + +/** + * Configuration for logger initialization. + */ +export interface LogConfig { + /** + * Minimum log level to output. + * @default LogLevel.Info + */ + level?: LogLevel; + /** + * Logger implementation to use. + * @default new ConsoleLogger() + */ + logger?: ILogger; + /** + * Whether logging should be silenced. + * @default true + */ + silent?: boolean; +} + +/** + * Default console-based logger implementation. + */ +export class ConsoleLogger implements ILogger { + debug(message: string, ...args: unknown[]): void { + console.debug(message, ...args); + } + info(message: string, ...args: unknown[]): void { + console.info(message, ...args); + } + warn(message: string, ...args: unknown[]): void { + console.warn(message, ...args); + } + error(message: string, ...args: unknown[]): void { + console.error(message, ...args); + } +} + +/** + * Logger class that provides level-based logging functionality. + */ +export class Logger { + private readonly level: number; + private readonly logger: ILogger; + private readonly silent: boolean; + + /** + * Creates a new logger instance. + * @param config - Logger configuration + */ + constructor(config: Required) { + this.level = logLevelMap[config.level]; + this.logger = config.logger; + this.silent = config.silent; + } + + /** + * Checks if a log level should be output based on configuration. + * @param level - The log level to check + * @returns True if the level should be logged + */ + public shouldLog(level: LogLevel): boolean { + return !this.silent && this.level <= logLevelMap[level]; + } + + /** + * Checks if debug logging is enabled. + * @returns True if debug logs should be output + */ + public isDebug(): boolean { + return this.shouldLog(LogLevel.Debug); + } + + /** + * Logs a debug message if debug logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public debug(message: string, ...args: unknown[]): void { + if (this.isDebug()) { + this.logger.debug(message, ...args); + } + } + + /** + * Checks if info logging is enabled. + * @returns True if info logs should be output + */ + public isInfo(): boolean { + return this.shouldLog(LogLevel.Info); + } + + /** + * Logs an info message if info logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public info(message: string, ...args: unknown[]): void { + if (this.isInfo()) { + this.logger.info(message, ...args); + } + } + + /** + * Checks if warning logging is enabled. + * @returns True if warning logs should be output + */ + public isWarn(): boolean { + return this.shouldLog(LogLevel.Warn); + } + + /** + * Logs a warning message if warning logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public warn(message: string, ...args: unknown[]): void { + if (this.isWarn()) { + this.logger.warn(message, ...args); + } + } + + /** + * Checks if error logging is enabled. + * @returns True if error logs should be output + */ + public isError(): boolean { + return this.shouldLog(LogLevel.Error); + } + + /** + * Logs an error message if error logging is enabled. + * @param message - The message to log + * @param args - Additional arguments to log + */ + public error(message: string, ...args: unknown[]): void { + if (this.isError()) { + this.logger.error(message, ...args); + } + } +} + +export function createLogger(config?: LogConfig | Logger): Logger { + if (config == null) { + return defaultLogger; + } + if (config instanceof Logger) { + return config; + } + config = config ?? {}; + config.level ??= LogLevel.Info; + config.logger ??= new ConsoleLogger(); + config.silent ??= true; + return new Logger(config as Required); +} + +const defaultLogger: Logger = new Logger({ + level: LogLevel.Info, + logger: new ConsoleLogger(), + silent: true, +}); diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 08fd2563..56ebbb87 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -99,6 +99,18 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is in React-Native. + * This check should come before Node.js detection since React Native may have a process polyfill. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ + const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; + if (isReactNative) { + return { + type: "react-native", + }; + } + /** * A constant that indicates whether the environment the code is running is Node.JS. */ @@ -116,17 +128,6 @@ function evaluateRuntime(): Runtime { }; } - /** - * A constant that indicates whether the environment the code is running is in React-Native. - * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js - */ - const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; - if (isReactNative) { - return { - type: "react-native", - }; - } - return { type: "unknown", }; diff --git a/src/core/url/encodePathParam.ts b/src/core/url/encodePathParam.ts new file mode 100644 index 00000000..19b90124 --- /dev/null +++ b/src/core/url/encodePathParam.ts @@ -0,0 +1,18 @@ +export function encodePathParam(param: unknown): string { + if (param === null) { + return "null"; + } + const typeofParam = typeof param; + switch (typeofParam) { + case "undefined": + return "undefined"; + case "string": + case "number": + case "boolean": + break; + default: + param = String(param); + break; + } + return encodeURIComponent(param as string | number | boolean); +} diff --git a/src/core/url/index.ts b/src/core/url/index.ts index ed5aa0ff..f2e0fa2d 100644 --- a/src/core/url/index.ts +++ b/src/core/url/index.ts @@ -1,2 +1,3 @@ +export { encodePathParam } from "./encodePathParam.js"; export { join } from "./join.js"; export { toQueryString } from "./qs.js"; diff --git a/src/core/url/join.ts b/src/core/url/join.ts index 1dda7792..7ca7daef 100644 --- a/src/core/url/join.ts +++ b/src/core/url/join.ts @@ -3,15 +3,21 @@ export function join(base: string, ...segments: string[]): string { return ""; } + if (segments.length === 0) { + return base; + } + if (base.includes("://")) { let url: URL; try { url = new URL(base); } catch { - // Fallback to path joining if URL is malformed return joinPath(base, ...segments); } + const lastSegment = segments[segments.length - 1]; + const shouldPreserveTrailingSlash = lastSegment?.endsWith("/"); + for (const segment of segments) { const cleanSegment = trimSlashes(segment); if (cleanSegment) { @@ -19,6 +25,10 @@ export function join(base: string, ...segments: string[]): string { } } + if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) { + url.pathname += "/"; + } + return url.toString(); } @@ -26,8 +36,15 @@ export function join(base: string, ...segments: string[]): string { } function joinPath(base: string, ...segments: string[]): string { + if (segments.length === 0) { + return base; + } + let result = base; + const lastSegment = segments[segments.length - 1]; + const shouldPreserveTrailingSlash = lastSegment?.endsWith("/"); + for (const segment of segments) { const cleanSegment = trimSlashes(segment); if (cleanSegment) { @@ -35,6 +52,10 @@ function joinPath(base: string, ...segments: string[]): string { } } + if (shouldPreserveTrailingSlash && !result.endsWith("/")) { + result += "/"; + } + return result; } @@ -42,14 +63,17 @@ function joinPathSegments(left: string, right: string): string { if (left.endsWith("/")) { return left + right; } - return left + "/" + right; + return `${left}/${right}`; } function trimSlashes(str: string): string { if (!str) return str; - let start = str.startsWith("/") ? 1 : 0; - let end = str.endsWith("/") ? str.length - 1 : str.length; + let start = 0; + let end = str.length; + + if (str.startsWith("/")) start = 1; + if (str.endsWith("/")) end = str.length - 1; - return str.slice(start, end); + return start === 0 && end === str.length ? str : str.slice(start, end); } diff --git a/src/environments.ts b/src/environments.ts index 480cf99c..e48d74c9 100644 --- a/src/environments.ts +++ b/src/environments.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export const PayabliEnvironment = { Sandbox: "https://api-sandbox.payabli.com/api", diff --git a/src/errors/PayabliError.ts b/src/errors/PayabliError.ts index 9dd41caf..8e7184b8 100644 --- a/src/errors/PayabliError.ts +++ b/src/errors/PayabliError.ts @@ -1,8 +1,6 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import * as core from "../core/index.js"; +import type * as core from "../core/index.js"; import { toJson } from "../core/json.js"; export class PayabliError extends Error { @@ -38,7 +36,7 @@ function buildMessage({ statusCode: number | undefined; body: unknown | undefined; }): string { - let lines: string[] = []; + const lines: string[] = []; if (message != null) { lines.push(message); } diff --git a/src/errors/PayabliTimeoutError.ts b/src/errors/PayabliTimeoutError.ts index ad52f9ad..772ba034 100644 --- a/src/errors/PayabliTimeoutError.ts +++ b/src/errors/PayabliTimeoutError.ts @@ -1,6 +1,4 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. export class PayabliTimeoutError extends Error { constructor(message: string) { diff --git a/src/errors/handleNonStatusCodeError.ts b/src/errors/handleNonStatusCodeError.ts new file mode 100644 index 00000000..ba87509e --- /dev/null +++ b/src/errors/handleNonStatusCodeError.ts @@ -0,0 +1,37 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as core from "../core/index.js"; +import * as errors from "./index.js"; + +export function handleNonStatusCodeError( + error: core.Fetcher.Error, + rawResponse: core.RawResponse, + method: string, + path: string, +): never { + switch (error.reason) { + case "non-json": + throw new errors.PayabliError({ + statusCode: error.statusCode, + body: error.rawBody, + rawResponse: rawResponse, + }); + case "body-is-null": + throw new errors.PayabliError({ + statusCode: error.statusCode, + rawResponse: rawResponse, + }); + case "timeout": + throw new errors.PayabliTimeoutError(`Timeout exceeded when calling ${method} ${path}.`); + case "unknown": + throw new errors.PayabliError({ + message: error.errorMessage, + rawResponse: rawResponse, + }); + default: + throw new errors.PayabliError({ + message: "Unknown error", + rawResponse: rawResponse, + }); + } +} diff --git a/src/exports.ts b/src/exports.ts new file mode 100644 index 00000000..7b70ee14 --- /dev/null +++ b/src/exports.ts @@ -0,0 +1 @@ +export * from "./core/exports.js"; diff --git a/src/index.ts b/src/index.ts index b36eb8ab..73ec0de0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,6 @@ export * as Payabli from "./api/index.js"; -export { PayabliError, PayabliTimeoutError } from "./errors/index.js"; +export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; export { PayabliClient } from "./Client.js"; export { PayabliEnvironment } from "./environments.js"; +export { PayabliError, PayabliTimeoutError } from "./errors/index.js"; +export * from "./exports.js"; diff --git a/src/version.ts b/src/version.ts deleted file mode 100644 index 7cc9a2cc..00000000 --- a/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const SDK_VERSION = "0.0.117"; diff --git a/tests/BrowserTestEnvironment.ts b/tests/BrowserTestEnvironment.ts deleted file mode 100644 index 0f32bf7b..00000000 --- a/tests/BrowserTestEnvironment.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TestEnvironment } from "jest-environment-jsdom"; - -class BrowserTestEnvironment extends TestEnvironment { - async setup() { - await super.setup(); - this.global.Request = Request; - this.global.Response = Response; - this.global.ReadableStream = ReadableStream; - this.global.TextEncoder = TextEncoder; - this.global.TextDecoder = TextDecoder; - this.global.FormData = FormData; - this.global.File = File; - this.global.Blob = Blob; - } -} - -export default BrowserTestEnvironment; diff --git a/tests/mock-server/MockServer.ts b/tests/mock-server/MockServer.ts index 6e258f17..95487215 100644 --- a/tests/mock-server/MockServer.ts +++ b/tests/mock-server/MockServer.ts @@ -1,4 +1,4 @@ -import { RequestHandlerOptions } from "msw"; +import type { RequestHandlerOptions } from "msw"; import type { SetupServer } from "msw/node"; import { mockEndpointBuilder } from "./mockEndpointBuilder"; @@ -19,7 +19,7 @@ export class MockServer { public mockEndpoint(options?: RequestHandlerOptions): ReturnType { const builder = mockEndpointBuilder({ - once: options?.once, + once: options?.once ?? true, onBuild: (handler) => { this.server.use(handler); }, diff --git a/tests/mock-server/MockServerPool.ts b/tests/mock-server/MockServerPool.ts index 81608069..e1a90f7f 100644 --- a/tests/mock-server/MockServerPool.ts +++ b/tests/mock-server/MockServerPool.ts @@ -22,7 +22,7 @@ async function formatHttpRequest(request: Request, id?: string): Promise } else if (clone.body) { body = await clone.text(); } - } catch (e) { + } catch (_e) { body = "(unable to parse body)"; } @@ -48,7 +48,7 @@ async function formatHttpResponse(response: Response, id?: string): Promise { const formattedRequest = await formatHttpRequest(request, requestId); - console.debug("request:start\n" + formattedRequest); + console.debug(`request:start\n${formattedRequest}`); }); mswServer.events.on("request:unhandled", async ({ request, requestId }) => { const formattedRequest = await formatHttpRequest(request, requestId); - console.debug("request:unhandled\n" + formattedRequest); + console.debug(`request:unhandled\n${formattedRequest}`); }); mswServer.events.on("response:mocked", async ({ request, response, requestId }) => { const formattedResponse = await formatHttpResponse(response, requestId); - console.debug("response:mocked\n" + formattedResponse); + console.debug(`response:mocked\n${formattedResponse}`); }); } } diff --git a/tests/mock-server/mockEndpointBuilder.ts b/tests/mock-server/mockEndpointBuilder.ts index 390b2256..1b0e5107 100644 --- a/tests/mock-server/mockEndpointBuilder.ts +++ b/tests/mock-server/mockEndpointBuilder.ts @@ -1,6 +1,8 @@ -import { DefaultBodyType, HttpHandler, HttpResponse, HttpResponseResolver, http } from "msw"; +import { type DefaultBodyType, type HttpHandler, HttpResponse, type HttpResponseResolver, http } from "msw"; +import { url } from "../../src/core"; import { toJson } from "../../src/core/json"; +import { withFormUrlEncoded } from "./withFormUrlEncoded"; import { withHeaders } from "./withHeaders"; import { withJson } from "./withJson"; @@ -25,6 +27,7 @@ interface RequestHeadersStage extends RequestBodyStage, ResponseStage { interface RequestBodyStage extends ResponseStage { jsonBody(body: unknown): ResponseStage; + formUrlEncodedBody(body: unknown): ResponseStage; } interface ResponseStage { @@ -127,28 +130,35 @@ class RequestBuilder implements MethodStage, RequestHeadersStage, RequestBodySta } jsonBody(body: unknown): ResponseStage { + if (body === undefined) { + throw new Error("Undefined is not valid JSON. Do not call jsonBody if you want an empty body."); + } this.predicates.push((resolver) => withJson(body, resolver)); return this; } + formUrlEncodedBody(body: unknown): ResponseStage { + if (body === undefined) { + throw new Error( + "Undefined is not valid for form-urlencoded. Do not call formUrlEncodedBody if you want an empty body.", + ); + } + this.predicates.push((resolver) => withFormUrlEncoded(body, resolver)); + return this; + } + respondWith(): ResponseStatusStage { - return new ResponseBuilder(this.method, this.buildPath(), this.predicates, this.handlerOptions); + return new ResponseBuilder(this.method, this.buildUrl(), this.predicates, this.handlerOptions); } - private buildPath(): string { - if (this._baseUrl.endsWith("/") && this.path.startsWith("/")) { - return this._baseUrl + this.path.slice(1); - } - if (!this._baseUrl.endsWith("/") && !this.path.startsWith("/")) { - return this._baseUrl + "/" + this.path; - } - return this._baseUrl + this.path; + private buildUrl(): string { + return url.join(this._baseUrl, this.path); } } class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, ResponseBodyStage, BuildStage { private readonly method: HttpMethod; - private readonly path: string; + private readonly url: string; private readonly requestPredicates: ((resolver: HttpResponseResolver) => HttpResponseResolver)[]; private readonly handlerOptions?: HttpHandlerBuilderOptions; @@ -158,12 +168,12 @@ class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, Respo constructor( method: HttpMethod, - path: string, + url: string, requestPredicates: ((resolver: HttpResponseResolver) => HttpResponseResolver)[], options?: HttpHandlerBuilderOptions, ) { this.method = method; - this.path = path; + this.url = url; this.requestPredicates = requestPredicates; this.handlerOptions = options; } @@ -184,21 +194,29 @@ class ResponseBuilder implements ResponseStatusStage, ResponseHeaderStage, Respo } public jsonBody(body: unknown): BuildStage { + if (body === undefined) { + throw new Error("Undefined is not valid JSON. Do not call jsonBody if you expect an empty body."); + } this.responseBody = toJson(body); return this; } public build(): HttpHandler { const responseResolver: HttpResponseResolver = () => { - return new HttpResponse(this.responseBody, { + const response = new HttpResponse(this.responseBody, { status: this.responseStatusCode, headers: this.responseHeaders, }); + // if no Content-Type header is set, delete the default text content type that is set + if (Object.keys(this.responseHeaders).some((key) => key.toLowerCase() === "content-type") === false) { + response.headers.delete("Content-Type"); + } + return response; }; const finalResolver = this.requestPredicates.reduceRight((acc, predicate) => predicate(acc), responseResolver); - const handler = http[this.method](this.path, finalResolver, this.handlerOptions); + const handler = http[this.method](this.url, finalResolver, this.handlerOptions); this.handlerOptions?.onBuild?.(handler); return handler; } diff --git a/tests/mock-server/setup.ts b/tests/mock-server/setup.ts index c216d607..aeb3a95a 100644 --- a/tests/mock-server/setup.ts +++ b/tests/mock-server/setup.ts @@ -1,4 +1,4 @@ -import { afterAll, beforeAll } from "@jest/globals"; +import { afterAll, beforeAll } from "vitest"; import { mockServerPool } from "./MockServerPool"; diff --git a/tests/mock-server/withFormUrlEncoded.ts b/tests/mock-server/withFormUrlEncoded.ts new file mode 100644 index 00000000..e9e6ff2d --- /dev/null +++ b/tests/mock-server/withFormUrlEncoded.ts @@ -0,0 +1,80 @@ +import { type HttpResponseResolver, passthrough } from "msw"; + +import { toJson } from "../../src/core/json"; + +/** + * Creates a request matcher that validates if the request form-urlencoded body exactly matches the expected object + * @param expectedBody - The exact body object to match against + * @param resolver - Response resolver to execute if body matches + */ +export function withFormUrlEncoded(expectedBody: unknown, resolver: HttpResponseResolver): HttpResponseResolver { + return async (args) => { + const { request } = args; + + let clonedRequest: Request; + let bodyText: string | undefined; + let actualBody: Record; + try { + clonedRequest = request.clone(); + bodyText = await clonedRequest.text(); + if (bodyText === "") { + console.error("Request body is empty, expected a form-urlencoded body."); + return passthrough(); + } + const params = new URLSearchParams(bodyText); + actualBody = {}; + for (const [key, value] of params.entries()) { + actualBody[key] = value; + } + } catch (error) { + console.error(`Error processing form-urlencoded request body:\n\tError: ${error}\n\tBody: ${bodyText}`); + return passthrough(); + } + + const mismatches = findMismatches(actualBody, expectedBody); + if (Object.keys(mismatches).length > 0) { + console.error("Form-urlencoded body mismatch:", toJson(mismatches, undefined, 2)); + return passthrough(); + } + + return resolver(args); + }; +} + +function findMismatches(actual: any, expected: any): Record { + const mismatches: Record = {}; + + if (typeof actual !== typeof expected) { + return { value: { actual, expected } }; + } + + if (typeof actual !== "object" || actual === null || expected === null) { + if (actual !== expected) { + return { value: { actual, expected } }; + } + return {}; + } + + const actualKeys = Object.keys(actual); + const expectedKeys = Object.keys(expected); + + const allKeys = new Set([...actualKeys, ...expectedKeys]); + + for (const key of allKeys) { + if (!expectedKeys.includes(key)) { + if (actual[key] === undefined) { + continue; + } + mismatches[key] = { actual: actual[key], expected: undefined }; + } else if (!actualKeys.includes(key)) { + if (expected[key] === undefined) { + continue; + } + mismatches[key] = { actual: undefined, expected: expected[key] }; + } else if (actual[key] !== expected[key]) { + mismatches[key] = { actual: actual[key], expected: expected[key] }; + } + } + + return mismatches; +} diff --git a/tests/mock-server/withHeaders.ts b/tests/mock-server/withHeaders.ts index e77c837d..6599d2b4 100644 --- a/tests/mock-server/withHeaders.ts +++ b/tests/mock-server/withHeaders.ts @@ -1,4 +1,4 @@ -import { HttpResponseResolver, passthrough } from "msw"; +import { type HttpResponseResolver, passthrough } from "msw"; /** * Creates a request matcher that validates if request headers match specified criteria diff --git a/tests/mock-server/withJson.ts b/tests/mock-server/withJson.ts index 4b4820c9..b627638b 100644 --- a/tests/mock-server/withJson.ts +++ b/tests/mock-server/withJson.ts @@ -1,4 +1,4 @@ -import { HttpResponseResolver, passthrough } from "msw"; +import { type HttpResponseResolver, passthrough } from "msw"; import { fromJson, toJson } from "../../src/core/json"; @@ -12,17 +12,23 @@ export function withJson(expectedBody: unknown, resolver: HttpResponseResolver): const { request } = args; let clonedRequest: Request; + let bodyText: string | undefined; let actualBody: unknown; try { clonedRequest = request.clone(); - actualBody = fromJson(await clonedRequest.text()); + bodyText = await clonedRequest.text(); + if (bodyText === "") { + console.error("Request body is empty, expected a JSON object."); + return passthrough(); + } + actualBody = fromJson(bodyText); } catch (error) { - console.error("Error processing request body:", error); + console.error(`Error processing request body:\n\tError: ${error}\n\tBody: ${bodyText}`); return passthrough(); } const mismatches = findMismatches(actualBody, expectedBody); - if (Object.keys(mismatches).length > 0) { + if (Object.keys(mismatches).filter((key) => !key.startsWith("pagination.")).length > 0) { console.error("JSON body mismatch:", toJson(mismatches, undefined, 2)); return passthrough(); } @@ -61,7 +67,7 @@ function findMismatches(actual: any, expected: any): Record 0) { for (const [mismatchKey, mismatchValue] of Object.entries(itemMismatches)) { - arrayMismatches[`[${i}]${mismatchKey === "value" ? "" : "." + mismatchKey}`] = mismatchValue; + arrayMismatches[`[${i}]${mismatchKey === "value" ? "" : `.${mismatchKey}`}`] = mismatchValue; } } } @@ -75,8 +81,14 @@ function findMismatches(actual: any, expected: any): Record 0) { for (const [nestedKey, nestedValue] of Object.entries(nestedMismatches)) { - mismatches[`${key}${nestedKey === "value" ? "" : "." + nestedKey}`] = nestedValue; + mismatches[`${key}${nestedKey === "value" ? "" : `.${nestedKey}`}`] = nestedValue; } } } else if (actual[key] !== expected[key]) { diff --git a/tests/setup.ts b/tests/setup.ts new file mode 100644 index 00000000..a5651f81 --- /dev/null +++ b/tests/setup.ts @@ -0,0 +1,80 @@ +import { expect } from "vitest"; + +interface CustomMatchers { + toContainHeaders(expectedHeaders: Record): R; +} + +declare module "vitest" { + interface Assertion extends CustomMatchers {} + interface AsymmetricMatchersContaining extends CustomMatchers {} +} + +expect.extend({ + toContainHeaders(actual: unknown, expectedHeaders: Record) { + const isHeaders = actual instanceof Headers; + const isPlainObject = typeof actual === "object" && actual !== null && !Array.isArray(actual); + + if (!isHeaders && !isPlainObject) { + throw new TypeError("Received value must be an instance of Headers or a plain object!"); + } + + if (typeof expectedHeaders !== "object" || expectedHeaders === null || Array.isArray(expectedHeaders)) { + throw new TypeError("Expected headers must be a plain object!"); + } + + const missingHeaders: string[] = []; + const mismatchedHeaders: Array<{ key: string; expected: string; actual: string | null }> = []; + + for (const [key, value] of Object.entries(expectedHeaders)) { + let actualValue: string | null = null; + + if (isHeaders) { + // Headers.get() is already case-insensitive + actualValue = (actual as Headers).get(key); + } else { + // For plain objects, do case-insensitive lookup + const actualObj = actual as Record; + const lowerKey = key.toLowerCase(); + const foundKey = Object.keys(actualObj).find((k) => k.toLowerCase() === lowerKey); + actualValue = foundKey ? actualObj[foundKey] : null; + } + + if (actualValue === null || actualValue === undefined) { + missingHeaders.push(key); + } else if (actualValue !== value) { + mismatchedHeaders.push({ key, expected: value, actual: actualValue }); + } + } + + const pass = missingHeaders.length === 0 && mismatchedHeaders.length === 0; + + const actualType = isHeaders ? "Headers" : "object"; + + if (pass) { + return { + message: () => `expected ${actualType} not to contain ${this.utils.printExpected(expectedHeaders)}`, + pass: true, + }; + } else { + const messages: string[] = []; + + if (missingHeaders.length > 0) { + messages.push(`Missing headers: ${this.utils.printExpected(missingHeaders.join(", "))}`); + } + + if (mismatchedHeaders.length > 0) { + const mismatches = mismatchedHeaders.map( + ({ key, expected, actual }) => + `${key}: expected ${this.utils.printExpected(expected)} but got ${this.utils.printReceived(actual)}`, + ); + messages.push(mismatches.join("\n")); + } + + return { + message: () => + `expected ${actualType} to contain ${this.utils.printExpected(expectedHeaders)}\n\n${messages.join("\n")}`, + pass: false, + }; + } + }, +}); diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 10185ed2..a477df47 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "outDir": null, "rootDir": "..", - "baseUrl": ".." + "baseUrl": "..", + "types": ["vitest/globals"] }, "include": ["../src", "../tests"], "exclude": [] diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts new file mode 100644 index 00000000..9b512336 --- /dev/null +++ b/tests/unit/auth/BasicAuth.test.ts @@ -0,0 +1,92 @@ +import { BasicAuth } from "../../../src/core/auth/BasicAuth"; + +describe("BasicAuth", () => { + interface ToHeaderTestCase { + description: string; + input: { username: string; password: string }; + expected: string; + } + + interface FromHeaderTestCase { + description: string; + input: string; + expected: { username: string; password: string }; + } + + interface ErrorTestCase { + description: string; + input: string; + expectedError: string; + } + + describe("toAuthorizationHeader", () => { + const toHeaderTests: ToHeaderTestCase[] = [ + { + description: "correctly converts to header", + input: { username: "username", password: "password" }, + expected: "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", + }, + ]; + + toHeaderTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(BasicAuth.toAuthorizationHeader(input)).toBe(expected); + }); + }); + }); + + describe("fromAuthorizationHeader", () => { + const fromHeaderTests: FromHeaderTestCase[] = [ + { + description: "correctly parses header", + input: "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", + expected: { username: "username", password: "password" }, + }, + { + description: "handles password with colons", + input: "Basic dXNlcjpwYXNzOndvcmQ=", + expected: { username: "user", password: "pass:word" }, + }, + { + description: "handles empty username and password (just colon)", + input: "Basic Og==", + expected: { username: "", password: "" }, + }, + { + description: "handles empty username", + input: "Basic OnBhc3N3b3Jk", + expected: { username: "", password: "password" }, + }, + { + description: "handles empty password", + input: "Basic dXNlcm5hbWU6", + expected: { username: "username", password: "" }, + }, + ]; + + fromHeaderTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(BasicAuth.fromAuthorizationHeader(input)).toEqual(expected); + }); + }); + + const errorTests: ErrorTestCase[] = [ + { + description: "throws error for completely empty credentials", + input: "Basic ", + expectedError: "Invalid basic auth", + }, + { + description: "throws error for credentials without colon", + input: "Basic dXNlcm5hbWU=", + expectedError: "Invalid basic auth", + }, + ]; + + errorTests.forEach(({ description, input, expectedError }) => { + it(description, () => { + expect(() => BasicAuth.fromAuthorizationHeader(input)).toThrow(expectedError); + }); + }); + }); +}); diff --git a/tests/unit/auth/BearerToken.test.ts b/tests/unit/auth/BearerToken.test.ts new file mode 100644 index 00000000..7757b87c --- /dev/null +++ b/tests/unit/auth/BearerToken.test.ts @@ -0,0 +1,14 @@ +import { BearerToken } from "../../../src/core/auth/BearerToken"; + +describe("BearerToken", () => { + describe("toAuthorizationHeader", () => { + it("correctly converts to header", () => { + expect(BearerToken.toAuthorizationHeader("my-token")).toBe("Bearer my-token"); + }); + }); + describe("fromAuthorizationHeader", () => { + it("correctly parses header", () => { + expect(BearerToken.fromAuthorizationHeader("Bearer my-token")).toBe("my-token"); + }); + }); +}); diff --git a/tests/unit/base64.test.ts b/tests/unit/base64.test.ts new file mode 100644 index 00000000..939594ca --- /dev/null +++ b/tests/unit/base64.test.ts @@ -0,0 +1,53 @@ +import { base64Decode, base64Encode } from "../../src/core/base64"; + +describe("base64", () => { + describe("base64Encode", () => { + it("should encode ASCII strings", () => { + expect(base64Encode("hello")).toBe("aGVsbG8="); + expect(base64Encode("")).toBe(""); + }); + + it("should encode UTF-8 strings", () => { + expect(base64Encode("café")).toBe("Y2Fmw6k="); + expect(base64Encode("🎉")).toBe("8J+OiQ=="); + }); + + it("should handle basic auth credentials", () => { + expect(base64Encode("username:password")).toBe("dXNlcm5hbWU6cGFzc3dvcmQ="); + }); + }); + + describe("base64Decode", () => { + it("should decode ASCII strings", () => { + expect(base64Decode("aGVsbG8=")).toBe("hello"); + expect(base64Decode("")).toBe(""); + }); + + it("should decode UTF-8 strings", () => { + expect(base64Decode("Y2Fmw6k=")).toBe("café"); + expect(base64Decode("8J+OiQ==")).toBe("🎉"); + }); + + it("should handle basic auth credentials", () => { + expect(base64Decode("dXNlcm5hbWU6cGFzc3dvcmQ=")).toBe("username:password"); + }); + }); + + describe("round-trip encoding", () => { + const testStrings = [ + "hello world", + "test@example.com", + "café", + "username:password", + "user@domain.com:super$ecret123!", + ]; + + testStrings.forEach((testString) => { + it(`should round-trip encode/decode: "${testString}"`, () => { + const encoded = base64Encode(testString); + const decoded = base64Decode(encoded); + expect(decoded).toBe(testString); + }); + }); + }); +}); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts index d34ced5c..60df2b5e 100644 --- a/tests/unit/fetcher/Fetcher.test.ts +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -1,9 +1,8 @@ import fs from "fs"; -import stream from "stream"; import { join } from "path"; - -import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; -import { BinaryResponse } from "../../../src/core"; +import stream from "stream"; +import type { BinaryResponse } from "../../../src/core"; +import { type Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; describe("Test fetcherImpl", () => { it("should handle successful request", async () => { @@ -14,10 +13,11 @@ describe("Test fetcherImpl", () => { body: { data: "test" }, contentType: "application/json", requestType: "json", + maxRetries: 0, responseType: "json", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response(JSON.stringify({ data: "test" }), { status: 200, statusText: "OK", @@ -34,7 +34,7 @@ describe("Test fetcherImpl", () => { "https://httpbin.org/post", expect.objectContaining({ method: "POST", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), body: JSON.stringify({ data: "test" }), }), ); @@ -48,11 +48,12 @@ describe("Test fetcherImpl", () => { headers: { "X-Test": "x-test-header" }, contentType: "application/octet-stream", requestType: "bytes", + maxRetries: 0, responseType: "json", body: fs.createReadStream(join(__dirname, "test-file.txt")), }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response(JSON.stringify({ data: "test" }), { status: 200, statusText: "OK", @@ -65,7 +66,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "POST", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), body: expect.any(fs.ReadStream), }), ); @@ -81,10 +82,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -100,7 +102,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -126,10 +128,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -145,7 +148,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -171,10 +174,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -190,7 +194,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -214,10 +218,11 @@ describe("Test fetcherImpl", () => { url, method: "GET", headers: { "X-Test": "x-test-header" }, + maxRetries: 0, responseType: "binary-response", }; - global.fetch = jest.fn().mockResolvedValue( + global.fetch = vi.fn().mockResolvedValue( new Response( stream.Readable.toWeb(fs.createReadStream(join(__dirname, "test-file.txt"))) as ReadableStream, { @@ -233,7 +238,7 @@ describe("Test fetcherImpl", () => { url, expect.objectContaining({ method: "GET", - headers: expect.objectContaining({ "X-Test": "x-test-header" }), + headers: expect.toContainHeaders({ "X-Test": "x-test-header" }), }), ); expect(result.ok).toBe(true); @@ -242,6 +247,9 @@ describe("Test fetcherImpl", () => { expect(body).toBeDefined(); expect(body.bodyUsed).toBe(false); expect(typeof body.bytes).toBe("function"); + if (!body.bytes) { + return; + } const bytes = await body.bytes(); expect(bytes).toBeInstanceOf(Uint8Array); const decoder = new TextDecoder(); diff --git a/tests/unit/fetcher/HttpResponsePromise.test.ts b/tests/unit/fetcher/HttpResponsePromise.test.ts index 2216a33e..2ec008e5 100644 --- a/tests/unit/fetcher/HttpResponsePromise.test.ts +++ b/tests/unit/fetcher/HttpResponsePromise.test.ts @@ -1,7 +1,7 @@ -import { beforeEach, describe, expect, it, jest } from "@jest/globals"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import { HttpResponsePromise } from "../../../src/core/fetcher/HttpResponsePromise"; -import { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; +import type { RawResponse, WithRawResponse } from "../../../src/core/fetcher/RawResponse"; describe("HttpResponsePromise", () => { const mockRawResponse: RawResponse = { @@ -20,7 +20,7 @@ describe("HttpResponsePromise", () => { describe("fromFunction", () => { it("should create an HttpResponsePromise from a function", async () => { - const mockFn = jest + const mockFn = vi .fn<(arg1: string, arg2: string) => Promise>>() .mockResolvedValue(mockWithRawResponse); @@ -111,7 +111,7 @@ describe("HttpResponsePromise", () => { reject(new Error("Test error")); }); - const catchSpy = jest.fn(); + const catchSpy = vi.fn(); await errorResponsePromise.catch(catchSpy); expect(catchSpy).toHaveBeenCalled(); @@ -121,7 +121,7 @@ describe("HttpResponsePromise", () => { }); it("should support finally() method", async () => { - const finallySpy = jest.fn(); + const finallySpy = vi.fn(); await responsePromise.finally(finallySpy); expect(finallySpy).toHaveBeenCalled(); diff --git a/tests/unit/fetcher/RawResponse.test.ts b/tests/unit/fetcher/RawResponse.test.ts index 9ccd5e1e..375ee3f3 100644 --- a/tests/unit/fetcher/RawResponse.test.ts +++ b/tests/unit/fetcher/RawResponse.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from "@jest/globals"; +import { describe, expect, it } from "vitest"; import { toRawResponse } from "../../../src/core/fetcher/RawResponse"; diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index 06e03b2c..a92f1b5e 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -1,160 +1,163 @@ import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl"; describe("Test createRequestUrl", () => { - it("should return the base URL when no query parameters are provided", () => { - const baseUrl = "https://api.example.com"; - expect(createRequestUrl(baseUrl)).toBe(baseUrl); - }); - - it("should append simple query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { key: "value", another: "param" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param"); - }); - - it("should handle array query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { items: ["a", "b", "c"] }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c"); - }); - - it("should handle object query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { filter: { name: "John", age: 30 } }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", - ); - }); - - it("should handle mixed types of query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - simple: "value", - array: ["x", "y"], - object: { key: "value" }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", - ); - }); - - it("should handle empty query parameters object", () => { - const baseUrl = "https://api.example.com"; - expect(createRequestUrl(baseUrl, {})).toBe(baseUrl); - }); - - it("should encode special characters in query parameters", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { special: "a&b=c d" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d"); - }); - - // Additional tests for edge cases and different value types - it("should handle numeric values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { count: 42, price: 19.99, active: 1, inactive: 0 }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?count=42&price=19.99&active=1&inactive=0", - ); - }); - - it("should handle boolean values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { enabled: true, disabled: false }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?enabled=true&disabled=false"); - }); - - it("should handle null and undefined values", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - valid: "value", - nullValue: null, - undefinedValue: undefined, - emptyString: "", - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?valid=value&nullValue=&emptyString=", - ); - }); - - it("should handle deeply nested objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - user: { - profile: { - name: "John", - settings: { theme: "dark" }, + const BASE_URL = "https://api.example.com"; + + interface TestCase { + description: string; + baseUrl: string; + queryParams?: Record; + expected: string; + } + + const testCases: TestCase[] = [ + { + description: "should return the base URL when no query parameters are provided", + baseUrl: BASE_URL, + expected: BASE_URL, + }, + { + description: "should append simple query parameters", + baseUrl: BASE_URL, + queryParams: { key: "value", another: "param" }, + expected: "https://api.example.com?key=value&another=param", + }, + { + description: "should handle array query parameters", + baseUrl: BASE_URL, + queryParams: { items: ["a", "b", "c"] }, + expected: "https://api.example.com?items=a&items=b&items=c", + }, + { + description: "should handle object query parameters", + baseUrl: BASE_URL, + queryParams: { filter: { name: "John", age: 30 } }, + expected: "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", + }, + { + description: "should handle mixed types of query parameters", + baseUrl: BASE_URL, + queryParams: { + simple: "value", + array: ["x", "y"], + object: { key: "value" }, + }, + expected: "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", + }, + { + description: "should handle empty query parameters object", + baseUrl: BASE_URL, + queryParams: {}, + expected: BASE_URL, + }, + { + description: "should encode special characters in query parameters", + baseUrl: BASE_URL, + queryParams: { special: "a&b=c d" }, + expected: "https://api.example.com?special=a%26b%3Dc%20d", + }, + { + description: "should handle numeric values", + baseUrl: BASE_URL, + queryParams: { count: 42, price: 19.99, active: 1, inactive: 0 }, + expected: "https://api.example.com?count=42&price=19.99&active=1&inactive=0", + }, + { + description: "should handle boolean values", + baseUrl: BASE_URL, + queryParams: { enabled: true, disabled: false }, + expected: "https://api.example.com?enabled=true&disabled=false", + }, + { + description: "should handle null and undefined values", + baseUrl: BASE_URL, + queryParams: { + valid: "value", + nullValue: null, + undefinedValue: undefined, + emptyString: "", + }, + expected: "https://api.example.com?valid=value&nullValue=&emptyString=", + }, + { + description: "should handle deeply nested objects", + baseUrl: BASE_URL, + queryParams: { + user: { + profile: { + name: "John", + settings: { theme: "dark" }, + }, }, }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", - ); - }); - - it("should handle arrays of objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - users: [ - { name: "John", age: 30 }, - { name: "Jane", age: 25 }, - ], - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?users%5Bname%5D=John&users%5Bage%5D=30&users%5Bname%5D=Jane&users%5Bage%5D=25", - ); - }); - - it("should handle mixed arrays", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - mixed: ["string", 42, true, { key: "value" }], - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?mixed=string&mixed=42&mixed=true&mixed%5Bkey%5D=value", - ); - }); - - it("should handle empty arrays", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { emptyArray: [] }; - expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); - }); - - it("should handle empty objects", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { emptyObject: {} }; - expect(createRequestUrl(baseUrl, queryParams)).toBe(baseUrl); - }); - - it("should handle special characters in keys", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { "key with spaces": "value", "key[with]brackets": "value" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?key%20with%20spaces=value&key%5Bwith%5Dbrackets=value", - ); - }); - - it("should handle URL with existing query parameters", () => { - const baseUrl = "https://api.example.com?existing=param"; - const queryParams = { new: "value" }; - expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?existing=param?new=value"); - }); - - it("should handle complex nested structures", () => { - const baseUrl = "https://api.example.com"; - const queryParams = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + expected: + "https://api.example.com?user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + }, + { + description: "should handle arrays of objects", + baseUrl: BASE_URL, + queryParams: { + users: [ + { name: "John", age: 30 }, + { name: "Jane", age: 25 }, + ], + }, + expected: + "https://api.example.com?users%5Bname%5D=John&users%5Bage%5D=30&users%5Bname%5D=Jane&users%5Bage%5D=25", + }, + { + description: "should handle mixed arrays", + baseUrl: BASE_URL, + queryParams: { + mixed: ["string", 42, true, { key: "value" }], + }, + expected: "https://api.example.com?mixed=string&mixed=42&mixed=true&mixed%5Bkey%5D=value", + }, + { + description: "should handle empty arrays", + baseUrl: BASE_URL, + queryParams: { emptyArray: [] }, + expected: BASE_URL, + }, + { + description: "should handle empty objects", + baseUrl: BASE_URL, + queryParams: { emptyObject: {} }, + expected: BASE_URL, + }, + { + description: "should handle special characters in keys", + baseUrl: BASE_URL, + queryParams: { "key with spaces": "value", "key[with]brackets": "value" }, + expected: "https://api.example.com?key%20with%20spaces=value&key%5Bwith%5Dbrackets=value", + }, + { + description: "should handle URL with existing query parameters", + baseUrl: "https://api.example.com?existing=param", + queryParams: { new: "value" }, + expected: "https://api.example.com?existing=param?new=value", + }, + { + description: "should handle complex nested structures", + baseUrl: BASE_URL, + queryParams: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); + expected: + "https://api.example.com?filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + ]; + + testCases.forEach(({ description, baseUrl, queryParams, expected }) => { + it(description, () => { + expect(createRequestUrl(baseUrl, queryParams)).toBe(expected); + }); }); }); diff --git a/tests/unit/fetcher/getRequestBody.test.ts b/tests/unit/fetcher/getRequestBody.test.ts index e864c8b5..8a6c3a57 100644 --- a/tests/unit/fetcher/getRequestBody.test.ts +++ b/tests/unit/fetcher/getRequestBody.test.ts @@ -2,15 +2,117 @@ import { getRequestBody } from "../../../src/core/fetcher/getRequestBody"; import { RUNTIME } from "../../../src/core/runtime"; describe("Test getRequestBody", () => { - it("should stringify body if not FormData in Node environment", async () => { - if (RUNTIME.type === "node") { - const body = { key: "value" }; + interface TestCase { + description: string; + input: any; + type: "json" | "form" | "file" | "bytes" | "other"; + expected: any; + skipCondition?: () => boolean; + } + + const testCases: TestCase[] = [ + { + description: "should stringify body if not FormData in Node environment", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + skipCondition: () => RUNTIME.type !== "node", + }, + { + description: "should stringify body if not FormData in browser environment", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + skipCondition: () => RUNTIME.type !== "browser", + }, + { + description: "should return the Uint8Array", + input: new Uint8Array([1, 2, 3]), + type: "bytes", + expected: new Uint8Array([1, 2, 3]), + }, + { + description: "should serialize objects for form-urlencoded content type", + input: { username: "johndoe", email: "john@example.com" }, + type: "form", + expected: "username=johndoe&email=john%40example.com", + }, + { + description: "should serialize complex nested objects and arrays for form-urlencoded content type", + input: { + user: { + profile: { + name: "John Doe", + settings: { + theme: "dark", + notifications: true, + }, + }, + tags: ["admin", "user"], + contacts: [ + { type: "email", value: "john@example.com" }, + { type: "phone", value: "+1234567890" }, + ], + }, + filters: { + status: ["active", "pending"], + metadata: { + created: "2024-01-01", + categories: ["electronics", "books"], + }, + }, + preferences: ["notifications", "updates"], + }, + type: "form", + expected: + "user%5Bprofile%5D%5Bname%5D=John%20Doe&" + + "user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark&" + + "user%5Bprofile%5D%5Bsettings%5D%5Bnotifications%5D=true&" + + "user%5Btags%5D=admin&" + + "user%5Btags%5D=user&" + + "user%5Bcontacts%5D%5Btype%5D=email&" + + "user%5Bcontacts%5D%5Bvalue%5D=john%40example.com&" + + "user%5Bcontacts%5D%5Btype%5D=phone&" + + "user%5Bcontacts%5D%5Bvalue%5D=%2B1234567890&" + + "filters%5Bstatus%5D=active&" + + "filters%5Bstatus%5D=pending&" + + "filters%5Bmetadata%5D%5Bcreated%5D=2024-01-01&" + + "filters%5Bmetadata%5D%5Bcategories%5D=electronics&" + + "filters%5Bmetadata%5D%5Bcategories%5D=books&" + + "preferences=notifications&" + + "preferences=updates", + }, + { + description: "should return the input for pre-serialized form-urlencoded strings", + input: "key=value&another=param", + type: "other", + expected: "key=value&another=param", + }, + { + description: "should JSON stringify objects", + input: { key: "value" }, + type: "json", + expected: '{"key":"value"}', + }, + ]; + + testCases.forEach(({ description, input, type, expected, skipCondition }) => { + it(description, async () => { + if (skipCondition?.()) { + return; + } + const result = await getRequestBody({ - body, - type: "json", + body: input, + type, }); - expect(result).toBe('{"key":"value"}'); - } + + if (input instanceof Uint8Array) { + expect(result).toBe(input); + } else { + expect(result).toBe(expected); + } + }); }); it("should return FormData in browser environment", async () => { @@ -24,42 +126,4 @@ describe("Test getRequestBody", () => { expect(result).toBe(formData); } }); - - it("should stringify body if not FormData in browser environment", async () => { - if (RUNTIME.type === "browser") { - const body = { key: "value" }; - const result = await getRequestBody({ - body, - type: "json", - }); - expect(result).toBe('{"key":"value"}'); - } - }); - - it("should return the Uint8Array", async () => { - const input = new Uint8Array([1, 2, 3]); - const result = await getRequestBody({ - body: input, - type: "bytes", - }); - expect(result).toBe(input); - }); - - it("should return the input for content-type 'application/x-www-form-urlencoded'", async () => { - const input = "key=value&another=param"; - const result = await getRequestBody({ - body: input, - type: "other", - }); - expect(result).toBe(input); - }); - - it("should JSON stringify objects", async () => { - const input = { key: "value" }; - const result = await getRequestBody({ - body: input, - type: "json", - }); - expect(result).toBe('{"key":"value"}'); - }); }); diff --git a/tests/unit/fetcher/getResponseBody.test.ts b/tests/unit/fetcher/getResponseBody.test.ts index 400782f5..ad6be7fc 100644 --- a/tests/unit/fetcher/getResponseBody.test.ts +++ b/tests/unit/fetcher/getResponseBody.test.ts @@ -1,7 +1,61 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { getResponseBody } from "../../../src/core/fetcher/getResponseBody"; +import { RUNTIME } from "../../../src/core/runtime"; + describe("Test getResponseBody", () => { + interface SimpleTestCase { + description: string; + responseData: string | Record; + responseType?: "blob" | "sse" | "streaming" | "text"; + expected: any; + skipCondition?: () => boolean; + } + + const simpleTestCases: SimpleTestCase[] = [ + { + description: "should handle text response type", + responseData: "test text", + responseType: "text", + expected: "test text", + }, + { + description: "should handle JSON response", + responseData: { key: "value" }, + expected: { key: "value" }, + }, + { + description: "should handle empty response", + responseData: "", + expected: undefined, + }, + { + description: "should handle non-JSON response", + responseData: "invalid json", + expected: { + ok: false, + error: { + reason: "non-json", + statusCode: 200, + rawBody: "invalid json", + }, + }, + }, + ]; + + simpleTestCases.forEach(({ description, responseData, responseType, expected, skipCondition }) => { + it(description, async () => { + if (skipCondition?.()) { + return; + } + + const mockResponse = new Response( + typeof responseData === "string" ? responseData : JSON.stringify(responseData), + ); + const result = await getResponseBody(mockResponse, responseType); + expect(result).toEqual(expected); + }); + }); + it("should handle blob response type", async () => { const mockBlob = new Blob(["test"], { type: "text/plain" }); const mockResponse = new Response(mockBlob); @@ -20,7 +74,6 @@ describe("Test getResponseBody", () => { }); it("should handle streaming response type", async () => { - // Create a ReadableStream with some test data const encoder = new TextEncoder(); const testData = "test stream data"; const mockStream = new ReadableStream({ @@ -35,43 +88,10 @@ describe("Test getResponseBody", () => { expect(result).toBeInstanceOf(ReadableStream); - // Read and verify the stream content const reader = result.getReader(); const decoder = new TextDecoder(); const { value } = await reader.read(); const streamContent = decoder.decode(value); expect(streamContent).toBe(testData); }); - - it("should handle text response type", async () => { - const mockResponse = new Response("test text"); - const result = await getResponseBody(mockResponse, "text"); - expect(result).toBe("test text"); - }); - - it("should handle JSON response", async () => { - const mockJson = { key: "value" }; - const mockResponse = new Response(JSON.stringify(mockJson)); - const result = await getResponseBody(mockResponse); - expect(result).toEqual(mockJson); - }); - - it("should handle empty response", async () => { - const mockResponse = new Response(""); - const result = await getResponseBody(mockResponse); - expect(result).toBeUndefined(); - }); - - it("should handle non-JSON response", async () => { - const mockResponse = new Response("invalid json"); - const result = await getResponseBody(mockResponse); - expect(result).toEqual({ - ok: false, - error: { - reason: "non-json", - statusCode: 200, - rawBody: "invalid json", - }, - }); - }); }); diff --git a/tests/unit/fetcher/logging.test.ts b/tests/unit/fetcher/logging.test.ts new file mode 100644 index 00000000..366c9b6c --- /dev/null +++ b/tests/unit/fetcher/logging.test.ts @@ -0,0 +1,517 @@ +import { fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +function mockSuccessResponse(data: unknown = { data: "test" }, status = 200, statusText = "OK") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +function mockErrorResponse(data: unknown = { error: "Error" }, status = 404, statusText = "Not Found") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +describe("Fetcher Logging Integration", () => { + describe("Request Logging", () => { + it("should log successful request at debug level", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + headers: { "Content-Type": "application/json" }, + body: { test: "data" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "POST", + url: "https://example.com/api", + headers: expect.toContainHeaders({ + "Content-Type": "application/json", + }), + hasBody: true, + }), + ); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + method: "POST", + url: "https://example.com/api", + statusCode: 200, + }), + ); + }); + + it("should not log debug messages at info level for successful requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "info", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + }); + + it("should log request with body flag", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + hasBody: true, + }), + ); + }); + + it("should log request without body flag", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + hasBody: false, + }), + ); + }); + + it("should not log when silent mode is enabled", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: true, + }, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).not.toHaveBeenCalled(); + }); + + it("should not log when no logging config is provided", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + }); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + }); + }); + + describe("Error Logging", () => { + it("should log 4xx errors at error level", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Not found" }, 404, "Not Found"); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + statusCode: 404, + }), + ); + }); + + it("should log 5xx errors at error level", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Internal error" }, 500, "Internal Server Error"); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + statusCode: 500, + }), + ); + }); + + it("should log aborted request errors", async () => { + const mockLogger = createMockLogger(); + + const abortController = new AbortController(); + abortController.abort(); + + global.fetch = vi.fn().mockRejectedValue(new Error("Aborted")); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + abortSignal: abortController.signal, + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request was aborted", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + }), + ); + }); + + it("should log timeout errors", async () => { + const mockLogger = createMockLogger(); + + const timeoutError = new Error("Request timeout"); + timeoutError.name = "AbortError"; + + global.fetch = vi.fn().mockRejectedValue(timeoutError); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request timed out", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + timeoutMs: undefined, + }), + ); + }); + + it("should log unknown errors", async () => { + const mockLogger = createMockLogger(); + + const unknownError = new Error("Unknown error"); + + global.fetch = vi.fn().mockRejectedValue(unknownError); + + const result = await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(result.ok).toBe(false); + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error", + expect.objectContaining({ + method: "GET", + url: "https://example.com/api", + errorMessage: "Unknown error", + }), + ); + }); + }); + + describe("Logging with Redaction", () => { + it("should redact sensitive data in error logs", async () => { + const mockLogger = createMockLogger(); + mockErrorResponse({ error: "Unauthorized" }, 401, "Unauthorized"); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]", + }), + ); + }); + }); + + describe("Different HTTP Methods", () => { + it("should log GET requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "GET", + }), + ); + }); + + it("should log POST requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 201, "Created"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "POST", + }), + ); + }); + + it("should log PUT requests", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "PUT", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "PUT", + }), + ); + }); + + it("should log DELETE requests", async () => { + const mockLogger = createMockLogger(); + global.fetch = vi.fn().mockResolvedValue( + new Response(null, { + status: 200, + statusText: "OK", + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "DELETE", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + method: "DELETE", + }), + ); + }); + }); + + describe("Status Code Logging", () => { + it("should log 2xx success status codes", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 201, "Created"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "POST", + body: { data: "test" }, + contentType: "application/json", + requestType: "json", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + statusCode: 201, + }), + ); + }); + + it("should log 3xx redirect status codes as success", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse({ data: "test" }, 301, "Moved Permanently"); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + statusCode: 301, + }), + ); + }); + }); +}); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts index 43ed9d11..ea49466a 100644 --- a/tests/unit/fetcher/makeRequest.test.ts +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -1,3 +1,4 @@ +import type { Mock } from "vitest"; import { makeRequest } from "../../../src/core/fetcher/makeRequest"; describe("Test makeRequest", () => { @@ -6,10 +7,10 @@ describe("Test makeRequest", () => { const mockHeaders = { "Content-Type": "application/json" }; const mockBody = JSON.stringify({ key: "value" }); - let mockFetch: jest.Mock; + let mockFetch: Mock; beforeEach(() => { - mockFetch = jest.fn(); + mockFetch = vi.fn(); mockFetch.mockResolvedValue(new Response(JSON.stringify({ test: "successful" }), { status: 200 })); }); diff --git a/tests/unit/fetcher/redacting.test.ts b/tests/unit/fetcher/redacting.test.ts new file mode 100644 index 00000000..d599376b --- /dev/null +++ b/tests/unit/fetcher/redacting.test.ts @@ -0,0 +1,1115 @@ +import { fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +function mockSuccessResponse(data: unknown = { data: "test" }, status = 200, statusText = "OK") { + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify(data), { + status, + statusText, + }), + ); +} + +describe("Redacting Logic", () => { + describe("Header Redaction", () => { + it("should redact authorization header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { Authorization: "Bearer secret-token-12345" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Authorization: "[REDACTED]", + }), + }), + ); + }); + + it("should redact api-key header (case-insensitive)", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-API-KEY": "secret-api-key" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-API-KEY": "[REDACTED]", + }), + }), + ); + }); + + it("should redact cookie header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { Cookie: "session=abc123; token=xyz789" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Cookie: "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-auth-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "x-auth-token": "auth-token-12345" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "x-auth-token": "[REDACTED]", + }), + }), + ); + }); + + it("should redact proxy-authorization header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "Proxy-Authorization": "Basic credentials" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "Proxy-Authorization": "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-csrf-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-CSRF-Token": "csrf-token-abc" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-CSRF-Token": "[REDACTED]", + }), + }), + ); + }); + + it("should redact www-authenticate header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "WWW-Authenticate": "Bearer realm=example" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "WWW-Authenticate": "[REDACTED]", + }), + }), + ); + }); + + it("should redact x-session-token header", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { "X-Session-Token": "session-token-xyz" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "X-Session-Token": "[REDACTED]", + }), + }), + ); + }); + + it("should not redact non-sensitive headers", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { + "Content-Type": "application/json", + "User-Agent": "Test/1.0", + Accept: "application/json", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + "Content-Type": "application/json", + "User-Agent": "Test/1.0", + Accept: "application/json", + }), + }), + ); + }); + + it("should redact multiple sensitive headers at once", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + headers: { + Authorization: "Bearer token", + "X-API-Key": "api-key", + Cookie: "session=123", + "Content-Type": "application/json", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + headers: expect.toContainHeaders({ + Authorization: "[REDACTED]", + "X-API-Key": "[REDACTED]", + Cookie: "[REDACTED]", + "Content-Type": "application/json", + }), + }), + ); + }); + }); + + describe("Response Header Redaction", () => { + it("should redact Set-Cookie in response headers", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("Set-Cookie", "session=abc123; HttpOnly; Secure"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + "set-cookie": "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + + it("should redact authorization in response headers", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("Authorization", "Bearer token-123"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ data: "test" }), { + status: 200, + statusText: "OK", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "HTTP request succeeded", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + authorization: "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + + it("should redact response headers in error responses", async () => { + const mockLogger = createMockLogger(); + + const mockHeaders = new Headers(); + mockHeaders.set("WWW-Authenticate", "Bearer realm=example"); + mockHeaders.set("Content-Type", "application/json"); + + global.fetch = vi.fn().mockResolvedValue( + new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + statusText: "Unauthorized", + headers: mockHeaders, + }), + ); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "error", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.error).toHaveBeenCalledWith( + "HTTP request failed with error status", + expect.objectContaining({ + responseHeaders: expect.toContainHeaders({ + "www-authenticate": "[REDACTED]", + "content-type": "application/json", + }), + }), + ); + }); + }); + + describe("Query Parameter Redaction", () => { + it("should redact api_key query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { api_key: "secret-key" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + api_key: "[REDACTED]", + }), + }), + ); + }); + + it("should redact token query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { token: "secret-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + token: "[REDACTED]", + }), + }), + ); + }); + + it("should redact access_token query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { access_token: "secret-access-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + access_token: "[REDACTED]", + }), + }), + ); + }); + + it("should redact password query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { password: "secret-password" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + password: "[REDACTED]", + }), + }), + ); + }); + + it("should redact secret query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { secret: "secret-value" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + secret: "[REDACTED]", + }), + }), + ); + }); + + it("should redact session_id query parameter", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { session_id: "session-123" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + session_id: "[REDACTED]", + }), + }), + ); + }); + + it("should not redact non-sensitive query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { + page: "1", + limit: "10", + sort: "name", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + page: "1", + limit: "10", + sort: "name", + }), + }), + ); + }); + + it("should not redact parameters containing 'auth' substring like 'author'", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { + author: "john", + authenticate: "false", + authorization_level: "user", + }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + author: "john", + authenticate: "false", + authorization_level: "user", + }), + }), + ); + }); + + it("should handle undefined query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: undefined, + }), + ); + }); + + it("should redact case-insensitive query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + queryParameters: { API_KEY: "secret-key", Token: "secret-token" }, + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + queryParameters: expect.objectContaining({ + API_KEY: "[REDACTED]", + Token: "[REDACTED]", + }), + }), + ); + }); + }); + + describe("URL Redaction", () => { + it("should redact credentials in URL", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:password@example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/api", + }), + ); + }); + + it("should redact api_key in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret-key&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]&page=1", + }), + ); + }); + + it("should redact token in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?token=secret-token", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?token=[REDACTED]", + }), + ); + }); + + it("should redact password in query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?username=user&password=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?username=user&password=[REDACTED]", + }), + ); + }); + + it("should not redact non-sensitive query strings", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?page=1&limit=10&sort=name", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1&limit=10&sort=name", + }), + ); + }); + + it("should not redact URL parameters containing 'auth' substring like 'author'", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?author=john&authenticate=false&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?author=john&authenticate=false&page=1", + }), + ); + }); + + it("should handle URL with fragment", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?token=secret#section", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?token=[REDACTED]#section", + }), + ); + }); + + it("should redact URL-encoded query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api%5Fkey=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api%5Fkey=[REDACTED]", + }), + ); + }); + + it("should handle URL without query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api", + }), + ); + }); + + it("should handle empty query string", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?", + }), + ); + }); + + it("should redact multiple sensitive parameters in URL", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?api_key=secret1&token=secret2&page=1", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?api_key=[REDACTED]&token=[REDACTED]&page=1", + }), + ); + }); + + it("should redact both credentials and query parameters", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:pass@example.com/api?token=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/api?token=[REDACTED]", + }), + ); + }); + + it("should use fast path for URLs without sensitive keywords", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?page=1&limit=10&sort=name&filter=value", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?page=1&limit=10&sort=name&filter=value", + }), + ); + }); + + it("should handle query parameter without value", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?flag&token=secret", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?flag&token=[REDACTED]", + }), + ); + }); + + it("should handle URL with multiple @ symbols in credentials", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user@example.com:pass@host.com/api", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@host.com/api", + }), + ); + }); + + it("should handle URL with @ in query parameter but not in credentials", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://example.com/api?email=user@example.com", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://example.com/api?email=user@example.com", + }), + ); + }); + + it("should handle URL with both credentials and @ in path", async () => { + const mockLogger = createMockLogger(); + mockSuccessResponse(); + + await fetcherImpl({ + url: "https://user:pass@example.com/users/@username", + method: "GET", + responseType: "json", + maxRetries: 0, + logging: { + level: "debug", + logger: mockLogger, + silent: false, + }, + }); + + expect(mockLogger.debug).toHaveBeenCalledWith( + "Making HTTP request", + expect.objectContaining({ + url: "https://[REDACTED]@example.com/users/@username", + }), + ); + }); + }); +}); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts index 3cdaa40a..d2266136 100644 --- a/tests/unit/fetcher/requestWithRetries.test.ts +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -1,28 +1,43 @@ +import type { Mock, MockInstance } from "vitest"; import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; describe("requestWithRetries", () => { - let mockFetch: jest.Mock; + let mockFetch: Mock; let originalMathRandom: typeof Math.random; - let setTimeoutSpy: jest.SpyInstance; + let setTimeoutSpy: MockInstance; beforeEach(() => { - mockFetch = jest.fn(); + mockFetch = vi.fn(); originalMathRandom = Math.random; - // Mock Math.random for consistent jitter - Math.random = jest.fn(() => 0.5); - - jest.useFakeTimers({ doNotFake: ["nextTick"] }); + Math.random = vi.fn(() => 0.5); + + vi.useFakeTimers({ + toFake: [ + "setTimeout", + "clearTimeout", + "setInterval", + "clearInterval", + "setImmediate", + "clearImmediate", + "Date", + "performance", + "requestAnimationFrame", + "cancelAnimationFrame", + "requestIdleCallback", + "cancelIdleCallback", + ], + }); }); afterEach(() => { Math.random = originalMathRandom; - jest.clearAllMocks(); - jest.clearAllTimers(); + vi.clearAllMocks(); + vi.clearAllTimers(); }); it("should retry on retryable status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -38,7 +53,7 @@ describe("requestWithRetries", () => { }); const responsePromise = requestWithRetries(() => mockFetch(), retryableStatuses.length); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const response = await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(retryableStatuses.length + 1); @@ -46,7 +61,7 @@ describe("requestWithRetries", () => { }); it("should respect maxRetries limit", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -55,7 +70,7 @@ describe("requestWithRetries", () => { mockFetch.mockResolvedValue(new Response("", { status: 500 })); const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const response = await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(maxRetries + 1); @@ -63,7 +78,7 @@ describe("requestWithRetries", () => { }); it("should not retry on success status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -76,7 +91,7 @@ describe("requestWithRetries", () => { mockFetch.mockResolvedValueOnce(new Response("", { status })); const responsePromise = requestWithRetries(() => mockFetch(), 3); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); await responsePromise; expect(mockFetch).toHaveBeenCalledTimes(1); @@ -84,8 +99,69 @@ describe("requestWithRetries", () => { } }); + interface RetryHeaderTestCase { + description: string; + headerName: string; + headerValue: string | (() => string); + expectedDelayMin: number; + expectedDelayMax: number; + } + + const retryHeaderTests: RetryHeaderTestCase[] = [ + { + description: "should respect retry-after header with seconds value", + headerName: "retry-after", + headerValue: "5", + expectedDelayMin: 4000, + expectedDelayMax: 6000, + }, + { + description: "should respect retry-after header with HTTP date value", + headerName: "retry-after", + headerValue: () => new Date(Date.now() + 3000).toUTCString(), + expectedDelayMin: 2000, + expectedDelayMax: 4000, + }, + { + description: "should respect x-ratelimit-reset header", + headerName: "x-ratelimit-reset", + headerValue: () => Math.floor((Date.now() + 4000) / 1000).toString(), + expectedDelayMin: 3000, + expectedDelayMax: 6000, + }, + ]; + + retryHeaderTests.forEach(({ description, headerName, headerValue, expectedDelayMin, expectedDelayMax }) => { + it(description, async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + const value = typeof headerValue === "function" ? headerValue() : headerValue; + mockFetch + .mockResolvedValueOnce( + new Response("", { + status: 429, + headers: new Headers({ [headerName]: value }), + }), + ) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 1); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), expect.any(Number)); + const actualDelay = setTimeoutSpy.mock.calls[0][1]; + expect(actualDelay).toBeGreaterThan(expectedDelayMin); + expect(actualDelay).toBeLessThan(expectedDelayMax); + expect(response.status).toBe(200); + }); + }); + it("should apply correct exponential backoff with jitter", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -95,10 +171,9 @@ describe("requestWithRetries", () => { const expectedDelays = [1000, 2000, 4000]; const responsePromise = requestWithRetries(() => mockFetch(), maxRetries); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); await responsePromise; - // Verify setTimeout calls expect(setTimeoutSpy).toHaveBeenCalledTimes(expectedDelays.length); expectedDelays.forEach((delay, index) => { @@ -109,7 +184,7 @@ describe("requestWithRetries", () => { }); it("should handle concurrent retries independently", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -123,10 +198,33 @@ describe("requestWithRetries", () => { const promise1 = requestWithRetries(() => mockFetch(), 1); const promise2 = requestWithRetries(() => mockFetch(), 1); - await jest.runAllTimersAsync(); + await vi.runAllTimersAsync(); const [response1, response2] = await Promise.all([promise1, promise2]); expect(response1.status).toBe(200); expect(response2.status).toBe(200); }); + + it("should cap delay at MAX_RETRY_DELAY for large header values", async () => { + setTimeoutSpy = vi.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { + process.nextTick(callback); + return null as any; + }); + + mockFetch + .mockResolvedValueOnce( + new Response("", { + status: 429, + headers: new Headers({ "retry-after": "120" }), // 120 seconds = 120000ms > MAX_RETRY_DELAY (60000ms) + }), + ) + .mockResolvedValueOnce(new Response("", { status: 200 })); + + const responsePromise = requestWithRetries(() => mockFetch(), 1); + await vi.runAllTimersAsync(); + const response = await responsePromise; + + expect(setTimeoutSpy).toHaveBeenCalledWith(expect.any(Function), 60000); + expect(response.status).toBe(200); + }); }); diff --git a/tests/unit/fetcher/signals.test.ts b/tests/unit/fetcher/signals.test.ts index 9cabfa07..d7b6d1e6 100644 --- a/tests/unit/fetcher/signals.test.ts +++ b/tests/unit/fetcher/signals.test.ts @@ -2,11 +2,11 @@ import { anySignal, getTimeoutSignal } from "../../../src/core/fetcher/signals"; describe("Test getTimeoutSignal", () => { beforeEach(() => { - jest.useFakeTimers(); + vi.useFakeTimers(); }); afterEach(() => { - jest.useRealTimers(); + vi.useRealTimers(); }); it("should return an object with signal and abortId", () => { @@ -24,10 +24,10 @@ describe("Test getTimeoutSignal", () => { expect(signal.aborted).toBe(false); - jest.advanceTimersByTime(timeoutMs - 1); + vi.advanceTimersByTime(timeoutMs - 1); expect(signal.aborted).toBe(false); - jest.advanceTimersByTime(1); + vi.advanceTimersByTime(1); expect(signal.aborted).toBe(true); }); }); diff --git a/tests/unit/file/file.test.ts b/tests/unit/file/file.test.ts new file mode 100644 index 00000000..d7c4570b --- /dev/null +++ b/tests/unit/file/file.test.ts @@ -0,0 +1,498 @@ +import fs from "fs"; +import { join } from "path"; +import { Readable } from "stream"; +import { toBinaryUploadRequest, type Uploadable } from "../../../src/core/file/index"; + +describe("toBinaryUploadRequest", () => { + const TEST_FILE_PATH = join(__dirname, "..", "test-file.txt"); + + beforeEach(() => { + vi.clearAllMocks(); + }); + + describe("Buffer input", () => { + it("should handle Buffer with all metadata", async () => { + const buffer = Buffer.from("test data"); + const input: Uploadable.WithMetadata = { + data: buffer, + filename: "test.txt", + contentType: "text/plain", + contentLength: 42, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="test.txt"', + "Content-Type": "text/plain", + "Content-Length": "42", + }); + }); + + it("should handle Buffer without metadata", async () => { + const buffer = Buffer.from("test data"); + const input: Uploadable.WithMetadata = { + data: buffer, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Length": "9", // buffer.length + }); + }); + + it("should handle Buffer passed directly", async () => { + const buffer = Buffer.from("test data"); + + const result = await toBinaryUploadRequest(buffer); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Length": "9", // buffer.length + }); + }); + }); + + describe("ArrayBuffer input", () => { + it("should handle ArrayBuffer with metadata", async () => { + const arrayBuffer = new ArrayBuffer(10); + const input: Uploadable.WithMetadata = { + data: arrayBuffer, + filename: "data.bin", + contentType: "application/octet-stream", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(arrayBuffer); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="data.bin"', + "Content-Type": "application/octet-stream", + "Content-Length": "10", // arrayBuffer.byteLength + }); + }); + + it("should handle ArrayBuffer passed directly", async () => { + const arrayBuffer = new ArrayBuffer(10); + + const result = await toBinaryUploadRequest(arrayBuffer); + + expect(result.body).toBe(arrayBuffer); + expect(result.headers).toEqual({ + "Content-Length": "10", // arrayBuffer.byteLength + }); + }); + }); + + describe("Uint8Array input", () => { + it("should handle Uint8Array with metadata", async () => { + const uint8Array = new Uint8Array([1, 2, 3, 4, 5]); + const input: Uploadable.WithMetadata = { + data: uint8Array, + filename: "bytes.bin", + contentType: "application/octet-stream", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(uint8Array); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="bytes.bin"', + "Content-Type": "application/octet-stream", + "Content-Length": "5", // uint8Array.byteLength + }); + }); + + it("should handle Uint8Array passed directly", async () => { + const uint8Array = new Uint8Array([1, 2, 3, 4, 5]); + + const result = await toBinaryUploadRequest(uint8Array); + + expect(result.body).toBe(uint8Array); + expect(result.headers).toEqual({ + "Content-Length": "5", // uint8Array.byteLength + }); + }); + }); + + describe("Blob input", () => { + it("should handle Blob with metadata", async () => { + const blob = new Blob(["test content"], { type: "text/plain" }); + const input: Uploadable.WithMetadata = { + data: blob, + filename: "override.txt", + contentType: "text/html", // Override blob's type + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(blob); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="override.txt"', + "Content-Type": "text/html", // Should use provided contentType + "Content-Length": "12", // blob.size + }); + }); + + it("should handle Blob with intrinsic type", async () => { + const blob = new Blob(["test content"], { type: "application/json" }); + const input: Uploadable.WithMetadata = { + data: blob, + filename: "data.json", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(blob); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="data.json"', + "Content-Type": "application/json", // Should use blob's type + "Content-Length": "12", // blob.size + }); + }); + + it("should handle Blob passed directly", async () => { + const blob = new Blob(["test content"], { type: "text/plain" }); + + const result = await toBinaryUploadRequest(blob); + + expect(result.body).toBe(blob); + expect(result.headers).toEqual({ + "Content-Type": "text/plain", // Should use blob's type + "Content-Length": "12", // blob.size + }); + }); + }); + + describe("File input", () => { + it("should handle File with metadata", async () => { + const file = new File(["file content"], "original.txt", { type: "text/plain" }); + const input: Uploadable.WithMetadata = { + data: file, + filename: "renamed.txt", + contentType: "text/html", // Override file's type + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(file); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="renamed.txt"', + "Content-Type": "text/html", // Should use provided contentType + "Content-Length": "12", // file.size + }); + }); + + it("should handle File with intrinsic properties", async () => { + const file = new File(["file content"], "test.json", { type: "application/json" }); + const input: Uploadable.WithMetadata = { + data: file, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(file); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="test.json"', // Should use file's name + "Content-Type": "application/json", // Should use file's type + "Content-Length": "12", // file.size + }); + }); + + it("should handle File passed directly", async () => { + const file = new File(["file content"], "direct.txt", { type: "text/plain" }); + + const result = await toBinaryUploadRequest(file); + + expect(result.body).toBe(file); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="direct.txt"', + "Content-Type": "text/plain", + "Content-Length": "12", // file.size + }); + }); + }); + + describe("ReadableStream input", () => { + it("should handle ReadableStream with metadata", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("stream data")); + controller.close(); + }, + }); + const input: Uploadable.WithMetadata = { + data: stream, + filename: "stream.txt", + contentType: "text/plain", + contentLength: 100, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(stream); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="stream.txt"', + "Content-Type": "text/plain", + "Content-Length": "100", // Should use provided contentLength + }); + }); + + it("should handle ReadableStream without size", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("stream data")); + controller.close(); + }, + }); + const input: Uploadable.WithMetadata = { + data: stream, + filename: "stream.txt", + contentType: "text/plain", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(stream); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="stream.txt"', + "Content-Type": "text/plain", + // No Content-Length header since it cannot be determined from ReadableStream + }); + }); + + it("should handle ReadableStream passed directly", async () => { + const stream = new ReadableStream({ + start(controller) { + controller.enqueue(new TextEncoder().encode("stream data")); + controller.close(); + }, + }); + + const result = await toBinaryUploadRequest(stream); + + expect(result.body).toBe(stream); + expect(result.headers).toEqual({ + // No headers since no metadata provided and cannot be determined + }); + }); + }); + + describe("Node.js Readable stream input", () => { + it("should handle Readable stream with metadata", async () => { + const readable = new Readable({ + read() { + this.push("readable data"); + this.push(null); + }, + }); + const input: Uploadable.WithMetadata = { + data: readable, + filename: "readable.txt", + contentType: "text/plain", + contentLength: 50, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(readable); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="readable.txt"', + "Content-Type": "text/plain", + "Content-Length": "50", // Should use provided contentLength + }); + }); + + it("should handle Readable stream without size", async () => { + const readable = new Readable({ + read() { + this.push("readable data"); + this.push(null); + }, + }); + const input: Uploadable.WithMetadata = { + data: readable, + filename: "readable.txt", + contentType: "text/plain", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(readable); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="readable.txt"', + "Content-Type": "text/plain", + // No Content-Length header since it cannot be determined from Readable + }); + }); + + it("should handle Readable stream passed directly", async () => { + const readable = new Readable({ + read() { + this.push("readable data"); + this.push(null); + }, + }); + + const result = await toBinaryUploadRequest(readable); + + expect(result.body).toBe(readable); + expect(result.headers).toEqual({ + // No headers since no metadata provided and cannot be determined + }); + }); + }); + + describe("File path input (FromPath type)", () => { + it("should handle file path with all metadata", async () => { + const input: Uploadable.FromPath = { + path: TEST_FILE_PATH, + filename: "custom.txt", + contentType: "text/html", + contentLength: 42, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBeInstanceOf(fs.ReadStream); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="custom.txt"', + "Content-Type": "text/html", + "Content-Length": "42", // Should use provided contentLength + }); + }); + + it("should handle file path with minimal metadata", async () => { + const input: Uploadable.FromPath = { + path: TEST_FILE_PATH, + contentType: "text/plain", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBeInstanceOf(fs.ReadStream); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="test-file.txt"', // Should extract from path + "Content-Type": "text/plain", + "Content-Length": "21", // Should determine from file system (test file is 21 bytes) + }); + }); + + it("should handle file path with no metadata", async () => { + const input: Uploadable.FromPath = { + path: TEST_FILE_PATH, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBeInstanceOf(fs.ReadStream); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="test-file.txt"', // Should extract from path + "Content-Length": "21", // Should determine from file system (test file is 21 bytes) + }); + }); + }); + + describe("ArrayBufferView input", () => { + it("should handle ArrayBufferView with metadata", async () => { + const arrayBuffer = new ArrayBuffer(10); + const arrayBufferView = new Int8Array(arrayBuffer); + const input: Uploadable.WithMetadata = { + data: arrayBufferView, + filename: "view.bin", + contentType: "application/octet-stream", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(arrayBufferView); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="view.bin"', + "Content-Type": "application/octet-stream", + "Content-Length": "10", // arrayBufferView.byteLength + }); + }); + + it("should handle ArrayBufferView passed directly", async () => { + const arrayBuffer = new ArrayBuffer(10); + const arrayBufferView = new Int8Array(arrayBuffer); + + const result = await toBinaryUploadRequest(arrayBufferView); + + expect(result.body).toBe(arrayBufferView); + expect(result.headers).toEqual({ + "Content-Length": "10", // arrayBufferView.byteLength + }); + }); + }); + + describe("Edge cases", () => { + it("should handle empty headers when no metadata is available", async () => { + const buffer = Buffer.from(""); + const input: Uploadable.WithMetadata = { + data: buffer, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Length": "0", + }); + }); + + it("should handle zero contentLength", async () => { + const buffer = Buffer.from("test"); + const input: Uploadable.WithMetadata = { + data: buffer, + contentLength: 0, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Length": "0", // Should use provided 0 + }); + }); + + it("should handle null filename", async () => { + const buffer = Buffer.from("test"); + const input: Uploadable.WithMetadata = { + data: buffer, + filename: undefined, + contentType: "text/plain", + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Type": "text/plain", + "Content-Length": "4", + // No Content-Disposition since filename is undefined + }); + }); + + it("should handle null contentType", async () => { + const buffer = Buffer.from("test"); + const input: Uploadable.WithMetadata = { + data: buffer, + filename: "test.txt", + contentType: undefined, + }; + + const result = await toBinaryUploadRequest(input); + + expect(result.body).toBe(buffer); + expect(result.headers).toEqual({ + "Content-Disposition": 'attachment; filename="test.txt"', + "Content-Length": "4", + // No Content-Type since contentType is undefined + }); + }); + }); +}); diff --git a/tests/unit/form-data-utils/encodeAsFormParameter.test.ts b/tests/unit/form-data-utils/encodeAsFormParameter.test.ts index 86ce11aa..d4b0c450 100644 --- a/tests/unit/form-data-utils/encodeAsFormParameter.test.ts +++ b/tests/unit/form-data-utils/encodeAsFormParameter.test.ts @@ -1,4 +1,4 @@ -import { encodeAsFormParameter } from "../../../src/core/form-data-utils/encodeAsFormParameter.js"; +import { encodeAsFormParameter } from "../../../src/core/form-data-utils/encodeAsFormParameter"; describe("encodeAsFormParameter", () => { describe("Basic functionality", () => { diff --git a/tests/unit/form-data-utils/formDataWrapper.browser.test.ts b/tests/unit/form-data-utils/formDataWrapper.browser.test.ts deleted file mode 100644 index f7667618..00000000 --- a/tests/unit/form-data-utils/formDataWrapper.browser.test.ts +++ /dev/null @@ -1,378 +0,0 @@ -import { FormDataWrapper, newFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; - -type FormDataRequest = ReturnType["getRequest"]>; - -async function getFormDataInfo(formRequest: FormDataRequest): Promise<{ - hasFile: boolean; - filename?: string; - contentType?: string; - serialized: string; -}> { - const request = new Request("http://localhost", { - ...formRequest, - method: "POST", - }); - const buffer = await request.arrayBuffer(); - const serialized = new TextDecoder().decode(buffer); - - const filenameMatch = serialized.match(/filename="([^"]+)"/); - const filename = filenameMatch ? filenameMatch[1] : undefined; - - const contentTypeMatch = serialized.match(/Content-Type: ([^\r\n]+)/); - const contentType = contentTypeMatch ? contentTypeMatch[1] : undefined; - - return { - hasFile: !!filename, - filename, - contentType, - serialized, - }; -} - -describe("FormDataWrapper - Browser Environment", () => { - let formData: FormDataWrapper; - - beforeEach(async () => { - formData = new FormDataWrapper(); - await formData.setup(); - }); - - describe("Web ReadableStream", () => { - it("serializes Web ReadableStream with filename", async () => { - const stream = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("web stream content")); - controller.close(); - }, - }); - - await formData.appendFile("file", stream, "webstream.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="webstream.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("webstream.txt"); - }); - - it("handles empty Web ReadableStream", async () => { - const stream = new ReadableStream({ - start(controller) { - controller.close(); - }, - }); - - await formData.appendFile("file", stream, "empty.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="empty.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("empty.txt"); - }); - }); - - describe("Browser-specific types", () => { - it("serializes Blob with specified filename and content type", async () => { - const blob = new Blob(["file content"], { type: "text/plain" }); - await formData.appendFile("file", blob, "testfile.txt"); - - const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="testfile.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("testfile.txt"); - expect(contentType).toBe("text/plain"); - }); - - it("serializes File and preserves filename", async () => { - const file = new File(["file content"], "testfile.txt", { type: "text/plain" }); - await formData.appendFile("file", file); - - const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="testfile.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("testfile.txt"); - expect(contentType).toBe("text/plain"); - }); - - it("allows filename override for File objects", async () => { - const file = new File(["file content"], "original.txt", { type: "text/plain" }); - await formData.appendFile("file", file, "override.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="override.txt"'); - expect(serialized).not.toContain('filename="original.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("override.txt"); - }); - }); - - describe("Binary data types", () => { - it("serializes ArrayBuffer with filename", async () => { - const arrayBuffer = new ArrayBuffer(8); - new Uint8Array(arrayBuffer).set([1, 2, 3, 4, 5, 6, 7, 8]); - - await formData.appendFile("file", arrayBuffer, "binary.bin"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="binary.bin"'); - expect(hasFile).toBe(true); - expect(filename).toBe("binary.bin"); - }); - - it("serializes Uint8Array with filename", async () => { - const uint8Array = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" - await formData.appendFile("file", uint8Array, "binary.bin"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="binary.bin"'); - expect(hasFile).toBe(true); - expect(filename).toBe("binary.bin"); - }); - - it("serializes other typed arrays", async () => { - const int16Array = new Int16Array([1000, 2000, 3000]); - await formData.appendFile("file", int16Array, "numbers.bin"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="numbers.bin"'); - expect(hasFile).toBe(true); - expect(filename).toBe("numbers.bin"); - }); - }); - - describe("Text and primitive types", () => { - it("serializes string as regular form field", async () => { - formData.append("text", "test string"); - - const { serialized, hasFile } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="text"'); - expect(serialized).not.toContain("filename="); - expect(serialized).toContain("test string"); - expect(hasFile).toBe(false); - }); - - it("serializes string as file with filename", async () => { - await formData.appendFile("file", "test content", "text.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="text.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("text.txt"); - }); - - it("serializes numbers and booleans as strings", async () => { - formData.append("number", 12345); - formData.append("flag", true); - - const { serialized } = await getFormDataInfo(formData.getRequest()); - expect(serialized).toContain("12345"); - expect(serialized).toContain("true"); - }); - }); - - describe("Object and JSON handling", () => { - it("serializes objects as JSON with filename", async () => { - const obj = { test: "value", nested: { key: "data" } }; - await formData.appendFile("data", obj, "data.json"); - - const { serialized, hasFile, contentType, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="data"'); - expect(serialized).toContain('filename="data.json"'); - expect(serialized).toContain("Content-Type: application/json"); - expect(hasFile).toBe(true); - expect(filename).toBe("data.json"); - expect(contentType).toBe("application/json"); - }); - - it("serializes arrays as JSON", async () => { - const arr = [1, 2, 3, "test"]; - await formData.appendFile("array", arr, "array.json"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="array"'); - expect(serialized).toContain('filename="array.json"'); - expect(hasFile).toBe(true); - expect(filename).toBe("array.json"); - }); - - it("handles null and undefined values", async () => { - formData.append("nullValue", null); - formData.append("undefinedValue", undefined); - - const { serialized } = await getFormDataInfo(formData.getRequest()); - expect(serialized).toContain("null"); - expect(serialized).toContain("undefined"); - }); - }); - - describe("Filename extraction from objects", () => { - it("extracts filename from object with name property", async () => { - const namedValue = { name: "custom-name.txt", data: "content" }; - await formData.appendFile("file", namedValue); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="custom-name.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("custom-name.txt"); - }); - - it("extracts filename from object with path property", async () => { - const pathedValue = { path: "/some/path/file.txt", content: "data" }; - await formData.appendFile("file", pathedValue); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="file.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("file.txt"); - }); - - it("prioritizes explicit filename over object properties", async () => { - const namedValue = { name: "original.txt", data: "content" }; - await formData.appendFile("file", namedValue, "override.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file"'); - expect(serialized).toContain('filename="override.txt"'); - expect(serialized).not.toContain('filename="original.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("override.txt"); - }); - }); - - describe("Edge cases and error handling", () => { - it("handles empty filename gracefully", async () => { - await formData.appendFile("file", "content", ""); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('Content-Disposition: form-data; name="file"'); - expect(serialized).toContain('filename="blob"'); // Default fallback - expect(hasFile).toBe(true); - expect(filename).toBe("blob"); - }); - - it("handles large strings", async () => { - const largeString = "x".repeat(1000); - await formData.appendFile("large", largeString, "large.txt"); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="large"'); - expect(serialized).toContain('filename="large.txt"'); - expect(hasFile).toBe(true); - expect(filename).toBe("large.txt"); - }); - - it("handles unicode content and filenames", async () => { - const unicodeContent = "Hello 世界 🌍 Emoji 🚀"; - const unicodeFilename = "файл-тест-🌟.txt"; - - await formData.appendFile("unicode", unicodeContent, unicodeFilename); - - const { serialized, hasFile, filename } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="unicode"'); - expect(serialized).toContain(`filename="${unicodeFilename}"`); - expect(hasFile).toBe(true); - expect(filename).toBe(unicodeFilename); - }); - - it("handles multiple files in single form", async () => { - await formData.appendFile("file1", "content1", "file1.txt"); - await formData.appendFile("file2", "content2", "file2.txt"); - formData.append("text", "regular field"); - - const { serialized } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toContain('name="file1"'); - expect(serialized).toContain('filename="file1.txt"'); - - expect(serialized).toContain('name="file2"'); - expect(serialized).toContain('filename="file2.txt"'); - - expect(serialized).toContain('name="text"'); - expect(serialized).not.toContain('filename="text"'); - expect(serialized).toContain("regular field"); - }); - }); - - describe("Request structure", () => { - it("returns correct request structure", async () => { - await formData.appendFile("file", "content", "test.txt"); - - const request = formData.getRequest(); - - expect(request).toHaveProperty("body"); - expect(request).toHaveProperty("headers"); - expect(request).toHaveProperty("duplex"); - expect(request.body).toBeInstanceOf(FormData); - expect(request.headers).toEqual({}); - expect(request.duplex).toBe("half"); - }); - - it("generates proper multipart boundary structure", async () => { - await formData.appendFile("file", "test content", "test.txt"); - formData.append("field", "value"); - - const { serialized } = await getFormDataInfo(formData.getRequest()); - - expect(serialized).toMatch(/------formdata-undici-\w+|------WebKitFormBoundary\w+/); - expect(serialized).toContain("Content-Disposition: form-data;"); - expect(serialized).toMatch(/------formdata-undici-\w+--|------WebKitFormBoundary\w+--/); - }); - }); - - describe("Factory function", () => { - it("returns FormDataWrapper instance", async () => { - const formData = await newFormData(); - expect(formData).toBeInstanceOf(FormDataWrapper); - }); - - it("creates independent instances", async () => { - const formData1 = await newFormData(); - const formData2 = await newFormData(); - - await formData1.setup(); - await formData2.setup(); - - formData1.append("test1", "value1"); - formData2.append("test2", "value2"); - - const request1 = formData1.getRequest() as { body: FormData }; - const request2 = formData2.getRequest() as { body: FormData }; - - const entries1 = Array.from(request1.body.entries()); - const entries2 = Array.from(request2.body.entries()); - - expect(entries1).toHaveLength(1); - expect(entries2).toHaveLength(1); - expect(entries1[0][0]).toBe("test1"); - expect(entries2[0][0]).toBe("test2"); - }); - }); -}); diff --git a/tests/unit/form-data-utils/formDataWrapper.test.ts b/tests/unit/form-data-utils/formDataWrapper.test.ts index 0ec0bcae..47705084 100644 --- a/tests/unit/form-data-utils/formDataWrapper.test.ts +++ b/tests/unit/form-data-utils/formDataWrapper.test.ts @@ -1,7 +1,8 @@ +import { Blob, File } from "buffer"; +import { join } from "path"; /* eslint-disable @typescript-eslint/ban-ts-comment */ import { Readable } from "stream"; import { FormDataWrapper, newFormData } from "../../../src/core/form-data-utils/FormDataWrapper"; -import { File, Blob } from "buffer"; // Helper function to serialize FormData to string for inspection async function serializeFormData(formData: FormData): Promise { @@ -22,10 +23,38 @@ describe("FormDataWrapper", () => { await formData.setup(); }); + it("Upload file by path", async () => { + await formData.appendFile("file", { + path: join(__dirname, "..", "test-file.txt"), + }); + + const serialized = await serializeFormData(formData.getRequest().body); + + expect(serialized).toContain('Content-Disposition: form-data; name="file"'); + expect(serialized).toContain('filename="test-file.txt"'); + expect(serialized).toContain("This is a test file!"); + }); + + it("Upload file by path with filename", async () => { + await formData.appendFile("file", { + path: join(__dirname, "..", "test-file.txt"), + filename: "custom-file.txt", + }); + + const serialized = await serializeFormData(formData.getRequest().body); + + expect(serialized).toContain('Content-Disposition: form-data; name="file"'); + expect(serialized).toContain('filename="custom-file.txt"'); + expect(serialized).toContain("This is a test file!"); + }); + describe("Stream handling", () => { it("serializes Node.js Readable stream with filename", async () => { const stream = Readable.from(["file content"]); - await formData.appendFile("file", stream, "testfile.txt"); + await formData.appendFile("file", { + data: stream, + filename: "testfile.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); @@ -56,7 +85,10 @@ describe("FormDataWrapper", () => { it("handles empty streams", async () => { const stream = Readable.from([]); - await formData.appendFile("file", stream, "empty.txt"); + await formData.appendFile("file", { + data: stream, + filename: "empty.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="empty.txt"'); @@ -71,7 +103,10 @@ describe("FormDataWrapper", () => { }, }); - await formData.appendFile("file", stream, "webstream.txt"); + await formData.appendFile("file", { + data: stream, + filename: "webstream.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="webstream.txt"'); @@ -85,7 +120,10 @@ describe("FormDataWrapper", () => { }, }); - await formData.appendFile("file", stream, "empty.txt"); + await formData.appendFile("file", { + data: stream, + filename: "empty.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="empty.txt"'); @@ -96,7 +134,10 @@ describe("FormDataWrapper", () => { describe("Blob and File types", () => { it("serializes Blob with specified filename", async () => { const blob = new Blob(["file content"], { type: "text/plain" }); - await formData.appendFile("file", blob, "testfile.txt"); + await formData.appendFile("file", { + data: blob, + filename: "testfile.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="testfile.txt"'); @@ -126,7 +167,10 @@ describe("FormDataWrapper", () => { it("allows filename override for File objects", async () => { if (typeof File !== "undefined") { const file = new File(["file content"], "original.txt", { type: "text/plain" }); - await formData.appendFile("file", file, "override.txt"); + await formData.appendFile("file", { + data: file, + filename: "override.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="override.txt"'); @@ -140,7 +184,10 @@ describe("FormDataWrapper", () => { const arrayBuffer = new ArrayBuffer(8); new Uint8Array(arrayBuffer).set([1, 2, 3, 4, 5, 6, 7, 8]); - await formData.appendFile("file", arrayBuffer, "binary.bin"); + await formData.appendFile("file", { + data: arrayBuffer, + filename: "binary.bin", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="binary.bin"'); @@ -149,7 +196,10 @@ describe("FormDataWrapper", () => { it("serializes Uint8Array with filename", async () => { const uint8Array = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" - await formData.appendFile("file", uint8Array, "binary.bin"); + await formData.appendFile("file", { + data: uint8Array, + filename: "binary.bin", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="binary.bin"'); @@ -158,7 +208,10 @@ describe("FormDataWrapper", () => { it("serializes other typed arrays", async () => { const int16Array = new Int16Array([1000, 2000, 3000]); - await formData.appendFile("file", int16Array, "numbers.bin"); + await formData.appendFile("file", { + data: int16Array, + filename: "numbers.bin", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="numbers.bin"'); @@ -167,7 +220,10 @@ describe("FormDataWrapper", () => { it("serializes Buffer data with filename", async () => { if (typeof Buffer !== "undefined" && typeof Buffer.isBuffer === "function") { const buffer = Buffer.from("test content"); - await formData.appendFile("file", buffer, "test.txt"); + await formData.appendFile("file", { + data: buffer, + filename: "test.txt", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="test.txt"'); @@ -186,14 +242,6 @@ describe("FormDataWrapper", () => { expect(serialized).toContain("test string"); }); - it("serializes string as file with filename", async () => { - await formData.appendFile("file", "test content", "text.txt"); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="text.txt"'); - expect(serialized).toContain("test content"); - }); - it("serializes numbers and booleans as strings", async () => { formData.append("number", 12345); formData.append("flag", true); @@ -204,94 +252,26 @@ describe("FormDataWrapper", () => { }); }); - describe("Object and JSON handling", () => { - it("serializes objects as JSON with filename", async () => { - const obj = { test: "value", nested: { key: "data" } }; - await formData.appendFile("data", obj, "data.json"); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="data.json"'); - expect(serialized).toContain("Content-Type: application/json"); - expect(serialized).toContain(JSON.stringify(obj)); - }); - - it("serializes arrays as JSON", async () => { - const arr = [1, 2, 3, "test"]; - await formData.appendFile("array", arr, "array.json"); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="array.json"'); - expect(serialized).toContain(JSON.stringify(arr)); - }); - - it("handles null and undefined values", async () => { - formData.append("nullValue", null); - formData.append("undefinedValue", undefined); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain("null"); - expect(serialized).toContain("undefined"); - }); - }); - - describe("Filename extraction from objects", () => { - it("extracts filename from object with name property", async () => { - const namedValue = { name: "custom-name.txt", data: "content" }; - await formData.appendFile("file", namedValue); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="custom-name.txt"'); - expect(serialized).toContain(JSON.stringify(namedValue)); - }); - - it("extracts filename from object with path property", async () => { - const pathedValue = { path: "/some/path/file.txt", content: "data" }; - await formData.appendFile("file", pathedValue); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="file.txt"'); - }); - - it("prioritizes explicit filename over object properties", async () => { - const namedValue = { name: "original.txt", data: "content" }; - await formData.appendFile("file", namedValue, "override.txt"); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="override.txt"'); - expect(serialized).not.toContain('filename="original.txt"'); - }); - }); - describe("Edge cases and error handling", () => { it("handles empty filename gracefully", async () => { - await formData.appendFile("file", "content", ""); + await formData.appendFile("file", { + data: new Blob(["content"], { type: "text/plain" }), + filename: "", + }); const serialized = await serializeFormData(formData.getRequest().body); expect(serialized).toContain('filename="blob"'); // Default fallback }); - it("handles large strings", async () => { - const largeString = "x".repeat(1000); - await formData.appendFile("large", largeString, "large.txt"); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="large.txt"'); - }); - - it("handles unicode content and filenames", async () => { - const unicodeContent = "Hello 世界 🌍 Emoji 🚀"; - const unicodeFilename = "файл-тест-🌟.txt"; - - await formData.appendFile("unicode", unicodeContent, unicodeFilename); - - const serialized = await serializeFormData(formData.getRequest().body); - expect(serialized).toContain('filename="' + unicodeFilename + '"'); - expect(serialized).toContain(unicodeContent); - }); - it("handles multiple files in single form", async () => { - await formData.appendFile("file1", "content1", "file1.txt"); - await formData.appendFile("file2", "content2", "file2.txt"); + await formData.appendFile("file1", { + data: new Blob(["content1"], { type: "text/plain" }), + filename: "file1.txt", + }); + await formData.appendFile("file2", { + data: new Blob(["content2"], { type: "text/plain" }), + filename: "file2.txt", + }); formData.append("text", "regular field"); const serialized = await serializeFormData(formData.getRequest().body); @@ -305,7 +285,10 @@ describe("FormDataWrapper", () => { describe("Request structure", () => { it("returns correct request structure", async () => { - await formData.appendFile("file", "content", "test.txt"); + await formData.appendFile("file", { + data: new Blob(["content"], { type: "text/plain" }), + filename: "test.txt", + }); const request = formData.getRequest(); @@ -318,7 +301,10 @@ describe("FormDataWrapper", () => { }); it("generates proper multipart boundary structure", async () => { - await formData.appendFile("file", "test content", "test.txt"); + await formData.appendFile("file", { + data: new Blob(["test content"], { type: "text/plain" }), + filename: "test.txt", + }); formData.append("field", "value"); const serialized = await serializeFormData(formData.getRequest().body); diff --git a/tests/unit/logging/logger.test.ts b/tests/unit/logging/logger.test.ts new file mode 100644 index 00000000..2e0b5fe5 --- /dev/null +++ b/tests/unit/logging/logger.test.ts @@ -0,0 +1,454 @@ +import { ConsoleLogger, createLogger, Logger, LogLevel } from "../../../src/core/logging/logger"; + +function createMockLogger() { + return { + debug: vi.fn(), + info: vi.fn(), + warn: vi.fn(), + error: vi.fn(), + }; +} + +describe("Logger", () => { + describe("LogLevel", () => { + it("should have correct log levels", () => { + expect(LogLevel.Debug).toBe("debug"); + expect(LogLevel.Info).toBe("info"); + expect(LogLevel.Warn).toBe("warn"); + expect(LogLevel.Error).toBe("error"); + }); + }); + + describe("ConsoleLogger", () => { + let consoleLogger: ConsoleLogger; + let consoleSpy: { + debug: ReturnType; + info: ReturnType; + warn: ReturnType; + error: ReturnType; + }; + + beforeEach(() => { + consoleLogger = new ConsoleLogger(); + consoleSpy = { + debug: vi.spyOn(console, "debug").mockImplementation(() => {}), + info: vi.spyOn(console, "info").mockImplementation(() => {}), + warn: vi.spyOn(console, "warn").mockImplementation(() => {}), + error: vi.spyOn(console, "error").mockImplementation(() => {}), + }; + }); + + afterEach(() => { + consoleSpy.debug.mockRestore(); + consoleSpy.info.mockRestore(); + consoleSpy.warn.mockRestore(); + consoleSpy.error.mockRestore(); + }); + + it("should log debug messages", () => { + consoleLogger.debug("debug message", { data: "test" }); + expect(consoleSpy.debug).toHaveBeenCalledWith("debug message", { data: "test" }); + }); + + it("should log info messages", () => { + consoleLogger.info("info message", { data: "test" }); + expect(consoleSpy.info).toHaveBeenCalledWith("info message", { data: "test" }); + }); + + it("should log warn messages", () => { + consoleLogger.warn("warn message", { data: "test" }); + expect(consoleSpy.warn).toHaveBeenCalledWith("warn message", { data: "test" }); + }); + + it("should log error messages", () => { + consoleLogger.error("error message", { data: "test" }); + expect(consoleSpy.error).toHaveBeenCalledWith("error message", { data: "test" }); + }); + + it("should handle multiple arguments", () => { + consoleLogger.debug("message", "arg1", "arg2", { key: "value" }); + expect(consoleSpy.debug).toHaveBeenCalledWith("message", "arg1", "arg2", { key: "value" }); + }); + }); + + describe("Logger with level filtering", () => { + let mockLogger: { + debug: ReturnType; + info: ReturnType; + warn: ReturnType; + error: ReturnType; + }; + + beforeEach(() => { + mockLogger = createMockLogger(); + }); + + describe("Debug level", () => { + it("should log all levels when set to debug", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).toHaveBeenCalledWith("debug"); + expect(mockLogger.info).toHaveBeenCalledWith("info"); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(true); + expect(logger.isInfo()).toBe(true); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Info level", () => { + it("should log info, warn, and error when set to info", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).toHaveBeenCalledWith("info"); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(true); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Warn level", () => { + it("should log warn and error when set to warn", () => { + const logger = new Logger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).toHaveBeenCalledWith("warn"); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(true); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Error level", () => { + it("should only log error when set to error", () => { + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).toHaveBeenCalledWith("error"); + }); + + it("should report correct level checks", () => { + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(false); + expect(logger.isError()).toBe(true); + }); + }); + + describe("Silent mode", () => { + it("should not log anything when silent is true", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + logger.debug("debug"); + logger.info("info"); + logger.warn("warn"); + logger.error("error"); + + expect(mockLogger.debug).not.toHaveBeenCalled(); + expect(mockLogger.info).not.toHaveBeenCalled(); + expect(mockLogger.warn).not.toHaveBeenCalled(); + expect(mockLogger.error).not.toHaveBeenCalled(); + }); + + it("should report all level checks as false when silent", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + expect(logger.isDebug()).toBe(false); + expect(logger.isInfo()).toBe(false); + expect(logger.isWarn()).toBe(false); + expect(logger.isError()).toBe(false); + }); + }); + + describe("shouldLog", () => { + it("should correctly determine if level should be logged", () => { + const logger = new Logger({ + level: LogLevel.Info, + logger: mockLogger, + silent: false, + }); + + expect(logger.shouldLog(LogLevel.Debug)).toBe(false); + expect(logger.shouldLog(LogLevel.Info)).toBe(true); + expect(logger.shouldLog(LogLevel.Warn)).toBe(true); + expect(logger.shouldLog(LogLevel.Error)).toBe(true); + }); + + it("should return false for all levels when silent", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: true, + }); + + expect(logger.shouldLog(LogLevel.Debug)).toBe(false); + expect(logger.shouldLog(LogLevel.Info)).toBe(false); + expect(logger.shouldLog(LogLevel.Warn)).toBe(false); + expect(logger.shouldLog(LogLevel.Error)).toBe(false); + }); + }); + + describe("Multiple arguments", () => { + it("should pass multiple arguments to logger", () => { + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("message", "arg1", { key: "value" }, 123); + expect(mockLogger.debug).toHaveBeenCalledWith("message", "arg1", { key: "value" }, 123); + }); + }); + }); + + describe("createLogger", () => { + it("should return default logger when no config provided", () => { + const logger = createLogger(); + expect(logger).toBeInstanceOf(Logger); + }); + + it("should return same logger instance when Logger is passed", () => { + const customLogger = new Logger({ + level: LogLevel.Debug, + logger: new ConsoleLogger(), + silent: false, + }); + + const result = createLogger(customLogger); + expect(result).toBe(customLogger); + }); + + it("should create logger with custom config", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + level: LogLevel.Warn, + logger: mockLogger, + silent: false, + }); + + expect(logger).toBeInstanceOf(Logger); + logger.warn("test"); + expect(mockLogger.warn).toHaveBeenCalledWith("test"); + }); + + it("should use default values for missing config", () => { + const logger = createLogger({}); + expect(logger).toBeInstanceOf(Logger); + }); + + it("should override default level", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("test"); + expect(mockLogger.debug).toHaveBeenCalledWith("test"); + }); + + it("should override default silent mode", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + logger: mockLogger, + silent: false, + }); + + logger.info("test"); + expect(mockLogger.info).toHaveBeenCalledWith("test"); + }); + + it("should use provided logger implementation", () => { + const customLogger = createMockLogger(); + + const logger = createLogger({ + logger: customLogger, + level: LogLevel.Debug, + silent: false, + }); + + logger.debug("test"); + expect(customLogger.debug).toHaveBeenCalledWith("test"); + }); + + it("should default to silent: true", () => { + const mockLogger = createMockLogger(); + + const logger = createLogger({ + logger: mockLogger, + level: LogLevel.Debug, + }); + + logger.debug("test"); + expect(mockLogger.debug).not.toHaveBeenCalled(); + }); + }); + + describe("Default logger", () => { + it("should have silent: true by default", () => { + const logger = createLogger(); + expect(logger.shouldLog(LogLevel.Info)).toBe(false); + }); + + it("should not log when using default logger", () => { + const logger = createLogger(); + + logger.info("test"); + expect(logger.isInfo()).toBe(false); + }); + }); + + describe("Edge cases", () => { + it("should handle empty message", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug(""); + expect(mockLogger.debug).toHaveBeenCalledWith(""); + }); + + it("should handle no arguments", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + logger.debug("message"); + expect(mockLogger.debug).toHaveBeenCalledWith("message"); + }); + + it("should handle complex objects", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Debug, + logger: mockLogger, + silent: false, + }); + + const complexObject = { + nested: { key: "value" }, + array: [1, 2, 3], + fn: () => "test", + }; + + logger.debug("message", complexObject); + expect(mockLogger.debug).toHaveBeenCalledWith("message", complexObject); + }); + + it("should handle errors as arguments", () => { + const mockLogger = createMockLogger(); + + const logger = new Logger({ + level: LogLevel.Error, + logger: mockLogger, + silent: false, + }); + + const error = new Error("Test error"); + logger.error("Error occurred", error); + expect(mockLogger.error).toHaveBeenCalledWith("Error occurred", error); + }); + }); +}); diff --git a/tests/unit/test-file.txt b/tests/unit/test-file.txt new file mode 100644 index 00000000..c66d471e --- /dev/null +++ b/tests/unit/test-file.txt @@ -0,0 +1 @@ +This is a test file! diff --git a/tests/unit/url/join.test.ts b/tests/unit/url/join.test.ts index c630ac00..123488f0 100644 --- a/tests/unit/url/join.test.ts +++ b/tests/unit/url/join.test.ts @@ -1,88 +1,223 @@ -import { join } from "../../../src/core/url/index.js"; +import { join } from "../../../src/core/url/index"; describe("join", () => { - describe("basic functionality", () => { - it("should return empty string for empty base", () => { - expect(join("")).toBe(""); - expect(join("", "path")).toBe(""); - }); + interface TestCase { + description: string; + base: string; + segments: string[]; + expected: string; + } - it("should handle single segment", () => { - expect(join("base", "segment")).toBe("base/segment"); - expect(join("base/", "segment")).toBe("base/segment"); - expect(join("base", "/segment")).toBe("base/segment"); - expect(join("base/", "/segment")).toBe("base/segment"); - }); + describe("basic functionality", () => { + const basicTests: TestCase[] = [ + { description: "should return empty string for empty base", base: "", segments: [], expected: "" }, + { + description: "should return empty string for empty base with path", + base: "", + segments: ["path"], + expected: "", + }, + { + description: "should handle single segment", + base: "base", + segments: ["segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with trailing slash on base", + base: "base/", + segments: ["segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with leading slash", + base: "base", + segments: ["/segment"], + expected: "base/segment", + }, + { + description: "should handle single segment with both slashes", + base: "base/", + segments: ["/segment"], + expected: "base/segment", + }, + { + description: "should handle multiple segments", + base: "base", + segments: ["path1", "path2", "path3"], + expected: "base/path1/path2/path3", + }, + { + description: "should handle multiple segments with slashes", + base: "base/", + segments: ["/path1/", "/path2/", "/path3/"], + expected: "base/path1/path2/path3/", + }, + ]; - it("should handle multiple segments", () => { - expect(join("base", "path1", "path2", "path3")).toBe("base/path1/path2/path3"); - expect(join("base/", "/path1/", "/path2/", "/path3/")).toBe("base/path1/path2/path3"); + basicTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("URL handling", () => { - it("should handle absolute URLs", () => { - expect(join("https://example.com", "api", "v1")).toBe("https://example.com/api/v1"); - expect(join("https://example.com/", "/api/", "/v1/")).toBe("https://example.com/api/v1"); - expect(join("https://example.com/base", "api", "v1")).toBe("https://example.com/base/api/v1"); - }); - - it("should preserve URL query parameters and fragments", () => { - expect(join("https://example.com?query=1", "api")).toBe("https://example.com/api?query=1"); - expect(join("https://example.com#fragment", "api")).toBe("https://example.com/api#fragment"); - expect(join("https://example.com?query=1#fragment", "api")).toBe( - "https://example.com/api?query=1#fragment", - ); - }); - - it("should handle different protocols", () => { - expect(join("http://example.com", "api")).toBe("http://example.com/api"); - expect(join("ftp://example.com", "files")).toBe("ftp://example.com/files"); - expect(join("ws://example.com", "socket")).toBe("ws://example.com/socket"); - }); + const urlTests: TestCase[] = [ + { + description: "should handle absolute URLs", + base: "https://example.com", + segments: ["api", "v1"], + expected: "https://example.com/api/v1", + }, + { + description: "should handle absolute URLs with slashes", + base: "https://example.com/", + segments: ["/api/", "/v1/"], + expected: "https://example.com/api/v1/", + }, + { + description: "should handle absolute URLs with base path", + base: "https://example.com/base", + segments: ["api", "v1"], + expected: "https://example.com/base/api/v1", + }, + { + description: "should preserve URL query parameters", + base: "https://example.com?query=1", + segments: ["api"], + expected: "https://example.com/api?query=1", + }, + { + description: "should preserve URL fragments", + base: "https://example.com#fragment", + segments: ["api"], + expected: "https://example.com/api#fragment", + }, + { + description: "should preserve URL query and fragments", + base: "https://example.com?query=1#fragment", + segments: ["api"], + expected: "https://example.com/api?query=1#fragment", + }, + { + description: "should handle http protocol", + base: "http://example.com", + segments: ["api"], + expected: "http://example.com/api", + }, + { + description: "should handle ftp protocol", + base: "ftp://example.com", + segments: ["files"], + expected: "ftp://example.com/files", + }, + { + description: "should handle ws protocol", + base: "ws://example.com", + segments: ["socket"], + expected: "ws://example.com/socket", + }, + { + description: "should fallback to path joining for malformed URLs", + base: "not-a-url://", + segments: ["path"], + expected: "not-a-url:///path", + }, + ]; - it("should fallback to path joining for malformed URLs", () => { - expect(join("not-a-url://", "path")).toBe("not-a-url:///path"); + urlTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("edge cases", () => { - it("should handle empty segments", () => { - expect(join("base", "", "path")).toBe("base/path"); - expect(join("base", null as any, "path")).toBe("base/path"); - expect(join("base", undefined as any, "path")).toBe("base/path"); - }); - - it("should handle segments with only slashes", () => { - expect(join("base", "/", "path")).toBe("base/path"); - expect(join("base", "//", "path")).toBe("base/path"); - }); + const edgeCaseTests: TestCase[] = [ + { + description: "should handle empty segments", + base: "base", + segments: ["", "path"], + expected: "base/path", + }, + { + description: "should handle null segments", + base: "base", + segments: [null as any, "path"], + expected: "base/path", + }, + { + description: "should handle undefined segments", + base: "base", + segments: [undefined as any, "path"], + expected: "base/path", + }, + { + description: "should handle segments with only single slash", + base: "base", + segments: ["/", "path"], + expected: "base/path", + }, + { + description: "should handle segments with only double slash", + base: "base", + segments: ["//", "path"], + expected: "base/path", + }, + { + description: "should handle base paths with trailing slashes", + base: "base/", + segments: ["path"], + expected: "base/path", + }, + { + description: "should handle complex nested paths", + base: "api/v1/", + segments: ["/users/", "/123/", "/profile"], + expected: "api/v1/users/123/profile", + }, + ]; - it("should handle base paths with trailing slashes", () => { - expect(join("base/", "path")).toBe("base/path"); - }); - - it("should handle complex nested paths", () => { - expect(join("api/v1/", "/users/", "/123/", "/profile")).toBe("api/v1/users/123/profile"); + edgeCaseTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); describe("real-world scenarios", () => { - it("should handle API endpoint construction", () => { - const baseUrl = "https://api.example.com/v1"; - expect(join(baseUrl, "users", "123", "posts")).toBe("https://api.example.com/v1/users/123/posts"); - }); + const realWorldTests: TestCase[] = [ + { + description: "should handle API endpoint construction", + base: "https://api.example.com/v1", + segments: ["users", "123", "posts"], + expected: "https://api.example.com/v1/users/123/posts", + }, + { + description: "should handle file path construction", + base: "/var/www", + segments: ["html", "assets", "images"], + expected: "/var/www/html/assets/images", + }, + { + description: "should handle relative path construction", + base: "../parent", + segments: ["child", "grandchild"], + expected: "../parent/child/grandchild", + }, + { + description: "should handle Windows-style paths", + base: "C:\\Users", + segments: ["Documents", "file.txt"], + expected: "C:\\Users/Documents/file.txt", + }, + ]; - it("should handle file path construction", () => { - expect(join("/var/www", "html", "assets", "images")).toBe("/var/www/html/assets/images"); - }); - - it("should handle relative path construction", () => { - expect(join("../parent", "child", "grandchild")).toBe("../parent/child/grandchild"); - }); - - it("should handle Windows-style paths", () => { - expect(join("C:\\Users", "Documents", "file.txt")).toBe("C:\\Users/Documents/file.txt"); + realWorldTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); }); }); @@ -90,7 +225,7 @@ describe("join", () => { it("should handle many segments efficiently", () => { const segments = Array(100).fill("segment"); const result = join("base", ...segments); - expect(result).toBe("base/" + segments.join("/")); + expect(result).toBe(`base/${segments.join("/")}`); }); it("should handle long URLs", () => { @@ -98,4 +233,52 @@ describe("join", () => { expect(join("https://example.com", longPath)).toBe(`https://example.com/${longPath}`); }); }); + + describe("trailing slash preservation", () => { + const trailingSlashTests: TestCase[] = [ + { + description: + "should preserve trailing slash on final result when base has trailing slash and no segments", + base: "https://api.example.com/", + segments: [], + expected: "https://api.example.com/", + }, + { + description: "should preserve trailing slash on v1 path", + base: "https://api.example.com/v1/", + segments: [], + expected: "https://api.example.com/v1/", + }, + { + description: "should preserve trailing slash when last segment has trailing slash", + base: "https://api.example.com", + segments: ["users/"], + expected: "https://api.example.com/users/", + }, + { + description: "should preserve trailing slash with relative path", + base: "api/v1", + segments: ["users/"], + expected: "api/v1/users/", + }, + { + description: "should preserve trailing slash with multiple segments", + base: "https://api.example.com", + segments: ["v1", "collections/"], + expected: "https://api.example.com/v1/collections/", + }, + { + description: "should preserve trailing slash with base path", + base: "base", + segments: ["path1", "path2/"], + expected: "base/path1/path2/", + }, + ]; + + trailingSlashTests.forEach(({ description, base, segments, expected }) => { + it(description, () => { + expect(join(base, ...segments)).toBe(expected); + }); + }); + }); }); diff --git a/tests/unit/url/qs.test.ts b/tests/unit/url/qs.test.ts index 867c4b03..42cdffb9 100644 --- a/tests/unit/url/qs.test.ts +++ b/tests/unit/url/qs.test.ts @@ -1,187 +1,278 @@ -import { toQueryString } from "../../../src/core/url/index.js"; +import { toQueryString } from "../../../src/core/url/index"; describe("Test qs toQueryString", () => { - describe("Basic functionality", () => { - it("should return empty string for null/undefined", () => { - expect(toQueryString(null)).toBe(""); - expect(toQueryString(undefined)).toBe(""); - }); + interface BasicTestCase { + description: string; + input: any; + expected: string; + } - it("should return empty string for primitive values", () => { - expect(toQueryString("hello")).toBe(""); - expect(toQueryString(42)).toBe(""); - expect(toQueryString(true)).toBe(""); - expect(toQueryString(false)).toBe(""); - }); - - it("should handle empty objects", () => { - expect(toQueryString({})).toBe(""); - }); + describe("Basic functionality", () => { + const basicTests: BasicTestCase[] = [ + { description: "should return empty string for null", input: null, expected: "" }, + { description: "should return empty string for undefined", input: undefined, expected: "" }, + { description: "should return empty string for string primitive", input: "hello", expected: "" }, + { description: "should return empty string for number primitive", input: 42, expected: "" }, + { description: "should return empty string for true boolean", input: true, expected: "" }, + { description: "should return empty string for false boolean", input: false, expected: "" }, + { description: "should handle empty objects", input: {}, expected: "" }, + { + description: "should handle simple key-value pairs", + input: { name: "John", age: 30 }, + expected: "name=John&age=30", + }, + ]; - it("should handle simple key-value pairs", () => { - const obj = { name: "John", age: 30 }; - expect(toQueryString(obj)).toBe("name=John&age=30"); + basicTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Array handling", () => { - it("should handle arrays with indices format (default)", () => { - const obj = { items: ["a", "b", "c"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b&items%5B2%5D=c"); - }); - - it("should handle arrays with repeat format", () => { - const obj = { items: ["a", "b", "c"] }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("items=a&items=b&items=c"); - }); + interface ArrayTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices" }; + expected: string; + } - it("should handle empty arrays", () => { - const obj = { items: [] }; - expect(toQueryString(obj)).toBe(""); - }); - - it("should handle arrays with mixed types", () => { - const obj = { mixed: ["string", 42, true, false] }; - expect(toQueryString(obj)).toBe("mixed%5B0%5D=string&mixed%5B1%5D=42&mixed%5B2%5D=true&mixed%5B3%5D=false"); - }); - - it("should handle arrays with objects", () => { - const obj = { users: [{ name: "John" }, { name: "Jane" }] }; - expect(toQueryString(obj)).toBe("users%5B0%5D%5Bname%5D=John&users%5B1%5D%5Bname%5D=Jane"); - }); + const arrayTests: ArrayTestCase[] = [ + { + description: "should handle arrays with indices format (default)", + input: { items: ["a", "b", "c"] }, + expected: "items%5B0%5D=a&items%5B1%5D=b&items%5B2%5D=c", + }, + { + description: "should handle arrays with repeat format", + input: { items: ["a", "b", "c"] }, + options: { arrayFormat: "repeat" }, + expected: "items=a&items=b&items=c", + }, + { + description: "should handle empty arrays", + input: { items: [] }, + expected: "", + }, + { + description: "should handle arrays with mixed types", + input: { mixed: ["string", 42, true, false] }, + expected: "mixed%5B0%5D=string&mixed%5B1%5D=42&mixed%5B2%5D=true&mixed%5B3%5D=false", + }, + { + description: "should handle arrays with objects", + input: { users: [{ name: "John" }, { name: "Jane" }] }, + expected: "users%5B0%5D%5Bname%5D=John&users%5B1%5D%5Bname%5D=Jane", + }, + { + description: "should handle arrays with objects in repeat format", + input: { users: [{ name: "John" }, { name: "Jane" }] }, + options: { arrayFormat: "repeat" }, + expected: "users%5Bname%5D=John&users%5Bname%5D=Jane", + }, + ]; - it("should handle arrays with objects in repeat format", () => { - const obj = { users: [{ name: "John" }, { name: "Jane" }] }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe("users%5Bname%5D=John&users%5Bname%5D=Jane"); + arrayTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Nested objects", () => { - it("should handle nested objects", () => { - const obj = { user: { name: "John", age: 30 } }; - expect(toQueryString(obj)).toBe("user%5Bname%5D=John&user%5Bage%5D=30"); - }); - - it("should handle deeply nested objects", () => { - const obj = { user: { profile: { name: "John", settings: { theme: "dark" } } } }; - expect(toQueryString(obj)).toBe( - "user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", - ); - }); + const nestedTests: BasicTestCase[] = [ + { + description: "should handle nested objects", + input: { user: { name: "John", age: 30 } }, + expected: "user%5Bname%5D=John&user%5Bage%5D=30", + }, + { + description: "should handle deeply nested objects", + input: { user: { profile: { name: "John", settings: { theme: "dark" } } } }, + expected: "user%5Bprofile%5D%5Bname%5D=John&user%5Bprofile%5D%5Bsettings%5D%5Btheme%5D=dark", + }, + { + description: "should handle empty nested objects", + input: { user: {} }, + expected: "", + }, + ]; - it("should handle empty nested objects", () => { - const obj = { user: {} }; - expect(toQueryString(obj)).toBe(""); + nestedTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Encoding", () => { - it("should encode by default", () => { - const obj = { name: "John Doe", email: "john@example.com" }; - expect(toQueryString(obj)).toBe("name=John%20Doe&email=john%40example.com"); - }); + interface EncodingTestCase { + description: string; + input: any; + options?: { encode?: boolean }; + expected: string; + } - it("should not encode when encode is false", () => { - const obj = { name: "John Doe", email: "john@example.com" }; - expect(toQueryString(obj, { encode: false })).toBe("name=John Doe&email=john@example.com"); - }); - - it("should encode special characters in keys", () => { - const obj = { "user name": "John", "email[primary]": "john@example.com" }; - expect(toQueryString(obj)).toBe("user%20name=John&email%5Bprimary%5D=john%40example.com"); - }); + const encodingTests: EncodingTestCase[] = [ + { + description: "should encode by default", + input: { name: "John Doe", email: "john@example.com" }, + expected: "name=John%20Doe&email=john%40example.com", + }, + { + description: "should not encode when encode is false", + input: { name: "John Doe", email: "john@example.com" }, + options: { encode: false }, + expected: "name=John Doe&email=john@example.com", + }, + { + description: "should encode special characters in keys", + input: { "user name": "John", "email[primary]": "john@example.com" }, + expected: "user%20name=John&email%5Bprimary%5D=john%40example.com", + }, + { + description: "should not encode special characters in keys when encode is false", + input: { "user name": "John", "email[primary]": "john@example.com" }, + options: { encode: false }, + expected: "user name=John&email[primary]=john@example.com", + }, + ]; - it("should not encode special characters in keys when encode is false", () => { - const obj = { "user name": "John", "email[primary]": "john@example.com" }; - expect(toQueryString(obj, { encode: false })).toBe("user name=John&email[primary]=john@example.com"); + encodingTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Mixed scenarios", () => { - it("should handle complex nested structures", () => { - const obj = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + interface MixedTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices" }; + expected: string; + } + + const mixedTests: MixedTestCase[] = [ + { + description: "should handle complex nested structures", + input: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(toQueryString(obj)).toBe( - "filters%5Bstatus%5D%5B0%5D=active&filters%5Bstatus%5D%5B1%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D%5B0%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D%5B1%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); - }); - - it("should handle complex nested structures with repeat format", () => { - const obj = { - filters: { - status: ["active", "pending"], - category: { - type: "electronics", - subcategories: ["phones", "laptops"], + expected: + "filters%5Bstatus%5D%5B0%5D=active&filters%5Bstatus%5D%5B1%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D%5B0%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D%5B1%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + { + description: "should handle complex nested structures with repeat format", + input: { + filters: { + status: ["active", "pending"], + category: { + type: "electronics", + subcategories: ["phones", "laptops"], + }, }, + sort: { field: "name", direction: "asc" }, }, - sort: { field: "name", direction: "asc" }, - }; - expect(toQueryString(obj, { arrayFormat: "repeat" })).toBe( - "filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", - ); - }); - - it("should handle arrays with null/undefined values", () => { - const obj = { items: ["a", null, "c", undefined, "e"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e"); - }); + options: { arrayFormat: "repeat" }, + expected: + "filters%5Bstatus%5D=active&filters%5Bstatus%5D=pending&filters%5Bcategory%5D%5Btype%5D=electronics&filters%5Bcategory%5D%5Bsubcategories%5D=phones&filters%5Bcategory%5D%5Bsubcategories%5D=laptops&sort%5Bfield%5D=name&sort%5Bdirection%5D=asc", + }, + { + description: "should handle arrays with null/undefined values", + input: { items: ["a", null, "c", undefined, "e"] }, + expected: "items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e", + }, + { + description: "should handle objects with null/undefined values", + input: { name: "John", age: null, email: undefined, active: true }, + expected: "name=John&age=&active=true", + }, + ]; - it("should handle objects with null/undefined values", () => { - const obj = { name: "John", age: null, email: undefined, active: true }; - expect(toQueryString(obj)).toBe("name=John&age=&active=true"); + mixedTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); describe("Edge cases", () => { - it("should handle numeric keys", () => { - const obj = { "0": "zero", "1": "one" }; - expect(toQueryString(obj)).toBe("0=zero&1=one"); - }); - - it("should handle boolean values in objects", () => { - const obj = { enabled: true, disabled: false }; - expect(toQueryString(obj)).toBe("enabled=true&disabled=false"); - }); - - it("should handle empty strings", () => { - const obj = { name: "", description: "test" }; - expect(toQueryString(obj)).toBe("name=&description=test"); - }); + const edgeCaseTests: BasicTestCase[] = [ + { + description: "should handle numeric keys", + input: { "0": "zero", "1": "one" }, + expected: "0=zero&1=one", + }, + { + description: "should handle boolean values in objects", + input: { enabled: true, disabled: false }, + expected: "enabled=true&disabled=false", + }, + { + description: "should handle empty strings", + input: { name: "", description: "test" }, + expected: "name=&description=test", + }, + { + description: "should handle zero values", + input: { count: 0, price: 0.0 }, + expected: "count=0&price=0", + }, + { + description: "should handle arrays with empty strings", + input: { items: ["a", "", "c"] }, + expected: "items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c", + }, + ]; - it("should handle zero values", () => { - const obj = { count: 0, price: 0.0 }; - expect(toQueryString(obj)).toBe("count=0&price=0"); - }); - - it("should handle arrays with empty strings", () => { - const obj = { items: ["a", "", "c"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c"); + edgeCaseTests.forEach(({ description, input, expected }) => { + it(description, () => { + expect(toQueryString(input)).toBe(expected); + }); }); }); describe("Options combinations", () => { - it("should respect both arrayFormat and encode options", () => { - const obj = { items: ["a & b", "c & d"] }; - expect(toQueryString(obj, { arrayFormat: "repeat", encode: false })).toBe("items=a & b&items=c & d"); - }); + interface OptionsTestCase { + description: string; + input: any; + options?: { arrayFormat?: "repeat" | "indices"; encode?: boolean }; + expected: string; + } - it("should use default options when none provided", () => { - const obj = { items: ["a", "b"] }; - expect(toQueryString(obj)).toBe("items%5B0%5D=a&items%5B1%5D=b"); - }); + const optionsTests: OptionsTestCase[] = [ + { + description: "should respect both arrayFormat and encode options", + input: { items: ["a & b", "c & d"] }, + options: { arrayFormat: "repeat", encode: false }, + expected: "items=a & b&items=c & d", + }, + { + description: "should use default options when none provided", + input: { items: ["a", "b"] }, + expected: "items%5B0%5D=a&items%5B1%5D=b", + }, + { + description: "should merge provided options with defaults", + input: { items: ["a", "b"], name: "John Doe" }, + options: { encode: false }, + expected: "items[0]=a&items[1]=b&name=John Doe", + }, + ]; - it("should merge provided options with defaults", () => { - const obj = { items: ["a", "b"], name: "John Doe" }; - expect(toQueryString(obj, { encode: false })).toBe("items[0]=a&items[1]=b&name=John Doe"); + optionsTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); }); }); }); diff --git a/tests/wire/.gitkeep b/tests/wire/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/wire/bill.test.ts b/tests/wire/bill.test.ts index e77ba74e..7c136b03 100644 --- a/tests/wire/bill.test.ts +++ b/tests/wire/bill.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Bill", () => { - test("AddBill", async () => { +describe("BillClient", () => { + test("AddBill (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { billNumber: "ABC-123", netAmount: 3762.87, @@ -42,7 +41,6 @@ describe("Bill", () => { }; const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -100,7 +98,6 @@ describe("Bill", () => { }); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -108,13 +105,96 @@ describe("Bill", () => { }); }); - test("deleteAttachedFromBill", async () => { + test("AddBill (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.addBill("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.addBill("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.addBill("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Bill/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.addBill("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("deleteAttachedFromBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -131,7 +211,6 @@ describe("Bill", () => { const response = await client.bill.deleteAttachedFromBill(285, "0_Bill.pdf"); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -139,13 +218,84 @@ describe("Bill", () => { }); }); - test("DeleteBill", async () => { + test("deleteAttachedFromBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.deleteAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("deleteAttachedFromBill (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.deleteAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("deleteAttachedFromBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.deleteAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("deleteAttachedFromBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.deleteAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -156,7 +306,6 @@ describe("Bill", () => { const response = await client.bill.deleteBill(285); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -164,13 +313,60 @@ describe("Bill", () => { }); }); - test("EditBill", async () => { + test("DeleteBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Bill/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.deleteBill(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Bill/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.deleteBill(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteBill (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Bill/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.deleteBill(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Bill/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.deleteBill(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { netAmount: 3762.87, billDate: "2025-07-01" }; const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -191,7 +387,6 @@ describe("Bill", () => { }); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -199,9 +394,85 @@ describe("Bill", () => { }); }); - test("getAttachedFromBill", async () => { + test("EditBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.editBill(1, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.editBill(1, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.editBill(1, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.editBill(1, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getAttachedFromBill (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { fContent: "TXkgdGVzdCBmaWxlHJ==...", @@ -228,13 +499,84 @@ describe("Bill", () => { }); }); - test("GetBill", async () => { + test("getAttachedFromBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.getAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getAttachedFromBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.getAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getAttachedFromBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.getAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getAttachedFromBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Bill/attachedFileFromBill/1/filename") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.getAttachedFromBill(1, "filename"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetBill (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -242,12 +584,10 @@ describe("Bill", () => { IdBill: 285, BillNumber: "ABC-123", NetAmount: 100, - Discount: undefined, TotalAmount: 100, BillDate: "2025-07-01", DueDate: "2025-07-01", Comments: "Deposit for materials", - BatchNumber: undefined, BillItems: [ { itemTotalAmount: 123, @@ -261,17 +601,11 @@ describe("Bill", () => { itemCost: 5, itemQty: 1, itemMode: 0, - itemCategories: undefined, }, ], Mode: 0, - PaymentMethod: undefined, - PaymentId: undefined, AccountingField1: "MyInternalId", AccountingField2: "MyInternalId", - Terms: undefined, - Source: undefined, - AdditionalData: undefined, Vendor: { VendorNumber: "1234", Name1: "Herman's Coatings and Masonry", @@ -279,7 +613,6 @@ describe("Bill", () => { EIN: "XXXX6789", Phone: "5555555555", Email: "contact@hermanscoatings.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Miami", @@ -298,7 +631,6 @@ describe("Bill", () => { ], BillingData: { id: 123, - accountId: undefined, nickname: "Checking Account", bankName: "Country Bank", routingAccount: "123123123", @@ -315,7 +647,6 @@ describe("Bill", () => { PaymentMethod: "vcard", VendorStatus: 1, VendorId: 1234, - EnrollmentStatus: undefined, Summary: { ActiveBills: 5, PendingBills: 2, @@ -363,34 +694,27 @@ describe("Bill", () => { }, Status: -99, CreatedAt: "2025-07-01T15:00:01Z", - EndDate: undefined, LastUpdated: "2025-07-01T15:00:01Z", - Frequency: undefined, billEvents: [ { description: "Created Bill", eventTime: "2025-07-01T15:00:01Z", refData: "REF-12345", - extraData: undefined, source: "API", }, ], - billApprovals: undefined, PaypointLegalname: "Gruzya Adventure Outfitters LLC", PaypointDbaname: "Gruzya Adventure Outfitters", ParentOrgId: 1232, ParentOrgName: "Pilgrim Planner", PaypointEntryname: "41035afaa7", - paylinkId: undefined, DocumentsRef: { zipfile: "documents_285.zip", filelist: [ { originalName: "invoice.pdf", zipName: "0_invoice.pdf", descriptor: "Invoice document" }, ], }, - externalPaypointID: undefined, LotNumber: "LOT-285", - EntityID: undefined, }, }; server.mockEndpoint().get("/Bill/285").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -398,7 +722,6 @@ describe("Bill", () => { const response = await client.bill.getBill(285); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -406,12 +729,10 @@ describe("Bill", () => { IdBill: 285, BillNumber: "ABC-123", NetAmount: 100, - Discount: undefined, TotalAmount: 100, BillDate: "2025-07-01", DueDate: "2025-07-01", Comments: "Deposit for materials", - BatchNumber: undefined, BillItems: [ { itemTotalAmount: 123, @@ -425,17 +746,11 @@ describe("Bill", () => { itemCost: 5, itemQty: 1, itemMode: 0, - itemCategories: undefined, }, ], Mode: 0, - PaymentMethod: undefined, - PaymentId: undefined, AccountingField1: "MyInternalId", AccountingField2: "MyInternalId", - Terms: undefined, - Source: undefined, - AdditionalData: undefined, Vendor: { VendorNumber: "1234", Name1: "Herman's Coatings and Masonry", @@ -443,7 +758,6 @@ describe("Bill", () => { EIN: "XXXX6789", Phone: "5555555555", Email: "contact@hermanscoatings.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Miami", @@ -462,7 +776,6 @@ describe("Bill", () => { ], BillingData: { id: 123, - accountId: undefined, nickname: "Checking Account", bankName: "Country Bank", routingAccount: "123123123", @@ -479,7 +792,6 @@ describe("Bill", () => { PaymentMethod: "vcard", VendorStatus: 1, VendorId: 1234, - EnrollmentStatus: undefined, Summary: { ActiveBills: 5, PendingBills: 2, @@ -527,25 +839,20 @@ describe("Bill", () => { }, Status: -99, CreatedAt: "2025-07-01T15:00:01Z", - EndDate: undefined, LastUpdated: "2025-07-01T15:00:01Z", - Frequency: undefined, billEvents: [ { description: "Created Bill", eventTime: "2025-07-01T15:00:01Z", refData: "REF-12345", - extraData: undefined, source: "API", }, ], - billApprovals: undefined, PaypointLegalname: "Gruzya Adventure Outfitters LLC", PaypointDbaname: "Gruzya Adventure Outfitters", ParentOrgId: 1232, ParentOrgName: "Pilgrim Planner", PaypointEntryname: "41035afaa7", - paylinkId: undefined, DocumentsRef: { zipfile: "documents_285.zip", filelist: [ @@ -556,20 +863,65 @@ describe("Bill", () => { }, ], }, - externalPaypointID: undefined, LotNumber: "LOT-285", - EntityID: undefined, }, }); }); - test("ListBills", async () => { + test("GetBill (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Bill/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.getBill(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Bill/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.getBill(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Bill/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.getBill(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Bill/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.getBill(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBills (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Summary: { - pageidentifier: undefined, pageSize: 20, total2approval: 1, totalactive: 1, @@ -702,7 +1054,6 @@ describe("Bill", () => { }); expect(response).toEqual({ Summary: { - pageidentifier: undefined, pageSize: 20, total2approval: 1, totalactive: 1, @@ -832,13 +1183,60 @@ describe("Bill", () => { }); }); - test("ListBillsOrg", async () => { + test("ListBills (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/entry").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBills("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBills (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/entry").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBills("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBills (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/entry").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBills("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBills (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/bills/entry").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBills("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBillsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Summary: { - pageidentifier: undefined, pageSize: 20, total2approval: 1, totalactive: 1, @@ -971,7 +1369,6 @@ describe("Bill", () => { }); expect(response).toEqual({ Summary: { - pageidentifier: undefined, pageSize: 20, total2approval: 1, totalactive: 1, @@ -1101,9 +1498,57 @@ describe("Bill", () => { }); }); - test("ModifyApprovalBill", async () => { + test("ListBillsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/org/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBillsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBillsOrg (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/org/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBillsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBillsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/bills/org/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBillsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBillsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/bills/org/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.bill.listBillsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ModifyApprovalBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = ["string"]; const rawResponseBody = { isSuccess: true, responseData: 6101, responseText: "Success" }; server @@ -1123,13 +1568,88 @@ describe("Bill", () => { }); }); - test("SendToApprovalBill", async () => { + test("ModifyApprovalBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.modifyApprovalBill(1, ["string", "string"]); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ModifyApprovalBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.modifyApprovalBill(1, ["string", "string"]); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ModifyApprovalBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.modifyApprovalBill(1, ["string", "string"]); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ModifyApprovalBill (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.modifyApprovalBill(1, ["string", "string"]); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SendToApprovalBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = ["string"]; const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -1151,7 +1671,6 @@ describe("Bill", () => { }); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -1159,9 +1678,93 @@ describe("Bill", () => { }); }); - test("SetApprovedBill", async () => { + test("SendToApprovalBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.sendToApprovalBill(1, { + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SendToApprovalBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.sendToApprovalBill(1, { + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SendToApprovalBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.sendToApprovalBill(1, { + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SendToApprovalBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Bill/approval/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.sendToApprovalBill(1, { + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SetApprovedBill (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseData: 6101, responseText: "Success" }; server @@ -1179,4 +1782,76 @@ describe("Bill", () => { responseText: "Success", }); }); + + test("SetApprovedBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/approval/1/approved") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.setApprovedBill(1, "approved"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SetApprovedBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/approval/1/approved") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.setApprovedBill(1, "approved"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SetApprovedBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Bill/approval/1/approved") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.setApprovedBill(1, "approved"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SetApprovedBill (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Bill/approval/1/approved") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.bill.setApprovedBill(1, "approved"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/boarding.test.ts b/tests/wire/boarding.test.ts index cbe4680c..1b581519 100644 --- a/tests/wire/boarding.test.ts +++ b/tests/wire/boarding.test.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; -import { PayabliClient } from "../../src/Client"; import * as Payabli from "../../src/api/index"; +import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Boarding", () => { - test("AddApplication", async () => { +describe("BoardingClient", () => { + test("AddApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { services: { ach: {}, @@ -152,44 +150,882 @@ describe("Boarding", () => { contactTitle: "Owner", }, ], - creditLimit: "creditLimit", - dbaName: "Sunshine Gutters", + creditLimit: "creditLimit", + dbaName: "Sunshine Gutters", + ein: "123456789", + faxnumber: "1234567890", + highticketamt: 1000, + legalName: "Sunshine Services, LLC", + license: "2222222FFG", + licstate: "CA", + maddress: "123 Walnut Street", + maddress1: "STE 900", + mcc: "7777", + mcity: "Johnson City", + mcountry: "US", + mstate: "TN", + mzip: "37615", + orgId: 123, + ownership: [ + { + oaddress: "33 North St", + ocity: "Any City", + ocountry: "US", + odriverstate: "CA", + ostate: "CA", + ownerdob: "01/01/1990", + ownerdriver: "CA6677778", + owneremail: "test@email.com", + ownername: "John Smith", + ownerpercent: 100, + ownerphone1: "555888111", + ownerphone2: "555888111", + ownerssn: "123456789", + ownertitle: "CEO", + ozip: "55555", + }, + ], + phonenumber: "1234567890", + processingRegion: "US", + recipientEmail: "josephray@example.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/1990", + taxFillName: "Sunshine LLC", + templateId: 22, + ticketamt: 1000, + website: "www.example.com", + whenCharged: "When Service Provided", + whenDelivered: "Over 30 Days", + whenProvided: "30 Days or Less", + whenRefunded: "30 Days or Less", + }); + expect(response).toEqual({ + isSuccess: true, + responseCode: 1, + responseData: 3625, + responseText: "Success", + }); + }); + + test("AddApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + annualRevenue: 750000, + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-456", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-789", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-100", + }, + ], + bcity: "Miami", + bcountry: "US", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", + ein: "123456789", + faxnumber: "3055550001", + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", + mcountry: "US", + mstate: "FL", + mzip: "33101", + orgId: 123, + ownership: [ + { + oaddress: "123 Palm Avenue", + ocity: "Miami", + ocountry: "US", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", + ownerpercent: 100, + ownerphone1: "3055550000", + ownerphone2: "3055550002", + ownerssn: "123456789", + ownertitle: "Owner", + ozip: "33102", + }, + ], + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", + templateId: 22, + website: "www.hermanscoatings.com", + }; + const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.boarding.addApplication({ + annualRevenue: 750000, + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-456", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-789", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-100", + }, + ], + bcity: "Miami", + bcountry: "US", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", + ein: "123456789", + faxnumber: "3055550001", + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", + mcountry: "US", + mstate: "FL", + mzip: "33101", + orgId: 123, + ownership: [ + { + oaddress: "123 Palm Avenue", + ocity: "Miami", + ocountry: "US", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", + ownerpercent: 100, + ownerphone1: "3055550000", + ownerphone2: "3055550002", + ownerssn: "123456789", + ownertitle: "Owner", + ozip: "33102", + }, + ], + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", + templateId: 22, + website: "www.hermanscoatings.com", + }); + expect(response).toEqual({ + isSuccess: true, + responseCode: 1, + responseData: 3625, + responseText: "Success", + }); + }); + + test("AddApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { + ach: { acceptCCD: true, acceptPPD: true, acceptWeb: true }, + card: { acceptAmex: true, acceptDiscover: true, acceptMastercard: true, acceptVisa: true }, + odp: { + allowAch: true, + allowChecks: true, + allowVCard: true, + processing_region: "US", + processor: "tsys", + issuerNetworkSettingsId: "12345678901234", + }, + }, + annualRevenue: 750000, + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-789", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-234", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-567", + }, + ], + bcity: "Miami", + bcountry: "US", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", + ein: "123456789", + faxnumber: "3055550001", + highticketamt: 15000, + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", + mcountry: "US", + mstate: "FL", + mzip: "33101", + orgId: 123, + ownership: [ + { + oaddress: "123 Palm Avenue", + ocity: "Miami", + ocountry: "US", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", + ownerpercent: 100, + ownerphone1: "3055550000", + ownerphone2: "3055550002", + ownerssn: "123456789", + ownertitle: "Owner", + ozip: "33102", + }, + ], + payoutAverageMonthlyVolume: 50000, + payoutAverageTicketAmount: 3500, + payoutCreditLimit: 25000, + payoutHighTicketAmount: 15000, + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", + templateId: 22, + website: "www.hermanscoatings.com", + }; + const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.boarding.addApplication({ + services: { + ach: { + acceptCCD: true, + acceptPPD: true, + acceptWeb: true, + }, + card: { + acceptAmex: true, + acceptDiscover: true, + acceptMastercard: true, + acceptVisa: true, + }, + odp: { + allowAch: true, + allowChecks: true, + allowVCard: true, + processing_region: "US", + processor: "tsys", + issuerNetworkSettingsId: "12345678901234", + }, + }, + annualRevenue: 750000, + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-789", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-234", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "333-567", + }, + ], + bcity: "Miami", + bcountry: "US", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", + ein: "123456789", + faxnumber: "3055550001", + highticketamt: 15000, + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", + mcountry: "US", + mstate: "FL", + mzip: "33101", + orgId: 123, + ownership: [ + { + oaddress: "123 Palm Avenue", + ocity: "Miami", + ocountry: "US", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", + ownerpercent: 100, + ownerphone1: "3055550000", + ownerphone2: "3055550002", + ownerssn: "123456789", + ownertitle: "Owner", + ozip: "33102", + }, + ], + payoutAverageMonthlyVolume: 50000, + payoutAverageTicketAmount: 3500, + payoutCreditLimit: 25000, + payoutHighTicketAmount: 15000, + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", + templateId: 22, + website: "www.hermanscoatings.com", + }); + expect(response).toEqual({ + isSuccess: true, + responseCode: 1, + responseData: 3625, + responseText: "Success", + }); + }); + + test("AddApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { + ach: { acceptCCD: true, acceptPPD: true, acceptWeb: true }, + card: { acceptAmex: true, acceptDiscover: true, acceptMastercard: true, acceptVisa: true }, + odp: { allowAch: false, allowChecks: false, allowVCard: false }, + }, + annualRevenue: 750000, + attachments: [{}, {}], + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 123, + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-789", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 456, + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-456", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 987, + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-100", + }, + ], + bcity: "Miami", + bcountry: "US", + boardingLinkId: "bl_123456", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", + ein: "123456789", + faxnumber: "3055550001", + highticketamt: 15000, + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", + mcountry: "US", + mstate: "FL", + mzip: "33101", + orgId: 123, + ownership: [ + { + oaddress: "123 Palm Avenue", + ocity: "Miami", + ocountry: "US", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", + ownerpercent: 100, + ownerphone1: "3055550000", + ownerphone2: "3055550002", + ownerssn: "123456789", + ownertitle: "Owner", + ozip: "33102", + }, + ], + payoutAverageMonthlyVolume: 50000, + payoutAverageTicketAmount: 500, + payoutCreditLimit: 25000, + payoutHighTicketAmount: 15000, + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", + recipientEmailNotification: true, + resumable: true, + signer: { + address: "33 North St", + address1: "STE 900", + city: "Bristol", + country: "US", + dob: "01/01/1976", + email: "test@email.com", + name: "John Smith", + phone: "555888111", + ssn: "123456789", + state: "TN", + zip: "55555", + pciAttestation: true, + signedDocumentReference: "https://example.com/signed-document.pdf", + attestationDate: "04/20/2025", + signDate: "04/20/2025", + additionalData: + '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', + }, + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", + templateId: 22, + website: "www.hermanscoatings.com", + }; + const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.boarding.addApplication({ + services: { + ach: { + acceptCCD: true, + acceptPPD: true, + acceptWeb: true, + }, + card: { + acceptAmex: true, + acceptDiscover: true, + acceptMastercard: true, + acceptVisa: true, + }, + odp: { + allowAch: false, + allowChecks: false, + allowVCard: false, + }, + }, + annualRevenue: 750000, + attachments: [{}, {}], + baddress: "789 Industrial Parkway", + baddress1: "Unit 12", + bankData: [ + { + accountNumber: "1XXXXXX3100", + bankAccountFunction: 1, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 123, + nickname: "Withdrawal Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-789", + }, + { + accountNumber: "1XXXXXX3200", + bankAccountFunction: 0, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 456, + nickname: "Deposit Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-456", + }, + { + accountNumber: "1XXXXXX3123", + bankAccountFunction: 3, + bankAccountHolderName: "Herman's Coatings LLC", + bankAccountHolderType: "Business", + bankName: "First Miami Bank", + id: 987, + nickname: "Remittance Account", + routingAccount: "123123123", + typeAccount: "Checking", + accountId: "123-100", + }, + ], + bcity: "Miami", + bcountry: "US", + boardingLinkId: "bl_123456", + bstate: "FL", + bsummary: "Commercial and industrial coating services, including protective and decorative coatings", + btype: "Limited Liability Company", + bzip: "33101", + contacts: [ + { + contactEmail: "herman@hermanscoatings.com", + contactName: "Herman Martinez", + contactPhone: "3055550000", + contactTitle: "Owner", + }, + ], + dbaname: "Herman's Coatings", ein: "123456789", - faxnumber: "1234567890", - highticketamt: 1000, - legalName: "Sunshine Services, LLC", - license: "2222222FFG", - licstate: "CA", - maddress: "123 Walnut Street", - maddress1: "STE 900", - mcc: "7777", - mcity: "Johnson City", + faxnumber: "3055550001", + highticketamt: 15000, + legalname: "Herman's Coatings LLC", + license: "FL123456", + licstate: "FL", + maddress: "789 Industrial Parkway", + maddress1: "Unit 12", + mcc: "1799", + mcity: "Miami", mcountry: "US", - mstate: "TN", - mzip: "37615", + mstate: "FL", + mzip: "33101", orgId: 123, ownership: [ { - oaddress: "33 North St", - ocity: "Any City", + oaddress: "123 Palm Avenue", + ocity: "Miami", ocountry: "US", - odriverstate: "CA", - ostate: "CA", - ownerdob: "01/01/1990", - ownerdriver: "CA6677778", - owneremail: "test@email.com", - ownername: "John Smith", + odriverstate: "FL", + ostate: "FL", + ownerdob: "05/15/1980", + ownerdriver: "FL789456", + owneremail: "herman@hermanscoatings.com", + ownername: "Herman Martinez", ownerpercent: 100, - ownerphone1: "555888111", - ownerphone2: "555888111", + ownerphone1: "3055550000", + ownerphone2: "3055550002", ownerssn: "123456789", - ownertitle: "CEO", - ozip: "55555", + ownertitle: "Owner", + ozip: "33102", }, ], - phonenumber: "1234567890", - processingRegion: "US", - recipientEmail: "josephray@example.com", + payoutAverageMonthlyVolume: 50000, + payoutAverageTicketAmount: 500, + payoutCreditLimit: 25000, + payoutHighTicketAmount: 15000, + phonenumber: "3055550000", + recipientEmail: "herman@hermanscoatings.com", recipientEmailNotification: true, resumable: true, signer: { @@ -211,15 +1047,10 @@ describe("Boarding", () => { additionalData: '{"deviceId":"499585-389fj484-3jcj8hj3","session":"fifji4-fiu443-fn4843","timeWithCompany":"6 Years"}', }, - startdate: "01/01/1990", - taxFillName: "Sunshine LLC", + startdate: "01/01/2015", + taxfillname: "Herman's Coatings LLC", templateId: 22, - ticketamt: 1000, - website: "www.example.com", - whenCharged: "When Service Provided", - whenDelivered: "Over 30 Days", - whenProvided: "30 Days or Less", - whenRefunded: "30 Days or Less", + website: "www.hermanscoatings.com", }); expect(response).toEqual({ isSuccess: true, @@ -229,9 +1060,177 @@ describe("Boarding", () => { }); }); - test("DeleteApplication", async () => { + test("AddApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { ach: {}, card: {} }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.addApplication({ + services: { + ach: {}, + card: {}, + }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddApplication (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { ach: {}, card: {} }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.addApplication({ + services: { + ach: {}, + card: {}, + }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddApplication (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { ach: {}, card: {} }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.addApplication({ + services: { + ach: {}, + card: {}, + }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddApplication (8)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + services: { ach: {}, card: {} }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Boarding/app") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.addApplication({ + services: { + ach: {}, + card: {}, + }, + bankData: {}, + phonenumber: "phonenumber", + processingRegion: "processingRegion", + signer: {}, + whenCharged: "When Service Provided", + whenDelivered: "0-7 Days", + whenProvided: "30 Days or Less", + whenRefunded: "Exchange Only", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; server @@ -251,9 +1250,57 @@ describe("Boarding", () => { }); }); - test("GetApplication", async () => { + test("DeleteApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Boarding/app/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.deleteApplication(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Boarding/app/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.deleteApplication(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Boarding/app/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.deleteApplication(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Boarding/app/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.deleteApplication(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { annualRevenue: 1000, @@ -413,7 +1460,6 @@ describe("Boarding", () => { contactName: "Herman Martinez", contactPhone: "3055550000", contactTitle: "Owner", - additionalData: undefined, }, ], createdAt: "2022-07-01T15:00:01Z", @@ -499,7 +1545,6 @@ describe("Boarding", () => { ownerssn: "123456789", ownertitle: "CEO", ozip: "55555", - additionalData: undefined, }, ], ownType: "Limited Liability Company", @@ -1009,7 +2054,6 @@ describe("Boarding", () => { contactName: "Herman Martinez", contactPhone: "3055550000", contactTitle: "Owner", - additionalData: undefined, }, ], createdAt: "2022-07-01T15:00:01Z", @@ -1110,7 +2154,6 @@ describe("Boarding", () => { ownerssn: "123456789", ownertitle: "CEO", ozip: "55555", - additionalData: undefined, }, ], ownType: "Limited Liability Company", @@ -1168,9 +2211,57 @@ describe("Boarding", () => { }); }); - test("GetApplicationByAuth", async () => { + test("GetApplication (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Boarding/read/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.getApplication(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Boarding/read/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.getApplication(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Boarding/read/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.getApplication(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Boarding/read/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.getApplication(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetApplicationByAuth (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { email: "admin@email.com", referenceId: "n6UCd1f1ygG7" }; const rawResponseBody = { annualRevenue: 1000, @@ -1483,9 +2574,85 @@ describe("Boarding", () => { }); }); - test("GetByIdLinkApplication", async () => { + test("GetApplicationByAuth (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/read/xId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getApplicationByAuth("xId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetApplicationByAuth (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/read/xId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getApplicationByAuth("xId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetApplicationByAuth (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Boarding/read/xId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getApplicationByAuth("xId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetApplicationByAuth (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Boarding/read/xId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getApplicationByAuth("xId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetByIdLinkApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { acceptOauth: false, @@ -1508,43 +2675,115 @@ describe("Boarding", () => { }; server .mockEndpoint() - .get("/Boarding/linkbyId/91") + .get("/Boarding/linkbyId/91") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.boarding.getByIdLinkApplication(91); + expect(response).toEqual({ + acceptOauth: false, + acceptRegister: false, + builderData: { + attributes: { + minimumDocuments: 1, + multipleContacts: true, + multipleOwners: true, + }, + }, + entryAttributes: "entryAttributes", + id: 1000000, + logo: { + fContent: "TXkgdGVzdCBmaWxlHJ==...", + filename: "my-doc.pdf", + ftype: "pdf", + furl: "https://mysite.com/my-doc.pdf", + }, + orgId: 123, + "pageIdentifier:": "null", + recipientEmailNotification: true, + referenceName: "payabli-00710", + referenceTemplateId: 1830, + resumable: false, + }); + }); + + test("GetByIdLinkApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyId/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByIdLinkApplication(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetByIdLinkApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyId/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByIdLinkApplication(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetByIdLinkApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyId/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByIdLinkApplication(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetByIdLinkApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Boarding/linkbyId/1") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.boarding.getByIdLinkApplication(91); - expect(response).toEqual({ - acceptOauth: false, - acceptRegister: false, - builderData: { - attributes: { - minimumDocuments: 1, - multipleContacts: true, - multipleOwners: true, - }, - }, - entryAttributes: "entryAttributes", - id: 1000000, - logo: { - fContent: "TXkgdGVzdCBmaWxlHJ==...", - filename: "my-doc.pdf", - ftype: "pdf", - furl: "https://mysite.com/my-doc.pdf", - }, - orgId: 123, - "pageIdentifier:": "null", - recipientEmailNotification: true, - referenceName: "payabli-00710", - referenceTemplateId: 1830, - resumable: false, - }); + await expect(async () => { + return await client.boarding.getByIdLinkApplication(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("GetByTemplateIdLinkApplication", async () => { + test("GetByTemplateIdLinkApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { acceptOauth: false, @@ -1601,9 +2840,81 @@ describe("Boarding", () => { }); }); - test("getExternalApplication", async () => { + test("GetByTemplateIdLinkApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyTemplate/1.1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByTemplateIdLinkApplication(1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetByTemplateIdLinkApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyTemplate/1.1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByTemplateIdLinkApplication(1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetByTemplateIdLinkApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/linkbyTemplate/1.1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByTemplateIdLinkApplication(1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetByTemplateIdLinkApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Boarding/linkbyTemplate/1.1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getByTemplateIdLinkApplication(1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getExternalApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -1634,9 +2945,81 @@ describe("Boarding", () => { }); }); - test("GetLinkApplication", async () => { + test("getExternalApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/applink/1/mail2") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getExternalApplication(1, "mail2"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getExternalApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/applink/1/mail2") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getExternalApplication(1, "mail2"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getExternalApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/applink/1/mail2") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getExternalApplication(1, "mail2"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getExternalApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Boarding/applink/1/mail2") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getExternalApplication(1, "mail2"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetLinkApplication (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { acceptOauth: false, @@ -1693,9 +3076,81 @@ describe("Boarding", () => { }); }); - test("ListApplications", async () => { + test("GetLinkApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/link/boardingLinkReference") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getLinkApplication("boardingLinkReference"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetLinkApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/link/boardingLinkReference") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getLinkApplication("boardingLinkReference"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetLinkApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Boarding/link/boardingLinkReference") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getLinkApplication("boardingLinkReference"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetLinkApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Boarding/link/boardingLinkReference") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.getLinkApplication("boardingLinkReference"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListApplications (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -1865,9 +3320,57 @@ describe("Boarding", () => { }); }); - test("ListBoardingLinks", async () => { + test("ListApplications (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/boarding/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.listApplications(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListApplications (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/boarding/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.listApplications(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListApplications (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/boarding/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.listApplications(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListApplications (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/boarding/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.boarding.listApplications(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBoardingLinks (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -1932,9 +3435,81 @@ describe("Boarding", () => { }); }); - test("UpdateApplication", async () => { + test("ListBoardingLinks (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/boardinglinks/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.listBoardingLinks(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBoardingLinks (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/boardinglinks/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.listBoardingLinks(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBoardingLinks (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/boardinglinks/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.listBoardingLinks(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBoardingLinks (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/boardinglinks/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.listBoardingLinks(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateApplication (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; server @@ -1954,4 +3529,80 @@ describe("Boarding", () => { responseText: "Success", }); }); + + test("UpdateApplication (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/app/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.updateApplication(1, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateApplication (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/app/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.updateApplication(1, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateApplication (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Boarding/app/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.updateApplication(1, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateApplication (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Boarding/app/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.boarding.updateApplication(1, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/chargeBacks.test.ts b/tests/wire/chargeBacks.test.ts index 08c8604b..15d546b5 100644 --- a/tests/wire/chargeBacks.test.ts +++ b/tests/wire/chargeBacks.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("ChargeBacks", () => { - test("AddResponse", async () => { +describe("ChargeBacksClient", () => { + test("AddResponse (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseData: 126, responseText: "Success" }; server @@ -31,9 +30,85 @@ describe("ChargeBacks", () => { }); }); - test("GetChargeback", async () => { + test("AddResponse (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/ChargeBacks/response/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.addResponse(1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddResponse (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/ChargeBacks/response/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.addResponse(1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddResponse (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/ChargeBacks/response/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.addResponse(1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddResponse (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/ChargeBacks/response/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.addResponse(1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetChargeback (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Id: 201, @@ -54,7 +129,6 @@ describe("ChargeBacks", () => { NetAmount: 3762.87, TransactionTime: "2024-01-15T09:30:00Z", Customer: { - AdditionalData: undefined, BillingAddress1: "1111 West 1st Street", BillingAddress2: "Suite 200", BillingCity: "Miami", @@ -265,8 +339,6 @@ describe("ChargeBacks", () => { TransAdditionalData: { key: "value" }, TransStatus: 1, }, - externalPaypointID: undefined, - pageidentifier: undefined, messages: [ { Id: 1, @@ -311,7 +383,6 @@ describe("ChargeBacks", () => { NetAmount: 3762.87, TransactionTime: "2024-01-15T09:30:00Z", Customer: { - AdditionalData: undefined, BillingAddress1: "1111 West 1st Street", BillingAddress2: "Suite 200", BillingCity: "Miami", @@ -543,8 +614,6 @@ describe("ChargeBacks", () => { }, TransStatus: 1, }, - externalPaypointID: undefined, - pageidentifier: undefined, messages: [ { Id: 1, @@ -564,4 +633,76 @@ describe("ChargeBacks", () => { ProcessorName: "Global Payments", }); }); + + test("GetChargeback (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ChargeBacks/read/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.getChargeback(1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetChargeback (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ChargeBacks/read/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.getChargeback(1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetChargeback (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/ChargeBacks/read/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.getChargeback(1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetChargeback (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/ChargeBacks/read/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.chargeBacks.getChargeback(1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/checkCapture.test.ts b/tests/wire/checkCapture.test.ts index ea62290e..d96437bd 100644 --- a/tests/wire/checkCapture.test.ts +++ b/tests/wire/checkCapture.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("CheckCapture", () => { - test("CheckProcessing", async () => { +describe("CheckCaptureClient", () => { + test("CheckProcessing (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entryPoint: "47abcfea12", frontImage: "/9j/4AAQSkZJRgABAQEASABIAAD...", @@ -37,7 +36,6 @@ describe("CheckCapture", () => { carLarMatchStatus: "MATCH", checkType: 1, referenceNumber: "REF_XYZ789", - pageIdentifier: undefined, }; server .mockEndpoint() @@ -76,7 +74,122 @@ describe("CheckCapture", () => { carLarMatchStatus: "MATCH", checkType: 1, referenceNumber: "REF_XYZ789", - pageIdentifier: undefined, }); }); + + test("CheckProcessing (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/CheckCapture/CheckProcessing") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.checkCapture.checkProcessing({ + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CheckProcessing (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/CheckCapture/CheckProcessing") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.checkCapture.checkProcessing({ + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CheckProcessing (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/CheckCapture/CheckProcessing") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.checkCapture.checkProcessing({ + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CheckProcessing (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/CheckCapture/CheckProcessing") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.checkCapture.checkProcessing({ + entryPoint: "entryPoint", + frontImage: "frontImage", + rearImage: "rearImage", + checkAmount: 1, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/cloud.test.ts b/tests/wire/cloud.test.ts index 6ee4860f..f7312331 100644 --- a/tests/wire/cloud.test.ts +++ b/tests/wire/cloud.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Cloud", () => { - test("addDevice", async () => { +describe("CloudClient", () => { + test("addDevice (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { registrationCode: "YS7DS5", description: "Front Desk POS" }; const rawResponseBody = { isSuccess: true, @@ -35,9 +34,85 @@ describe("Cloud", () => { }); }); - test("HistoryDevice", async () => { + test("addDevice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Cloud/register/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.addDevice("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("addDevice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Cloud/register/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.addDevice("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("addDevice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Cloud/register/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.addDevice("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("addDevice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Cloud/register/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.addDevice("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("HistoryDevice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -82,9 +157,81 @@ describe("Cloud", () => { }); }); - test("ListDevice", async () => { + test("HistoryDevice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Cloud/history/entry/deviceId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.historyDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("HistoryDevice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Cloud/history/entry/deviceId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.historyDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("HistoryDevice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Cloud/history/entry/deviceId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.historyDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("HistoryDevice (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Cloud/history/entry/deviceId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.historyDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListDevice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -129,9 +276,57 @@ describe("Cloud", () => { }); }); - test("RemoveDevice", async () => { + test("ListDevice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Cloud/list/entry").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.cloud.listDevice("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListDevice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Cloud/list/entry").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.cloud.listDevice("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListDevice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Cloud/list/entry").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.cloud.listDevice("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListDevice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Cloud/list/entry").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.cloud.listDevice("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("RemoveDevice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -153,4 +348,76 @@ describe("Cloud", () => { responseText: "Success", }); }); + + test("RemoveDevice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Cloud/register/entry/deviceId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.removeDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("RemoveDevice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Cloud/register/entry/deviceId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.removeDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("RemoveDevice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Cloud/register/entry/deviceId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.removeDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("RemoveDevice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/Cloud/register/entry/deviceId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.cloud.removeDevice("entry", "deviceId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/customer.test.ts b/tests/wire/customer.test.ts index e83868bf..81fde040 100644 --- a/tests/wire/customer.test.ts +++ b/tests/wire/customer.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Customer", () => { - test("AddCustomer", async () => { +describe("CustomerClient", () => { + test("AddCustomer (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerNumber: "12356ACB", firstname: "Irene", @@ -27,38 +26,23 @@ describe("Customer", () => { responseData: { customerId: 17264, customerNumber: "12356ACB", - customerUsername: undefined, customerStatus: 0, - Company: undefined, Firstname: "Irene", Lastname: "Canizales", - Phone: undefined, Email: "irene@canizalesconcrete.com", - Address: undefined, Address1: "123 Bishop's Trail", City: "Mountain City", State: "TN", Zip: "37612", Country: "US", - ShippingAddress: undefined, - ShippingAddress1: undefined, - ShippingCity: undefined, - ShippingState: undefined, - ShippingZip: undefined, - ShippingCountry: undefined, Balance: 0, TimeZone: -5, MFA: false, MFAMode: 0, - snProvider: undefined, - snIdentifier: undefined, - snData: undefined, LastUpdated: "2024-03-13T12:49:56Z", Created: "2024-03-13T12:49:56Z", AdditionalFields: { key: "value" }, IdentifierFields: ["email"], - Subscriptions: undefined, - StoredMethods: undefined, customerSummary: { numberofTransactions: 30, recentTransactions: [ @@ -81,8 +65,6 @@ describe("Customer", () => { ParentOrgId: 123, PaypointEntryname: "41035afaa7", pageidentifier: "null", - externalPaypointID: undefined, - customerConsent: undefined, }, responseText: "Success", }; @@ -115,40 +97,25 @@ describe("Customer", () => { responseData: { customerId: 17264, customerNumber: "12356ACB", - customerUsername: undefined, customerStatus: 0, - Company: undefined, Firstname: "Irene", Lastname: "Canizales", - Phone: undefined, Email: "irene@canizalesconcrete.com", - Address: undefined, Address1: "123 Bishop's Trail", City: "Mountain City", State: "TN", Zip: "37612", Country: "US", - ShippingAddress: undefined, - ShippingAddress1: undefined, - ShippingCity: undefined, - ShippingState: undefined, - ShippingZip: undefined, - ShippingCountry: undefined, Balance: 0, TimeZone: -5, MFA: false, MFAMode: 0, - snProvider: undefined, - snIdentifier: undefined, - snData: undefined, LastUpdated: "2024-03-13T12:49:56Z", Created: "2024-03-13T12:49:56Z", AdditionalFields: { key: "value", }, IdentifierFields: ["email"], - Subscriptions: undefined, - StoredMethods: undefined, customerSummary: { numberofTransactions: 30, recentTransactions: [ @@ -171,16 +138,98 @@ describe("Customer", () => { ParentOrgId: 123, PaypointEntryname: "41035afaa7", pageidentifier: "null", - externalPaypointID: undefined, - customerConsent: undefined, }, responseText: "Success", }); }); - test("DeleteCustomer", async () => { + test("AddCustomer (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.addCustomer("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddCustomer (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.addCustomer("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddCustomer (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.addCustomer("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddCustomer (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Customer/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.addCustomer("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteCustomer (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, @@ -203,9 +252,57 @@ describe("Customer", () => { }); }); - test("GetCustomer", async () => { + test("DeleteCustomer (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Customer/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.deleteCustomer(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteCustomer (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Customer/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.deleteCustomer(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteCustomer (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Customer/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.deleteCustomer(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteCustomer (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Customer/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.deleteCustomer(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetCustomer (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { customerId: 4440, @@ -464,9 +561,57 @@ describe("Customer", () => { }); }); - test("LinkCustomerTransaction", async () => { + test("GetCustomer (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Customer/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.getCustomer(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetCustomer (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Customer/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.getCustomer(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetCustomer (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Customer/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.getCustomer(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetCustomer (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Customer/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.customer.getCustomer(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("LinkCustomerTransaction (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, @@ -495,9 +640,81 @@ describe("Customer", () => { }); }); - test("RequestConsent", async () => { + test("LinkCustomerTransaction (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Customer/link/1/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.linkCustomerTransaction(1, "transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("LinkCustomerTransaction (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Customer/link/1/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.linkCustomerTransaction(1, "transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("LinkCustomerTransaction (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Customer/link/1/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.linkCustomerTransaction(1, "transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("LinkCustomerTransaction (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Customer/link/1/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.linkCustomerTransaction(1, "transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("RequestConsent (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -524,9 +741,81 @@ describe("Customer", () => { }); }); - test("UpdateCustomer", async () => { + test("RequestConsent (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/1/consent") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.requestConsent(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("RequestConsent (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/1/consent") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.requestConsent(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("RequestConsent (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Customer/1/consent") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.requestConsent(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("RequestConsent (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Customer/1/consent") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.requestConsent(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateCustomer (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { firstname: "Irene", lastname: "Canizales", @@ -562,4 +851,80 @@ describe("Customer", () => { responseText: "Success", }); }); + + test("UpdateCustomer (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Customer/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.updateCustomer(1, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateCustomer (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Customer/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.updateCustomer(1, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateCustomer (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Customer/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.updateCustomer(1, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateCustomer (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Customer/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.customer.updateCustomer(1, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/export.test.ts b/tests/wire/export.test.ts index be8830eb..42229729 100644 --- a/tests/wire/export.test.ts +++ b/tests/wire/export.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Export", () => { - test("ExportApplications", async () => { +describe("ExportClient", () => { + test("ExportApplications (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server @@ -29,112 +28,92 @@ describe("Export", () => { }); }); - test("ExportBatchDetails", async () => { + test("ExportApplications (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/batchDetails/csv/8cfec329267") + .get("/Export/boarding/csv/1") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatchDetails("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportApplications("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportBatchDetailsOrg", async () => { + test("ExportApplications (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/batchDetails/csv/org/123") + .get("/Export/boarding/csv/1") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatchDetailsOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportApplications("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportBatches", async () => { + test("ExportApplications (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/batches/csv/8cfec329267") + .get("/Export/boarding/csv/1") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatches("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportApplications("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); }); - test("ExportBatchesOrg", async () => { + test("ExportApplications (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { key: "value" }; + const rawResponseBody = { responseText: "responseText" }; server .mockEndpoint() - .get("/Export/batches/csv/org/123") + .get("/Export/boarding/csv/1") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatchesOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportApplications("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("ExportBatchesOut", async () => { + test("ExportBatchDetails (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/batchesOut/csv/8cfec329267") + .get("/Export/batchDetails/csv/8cfec329267") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatchesOut("csv", "8cfec329267", { + const response = await client.export.exportBatchDetails("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, @@ -144,112 +123,92 @@ describe("Export", () => { }); }); - test("ExportBatchesOutOrg", async () => { + test("ExportBatchDetails (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/batchesOut/csv/org/123") + .get("/Export/batchDetails/csv/entry") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBatchesOutOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetails("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportBills", async () => { + test("ExportBatchDetails (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/bills/csv/8cfec329267") + .get("/Export/batchDetails/csv/entry") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBills("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetails("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportBillsOrg", async () => { + test("ExportBatchDetails (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/bills/csv/org/123") + .get("/Export/batchDetails/csv/entry") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportBillsOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetails("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); }); - test("ExportChargebacks", async () => { + test("ExportBatchDetails (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { key: "value" }; + const rawResponseBody = { responseText: "responseText" }; server .mockEndpoint() - .get("/Export/chargebacks/csv/8cfec329267") + .get("/Export/batchDetails/csv/entry") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportChargebacks("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetails("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("ExportChargebacksOrg", async () => { + test("ExportBatchDetailsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/chargebacks/csv/org/123") + .get("/Export/batchDetails/csv/org/123") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportChargebacksOrg("csv", 123, { + const response = await client.export.exportBatchDetailsOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, @@ -259,112 +218,92 @@ describe("Export", () => { }); }); - test("ExportCustomers", async () => { + test("ExportBatchDetailsOrg (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/customers/csv/8cfec329267") + .get("/Export/batchDetails/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportCustomers("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetailsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportCustomersOrg", async () => { + test("ExportBatchDetailsOrg (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/customers/csv/org/123") + .get("/Export/batchDetails/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportCustomersOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetailsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportInvoices", async () => { + test("ExportBatchDetailsOrg (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/invoices/csv/8cfec329267") + .get("/Export/batchDetails/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportInvoices("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetailsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); }); - test("ExportInvoicesOrg", async () => { + test("ExportBatchDetailsOrg (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { key: "value" }; + const rawResponseBody = { responseText: "responseText" }; server .mockEndpoint() - .get("/Export/invoices/csv/org/123") + .get("/Export/batchDetails/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportInvoicesOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchDetailsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("ExportOrganizations", async () => { + test("ExportBatches (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/organizations/csv/org/123") + .get("/Export/batches/csv/8cfec329267") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportOrganizations("csv", 123, { + const response = await client.export.exportBatches("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, @@ -374,112 +313,92 @@ describe("Export", () => { }); }); - test("ExportPayout", async () => { + test("ExportBatches (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/payouts/csv/8cfec329267") + .get("/Export/batches/csv/entry") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportPayout("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatches("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportPayoutOrg", async () => { + test("ExportBatches (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/payouts/csv/org/123") + .get("/Export/batches/csv/entry") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportPayoutOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatches("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportPaypoints", async () => { + test("ExportBatches (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/paypoints/csv/123") + .get("/Export/batches/csv/entry") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportPaypoints("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatches("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); }); - test("ExportSettlements", async () => { + test("ExportBatches (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { key: "value" }; + const rawResponseBody = { responseText: "responseText" }; server .mockEndpoint() - .get("/Export/settlements/csv/8cfec329267") + .get("/Export/batches/csv/entry") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportSettlements("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatches("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("ExportSettlementsOrg", async () => { + test("ExportBatchesOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/settlements/csv/org/123") + .get("/Export/batches/csv/org/123") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportSettlementsOrg("csv", 123, { + const response = await client.export.exportBatchesOrg("csv", 123, { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, @@ -489,189 +408,2357 @@ describe("Export", () => { }); }); - test("ExportSubscriptions", async () => { + test("ExportBatchesOrg (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/subscriptions/csv/8cfec329267") + .get("/Export/batches/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportSubscriptions("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportSubscriptionsOrg", async () => { + test("ExportBatchesOrg (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/subscriptions/csv/org/123") + .get("/Export/batches/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportSubscriptionsOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportTransactions", async () => { + test("ExportBatchesOrg (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/transactions/csv/8cfec329267") + .get("/Export/batches/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportTransactions("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); }); - test("ExportTransactionsOrg", async () => { + test("ExportBatchesOrg (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { key: "value" }; + const rawResponseBody = { responseText: "responseText" }; server .mockEndpoint() - .get("/Export/transactions/csv/org/123") + .get("/Export/batches/csv/org/1") .respondWith() - .statusCode(200) + .statusCode(503) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportTransactionsOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); }); - test("ExportTransferDetails", async () => { + test("ExportBatchesOut (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/transferDetails/csv/8cfec329267/1000000") + .get("/Export/batchesOut/csv/8cfec329267") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, { + const response = await client.export.exportBatchesOut("csv", "8cfec329267", { columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", fromRecord: 251, limitRecord: 1000, - sortBy: "desc(field_name)", }); expect(response).toEqual({ key: "value", }); }); - test("ExportTransfers", async () => { + test("ExportBatchesOut (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/transfers/8cfec329267") + .get("/Export/batchesOut/csv/entry") .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportTransfers("8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - sortBy: "desc(field_name)", - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOut("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); }); - test("ExportVendors", async () => { + test("ExportBatchesOut (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/vendors/csv/8cfec329267") + .get("/Export/batchesOut/csv/entry") .respondWith() - .statusCode(200) + .statusCode(401) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportVendors("csv", "8cfec329267", { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", - }); + await expect(async () => { + return await client.export.exportBatchesOut("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); }); - test("ExportVendorsOrg", async () => { + test("ExportBatchesOut (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server .mockEndpoint() - .get("/Export/vendors/csv/org/123") + .get("/Export/batchesOut/csv/entry") .respondWith() - .statusCode(200) + .statusCode(500) .jsonBody(rawResponseBody) .build(); - const response = await client.export.exportVendorsOrg("csv", 123, { - columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", - fromRecord: 251, - limitRecord: 1000, - }); - expect(response).toEqual({ - key: "value", + await expect(async () => { + return await client.export.exportBatchesOut("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportBatchesOut (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBatchesOut("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportBatchesOutOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportBatchesOutOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportBatchesOutOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBatchesOutOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportBatchesOutOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBatchesOutOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportBatchesOutOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBatchesOutOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportBatchesOutOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/batchesOut/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBatchesOutOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportBills (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportBills("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportBills (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBills("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportBills (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBills("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportBills (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBills("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportBills (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/bills/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBills("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportBillsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportBillsOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportBillsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBillsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportBillsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBillsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportBillsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/bills/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBillsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportBillsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/bills/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportBillsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportChargebacks (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportChargebacks("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportChargebacks (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacks("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportChargebacks (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacks("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportChargebacks (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacks("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportChargebacks (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacks("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportChargebacksOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportChargebacksOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportChargebacksOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacksOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportChargebacksOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacksOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportChargebacksOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacksOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportChargebacksOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/chargebacks/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportChargebacksOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportCustomers (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportCustomers("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportCustomers (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomers("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportCustomers (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomers("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportCustomers (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomers("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportCustomers (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/customers/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomers("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportCustomersOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportCustomersOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportCustomersOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomersOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportCustomersOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomersOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportCustomersOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/customers/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomersOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportCustomersOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/customers/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportCustomersOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportInvoices (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportInvoices("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportInvoices (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoices("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportInvoices (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoices("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportInvoices (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoices("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportInvoices (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoices("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportInvoicesOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportInvoicesOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportInvoicesOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoicesOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportInvoicesOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoicesOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportInvoicesOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoicesOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportInvoicesOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/invoices/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportInvoicesOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportOrganizations (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/organizations/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportOrganizations("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportOrganizations (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/organizations/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportOrganizations("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportOrganizations (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/organizations/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportOrganizations("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportOrganizations (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/organizations/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportOrganizations("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportOrganizations (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/organizations/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportOrganizations("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportPayout (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportPayout("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportPayout (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayout("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportPayout (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayout("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportPayout (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayout("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportPayout (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayout("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportPayoutOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportPayoutOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportPayoutOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayoutOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportPayoutOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayoutOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportPayoutOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayoutOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportPayoutOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/payouts/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPayoutOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportPaypoints (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/paypoints/csv/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportPaypoints("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportPaypoints (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/paypoints/csv/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPaypoints("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportPaypoints (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/paypoints/csv/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPaypoints("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportPaypoints (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/paypoints/csv/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPaypoints("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportPaypoints (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/paypoints/csv/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportPaypoints("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportSettlements (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportSettlements("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportSettlements (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlements("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportSettlements (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlements("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportSettlements (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlements("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportSettlements (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlements("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportSettlementsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportSettlementsOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportSettlementsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlementsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportSettlementsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlementsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportSettlementsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlementsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportSettlementsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/settlements/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSettlementsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportSubscriptions (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportSubscriptions("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportSubscriptions (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptions("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportSubscriptions (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptions("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportSubscriptions (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptions("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportSubscriptions (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptions("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportSubscriptionsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportSubscriptionsOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportSubscriptionsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptionsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportSubscriptionsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptionsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportSubscriptionsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptionsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportSubscriptionsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/subscriptions/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportSubscriptionsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportTransactions (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportTransactions("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportTransactions (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactions("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportTransactions (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactions("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportTransactions (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactions("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportTransactions (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactions("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportTransactionsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportTransactionsOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportTransactionsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactionsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportTransactionsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactionsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportTransactionsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactionsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportTransactionsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/transactions/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransactionsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportTransferDetails (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transferDetails/csv/8cfec329267/1000000") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportTransferDetails("csv", "8cfec329267", 1000000, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + sortBy: "desc(field_name)", + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportTransferDetails (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transferDetails/csv/entry/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransferDetails("csv", "entry", 1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportTransferDetails (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transferDetails/csv/entry/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransferDetails("csv", "entry", 1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportTransferDetails (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transferDetails/csv/entry/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransferDetails("csv", "entry", 1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportTransferDetails (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/transferDetails/csv/entry/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransferDetails("csv", "entry", 1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportTransfers (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transfers/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportTransfers("8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + sortBy: "desc(field_name)", + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportTransfers (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transfers/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransfers("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportTransfers (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transfers/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransfers("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportTransfers (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/transfers/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransfers("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportTransfers (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/transfers/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportTransfers("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportVendors (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/8cfec329267") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportVendors("csv", "8cfec329267", { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", + }); + }); + + test("ExportVendors (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendors("csv", "entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportVendors (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendors("csv", "entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportVendors (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendors("csv", "entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportVendors (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendors("csv", "entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ExportVendorsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/org/123") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.export.exportVendorsOrg("csv", 123, { + columnsExport: "BatchDate:Batch_Date,PaypointName:Legal_name", + fromRecord: 251, + limitRecord: 1000, + }); + expect(response).toEqual({ + key: "value", }); }); + + test("ExportVendorsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendorsOrg("csv", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ExportVendorsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendorsOrg("csv", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ExportVendorsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendorsOrg("csv", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ExportVendorsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/vendors/csv/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.export.exportVendorsOrg("csv", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/hostedPaymentPages.test.ts b/tests/wire/hostedPaymentPages.test.ts index ac0afd14..7bafdb3f 100644 --- a/tests/wire/hostedPaymentPages.test.ts +++ b/tests/wire/hostedPaymentPages.test.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; -import { PayabliClient } from "../../src/Client"; import * as Payabli from "../../src/api/index"; +import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("HostedPaymentPages", () => { - test("loadPage", async () => { +describe("HostedPaymentPagesClient", () => { + test("loadPage (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { AdditionalData: { key1: { key: "value" }, key2: { key: "value" }, key3: { key: "value" } }, @@ -300,9 +298,81 @@ describe("HostedPaymentPages", () => { }); }); - test("newPage", async () => { + test("loadPage (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/load/entry/subdomain") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.loadPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("loadPage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/load/entry/subdomain") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.loadPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("loadPage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/load/entry/subdomain") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.loadPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("loadPage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Paypoint/load/entry/subdomain") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.loadPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("newPage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, @@ -334,9 +404,93 @@ describe("HostedPaymentPages", () => { }); }); - test("savePage", async () => { + test("newPage (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.newPage("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("newPage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.newPage("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("newPage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.newPage("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("newPage (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Paypoint/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.newPage("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("savePage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: "string", responseText: "Updated" }; server @@ -356,4 +510,80 @@ describe("HostedPaymentPages", () => { responseText: "Updated", }); }); + + test("savePage (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/entry/subdomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.savePage("entry", "subdomain", {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("savePage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/entry/subdomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.savePage("entry", "subdomain", {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("savePage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/entry/subdomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.savePage("entry", "subdomain", {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("savePage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Paypoint/entry/subdomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.hostedPaymentPages.savePage("entry", "subdomain", {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/invoice.test.ts b/tests/wire/invoice.test.ts index 0e5f179f..570859a3 100644 --- a/tests/wire/invoice.test.ts +++ b/tests/wire/invoice.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Invoice", () => { - test("AddInvoice", async () => { +describe("InvoiceClient", () => { + test("AddInvoice (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { firstName: "Tamara", lastName: "Bagratoni", customerNumber: "3" }, invoiceData: { @@ -96,9 +95,93 @@ describe("Invoice", () => { }); }); - test("deleteAttachedFromInvoice", async () => { + test("AddInvoice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Invoice/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.addInvoice("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Invoice/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.addInvoice("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Invoice/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.addInvoice("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Invoice/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.addInvoice("entry", { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("deleteAttachedFromInvoice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -127,9 +210,81 @@ describe("Invoice", () => { }); }); - test("DeleteInvoice", async () => { + test("deleteAttachedFromInvoice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.deleteAttachedFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("deleteAttachedFromInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.deleteAttachedFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("deleteAttachedFromInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.deleteAttachedFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("deleteAttachedFromInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.deleteAttachedFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteInvoice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -158,9 +313,57 @@ describe("Invoice", () => { }); }); - test("EditInvoice", async () => { + test("DeleteInvoice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Invoice/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.deleteInvoice(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteInvoice (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Invoice/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.deleteInvoice(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Invoice/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.deleteInvoice(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Invoice/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.deleteInvoice(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditInvoice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { invoiceData: { items: [ @@ -220,9 +423,93 @@ describe("Invoice", () => { }); }); - test("GetAttachedFileFromInvoice", async () => { + test("EditInvoice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Invoice/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.editInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Invoice/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.editInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditInvoice (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Invoice/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.editInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Invoice/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.editInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetAttachedFileFromInvoice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { fContent: "fContent", filename: "filename", ftype: "pdf", furl: "furl" }; server @@ -242,12 +529,83 @@ describe("Invoice", () => { }); }); - test("GetInvoice", async () => { + test("GetAttachedFileFromInvoice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getAttachedFileFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetAttachedFileFromInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getAttachedFileFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetAttachedFileFromInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getAttachedFileFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetAttachedFileFromInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Invoice/attachedFileFromInvoice/1/filename") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getAttachedFileFromInvoice(1, "filename"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetInvoice (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - AdditionalData: undefined, billEvents: [ { description: "TransferCreated", @@ -344,7 +702,6 @@ describe("Invoice", () => { const response = await client.invoice.getInvoice(23548884); expect(response).toEqual({ - AdditionalData: undefined, billEvents: [ { description: "TransferCreated", @@ -447,9 +804,57 @@ describe("Invoice", () => { }); }); - test("GetInvoiceNumber", async () => { + test("GetInvoice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.getInvoice(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.getInvoice(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.getInvoice(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Invoice/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.getInvoice(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetInvoiceNumber (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseData: "MyInvoice-114434565s32440", responseText: "Success" }; server @@ -468,9 +873,81 @@ describe("Invoice", () => { }); }); - test("ListInvoices", async () => { + test("GetInvoiceNumber (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/getNumber/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoiceNumber("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetInvoiceNumber (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/getNumber/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoiceNumber("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetInvoiceNumber (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Invoice/getNumber/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoiceNumber("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetInvoiceNumber (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Invoice/getNumber/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoiceNumber("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListInvoices (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -481,7 +958,6 @@ describe("Invoice", () => { invoiceNumber: "QA-1709680125", invoiceDate: "2025-03-05", invoiceDueDate: "2025-03-05", - lastPaymentDate: undefined, createdAt: "2024-03-05T18:08:45Z", invoiceStatus: 1, invoiceType: 0, @@ -566,7 +1042,6 @@ describe("Invoice", () => { invoiceNumber: "QA-1709680125", invoiceDate: "2025-03-05", invoiceDueDate: "2025-03-05", - lastPaymentDate: undefined, createdAt: "2024-03-05T18:08:45Z", invoiceStatus: 1, invoiceType: 0, @@ -648,9 +1123,81 @@ describe("Invoice", () => { }); }); - test("ListInvoicesOrg", async () => { + test("ListInvoices (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoices("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListInvoices (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoices("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListInvoices (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoices("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListInvoices (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/invoices/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoices("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListInvoicesOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -812,9 +1359,81 @@ describe("Invoice", () => { }); }); - test("SendInvoice", async () => { + test("ListInvoicesOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoicesOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListInvoicesOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoicesOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListInvoicesOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/invoices/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoicesOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListInvoicesOrg (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/invoices/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.listInvoicesOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SendInvoice (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -835,9 +1454,57 @@ describe("Invoice", () => { }); }); - test("GetInvoicePDF", async () => { + test("SendInvoice (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/send/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.sendInvoice(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SendInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/send/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.sendInvoice(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SendInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Invoice/send/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.sendInvoice(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SendInvoice (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Invoice/send/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.invoice.sendInvoice(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetInvoicePDF (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server @@ -853,4 +1520,76 @@ describe("Invoice", () => { key: "value", }); }); + + test("GetInvoicePDF (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoicePdf/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoicePdf(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetInvoicePDF (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoicePdf/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoicePdf(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetInvoicePDF (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/invoicePdf/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoicePdf(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetInvoicePDF (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/invoicePdf/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.invoice.getInvoicePdf(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/lineItem.test.ts b/tests/wire/lineItem.test.ts index ca4d8c4b..38d221f8 100644 --- a/tests/wire/lineItem.test.ts +++ b/tests/wire/lineItem.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("LineItem", () => { - test("AddItem", async () => { +describe("LineItemClient", () => { + test("AddItem (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { itemProductCode: "M-DEPOSIT", itemProductName: "Materials deposit", @@ -48,9 +47,105 @@ describe("LineItem", () => { }); }); - test("DeleteItem", async () => { + test("AddItem (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/LineItem/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.addItem("entry", { + body: { + itemCost: 1.1, + itemQty: 1, + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddItem (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/LineItem/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.addItem("entry", { + body: { + itemCost: 1.1, + itemQty: 1, + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddItem (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/LineItem/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.addItem("entry", { + body: { + itemCost: 1.1, + itemQty: 1, + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddItem (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/LineItem/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.addItem("entry", { + body: { + itemCost: 1.1, + itemQty: 1, + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteItem (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseText: "Success" }; server.mockEndpoint().delete("/LineItem/700").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -62,9 +157,57 @@ describe("LineItem", () => { }); }); - test("GetItem", async () => { + test("DeleteItem (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/LineItem/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.deleteItem(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteItem (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/LineItem/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.deleteItem(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteItem (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/LineItem/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.deleteItem(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteItem (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/LineItem/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.deleteItem(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetItem (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { createdAt: "2022-07-01T15:00:01Z", @@ -109,9 +252,57 @@ describe("LineItem", () => { }); }); - test("ListLineItems", async () => { + test("GetItem (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/LineItem/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.getItem(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetItem (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/LineItem/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.getItem(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetItem (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/LineItem/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.getItem(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetItem (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/LineItem/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.lineItem.getItem(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListLineItems (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -170,9 +361,81 @@ describe("LineItem", () => { }); }); - test("UpdateItem", async () => { + test("ListLineItems (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/lineitems/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.listLineItems("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListLineItems (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/lineitems/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.listLineItems("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListLineItems (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/lineitems/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.listLineItems("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListLineItems (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/lineitems/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.listLineItems("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateItem (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { itemCost: 12.45, itemQty: 1 }; const rawResponseBody = { isSuccess: true, responseData: 700, responseText: "Success" }; server @@ -194,4 +457,92 @@ describe("LineItem", () => { responseText: "Success", }); }); + + test("UpdateItem (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/LineItem/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.updateItem(1, { + itemCost: 1.1, + itemQty: 1, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateItem (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/LineItem/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.updateItem(1, { + itemCost: 1.1, + itemQty: 1, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateItem (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/LineItem/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.updateItem(1, { + itemCost: 1.1, + itemQty: 1, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateItem (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { itemCost: 1.1, itemQty: 1 }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/LineItem/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.lineItem.updateItem(1, { + itemCost: 1.1, + itemQty: 1, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/moneyIn.test.ts b/tests/wire/moneyIn.test.ts index 8f7d3b2e..fd6b1e8b 100644 --- a/tests/wire/moneyIn.test.ts +++ b/tests/wire/moneyIn.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("MoneyIn", () => { - test("Authorize", async () => { +describe("MoneyInClient", () => { + test("Authorize (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", @@ -27,7 +26,6 @@ describe("MoneyIn", () => { const rawResponseBody = { responseText: "Success", isSuccess: true, - pageIdentifier: undefined, responseData: { authCode: "123456", referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", @@ -36,7 +34,6 @@ describe("MoneyIn", () => { avsResponseText: "No address or ZIP match only", cvvResponseText: "CVV2/CVC2 no match", customerId: 4440, - methodReferenceId: undefined, }, }; server @@ -73,7 +70,6 @@ describe("MoneyIn", () => { expect(response).toEqual({ responseText: "Success", isSuccess: true, - pageIdentifier: undefined, responseData: { authCode: "123456", referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", @@ -82,14 +78,145 @@ describe("MoneyIn", () => { avsResponseText: "No address or ZIP match only", cvvResponseText: "CVV2/CVC2 no match", customerId: 4440, - methodReferenceId: undefined, }, }); }); - test("Capture", async () => { + test("Authorize (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.authorize({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Authorize (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.authorize({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Authorize (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.authorize({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Authorize (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.authorize({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Capture (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, @@ -136,9 +263,81 @@ describe("MoneyIn", () => { }); }); - test("CaptureAuth", async () => { + test("Capture (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/capture/transId/1.1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.capture("transId", 1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Capture (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/capture/transId/1.1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.capture("transId", 1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Capture (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/capture/transId/1.1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.capture("transId", 1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Capture (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/capture/transId/1.1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.capture("transId", 1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CaptureAuth (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { paymentDetails: { totalAmount: 105, serviceFee: 5 } }; const rawResponseBody = { responseCode: 1, @@ -191,9 +390,210 @@ describe("MoneyIn", () => { }); }); - test("Credit", async () => { + test("CaptureAuth (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 89, serviceFee: 4 } }; + const rawResponseBody = { + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "123456", + referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", + resultCode: 1, + resultText: "SUCCESS", + avsResponseText: null, + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", { + paymentDetails: { + totalAmount: 89, + serviceFee: 4, + }, + }); + expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "123456", + referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", + resultCode: 1, + resultText: "SUCCESS", + avsResponseText: null, + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("CaptureAuth (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 100 } }; + const rawResponseBody = { + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "123456", + referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", + resultCode: 1, + resultText: "SUCCESS", + avsResponseText: null, + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.captureAuth("10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", { + paymentDetails: { + totalAmount: 100, + }, + }); + expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "123456", + referenceId: "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13", + resultCode: 1, + resultText: "SUCCESS", + avsResponseText: null, + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("CaptureAuth (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 1.1 } }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/capture/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.captureAuth("transId", { + paymentDetails: { + totalAmount: 1.1, + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CaptureAuth (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 1.1 } }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/capture/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.captureAuth("transId", { + paymentDetails: { + totalAmount: 1.1, + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CaptureAuth (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 1.1 } }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/capture/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.captureAuth("transId", { + paymentDetails: { + totalAmount: 1.1, + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CaptureAuth (7)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { paymentDetails: { totalAmount: 1.1 } }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/capture/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.captureAuth("transId", { + paymentDetails: { + totalAmount: 1.1, + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Credit (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { billingAddress1: "5127 Linkwood ave", customerNumber: "100" }, entrypoint: "my-entrypoint", @@ -212,7 +612,6 @@ describe("MoneyIn", () => { responseData: { AuthCode: "AuthCode", CustomerId: 4440, - methodReferenceId: undefined, ReferenceId: "45-erre-324", ResultCode: 1, ResultText: "Approved", @@ -254,7 +653,6 @@ describe("MoneyIn", () => { responseData: { AuthCode: "AuthCode", CustomerId: 4440, - methodReferenceId: undefined, ReferenceId: "45-erre-324", ResultCode: 1, ResultText: "Approved", @@ -263,13 +661,220 @@ describe("MoneyIn", () => { }); }); - test("Details", async () => { + test("Credit (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - - const rawResponseBody = { - BatchAmount: 10050.75, - BatchNumber: "BN987654321", + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { + billingAddress1: "125 Main Street", + billingCity: "Kingsport", + billingEmail: "johnnyp@email.com", + company: "Acme, Inc", + customerNumber: "100", + firstName: "Johnny", + lastName: "Poulsbo", + }, + entrypoint: "my-entrypoint", + paymentDetails: { serviceFee: 0, totalAmount: 1 }, + paymentMethod: { + achAccount: "88354554", + achAccountType: "Checking", + achHolder: "John Poulsbo", + achRouting: "029000021", + method: "ach", + }, + }; + const rawResponseBody = { + isSuccess: true, + pageIdentifier: "null", + responseData: { + AuthCode: "AuthCode", + CustomerId: 4440, + ReferenceId: "45-erre-324", + ResultCode: 1, + ResultText: "Approved", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .post("/MoneyIn/makecredit") + .header("idempotencyKey", "6B29FC40-CA47-1067-B31D-00DD010662DA") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.credit({ + idempotencyKey: "6B29FC40-CA47-1067-B31D-00DD010662DA", + customerData: { + billingAddress1: "125 Main Street", + billingCity: "Kingsport", + billingEmail: "johnnyp@email.com", + company: "Acme, Inc", + customerNumber: "100", + firstName: "Johnny", + lastName: "Poulsbo", + }, + entrypoint: "my-entrypoint", + paymentDetails: { + serviceFee: 0, + totalAmount: 1, + }, + paymentMethod: { + achAccount: "88354554", + achAccountType: "Checking", + achHolder: "John Poulsbo", + achRouting: "029000021", + method: "ach", + }, + }); + expect(response).toEqual({ + isSuccess: true, + pageIdentifier: "null", + responseData: { + AuthCode: "AuthCode", + CustomerId: 4440, + ReferenceId: "45-erre-324", + ResultCode: 1, + ResultText: "Approved", + }, + responseText: "Success", + }); + }); + + test("Credit (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: {}, + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { method: "ach" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/makecredit") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.credit({ + customerData: {}, + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + method: "ach", + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Credit (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: {}, + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { method: "ach" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/makecredit") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.credit({ + customerData: {}, + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + method: "ach", + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Credit (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: {}, + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { method: "ach" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/makecredit") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.credit({ + customerData: {}, + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + method: "ach", + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Credit (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: {}, + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { method: "ach" }, + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/makecredit") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.credit({ + customerData: {}, + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + method: "ach", + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Details (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + BatchAmount: 10050.75, + BatchNumber: "BN987654321", CfeeTransactions: [ { cFeeTransid: "cFeeTransid", @@ -675,9 +1280,81 @@ describe("MoneyIn", () => { }); }); - test("getpaid", async () => { + test("Details (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/details/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.details("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Details (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/details/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.details("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Details (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/details/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.details("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Details (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/details/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.details("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getpaid (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", @@ -696,7 +1373,6 @@ describe("MoneyIn", () => { const rawResponseBody = { responseText: "Success", isSuccess: true, - pageIdentifier: undefined, responseData: { authCode: "VTLMC1", referenceId: "575-c490247af7ed403d86ba583507be61b0", @@ -706,7 +1382,6 @@ describe("MoneyIn", () => { cvvResponseText: "Not processed. Indicates that the expiration date was not provided with the request, or that the card does not have a valid CVV2 code. If the expiration date was not included with the request, resubmit the request with the expiration date.", customerId: 41892, - methodReferenceId: undefined, }, }; server @@ -743,7 +1418,6 @@ describe("MoneyIn", () => { expect(response).toEqual({ responseText: "Success", isSuccess: true, - pageIdentifier: undefined, responseData: { authCode: "VTLMC1", referenceId: "575-c490247af7ed403d86ba583507be61b0", @@ -753,83 +1427,800 @@ describe("MoneyIn", () => { cvvResponseText: "Not processed. Indicates that the expiration date was not provided with the request, or that the card does not have a valid CVV2 code. If the expiration date was not included with the request, resubmit the request with the expiration date.", customerId: 41892, - methodReferenceId: undefined, }, }); }); - test("Reverse", async () => { + test("getpaid (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { + initiator: "payor", + method: "card", + storedMethodId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + storedMethodUsageType: "unscheduled", + }, + }; const rawResponseBody = { - responseCode: 1, - pageIdentifier: undefined, - roomId: 0, - isSuccess: true, responseText: "Success", + isSuccess: true, responseData: { - authCode: "A0000", - referenceId: "255-fb61db4171334aa79224b019f090e4c5", + authCode: "AuthCode", + referenceId: "45-erre-324", resultCode: 1, - resultText: "REVERSED", - avsResponseText: undefined, - cvvResponseText: null, - customerId: null, - methodReferenceId: null, + resultText: "Approved", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, + methodReferenceId: "1ed73d3c67-4076-8f8c-9f26317762ef", }, }; server .mockEndpoint() - .get("/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0); + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + initiator: "payor", + method: "card", + storedMethodId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + storedMethodUsageType: "unscheduled", + }, + }, + }); expect(response).toEqual({ - responseCode: 1, - pageIdentifier: undefined, - roomId: 0, - isSuccess: true, responseText: "Success", + isSuccess: true, responseData: { - authCode: "A0000", - referenceId: "255-fb61db4171334aa79224b019f090e4c5", + authCode: "AuthCode", + referenceId: "45-erre-324", resultCode: 1, - resultText: "REVERSED", - avsResponseText: undefined, - cvvResponseText: null, - customerId: null, - methodReferenceId: null, + resultText: "Approved", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, + methodReferenceId: "1ed73d3c67-4076-8f8c-9f26317762ef", }, }); }); - test("Refund", async () => { + test("getpaid (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { device: "6c361c7d-674c-44cc-b790-382b75d1xxx", method: "cloud", saveIfSuccess: true }, + }; const rawResponseBody = { responseText: "Success", isSuccess: true, responseData: { - authCode: "A0000", - expectedProcessingDateTime: "2025-02-15T10:30:00Z", - referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", - resultCode: 10, - resultText: "INITIATED", - avsResponseText: undefined, - cvvResponseText: null, - customerId: null, - methodReferenceId: null, + authCode: "AuthCode", + referenceId: "45-erre-324", + resultCode: 1, + resultText: "Approved", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, }, - pageidentifier: undefined, }; server .mockEndpoint() - .get("/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + device: "6c361c7d-674c-44cc-b790-382b75d1xxx", + method: "cloud", + saveIfSuccess: true, + }, + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "AuthCode", + referenceId: "45-erre-324", + resultCode: 1, + resultText: "Approved", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, + }, + }); + }); + + test("getpaid (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { + achAccount: "123123123", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Cassian", + achHolderType: "personal", + achRouting: "123123123", + method: "ach", + }, + }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "123456", + referenceId: "132-d9719a411918429cb7ca465927969900", + resultCode: 1, + resultText: "Approved", + avsResponseText: "", + cvvResponseText: "", + customerId: 545, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + achAccount: "123123123", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Cassian", + achHolderType: "personal", + achRouting: "123123123", + method: "ach", + }, + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "123456", + referenceId: "132-d9719a411918429cb7ca465927969900", + resultCode: 1, + resultText: "Approved", + avsResponseText: "", + cvvResponseText: "", + customerId: 545, + }, + }); + }); + + test("getpaid (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { + billingAddress1: "123 Walnut Street", + billingCity: "Johnson City", + billingCountry: "US", + billingEmail: "john@email.com", + billingPhone: "1234567890", + billingState: "Johnson City", + billingZip: "37615", + customerNumber: "3456-7645A", + firstName: "John", + lastName: "Cassian", + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + orderDescription: "New customer package", + orderId: "982-102", + paymentDetails: { serviceFee: 0, totalAmount: 1000 }, + paymentMethod: { + cardcvv: "123", + cardexp: "02/25", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + saveIfSuccess: true, + }, + source: "web", + }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "AuthCode", + referenceId: "45-erre-324", + resultCode: 1, + resultText: "Approved", + avsResponseText: "Exact match, Street address and 5-digit ZIP code both match", + cvvResponseText: "CVV2/CVC2 match", + customerId: 4440, + methodReferenceId: "1ed73d3c67-4076-8f8c-9f26317762ef", + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + billingAddress1: "123 Walnut Street", + billingCity: "Johnson City", + billingCountry: "US", + billingEmail: "john@email.com", + billingPhone: "1234567890", + billingState: "Johnson City", + billingZip: "37615", + customerNumber: "3456-7645A", + firstName: "John", + lastName: "Cassian", + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + orderDescription: "New customer package", + orderId: "982-102", + paymentDetails: { + serviceFee: 0, + totalAmount: 1000, + }, + paymentMethod: { + cardcvv: "123", + cardexp: "02/25", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + saveIfSuccess: true, + }, + source: "web", + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "AuthCode", + referenceId: "45-erre-324", + resultCode: 1, + resultText: "Approved", + avsResponseText: "Exact match, Street address and 5-digit ZIP code both match", + cvvResponseText: "CVV2/CVC2 match", + customerId: 4440, + methodReferenceId: "1ed73d3c67-4076-8f8c-9f26317762ef", + }, + }); + }); + + test("getpaid (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { serviceFee: 0, totalAmount: 100, currency: "CAD" }, + paymentMethod: { + cardcvv: "999", + cardexp: "02/27", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + }, + }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "VTLMC1", + referenceId: "575-c490247af7ed403d86ba583507be61b0", + resultCode: 1, + resultText: "Approved", + avsResponseText: " ", + cvvResponseText: "CVV2/CVC2 match", + customerId: 41892, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + currency: "CAD", + }, + paymentMethod: { + cardcvv: "999", + cardexp: "02/27", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + }, + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "VTLMC1", + referenceId: "575-c490247af7ed403d86ba583507be61b0", + resultCode: 1, + resultText: "Approved", + avsResponseText: " ", + cvvResponseText: "CVV2/CVC2 match", + customerId: 41892, + }, + }); + }); + + test("getpaid (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { + cardcvv: "999", + cardexp: "02/27", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + }, + }; + const rawResponseBody = { + responseText: "Declined", + isSuccess: false, + responseData: { + referenceId: "45-erre-324", + resultCode: 1, + resultText: "200: Transaction was declined by processor.. DECLINE", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.getpaid({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + ipaddress: "255.255.255.255", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + cardcvv: "999", + cardexp: "02/27", + cardHolder: "John Cassian", + cardnumber: "4111111111111111", + cardzip: "12345", + initiator: "payor", + method: "card", + }, + }, + }); + expect(response).toEqual({ + responseText: "Declined", + isSuccess: false, + responseData: { + referenceId: "45-erre-324", + resultCode: 1, + resultText: "200: Transaction was declined by processor.. DECLINE", + avsResponseText: "No address or ZIP match only", + cvvResponseText: "CVV2/CVC2 no match", + customerId: 4440, + }, + }); + }); + + test("getpaid (8)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.getpaid({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getpaid (9)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.getpaid({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getpaid (10)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.getpaid({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getpaid (11)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { totalAmount: 1.1 }, + paymentMethod: { cardexp: "alpha", cardnumber: "cardnumber", method: "card" }, + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/getpaid") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.getpaid({ + body: { + paymentDetails: { + totalAmount: 1.1, + }, + paymentMethod: { + cardexp: "alpha", + cardnumber: "cardnumber", + method: "card", + }, + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Reverse (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + responseCode: 1, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "A0000", + referenceId: "255-fb61db4171334aa79224b019f090e4c5", + resultCode: 1, + resultText: "REVERSED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0); + expect(response).toEqual({ + responseCode: 1, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "A0000", + referenceId: "255-fb61db4171334aa79224b019f090e4c5", + resultCode: 1, + resultText: "REVERSED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("Reverse (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + responseCode: 1, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "A0000", + referenceId: "255-fb61db4171334aa79224b019f090e4c5", + resultCode: 10, + resultText: "INITIATED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 53.76); + expect(response).toEqual({ + responseCode: 1, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: "A0000", + referenceId: "255-fb61db4171334aa79224b019f090e4c5", + resultCode: 10, + resultText: "INITIATED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("Reverse (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/transId/1.1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverse("transId", 1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Reverse (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/transId/1.1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverse("transId", 1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Reverse (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/transId/1.1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverse("transId", 1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Reverse (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/reverse/transId/1.1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverse("transId", 1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Refund (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "A0000", + expectedProcessingDateTime: "2025-02-15T10:30:00Z", + referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", + resultCode: 10, + resultText: "INITIATED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .get("/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") .respondWith() .statusCode(200) .jsonBody(rawResponseBody) @@ -840,40 +2231,235 @@ describe("MoneyIn", () => { responseText: "Success", isSuccess: true, responseData: { - authCode: "A0000", - expectedProcessingDateTime: "2025-02-15T10:30:00Z", - referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", - resultCode: 10, - resultText: "INITIATED", - avsResponseText: undefined, + authCode: "A0000", + expectedProcessingDateTime: "2025-02-15T10:30:00Z", + referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", + resultCode: 10, + resultText: "INITIATED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("Refund (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "A0000", + referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", + resultCode: 1, + resultText: "CAPTURED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .get("/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/100.99") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.refund("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 100.99); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "A0000", + referenceId: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", + resultCode: 1, + resultText: "CAPTURED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }); + }); + + test("Refund (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/refund/transId/1.1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refund("transId", 1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Refund (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/refund/transId/1.1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refund("transId", 1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Refund (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/refund/transId/1.1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refund("transId", 1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Refund (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/refund/transId/1.1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refund("transId", 1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("RefundWithInstructions (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + source: "api", + orderDescription: "Materials deposit", + amount: 100, + refundDetails: { + splitRefunding: [ + { + originationEntryPoint: "7f1a381696", + accountId: "187-342", + description: "Refunding undelivered materials", + amount: 60, + }, + { + originationEntryPoint: "7f1a381696", + accountId: "187-343", + description: "Refunding deposit for undelivered materials", + amount: 40, + }, + ], + }, + }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "", + referenceId: "288-a1192b75-99e9-4d43-8af1-7ae9ab7da4f4", + resultCode: 1, + resultText: "CAPTURED", + cvvResponseText: null, + customerId: null, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .post("/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723") + .header("idempotencyKey", "8A29FC40-CA47-1067-B31D-00DD010662DB") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", { + idempotencyKey: "8A29FC40-CA47-1067-B31D-00DD010662DB", + source: "api", + orderDescription: "Materials deposit", + amount: 100, + refundDetails: { + splitRefunding: [ + { + originationEntryPoint: "7f1a381696", + accountId: "187-342", + description: "Refunding undelivered materials", + amount: 60, + }, + { + originationEntryPoint: "7f1a381696", + accountId: "187-343", + description: "Refunding deposit for undelivered materials", + amount: 40, + }, + ], + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: { + authCode: "", + referenceId: "288-a1192b75-99e9-4d43-8af1-7ae9ab7da4f4", + resultCode: 1, + resultText: "CAPTURED", cvvResponseText: null, customerId: null, methodReferenceId: null, }, - pageidentifier: undefined, }); }); - test("RefundWithInstructions", async () => { + test("RefundWithInstructions (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { source: "api", orderDescription: "Materials deposit", - amount: 100, + amount: 70, refundDetails: { splitRefunding: [ { originationEntryPoint: "7f1a381696", accountId: "187-342", description: "Refunding undelivered materials", - amount: 60, + amount: 40, }, { originationEntryPoint: "7f1a381696", accountId: "187-343", description: "Refunding deposit for undelivered materials", - amount: 40, + amount: 30, }, ], }, @@ -886,12 +2472,10 @@ describe("MoneyIn", () => { referenceId: "288-a1192b75-99e9-4d43-8af1-7ae9ab7da4f4", resultCode: 1, resultText: "CAPTURED", - avsResponseText: undefined, cvvResponseText: null, customerId: null, methodReferenceId: null, }, - pageidentifier: undefined, }; server .mockEndpoint() @@ -907,20 +2491,20 @@ describe("MoneyIn", () => { idempotencyKey: "8A29FC40-CA47-1067-B31D-00DD010662DB", source: "api", orderDescription: "Materials deposit", - amount: 100, + amount: 70, refundDetails: { splitRefunding: [ { originationEntryPoint: "7f1a381696", accountId: "187-342", description: "Refunding undelivered materials", - amount: 60, + amount: 40, }, { originationEntryPoint: "7f1a381696", accountId: "187-343", description: "Refunding deposit for undelivered materials", - amount: 40, + amount: 30, }, ], }, @@ -933,18 +2517,92 @@ describe("MoneyIn", () => { referenceId: "288-a1192b75-99e9-4d43-8af1-7ae9ab7da4f4", resultCode: 1, resultText: "CAPTURED", - avsResponseText: undefined, cvvResponseText: null, customerId: null, methodReferenceId: null, }, - pageidentifier: undefined, }); }); - test("ReverseCredit", async () => { + test("RefundWithInstructions (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/refund/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refundWithInstructions("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("RefundWithInstructions (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/refund/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refundWithInstructions("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("RefundWithInstructions (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/refund/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refundWithInstructions("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("RefundWithInstructions (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/refund/transId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.refundWithInstructions("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ReverseCredit (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -983,9 +2641,81 @@ describe("MoneyIn", () => { }); }); - test("SendReceipt2Trans", async () => { + test("ReverseCredit (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverseCredit/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverseCredit("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ReverseCredit (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverseCredit/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverseCredit("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ReverseCredit (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/reverseCredit/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverseCredit("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ReverseCredit (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/reverseCredit/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.reverseCredit("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SendReceipt2Trans (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, pageIdentifier: "null", responseText: "Success" }; server @@ -1006,9 +2736,81 @@ describe("MoneyIn", () => { }); }); - test("Validate", async () => { + test("SendReceipt2Trans (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/sendreceipt/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.sendReceipt2Trans("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SendReceipt2Trans (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/sendreceipt/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.sendReceipt2Trans("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SendReceipt2Trans (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/sendreceipt/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.sendReceipt2Trans("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SendReceipt2Trans (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/sendreceipt/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.sendReceipt2Trans("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Validate (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entryPoint: "entry132", paymentMethod: { @@ -1029,7 +2831,6 @@ describe("MoneyIn", () => { avsResponseText: "Zip code provided", cvvResponseText: "", customerId: 0, - methodReferenceId: undefined, }, responseText: "Success", }; @@ -1064,19 +2865,165 @@ describe("MoneyIn", () => { avsResponseText: "Zip code provided", cvvResponseText: "", customerId: 0, - methodReferenceId: undefined, }, responseText: "Success", }); }); - test("Void", async () => { + test("Validate (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/validate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.validate({ + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Validate (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/validate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.validate({ + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Validate (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyIn/validate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.validate({ + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Validate (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyIn/validate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.validate({ + entryPoint: "entryPoint", + paymentMethod: { + method: "card", + cardnumber: "cardnumber", + cardexp: "alpha", + cardzip: "cardzip", + cardHolder: "cardHolder", + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("Void (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -1085,10 +3032,6 @@ describe("MoneyIn", () => { referenceId: "132-9eab3dfe958146639944aebcab3e9e28", resultCode: 1, resultText: "Transaction Void Successful", - avsResponseText: undefined, - cvvResponseText: undefined, - customerId: undefined, - methodReferenceId: undefined, }, }; server @@ -1102,7 +3045,6 @@ describe("MoneyIn", () => { const response = await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723"); expect(response).toEqual({ responseCode: 1, - pageIdentifier: undefined, roomId: 0, isSuccess: true, responseText: "Success", @@ -1111,11 +3053,79 @@ describe("MoneyIn", () => { referenceId: "132-9eab3dfe958146639944aebcab3e9e28", resultCode: 1, resultText: "Transaction Void Successful", - avsResponseText: undefined, - cvvResponseText: undefined, - customerId: undefined, - methodReferenceId: undefined, }, }); }); + + test("Void (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/void/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.void("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("Void (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/void/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.void("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("Void (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyIn/void/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.void("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("Void (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyIn/void/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyIn.void("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/moneyOut.test.ts b/tests/wire/moneyOut.test.ts index 5e56e9df..a40f5953 100644 --- a/tests/wire/moneyOut.test.ts +++ b/tests/wire/moneyOut.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("MoneyOut", () => { - test("AuthorizeOut", async () => { +describe("MoneyOutClient", () => { + test("AuthorizeOut (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entryPoint: "48acde49", invoiceData: [{ billId: 54323 }], @@ -83,253 +82,1436 @@ describe("MoneyOut", () => { }); }); - test("CancelAllOut", async () => { + test("AuthorizeOut (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = ["2-29", "2-28", "2-27"]; + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "48acde49", + invoiceData: [ + { + billId: 123, + attachments: [{ filename: "bill.pdf", ftype: "pdf", furl: "https://example.com/bill.pdf" }], + }, + ], + orderDescription: "Window Painting", + paymentDetails: { totalAmount: 47 }, + paymentMethod: { method: "managed" }, + vendorData: { vendorNumber: "7895433" }, + }; const rawResponseBody = { - isSuccess: true, - pageIdentifier: "null", responseCode: 1, - responseData: [ - { CustomerId: 1000000, ReferenceId: "129-230", ResultCode: 1, ResultText: "Cancelled" }, - { CustomerId: 1000000, ReferenceId: "129-219", ResultCode: 1, ResultText: "Cancelled" }, - ], + pageIdentifier: null, + roomId: 0, + isSuccess: true, responseText: "Success", + responseData: { + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, + }, }; server .mockEndpoint() - .post("/MoneyOut/cancelAll") + .post("/MoneyOut/authorize") .jsonBody(rawRequestBody) .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.moneyOut.cancelAllOut(["2-29", "2-28", "2-27"]); - expect(response).toEqual({ - isSuccess: true, - pageIdentifier: "null", - responseCode: 1, - responseData: [ - { - CustomerId: 1000000, - ReferenceId: "129-230", - ResultCode: 1, - ResultText: "Cancelled", + const response = await client.moneyOut.authorizeOut({ + body: { + entryPoint: "48acde49", + invoiceData: [ + { + billId: 123, + attachments: [ + { + filename: "bill.pdf", + ftype: "pdf", + furl: "https://example.com/bill.pdf", + }, + ], + }, + ], + orderDescription: "Window Painting", + paymentDetails: { + totalAmount: 47, }, - { - CustomerId: 1000000, - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Cancelled", + paymentMethod: { + method: "managed", }, - ], + vendorData: { + vendorNumber: "7895433", + }, + }, + }); + expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, responseText: "Success", + responseData: { + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, + }, }); }); - test("CancelOutGet", async () => { + test("AuthorizeOut (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "48acde49", + source: "api", + invoiceData: [{ billId: 54323 }], + orderDescription: "Window Painting", + paymentMethod: { method: "ach", storedMethodId: "4c6a4b78-72de-4bdd-9455-b9d30f991001-XXXX" }, + paymentDetails: { totalAmount: 47 }, + vendorData: { vendorNumber: "7895433" }, + }; const rawResponseBody = { + responseCode: 1, + pageIdentifier: null, + roomId: 0, isSuccess: true, responseText: "Success", - pageIdentifier: undefined, responseData: { - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Approved", - CustomerId: 0, - AuthCode: undefined, - cvvResponseText: undefined, - avsResponseText: undefined, - methodReferenceId: undefined, + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, }, }; server .mockEndpoint() - .get("/MoneyOut/cancel/129-219") + .post("/MoneyOut/authorize") + .jsonBody(rawRequestBody) .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.moneyOut.cancelOutGet("129-219"); + const response = await client.moneyOut.authorizeOut({ + body: { + entryPoint: "48acde49", + source: "api", + invoiceData: [ + { + billId: 54323, + }, + ], + orderDescription: "Window Painting", + paymentMethod: { + method: "ach", + storedMethodId: "4c6a4b78-72de-4bdd-9455-b9d30f991001-XXXX", + }, + paymentDetails: { + totalAmount: 47, + }, + vendorData: { + vendorNumber: "7895433", + }, + }, + }); expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, isSuccess: true, responseText: "Success", - pageIdentifier: undefined, responseData: { - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Approved", - CustomerId: 0, - AuthCode: undefined, - cvvResponseText: undefined, - avsResponseText: undefined, - methodReferenceId: undefined, + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, }, }); }); - test("CancelOutDelete", async () => { + test("AuthorizeOut (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "47ced57b", + paymentMethod: { + method: "ach", + achHolder: "John Doe", + achRouting: "011401533", + achAccount: "123456789", + achAccountType: "checking", + achHolderType: "business", + }, + paymentDetails: { totalAmount: 978.32 }, + vendorData: { + vendorNumber: "Vendor3800638299609471", + name1: "Heritage Pro Company", + name2: "", + ein: "473771889", + phone: "7868342364", + email: "contact570@heritagepro.com", + address1: "478 Mittie Roads", + city: "Jakubowskifield", + state: "WI", + zip: "45993", + country: "US", + mcc: "0763", + locationCode: "tpa", + contacts: [ + { + contactName: "Dax", + contactEmail: "Mandy65@heritagepro.com", + contactPhone: "996-325-5420 x31028", + }, + ], + vendorStatus: 1, + remitAddress1: "727 Terrell Streets", + remitAddress2: "Apt. 773", + remitCity: "South Nicholeside", + remitState: "ID", + remitZip: "72951-9790", + remitCountry: "US", + }, + invoiceData: [ + { + invoiceNumber: "VI3BvwTG", + netAmount: "1", + invoiceDate: "2026-09-03", + dueDate: "2026-11-04", + comments: "Building Repairs - Community event setup (System updates)", + }, + ], + }; const rawResponseBody = { + responseCode: 1, + pageIdentifier: null, + roomId: 0, isSuccess: true, responseText: "Success", - pageIdentifier: undefined, responseData: { - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Approved", - CustomerId: 0, - AuthCode: undefined, - cvvResponseText: undefined, - avsResponseText: undefined, - methodReferenceId: undefined, + authCode: null, + referenceId: "129-220", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 12345, + methodReferenceId: "12dea40cba9130s93s-12345", }, }; server .mockEndpoint() - .delete("/MoneyOut/cancel/129-219") + .post("/MoneyOut/authorize") + .jsonBody(rawRequestBody) .respondWith() .statusCode(200) .jsonBody(rawResponseBody) .build(); - const response = await client.moneyOut.cancelOutDelete("129-219"); + const response = await client.moneyOut.authorizeOut({ + body: { + entryPoint: "47ced57b", + paymentMethod: { + method: "ach", + achHolder: "John Doe", + achRouting: "011401533", + achAccount: "123456789", + achAccountType: "checking", + achHolderType: "business", + }, + paymentDetails: { + totalAmount: 978.32, + }, + vendorData: { + vendorNumber: "Vendor3800638299609471", + name1: "Heritage Pro Company", + name2: "", + ein: "473771889", + phone: "7868342364", + email: "contact570@heritagepro.com", + address1: "478 Mittie Roads", + city: "Jakubowskifield", + state: "WI", + zip: "45993", + country: "US", + mcc: "0763", + locationCode: "tpa", + contacts: [ + { + contactName: "Dax", + contactEmail: "Mandy65@heritagepro.com", + contactPhone: "996-325-5420 x31028", + }, + ], + vendorStatus: 1, + remitAddress1: "727 Terrell Streets", + remitAddress2: "Apt. 773", + remitCity: "South Nicholeside", + remitState: "ID", + remitZip: "72951-9790", + remitCountry: "US", + }, + invoiceData: [ + { + invoiceNumber: "VI3BvwTG", + netAmount: "1", + invoiceDate: "2026-09-03", + dueDate: "2026-11-04", + comments: "Building Repairs - Community event setup (System updates)", + }, + ], + }, + }); expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, isSuccess: true, responseText: "Success", - pageIdentifier: undefined, responseData: { - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Approved", - CustomerId: 0, - AuthCode: undefined, - cvvResponseText: undefined, - avsResponseText: undefined, - methodReferenceId: undefined, + authCode: null, + referenceId: "129-220", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 12345, + methodReferenceId: "12dea40cba9130s93s-12345", }, }); }); - test("CaptureAllOut", async () => { + test("AuthorizeOut (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = ["2-29", "2-28", "2-27"]; - const rawResponseBody = { - isSuccess: true, - pageIdentifier: "null", - responseCode: 1, - responseData: [ - { CustomerId: 1000000, ReferenceId: "129-230", ResultCode: 1, ResultText: "Captured" }, - { CustomerId: 1000000, ReferenceId: "129-219", ResultCode: 1, ResultText: "Captured" }, - ], - responseText: "Success", + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { method: "method" }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], }; + const rawResponseBody = { key: "value" }; server .mockEndpoint() - .post("/MoneyOut/captureAll") + .post("/MoneyOut/authorize") .jsonBody(rawRequestBody) .respondWith() - .statusCode(200) + .statusCode(400) .jsonBody(rawResponseBody) .build(); - const response = await client.moneyOut.captureAllOut({ - body: ["2-29", "2-28", "2-27"], - }); - expect(response).toEqual({ - isSuccess: true, - pageIdentifier: "null", - responseCode: 1, - responseData: [ - { - CustomerId: 1000000, - ReferenceId: "129-230", - ResultCode: 1, - ResultText: "Captured", + await expect(async () => { + return await client.moneyOut.authorizeOut({ + body: { + entryPoint: "entryPoint", + paymentMethod: { + method: "method", + }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], }, - { - CustomerId: 1000000, - ReferenceId: "129-219", - ResultCode: 1, - ResultText: "Captured", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AuthorizeOut (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { method: "method" }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.authorizeOut({ + body: { + entryPoint: "entryPoint", + paymentMethod: { + method: "method", + }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AuthorizeOut (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { method: "method" }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.authorizeOut({ + body: { + entryPoint: "entryPoint", + paymentMethod: { + method: "method", + }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AuthorizeOut (8)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "entryPoint", + paymentMethod: { method: "method" }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyOut/authorize") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.authorizeOut({ + body: { + entryPoint: "entryPoint", + paymentMethod: { + method: "method", + }, + paymentDetails: {}, + vendorData: {}, + invoiceData: [{}, {}], + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CancelAllOut (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["2-29", "2-28", "2-27"]; + const rawResponseBody = { + isSuccess: true, + pageIdentifier: "null", + responseCode: 1, + responseData: [ + { CustomerId: 1000000, ReferenceId: "129-230", ResultCode: 1, ResultText: "Cancelled" }, + { CustomerId: 1000000, ReferenceId: "129-219", ResultCode: 1, ResultText: "Cancelled" }, + ], + responseText: "Success", + }; + server + .mockEndpoint() + .post("/MoneyOut/cancelAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.cancelAllOut(["2-29", "2-28", "2-27"]); + expect(response).toEqual({ + isSuccess: true, + pageIdentifier: "null", + responseCode: 1, + responseData: [ + { + CustomerId: 1000000, + ReferenceId: "129-230", + ResultCode: 1, + ResultText: "Cancelled", + }, + { + CustomerId: 1000000, + ReferenceId: "129-219", + ResultCode: 1, + ResultText: "Cancelled", + }, + ], + responseText: "Success", + }); + }); + + test("CancelAllOut (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/cancelAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelAllOut(["string", "string"]); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CancelAllOut (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/cancelAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelAllOut(["string", "string"]); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CancelAllOut (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/cancelAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelAllOut(["string", "string"]); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CancelAllOut (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyOut/cancelAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelAllOut(["string", "string"]); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CancelOutGet (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + isSuccess: true, + responseText: "Success", + responseData: { ReferenceId: "129-219", ResultCode: 1, ResultText: "Approved", CustomerId: 0 }, + }; + server + .mockEndpoint() + .get("/MoneyOut/cancel/129-219") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.cancelOutGet("129-219"); + expect(response).toEqual({ + isSuccess: true, + responseText: "Success", + responseData: { + ReferenceId: "129-219", + ResultCode: 1, + ResultText: "Approved", + CustomerId: 0, + }, + }); + }); + + test("CancelOutGet (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutGet("referenceId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CancelOutGet (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutGet("referenceId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CancelOutGet (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutGet("referenceId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CancelOutGet (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutGet("referenceId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CancelOutDelete (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + isSuccess: true, + responseText: "Success", + responseData: { ReferenceId: "129-219", ResultCode: 1, ResultText: "Approved", CustomerId: 0 }, + }; + server + .mockEndpoint() + .delete("/MoneyOut/cancel/129-219") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.cancelOutDelete("129-219"); + expect(response).toEqual({ + isSuccess: true, + responseText: "Success", + responseData: { + ReferenceId: "129-219", + ResultCode: 1, + ResultText: "Approved", + CustomerId: 0, + }, + }); + }); + + test("CancelOutDelete (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutDelete("referenceId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CancelOutDelete (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutDelete("referenceId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CancelOutDelete (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutDelete("referenceId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CancelOutDelete (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/MoneyOut/cancel/referenceId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.cancelOutDelete("referenceId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CaptureAllOut (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["2-29", "2-28", "2-27"]; + const rawResponseBody = { + isSuccess: true, + pageIdentifier: "null", + responseCode: 1, + responseData: [ + { CustomerId: 1000000, ReferenceId: "129-230", ResultCode: 1, ResultText: "Captured" }, + { CustomerId: 1000000, ReferenceId: "129-219", ResultCode: 1, ResultText: "Captured" }, + ], + responseText: "Success", + }; + server + .mockEndpoint() + .post("/MoneyOut/captureAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.captureAllOut({ + body: ["2-29", "2-28", "2-27"], + }); + expect(response).toEqual({ + isSuccess: true, + pageIdentifier: "null", + responseCode: 1, + responseData: [ + { + CustomerId: 1000000, + ReferenceId: "129-230", + ResultCode: 1, + ResultText: "Captured", + }, + { + CustomerId: 1000000, + ReferenceId: "129-219", + ResultCode: 1, + ResultText: "Captured", + }, + ], + responseText: "Success", + }); + }); + + test("CaptureAllOut (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/captureAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureAllOut({ + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CaptureAllOut (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/captureAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureAllOut({ + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CaptureAllOut (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/MoneyOut/captureAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureAllOut({ + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CaptureAllOut (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["string", "string"]; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/MoneyOut/captureAll") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureAllOut({ + body: ["string", "string"], + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CaptureOut (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, + }, + }; + server + .mockEndpoint() + .get("/MoneyOut/capture/129-219") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.captureOut("129-219"); + expect(response).toEqual({ + responseCode: 1, + pageIdentifier: null, + roomId: 0, + isSuccess: true, + responseText: "Success", + responseData: { + authCode: null, + referenceId: "129-219", + resultCode: 1, + resultText: "Authorized", + avsResponseText: null, + cvvResponseText: null, + customerId: 0, + methodReferenceId: null, + }, + }); + }); + + test("CaptureOut (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/capture/referenceId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureOut("referenceId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CaptureOut (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/capture/referenceId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureOut("referenceId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CaptureOut (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/capture/referenceId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureOut("referenceId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CaptureOut (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyOut/capture/referenceId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.captureOut("referenceId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("PayoutDetails (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + Bills: [{ invoiceNumber: "123B", netAmount: "8800.00" }], + Comments: "testing", + CreatedDate: "2022-07-01T15:00:01Z", + Events: [{ EventTime: "2023-04-24T09:17:49Z", TransEvent: "Authorized" }], + FeeAmount: 0, + Gateway: "TSYS", + IdOut: 350, + LastUpdated: "2023-04-23T17:00:00Z", + NetAmount: 8800, + ParentOrgName: "PropertyManager Pro", + PaymentData: { + AccountType: "", + binData: { + binMatchedLength: "6", + binCardBrand: "Visa", + binCardType: "Credit", + binCardCategory: "PLATINUM", + binCardIssuer: "Bank of Example", + binCardIssuerCountry: "United States", + binCardIssuerCountryCodeA2: "US", + binCardIssuerCountryNumber: "840", + binCardIsRegulated: "false", + binCardUseCategory: "Consumer", + binCardIssuerCountryCodeA3: "USA", + }, + HolderName: "", + Initiator: "payor", + MaskedAccount: "", + Sequence: "subsequent", + SignatureData: "SignatureData", + StoredMethodUsageType: "subscription", + }, + PaymentGroup: "2345667-ddd-fff", + PaymentId: "12345678910", + PaymentMethod: "managed", + PaymentStatus: "Authorized", + PaypointDbaname: "Sunshine Gutters", + PaypointLegalname: "Sunshine Services, LLC", + Source: "api", + Status: 11, + StatusText: "Captured", + TotalAmount: 8800, + Vendor: { + VendorNumber: "1234", + Name1: "Herman's Coatings", + Name2: "Herman's Coating Supply Company, LLC", + EIN: "123456789", + Phone: "212-555-1234", + Email: "example@email.com", + Address1: "123 Ocean Drive", + Address2: "Suite 400", + City: "Bristol", + State: "GA", + Zip: "31113", + Country: "US", + Mcc: "7777", + LocationCode: "LOC123", + Contacts: { + ContactEmail: "eric@martinezcoatings.com", + ContactName: "Eric Martinez", + ContactPhone: "5555555555", + ContactTitle: "Owner", + }, + BillingData: { + id: 123456, + accountId: "bank-account-001", + nickname: "Main Checking Account", + bankName: "Example Bank", + routingAccount: "123456789", + accountNumber: "9876543210", + typeAccount: "Checking", + bankAccountHolderName: "John Doe", + bankAccountHolderType: "Business", + bankAccountFunction: 2, + verified: true, + status: 1, + services: [], + default: true, + }, + VendorStatus: 1, + VendorId: 1, + Summary: { + ActiveBills: 2, + PendingBills: 4, + InTransitBills: 3, + PaidBills: 18, + OverdueBills: 1, + ApprovedBills: 5, + DisapprovedBills: 1, + TotalBills: 34, + ActiveBillsAmount: 1250.75, + PendingBillsAmount: 2890.5, + InTransitBillsAmount: 1675.25, + PaidBillsAmount: 15420.8, + OverdueBillsAmount: 425, + ApprovedBillsAmount: 3240.9, + DisapprovedBillsAmount: 180, + TotalBillsAmount: 25083.2, + }, + PaypointLegalname: "Sunshine Services, LLC", + PaypointDbaname: "Sunshine Gutters", + PaypointEntryname: "d193cf9a46", + ParentOrgName: "PropertyManager Pro", + ParentOrgId: 1000, + CreatedDate: "2022-07-01T15:00:01Z", + LastUpdated: "2022-07-01T15:00:01Z", + remitAddress1: "123 Walnut Street", + remitAddress2: "Suite 900", + remitCity: "Miami", + remitState: "FL", + remitZip: "31113", + remitCountry: "US", + payeeName1: "payeeName1", + payeeName2: "payeeName2", + customField1: "", + customField2: "", + customerVendorAccount: "123-456", + InternalReferenceId: 1000000, + externalPaypointID: "Paypoint-100", + StoredMethods: [], + }, + HasVcardTransactions: false, + IsSameDayACH: false, + RiskFlagged: false, + }; + server + .mockEndpoint() + .get("/MoneyOut/details/45-as456777hhhhhhhhhh77777777-324") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.moneyOut.payoutDetails("45-as456777hhhhhhhhhh77777777-324"); + expect(response).toEqual({ + Bills: [ + { + invoiceNumber: "123B", + netAmount: "8800.00", + }, + ], + Comments: "testing", + CreatedDate: "2022-07-01T15:00:01Z", + Events: [ + { + EventTime: "2023-04-24T09:17:49Z", + TransEvent: "Authorized", + }, + ], + FeeAmount: 0, + Gateway: "TSYS", + IdOut: 350, + LastUpdated: "2023-04-23T17:00:00Z", + NetAmount: 8800, + ParentOrgName: "PropertyManager Pro", + PaymentData: { + AccountType: "", + binData: { + binMatchedLength: "6", + binCardBrand: "Visa", + binCardType: "Credit", + binCardCategory: "PLATINUM", + binCardIssuer: "Bank of Example", + binCardIssuerCountry: "United States", + binCardIssuerCountryCodeA2: "US", + binCardIssuerCountryNumber: "840", + binCardIsRegulated: "false", + binCardUseCategory: "Consumer", + binCardIssuerCountryCodeA3: "USA", + }, + HolderName: "", + Initiator: "payor", + MaskedAccount: "", + Sequence: "subsequent", + SignatureData: "SignatureData", + StoredMethodUsageType: "subscription", + }, + PaymentGroup: "2345667-ddd-fff", + PaymentId: "12345678910", + PaymentMethod: "managed", + PaymentStatus: "Authorized", + PaypointDbaname: "Sunshine Gutters", + PaypointLegalname: "Sunshine Services, LLC", + Source: "api", + Status: 11, + StatusText: "Captured", + TotalAmount: 8800, + Vendor: { + VendorNumber: "1234", + Name1: "Herman's Coatings", + Name2: "Herman's Coating Supply Company, LLC", + EIN: "123456789", + Phone: "212-555-1234", + Email: "example@email.com", + Address1: "123 Ocean Drive", + Address2: "Suite 400", + City: "Bristol", + State: "GA", + Zip: "31113", + Country: "US", + Mcc: "7777", + LocationCode: "LOC123", + Contacts: { + ContactEmail: "eric@martinezcoatings.com", + ContactName: "Eric Martinez", + ContactPhone: "5555555555", + ContactTitle: "Owner", + }, + BillingData: { + id: 123456, + accountId: "bank-account-001", + nickname: "Main Checking Account", + bankName: "Example Bank", + routingAccount: "123456789", + accountNumber: "9876543210", + typeAccount: "Checking", + bankAccountHolderName: "John Doe", + bankAccountHolderType: "Business", + bankAccountFunction: 2, + verified: true, + status: 1, + services: [], + default: true, + }, + VendorStatus: 1, + VendorId: 1, + Summary: { + ActiveBills: 2, + PendingBills: 4, + InTransitBills: 3, + PaidBills: 18, + OverdueBills: 1, + ApprovedBills: 5, + DisapprovedBills: 1, + TotalBills: 34, + ActiveBillsAmount: 1250.75, + PendingBillsAmount: 2890.5, + InTransitBillsAmount: 1675.25, + PaidBillsAmount: 15420.8, + OverdueBillsAmount: 425, + ApprovedBillsAmount: 3240.9, + DisapprovedBillsAmount: 180, + TotalBillsAmount: 25083.2, }, - ], - responseText: "Success", - }); - }); - - test("CaptureOut", async () => { - const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - - const rawResponseBody = { - responseCode: 1, - pageIdentifier: null, - roomId: 0, - isSuccess: true, - responseText: "Success", - responseData: { - authCode: null, - referenceId: "129-219", - resultCode: 1, - resultText: "Authorized", - avsResponseText: null, - cvvResponseText: null, - customerId: 0, - methodReferenceId: null, - }, - }; - server - .mockEndpoint() - .get("/MoneyOut/capture/129-219") - .respondWith() - .statusCode(200) - .jsonBody(rawResponseBody) - .build(); - - const response = await client.moneyOut.captureOut("129-219"); - expect(response).toEqual({ - responseCode: 1, - pageIdentifier: null, - roomId: 0, - isSuccess: true, - responseText: "Success", - responseData: { - authCode: null, - referenceId: "129-219", - resultCode: 1, - resultText: "Authorized", - avsResponseText: null, - cvvResponseText: null, - customerId: 0, - methodReferenceId: null, + PaypointLegalname: "Sunshine Services, LLC", + PaypointDbaname: "Sunshine Gutters", + PaypointEntryname: "d193cf9a46", + ParentOrgName: "PropertyManager Pro", + ParentOrgId: 1000, + CreatedDate: "2022-07-01T15:00:01Z", + LastUpdated: "2022-07-01T15:00:01Z", + remitAddress1: "123 Walnut Street", + remitAddress2: "Suite 900", + remitCity: "Miami", + remitState: "FL", + remitZip: "31113", + remitCountry: "US", + payeeName1: "payeeName1", + payeeName2: "payeeName2", + customField1: "", + customField2: "", + customerVendorAccount: "123-456", + InternalReferenceId: 1000000, + externalPaypointID: "Paypoint-100", + StoredMethods: [], }, + HasVcardTransactions: false, + IsSameDayACH: false, + RiskFlagged: false, }); }); - test("PayoutDetails", async () => { + test("PayoutDetails (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Bills: [{ invoiceNumber: "123B", netAmount: "8800.00" }], - CheckData: undefined, - CheckNumber: undefined, Comments: "testing", CreatedDate: "2022-07-01T15:00:01Z", - Events: [{ EventTime: "2023-04-24T09:17:49Z", TransEvent: "Authorized" }], + Events: [ + { EventTime: "2023-04-24T09:00:33Z", TransEvent: "Authorized" }, + { + EventData: { + custId: "PAYABLITST", + dateCreated: "2023-04-24T16:14:28Z", + dateModified: "2023-04-24T16:14:28Z", + group: { + approved: false, + custId: "PAYABLITST", + dateCreated: "2023-04-24T16:14:28Z", + dateModified: "2023-04-24T16:14:28Z", + id: "acd5ddd9-42be-4822-bc02-46e7c560d8a4", + links: [ + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4", + rel: "cancel", + type: "DELETE", + }, + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4/approve", + rel: "approve", + type: "POST", + }, + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4", + rel: "self", + type: "GET", + }, + ], + name: "187-20230424-PAYABLITST", + status: "Waiting Funds", + totalAmount: "8800.00", + }, + id: "1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + invoices: [{ invoiceNumber: "123B", netAmount: "8800.00" }], + links: [ + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded/resendRemit", + rel: "resendRemit", + type: "POST", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + rel: "cancel", + type: "DELETE", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + rel: "self", + type: "GET", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded/reissue", + rel: "reissue", + type: "POST", + }, + ], + paymentNumber: "187-349", + paymentStatus: "Awaiting Funds", + paymentType: "VCard", + remitAddress: { + address1: "5724 daughtery downs Loop", + address2: "", + city: "Lakeland", + countryCode: "US", + state: "FL", + zip: "33809", + }, + vendor: { + address: { + address1: "5724 DAUGHTERY DOWNS LOOP", + address2: "", + city: "LAKELAND", + countryCode: "US", + state: "FL", + zip: "33809", + }, + contactEmail: "paul@payabli.com", + custId: "PAYABLITST", + dateCreated: "2023-04-07T15:10:13Z", + dateModified: "2023-04-17T15:39:33Z", + email: "paul@payabli.com", + id: "d7d92fac-fd8a-4ce9-8f92-62ee979b43fe", + links: [ + { + href: "https://cert-api.cpayplus.com/payments/d7d92fac-fd8a-4ce9-8f92-62ee979b43fe", + rel: "self", + type: "GET", + }, + ], + paymentType: "VCard", + status: "Enrolled", + statusReason: "Customer Enrolled", + vendorName1: "PAUL'S", + vendorNumber: "54321", + vendorPhone: "19706188888", + vendorTaxId: "123456789", + }, + }, + EventTime: "2023-04-24T09:14:28Z", + TransEvent: "Captured", + }, + ], FeeAmount: 0, Gateway: "TSYS", - IdOut: 350, + IdOut: 349, LastUpdated: "2023-04-23T17:00:00Z", NetAmount: 8800, ParentOrgName: "PropertyManager Pro", @@ -356,13 +1538,13 @@ describe("MoneyOut", () => { StoredMethodUsageType: "subscription", }, PaymentGroup: "2345667-ddd-fff", - PaymentId: "12345678910", + PaymentId: "1234567890", PaymentMethod: "managed", - PaymentStatus: "Authorized", + PaymentStatus: "Captured", PaypointDbaname: "Sunshine Gutters", PaypointLegalname: "Sunshine Services, LLC", Source: "api", - Status: 11, + Status: 1, StatusText: "Captured", TotalAmount: 8800, Vendor: { @@ -372,7 +1554,6 @@ describe("MoneyOut", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -403,10 +1584,8 @@ describe("MoneyOut", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -444,25 +1623,12 @@ describe("MoneyOut", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, - CreatedAt: undefined, - ParentOrgId: undefined, - externalPaypointID: undefined, - EntryName: undefined, - BatchId: undefined, HasVcardTransactions: false, IsSameDayACH: false, - ScheduleId: undefined, - SettlementStatus: undefined, RiskFlagged: false, - RiskFlaggedOn: undefined, - RiskStatus: undefined, - RiskReason: undefined, - RiskAction: undefined, - RiskActionCode: undefined, }; server .mockEndpoint() @@ -480,19 +1646,123 @@ describe("MoneyOut", () => { netAmount: "8800.00", }, ], - CheckData: undefined, - CheckNumber: undefined, Comments: "testing", CreatedDate: "2022-07-01T15:00:01Z", Events: [ { - EventTime: "2023-04-24T09:17:49Z", + EventTime: "2023-04-24T09:00:33Z", TransEvent: "Authorized", }, + { + EventData: { + custId: "PAYABLITST", + dateCreated: "2023-04-24T16:14:28Z", + dateModified: "2023-04-24T16:14:28Z", + group: { + approved: false, + custId: "PAYABLITST", + dateCreated: "2023-04-24T16:14:28Z", + dateModified: "2023-04-24T16:14:28Z", + id: "acd5ddd9-42be-4822-bc02-46e7c560d8a4", + links: [ + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4", + rel: "cancel", + type: "DELETE", + }, + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4/approve", + rel: "approve", + type: "POST", + }, + { + href: "https://cert-api.cpayplus.com/payments/groups/acd5ddd9-42be-4822-bc02-46e7c560d8a4", + rel: "self", + type: "GET", + }, + ], + name: "187-20230424-PAYABLITST", + status: "Waiting Funds", + totalAmount: "8800.00", + }, + id: "1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + invoices: [ + { + invoiceNumber: "123B", + netAmount: "8800.00", + }, + ], + links: [ + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded/resendRemit", + rel: "resendRemit", + type: "POST", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + rel: "cancel", + type: "DELETE", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded", + rel: "self", + type: "GET", + }, + { + href: "https://cert-api.cpayplus.com/payments/1ede3eb2-a564-43b5-b2d2-7195f6d9fded/reissue", + rel: "reissue", + type: "POST", + }, + ], + paymentNumber: "187-349", + paymentStatus: "Awaiting Funds", + paymentType: "VCard", + remitAddress: { + address1: "5724 daughtery downs Loop", + address2: "", + city: "Lakeland", + countryCode: "US", + state: "FL", + zip: "33809", + }, + vendor: { + address: { + address1: "5724 DAUGHTERY DOWNS LOOP", + address2: "", + city: "LAKELAND", + countryCode: "US", + state: "FL", + zip: "33809", + }, + contactEmail: "paul@payabli.com", + custId: "PAYABLITST", + dateCreated: "2023-04-07T15:10:13Z", + dateModified: "2023-04-17T15:39:33Z", + email: "paul@payabli.com", + id: "d7d92fac-fd8a-4ce9-8f92-62ee979b43fe", + links: [ + { + href: "https://cert-api.cpayplus.com/payments/d7d92fac-fd8a-4ce9-8f92-62ee979b43fe", + rel: "self", + type: "GET", + }, + ], + paymentType: "VCard", + status: "Enrolled", + statusReason: "Customer Enrolled", + vendorName1: "PAUL'S", + vendorNumber: "54321", + vendorPhone: "19706188888", + vendorTaxId: "123456789", + }, + }, + EventTime: "2023-04-24T09:14:28Z", + TransEvent: "Captured", + }, ], FeeAmount: 0, Gateway: "TSYS", - IdOut: 350, + IdOut: 349, LastUpdated: "2023-04-23T17:00:00Z", NetAmount: 8800, ParentOrgName: "PropertyManager Pro", @@ -519,13 +1789,13 @@ describe("MoneyOut", () => { StoredMethodUsageType: "subscription", }, PaymentGroup: "2345667-ddd-fff", - PaymentId: "12345678910", + PaymentId: "1234567890", PaymentMethod: "managed", - PaymentStatus: "Authorized", + PaymentStatus: "Captured", PaypointDbaname: "Sunshine Gutters", PaypointLegalname: "Sunshine Services, LLC", Source: "api", - Status: 11, + Status: 1, StatusText: "Captured", TotalAmount: 8800, Vendor: { @@ -535,7 +1805,6 @@ describe("MoneyOut", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -566,10 +1835,8 @@ describe("MoneyOut", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -607,31 +1874,90 @@ describe("MoneyOut", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, - CreatedAt: undefined, - ParentOrgId: undefined, - externalPaypointID: undefined, - EntryName: undefined, - BatchId: undefined, HasVcardTransactions: false, IsSameDayACH: false, - ScheduleId: undefined, - SettlementStatus: undefined, RiskFlagged: false, - RiskFlaggedOn: undefined, - RiskStatus: undefined, - RiskReason: undefined, - RiskAction: undefined, - RiskActionCode: undefined, }); }); - test("VCardGet", async () => { + test("PayoutDetails (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/details/transId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.payoutDetails("transId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("PayoutDetails (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/details/transId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.payoutDetails("transId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("PayoutDetails (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/details/transId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.payoutDetails("transId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("PayoutDetails (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyOut/details/transId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.payoutDetails("transId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("VCardGet (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { vcardSent: false, @@ -639,18 +1965,12 @@ describe("MoneyOut", () => { cardNumber: "553232XXXXXX3179", cvc: "XXX", expirationDate: "2025-05-01", - status: undefined, amount: 120, currentBalance: 120, expenseLimit: 20, - expenseLimitPeriod: undefined, maxNumberOfUses: 1, currentNumberOfUses: 0, exactAmount: true, - mcc: undefined, - tcc: undefined, - misc1: undefined, - misc2: undefined, dateCreated: "2023-12-06T20:25:31.077", dateModified: "2023-12-06T00:00:00", associatedVendor: { @@ -660,7 +1980,6 @@ describe("MoneyOut", () => { EIN: "12-3456789", Phone: "555-123-4567", Email: "contact@smithindustries.com", - RemitEmail: undefined, Address1: "1234 Main Street", Address2: "Suite 200", City: "New York", @@ -668,7 +1987,6 @@ describe("MoneyOut", () => { Zip: "10001", Country: "USA", Mcc: "5411", - LocationCode: undefined, Contacts: [ { ContactName: "Herman Martinez", @@ -679,7 +1997,6 @@ describe("MoneyOut", () => { ], BillingData: { id: 123, - accountId: undefined, nickname: "Checking Account", bankName: "Chase Bank", routingAccount: "021000021", @@ -696,7 +2013,6 @@ describe("MoneyOut", () => { PaymentMethod: "vcard", VendorStatus: 1, VendorId: 339, - EnrollmentStatus: undefined, Summary: { ActiveBills: 1, ActiveBillsAmount: 1.1, @@ -728,22 +2044,14 @@ describe("MoneyOut", () => { remitState: "FL", remitZip: "31113", remitCountry: "US", - payeeName1: undefined, - payeeName2: undefined, customField1: "customField1", customField2: "customField2", - customerVendorAccount: undefined, InternalReferenceId: 27, - additionalData: undefined, - externalPaypointID: undefined, - StoredMethods: undefined, }, - associatedCustomer: undefined, ParentOrgName: "HOA Manager Pro", PaypointDbaname: "Athlete Factory LLC", PaypointLegalname: "Athlete Factory LLC", PaypointEntryname: "47acde49", - externalPaypointID: undefined, paypointId: 12345, }; server @@ -761,18 +2069,12 @@ describe("MoneyOut", () => { cardNumber: "553232XXXXXX3179", cvc: "XXX", expirationDate: "2025-05-01", - status: undefined, amount: 120, currentBalance: 120, expenseLimit: 20, - expenseLimitPeriod: undefined, maxNumberOfUses: 1, currentNumberOfUses: 0, exactAmount: true, - mcc: undefined, - tcc: undefined, - misc1: undefined, - misc2: undefined, dateCreated: "2023-12-06T20:25:31.077", dateModified: "2023-12-06T00:00:00", associatedVendor: { @@ -782,7 +2084,6 @@ describe("MoneyOut", () => { EIN: "12-3456789", Phone: "555-123-4567", Email: "contact@smithindustries.com", - RemitEmail: undefined, Address1: "1234 Main Street", Address2: "Suite 200", City: "New York", @@ -790,7 +2091,6 @@ describe("MoneyOut", () => { Zip: "10001", Country: "USA", Mcc: "5411", - LocationCode: undefined, Contacts: [ { ContactName: "Herman Martinez", @@ -801,7 +2101,6 @@ describe("MoneyOut", () => { ], BillingData: { id: 123, - accountId: undefined, nickname: "Checking Account", bankName: "Chase Bank", routingAccount: "021000021", @@ -818,7 +2117,6 @@ describe("MoneyOut", () => { PaymentMethod: "vcard", VendorStatus: 1, VendorId: 339, - EnrollmentStatus: undefined, Summary: { ActiveBills: 1, ActiveBillsAmount: 1.1, @@ -850,29 +2148,93 @@ describe("MoneyOut", () => { remitState: "FL", remitZip: "31113", remitCountry: "US", - payeeName1: undefined, - payeeName2: undefined, customField1: "customField1", customField2: "customField2", - customerVendorAccount: undefined, InternalReferenceId: 27, - additionalData: undefined, - externalPaypointID: undefined, - StoredMethods: undefined, }, - associatedCustomer: undefined, ParentOrgName: "HOA Manager Pro", PaypointDbaname: "Athlete Factory LLC", PaypointLegalname: "Athlete Factory LLC", PaypointEntryname: "47acde49", - externalPaypointID: undefined, paypointId: 12345, }); }); - test("SendVCardLink", async () => { + test("VCardGet (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/vcard/cardToken") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.vCardGet("cardToken"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("VCardGet (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/vcard/cardToken") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.vCardGet("cardToken"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("VCardGet (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/vcard/cardToken") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.vCardGet("cardToken"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("VCardGet (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyOut/vcard/cardToken") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.vCardGet("cardToken"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SendVCardLink (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { transId: "01K33Z6YQZ6GD5QVKZ856MJBSC" }; const rawResponseBody = { message: "Successfully sent email to: vendor@vendor.com", success: true }; server @@ -893,9 +2255,93 @@ describe("MoneyOut", () => { }); }); - test("GetCheckImage", async () => { + test("SendVCardLink (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { transId: "transId" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/vcard/send-card-link") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.sendVCardLink({ + transId: "transId", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SendVCardLink (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { transId: "transId" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/vcard/send-card-link") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.sendVCardLink({ + transId: "transId", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SendVCardLink (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { transId: "transId" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/vcard/send-card-link") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.sendVCardLink({ + transId: "transId", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SendVCardLink (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { transId: "transId" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/vcard/send-card-link") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.sendVCardLink({ + transId: "transId", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetCheckImage (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = '%PDF-1.7\n%����\n123 0 obj\n<>\nendobj\n\n124 0 obj\n<>/Filter/FlateDecode/ID[<12345678ABCDEF9876543210FEDCBA98>]/Index[123 100]/Info 122 0 R/Length 128/Prev 123450/Root 125 0 R/Size 223/Type/XRef/W[1 3 1]>>stream\nh�bbd```b``�\n"x�a7�r�H~�����A�D���2����m�f��L`v6�H����D���J[@����H8�I��)0��q� XD��`��a���P�`�`��"�A$������r���p�$�Ip������a� �'; @@ -912,4 +2358,76 @@ describe("MoneyOut", () => { '%PDF-1.7\n%\uFFFD\uFFFD\uFFFD\uFFFD\n123 0 obj\n<>\nendobj\n\n124 0 obj\n<>/Filter/FlateDecode/ID[<12345678ABCDEF9876543210FEDCBA98>]/Index[123 100]/Info 122 0 R/Length 128/Prev 123450/Root 125 0 R/Size 223/Type/XRef/W[1 3 1]>>stream\nh\uFFFDbbd```b``\uFFFD\n"x\uFFFDa7\uFFFDr\uFFFDH~\uFFFD\uFFFD\uFFFD\uFFFD\uFFFDA\uFFFDD\uFFFD\uFFFD\uFFFD2\uFFFD\uFFFD\uFFFD\uFFFDm\uFFFDf\uFFFD\uFFFDL`v6\uFFFDH\uFFFD\uFFFD\uFFFD\uFFFDD\uFFFD\uFFFD\uFFFDJ[@\uFFFD\uFFFD\uFFFD\uFFFDH8\uFFFDI\uFFFD\uFFFD)0\uFFFD\uFFFDq\uFFFD XD\uFFFD\uFFFD`\uFFFD\uFFFDa\uFFFD\uFFFD\uFFFDP\uFFFD`\uFFFD`\uFFFD\uFFFD"\uFFFDA$\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFDr\uFFFD\uFFFD\uFFFDp\uFFFD$\uFFFDIp\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFDa\uFFFD \uFFFD', ); }); + + test("GetCheckImage (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/checkimage/assetName") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.getCheckImage("assetName"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetCheckImage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/checkimage/assetName") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.getCheckImage("assetName"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetCheckImage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/MoneyOut/checkimage/assetName") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.getCheckImage("assetName"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetCheckImage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/MoneyOut/checkimage/assetName") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.moneyOut.getCheckImage("assetName"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/notification.test.ts b/tests/wire/notification.test.ts index 035efcf2..45354a92 100644 --- a/tests/wire/notification.test.ts +++ b/tests/wire/notification.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Notification", () => { - test("AddNotification", async () => { +describe("NotificationClient", () => { + test("AddNotification (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { content: { eventType: "CreatedApplication" }, frequency: "untilcancelled", @@ -47,9 +46,156 @@ describe("Notification", () => { }); }); - test("DeleteNotification", async () => { + test("AddNotification (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + content: { + eventType: "Report", + fileFormat: "json", + reportName: "Transaction", + timeZone: -5, + transactionId: "0", + }, + frequency: "biweekly", + method: "report-email", + ownerId: "236", + ownerType: 0, + status: 1, + target: "admin@example.com", + }; + const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 1717, responseText: "Success" }; + server + .mockEndpoint() + .post("/Notification") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.notification.addNotification({ + content: { + eventType: "Report", + fileFormat: "json", + reportName: "Transaction", + timeZone: -5, + transactionId: "0", + }, + frequency: "biweekly", + method: "report-email", + ownerId: "236", + ownerType: 0, + status: 1, + target: "admin@example.com", + }); + expect(response).toEqual({ + isSuccess: true, + responseCode: 1, + responseData: 1717, + responseText: "Success", + }); + }); + + test("AddNotification (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Notification") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.addNotification({ + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddNotification (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Notification") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.addNotification({ + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddNotification (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Notification") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.addNotification({ + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddNotification (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Notification") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.addNotification({ + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteNotification (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 1717, responseText: "Success" }; server @@ -69,9 +215,81 @@ describe("Notification", () => { }); }); - test("GetNotification", async () => { + test("DeleteNotification (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Notification/nId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.deleteNotification("nId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteNotification (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Notification/nId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.deleteNotification("nId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteNotification (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Notification/nId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.deleteNotification("nId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteNotification (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/Notification/nId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.deleteNotification("nId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetNotification (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { content: { fileFormat: "csv", reportName: "Returned" }, @@ -107,9 +325,57 @@ describe("Notification", () => { }); }); - test("UpdateNotification", async () => { + test("GetNotification (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Notification/nId").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.notification.getNotification("nId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetNotification (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Notification/nId").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.notification.getNotification("nId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetNotification (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Notification/nId").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.notification.getNotification("nId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetNotification (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Notification/nId").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.notification.getNotification("nId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateNotification (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { content: { eventType: "ApprovedPayment" }, frequency: "untilcancelled", @@ -148,9 +414,105 @@ describe("Notification", () => { }); }); - test("GetReportFile", async () => { + test("UpdateNotification (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Notification/nId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.updateNotification("nId", { + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateNotification (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Notification/nId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.updateNotification("nId", { + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateNotification (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Notification/nId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.updateNotification("nId", { + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateNotification (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { frequency: "one-time", method: "email", ownerType: 1, target: "target" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Notification/nId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.updateNotification("nId", { + frequency: "one-time", + method: "email", + ownerType: 1, + target: "target", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetReportFile (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { key: "value" }; server @@ -166,4 +528,76 @@ describe("Notification", () => { key: "value", }); }); + + test("GetReportFile (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/notificationReport/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.getReportFile(1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetReportFile (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/notificationReport/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.getReportFile(1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetReportFile (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Export/notificationReport/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.getReportFile(1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetReportFile (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Export/notificationReport/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notification.getReportFile(1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/notificationlogs.test.ts b/tests/wire/notificationlogs.test.ts index e872856f..4621e467 100644 --- a/tests/wire/notificationlogs.test.ts +++ b/tests/wire/notificationlogs.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Notificationlogs", () => { - test("searchNotificationLogs", async () => { +describe("NotificationlogsClient", () => { + test("searchNotificationLogs (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { startDate: "2024-01-01T00:00:00Z", endDate: "2024-01-31T23:59:59Z", @@ -69,9 +68,105 @@ describe("Notificationlogs", () => { ]); }); - test("getNotificationLog", async () => { + test("searchNotificationLogs (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { startDate: "2024-01-15T09:30:00Z", endDate: "2024-01-15T09:30:00Z" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.searchNotificationLogs({ + body: { + startDate: "2024-01-15T09:30:00Z", + endDate: "2024-01-15T09:30:00Z", + }, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("searchNotificationLogs (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { startDate: "2024-01-15T09:30:00Z", endDate: "2024-01-15T09:30:00Z" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.searchNotificationLogs({ + body: { + startDate: "2024-01-15T09:30:00Z", + endDate: "2024-01-15T09:30:00Z", + }, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("searchNotificationLogs (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { startDate: "2024-01-15T09:30:00Z", endDate: "2024-01-15T09:30:00Z" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.searchNotificationLogs({ + body: { + startDate: "2024-01-15T09:30:00Z", + endDate: "2024-01-15T09:30:00Z", + }, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("searchNotificationLogs (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { startDate: "2024-01-15T09:30:00Z", endDate: "2024-01-15T09:30:00Z" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/v2/notificationlogs") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.searchNotificationLogs({ + body: { + startDate: "2024-01-15T09:30:00Z", + endDate: "2024-01-15T09:30:00Z", + }, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getNotificationLog (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { id: "550e8400-e29b-41d4-a716-446655440000", @@ -142,9 +237,81 @@ describe("Notificationlogs", () => { }); }); - test("retryNotificationLog", async () => { + test("getNotificationLog (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.getNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getNotificationLog (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.getNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getNotificationLog (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.getNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getNotificationLog (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.getNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("retryNotificationLog (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { id: "550e8400-e29b-41d4-a716-446655440000", @@ -201,9 +368,81 @@ describe("Notificationlogs", () => { }); }); - test("bulkRetryNotificationLogs", async () => { + test("retryNotificationLog (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32/retry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.retryNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("retryNotificationLog (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32/retry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.retryNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("retryNotificationLog (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32/retry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.retryNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("retryNotificationLog (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/v2/notificationlogs/d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32/retry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.retryNotificationLog("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("bulkRetryNotificationLogs (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = [ "550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440001", @@ -225,4 +464,92 @@ describe("Notificationlogs", () => { ]); expect(response).toEqual(undefined); }); + + test("bulkRetryNotificationLogs (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs/retry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.bulkRetryNotificationLogs([ + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ]); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("bulkRetryNotificationLogs (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs/retry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.bulkRetryNotificationLogs([ + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ]); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("bulkRetryNotificationLogs (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"]; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/v2/notificationlogs/retry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.bulkRetryNotificationLogs([ + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ]); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("bulkRetryNotificationLogs (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = ["d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"]; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/v2/notificationlogs/retry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.notificationlogs.bulkRetryNotificationLogs([ + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ]); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/ocr.test.ts b/tests/wire/ocr.test.ts index 1a998031..fb37af29 100644 --- a/tests/wire/ocr.test.ts +++ b/tests/wire/ocr.test.ts @@ -1,15 +1,14 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Ocr", () => { - test("OcrDocumentForm", async () => { +describe("OcrClient", () => { + test("OcrDocumentForm (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { ftype: undefined, filename: undefined, furl: undefined, fContent: undefined }; + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "responseText", @@ -75,22 +74,7 @@ describe("Ocr", () => { country: "country", mcc: "mcc", locationCode: "locationCode", - contacts: [ - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - ], + contacts: [{}, {}], billingData: { id: 1, bankName: "bankName", @@ -150,12 +134,7 @@ describe("Ocr", () => { .jsonBody(rawResponseBody) .build(); - const response = await client.ocr.ocrDocumentForm("typeResult", { - ftype: undefined, - filename: undefined, - furl: undefined, - fContent: undefined, - }); + const response = await client.ocr.ocrDocumentForm("typeResult", {}); expect(response).toEqual({ isSuccess: true, responseText: "responseText", @@ -221,22 +200,7 @@ describe("Ocr", () => { country: "country", mcc: "mcc", locationCode: "locationCode", - contacts: [ - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - ], + contacts: [{}, {}], billingData: { id: 1, bankName: "bankName", @@ -291,10 +255,86 @@ describe("Ocr", () => { }); }); - test("OcrDocumentJson", async () => { + test("OcrDocumentForm (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentForm/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentForm("typeResult", {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("OcrDocumentForm (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentForm/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentForm("typeResult", {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("OcrDocumentForm (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentForm/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentForm("typeResult", {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("OcrDocumentForm (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentForm/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentForm("typeResult", {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("OcrDocumentJson (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { ftype: undefined, filename: undefined, furl: undefined, fContent: undefined }; + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "responseText", @@ -360,22 +400,7 @@ describe("Ocr", () => { country: "country", mcc: "mcc", locationCode: "locationCode", - contacts: [ - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - ], + contacts: [{}, {}], billingData: { id: 1, bankName: "bankName", @@ -435,12 +460,7 @@ describe("Ocr", () => { .jsonBody(rawResponseBody) .build(); - const response = await client.ocr.ocrDocumentJson("typeResult", { - ftype: undefined, - filename: undefined, - furl: undefined, - fContent: undefined, - }); + const response = await client.ocr.ocrDocumentJson("typeResult", {}); expect(response).toEqual({ isSuccess: true, responseText: "responseText", @@ -506,22 +526,7 @@ describe("Ocr", () => { country: "country", mcc: "mcc", locationCode: "locationCode", - contacts: [ - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - { - contactEmail: undefined, - contactName: undefined, - contactPhone: undefined, - contactTitle: undefined, - additionalData: undefined, - }, - ], + contacts: [{}, {}], billingData: { id: 1, bankName: "bankName", @@ -575,4 +580,80 @@ describe("Ocr", () => { }, }); }); + + test("OcrDocumentJson (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentJson/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentJson("typeResult", {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("OcrDocumentJson (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentJson/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentJson("typeResult", {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("OcrDocumentJson (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentJson/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentJson("typeResult", {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("OcrDocumentJson (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Import/ocrDocumentJson/typeResult") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.ocr.ocrDocumentJson("typeResult", {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/organization.test.ts b/tests/wire/organization.test.ts index 936c744c..df443f8f 100644 --- a/tests/wire/organization.test.ts +++ b/tests/wire/organization.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Organization", () => { - test("AddOrganization", async () => { +describe("OrganizationClient", () => { + test("AddOrganization (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { billingInfo: { achAccount: "123123123", @@ -108,9 +107,101 @@ describe("Organization", () => { }); }); - test("DeleteOrganization", async () => { + test("AddOrganization (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { orgName: "orgName", orgType: 1, replyToEmail: "replyToEmail" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.addOrganization({ + orgName: "orgName", + orgType: 1, + replyToEmail: "replyToEmail", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { orgName: "orgName", orgType: 1, replyToEmail: "replyToEmail" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.addOrganization({ + orgName: "orgName", + orgType: 1, + replyToEmail: "replyToEmail", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { orgName: "orgName", orgType: 1, replyToEmail: "replyToEmail" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.addOrganization({ + orgName: "orgName", + orgType: 1, + replyToEmail: "replyToEmail", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { orgName: "orgName", orgType: 1, replyToEmail: "replyToEmail" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.addOrganization({ + orgName: "orgName", + orgType: 1, + replyToEmail: "replyToEmail", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteOrganization (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseData: 245, responseText: "Success" }; server @@ -129,9 +220,57 @@ describe("Organization", () => { }); }); - test("EditOrganization", async () => { + test("DeleteOrganization (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Organization/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.organization.deleteOrganization(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteOrganization (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Organization/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.organization.deleteOrganization(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Organization/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.organization.deleteOrganization(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Organization/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.organization.deleteOrganization(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditOrganization (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contacts: [ { @@ -192,9 +331,85 @@ describe("Organization", () => { }); }); - test("GetBasicOrganization", async () => { + test("EditOrganization (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Organization/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.editOrganization(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Organization/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.editOrganization(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Organization/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.editOrganization(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Organization/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.editOrganization(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetBasicOrganization (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { services: [ @@ -382,9 +597,81 @@ describe("Organization", () => { }); }); - test("GetBasicOrganizationById", async () => { + test("GetBasicOrganization (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basic/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganization("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetBasicOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basic/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganization("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetBasicOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basic/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganization("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetBasicOrganization (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Organization/basic/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganization("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetBasicOrganizationById (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { services: [ @@ -572,9 +859,81 @@ describe("Organization", () => { }); }); - test("GetOrganization", async () => { + test("GetBasicOrganizationById (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basicById/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganizationById(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetBasicOrganizationById (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basicById/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganizationById(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetBasicOrganizationById (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/basicById/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganizationById(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetBasicOrganizationById (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Organization/basicById/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getBasicOrganizationById(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetOrganization (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { services: [ @@ -762,9 +1121,81 @@ describe("Organization", () => { }); }); - test("GetSettingsOrganization", async () => { + test("GetOrganization (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/read/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getOrganization(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/read/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getOrganization(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetOrganization (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/read/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getOrganization(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Organization/read/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getOrganization(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetSettingsOrganization (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { customFields: [{ key: "key", readOnly: false, value: "value" }], @@ -828,4 +1259,76 @@ describe("Organization", () => { ], }); }); + + test("GetSettingsOrganization (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/settings/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getSettingsOrganization(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetSettingsOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/settings/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getSettingsOrganization(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetSettingsOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Organization/settings/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getSettingsOrganization(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetSettingsOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Organization/settings/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.organization.getSettingsOrganization(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/paymentLink.test.ts b/tests/wire/paymentLink.test.ts index f1d50bb7..2c1239c4 100644 --- a/tests/wire/paymentLink.test.ts +++ b/tests/wire/paymentLink.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("PaymentLink", () => { - test("AddPayLinkFromInvoice", async () => { +describe("PaymentLinkClient", () => { + test("AddPayLinkFromInvoice (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactUs: { emailLabel: "Email", @@ -212,9 +211,93 @@ describe("PaymentLink", () => { }); }); - test("AddPayLinkFromBill", async () => { + test("AddPayLinkFromInvoice (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddPayLinkFromInvoice (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddPayLinkFromInvoice (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddPayLinkFromInvoice (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentLink/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromInvoice(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("AddPayLinkFromBill (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactUs: { emailLabel: "Email", @@ -367,9 +450,93 @@ describe("PaymentLink", () => { }); }); - test("deletePayLinkFromId", async () => { + test("AddPayLinkFromBill (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBill(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddPayLinkFromBill (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBill(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddPayLinkFromBill (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBill(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddPayLinkFromBill (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBill(1, { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("deletePayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -392,9 +559,81 @@ describe("PaymentLink", () => { }); }); - test("getPayLinkFromId", async () => { + test("deletePayLinkFromId (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentLink/payLinkId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.deletePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("deletePayLinkFromId (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentLink/payLinkId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.deletePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("deletePayLinkFromId (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentLink/payLinkId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.deletePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("deletePayLinkFromId (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/PaymentLink/payLinkId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.deletePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getPayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -557,9 +796,81 @@ describe("PaymentLink", () => { }); }); - test("pushPayLinkFromId", async () => { + test("getPayLinkFromId (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/load/paylinkId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.getPayLinkFromId("paylinkId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getPayLinkFromId (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/load/paylinkId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.getPayLinkFromId("paylinkId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getPayLinkFromId (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/load/paylinkId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.getPayLinkFromId("paylinkId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getPayLinkFromId (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/PaymentLink/load/paylinkId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.getPayLinkFromId("paylinkId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("pushPayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { channel: "sms" }; const rawResponseBody = { isSuccess: true, @@ -585,9 +896,127 @@ describe("PaymentLink", () => { }); }); - test("refreshPayLinkFromId", async () => { + test("pushPayLinkFromId (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + channel: "email", + additionalEmails: ["admin@example.com", "accounting@example.com"], + attachFile: true, + }; + const rawResponseBody = { + isSuccess: true, + responseData: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234", + responseText: "Success", + }; + server + .mockEndpoint() + .post("/PaymentLink/push/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.paymentLink.pushPayLinkFromId("payLinkId", { + channel: "email", + additionalEmails: ["admin@example.com", "accounting@example.com"], + attachFile: true, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: "2325-XXXXXXX-90b1-4598-b6c7-44cdcbf495d7-1234", + responseText: "Success", + }); + }); + + test("pushPayLinkFromId (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { channel: "email" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/push/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.pushPayLinkFromId("payLinkId", { + channel: "email", + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("pushPayLinkFromId (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { channel: "email" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/push/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.pushPayLinkFromId("payLinkId", { + channel: "email", + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("pushPayLinkFromId (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { channel: "email" }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/push/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.pushPayLinkFromId("payLinkId", { + channel: "email", + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("pushPayLinkFromId (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { channel: "email" }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentLink/push/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.pushPayLinkFromId("payLinkId", { + channel: "email", + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("refreshPayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -610,9 +1039,81 @@ describe("PaymentLink", () => { }); }); - test("sendPayLinkFromId", async () => { + test("refreshPayLinkFromId (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/refresh/payLinkId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.refreshPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("refreshPayLinkFromId (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/refresh/payLinkId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.refreshPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("refreshPayLinkFromId (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/refresh/payLinkId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.refreshPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("refreshPayLinkFromId (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/PaymentLink/refresh/payLinkId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.refreshPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("sendPayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -637,9 +1138,81 @@ describe("PaymentLink", () => { }); }); - test("updatePayLinkFromId", async () => { + test("sendPayLinkFromId (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/send/payLinkId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.sendPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("sendPayLinkFromId (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/send/payLinkId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.sendPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("sendPayLinkFromId (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentLink/send/payLinkId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.sendPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("sendPayLinkFromId (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/PaymentLink/send/payLinkId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.sendPayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("updatePayLinkFromId (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { notes: { enabled: true, @@ -681,9 +1254,85 @@ describe("PaymentLink", () => { }); }); - test("AddPayLinkFromBillLotNumber", async () => { + test("updatePayLinkFromId (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/PaymentLink/update/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.updatePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("updatePayLinkFromId (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/PaymentLink/update/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.updatePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("updatePayLinkFromId (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/PaymentLink/update/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.updatePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("updatePayLinkFromId (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/PaymentLink/update/payLinkId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.updatePayLinkFromId("payLinkId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("AddPayLinkFromBillLotNumber (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { contactUs: { emailLabel: "Email", @@ -838,4 +1487,96 @@ describe("PaymentLink", () => { responseText: "Success", }); }); + + test("AddPayLinkFromBillLotNumber (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/lotNumber/lotNumber") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBillLotNumber("lotNumber", { + entryPoint: "entryPoint", + vendorNumber: "vendorNumber", + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddPayLinkFromBillLotNumber (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/lotNumber/lotNumber") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBillLotNumber("lotNumber", { + entryPoint: "entryPoint", + vendorNumber: "vendorNumber", + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddPayLinkFromBillLotNumber (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/lotNumber/lotNumber") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBillLotNumber("lotNumber", { + entryPoint: "entryPoint", + vendorNumber: "vendorNumber", + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddPayLinkFromBillLotNumber (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentLink/bill/lotNumber/lotNumber") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentLink.addPayLinkFromBillLotNumber("lotNumber", { + entryPoint: "entryPoint", + vendorNumber: "vendorNumber", + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/paymentMethodDomain.test.ts b/tests/wire/paymentMethodDomain.test.ts index 0ad08867..e9e3ad56 100644 --- a/tests/wire/paymentMethodDomain.test.ts +++ b/tests/wire/paymentMethodDomain.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("PaymentMethodDomain", () => { - test("AddPaymentMethodDomain", async () => { +describe("PaymentMethodDomainClient", () => { + test("AddPaymentMethodDomain (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { domainName: "checkout.example.com", entityId: 109, @@ -25,29 +24,26 @@ describe("PaymentMethodDomain", () => { entityId: 109, entityType: "paypoint", domainName: "checkout.example.com", - applePay: { isEnabled: true, data: undefined }, - googlePay: { isEnabled: true, data: undefined }, + applePay: { isEnabled: true }, + googlePay: { isEnabled: true }, ownerEntityId: 109, ownerEntityType: "paypoint", cascades: [ { jobId: "1030398", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, { jobId: "611502", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2026-09-26T22:25:45.095Z", updatedAt: "2026-09-26T22:25:46.187Z", }, { jobId: "611172", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2026-09-26T19:46:40.075Z", updatedAt: "2026-09-26T19:47:13.548Z", }, @@ -88,11 +84,9 @@ describe("PaymentMethodDomain", () => { domainName: "checkout.example.com", applePay: { isEnabled: true, - data: undefined, }, googlePay: { isEnabled: true, - data: undefined, }, ownerEntityId: 109, ownerEntityType: "paypoint", @@ -100,21 +94,18 @@ describe("PaymentMethodDomain", () => { { jobId: "1030398", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, { jobId: "611502", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2026-09-26T22:25:45.095Z", updatedAt: "2026-09-26T22:25:46.187Z", }, { jobId: "611172", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2026-09-26T19:46:40.075Z", updatedAt: "2026-09-26T19:47:13.548Z", }, @@ -126,9 +117,85 @@ describe("PaymentMethodDomain", () => { }); }); - test("CascadePaymentMethodDomain", async () => { + test("AddPaymentMethodDomain (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.addPaymentMethodDomain(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddPaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.addPaymentMethodDomain(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddPaymentMethodDomain (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.addPaymentMethodDomain(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddPaymentMethodDomain (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.addPaymentMethodDomain(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CascadePaymentMethodDomain (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -139,15 +206,14 @@ describe("PaymentMethodDomain", () => { entityId: 78, entityType: "organization", domainName: "checkout.example.com", - applePay: { isEnabled: true, data: undefined }, - googlePay: { isEnabled: true, data: undefined }, + applePay: { isEnabled: true }, + googlePay: { isEnabled: true }, ownerEntityId: 78, ownerEntityType: "organization", cascades: [ { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -179,11 +245,9 @@ describe("PaymentMethodDomain", () => { domainName: "checkout.example.com", applePay: { isEnabled: true, - data: undefined, }, googlePay: { isEnabled: true, - data: undefined, }, ownerEntityId: 78, ownerEntityType: "organization", @@ -191,7 +255,6 @@ describe("PaymentMethodDomain", () => { { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -203,9 +266,81 @@ describe("PaymentMethodDomain", () => { }); }); - test("DeletePaymentMethodDomain", async () => { + test("CascadePaymentMethodDomain (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/cascade") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.cascadePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CascadePaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/cascade") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.cascadePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CascadePaymentMethodDomain (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/cascade") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.cascadePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CascadePaymentMethodDomain (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/cascade") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.cascadePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeletePaymentMethodDomain (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -232,9 +367,81 @@ describe("PaymentMethodDomain", () => { }); }); - test("GetPaymentMethodDomain", async () => { + test("DeletePaymentMethodDomain (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.deletePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeletePaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.deletePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeletePaymentMethodDomain (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.deletePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeletePaymentMethodDomain (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.deletePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetPaymentMethodDomain (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { id: "pmd_b8237fa45c964d8a9ef27160cd42b8c5", @@ -242,8 +449,8 @@ describe("PaymentMethodDomain", () => { entityId: 78, entityType: "organization", domainName: "checkout.example.com", - applePay: { isEnabled: true, data: undefined }, - googlePay: { isEnabled: true, data: undefined }, + applePay: { isEnabled: true }, + googlePay: { isEnabled: true }, ownerEntityId: 78, ownerEntityType: "organization", cascades: [ @@ -276,11 +483,9 @@ describe("PaymentMethodDomain", () => { domainName: "checkout.example.com", applePay: { isEnabled: true, - data: undefined, }, googlePay: { isEnabled: true, - data: undefined, }, ownerEntityId: 78, ownerEntityType: "organization", @@ -297,9 +502,81 @@ describe("PaymentMethodDomain", () => { }); }); - test("ListPaymentMethodDomains", async () => { + test("GetPaymentMethodDomain (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.getPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetPaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.getPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetPaymentMethodDomain (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.getPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetPaymentMethodDomain (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/domainId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.getPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListPaymentMethodDomains (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { records: [ @@ -425,9 +702,174 @@ describe("PaymentMethodDomain", () => { }); }); - test("UpdatePaymentMethodDomain", async () => { + test("ListPaymentMethodDomains (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + records: [ + { + id: "pmd_1bed085c821e432fa71ae0817c571dd6", + type: "PaymentMethodDomains", + entityId: 39, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { isEnabled: true }, + googlePay: { isEnabled: false }, + ownerEntityId: 39, + ownerEntityType: "organization", + createdAt: "2026-09-27T01:20:17.486Z", + updatedAt: "2025-03-26T23:55:36.876Z", + }, + { + id: "pmd_dab1e3d2a3774216920bdc2afd62c307", + type: "PaymentMethodDomains", + entityId: 39, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { isEnabled: true }, + googlePay: { isEnabled: false }, + ownerEntityId: 39, + ownerEntityType: "organization", + createdAt: "2026-08-23T03:42:06.673Z", + updatedAt: "2025-03-26T23:56:15.708Z", + }, + ], + summary: { pageIdentifier: "pageIdentifier", pageSize: 20, totalPages: 1, totalRecords: 2 }, + }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/list") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.paymentMethodDomain.listPaymentMethodDomains({ + entityId: 39, + entityType: "organization", + }); + expect(response).toEqual({ + records: [ + { + id: "pmd_1bed085c821e432fa71ae0817c571dd6", + type: "PaymentMethodDomains", + entityId: 39, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { + isEnabled: true, + }, + googlePay: { + isEnabled: false, + }, + ownerEntityId: 39, + ownerEntityType: "organization", + createdAt: "2026-09-27T01:20:17.486Z", + updatedAt: "2025-03-26T23:55:36.876Z", + }, + { + id: "pmd_dab1e3d2a3774216920bdc2afd62c307", + type: "PaymentMethodDomains", + entityId: 39, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { + isEnabled: true, + }, + googlePay: { + isEnabled: false, + }, + ownerEntityId: 39, + ownerEntityType: "organization", + createdAt: "2026-08-23T03:42:06.673Z", + updatedAt: "2025-03-26T23:56:15.708Z", + }, + ], + summary: { + pageIdentifier: "pageIdentifier", + pageSize: 20, + totalPages: 1, + totalRecords: 2, + }, + }); + }); + + test("ListPaymentMethodDomains (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/list") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.listPaymentMethodDomains(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListPaymentMethodDomains (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/list") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.listPaymentMethodDomains(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListPaymentMethodDomains (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/list") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.listPaymentMethodDomains(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListPaymentMethodDomains (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/PaymentMethodDomain/list") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.listPaymentMethodDomains(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdatePaymentMethodDomain (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { applePay: { isEnabled: false }, googlePay: { isEnabled: false } }; const rawResponseBody = { isSuccess: true, @@ -438,15 +880,14 @@ describe("PaymentMethodDomain", () => { entityId: 78, entityType: "organization", domainName: "checkout.example.com", - applePay: { isEnabled: false, data: undefined }, - googlePay: { isEnabled: false, data: undefined }, + applePay: { isEnabled: false }, + googlePay: { isEnabled: false }, ownerEntityId: 78, ownerEntityType: "organization", cascades: [ { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -487,11 +928,9 @@ describe("PaymentMethodDomain", () => { domainName: "checkout.example.com", applePay: { isEnabled: false, - data: undefined, }, googlePay: { isEnabled: false, - data: undefined, }, ownerEntityId: 78, ownerEntityType: "organization", @@ -499,7 +938,6 @@ describe("PaymentMethodDomain", () => { { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -511,9 +949,85 @@ describe("PaymentMethodDomain", () => { }); }); - test("VerifyPaymentMethodDomain", async () => { + test("UpdatePaymentMethodDomain (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/PaymentMethodDomain/domainId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.updatePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdatePaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/PaymentMethodDomain/domainId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.updatePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdatePaymentMethodDomain (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .patch("/PaymentMethodDomain/domainId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.updatePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdatePaymentMethodDomain (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .patch("/PaymentMethodDomain/domainId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.updatePaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("VerifyPaymentMethodDomain (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -524,15 +1038,14 @@ describe("PaymentMethodDomain", () => { entityId: 78, entityType: "organization", domainName: "checkout.example.com", - applePay: { isEnabled: true, data: undefined }, - googlePay: { isEnabled: true, data: undefined }, + applePay: { isEnabled: true }, + googlePay: { isEnabled: true }, ownerEntityId: 78, ownerEntityType: "organization", cascades: [ { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -564,11 +1077,9 @@ describe("PaymentMethodDomain", () => { domainName: "checkout.example.com", applePay: { isEnabled: true, - data: undefined, }, googlePay: { isEnabled: true, - data: undefined, }, ownerEntityId: 78, ownerEntityType: "organization", @@ -576,7 +1087,6 @@ describe("PaymentMethodDomain", () => { { jobId: "1245697", jobStatus: "completed", - jobErrorMessage: undefined, createdAt: "2025-04-25T15:37:28.685Z", updatedAt: "2025-04-25T15:37:33.228Z", }, @@ -587,4 +1097,177 @@ describe("PaymentMethodDomain", () => { responseText: "Success", }); }); + + test("VerifyPaymentMethodDomain (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + isSuccess: false, + pageidentifier: "null", + responseData: { + id: "pmd_b8237fa45c964d8a9ef27160cd42b8c5", + type: "PaymentMethodDomains", + entityId: 78, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { + isEnabled: true, + data: { + errorMessage: + "Unable to validate the domain. Verification file not found at https://checkout.example.com/.well-known/apple-developer-merchantid-domain-association", + metadata: { isFileAvailable: false, isFileContentValid: false, statusCode: 404 }, + }, + }, + googlePay: { + isEnabled: true, + data: { + errorMessage: "Unable to validate the domain. Domain not found.", + metadata: { statusCode: 404 }, + }, + }, + ownerEntityId: 78, + ownerEntityType: "organization", + cascades: [ + { + jobId: "1245697", + jobStatus: "completed", + createdAt: "2025-04-25T15:37:28.685Z", + updatedAt: "2025-04-25T15:37:33.228Z", + }, + ], + createdAt: "2025-03-15T10:24:36.207Z", + updatedAt: "2025-04-25T15:45:21.517Z", + }, + responseText: "Failed", + }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/pmd_b8237fa45c964d8a9ef27160cd42b8c5/verify") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.paymentMethodDomain.verifyPaymentMethodDomain( + "pmd_b8237fa45c964d8a9ef27160cd42b8c5", + ); + expect(response).toEqual({ + isSuccess: false, + pageidentifier: "null", + responseData: { + id: "pmd_b8237fa45c964d8a9ef27160cd42b8c5", + type: "PaymentMethodDomains", + entityId: 78, + entityType: "organization", + domainName: "checkout.example.com", + applePay: { + isEnabled: true, + data: { + errorMessage: + "Unable to validate the domain. Verification file not found at https://checkout.example.com/.well-known/apple-developer-merchantid-domain-association", + metadata: { + isFileAvailable: false, + isFileContentValid: false, + statusCode: 404, + }, + }, + }, + googlePay: { + isEnabled: true, + data: { + errorMessage: "Unable to validate the domain. Domain not found.", + metadata: { + statusCode: 404, + }, + }, + }, + ownerEntityId: 78, + ownerEntityType: "organization", + cascades: [ + { + jobId: "1245697", + jobStatus: "completed", + createdAt: "2025-04-25T15:37:28.685Z", + updatedAt: "2025-04-25T15:37:33.228Z", + }, + ], + createdAt: "2025-03-15T10:24:36.207Z", + updatedAt: "2025-04-25T15:45:21.517Z", + }, + responseText: "Failed", + }); + }); + + test("VerifyPaymentMethodDomain (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/verify") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.verifyPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("VerifyPaymentMethodDomain (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/verify") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.verifyPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("VerifyPaymentMethodDomain (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/verify") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.verifyPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("VerifyPaymentMethodDomain (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/PaymentMethodDomain/domainId/verify") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paymentMethodDomain.verifyPaymentMethodDomain("domainId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/paypoint.test.ts b/tests/wire/paypoint.test.ts index 0340cabf..d65b71f5 100644 --- a/tests/wire/paypoint.test.ts +++ b/tests/wire/paypoint.test.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; -import { PayabliClient } from "../../src/Client"; import * as Payabli from "../../src/api/index"; +import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Paypoint", () => { - test("getBasicEntry", async () => { +describe("PaypointClient", () => { + test("getBasicEntry (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -126,9 +124,81 @@ describe("Paypoint", () => { }); }); - test("getBasicEntryById", async () => { + test("getBasicEntry (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basic/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntry("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getBasicEntry (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basic/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntry("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getBasicEntry (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basic/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntry("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getBasicEntry (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Paypoint/basic/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntry("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getBasicEntryById (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -245,9 +315,81 @@ describe("Paypoint", () => { }); }); - test("getEntryConfig", async () => { + test("getBasicEntryById (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basicById/IdPaypoint") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntryById("IdPaypoint"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getBasicEntryById (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basicById/IdPaypoint") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntryById("IdPaypoint"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getBasicEntryById (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/basicById/IdPaypoint") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntryById("IdPaypoint"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getBasicEntryById (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Paypoint/basicById/IdPaypoint") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getBasicEntryById("IdPaypoint"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getEntryConfig (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -364,9 +506,57 @@ describe("Paypoint", () => { }); }); - test("getPage", async () => { + test("getEntryConfig (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Paypoint/entry").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.paypoint.getEntryConfig("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getEntryConfig (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Paypoint/entry").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.paypoint.getEntryConfig("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getEntryConfig (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Paypoint/entry").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.paypoint.getEntryConfig("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getEntryConfig (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Paypoint/entry").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.paypoint.getEntryConfig("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getPage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { AdditionalData: { key1: { key: "value" }, key2: { key: "value" }, key3: { key: "value" } }, @@ -657,9 +847,81 @@ describe("Paypoint", () => { }); }); - test("removePage", async () => { + test("getPage (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getPage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getPage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getPage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.getPage("entry", "subdomain"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("removePage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -677,9 +939,81 @@ describe("Paypoint", () => { }); }); - test("saveLogo", async () => { + test("removePage (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.removePage("entry", "subdomain"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("removePage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.removePage("entry", "subdomain"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("removePage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.removePage("entry", "subdomain"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("removePage (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/Paypoint/entry/subdomain") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.removePage("entry", "subdomain"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("saveLogo (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, @@ -707,9 +1041,85 @@ describe("Paypoint", () => { }); }); - test("settingsPage", async () => { + test("saveLogo (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/logo/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.saveLogo("entry", {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("saveLogo (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/logo/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.saveLogo("entry", {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("saveLogo (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Paypoint/logo/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.saveLogo("entry", {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("saveLogo (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Paypoint/logo/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.saveLogo("entry", {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("settingsPage (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { customFields: [ @@ -955,9 +1365,81 @@ describe("Paypoint", () => { }); }); - test("migrate", async () => { + test("settingsPage (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/settings/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.settingsPage("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("settingsPage (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/settings/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.settingsPage("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("settingsPage (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Paypoint/settings/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.settingsPage("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("settingsPage (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Paypoint/settings/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.settingsPage("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("migrate (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entryPoint: "473abc123def", newParentOrganizationId: 123, @@ -995,4 +1477,92 @@ describe("Paypoint", () => { responseText: "Success", }); }); + + test("migrate (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entryPoint: "entryPoint", newParentOrganizationId: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/migrate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.migrate({ + entryPoint: "entryPoint", + newParentOrganizationId: 1, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("migrate (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entryPoint: "entryPoint", newParentOrganizationId: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/migrate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.migrate({ + entryPoint: "entryPoint", + newParentOrganizationId: 1, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("migrate (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entryPoint: "entryPoint", newParentOrganizationId: 1 }; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Paypoint/migrate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.migrate({ + entryPoint: "entryPoint", + newParentOrganizationId: 1, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("migrate (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entryPoint: "entryPoint", newParentOrganizationId: 1 }; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Paypoint/migrate") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.paypoint.migrate({ + entryPoint: "entryPoint", + newParentOrganizationId: 1, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/query.test.ts b/tests/wire/query.test.ts index 5143e871..562f0c1e 100644 --- a/tests/wire/query.test.ts +++ b/tests/wire/query.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Query", () => { - test("ListBatchDetails", async () => { +describe("QueryClient", () => { + test("ListBatchDetails (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -45,7 +44,6 @@ describe("Query", () => { Status: 1, TransactionTime: "2024-11-19T15:58:01Z", Customer: { - AdditionalData: undefined, BillingAddress1: "100 Golden Ridge Drive", BillingAddress2: "STE 100", BillingCity: "Mendota", @@ -216,7 +214,6 @@ describe("Query", () => { Status: 1, TransactionTime: "2024-11-19T15:58:01Z", Customer: { - AdditionalData: undefined, BillingAddress1: "100 Golden Ridge Drive", BillingAddress2: "STE 100", BillingCity: "Mendota", @@ -350,9 +347,81 @@ describe("Query", () => { }); }); - test("ListBatchDetailsOrg", async () => { + test("ListBatchDetails (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetails("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatchDetails (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetails("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatchDetails (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetails("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatchDetails (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batchDetails/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetails("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBatchDetailsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -644,32 +713,91 @@ describe("Query", () => { }); }); - test("ListBatches", async () => { + test("ListBatchDetailsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetailsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatchDetailsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetailsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatchDetailsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchDetails/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetailsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatchDetailsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batchDetails/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchDetailsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBatches (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - Summary: { - pageidentifier: undefined, - pageSize: 20, - totalAmount: 54049.71, - totalNetAmount: 0, - totalPages: 3, - totalRecords: 3, - }, + Summary: { pageSize: 20, totalAmount: 54049.71, totalNetAmount: 0, totalPages: 3, totalRecords: 3 }, Records: [ { IdBatch: 1049, BatchNumber: "batch_2857_combined_08-26-2025_001", TransferIdentifier: null, EventsData: [ - { - description: "Created", - eventTime: "2025-08-25T03:19:27.6190027-04:00", - refData: undefined, - extraData: undefined, - source: "api", - }, + { description: "Created", eventTime: "2025-08-25T03:19:27.6190027-04:00", source: "api" }, ], ConnectorName: "GP", BatchDate: "2025-08-25T20:00:00", @@ -735,18 +863,11 @@ describe("Query", () => { BatchNumber: "BT-2023041421-187", TransferIdentifier: "ec310c3d-d4bf-4670-9524-00fcc4ab6a2a", EventsData: [ - { - description: "Created", - eventTime: "2023-04-14T21:01:03Z", - refData: undefined, - extraData: undefined, - source: "api", - }, + { description: "Created", eventTime: "2023-04-14T21:01:03Z", source: "api" }, { description: "Closed", eventTime: "2023-04-15T03:05:10Z", refData: "batchId: 1012", - extraData: undefined, source: "worker", }, ], @@ -809,7 +930,6 @@ describe("Query", () => { }); expect(response).toEqual({ Summary: { - pageidentifier: undefined, pageSize: 20, totalAmount: 54049.71, totalNetAmount: 0, @@ -825,8 +945,6 @@ describe("Query", () => { { description: "Created", eventTime: "2025-08-25T03:19:27.6190027-04:00", - refData: undefined, - extraData: undefined, source: "api", }, ], @@ -897,15 +1015,12 @@ describe("Query", () => { { description: "Created", eventTime: "2023-04-14T21:01:03Z", - refData: undefined, - extraData: undefined, source: "api", }, { description: "Closed", eventTime: "2023-04-15T03:05:10Z", refData: "batchId: 1012", - extraData: undefined, source: "worker", }, ], @@ -955,32 +1070,91 @@ describe("Query", () => { }); }); - test("ListBatchesOrg", async () => { + test("ListBatches (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatches("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatches (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatches("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatches (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatches("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatches (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batches/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatches("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBatchesOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { - Summary: { - pageidentifier: undefined, - pageSize: 20, - totalAmount: 54049.71, - totalNetAmount: 0, - totalPages: 3, - totalRecords: 3, - }, + Summary: { pageSize: 20, totalAmount: 54049.71, totalNetAmount: 0, totalPages: 3, totalRecords: 3 }, Records: [ { IdBatch: 1049, BatchNumber: "batch_2857_combined_08-26-2025_001", TransferIdentifier: null, EventsData: [ - { - description: "Created", - eventTime: "2025-08-25T03:19:27.6190027-04:00", - refData: undefined, - extraData: undefined, - source: "api", - }, + { description: "Created", eventTime: "2025-08-25T03:19:27.6190027-04:00", source: "api" }, ], ConnectorName: "GP", BatchDate: "2025-08-25T20:00:00", @@ -1046,18 +1220,11 @@ describe("Query", () => { BatchNumber: "BT-2023041421-187", TransferIdentifier: "ec310c3d-d4bf-4670-9524-00fcc4ab6a2a", EventsData: [ - { - description: "Created", - eventTime: "2023-04-14T21:01:03Z", - refData: undefined, - extraData: undefined, - source: "api", - }, + { description: "Created", eventTime: "2023-04-14T21:01:03Z", source: "api" }, { description: "Closed", eventTime: "2023-04-15T03:05:10Z", refData: "batchId: 1012", - extraData: undefined, source: "worker", }, ], @@ -1120,7 +1287,6 @@ describe("Query", () => { }); expect(response).toEqual({ Summary: { - pageidentifier: undefined, pageSize: 20, totalAmount: 54049.71, totalNetAmount: 0, @@ -1136,8 +1302,6 @@ describe("Query", () => { { description: "Created", eventTime: "2025-08-25T03:19:27.6190027-04:00", - refData: undefined, - extraData: undefined, source: "api", }, ], @@ -1208,15 +1372,12 @@ describe("Query", () => { { description: "Created", eventTime: "2023-04-14T21:01:03Z", - refData: undefined, - extraData: undefined, source: "api", }, { description: "Closed", eventTime: "2023-04-15T03:05:10Z", refData: "batchId: 1012", - extraData: undefined, source: "worker", }, ], @@ -1266,9 +1427,81 @@ describe("Query", () => { }); }); - test("ListBatchesOut", async () => { + test("ListBatchesOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatchesOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatchesOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batches/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatchesOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batches/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBatchesOut (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -1395,9 +1628,81 @@ describe("Query", () => { }); }); - test("ListBatchesOutOrg", async () => { + test("ListBatchesOut (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOut("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatchesOut (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOut("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatchesOut (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOut("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatchesOut (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batchesOut/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOut("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListBatchesOutOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -1524,32 +1829,104 @@ describe("Query", () => { }); }); - test("ListChargebacks", async () => { + test("ListBatchesOutOrg (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawResponseBody = { - Records: [ - { - AccountType: "4XXXXXX0003", - CaseNumber: "00001", - ChargebackDate: "2023-02-08T00:00:00Z", - CreatedAt: "2023-02-20T15:36:49Z", - Customer: { - AdditionalData: "AdditionalData", - BillingAddress1: "321 Big Sky Road", - BillingAddress2: "", - BillingCity: "Helena", - BillingCountry: "US", - BillingEmail: "janis.berzins@example.com", - BillingPhone: "406-555-0123", - BillingState: "MT", - BillingZip: "59601", - CompanyName: "Big Sky Imports", - customerId: 1324, - CustomerNumber: "12345", - customerStatus: 1, - FirstName: "Janis", + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOutOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListBatchesOutOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOutOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListBatchesOutOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/batchesOut/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOutOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListBatchesOutOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/batchesOut/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listBatchesOutOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListChargebacks (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + Records: [ + { + AccountType: "4XXXXXX0003", + CaseNumber: "00001", + ChargebackDate: "2023-02-08T00:00:00Z", + CreatedAt: "2023-02-20T15:36:49Z", + Customer: { + AdditionalData: "AdditionalData", + BillingAddress1: "321 Big Sky Road", + BillingAddress2: "", + BillingCity: "Helena", + BillingCountry: "US", + BillingEmail: "janis.berzins@example.com", + BillingPhone: "406-555-0123", + BillingState: "MT", + BillingZip: "59601", + CompanyName: "Big Sky Imports", + customerId: 1324, + CustomerNumber: "12345", + customerStatus: 1, + FirstName: "Janis", Identifiers: ["firstname", "email"], LastName: "Berzins", ShippingAddress1: "321 Big Sky Road", @@ -1836,9 +2213,81 @@ describe("Query", () => { }); }); - test("ListChargebacksOrg", async () => { + test("ListChargebacks (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacks("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListChargebacks (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacks("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListChargebacks (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacks("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListChargebacks (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/chargebacks/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacks("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListChargebacksOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -1955,9 +2404,81 @@ describe("Query", () => { }); }); - test("ListCustomers", async () => { + test("ListChargebacksOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacksOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListChargebacksOrg (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacksOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListChargebacksOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/chargebacks/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacksOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListChargebacksOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/chargebacks/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listChargebacksOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListCustomers (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2076,9 +2597,81 @@ describe("Query", () => { }); }); - test("ListCustomersOrg", async () => { + test("ListCustomers (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomers("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListCustomers (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomers("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListCustomers (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomers("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListCustomers (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/customers/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomers("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListCustomersOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2197,9 +2790,81 @@ describe("Query", () => { }); }); - test("ListNotificationReports", async () => { + test("ListCustomersOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomersOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListCustomersOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomersOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListCustomersOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/customers/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomersOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListCustomersOrg (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/customers/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listCustomersOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListNotificationReports (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2252,9 +2917,81 @@ describe("Query", () => { }); }); - test("ListNotificationReportsOrg", async () => { + test("ListNotificationReports (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReports("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListNotificationReports (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReports("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListNotificationReports (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReports("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListNotificationReports (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/notificationReports/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReports("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListNotificationReportsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2307,9 +3044,81 @@ describe("Query", () => { }); }); - test("ListNotifications", async () => { + test("ListNotificationReportsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReportsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListNotificationReportsOrg (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReportsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListNotificationReportsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notificationReports/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReportsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListNotificationReportsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/notificationReports/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationReportsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListNotifications (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2404,9 +3213,81 @@ describe("Query", () => { }); }); - test("ListNotificationsOrg", async () => { + test("ListNotifications (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotifications("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListNotifications (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotifications("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListNotifications (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotifications("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListNotifications (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/notifications/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotifications("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListNotificationsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2501,9 +3382,81 @@ describe("Query", () => { }); }); - test("ListOrganizations", async () => { + test("ListNotificationsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListNotificationsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListNotificationsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/notifications/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListNotificationsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/notifications/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listNotificationsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListOrganizations (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2601,9 +3554,81 @@ describe("Query", () => { }); }); - test("ListPayout", async () => { + test("ListOrganizations (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/organizations/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listOrganizations(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListOrganizations (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/organizations/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listOrganizations(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListOrganizations (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/organizations/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listOrganizations(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListOrganizations (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/organizations/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listOrganizations(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListPayout (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2744,9 +3769,81 @@ describe("Query", () => { }); }); - test("ListPayoutOrg", async () => { + test("ListPayout (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayout("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListPayout (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayout("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListPayout (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayout("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListPayout (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/payouts/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayout("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListPayoutOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -2887,9 +3984,81 @@ describe("Query", () => { }); }); - test("ListPaypoints", async () => { + test("ListPayoutOrg (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayoutOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListPayoutOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayoutOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListPayoutOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/payouts/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayoutOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListPayoutOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/payouts/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listPayoutOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListPaypoints (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -3050,9 +4219,57 @@ describe("Query", () => { }); }); - test("ListSettlements", async () => { + test("ListPaypoints (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/paypoints/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listPaypoints(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListPaypoints (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/paypoints/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listPaypoints(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListPaypoints (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/paypoints/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listPaypoints(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListPaypoints (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/paypoints/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listPaypoints(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListSettlements (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -3344,9 +4561,81 @@ describe("Query", () => { }); }); - test("ListSettlementsOrg", async () => { + test("ListSettlements (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlements("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListSettlements (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlements("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListSettlements (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlements("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListSettlements (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/settlements/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlements("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListSettlementsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -3638,9 +4927,81 @@ describe("Query", () => { }); }); - test("ListSubscriptions", async () => { + test("ListSettlementsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlementsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListSettlementsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlementsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListSettlementsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/settlements/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlementsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListSettlementsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/settlements/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSettlementsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListSubscriptions (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: { @@ -3905,9 +5266,81 @@ describe("Query", () => { }); }); - test("ListSubscriptionsOrg", async () => { + test("ListSubscriptions (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptions("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListSubscriptions (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptions("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListSubscriptions (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptions("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListSubscriptions (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/subscriptions/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptions("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListSubscriptionsOrg (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: { @@ -4172,9 +5605,81 @@ describe("Query", () => { }); }); - test("ListTransactions", async () => { + test("ListSubscriptionsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptionsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListSubscriptionsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptionsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListSubscriptionsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/subscriptions/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptionsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListSubscriptionsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/subscriptions/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listSubscriptionsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTransactions (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -4521,9 +6026,81 @@ describe("Query", () => { }); }); - test("ListTransactionsOrg", async () => { + test("ListTransactions (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactions("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTransactions (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactions("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTransactions (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactions("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTransactions (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/transactions/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactions("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTransactionsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -4660,9 +6237,81 @@ describe("Query", () => { }); }); - test("ListTransferDetails", async () => { + test("ListTransactionsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactionsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTransactionsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactionsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTransactionsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transactions/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactionsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTransactionsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/transactions/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransactionsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTransferDetails (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Summary: { @@ -4723,12 +6372,6 @@ describe("Query", () => { AccountExp: "08/28", HolderName: "Ara Karapetyan", orderDescription: "Electronics Purchase", - StoredId: undefined, - Initiator: undefined, - StoredMethodUsageType: undefined, - Sequence: undefined, - accountId: undefined, - SignatureData: undefined, binData: { binMatchedLength: "6", binCardBrand: "Visa", @@ -4742,7 +6385,6 @@ describe("Query", () => { binCardUseCategory: "Consumer", binCardIssuerCountryCodeA3: "USA", }, - paymentDetails: undefined, }, TransStatus: 1, TotalAmount: 1000, @@ -4876,12 +6518,6 @@ describe("Query", () => { AccountExp: "08/28", HolderName: "Ara Karapetyan", orderDescription: "Electronics Purchase", - StoredId: undefined, - Initiator: undefined, - StoredMethodUsageType: undefined, - Sequence: undefined, - accountId: undefined, - SignatureData: undefined, binData: { binMatchedLength: "6", binCardBrand: "Visa", @@ -4895,7 +6531,6 @@ describe("Query", () => { binCardUseCategory: "Consumer", binCardIssuerCountryCodeA3: "USA", }, - paymentDetails: undefined, }, TransStatus: 1, TotalAmount: 1000, @@ -4963,9 +6598,81 @@ describe("Query", () => { }); }); - test("ListTransfers", async () => { + test("ListTransferDetails (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transferDetails/entry/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransferDetails("entry", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTransferDetails (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transferDetails/entry/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransferDetails("entry", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTransferDetails (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transferDetails/entry/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransferDetails("entry", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTransferDetails (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/transferDetails/entry/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransferDetails("entry", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTransfers (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5004,8 +6711,6 @@ describe("Query", () => { { description: "Transfer Created", eventTime: "2024-11-16T08:15:33.4364067Z", - refData: undefined, - extraData: undefined, source: "worker", }, ], @@ -5066,8 +6771,6 @@ describe("Query", () => { { description: "Transfer Created", eventTime: "2024-11-16T08:15:33.4364067Z", - refData: undefined, - extraData: undefined, source: "worker", }, ], @@ -5082,9 +6785,81 @@ describe("Query", () => { }); }); - test("ListTransfersOrg", async () => { + test("ListTransfers (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfers("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTransfers (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfers("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTransfers (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfers("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTransfers (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/transfers/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfers("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTransfersOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5123,8 +6898,6 @@ describe("Query", () => { { description: "Transfer Created", eventTime: "2024-11-16T08:15:33.4364067Z", - refData: undefined, - extraData: undefined, source: "worker", }, ], @@ -5186,8 +6959,6 @@ describe("Query", () => { { description: "Transfer Created", eventTime: "2024-11-16T08:15:33.4364067Z", - refData: undefined, - extraData: undefined, source: "worker", }, ], @@ -5202,9 +6973,89 @@ describe("Query", () => { }); }); - test("ListUsersOrg", async () => { + test("ListTransfersOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/org/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfersOrg({ + orgId: 1000000, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTransfersOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/org/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfersOrg({ + orgId: 1000000, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTransfersOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/transfers/org/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfersOrg({ + orgId: 1000000, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTransfersOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/transfers/org/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listTransfersOrg({ + orgId: 1000000, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListUsersOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5291,9 +7142,57 @@ describe("Query", () => { }); }); - test("ListUsersPaypoint", async () => { + test("ListUsersOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/users/org/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listUsersOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListUsersOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/users/org/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listUsersOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListUsersOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/users/org/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listUsersOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListUsersOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/users/org/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.query.listUsersOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListUsersPaypoint (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5380,9 +7279,81 @@ describe("Query", () => { }); }); - test("ListVendors", async () => { + test("ListUsersPaypoint (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/users/point/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listUsersPaypoint("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListUsersPaypoint (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/users/point/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listUsersPaypoint("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListUsersPaypoint (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/users/point/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listUsersPaypoint("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListUsersPaypoint (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/users/point/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listUsersPaypoint("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListVendors (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5393,7 +7364,6 @@ describe("Query", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -5424,10 +7394,8 @@ describe("Query", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -5465,7 +7433,6 @@ describe("Query", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, @@ -5501,7 +7468,6 @@ describe("Query", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -5532,10 +7498,8 @@ describe("Query", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -5573,7 +7537,6 @@ describe("Query", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, @@ -5589,9 +7552,81 @@ describe("Query", () => { }); }); - test("ListVendorsOrg", async () => { + test("ListVendors (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendors("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListVendors (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendors("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListVendors (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendors("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListVendors (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/vendors/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendors("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListVendorsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5602,7 +7637,6 @@ describe("Query", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -5633,10 +7667,8 @@ describe("Query", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -5674,7 +7706,6 @@ describe("Query", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, @@ -5710,7 +7741,6 @@ describe("Query", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -5741,10 +7771,8 @@ describe("Query", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -5782,7 +7810,6 @@ describe("Query", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }, @@ -5798,9 +7825,81 @@ describe("Query", () => { }); }); - test("ListVcards", async () => { + test("ListVendorsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendorsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListVendorsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendorsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListVendorsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vendors/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendorsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListVendorsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/vendors/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVendorsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListVcards (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -5918,9 +8017,81 @@ describe("Query", () => { }); }); - test("ListVcardsOrg", async () => { + test("ListVcards (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/entry") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcards("entry"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListVcards (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/entry") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcards("entry"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListVcards (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/entry") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcards("entry"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListVcards (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/vcards/entry") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcards("entry"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListVcardsOrg (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Records: [ @@ -6037,4 +8208,76 @@ describe("Query", () => { }, }); }); + + test("ListVcardsOrg (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/org/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcardsOrg(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListVcardsOrg (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/org/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcardsOrg(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListVcardsOrg (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Query/vcards/org/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcardsOrg(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListVcardsOrg (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Query/vcards/org/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.query.listVcardsOrg(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/statistic.test.ts b/tests/wire/statistic.test.ts index 00e4c6a3..d1a1a24b 100644 --- a/tests/wire/statistic.test.ts +++ b/tests/wire/statistic.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Statistic", () => { - test("BasicStats", async () => { +describe("StatisticClient", () => { + test("BasicStats (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [ { @@ -106,9 +105,81 @@ describe("Statistic", () => { ]); }); - test("CustomerBasicStats", async () => { + test("BasicStats (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/basic/mode/freq/1/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.basicStats("mode", "freq", 1, 1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("BasicStats (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/basic/mode/freq/1/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.basicStats("mode", "freq", 1, 1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("BasicStats (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/basic/mode/freq/1/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.basicStats("mode", "freq", 1, 1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("BasicStats (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Statistic/basic/mode/freq/1/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.basicStats("mode", "freq", 1, 1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("CustomerBasicStats (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [{ interval: "2023-03", count: 45, volume: 12500.75 }]; server @@ -129,9 +200,81 @@ describe("Statistic", () => { ]); }); - test("SubStats", async () => { + test("CustomerBasicStats (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/customerbasic/mode/freq/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.customerBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("CustomerBasicStats (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/customerbasic/mode/freq/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.customerBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("CustomerBasicStats (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/customerbasic/mode/freq/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.customerBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("CustomerBasicStats (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Statistic/customerbasic/mode/freq/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.customerBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("SubStats (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [ { @@ -162,9 +305,81 @@ describe("Statistic", () => { ]); }); - test("VendorBasicStats", async () => { + test("SubStats (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/subscriptions/interval/1/1000000") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.subStats("interval", 1, 1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("SubStats (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/subscriptions/interval/1/1000000") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.subStats("interval", 1, 1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("SubStats (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/subscriptions/interval/1/1000000") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.subStats("interval", 1, 1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("SubStats (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Statistic/subscriptions/interval/1/1000000") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.subStats("interval", 1, 1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("VendorBasicStats (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = [ { @@ -218,4 +433,76 @@ describe("Statistic", () => { }, ]); }); + + test("VendorBasicStats (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/vendorbasic/mode/freq/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.vendorBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("VendorBasicStats (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/vendorbasic/mode/freq/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.vendorBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("VendorBasicStats (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Statistic/vendorbasic/mode/freq/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.vendorBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("VendorBasicStats (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Statistic/vendorbasic/mode/freq/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.statistic.vendorBasicStats("mode", "freq", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/subscription.test.ts b/tests/wire/subscription.test.ts index cf4bd389..8670cf7c 100644 --- a/tests/wire/subscription.test.ts +++ b/tests/wire/subscription.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Subscription", () => { - test("GetSubscription", async () => { +describe("SubscriptionClient", () => { + test("GetSubscription (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { CreatedAt: "2022-07-01T15:00:01Z", @@ -290,9 +289,57 @@ describe("Subscription", () => { }); }); - test("NewSubscription", async () => { + test("GetSubscription (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Subscription/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.getSubscription(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetSubscription (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Subscription/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.getSubscription(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetSubscription (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Subscription/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.getSubscription(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetSubscription (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Subscription/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.getSubscription(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("NewSubscription (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", @@ -353,9 +400,211 @@ describe("Subscription", () => { }); }); - test("RemoveSubscription", async () => { + test("NewSubscription (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { + achAccount: "3453445666", + achAccountType: "Checking", + achCode: "PPD", + achHolder: "John Cassian", + achHolderType: "personal", + achRouting: "021000021", + method: "ach", + }, + scheduleDetails: { endDate: "03-20-2025", frequency: "weekly", planId: 1, startDate: "09-20-2024" }, + }; + const rawResponseBody = { responseText: "Success", isSuccess: true, responseData: 396, customerId: 4440 }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscription.newSubscription({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + achAccount: "3453445666", + achAccountType: "Checking", + achCode: "PPD", + achHolder: "John Cassian", + achHolderType: "personal", + achRouting: "021000021", + method: "ach", + }, + scheduleDetails: { + endDate: "03-20-2025", + frequency: "weekly", + planId: 1, + startDate: "09-20-2024", + }, + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: 396, + customerId: 4440, + }); + }); + + test("NewSubscription (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + paymentMethod: { + initiator: "merchant", + storedMethodId: "4000e8c6-3add-4200-8ac2-9b8a4f8b1639-1323", + storedMethodUsageType: "recurring", + }, + scheduleDetails: { endDate: "03-20-2025", frequency: "weekly", planId: 1, startDate: "09-20-2024" }, + }; + const rawResponseBody = { responseText: "Success", isSuccess: true, responseData: 396, customerId: 4440 }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscription.newSubscription({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + paymentMethod: { + initiator: "merchant", + storedMethodId: "4000e8c6-3add-4200-8ac2-9b8a4f8b1639-1323", + storedMethodUsageType: "recurring", + }, + scheduleDetails: { + endDate: "03-20-2025", + frequency: "weekly", + planId: 1, + startDate: "09-20-2024", + }, + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: 396, + customerId: 4440, + }); + }); + + test("NewSubscription (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.newSubscription({ + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("NewSubscription (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.newSubscription({ + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("NewSubscription (6)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.newSubscription({ + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("NewSubscription (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Subscription/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.newSubscription({ + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("RemoveSubscription (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseData: "396", responseText: "Success" }; server @@ -374,9 +623,57 @@ describe("Subscription", () => { }); }); - test("UpdateSubscription", async () => { + test("RemoveSubscription (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Subscription/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.removeSubscription(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("RemoveSubscription (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Subscription/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.removeSubscription(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("RemoveSubscription (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Subscription/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.removeSubscription(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("RemoveSubscription (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Subscription/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.subscription.removeSubscription(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateSubscription (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { setPause: true }; const rawResponseBody = { responseText: "Success", @@ -403,4 +700,152 @@ describe("Subscription", () => { customerId: 4440, }); }); + + test("UpdateSubscription (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { setPause: false }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: "396 unpaused", + customerId: 4440, + }; + server + .mockEndpoint() + .put("/Subscription/231") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscription.updateSubscription(231, { + setPause: false, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: "396 unpaused", + customerId: 4440, + }); + }); + + test("UpdateSubscription (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + paymentDetails: { serviceFee: 0, totalAmount: 100 }, + scheduleDetails: { endDate: "03-20-2025", frequency: "weekly", planId: 1, startDate: "09-20-2024" }, + }; + const rawResponseBody = { + responseText: "Success", + isSuccess: true, + responseData: "396 updated", + customerId: 4440, + }; + server + .mockEndpoint() + .put("/Subscription/231") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.subscription.updateSubscription(231, { + paymentDetails: { + serviceFee: 0, + totalAmount: 100, + }, + scheduleDetails: { + endDate: "03-20-2025", + frequency: "weekly", + planId: 1, + startDate: "09-20-2024", + }, + }); + expect(response).toEqual({ + responseText: "Success", + isSuccess: true, + responseData: "396 updated", + customerId: 4440, + }); + }); + + test("UpdateSubscription (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Subscription/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.updateSubscription(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateSubscription (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Subscription/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.updateSubscription(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateSubscription (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Subscription/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.updateSubscription(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateSubscription (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Subscription/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.subscription.updateSubscription(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/templates.test.ts b/tests/wire/templates.test.ts index 088ef234..e5c00af4 100644 --- a/tests/wire/templates.test.ts +++ b/tests/wire/templates.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Templates", () => { - test("DeleteTemplate", async () => { +describe("TemplatesClient", () => { + test("DeleteTemplate (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3625, responseText: "Success" }; server.mockEndpoint().delete("/Templates/80").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -22,9 +21,57 @@ describe("Templates", () => { }); }); - test("getlinkTemplate", async () => { + test("DeleteTemplate (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Templates/1.1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.deleteTemplate(1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteTemplate (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Templates/1.1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.deleteTemplate(1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteTemplate (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Templates/1.1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.deleteTemplate(1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteTemplate (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Templates/1.1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.deleteTemplate(1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getlinkTemplate (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseData: "34", responseText: "Success" }; server @@ -42,9 +89,81 @@ describe("Templates", () => { }); }); - test("getTemplate", async () => { + test("getlinkTemplate (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Templates/getlink/1.1/true") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.templates.getlinkTemplate(1.1, true); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getlinkTemplate (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Templates/getlink/1.1/true") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.templates.getlinkTemplate(1.1, true); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getlinkTemplate (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/Templates/getlink/1.1/true") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.templates.getlinkTemplate(1.1, true); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getlinkTemplate (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/Templates/getlink/1.1/true") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.templates.getlinkTemplate(1.1, true); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("getTemplate (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { addPrice: true, @@ -163,9 +282,57 @@ describe("Templates", () => { }); }); - test("ListTemplates", async () => { + test("getTemplate (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Templates/get/1.1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.getTemplate(1.1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("getTemplate (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Templates/get/1.1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.getTemplate(1.1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("getTemplate (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Templates/get/1.1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.getTemplate(1.1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("getTemplate (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Templates/get/1.1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.getTemplate(1.1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ListTemplates (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { records: [ @@ -237,4 +404,52 @@ describe("Templates", () => { }, }); }); + + test("ListTemplates (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/templates/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.listTemplates(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ListTemplates (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/templates/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.listTemplates(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ListTemplates (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Query/templates/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.listTemplates(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ListTemplates (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Query/templates/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.templates.listTemplates(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/tokenStorage.test.ts b/tests/wire/tokenStorage.test.ts index e9b38fb7..66465f7e 100644 --- a/tests/wire/tokenStorage.test.ts +++ b/tests/wire/tokenStorage.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("TokenStorage", () => { - test("AddMethod", async () => { +describe("TokenStorageClient", () => { + test("AddMethod (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", @@ -72,9 +71,278 @@ describe("TokenStorage", () => { }); }); - test("GetMethod", async () => { + test("AddMethod (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + entryPoint: "f743aed24a", + fallbackAuth: true, + paymentMethod: { + cardcvv: "123", + cardexp: "02/25", + cardHolder: "John Doe", + cardnumber: "4111111111111111", + cardzip: "12345", + method: "card", + }, + }; + const rawResponseBody = { + isSuccess: true, + responseData: { + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.tokenStorage.addMethod({ + createAnonymous: true, + body: { + entryPoint: "f743aed24a", + fallbackAuth: true, + paymentMethod: { + cardcvv: "123", + cardexp: "02/25", + cardHolder: "John Doe", + cardnumber: "4111111111111111", + cardzip: "12345", + method: "card", + }, + }, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: { + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }); + }); + + test("AddMethod (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + fallbackAuth: true, + methodDescription: "Main card", + paymentMethod: { method: "card", tokenId: "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224" }, + }; + const rawResponseBody = { + isSuccess: true, + responseData: { + customerId: 4440, + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.tokenStorage.addMethod({ + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + fallbackAuth: true, + methodDescription: "Main card", + paymentMethod: { + method: "card", + tokenId: "c9700e93-b2ed-4b75-b1e4-ca4fb04fbe45-224", + }, + }, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: { + customerId: 4440, + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }); + }); + + test("AddMethod (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + paymentMethod: { + achAccount: "1111111111111", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Doe", + achHolderType: "personal", + achRouting: "123456780", + method: "ach", + }, + }; + const rawResponseBody = { + isSuccess: true, + responseData: { + customerId: 4440, + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.tokenStorage.addMethod({ + achValidation: true, + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + paymentMethod: { + achAccount: "1111111111111", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Doe", + achHolderType: "personal", + achRouting: "123456780", + method: "ach", + }, + }, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: { + customerId: 4440, + methodReferenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + referenceId: "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440", + resultCode: 1, + resultText: "Approved", + }, + responseText: "Success", + }); + }); + + test("AddMethod (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.addMethod({ + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddMethod (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.addMethod({ + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddMethod (7)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.addMethod({ + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddMethod (8)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/TokenStorage/add") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.addMethod({ + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetMethod (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -220,9 +488,207 @@ describe("TokenStorage", () => { }); }); - test("RemoveMethod", async () => { + test("GetMethod (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + isSuccess: true, + responseData: { + aba: "021000021", + achHolderType: "personal", + achSecCode: "PPD", + bin: "", + customers: [ + { + additionalData: { key1: { key: "value" }, key2: { key: "value" }, key3: { key: "value" } }, + balance: 250, + billingPhone: "1234567890", + company: "Bluesky Tech Inc", + created: "2023-06-01T14:30:00Z", + customerId: 1456, + customerNumber: "CS789", + customerStatus: 1, + customerUsername: "Marcus", + identifierFields: ["firstname", "email"], + lastUpdated: "2024-12-15T09:45:32Z", + mfa: true, + mfaMode: 1, + parentOrgId: 5, + parentOrgName: "TechCorp", + paypointDbaname: "Bluesky Tech", + paypointEntryname: "45782932fcc", + paypointLegalname: "Bluesky Technologies LLC", + shippingAddress1: "Suite 500", + shippingCity: "San Francisco", + shippingCountry: "US", + shippingState: "CA", + shippingZip: "94105", + snIdentifier: "null", + snProvider: "google", + timeZone: -8, + }, + ], + descriptor: "Checking", + expDate: "", + holderName: "Marcus Chen", + idPmethod: "81f7fde1-dd8b-4892-b2e1-cd60dd91f6b4-XXXX", + lastUpdated: "2025-01-15T16:30:22Z", + maskedAccount: "8XXXXXX8654", + method: "ach", + methodType: "Single Merchant", + postalCode: "", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .get("/TokenStorage/32-8877drt00045632-678") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.tokenStorage.getMethod("32-8877drt00045632-678", { + cardExpirationFormat: 1, + includeTemporary: false, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: { + aba: "021000021", + achHolderType: "personal", + achSecCode: "PPD", + bin: "", + customers: [ + { + additionalData: { + key1: { + key: "value", + }, + key2: { + key: "value", + }, + key3: { + key: "value", + }, + }, + balance: 250, + billingPhone: "1234567890", + company: "Bluesky Tech Inc", + created: "2023-06-01T14:30:00Z", + customerId: 1456, + customerNumber: "CS789", + customerStatus: 1, + customerUsername: "Marcus", + identifierFields: ["firstname", "email"], + lastUpdated: "2024-12-15T09:45:32Z", + mfa: true, + mfaMode: 1, + parentOrgId: 5, + parentOrgName: "TechCorp", + paypointDbaname: "Bluesky Tech", + paypointEntryname: "45782932fcc", + paypointLegalname: "Bluesky Technologies LLC", + shippingAddress1: "Suite 500", + shippingCity: "San Francisco", + shippingCountry: "US", + shippingState: "CA", + shippingZip: "94105", + snIdentifier: "null", + snProvider: "google", + timeZone: -8, + }, + ], + descriptor: "Checking", + expDate: "", + holderName: "Marcus Chen", + idPmethod: "81f7fde1-dd8b-4892-b2e1-cd60dd91f6b4-XXXX", + lastUpdated: "2025-01-15T16:30:22Z", + maskedAccount: "8XXXXXX8654", + method: "ach", + methodType: "Single Merchant", + postalCode: "", + }, + responseText: "Success", + }); + }); + + test("GetMethod (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/TokenStorage/methodId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.getMethod("methodId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetMethod (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/TokenStorage/methodId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.getMethod("methodId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetMethod (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .get("/TokenStorage/methodId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.getMethod("methodId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetMethod (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .get("/TokenStorage/methodId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.getMethod("methodId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("RemoveMethod (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -249,9 +715,81 @@ describe("TokenStorage", () => { }); }); - test("UpdateMethod", async () => { + test("RemoveMethod (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/TokenStorage/methodId") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.removeMethod("methodId"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("RemoveMethod (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/TokenStorage/methodId") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.removeMethod("methodId"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("RemoveMethod (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .delete("/TokenStorage/methodId") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.removeMethod("methodId"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("RemoveMethod (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .delete("/TokenStorage/methodId") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.removeMethod("methodId"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("UpdateMethod (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { customerData: { customerId: 4440 }, entryPoint: "f743aed24a", @@ -310,4 +848,150 @@ describe("TokenStorage", () => { responseText: "Success", }); }); + + test("UpdateMethod (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { + customerData: { customerId: 4440 }, + entryPoint: "f743aed24a", + paymentMethod: { + achAccount: "1111111111111", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Doe", + achHolderType: "personal", + achRouting: "123456780", + method: "ach", + }, + }; + const rawResponseBody = { + isSuccess: true, + responseData: { + referenceId: "1b502b79-e319-4159-8c29-a9f8d9f105c8-1323", + resultCode: 1, + resultText: "Updated", + }, + responseText: "Success", + }; + server + .mockEndpoint() + .put("/TokenStorage/32-8877drt00045632-678") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.tokenStorage.updateMethod("32-8877drt00045632-678", { + body: { + customerData: { + customerId: 4440, + }, + entryPoint: "f743aed24a", + paymentMethod: { + achAccount: "1111111111111", + achAccountType: "Checking", + achCode: "WEB", + achHolder: "John Doe", + achHolderType: "personal", + achRouting: "123456780", + method: "ach", + }, + }, + }); + expect(response).toEqual({ + isSuccess: true, + responseData: { + referenceId: "1b502b79-e319-4159-8c29-a9f8d9f105c8-1323", + resultCode: 1, + resultText: "Updated", + }, + responseText: "Success", + }); + }); + + test("UpdateMethod (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/TokenStorage/methodId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.updateMethod("methodId", { + body: {}, + }); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("UpdateMethod (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/TokenStorage/methodId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.updateMethod("methodId", { + body: {}, + }); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("UpdateMethod (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/TokenStorage/methodId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.updateMethod("methodId", { + body: {}, + }); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("UpdateMethod (6)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/TokenStorage/methodId") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.tokenStorage.updateMethod("methodId", { + body: {}, + }); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/user.test.ts b/tests/wire/user.test.ts index 846c2be9..66f73858 100644 --- a/tests/wire/user.test.ts +++ b/tests/wire/user.test.ts @@ -1,15 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("User", () => { - test("AddUser", async () => { +describe("UserClient", () => { + test("AddUser (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -28,9 +26,85 @@ describe("User", () => { }); }); - test("AuthRefreshUser", async () => { + test("AddUser (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.addUser({}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.addUser({}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.addUser({}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/User") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.addUser({}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("AuthRefreshUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { inactiveTokenTime: 31, @@ -51,9 +125,57 @@ describe("User", () => { }); }); - test("AuthResetUser", async () => { + test("AuthRefreshUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().post("/User/authrefresh").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.authRefreshUser(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AuthRefreshUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().post("/User/authrefresh").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.authRefreshUser(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AuthRefreshUser (4)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().post("/User/authrefresh").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.authRefreshUser(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AuthRefreshUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().post("/User/authrefresh").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.authRefreshUser(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("AuthResetUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -72,9 +194,85 @@ describe("User", () => { }); }); - test("AuthUser", async () => { + test("AuthResetUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/authreset") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authResetUser(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AuthResetUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/authreset") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authResetUser(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AuthResetUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/authreset") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authResetUser(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AuthResetUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/User/authreset") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authResetUser(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("AuthUser (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, @@ -104,9 +302,85 @@ describe("User", () => { }); }); - test("ChangePswUser", async () => { + test("AuthUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/auth/provider") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authUser("provider"); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AuthUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/auth/provider") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authUser("provider"); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AuthUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/auth/provider") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authUser("provider"); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AuthUser (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/User/auth/provider") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.authUser("provider"); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ChangePswUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -125,9 +399,85 @@ describe("User", () => { }); }); - test("DeleteUser", async () => { + test("ChangePswUser (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/authpsw") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.changePswUser(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ChangePswUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/authpsw") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.changePswUser(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ChangePswUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/authpsw") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.changePswUser(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ChangePswUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/User/authpsw") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.changePswUser(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { responseText: "Success" }; server.mockEndpoint().delete("/User/1000000").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -138,9 +488,57 @@ describe("User", () => { }); }); - test("EditMfaUser", async () => { + test("DeleteUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/User/1000000").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.deleteUser(1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/User/1000000").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.deleteUser(1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/User/1000000").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.deleteUser(1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/User/1000000").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.deleteUser(1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditMfaUser (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -159,9 +557,85 @@ describe("User", () => { }); }); - test("EditUser", async () => { + test("EditMfaUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/mfa/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editMfaUser(1000000, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditMfaUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/mfa/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editMfaUser(1000000, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditMfaUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/mfa/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editMfaUser(1000000, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditMfaUser (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/User/mfa/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editMfaUser(1000000, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { isSuccess: true, responseText: "Success" }; server @@ -180,9 +654,85 @@ describe("User", () => { }); }); - test("GetUser", async () => { + test("EditUser (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editUser(1000000, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editUser(1000000, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/User/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editUser(1000000, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/User/1000000") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.editUser(1000000, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { Access: [{ roleLabel: "customers", roleValue: true }], @@ -240,9 +790,57 @@ describe("User", () => { }); }); - test("LogoutUser", async () => { + test("GetUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/1000000").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.getUser(1000000); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/1000000").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.getUser(1000000); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/1000000").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.getUser(1000000); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/User/1000000").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.getUser(1000000); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("LogoutUser (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseText: "Success" }; server.mockEndpoint().get("/User/authlogout").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -254,9 +852,57 @@ describe("User", () => { }); }); - test("ResendMFACode", async () => { + test("LogoutUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/authlogout").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.logoutUser(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("LogoutUser (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/authlogout").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.logoutUser(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("LogoutUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/User/authlogout").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.logoutUser(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("LogoutUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/User/authlogout").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.user.logoutUser(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ResendMFACode (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, @@ -285,9 +931,81 @@ describe("User", () => { }); }); - test("ValidateMfaUser", async () => { + test("ResendMFACode (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/resendmfa/usrname/Entry/1") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.resendMfaCode("usrname", "Entry", 1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ResendMFACode (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/resendmfa/usrname/Entry/1") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.resendMfaCode("usrname", "Entry", 1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ResendMFACode (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/resendmfa/usrname/Entry/1") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.resendMfaCode("usrname", "Entry", 1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ResendMFACode (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/User/resendmfa/usrname/Entry/1") + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.resendMfaCode("usrname", "Entry", 1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ValidateMfaUser (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = {}; const rawResponseBody = { inactiveTokenTime: 31, @@ -314,4 +1032,80 @@ describe("User", () => { responseText: "Success", }); }); + + test("ValidateMfaUser (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/mfa") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.validateMfaUser(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ValidateMfaUser (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/mfa") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.validateMfaUser(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ValidateMfaUser (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/User/mfa") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.validateMfaUser(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ValidateMfaUser (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/User/mfa") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.user.validateMfaUser(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/vendor.test.ts b/tests/wire/vendor.test.ts index b63ad284..c564d646 100644 --- a/tests/wire/vendor.test.ts +++ b/tests/wire/vendor.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Vendor", () => { - test("AddVendor", async () => { +describe("VendorClient", () => { + test("AddVendor (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { vendorNumber: "1234", name1: "Herman's Coatings and Masonry", @@ -119,9 +118,85 @@ describe("Vendor", () => { }); }); - test("DeleteVendor", async () => { + test("AddVendor (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Vendor/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.addVendor("entry", {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("AddVendor (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Vendor/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.addVendor("entry", {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("AddVendor (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Vendor/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.addVendor("entry", {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("AddVendor (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Vendor/single/entry") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.addVendor("entry", {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("DeleteVendor (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3890, responseText: "Success" }; server.mockEndpoint().delete("/Vendor/1").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); @@ -135,9 +210,57 @@ describe("Vendor", () => { }); }); - test("EditVendor", async () => { + test("DeleteVendor (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Vendor/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.deleteVendor(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("DeleteVendor (3)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Vendor/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.deleteVendor(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("DeleteVendor (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().delete("/Vendor/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.deleteVendor(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("DeleteVendor (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().delete("/Vendor/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.deleteVendor(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("EditVendor (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { name1: "Theodore's Janitorial" }; const rawResponseBody = { isSuccess: true, responseCode: 1, responseData: 3890, responseText: "Success" }; server @@ -160,9 +283,85 @@ describe("Vendor", () => { }); }); - test("GetVendor", async () => { + test("EditVendor (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Vendor/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.editVendor(1, {}); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("EditVendor (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Vendor/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.editVendor(1, {}); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("EditVendor (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .put("/Vendor/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.editVendor(1, {}); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("EditVendor (5)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .put("/Vendor/1") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.vendor.editVendor(1, {}); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("GetVendor (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawResponseBody = { VendorNumber: "1234", @@ -171,7 +370,6 @@ describe("Vendor", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -202,10 +400,8 @@ describe("Vendor", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -243,7 +439,6 @@ describe("Vendor", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }; @@ -257,7 +452,6 @@ describe("Vendor", () => { EIN: "123456789", Phone: "212-555-1234", Email: "example@email.com", - RemitEmail: undefined, Address1: "123 Ocean Drive", Address2: "Suite 400", City: "Bristol", @@ -288,10 +482,8 @@ describe("Vendor", () => { services: [], default: true, }, - PaymentMethod: undefined, VendorStatus: 1, VendorId: 1, - EnrollmentStatus: undefined, Summary: { ActiveBills: 2, PendingBills: 4, @@ -329,9 +521,56 @@ describe("Vendor", () => { customField2: "", customerVendorAccount: "123-456", InternalReferenceId: 1000000, - additionalData: undefined, externalPaypointID: "Paypoint-100", StoredMethods: [], }); }); + + test("GetVendor (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Vendor/1").respondWith().statusCode(400).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.getVendor(1); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("GetVendor (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Vendor/1").respondWith().statusCode(401).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.getVendor(1); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("GetVendor (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { key: "value" }; + server.mockEndpoint().get("/Vendor/1").respondWith().statusCode(500).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.getVendor(1); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("GetVendor (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { responseText: "responseText" }; + server.mockEndpoint().get("/Vendor/1").respondWith().statusCode(503).jsonBody(rawResponseBody).build(); + + await expect(async () => { + return await client.vendor.getVendor(1); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tests/wire/wallet.test.ts b/tests/wire/wallet.test.ts index 6dad492a..0e409bb1 100644 --- a/tests/wire/wallet.test.ts +++ b/tests/wire/wallet.test.ts @@ -1,14 +1,13 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ +// This file was auto-generated by Fern from our API Definition. -import { mockServerPool } from "../mock-server/MockServerPool.js"; +import * as Payabli from "../../src/api/index"; import { PayabliClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; -describe("Wallet", () => { - test("ConfigureApplePayOrganization", async () => { +describe("WalletClient", () => { + test("ConfigureApplePayOrganization (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { cascade: true, isEnabled: true, orgId: 901 }; const rawResponseBody = { isSuccess: true, @@ -61,9 +60,85 @@ describe("Wallet", () => { }); }); - test("ConfigureApplePayPaypoint", async () => { + test("ConfigureApplePayOrganization (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayOrganization(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ConfigureApplePayOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayOrganization(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ConfigureApplePayOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayOrganization(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ConfigureApplePayOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayOrganization(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ConfigureApplePayPaypoint (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entry: "8cfec329267", isEnabled: true }; const rawResponseBody = { isSuccess: true, @@ -78,7 +153,6 @@ describe("Wallet", () => { applePayMerchantId: "applePayMerchantId", domainNames: ["subdomain.domain.com"], paypointName: "Alaskan Domes", - paypointUrl: undefined, markedForDeletionAt: "2022-07-01T15:00:01Z", createdAt: "2022-07-01T15:00:01Z", updatedAt: "2022-07-01T15:00:01Z", @@ -87,7 +161,6 @@ describe("Wallet", () => { }, }, responseText: "Success", - roomId: undefined, }; server .mockEndpoint() @@ -115,7 +188,6 @@ describe("Wallet", () => { applePayMerchantId: "applePayMerchantId", domainNames: ["subdomain.domain.com"], paypointName: "Alaskan Domes", - paypointUrl: undefined, markedForDeletionAt: "2022-07-01T15:00:01Z", createdAt: "2022-07-01T15:00:01Z", updatedAt: "2022-07-01T15:00:01Z", @@ -124,13 +196,88 @@ describe("Wallet", () => { }, }, responseText: "Success", - roomId: undefined, }); }); - test("ConfigureGooglePayOrganization", async () => { + test("ConfigureApplePayPaypoint (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayPaypoint(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ConfigureApplePayPaypoint (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayPaypoint(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ConfigureApplePayPaypoint (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayPaypoint(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ConfigureApplePayPaypoint (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Wallet/applepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureApplePayPaypoint(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ConfigureGooglePayOrganization (1)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { cascade: true, isEnabled: true, orgId: 901 }; const rawResponseBody = { isSuccess: true, @@ -183,9 +330,85 @@ describe("Wallet", () => { }); }); - test("ConfigureGooglePayPaypoint", async () => { + test("ConfigureGooglePayOrganization (2)", async () => { const server = mockServerPool.createServer(); - const client = new PayabliClient({ apiKey: "test", environment: server.baseUrl }); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayOrganization(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ConfigureGooglePayOrganization (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayOrganization(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ConfigureGooglePayOrganization (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayOrganization(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ConfigureGooglePayOrganization (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-organization") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayOrganization(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); + + test("ConfigureGooglePayPaypoint (1)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); const rawRequestBody = { entry: "8cfec329267", isEnabled: true }; const rawResponseBody = { isSuccess: true, @@ -198,7 +421,6 @@ describe("Wallet", () => { walletData: { gatewayMerchantId: "123ID", gatewayId: "123ID" }, }, responseText: "Success", - roomId: undefined, }; server .mockEndpoint() @@ -227,7 +449,82 @@ describe("Wallet", () => { }, }, responseText: "Success", - roomId: undefined, }); }); + + test("ConfigureGooglePayPaypoint (2)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayPaypoint(); + }).rejects.toThrow(Payabli.BadRequestError); + }); + + test("ConfigureGooglePayPaypoint (3)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayPaypoint(); + }).rejects.toThrow(Payabli.UnauthorizedError); + }); + + test("ConfigureGooglePayPaypoint (4)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { key: "value" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayPaypoint(); + }).rejects.toThrow(Payabli.InternalServerError); + }); + + test("ConfigureGooglePayPaypoint (5)", async () => { + const server = mockServerPool.createServer(); + const client = new PayabliClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = {}; + const rawResponseBody = { responseText: "responseText" }; + server + .mockEndpoint() + .post("/Wallet/googlepay/configure-paypoint") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(503) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.wallet.configureGooglePayPaypoint(); + }).rejects.toThrow(Payabli.ServiceUnavailableError); + }); }); diff --git a/tsconfig.base.json b/tsconfig.base.json index c75083dc..d7627675 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -9,7 +9,9 @@ "declaration": true, "outDir": "dist", "rootDir": "src", - "baseUrl": "src" + "baseUrl": "src", + "isolatedModules": true, + "isolatedDeclarations": true }, "include": ["src"], "exclude": [] diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 95a5eb73..6ce90974 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -2,7 +2,8 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "module": "esnext", - "outDir": "dist/esm" + "outDir": "dist/esm", + "verbatimModuleSyntax": true }, "include": ["src"], "exclude": [] diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 00000000..ba2ec4f9 --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,28 @@ +import { defineConfig } from "vitest/config"; +export default defineConfig({ + test: { + projects: [ + { + test: { + globals: true, + name: "unit", + environment: "node", + root: "./tests", + include: ["**/*.test.{js,ts,jsx,tsx}"], + exclude: ["wire/**"], + setupFiles: ["./setup.ts"], + }, + }, + { + test: { + globals: true, + name: "wire", + environment: "node", + root: "./tests/wire", + setupFiles: ["../setup.ts", "../mock-server/setup.ts"], + }, + }, + ], + passWithNoTests: true, + }, +}); diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 5800814c..00000000 --- a/yarn.lock +++ /dev/null @@ -1,3225 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" - integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== - dependencies: - "@babel/helper-validator-identifier" "^7.27.1" - js-tokens "^4.0.0" - picocolors "^1.1.1" - -"@babel/compat-data@^7.27.2": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.5.tgz#a8a4962e1567121ac0b3b487f52107443b455c7f" - integrity sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA== - -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.5.tgz#4c81b35e51e1b734f510c99b07dfbc7bbbb48f7e" - integrity sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.5" - "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-module-transforms" "^7.28.3" - "@babel/helpers" "^7.28.4" - "@babel/parser" "^7.28.5" - "@babel/template" "^7.27.2" - "@babel/traverse" "^7.28.5" - "@babel/types" "^7.28.5" - "@jridgewell/remapping" "^2.3.5" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - -"@babel/generator@^7.28.5", "@babel/generator@^7.7.2": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.5.tgz#712722d5e50f44d07bc7ac9fe84438742dd61298" - integrity sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ== - dependencies: - "@babel/parser" "^7.28.5" - "@babel/types" "^7.28.5" - "@jridgewell/gen-mapping" "^0.3.12" - "@jridgewell/trace-mapping" "^0.3.28" - jsesc "^3.0.2" - -"@babel/helper-compilation-targets@^7.27.2": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" - integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== - dependencies: - "@babel/compat-data" "^7.27.2" - "@babel/helper-validator-option" "^7.27.1" - browserslist "^4.24.0" - lru-cache "^5.1.1" - semver "^6.3.1" - -"@babel/helper-globals@^7.28.0": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" - integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== - -"@babel/helper-module-imports@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" - integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== - dependencies: - "@babel/traverse" "^7.27.1" - "@babel/types" "^7.27.1" - -"@babel/helper-module-transforms@^7.28.3": - version "7.28.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz#a2b37d3da3b2344fe085dab234426f2b9a2fa5f6" - integrity sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw== - dependencies: - "@babel/helper-module-imports" "^7.27.1" - "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.28.3" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" - integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== - -"@babel/helper-string-parser@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" - integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== - -"@babel/helper-validator-identifier@^7.27.1", "@babel/helper-validator-identifier@^7.28.5": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" - integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== - -"@babel/helper-validator-option@^7.27.1": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" - integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== - -"@babel/helpers@^7.28.4": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.4.tgz#fe07274742e95bdf7cf1443593eeb8926ab63827" - integrity sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w== - dependencies: - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.4" - -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.28.5": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.5.tgz#0b0225ee90362f030efd644e8034c99468893b08" - integrity sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ== - dependencies: - "@babel/types" "^7.28.5" - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-class-static-block@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" - integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-import-attributes@^7.24.7": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" - integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - -"@babel/plugin-syntax-import-meta@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" - integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-jsx@^7.7.2": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" - integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-private-property-in-object@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" - integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-top-level-await@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.27.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" - integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== - dependencies: - "@babel/helper-plugin-utils" "^7.27.1" - -"@babel/template@^7.27.2", "@babel/template@^7.3.3": - version "7.27.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" - integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/parser" "^7.27.2" - "@babel/types" "^7.27.1" - -"@babel/traverse@^7.27.1", "@babel/traverse@^7.28.3", "@babel/traverse@^7.28.5": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.5.tgz#450cab9135d21a7a2ca9d2d35aa05c20e68c360b" - integrity sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ== - dependencies: - "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.28.5" - "@babel/helper-globals" "^7.28.0" - "@babel/parser" "^7.28.5" - "@babel/template" "^7.27.2" - "@babel/types" "^7.28.5" - debug "^4.3.1" - -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.28.2", "@babel/types@^7.28.4", "@babel/types@^7.28.5", "@babel/types@^7.3.3": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b" - integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA== - dependencies: - "@babel/helper-string-parser" "^7.27.1" - "@babel/helper-validator-identifier" "^7.28.5" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@inquirer/ansi@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@inquirer/ansi/-/ansi-1.0.2.tgz#674a4c4d81ad460695cb2a1fc69d78cd187f337e" - integrity sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ== - -"@inquirer/confirm@^5.0.0": - version "5.1.21" - resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.1.21.tgz#610c4acd7797d94890a6e2dde2c98eb1e891dd12" - integrity sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ== - dependencies: - "@inquirer/core" "^10.3.2" - "@inquirer/type" "^3.0.10" - -"@inquirer/core@^10.3.2": - version "10.3.2" - resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.3.2.tgz#535979ff3ff4fe1e7cc4f83e2320504c743b7e20" - integrity sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A== - dependencies: - "@inquirer/ansi" "^1.0.2" - "@inquirer/figures" "^1.0.15" - "@inquirer/type" "^3.0.10" - cli-width "^4.1.0" - mute-stream "^2.0.0" - signal-exit "^4.1.0" - wrap-ansi "^6.2.0" - yoctocolors-cjs "^2.1.3" - -"@inquirer/figures@^1.0.15": - version "1.0.15" - resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.15.tgz#dbb49ed80df11df74268023b496ac5d9acd22b3a" - integrity sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g== - -"@inquirer/type@^3.0.10": - version "3.0.10" - resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.10.tgz#11ed564ec78432a200ea2601a212d24af8150d50" - integrity sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@jest/console@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" - integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - -"@jest/core@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" - integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== - dependencies: - "@jest/console" "^29.7.0" - "@jest/reporters" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - ci-info "^3.2.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-changed-files "^29.7.0" - jest-config "^29.7.0" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-resolve-dependencies "^29.7.0" - jest-runner "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - jest-watcher "^29.7.0" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" - integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== - dependencies: - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-mock "^29.7.0" - -"@jest/expect-utils@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" - integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== - dependencies: - jest-get-type "^29.6.3" - -"@jest/expect@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" - integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== - dependencies: - expect "^29.7.0" - jest-snapshot "^29.7.0" - -"@jest/fake-timers@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" - integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== - dependencies: - "@jest/types" "^29.6.3" - "@sinonjs/fake-timers" "^10.0.2" - "@types/node" "*" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-util "^29.7.0" - -"@jest/globals@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" - integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/types" "^29.6.3" - jest-mock "^29.7.0" - -"@jest/reporters@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" - integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^6.0.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - jest-worker "^29.7.0" - slash "^3.0.0" - string-length "^4.0.1" - strip-ansi "^6.0.0" - v8-to-istanbul "^9.0.1" - -"@jest/schemas@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" - integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== - dependencies: - "@sinclair/typebox" "^0.27.8" - -"@jest/source-map@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" - integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== - dependencies: - "@jridgewell/trace-mapping" "^0.3.18" - callsites "^3.0.0" - graceful-fs "^4.2.9" - -"@jest/test-result@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" - integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== - dependencies: - "@jest/console" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" - integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== - dependencies: - "@jest/test-result" "^29.7.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - slash "^3.0.0" - -"@jest/transform@^29.7.0": - version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" - integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== - dependencies: - "@babel/core" "^7.11.6" - "@jest/types" "^29.6.3" - "@jridgewell/trace-mapping" "^0.3.18" - babel-plugin-istanbul "^6.1.1" - chalk "^4.0.0" - convert-source-map "^2.0.0" - fast-json-stable-stringify "^2.1.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - micromatch "^4.0.4" - pirates "^4.0.4" - slash "^3.0.0" - write-file-atomic "^4.0.2" - -"@jest/types@^29.6.3": - version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" - integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== - dependencies: - "@jest/schemas" "^29.6.3" - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^17.0.8" - chalk "^4.0.0" - -"@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": - version "0.3.13" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f" - integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.5.0" - "@jridgewell/trace-mapping" "^0.3.24" - -"@jridgewell/remapping@^2.3.5": - version "2.3.5" - resolved "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1" - integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.24" - -"@jridgewell/resolve-uri@^3.1.0": - version "3.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" - integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== - -"@jridgewell/source-map@^0.3.3": - version "0.3.11" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.11.tgz#b21835cbd36db656b857c2ad02ebd413cc13a9ba" - integrity sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - -"@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": - version "1.5.5" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" - integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== - -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25", "@jridgewell/trace-mapping@^0.3.28": - version "0.3.31" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" - integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== - dependencies: - "@jridgewell/resolve-uri" "^3.1.0" - "@jridgewell/sourcemap-codec" "^1.4.14" - -"@mswjs/interceptors@^0.40.0": - version "0.40.0" - resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.40.0.tgz#1b45f215ba8c2983ed133763ca03af92896083d6" - integrity sha512-EFd6cVbHsgLa6wa4RljGj6Wk75qoHxUSyc5asLyyPSyuhIcdS2Q3Phw6ImS1q+CkALthJRShiYfKANcQMuMqsQ== - dependencies: - "@open-draft/deferred-promise" "^2.2.0" - "@open-draft/logger" "^0.3.0" - "@open-draft/until" "^2.0.0" - is-node-process "^1.2.0" - outvariant "^1.4.3" - strict-event-emitter "^0.5.1" - -"@open-draft/deferred-promise@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd" - integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA== - -"@open-draft/logger@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954" - integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ== - dependencies: - is-node-process "^1.2.0" - outvariant "^1.4.0" - -"@open-draft/until@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda" - integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg== - -"@sinclair/typebox@^0.27.8": - version "0.27.8" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" - integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== - -"@sinonjs/commons@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" - integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== - dependencies: - type-detect "4.0.8" - -"@sinonjs/fake-timers@^10.0.2": - version "10.3.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" - integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== - dependencies: - "@sinonjs/commons" "^3.0.0" - -"@tootallnate/once@2": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" - integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== - -"@types/babel__core@^7.1.14": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" - integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== - dependencies: - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.27.0.tgz#b5819294c51179957afaec341442f9341e4108a9" - integrity sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" - integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.28.0" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz#07d713d6cce0d265c9849db0cbe62d3f61f36f74" - integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== - dependencies: - "@babel/types" "^7.28.2" - -"@types/eslint-scope@^3.7.7": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "9.6.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" - integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" - integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== - -"@types/graceful-fs@^4.1.3": - version "4.1.9" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" - integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" - integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== - -"@types/istanbul-lib-report@*": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" - integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" - integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/jest@^29.5.14": - version "29.5.14" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" - integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== - dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" - -"@types/jsdom@^20.0.0": - version "20.0.1" - resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" - integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== - dependencies: - "@types/node" "*" - "@types/tough-cookie" "*" - parse5 "^7.0.0" - -"@types/json-schema@*", "@types/json-schema@^7.0.15", "@types/json-schema@^7.0.9": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" - integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== - -"@types/node@*": - version "24.10.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.10.1.tgz#91e92182c93db8bd6224fca031e2370cef9a8f01" - integrity sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ== - dependencies: - undici-types "~7.16.0" - -"@types/node@^18.19.70": - version "18.19.130" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.130.tgz#da4c6324793a79defb7a62cba3947ec5add00d59" - integrity sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg== - dependencies: - undici-types "~5.26.4" - -"@types/stack-utils@^2.0.0": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" - integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== - -"@types/statuses@^2.0.6": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.6.tgz#66748315cc9a96d63403baa8671b2c124f8633aa" - integrity sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA== - -"@types/tough-cookie@*": - version "4.0.5" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" - integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== - -"@types/yargs-parser@*": - version "21.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" - integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== - -"@types/yargs@^17.0.8": - version "17.0.35" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.35.tgz#07013e46aa4d7d7d50a49e15604c1c5340d4eb24" - integrity sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg== - dependencies: - "@types/yargs-parser" "*" - -"@webassemblyjs/ast@1.14.1", "@webassemblyjs/ast@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.14.1.tgz#a9f6a07f2b03c95c8d38c4536a1fdfb521ff55b6" - integrity sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ== - dependencies: - "@webassemblyjs/helper-numbers" "1.13.2" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - -"@webassemblyjs/floating-point-hex-parser@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz#fcca1eeddb1cc4e7b6eed4fc7956d6813b21b9fb" - integrity sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA== - -"@webassemblyjs/helper-api-error@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz#e0a16152248bc38daee76dd7e21f15c5ef3ab1e7" - integrity sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ== - -"@webassemblyjs/helper-buffer@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz#822a9bc603166531f7d5df84e67b5bf99b72b96b" - integrity sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA== - -"@webassemblyjs/helper-numbers@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz#dbd932548e7119f4b8a7877fd5a8d20e63490b2d" - integrity sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA== - dependencies: - "@webassemblyjs/floating-point-hex-parser" "1.13.2" - "@webassemblyjs/helper-api-error" "1.13.2" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/helper-wasm-bytecode@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz#e556108758f448aae84c850e593ce18a0eb31e0b" - integrity sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA== - -"@webassemblyjs/helper-wasm-section@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz#9629dda9c4430eab54b591053d6dc6f3ba050348" - integrity sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/wasm-gen" "1.14.1" - -"@webassemblyjs/ieee754@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz#1c5eaace1d606ada2c7fd7045ea9356c59ee0dba" - integrity sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.13.2.tgz#57c5c3deb0105d02ce25fa3fd74f4ebc9fd0bbb0" - integrity sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.13.2": - version "1.13.2" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.13.2.tgz#917a20e93f71ad5602966c2d685ae0c6c21f60f1" - integrity sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ== - -"@webassemblyjs/wasm-edit@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz#ac6689f502219b59198ddec42dcd496b1004d597" - integrity sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/helper-wasm-section" "1.14.1" - "@webassemblyjs/wasm-gen" "1.14.1" - "@webassemblyjs/wasm-opt" "1.14.1" - "@webassemblyjs/wasm-parser" "1.14.1" - "@webassemblyjs/wast-printer" "1.14.1" - -"@webassemblyjs/wasm-gen@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz#991e7f0c090cb0bb62bbac882076e3d219da9570" - integrity sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/ieee754" "1.13.2" - "@webassemblyjs/leb128" "1.13.2" - "@webassemblyjs/utf8" "1.13.2" - -"@webassemblyjs/wasm-opt@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz#e6f71ed7ccae46781c206017d3c14c50efa8106b" - integrity sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-buffer" "1.14.1" - "@webassemblyjs/wasm-gen" "1.14.1" - "@webassemblyjs/wasm-parser" "1.14.1" - -"@webassemblyjs/wasm-parser@1.14.1", "@webassemblyjs/wasm-parser@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz#b3e13f1893605ca78b52c68e54cf6a865f90b9fb" - integrity sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@webassemblyjs/helper-api-error" "1.13.2" - "@webassemblyjs/helper-wasm-bytecode" "1.13.2" - "@webassemblyjs/ieee754" "1.13.2" - "@webassemblyjs/leb128" "1.13.2" - "@webassemblyjs/utf8" "1.13.2" - -"@webassemblyjs/wast-printer@1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz#3bb3e9638a8ae5fdaf9610e7a06b4d9f9aa6fe07" - integrity sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw== - dependencies: - "@webassemblyjs/ast" "1.14.1" - "@xtuc/long" "4.2.2" - -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - -abab@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - -acorn-globals@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" - integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== - dependencies: - acorn "^8.1.0" - acorn-walk "^8.0.2" - -acorn-import-phases@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7" - integrity sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ== - -acorn-walk@^8.0.2: - version "8.3.4" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" - integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== - dependencies: - acorn "^8.11.0" - -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.15.0, acorn@^8.8.1: - version "8.15.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" - integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - -ajv-formats@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-2.1.1.tgz#6e669400659eb74973bbf2e33327180a0996b520" - integrity sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA== - dependencies: - ajv "^8.0.0" - -ajv-keywords@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-5.1.0.tgz#69d4d385a4733cdbeab44964a1170a88f87f0e16" - integrity sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw== - dependencies: - fast-deep-equal "^3.1.3" - -ajv@^8.0.0, ajv@^8.9.0: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" - integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== - dependencies: - fast-deep-equal "^3.1.3" - fast-uri "^3.0.1" - json-schema-traverse "^1.0.0" - require-from-string "^2.0.2" - -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -anymatch@^3.0.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" - integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -babel-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" - integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== - dependencies: - "@jest/transform" "^29.7.0" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^29.6.3" - chalk "^4.0.0" - graceful-fs "^4.2.9" - slash "^3.0.0" - -babel-plugin-istanbul@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" - integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^5.0.4" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" - integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.1.14" - "@types/babel__traverse" "^7.0.6" - -babel-preset-current-node-syntax@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6" - integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.12.13" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - "@babel/plugin-syntax-import-attributes" "^7.24.7" - "@babel/plugin-syntax-import-meta" "^7.10.4" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - "@babel/plugin-syntax-top-level-await" "^7.14.5" - -babel-preset-jest@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" - integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== - dependencies: - babel-plugin-jest-hoist "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -baseline-browser-mapping@^2.9.0: - version "2.9.5" - resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.9.5.tgz#47f9549e0be1a84cd16651ac4c3b7d87a71408e6" - integrity sha512-D5vIoztZOq1XM54LUdttJVc96ggEsIfju2JBvht06pSzpckp3C7HReun67Bghzrtdsq9XdMGbSSB3v3GhMNmAA== - -brace-expansion@^1.1.7: - version "1.1.12" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843" - integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" - integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== - dependencies: - fill-range "^7.1.1" - -browserslist@^4.24.0, browserslist@^4.26.3: - version "4.28.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.28.1.tgz#7f534594628c53c63101079e27e40de490456a95" - integrity sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA== - dependencies: - baseline-browser-mapping "^2.9.0" - caniuse-lite "^1.0.30001759" - electron-to-chromium "^1.5.263" - node-releases "^2.0.27" - update-browserslist-db "^1.2.0" - -bs-logger@^0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" - integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== - dependencies: - fast-json-stable-stringify "2.x" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" - integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.2.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -caniuse-lite@^1.0.30001759: - version "1.0.30001759" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001759.tgz#d569e7b010372c6b0ca3946e30dada0a2e9d5006" - integrity sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw== - -chalk@^4.0.0, chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -chrome-trace-event@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" - integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== - -ci-info@^3.2.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" - integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== - -cjs-module-lexer@^1.0.0: - version "1.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz#0f79731eb8cfe1ec72acd4066efac9d61991b00d" - integrity sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q== - -cli-width@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" - integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== - -collect-v8-coverage@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz#cc1f01eb8d02298cbc9a437c74c70ab4e5210b80" - integrity sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw== - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -convert-source-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" - integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== - -cookie@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.1.1.tgz#3bb9bdfc82369db9c2f69c93c9c3ceb310c88b3c" - integrity sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ== - -create-jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" - integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.9" - jest-config "^29.7.0" - jest-util "^29.7.0" - prompts "^2.0.1" - -cross-spawn@^7.0.3: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -cssom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" - integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -data-urls@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" - integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== - dependencies: - abab "^2.0.6" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.4.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" - integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== - dependencies: - ms "^2.1.3" - -decimal.js@^10.4.2: - version "10.6.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" - integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== - -dedent@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.0.tgz#c1f9445335f0175a96587be245a282ff451446ca" - integrity sha512-HGFtf8yhuhGhqO07SV79tRp+br4MnbdjeVxotpn1QBl30pcLLCQjX5b2295ll0fv8RKDKsmWYrl05usHM9CewQ== - -deepmerge@^4.2.2: - version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" - integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" - integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== - -domexception@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" - integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== - dependencies: - webidl-conversions "^7.0.0" - -dunder-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" - integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== - dependencies: - call-bind-apply-helpers "^1.0.1" - es-errors "^1.3.0" - gopd "^1.2.0" - -electron-to-chromium@^1.5.263: - version "1.5.267" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz#5d84f2df8cdb6bfe7e873706bb21bd4bfb574dc7" - integrity sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw== - -emittery@^0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" - integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.3: - version "5.18.3" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz#9b5f4c5c076b8787c78fe540392ce76a88855b44" - integrity sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww== - dependencies: - graceful-fs "^4.2.4" - tapable "^2.2.0" - -entities@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-6.0.1.tgz#c28c34a43379ca7f61d074130b2f5f7020a30694" - integrity sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g== - -error-ex@^1.3.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.4.tgz#b3a8d8bb6f92eecc1629e3e27d3c8607a8a32414" - integrity sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ== - dependencies: - is-arrayish "^0.2.1" - -es-define-property@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" - integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - -es-module-lexer@^1.2.1: - version "1.7.0" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.7.0.tgz#9159601561880a85f2734560a9099b2c31e5372a" - integrity sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA== - -es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== - dependencies: - es-errors "^1.3.0" - -es-set-tostringtag@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" - integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== - dependencies: - es-errors "^1.3.0" - get-intrinsic "^1.2.6" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - -escalade@^3.1.1, escalade@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" - integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -eslint-scope@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -events@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== - -expect@^29.0.0, expect@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" - integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== - dependencies: - "@jest/expect-utils" "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - -fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-uri@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.0.tgz#66eecff6c764c0df9b762e62ca7edcfb53b4edfa" - integrity sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA== - -fb-watchman@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" - integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== - dependencies: - bser "2.1.1" - -fill-range@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" - integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== - dependencies: - to-regex-range "^5.0.1" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -form-data@^4.0.0: - version "4.0.5" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.5.tgz#b49e48858045ff4cbf6b03e1805cebcad3679053" - integrity sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.12" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -fsevents@^2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.2.6: - version "1.3.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" - integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== - dependencies: - call-bind-apply-helpers "^1.0.2" - es-define-property "^1.0.1" - es-errors "^1.3.0" - es-object-atoms "^1.1.1" - function-bind "^1.1.2" - get-proto "^1.0.1" - gopd "^1.2.0" - has-symbols "^1.1.0" - hasown "^2.0.2" - math-intrinsics "^1.1.0" - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" - integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== - dependencies: - dunder-proto "^1.0.1" - es-object-atoms "^1.0.0" - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - -glob@^7.1.3, glob@^7.1.4: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -gopd@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" - integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== - -graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -graphql@^16.12.0: - version "16.12.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.12.0.tgz#28cc2462435b1ac3fdc6976d030cef83a0c13ac7" - integrity sha512-DKKrynuQRne0PNpEbzuEdHlYOMksHSUI8Zc9Unei5gTsMNA2/vMpoMz/yKba50pejK56qj98qM0SjYxAKi13gQ== - -handlebars@^4.7.8: - version "4.7.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" - integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== - dependencies: - minimist "^1.2.5" - neo-async "^2.6.2" - source-map "^0.6.1" - wordwrap "^1.0.0" - optionalDependencies: - uglify-js "^3.1.4" - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.3, has-symbols@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" - integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== - -has-tostringtag@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" - integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== - dependencies: - has-symbols "^1.0.3" - -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - -headers-polyfill@^4.0.2: - version "4.0.3" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" - integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== - -html-encoding-sniffer@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" - integrity sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA== - dependencies: - whatwg-encoding "^2.0.0" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -http-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" - integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== - dependencies: - "@tootallnate/once" "2" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" - integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== - dependencies: - agent-base "6" - debug "4" - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -iconv-lite@0.6.3: - version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" - integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -import-local@^3.0.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" - integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== - -is-core-module@^2.16.1: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== - dependencies: - hasown "^2.0.2" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-node-process@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-node-process/-/is-node-process-1.2.0.tgz#ea02a1b90ddb3934a19aea414e88edef7e11d134" - integrity sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - -is-stream@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" - integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== - -istanbul-lib-instrument@^5.0.4: - version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" - integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== - dependencies: - "@babel/core" "^7.12.3" - "@babel/parser" "^7.14.7" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.2.0" - semver "^6.3.0" - -istanbul-lib-instrument@^6.0.0: - version "6.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" - integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== - dependencies: - "@babel/core" "^7.23.9" - "@babel/parser" "^7.23.9" - "@istanbuljs/schema" "^0.1.3" - istanbul-lib-coverage "^3.2.0" - semver "^7.5.4" - -istanbul-lib-report@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" - integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^4.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" - integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" - integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -jest-changed-files@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" - integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== - dependencies: - execa "^5.0.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - -jest-circus@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" - integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/expect" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^1.0.0" - is-generator-fn "^2.0.0" - jest-each "^29.7.0" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-runtime "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - p-limit "^3.1.0" - pretty-format "^29.7.0" - pure-rand "^6.0.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-cli@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" - integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== - dependencies: - "@jest/core" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - chalk "^4.0.0" - create-jest "^29.7.0" - exit "^0.1.2" - import-local "^3.0.2" - jest-config "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - yargs "^17.3.1" - -jest-config@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" - integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== - dependencies: - "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.7.0" - "@jest/types" "^29.6.3" - babel-jest "^29.7.0" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-circus "^29.7.0" - jest-environment-node "^29.7.0" - jest-get-type "^29.6.3" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-runner "^29.7.0" - jest-util "^29.7.0" - jest-validate "^29.7.0" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^29.7.0" - slash "^3.0.0" - strip-json-comments "^3.1.1" - -jest-diff@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" - integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== - dependencies: - chalk "^4.0.0" - diff-sequences "^29.6.3" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-docblock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" - integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== - dependencies: - detect-newline "^3.0.0" - -jest-each@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" - integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== - dependencies: - "@jest/types" "^29.6.3" - chalk "^4.0.0" - jest-get-type "^29.6.3" - jest-util "^29.7.0" - pretty-format "^29.7.0" - -jest-environment-jsdom@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" - integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/jsdom" "^20.0.0" - "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" - jsdom "^20.0.0" - -jest-environment-node@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" - integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" - -jest-get-type@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" - integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== - -jest-haste-map@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" - integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== - dependencies: - "@jest/types" "^29.6.3" - "@types/graceful-fs" "^4.1.3" - "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.9" - jest-regex-util "^29.6.3" - jest-util "^29.7.0" - jest-worker "^29.7.0" - micromatch "^4.0.4" - walker "^1.0.8" - optionalDependencies: - fsevents "^2.3.2" - -jest-leak-detector@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" - integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== - dependencies: - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-matcher-utils@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" - integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== - dependencies: - chalk "^4.0.0" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - pretty-format "^29.7.0" - -jest-message-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" - integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.6.3" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^29.7.0" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-mock@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" - integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - jest-util "^29.7.0" - -jest-pnp-resolver@^1.2.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" - integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== - -jest-regex-util@^29.6.3: - version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" - integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== - -jest-resolve-dependencies@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" - integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== - dependencies: - jest-regex-util "^29.6.3" - jest-snapshot "^29.7.0" - -jest-resolve@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" - integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== - dependencies: - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-pnp-resolver "^1.2.2" - jest-util "^29.7.0" - jest-validate "^29.7.0" - resolve "^1.20.0" - resolve.exports "^2.0.0" - slash "^3.0.0" - -jest-runner@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" - integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== - dependencies: - "@jest/console" "^29.7.0" - "@jest/environment" "^29.7.0" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.13.1" - graceful-fs "^4.2.9" - jest-docblock "^29.7.0" - jest-environment-node "^29.7.0" - jest-haste-map "^29.7.0" - jest-leak-detector "^29.7.0" - jest-message-util "^29.7.0" - jest-resolve "^29.7.0" - jest-runtime "^29.7.0" - jest-util "^29.7.0" - jest-watcher "^29.7.0" - jest-worker "^29.7.0" - p-limit "^3.1.0" - source-map-support "0.5.13" - -jest-runtime@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" - integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/globals" "^29.7.0" - "@jest/source-map" "^29.6.3" - "@jest/test-result" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^29.7.0" - jest-message-util "^29.7.0" - jest-mock "^29.7.0" - jest-regex-util "^29.6.3" - jest-resolve "^29.7.0" - jest-snapshot "^29.7.0" - jest-util "^29.7.0" - slash "^3.0.0" - strip-bom "^4.0.0" - -jest-snapshot@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" - integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== - dependencies: - "@babel/core" "^7.11.6" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-jsx" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.7.0" - "@jest/transform" "^29.7.0" - "@jest/types" "^29.6.3" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^29.7.0" - graceful-fs "^4.2.9" - jest-diff "^29.7.0" - jest-get-type "^29.6.3" - jest-matcher-utils "^29.7.0" - jest-message-util "^29.7.0" - jest-util "^29.7.0" - natural-compare "^1.4.0" - pretty-format "^29.7.0" - semver "^7.5.3" - -jest-util@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" - integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== - dependencies: - "@jest/types" "^29.6.3" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.9" - picomatch "^2.2.3" - -jest-validate@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" - integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== - dependencies: - "@jest/types" "^29.6.3" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^29.6.3" - leven "^3.1.0" - pretty-format "^29.7.0" - -jest-watcher@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" - integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== - dependencies: - "@jest/test-result" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.13.1" - jest-util "^29.7.0" - string-length "^4.0.1" - -jest-worker@^27.4.5: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest-worker@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" - integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== - dependencies: - "@types/node" "*" - jest-util "^29.7.0" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" - integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== - dependencies: - "@jest/core" "^29.7.0" - "@jest/types" "^29.6.3" - import-local "^3.0.2" - jest-cli "^29.7.0" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@^3.13.1: - version "3.14.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0" - integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsdom@^20.0.0: - version "20.0.3" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" - integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== - dependencies: - abab "^2.0.6" - acorn "^8.8.1" - acorn-globals "^7.0.0" - cssom "^0.5.0" - cssstyle "^2.3.0" - data-urls "^3.0.2" - decimal.js "^10.4.2" - domexception "^4.0.0" - escodegen "^2.0.0" - form-data "^4.0.0" - html-encoding-sniffer "^3.0.0" - http-proxy-agent "^5.0.0" - https-proxy-agent "^5.0.1" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.2" - parse5 "^7.1.1" - saxes "^6.0.0" - symbol-tree "^3.2.4" - tough-cookie "^4.1.2" - w3c-xmlserializer "^4.0.0" - webidl-conversions "^7.0.0" - whatwg-encoding "^2.0.0" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - ws "^8.11.0" - xml-name-validator "^4.0.0" - -jsesc@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" - integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== - -json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" - integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== - -json-schema-traverse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" - integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== - -json5@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== - -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== - -lines-and-columns@^1.1.6: - version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" - integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== - -loader-runner@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.1.tgz#6c76ed29b0ccce9af379208299f07f876de737e3" - integrity sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q== - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -lodash.memoize@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== - -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - -make-dir@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" - integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== - dependencies: - semver "^7.5.3" - -make-error@^1.3.6: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -makeerror@1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" - integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== - dependencies: - tmpl "1.0.5" - -math-intrinsics@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" - integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== - -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== - -micromatch@^4.0.0, micromatch@^4.0.4: - version "4.0.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" - integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== - dependencies: - braces "^3.0.3" - picomatch "^2.3.1" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.12, mime-types@^2.1.27: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimatch@^3.0.4, minimatch@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.5: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -ms@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -msw@^2.8.4: - version "2.12.4" - resolved "https://registry.yarnpkg.com/msw/-/msw-2.12.4.tgz#9a7045a6ef831826f57f4050552ca41dd21fe0d4" - integrity sha512-rHNiVfTyKhzc0EjoXUBVGteNKBevdjOlVC6GlIRXpy+/3LHEIGRovnB5WPjcvmNODVQ1TNFnoa7wsGbd0V3epg== - dependencies: - "@inquirer/confirm" "^5.0.0" - "@mswjs/interceptors" "^0.40.0" - "@open-draft/deferred-promise" "^2.2.0" - "@types/statuses" "^2.0.6" - cookie "^1.0.2" - graphql "^16.12.0" - headers-polyfill "^4.0.2" - is-node-process "^1.2.0" - outvariant "^1.4.3" - path-to-regexp "^6.3.0" - picocolors "^1.1.1" - rettime "^0.7.0" - statuses "^2.0.2" - strict-event-emitter "^0.5.1" - tough-cookie "^6.0.0" - type-fest "^5.2.0" - until-async "^3.0.2" - yargs "^17.7.2" - -mute-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" - integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== - -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== - -node-releases@^2.0.27: - version "2.0.27" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.27.tgz#eedca519205cf20f650f61d56b070db111231e4e" - integrity sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA== - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" - -nwsapi@^2.2.2: - version "2.2.23" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.23.tgz#59712c3a88e6de2bb0b6ccc1070397267019cf6c" - integrity sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ== - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -outvariant@^1.4.0, outvariant@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873" - integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA== - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -parse-json@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" - integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== - dependencies: - "@babel/code-frame" "^7.0.0" - error-ex "^1.3.1" - json-parse-even-better-errors "^2.3.0" - lines-and-columns "^1.1.6" - -parse5@^7.0.0, parse5@^7.1.1: - version "7.3.0" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.3.0.tgz#d7e224fa72399c7a175099f45fc2ad024b05ec05" - integrity sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw== - dependencies: - entities "^6.0.0" - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^3.0.0, path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-to-regexp@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.3.0.tgz#2b6a26a337737a8e1416f9272ed0766b1c0389f4" - integrity sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ== - -picocolors@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" - integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== - -picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -pirates@^4.0.4: - version "4.0.7" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" - integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -prettier@^3.4.2: - version "3.7.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.7.4.tgz#d2f8335d4b1cec47e1c8098645411b0c9dff9c0f" - integrity sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA== - -pretty-format@^29.0.0, pretty-format@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" - integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== - dependencies: - "@jest/schemas" "^29.6.3" - ansi-styles "^5.0.0" - react-is "^18.0.0" - -prompts@^2.0.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" - integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== - dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" - -psl@^1.1.33: - version "1.15.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.15.0.tgz#bdace31896f1d97cec6a79e8224898ce93d974c6" - integrity sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w== - dependencies: - punycode "^2.3.1" - -punycode@^2.1.1, punycode@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" - integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== - -pure-rand@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" - integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -react-is@^18.0.0: - version "18.3.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" - integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -require-from-string@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve.exports@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" - integrity sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A== - -resolve@^1.20.0: - version "1.22.11" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.11.tgz#aad857ce1ffb8bfa9b0b1ac29f1156383f68c262" - integrity sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ== - dependencies: - is-core-module "^2.16.1" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -rettime@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/rettime/-/rettime-0.7.0.tgz#c040f1a65e396eaa4b8346dd96ed937edc79d96f" - integrity sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw== - -safe-buffer@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -"safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -saxes@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" - integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== - dependencies: - xmlchars "^2.2.0" - -schema-utils@^4.3.0, schema-utils@^4.3.3: - version "4.3.3" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.3.3.tgz#5b1850912fa31df90716963d45d9121fdfc09f46" - integrity sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA== - dependencies: - "@types/json-schema" "^7.0.9" - ajv "^8.9.0" - ajv-formats "^2.1.1" - ajv-keywords "^5.1.0" - -semver@^6.3.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.7.3: - version "7.7.3" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.3.tgz#4b5f4143d007633a8dc671cd0a6ef9147b8bb946" - integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== - -serialize-javascript@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" - integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== - dependencies: - randombytes "^2.1.0" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -signal-exit@^3.0.3, signal-exit@^3.0.7: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -signal-exit@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -source-map-support@0.5.13: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -source-map@^0.7.4: - version "0.7.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" - integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - -stack-utils@^2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" - integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== - dependencies: - escape-string-regexp "^2.0.0" - -statuses@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" - integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== - -strict-event-emitter@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93" - integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ== - -string-length@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" - integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== - dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== - -strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -tagged-tag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/tagged-tag/-/tagged-tag-1.0.0.tgz#a0b5917c2864cba54841495abfa3f6b13edcf4d6" - integrity sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng== - -tapable@^2.2.0, tapable@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.3.0.tgz#7e3ea6d5ca31ba8e078b560f0d83ce9a14aa8be6" - integrity sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg== - -terser-webpack-plugin@^5.3.11: - version "5.3.15" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.15.tgz#0a26860b765eaffa8e840170aabc5b3a3f6f6bb9" - integrity sha512-PGkOdpRFK+rb1TzVz+msVhw4YMRT9txLF4kRqvJhGhCM324xuR3REBSHALN+l+sAhKUmz0aotnjp5D+P83mLhQ== - dependencies: - "@jridgewell/trace-mapping" "^0.3.25" - jest-worker "^27.4.5" - schema-utils "^4.3.0" - serialize-javascript "^6.0.2" - terser "^5.31.1" - -terser@^5.31.1: - version "5.44.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.44.1.tgz#e391e92175c299b8c284ad6ded609e37303b0a9c" - integrity sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.15.0" - commander "^2.20.0" - source-map-support "~0.5.20" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -tldts-core@^7.0.19: - version "7.0.19" - resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.0.19.tgz#9dd8a457a09b4e65c8266c029f1847fa78dead20" - integrity sha512-lJX2dEWx0SGH4O6p+7FPwYmJ/bu1JbcGJ8RLaG9b7liIgZ85itUVEPbMtWRVrde/0fnDPEPHW10ZsKW3kVsE9A== - -tldts@^7.0.5: - version "7.0.19" - resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.0.19.tgz#84cd7a7f04e68ec93b93b106fac038c527b99368" - integrity sha512-8PWx8tvC4jDB39BQw1m4x8y5MH1BcQ5xHeL2n7UVFulMPH/3Q0uiamahFJ3lXA0zO2SUyRXuVVbWSDmstlt9YA== - dependencies: - tldts-core "^7.0.19" - -tmpl@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" - integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@^4.1.2: - version "4.1.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" - integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tough-cookie@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-6.0.0.tgz#11e418b7864a2c0d874702bc8ce0f011261940e5" - integrity sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w== - dependencies: - tldts "^7.0.5" - -tr46@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" - integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== - dependencies: - punycode "^2.1.1" - -ts-jest@^29.3.4: - version "29.4.6" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.6.tgz#51cb7c133f227396818b71297ad7409bb77106e9" - integrity sha512-fSpWtOO/1AjSNQguk43hb/JCo16oJDnMJf3CdEGNkqsEX3t0KX96xvyX1D7PfLCpVoKu4MfVrqUkFyblYoY4lA== - dependencies: - bs-logger "^0.2.6" - fast-json-stable-stringify "^2.1.0" - handlebars "^4.7.8" - json5 "^2.2.3" - lodash.memoize "^4.1.2" - make-error "^1.3.6" - semver "^7.7.3" - type-fest "^4.41.0" - yargs-parser "^21.1.1" - -ts-loader@^9.5.1: - version "9.5.4" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.4.tgz#44b571165c10fb5a90744aa5b7e119233c4f4585" - integrity sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ== - dependencies: - chalk "^4.1.0" - enhanced-resolve "^5.0.0" - micromatch "^4.0.0" - semver "^7.3.4" - source-map "^0.7.4" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -type-fest@^4.41.0: - version "4.41.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" - integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== - -type-fest@^5.2.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-5.3.1.tgz#251b8d0a813c1dbccf1f9450ba5adcdf7072adc2" - integrity sha512-VCn+LMHbd4t6sF3wfU/+HKT63C9OoyrSIf4b+vtWHpt2U7/4InZG467YDNMFMR70DdHjAdpPWmw2lzRdg0Xqqg== - dependencies: - tagged-tag "^1.0.0" - -typescript@~5.7.2: - version "5.7.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" - integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== - -uglify-js@^3.1.4: - version "3.19.3" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" - integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== - -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - -undici-types@~7.16.0: - version "7.16.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" - integrity sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -until-async@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/until-async/-/until-async-3.0.2.tgz#447f1531fdd7bb2b4c7a98869bdb1a4c2a23865f" - integrity sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw== - -update-browserslist-db@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz#cfb4358afa08b3d5731a2ecd95eebf4ddef8033e" - integrity sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA== - dependencies: - escalade "^3.2.0" - picocolors "^1.1.1" - -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -v8-to-istanbul@^9.0.1: - version "9.3.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz#b9572abfa62bd556c16d75fdebc1a411d5ff3175" - integrity sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - -w3c-xmlserializer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" - integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== - dependencies: - xml-name-validator "^4.0.0" - -walker@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" - integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== - dependencies: - makeerror "1.0.12" - -watchpack@^2.4.4: - version "2.4.4" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.4.tgz#473bda72f0850453da6425081ea46fc0d7602947" - integrity sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - -webidl-conversions@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" - integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== - -webpack-sources@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" - integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== - -webpack@^5.97.1: - version "5.103.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.103.0.tgz#17a7c5a5020d5a3a37c118d002eade5ee2c6f3da" - integrity sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw== - dependencies: - "@types/eslint-scope" "^3.7.7" - "@types/estree" "^1.0.8" - "@types/json-schema" "^7.0.15" - "@webassemblyjs/ast" "^1.14.1" - "@webassemblyjs/wasm-edit" "^1.14.1" - "@webassemblyjs/wasm-parser" "^1.14.1" - acorn "^8.15.0" - acorn-import-phases "^1.0.3" - browserslist "^4.26.3" - chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.3" - es-module-lexer "^1.2.1" - eslint-scope "5.1.1" - events "^3.2.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.2.11" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.3.1" - mime-types "^2.1.27" - neo-async "^2.6.2" - schema-utils "^4.3.3" - tapable "^2.3.0" - terser-webpack-plugin "^5.3.11" - watchpack "^2.4.4" - webpack-sources "^3.3.3" - -whatwg-encoding@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" - integrity sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg== - dependencies: - iconv-lite "0.6.3" - -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" - integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== - dependencies: - tr46 "^3.0.0" - webidl-conversions "^7.0.0" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -wordwrap@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -write-file-atomic@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" - integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^3.0.7" - -ws@^8.11.0: - version "8.18.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472" - integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== - -xml-name-validator@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" - integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs@^17.3.1, yargs@^17.7.2: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== - -yoctocolors-cjs@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz#7e4964ea8ec422b7a40ac917d3a344cfd2304baa" - integrity sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==