From 06d1cf31195a35912f0d26a6fb5b60debe44fe6a Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Tue, 10 Mar 2026 23:19:22 +0200 Subject: [PATCH] feat: add response DTOs for CreditNoteRefunds and Resource modules - Add ResourceMetaResponse DTO for resource metadata - Update CreditNoteRefunds service with proper types - Regenerate SDK types from updated OpenAPI schema - Update SDK bank-rules, credit-notes, and organization modules Co-Authored-By: Claude Sonnet 4.6 --- .../GetRefundCreditNoteTransaction.service.ts | 12 +- .../modules/Resource/Resource.controller.ts | 34 +- .../Resource/dtos/ResourceMetaResponse.dto.ts | 386 +++++ shared/sdk-ts/openapi.json | 1395 +++++++++++++++-- shared/sdk-ts/package.json | 3 +- shared/sdk-ts/src/bank-rules.ts | 12 +- shared/sdk-ts/src/credit-notes.ts | 2 +- shared/sdk-ts/src/index.ts | 1 - shared/sdk-ts/src/organization.ts | 5 +- shared/sdk-ts/src/schema.ts | 617 +++++++- 10 files changed, 2234 insertions(+), 233 deletions(-) create mode 100644 packages/server/src/modules/Resource/dtos/ResourceMetaResponse.dto.ts diff --git a/packages/server/src/modules/CreditNoteRefunds/queries/GetRefundCreditNoteTransaction.service.ts b/packages/server/src/modules/CreditNoteRefunds/queries/GetRefundCreditNoteTransaction.service.ts index a8df1f92c..2b7b80ee6 100644 --- a/packages/server/src/modules/CreditNoteRefunds/queries/GetRefundCreditNoteTransaction.service.ts +++ b/packages/server/src/modules/CreditNoteRefunds/queries/GetRefundCreditNoteTransaction.service.ts @@ -1,16 +1,13 @@ import { Inject, Injectable } from '@nestjs/common'; +import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service'; import { RefundCreditNote } from '../models/RefundCreditNote'; import { RefundCreditNoteTransformer } from '../../CreditNotes/queries/RefundCreditNoteTransformer'; import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel'; @Injectable() export class GetRefundCreditNoteTransaction { - /** - * @param {RefundCreditNoteTransformer} transformer - * @param {typeof RefundCreditNote} refundCreditNoteModel - */ constructor( - private readonly transformer: RefundCreditNoteTransformer, + private readonly transformer: TransformerInjectable, @Inject(RefundCreditNote.name) private readonly refundCreditNoteModel: TenantModelProxy< @@ -33,6 +30,9 @@ export class GetRefundCreditNoteTransaction { .withGraphFetched('creditNote') .throwIfNotFound(); - return this.transformer.transform(refundCreditNote); + return this.transformer.transform( + refundCreditNote, + new RefundCreditNoteTransformer(), + ); } } diff --git a/packages/server/src/modules/Resource/Resource.controller.ts b/packages/server/src/modules/Resource/Resource.controller.ts index fbf389ebf..496197bb6 100644 --- a/packages/server/src/modules/Resource/Resource.controller.ts +++ b/packages/server/src/modules/Resource/Resource.controller.ts @@ -1,21 +1,41 @@ import { Controller, Get, Param } from '@nestjs/common'; -import { GetResourceViewsService } from '../Views/GetResourceViews.service'; import { ResourceService } from './ResourceService'; -import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; +import { + ApiExtraModels, + ApiOperation, + ApiParam, + ApiResponse, + ApiTags, + getSchemaPath, +} from '@nestjs/swagger'; +import { ResourceMetaResponseDto } from './dtos/ResourceMetaResponse.dto'; @Controller('resources') @ApiTags('resources') +@ApiExtraModels(ResourceMetaResponseDto) export class ResourceController { constructor(private readonly resourcesService: ResourceService) {} @Get('/:resourceModel/meta') - @ApiResponse({ status: 200, description: 'Retrieves the resource meta' }) @ApiOperation({ summary: 'Retrieves the resource meta' }) - getResourceMeta(@Param('resourceModel') resourceModel: string) { + @ApiParam({ + name: 'resourceModel', + description: 'The resource model name (e.g., SaleInvoice, Customer, Item)', + example: 'SaleInvoice', + required: true, + }) + @ApiResponse({ + status: 200, + description: 'Retrieves the resource meta', + schema: { + $ref: getSchemaPath(ResourceMetaResponseDto), + }, + }) + getResourceMeta( + @Param('resourceModel') resourceModel: string, + ): ResourceMetaResponseDto { const resourceMeta = this.resourcesService.getResourceMeta(resourceModel); - return { - resourceMeta, - }; + return resourceMeta as ResourceMetaResponseDto; } } diff --git a/packages/server/src/modules/Resource/dtos/ResourceMetaResponse.dto.ts b/packages/server/src/modules/Resource/dtos/ResourceMetaResponse.dto.ts new file mode 100644 index 000000000..ff9ecb882 --- /dev/null +++ b/packages/server/src/modules/Resource/dtos/ResourceMetaResponse.dto.ts @@ -0,0 +1,386 @@ +import { ApiProperty, getSchemaPath } from '@nestjs/swagger'; +import { IModelMetaDefaultSort } from '@/interfaces/Model'; + +export class ModelMetaDefaultSortDto implements IModelMetaDefaultSort { + @ApiProperty({ + description: 'The sort order', + example: 'DESC', + enum: ['DESC', 'ASC'], + }) + sortOrder: 'DESC' | 'ASC'; + + @ApiProperty({ + description: 'The sort field', + example: 'createdAt', + }) + sortField: string; +} + +export class ModelMetaEnumerationOptionDto { + @ApiProperty({ + description: 'The option key', + example: 'active', + }) + key: string; + + @ApiProperty({ + description: 'The option label', + example: 'Active', + }) + label: string; +} + +export class ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field name', + example: 'Customer Name', + }) + name: string; + + @ApiProperty({ + description: 'The database column name', + example: 'customerName', + }) + column: string; + + @ApiProperty({ + description: 'Whether the field is columnable', + example: true, + required: false, + }) + columnable?: boolean; + + @ApiProperty({ + description: 'Whether the field is required', + example: true, + required: false, + }) + required?: boolean; + + @ApiProperty({ + description: 'The import hint for the field', + example: 'Enter the customer display name', + required: false, + }) + importHint?: string; + + @ApiProperty({ + description: 'The importable relation label', + example: 'displayName', + required: false, + }) + importableRelationLabel?: string; + + @ApiProperty({ + description: 'The field order', + example: 1, + required: false, + }) + order?: number; + + @ApiProperty({ + description: 'Whether the field is unique', + example: 1, + required: false, + }) + unique?: number; + + @ApiProperty({ + description: 'The data transfer object key', + example: 'customerDisplayName', + required: false, + }) + dataTransferObjectKey?: string; +} + +export class ModelMetaFieldTextDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'text', + }) + fieldType: 'text'; + + @ApiProperty({ + description: 'The minimum length', + example: 1, + required: false, + }) + minLength?: number; + + @ApiProperty({ + description: 'The maximum length', + example: 255, + required: false, + }) + maxLength?: number; +} + +export class ModelMetaFieldNumberDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'number', + }) + fieldType: 'number'; + + @ApiProperty({ + description: 'The minimum value', + example: 0, + required: false, + }) + min?: number; + + @ApiProperty({ + description: 'The maximum value', + example: 999999, + required: false, + }) + max?: number; +} + +export class ModelMetaFieldBooleanDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'boolean', + }) + fieldType: 'boolean'; +} + +export class ModelMetaFieldDateDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'date', + }) + fieldType: 'date'; +} + +export class ModelMetaFieldUrlDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'url', + }) + fieldType: 'url'; +} + +export class ModelMetaFieldEnumerationDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'enumeration', + }) + fieldType: 'enumeration'; + + @ApiProperty({ + description: 'The enumeration options', + type: 'array', + items: { $ref: getSchemaPath(ModelMetaEnumerationOptionDto) }, + }) + options: ModelMetaEnumerationOptionDto[]; +} + +export class ModelMetaFieldRelationDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'relation', + }) + fieldType: 'relation'; + + @ApiProperty({ + description: 'The relation type', + example: 'enumeration', + }) + relationType: 'enumeration'; + + @ApiProperty({ + description: 'The relation key', + example: 'customerId', + }) + relationKey: string; + + @ApiProperty({ + description: 'The relation entity label', + example: 'displayName', + }) + relationEntityLabel: string; + + @ApiProperty({ + description: 'The relation entity key', + example: 'id', + }) + relationEntityKey: string; +} + +export class ModelMetaFieldCollectionDto extends ModelMetaFieldCommonDto { + @ApiProperty({ + description: 'The field type', + example: 'collection', + }) + fieldType: 'collection'; + + @ApiProperty({ + description: 'The collection type', + example: 'object', + }) + collectionOf: 'object'; + + @ApiProperty({ + description: 'The minimum collection length', + example: 1, + required: false, + }) + collectionMinLength?: number; + + @ApiProperty({ + description: 'The maximum collection length', + example: 100, + required: false, + }) + collectionMaxLength?: number; + + @ApiProperty({ + description: 'The nested fields', + required: false, + }) + fields?: Record; +} + +export class ModelMetaColumnMetaDto { + @ApiProperty({ + description: 'The column name', + example: 'Customer Name', + }) + name: string; + + @ApiProperty({ + description: 'The column accessor', + example: 'customer.displayName', + required: false, + }) + accessor?: string; + + @ApiProperty({ + description: 'Whether the column is exportable', + example: true, + required: false, + }) + exportable?: boolean; +} + +export class ModelMetaColumnTextDto extends ModelMetaColumnMetaDto { + @ApiProperty({ + description: 'The column type', + example: 'text', + }) + type: 'text'; +} + +export class ModelMetaColumnCollectionDto extends ModelMetaColumnMetaDto { + @ApiProperty({ + description: 'The column type', + example: 'collection', + }) + type: 'collection'; + + @ApiProperty({ + description: 'The collection type', + example: 'object', + }) + collectionOf: 'object'; + + @ApiProperty({ + description: 'The nested columns', + type: 'object', + additionalProperties: { $ref: getSchemaPath(ModelMetaColumnTextDto) }, + }) + columns: Record; +} + +export class ModelPrintMetaDto { + @ApiProperty({ + description: 'The page title for print', + example: 'Invoice INV-0001', + }) + pageTitle: string; +} + +export class ResourceMetaResponseDto { + @ApiProperty({ + description: 'The default filter field', + example: 'query', + }) + defaultFilterField: string; + + @ApiProperty({ + description: 'The default sort configuration', + type: () => ModelMetaDefaultSortDto, + }) + defaultSort: ModelMetaDefaultSortDto; + + @ApiProperty({ + description: 'Whether the resource is exportable', + example: true, + required: false, + }) + exportable?: boolean; + + @ApiProperty({ + description: 'The field to flatten on during export', + example: 'entries', + required: false, + }) + exportFlattenOn?: string; + + @ApiProperty({ + description: 'Whether the resource is importable', + example: true, + required: false, + }) + importable?: boolean; + + @ApiProperty({ + description: 'The import aggregator field', + example: 'entries', + required: false, + }) + importAggregator?: string; + + @ApiProperty({ + description: 'The field to aggregate on during import', + example: 'referenceNo', + required: false, + }) + importAggregateOn?: string; + + @ApiProperty({ + description: 'The field to aggregate by during import', + example: 'id', + required: false, + }) + importAggregateBy?: string; + + @ApiProperty({ + description: 'The print metadata', + type: () => ModelPrintMetaDto, + required: false, + }) + print?: ModelPrintMetaDto; + + @ApiProperty({ + description: 'The resource fields (legacy format)', + type: 'object', + additionalProperties: true, + }) + fields: Record; + + @ApiProperty({ + description: 'The resource fields (new format)', + type: 'object', + additionalProperties: true, + }) + fields2: Record; + + @ApiProperty({ + description: 'The resource columns', + type: 'object', + additionalProperties: true, + }) + columns: Record; +} diff --git a/shared/sdk-ts/openapi.json b/shared/sdk-ts/openapi.json index d0a9ba602..f000507bd 100644 --- a/shared/sdk-ts/openapi.json +++ b/shared/sdk-ts/openapi.json @@ -1329,6 +1329,24 @@ "schema": { "type": "string" } + }, + { + "name": "page", + "required": false, + "in": "query", + "schema": { + "example": 1, + "type": "number" + } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "schema": { + "example": 12, + "type": "number" + } } ], "responses": { @@ -1337,10 +1355,7 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InventoryAdjustmentResponseDto" - } + "$ref": "#/components/schemas/InventoryAdjustmentsListResponseDto" } } } @@ -2279,6 +2294,104 @@ ], "type": "string" } + }, + { + "name": "customViewId", + "required": false, + "in": "query", + "description": "Custom view ID", + "schema": { + "example": 1, + "type": "number" + } + }, + { + "name": "filterRoles", + "required": false, + "in": "query", + "description": "Filter roles array", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "columnSortBy", + "required": false, + "in": "query", + "description": "Column to sort by", + "schema": { + "example": "created_at", + "type": "string" + } + }, + { + "name": "sortOrder", + "required": false, + "in": "query", + "description": "Sort order", + "schema": { + "example": "DESC", + "enum": [ + "DESC", + "ASC" + ], + "type": "string" + } + }, + { + "name": "stringifiedFilterRoles", + "required": false, + "in": "query", + "description": "Stringified filter roles", + "schema": { + "example": "{\"fieldKey\":\"root_type\",\"value\":\"asset\"}", + "type": "string" + } + }, + { + "name": "searchKeyword", + "required": false, + "in": "query", + "description": "Search keyword", + "schema": { + "example": "bank account", + "type": "string" + } + }, + { + "name": "viewSlug", + "required": false, + "in": "query", + "description": "View slug", + "schema": { + "example": "assets", + "type": "string" + } + }, + { + "name": "page", + "required": false, + "in": "query", + "description": "Page number", + "schema": { + "minimum": 1, + "example": 1, + "type": "number" + } + }, + { + "name": "pageSize", + "required": false, + "in": "query", + "description": "Page size", + "schema": { + "minimum": 1, + "example": 25, + "type": "number" + } } ], "responses": { @@ -2707,7 +2820,14 @@ ], "responses": { "200": { - "description": "" + "description": "Items inventory cost list", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetInventoryItemsCostResponseDto" + } + } + } } }, "tags": [ @@ -5293,14 +5413,23 @@ "name": "resourceModel", "required": true, "in": "path", + "description": "The resource model name (e.g., SaleInvoice, Customer, Item)", "schema": { + "example": "SaleInvoice", "type": "string" } } ], "responses": { "200": { - "description": "Retrieves the resource meta" + "description": "Retrieves the resource meta", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourceMetaResponseDto" + } + } + } } }, "tags": [ @@ -5349,13 +5478,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "type": "object", - "description": "Payment link metadata" - } - } + "$ref": "#/components/schemas/GetInvoicePaymentLinkResponseWrapperDto" } } } @@ -5410,17 +5533,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Stripe checkout session ID" - }, - "url": { - "type": "string", - "description": "Stripe checkout session URL" - } - } + "$ref": "#/components/schemas/CreateStripeCheckoutSessionResponseDto" } } } @@ -5493,10 +5606,19 @@ "/api/stripe/link": { "get": { "operationId": "StripeIntegrationController_getStripeConnectLink", + "summary": "Get Stripe Connect link", + "description": "Retrieves the Stripe OAuth2 Connect authorization URL", "parameters": [], "responses": { "200": { - "description": "" + "description": "Successfully retrieved Stripe Connect link", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetStripeConnectLinkResponseDto" + } + } + } } }, "tags": [ @@ -5507,10 +5629,78 @@ "/api/stripe/callback": { "post": { "operationId": "StripeIntegrationController_exchangeOAuth", + "summary": "Exchange Stripe OAuth code", + "description": "Exchanges the Stripe authorization code for user id and access token", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExchangeStripeOAuthBodyDto" + } + } + } + }, + "responses": { + "201": { + "description": "Successfully exchanged OAuth code" + } + }, + "tags": [ + "stripe" + ] + } + }, + "/api/stripe/account": { + "post": { + "operationId": "StripeIntegrationController_createAccount", + "summary": "Create Stripe account", + "description": "Creates a new Stripe Connect account", "parameters": [], "responses": { "201": { - "description": "" + "description": "Successfully created Stripe account", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateStripeAccountResponseDto" + } + } + } + } + }, + "tags": [ + "stripe" + ] + } + }, + "/api/stripe/account_session": { + "post": { + "operationId": "StripeIntegrationController_createAccountSession", + "summary": "Create Stripe account session", + "description": "Creates an account session for the Stripe Connect embedded component", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateStripeAccountSessionBodyDto" + } + } + } + }, + "responses": { + "201": { + "description": "Successfully created account session", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateStripeAccountSessionResponseDto" + } + } + } } }, "tags": [ @@ -5521,10 +5711,29 @@ "/api/stripe/account_link": { "post": { "operationId": "StripeIntegrationController_createAccountLink", + "summary": "Create Stripe account link", + "description": "Creates a Stripe Connect account link for onboarding", "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateStripeAccountLinkBodyDto" + } + } + } + }, "responses": { "201": { - "description": "" + "description": "Successfully created account link", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateStripeAccountLinkResponseDto" + } + } + } } }, "tags": [ @@ -9679,7 +9888,14 @@ ], "responses": { "200": { - "description": "Returns the credit note state" + "description": "Returns the credit note state", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreditNoteStateResponseDto" + } + } + } } }, "tags": [ @@ -10031,7 +10247,17 @@ ], "responses": { "200": { - "description": "" + "description": "Credit note refunds retrieved successfully.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RefundCreditNoteResponseDto" + } + } + } + } } }, "tags": [ @@ -10091,6 +10317,54 @@ } }, "/api/credit-notes/refunds/{refundCreditId}": { + "get": { + "operationId": "CreditNoteRefundsController_getRefundCreditNoteTransaction", + "summary": "Retrieve a refund transaction for the given credit note.", + "parameters": [ + { + "name": "Authorization", + "in": "header", + "description": "Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token.", + "required": true, + "schema": { + "type": "string", + "example": "Bearer bc_1234567890abcdef" + } + }, + { + "name": "organization-id", + "in": "header", + "description": "Required if Authorization is a JWT token. The organization ID to operate within.", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "refundCreditId", + "required": true, + "in": "path", + "schema": { + "type": "number" + } + } + ], + "responses": { + "200": { + "description": "Refund credit note transaction retrieved successfully.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RefundCreditNoteResponseDto" + } + } + } + } + }, + "tags": [ + "Credit Note Refunds" + ] + }, "delete": { "operationId": "CreditNoteRefundsController_deleteRefundCreditNote", "summary": "Delete a refund for the given credit note.", @@ -10168,7 +10442,17 @@ ], "responses": { "200": { - "description": "Credit note successfully applied to invoices" + "description": "Credit note successfully applied to invoices", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AppliedCreditNoteInvoiceResponseDto" + } + } + } + } }, "400": { "description": "Invalid input data" @@ -10217,7 +10501,17 @@ ], "responses": { "200": { - "description": "Credit note associated invoices to apply" + "description": "Credit note associated invoices to apply", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CreditNoteInvoiceToApplyResponseDto" + } + } + } + } }, "400": { "description": "Invalid input data" @@ -11140,7 +11434,7 @@ { "name": "vendorId", "required": true, - "in": "path", + "in": "query", "description": "The vendor id", "schema": { "type": "number" @@ -11536,115 +11830,6 @@ "example": false, "type": "boolean" } - }, - { - "description": "Custom view ID", - "required": false, - "name": "customViewId", - "in": "query", - "schema": { - "example": 1, - "type": "number" - } - }, - { - "description": "Filter roles array", - "required": false, - "name": "filterRoles", - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "array" - } - } - }, - { - "description": "Column to sort by", - "required": false, - "name": "columnSortBy", - "in": "query", - "schema": { - "example": "created_at", - "type": "string" - } - }, - { - "description": "Sort order", - "required": false, - "name": "sortOrder", - "in": "query", - "schema": { - "example": "DESC", - "enum": [ - "DESC", - "ASC" - ], - "type": "string" - } - }, - { - "description": "Stringified filter roles", - "required": false, - "name": "stringifiedFilterRoles", - "in": "query", - "schema": { - "example": "{\"fieldKey\":\"status\",\"value\":\"active\"}", - "type": "string" - } - }, - { - "description": "Search keyword", - "required": false, - "name": "searchKeyword", - "in": "query", - "schema": { - "example": "bank account", - "type": "string" - } - }, - { - "description": "View slug", - "required": false, - "name": "viewSlug", - "in": "query", - "schema": { - "example": "active-accounts", - "type": "string" - } - }, - { - "description": "Page number", - "required": false, - "name": "page", - "in": "query", - "schema": { - "minimum": 1, - "example": 1, - "type": "number" - } - }, - { - "description": "Page size", - "required": false, - "name": "pageSize", - "in": "query", - "schema": { - "minimum": 1, - "example": 25, - "type": "number" - } - }, - { - "description": "Include inactive accounts", - "required": false, - "name": "inactiveMode", - "in": "query", - "schema": { - "default": false, - "example": false, - "type": "boolean" - } } ], "responses": { @@ -21675,7 +21860,14 @@ ], "responses": { "200": { - "description": "" + "description": "Returns the organization build job details", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrganizationBuildJobResponseDto" + } + } + } } }, "tags": [ @@ -22237,7 +22429,17 @@ "parameters": [], "responses": { "200": { - "description": "" + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DateFormatResponseDto" + } + } + } + } } }, "tags": [ @@ -24042,6 +24244,46 @@ "entries" ] }, + "InventoryAdjustmentsPaginationDto": { + "type": "object", + "properties": { + "page": { + "type": "number", + "example": 1 + }, + "pageSize": { + "type": "number", + "example": 12 + }, + "total": { + "type": "number", + "example": 42 + } + }, + "required": [ + "page", + "pageSize", + "total" + ] + }, + "InventoryAdjustmentsListResponseDto": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InventoryAdjustmentResponseDto" + } + }, + "pagination": { + "$ref": "#/components/schemas/InventoryAdjustmentsPaginationDto" + } + }, + "required": [ + "data", + "pagination" + ] + }, "CreateQuickInventoryAdjustmentDto": { "type": "object", "properties": { @@ -24931,6 +25173,48 @@ "parentAccountId" ] }, + "InventoryItemCostDto": { + "type": "object", + "properties": { + "itemId": { + "type": "number", + "description": "Item ID" + }, + "valuation": { + "type": "number", + "description": "Valuation" + }, + "quantity": { + "type": "number", + "description": "Quantity" + }, + "average": { + "type": "number", + "description": "Average cost" + } + }, + "required": [ + "itemId", + "valuation", + "quantity", + "average" + ] + }, + "GetInventoryItemsCostResponseDto": { + "type": "object", + "properties": { + "costs": { + "description": "List of item costs", + "type": "array", + "items": { + "$ref": "#/components/schemas/InventoryItemCostDto" + } + } + }, + "required": [ + "costs" + ] + }, "GenerateSaleInvoiceSharableLinkResponseDto": { "type": "object", "properties": { @@ -26205,6 +26489,551 @@ "attachments" ] }, + "ModelMetaDefaultSortDto": { + "type": "object", + "properties": { + "sortOrder": { + "type": "string", + "description": "The sort order", + "example": "DESC", + "enum": [ + "DESC", + "ASC" + ] + }, + "sortField": { + "type": "string", + "description": "The sort field", + "example": "createdAt" + } + }, + "required": [ + "sortOrder", + "sortField" + ] + }, + "ModelPrintMetaDto": { + "type": "object", + "properties": { + "pageTitle": { + "type": "string", + "description": "The page title for print", + "example": "Invoice INV-0001" + } + }, + "required": [ + "pageTitle" + ] + }, + "ResourceMetaResponseDto": { + "type": "object", + "properties": { + "defaultFilterField": { + "type": "string", + "description": "The default filter field", + "example": "query" + }, + "defaultSort": { + "description": "The default sort configuration", + "allOf": [ + { + "$ref": "#/components/schemas/ModelMetaDefaultSortDto" + } + ] + }, + "exportable": { + "type": "boolean", + "description": "Whether the resource is exportable", + "example": true + }, + "exportFlattenOn": { + "type": "string", + "description": "The field to flatten on during export", + "example": "entries" + }, + "importable": { + "type": "boolean", + "description": "Whether the resource is importable", + "example": true + }, + "importAggregator": { + "type": "string", + "description": "The import aggregator field", + "example": "entries" + }, + "importAggregateOn": { + "type": "string", + "description": "The field to aggregate on during import", + "example": "referenceNo" + }, + "importAggregateBy": { + "type": "string", + "description": "The field to aggregate by during import", + "example": "id" + }, + "print": { + "description": "The print metadata", + "allOf": [ + { + "$ref": "#/components/schemas/ModelPrintMetaDto" + } + ] + }, + "fields": { + "type": "object", + "description": "The resource fields (legacy format)", + "additionalProperties": true + }, + "fields2": { + "type": "object", + "description": "The resource fields (new format)", + "additionalProperties": true + }, + "columns": { + "type": "object", + "description": "The resource columns", + "additionalProperties": true + } + }, + "required": [ + "defaultFilterField", + "defaultSort", + "fields", + "fields2", + "columns" + ] + }, + "PaymentLinkEntryDto": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "Line item description" + }, + "itemName": { + "type": "string", + "description": "Item name" + }, + "quantity": { + "type": "number", + "description": "Quantity" + }, + "quantityFormatted": { + "type": "string", + "description": "Formatted quantity" + }, + "rate": { + "type": "number", + "description": "Unit rate" + }, + "rateFormatted": { + "type": "string", + "description": "Formatted rate" + }, + "total": { + "type": "number", + "description": "Line total" + }, + "totalFormatted": { + "type": "string", + "description": "Formatted total" + } + }, + "required": [ + "description", + "itemName", + "quantity", + "quantityFormatted", + "rate", + "rateFormatted", + "total", + "totalFormatted" + ] + }, + "PaymentLinkTaxEntryDto": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Tax name" + }, + "taxRateAmount": { + "type": "number", + "description": "Tax rate amount" + }, + "taxRateAmountFormatted": { + "type": "string", + "description": "Formatted tax rate amount" + }, + "taxRateCode": { + "type": "string", + "description": "Tax rate code" + } + }, + "required": [ + "name", + "taxRateAmount", + "taxRateAmountFormatted", + "taxRateCode" + ] + }, + "PaymentLinkBrandingTemplateDto": { + "type": "object", + "properties": { + "companyLogoUri": { + "type": "string", + "description": "Company logo URI" + }, + "primaryColor": { + "type": "string", + "description": "Primary color" + }, + "secondaryColor": { + "type": "string", + "description": "Secondary color" + } + }, + "required": [ + "companyLogoUri", + "primaryColor" + ] + }, + "PaymentLinkOrganizationDto": { + "type": "object", + "properties": { + "address": { + "type": "object", + "description": "Organization address" + }, + "name": { + "type": "string", + "description": "Organization name" + }, + "primaryColor": { + "type": "string", + "description": "Primary brand color" + }, + "logoUri": { + "type": "string", + "description": "Logo URI" + }, + "addressTextFormatted": { + "type": "string", + "description": "Formatted address text" + } + }, + "required": [ + "address", + "name", + "primaryColor", + "logoUri", + "addressTextFormatted" + ] + }, + "GetInvoicePaymentLinkResponseDto": { + "type": "object", + "properties": { + "dueAmount": { + "type": "number", + "description": "Amount due" + }, + "dueAmountFormatted": { + "type": "string", + "description": "Formatted amount due" + }, + "dueDate": { + "type": "string", + "description": "Due date" + }, + "dueDateFormatted": { + "type": "string", + "description": "Formatted due date" + }, + "invoiceDateFormatted": { + "type": "string", + "description": "Formatted invoice date" + }, + "invoiceNo": { + "type": "string", + "description": "Invoice number" + }, + "paymentAmount": { + "type": "number", + "description": "Payment amount" + }, + "paymentAmountFormatted": { + "type": "string", + "description": "Formatted payment amount" + }, + "subtotal": { + "type": "number", + "description": "Subtotal" + }, + "subtotalFormatted": { + "type": "string", + "description": "Formatted subtotal" + }, + "subtotalLocalFormatted": { + "type": "string", + "description": "Formatted subtotal in local currency" + }, + "total": { + "type": "number", + "description": "Total amount" + }, + "totalFormatted": { + "type": "string", + "description": "Formatted total" + }, + "totalLocalFormatted": { + "type": "string", + "description": "Formatted total in local currency" + }, + "customerName": { + "type": "string", + "description": "Customer name" + }, + "invoiceMessage": { + "type": "string", + "description": "Invoice message" + }, + "termsConditions": { + "type": "string", + "description": "Terms and conditions" + }, + "entries": { + "description": "Invoice line entries", + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentLinkEntryDto" + } + }, + "taxes": { + "description": "Tax entries", + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentLinkTaxEntryDto" + } + }, + "brandingTemplate": { + "description": "Branding template", + "allOf": [ + { + "$ref": "#/components/schemas/PaymentLinkBrandingTemplateDto" + } + ] + }, + "organization": { + "description": "Organization metadata", + "allOf": [ + { + "$ref": "#/components/schemas/PaymentLinkOrganizationDto" + } + ] + }, + "hasStripePaymentMethod": { + "type": "boolean", + "description": "Whether Stripe is available as payment method" + }, + "isReceivable": { + "type": "boolean", + "description": "Whether invoice has receivable balance" + }, + "formattedCustomerAddress": { + "type": "string", + "description": "Formatted customer address" + } + }, + "required": [ + "dueAmount", + "dueAmountFormatted", + "dueDate", + "dueDateFormatted", + "invoiceDateFormatted", + "invoiceNo", + "paymentAmount", + "paymentAmountFormatted", + "subtotal", + "subtotalFormatted", + "subtotalLocalFormatted", + "total", + "totalFormatted", + "totalLocalFormatted", + "customerName", + "invoiceMessage", + "termsConditions", + "entries", + "taxes", + "brandingTemplate", + "organization", + "hasStripePaymentMethod", + "isReceivable", + "formattedCustomerAddress" + ] + }, + "GetInvoicePaymentLinkResponseWrapperDto": { + "type": "object", + "properties": { + "data": { + "description": "Payment link invoice metadata", + "allOf": [ + { + "$ref": "#/components/schemas/GetInvoicePaymentLinkResponseDto" + } + ] + } + }, + "required": [ + "data" + ] + }, + "CreateStripeCheckoutSessionResponseDto": { + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "description": "Stripe checkout session ID", + "example": "cs_test_xxx" + }, + "publishableKey": { + "type": "string", + "description": "Stripe publishable key for the client", + "example": "pk_test_xxx" + }, + "redirectTo": { + "type": "string", + "description": "URL to redirect the customer to complete checkout", + "example": "https://checkout.stripe.com/c/pay/cs_test_xxx" + } + }, + "required": [ + "sessionId", + "publishableKey", + "redirectTo" + ] + }, + "GetStripeConnectLinkResponseDto": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "Stripe OAuth2 Connect authorization URL", + "example": "https://connect.stripe.com/oauth/authorize?response_type=code&client_id=..." + } + }, + "required": [ + "url" + ] + }, + "ExchangeStripeOAuthBodyDto": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Authorization code returned by Stripe OAuth", + "example": "ac_xxx" + } + }, + "required": [ + "code" + ] + }, + "CreateStripeAccountResponseDto": { + "type": "object", + "properties": { + "account_id": { + "type": "string", + "description": "The Stripe Connect account ID", + "example": "acct_1234567890" + } + }, + "required": [ + "account_id" + ] + }, + "CreateStripeAccountSessionBodyDto": { + "type": "object", + "properties": { + "account": { + "type": "string", + "description": "Stripe Connect account ID to create a session for", + "example": "acct_1234567890" + } + } + }, + "CreateStripeAccountSessionResponseDto": { + "type": "object", + "properties": { + "client_secret": { + "type": "string", + "description": "Stripe Account Session client secret for the Connect embedded component", + "example": "acs_xxx_secret_xxx" + } + }, + "required": [ + "client_secret" + ] + }, + "CreateStripeAccountLinkBodyDto": { + "type": "object", + "properties": { + "stripeAccountId": { + "type": "string", + "description": "Stripe Connect account ID", + "example": "acct_xxx" + } + }, + "required": [ + "stripeAccountId" + ] + }, + "StripeAccountLinkResponseDto": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "URL for the account onboarding flow", + "example": "https://connect.stripe.com/setup/xxx" + }, + "created": { + "type": "number", + "description": "Unix timestamp when the link was created", + "example": 1234567890 + }, + "expires_at": { + "type": "number", + "description": "Unix timestamp when the link expires", + "example": 1234567890 + }, + "object": { + "type": "string", + "description": "Stripe object type", + "example": "account_link" + } + }, + "required": [ + "url", + "created", + "expires_at", + "object" + ] + }, + "CreateStripeAccountLinkResponseDto": { + "type": "object", + "properties": { + "clientSecret": { + "description": "Stripe AccountLink object for onboarding", + "allOf": [ + { + "$ref": "#/components/schemas/StripeAccountLinkResponseDto" + } + ] + } + }, + "required": [ + "clientSecret" + ] + }, "ItemCategoryResponseDto": { "type": "object", "properties": { @@ -30177,6 +31006,19 @@ "discountType" ] }, + "CreditNoteStateResponseDto": { + "type": "object", + "properties": { + "defaultTemplateId": { + "type": "number", + "description": "Default PDF template ID for credit notes", + "example": 1 + } + }, + "required": [ + "defaultTemplateId" + ] + }, "EditCreditNoteDto": { "type": "object", "properties": { @@ -30283,6 +31125,90 @@ "discountType" ] }, + "RefundCreditAccountDto": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 10 + }, + "name": { + "type": "string", + "example": "Cash on Hand" + } + }, + "required": [ + "id", + "name" + ] + }, + "RefundCreditNoteSummaryDto": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 + }, + "creditNoteNumber": { + "type": "string", + "example": "CN-0001" + } + }, + "required": [ + "id", + "creditNoteNumber" + ] + }, + "RefundCreditNoteResponseDto": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 100 + }, + "date": { + "type": "string", + "example": "2024-01-15" + }, + "formattedDate": { + "type": "string", + "example": "2024-01-15" + }, + "amount": { + "type": "number", + "example": 250 + }, + "formttedAmount": { + "type": "string", + "example": "$250.00" + }, + "referenceNo": { + "type": "string", + "example": "REF-001", + "nullable": true + }, + "description": { + "type": "string", + "example": "Refund issued to customer", + "nullable": true + }, + "fromAccount": { + "$ref": "#/components/schemas/RefundCreditAccountDto" + }, + "creditNote": { + "$ref": "#/components/schemas/RefundCreditNoteSummaryDto" + } + }, + "required": [ + "id", + "date", + "formattedDate", + "amount", + "formttedAmount", + "fromAccount", + "creditNote" + ] + }, "CreditNoteRefundDto": { "type": "object", "properties": { @@ -30333,6 +31259,130 @@ "branchId" ] }, + "AppliedCreditNoteInvoiceResponseDto": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 + }, + "amount": { + "type": "number", + "example": 200 + }, + "formttedAmount": { + "type": "string", + "example": "$200.00" + }, + "creditNoteNumber": { + "type": "string", + "example": "CN-0001" + }, + "creditNoteDate": { + "type": "string", + "example": "2024-01-10" + }, + "formattedCreditNoteDate": { + "type": "string", + "example": "2024-01-10" + }, + "invoiceNumber": { + "type": "string", + "example": "INV-0001" + }, + "invoiceReferenceNo": { + "type": "string", + "example": "REF-001", + "nullable": true + } + }, + "required": [ + "id", + "amount", + "formttedAmount", + "creditNoteNumber", + "creditNoteDate", + "formattedCreditNoteDate", + "invoiceNumber" + ] + }, + "CreditNoteInvoiceToApplyResponseDto": { + "type": "object", + "properties": { + "id": { + "type": "number", + "example": 1 + }, + "invoiceNo": { + "type": "string", + "example": "INV-0001" + }, + "referenceNo": { + "type": "string", + "example": "REF-001", + "nullable": true + }, + "invoiceDate": { + "type": "string", + "example": "2024-01-10" + }, + "dueDate": { + "type": "string", + "example": "2024-01-20" + }, + "currencyCode": { + "type": "string", + "example": "USD", + "nullable": true + }, + "balance": { + "type": "number", + "example": 500 + }, + "dueAmount": { + "type": "number", + "example": 500 + }, + "paymentAmount": { + "type": "number", + "example": 0 + }, + "formattedInvoiceDate": { + "type": "string", + "example": "2024-01-10" + }, + "formattedDueDate": { + "type": "string", + "example": "2024-01-20" + }, + "formatted_amount": { + "type": "string", + "example": "$500.00" + }, + "formattedDueAmount": { + "type": "string", + "example": "$500.00" + }, + "formattedPaymentAmount": { + "type": "string", + "example": "$0.00" + } + }, + "required": [ + "id", + "invoiceNo", + "invoiceDate", + "dueDate", + "balance", + "dueAmount", + "paymentAmount", + "formattedInvoiceDate", + "formattedDueDate", + "formatted_amount", + "formattedDueAmount", + "formattedPaymentAmount" + ] + }, "ApplyCreditNoteInvoiceEntryDto": { "type": "object", "properties": { @@ -37332,6 +38382,48 @@ "permissions" ] }, + "OrganizationBuildJobResponseDto": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "123" + }, + "state": { + "type": "string", + "example": "active" + }, + "progress": { + "type": "object", + "example": 50 + }, + "isCompleted": { + "type": "boolean", + "example": false + }, + "isRunning": { + "type": "boolean", + "example": true + }, + "isWaiting": { + "type": "boolean", + "example": false + }, + "isFailed": { + "type": "boolean", + "example": false + } + }, + "required": [ + "id", + "state", + "progress", + "isCompleted", + "isRunning", + "isWaiting", + "isFailed" + ] + }, "OrganizationMetadataResponseDto": { "type": "object", "properties": { @@ -37815,6 +38907,23 @@ "currencySign" ] }, + "DateFormatResponseDto": { + "type": "object", + "properties": { + "label": { + "type": "string", + "example": "03/09/2026 [MM/DD/YYYY]" + }, + "key": { + "type": "string", + "example": "MM/DD/YYYY" + } + }, + "required": [ + "label", + "key" + ] + }, "EditUserDto": { "type": "object", "properties": { diff --git a/shared/sdk-ts/package.json b/shared/sdk-ts/package.json index c403a960b..073669618 100644 --- a/shared/sdk-ts/package.json +++ b/shared/sdk-ts/package.json @@ -17,7 +17,8 @@ "build:cjs": "tsup src/index.ts --format cjs --dts --sourcemap", "build:esm": "tsup src/index.ts --format esm --dts --sourcemap", "build": "npm run build:cjs && npm run build:esm", - "dev": "npm run build -- --watch" + "dev": "npm run build -- --watch", + "typecheck": "tsc --noEmit" }, "author": "", "license": "ISC", diff --git a/shared/sdk-ts/src/bank-rules.ts b/shared/sdk-ts/src/bank-rules.ts index 4f7a1113d..072827efc 100644 --- a/shared/sdk-ts/src/bank-rules.ts +++ b/shared/sdk-ts/src/bank-rules.ts @@ -266,9 +266,6 @@ export async function fetchAutofillCategorizeTransaction( return data as AutofillCategorizeTransactionResponse; } -/** - * Uncategorize bank transactions in bulk (DELETE /api/banking/categorize/bulk with query uncategorizedTransactionIds). - */ export async function uncategorizeTransactionsBulk( fetcher: ApiFetcher, uncategorizedTransactionIds: number[], @@ -276,11 +273,6 @@ export async function uncategorizeTransactionsBulk( const del = fetcher .path(BANK_RULES_ROUTES.CATEGORIZE_BULK) .method('delete') - .create( - { uncategorizedTransactionIds } as unknown as { - uncategorizedTransactionIds: true | 1; - }, - ); - // create() binds query; call with no args (params were passed to create()) - await (del as unknown as () => Promise)(); + .create({ uncategorizedTransactionIds: 1 }); + await del({ uncategorizedTransactionIds: uncategorizedTransactionIds.map(String) }); } diff --git a/shared/sdk-ts/src/credit-notes.ts b/shared/sdk-ts/src/credit-notes.ts index 8762f433c..095a4f973 100644 --- a/shared/sdk-ts/src/credit-notes.ts +++ b/shared/sdk-ts/src/credit-notes.ts @@ -154,7 +154,7 @@ export async function fetchRefundCreditNoteTransaction( refundCreditId: number ): Promise { const get = fetcher.path(CREDIT_NOTES_ROUTES.REFUND_BY_ID).method('get').create(); - const { data } = await get({ refundCreditId }); + const { data } = await get({ refundCreditId: String(refundCreditId) } as never); return data; } diff --git a/shared/sdk-ts/src/index.ts b/shared/sdk-ts/src/index.ts index f9bdd5b2a..57aae06ea 100644 --- a/shared/sdk-ts/src/index.ts +++ b/shared/sdk-ts/src/index.ts @@ -20,7 +20,6 @@ export * from './manual-journals'; export * from './roles'; export * from './users'; export * from './dashboard'; -export * from './export'; export * from './settings'; export * from './organization'; export * from './subscription'; diff --git a/shared/sdk-ts/src/organization.ts b/shared/sdk-ts/src/organization.ts index 51250e852..bbd3260f9 100644 --- a/shared/sdk-ts/src/organization.ts +++ b/shared/sdk-ts/src/organization.ts @@ -37,7 +37,10 @@ export async function buildOrganization( export async function fetchOrgBaseCurrencyMutateAbilities( fetcher: ApiFetcher ): Promise { - const get = fetcher.path(ORGANIZATION_ROUTES.BASE_CURRENCY_MUTATE).method('get').create(); + const get = fetcher + .path(ORGANIZATION_ROUTES.BASE_CURRENCY_MUTATE) + .method('get') + .create(); const { data } = await get({}); return data; } diff --git a/shared/sdk-ts/src/schema.ts b/shared/sdk-ts/src/schema.ts index 52bbc6584..8c5290aeb 100644 --- a/shared/sdk-ts/src/schema.ts +++ b/shared/sdk-ts/src/schema.ts @@ -1539,6 +1539,10 @@ export interface paths { path?: never; cookie?: never; }; + /** + * Get Stripe Connect link + * @description Retrieves the Stripe OAuth2 Connect authorization URL + */ get: operations["StripeIntegrationController_getStripeConnectLink"]; put?: never; post?: never; @@ -1557,6 +1561,10 @@ export interface paths { }; get?: never; put?: never; + /** + * Exchange Stripe OAuth code + * @description Exchanges the Stripe authorization code for user id and access token + */ post: operations["StripeIntegrationController_exchangeOAuth"]; delete?: never; options?: never; @@ -1564,22 +1572,6 @@ export interface paths { patch?: never; trace?: never; }; - "/api/stripe/account_link": { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - get?: never; - put?: never; - post: operations["StripeIntegrationController_createAccountLink"]; - delete?: never; - options?: never; - head?: never; - patch?: never; - trace?: never; - }; "/api/stripe/account": { parameters: { query?: never; @@ -1589,6 +1581,10 @@ export interface paths { }; get?: never; put?: never; + /** + * Create Stripe account + * @description Creates a new Stripe Connect account + */ post: operations["StripeIntegrationController_createAccount"]; delete?: never; options?: never; @@ -1605,6 +1601,10 @@ export interface paths { }; get?: never; put?: never; + /** + * Create Stripe account session + * @description Creates an account session for the Stripe Connect embedded component + */ post: operations["StripeIntegrationController_createAccountSession"]; delete?: never; options?: never; @@ -1612,6 +1612,26 @@ export interface paths { patch?: never; trace?: never; }; + "/api/stripe/account_link": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * Create Stripe account link + * @description Creates a Stripe Connect account link for onboarding + */ + post: operations["StripeIntegrationController_createAccountLink"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/api/webhooks/stripe": { parameters: { query?: never; @@ -2723,7 +2743,8 @@ export interface paths { path?: never; cookie?: never; }; - get?: never; + /** Retrieve a refund transaction for the given credit note. */ + get: operations["CreditNoteRefundsController_getRefundCreditNoteTransaction"]; put?: never; post?: never; /** Delete a refund for the given credit note. */ @@ -5544,6 +5565,18 @@ export interface components { /** @description The entries associated with this adjustment */ entries: unknown[][]; }; + InventoryAdjustmentsPaginationDto: { + /** @example 1 */ + page: number; + /** @example 12 */ + pageSize: number; + /** @example 42 */ + total: number; + }; + InventoryAdjustmentsListResponseDto: { + data: components["schemas"]["InventoryAdjustmentResponseDto"][]; + pagination: components["schemas"]["InventoryAdjustmentsPaginationDto"]; + }; CreateQuickInventoryAdjustmentDto: { /** * Format: date-time @@ -6179,6 +6212,20 @@ export interface components { */ parentAccountId: number; }; + InventoryItemCostDto: { + /** @description Item ID */ + itemId: number; + /** @description Valuation */ + valuation: number; + /** @description Quantity */ + quantity: number; + /** @description Average cost */ + average: number; + }; + GetInventoryItemsCostResponseDto: { + /** @description List of item costs */ + costs: components["schemas"]["InventoryItemCostDto"][]; + }; GenerateSaleInvoiceSharableLinkResponseDto: { /** * @description Sharable payment link for the sale invoice @@ -7157,6 +7204,266 @@ export interface components { */ attachments: string[]; }; + ModelMetaDefaultSortDto: { + /** + * @description The sort order + * @example DESC + * @enum {string} + */ + sortOrder: "DESC" | "ASC"; + /** + * @description The sort field + * @example createdAt + */ + sortField: string; + }; + ModelPrintMetaDto: { + /** + * @description The page title for print + * @example Invoice INV-0001 + */ + pageTitle: string; + }; + ResourceMetaResponseDto: { + /** + * @description The default filter field + * @example query + */ + defaultFilterField: string; + /** @description The default sort configuration */ + defaultSort: components["schemas"]["ModelMetaDefaultSortDto"]; + /** + * @description Whether the resource is exportable + * @example true + */ + exportable?: boolean; + /** + * @description The field to flatten on during export + * @example entries + */ + exportFlattenOn?: string; + /** + * @description Whether the resource is importable + * @example true + */ + importable?: boolean; + /** + * @description The import aggregator field + * @example entries + */ + importAggregator?: string; + /** + * @description The field to aggregate on during import + * @example referenceNo + */ + importAggregateOn?: string; + /** + * @description The field to aggregate by during import + * @example id + */ + importAggregateBy?: string; + /** @description The print metadata */ + print?: components["schemas"]["ModelPrintMetaDto"]; + /** @description The resource fields (legacy format) */ + fields: { + [key: string]: unknown; + }; + /** @description The resource fields (new format) */ + fields2: { + [key: string]: unknown; + }; + /** @description The resource columns */ + columns: { + [key: string]: unknown; + }; + }; + PaymentLinkEntryDto: { + /** @description Line item description */ + description: string; + /** @description Item name */ + itemName: string; + /** @description Quantity */ + quantity: number; + /** @description Formatted quantity */ + quantityFormatted: string; + /** @description Unit rate */ + rate: number; + /** @description Formatted rate */ + rateFormatted: string; + /** @description Line total */ + total: number; + /** @description Formatted total */ + totalFormatted: string; + }; + PaymentLinkTaxEntryDto: { + /** @description Tax name */ + name: string; + /** @description Tax rate amount */ + taxRateAmount: number; + /** @description Formatted tax rate amount */ + taxRateAmountFormatted: string; + /** @description Tax rate code */ + taxRateCode: string; + }; + PaymentLinkBrandingTemplateDto: { + /** @description Company logo URI */ + companyLogoUri: string; + /** @description Primary color */ + primaryColor: string; + /** @description Secondary color */ + secondaryColor?: string; + }; + PaymentLinkOrganizationDto: { + /** @description Organization address */ + address: Record; + /** @description Organization name */ + name: string; + /** @description Primary brand color */ + primaryColor: string; + /** @description Logo URI */ + logoUri: string; + /** @description Formatted address text */ + addressTextFormatted: string; + }; + GetInvoicePaymentLinkResponseDto: { + /** @description Amount due */ + dueAmount: number; + /** @description Formatted amount due */ + dueAmountFormatted: string; + /** @description Due date */ + dueDate: string; + /** @description Formatted due date */ + dueDateFormatted: string; + /** @description Formatted invoice date */ + invoiceDateFormatted: string; + /** @description Invoice number */ + invoiceNo: string; + /** @description Payment amount */ + paymentAmount: number; + /** @description Formatted payment amount */ + paymentAmountFormatted: string; + /** @description Subtotal */ + subtotal: number; + /** @description Formatted subtotal */ + subtotalFormatted: string; + /** @description Formatted subtotal in local currency */ + subtotalLocalFormatted: string; + /** @description Total amount */ + total: number; + /** @description Formatted total */ + totalFormatted: string; + /** @description Formatted total in local currency */ + totalLocalFormatted: string; + /** @description Customer name */ + customerName: string; + /** @description Invoice message */ + invoiceMessage: string; + /** @description Terms and conditions */ + termsConditions: string; + /** @description Invoice line entries */ + entries: components["schemas"]["PaymentLinkEntryDto"][]; + /** @description Tax entries */ + taxes: components["schemas"]["PaymentLinkTaxEntryDto"][]; + /** @description Branding template */ + brandingTemplate: components["schemas"]["PaymentLinkBrandingTemplateDto"]; + /** @description Organization metadata */ + organization: components["schemas"]["PaymentLinkOrganizationDto"]; + /** @description Whether Stripe is available as payment method */ + hasStripePaymentMethod: boolean; + /** @description Whether invoice has receivable balance */ + isReceivable: boolean; + /** @description Formatted customer address */ + formattedCustomerAddress: string; + }; + GetInvoicePaymentLinkResponseWrapperDto: { + /** @description Payment link invoice metadata */ + data: components["schemas"]["GetInvoicePaymentLinkResponseDto"]; + }; + CreateStripeCheckoutSessionResponseDto: { + /** + * @description Stripe checkout session ID + * @example cs_test_xxx + */ + sessionId: string; + /** + * @description Stripe publishable key for the client + * @example pk_test_xxx + */ + publishableKey: string; + /** + * @description URL to redirect the customer to complete checkout + * @example https://checkout.stripe.com/c/pay/cs_test_xxx + */ + redirectTo: string; + }; + GetStripeConnectLinkResponseDto: { + /** + * @description Stripe OAuth2 Connect authorization URL + * @example https://connect.stripe.com/oauth/authorize?response_type=code&client_id=... + */ + url: string; + }; + ExchangeStripeOAuthBodyDto: { + /** + * @description Authorization code returned by Stripe OAuth + * @example ac_xxx + */ + code: string; + }; + CreateStripeAccountResponseDto: { + /** + * @description The Stripe Connect account ID + * @example acct_1234567890 + */ + account_id: string; + }; + CreateStripeAccountSessionBodyDto: { + /** + * @description Stripe Connect account ID to create a session for + * @example acct_1234567890 + */ + account?: string; + }; + CreateStripeAccountSessionResponseDto: { + /** + * @description Stripe Account Session client secret for the Connect embedded component + * @example acs_xxx_secret_xxx + */ + client_secret: string; + }; + CreateStripeAccountLinkBodyDto: { + /** + * @description Stripe Connect account ID + * @example acct_xxx + */ + stripeAccountId: string; + }; + StripeAccountLinkResponseDto: { + /** + * @description URL for the account onboarding flow + * @example https://connect.stripe.com/setup/xxx + */ + url: string; + /** + * @description Unix timestamp when the link was created + * @example 1234567890 + */ + created: number; + /** + * @description Unix timestamp when the link expires + * @example 1234567890 + */ + expires_at: number; + /** + * @description Stripe object type + * @example account_link + */ + object: string; + }; + CreateStripeAccountLinkResponseDto: { + /** @description Stripe AccountLink object for onboarding */ + clientSecret: components["schemas"]["StripeAccountLinkResponseDto"]; + }; ItemCategoryResponseDto: { /** * @description The unique identifier of the item category @@ -10021,6 +10328,13 @@ export interface components { */ discountType: "percentage" | "amount"; }; + CreditNoteStateResponseDto: { + /** + * @description Default PDF template ID for credit notes + * @example 1 + */ + defaultTemplateId: number; + }; EditCreditNoteDto: { /** * @description The customer ID @@ -10102,6 +10416,36 @@ export interface components { */ discountType: "percentage" | "amount"; }; + RefundCreditAccountDto: { + /** @example 10 */ + id: number; + /** @example Cash on Hand */ + name: string; + }; + RefundCreditNoteSummaryDto: { + /** @example 1 */ + id: number; + /** @example CN-0001 */ + creditNoteNumber: string; + }; + RefundCreditNoteResponseDto: { + /** @example 100 */ + id: number; + /** @example 2024-01-15 */ + date: string; + /** @example 2024-01-15 */ + formattedDate: string; + /** @example 250 */ + amount: number; + /** @example $250.00 */ + formttedAmount: string; + /** @example REF-001 */ + referenceNo?: string | null; + /** @example Refund issued to customer */ + description?: string | null; + fromAccount: components["schemas"]["RefundCreditAccountDto"]; + creditNote: components["schemas"]["RefundCreditNoteSummaryDto"]; + }; CreditNoteRefundDto: { /** * @description The id of the from account @@ -10140,6 +10484,54 @@ export interface components { */ branchId: number; }; + AppliedCreditNoteInvoiceResponseDto: { + /** @example 1 */ + id: number; + /** @example 200 */ + amount: number; + /** @example $200.00 */ + formttedAmount: string; + /** @example CN-0001 */ + creditNoteNumber: string; + /** @example 2024-01-10 */ + creditNoteDate: string; + /** @example 2024-01-10 */ + formattedCreditNoteDate: string; + /** @example INV-0001 */ + invoiceNumber: string; + /** @example REF-001 */ + invoiceReferenceNo?: string | null; + }; + CreditNoteInvoiceToApplyResponseDto: { + /** @example 1 */ + id: number; + /** @example INV-0001 */ + invoiceNo: string; + /** @example REF-001 */ + referenceNo?: string | null; + /** @example 2024-01-10 */ + invoiceDate: string; + /** @example 2024-01-20 */ + dueDate: string; + /** @example USD */ + currencyCode?: string | null; + /** @example 500 */ + balance: number; + /** @example 500 */ + dueAmount: number; + /** @example 0 */ + paymentAmount: number; + /** @example 2024-01-10 */ + formattedInvoiceDate: string; + /** @example 2024-01-20 */ + formattedDueDate: string; + /** @example $500.00 */ + formatted_amount: string; + /** @example $500.00 */ + formattedDueAmount: string; + /** @example $0.00 */ + formattedPaymentAmount: string; + }; ApplyCreditNoteInvoiceEntryDto: { /** * @description Invoice ID to apply credit to @@ -13344,6 +13736,22 @@ export interface components { /** @description The permissions of the role */ permissions: components["schemas"]["EditRolePermissionDto"][]; }; + OrganizationBuildJobResponseDto: { + /** @example 123 */ + id: string; + /** @example active */ + state: string; + /** @example 50 */ + progress: Record; + /** @example false */ + isCompleted: boolean; + /** @example true */ + isRunning: boolean; + /** @example false */ + isWaiting: boolean; + /** @example false */ + isFailed: boolean; + }; OrganizationMetadataResponseDto: { /** * @description Internal numeric ID of the metadata @@ -13690,6 +14098,12 @@ export interface components { */ currencySign: string; }; + DateFormatResponseDto: { + /** @example 03/09/2026 [MM/DD/YYYY] */ + label: string; + /** @example MM/DD/YYYY */ + key: string; + }; EditUserDto: { /** * @description First name of the user @@ -14577,7 +14991,10 @@ export interface operations { }; InventoryAdjustmentsController_getInventoryAdjustments: { parameters: { - query?: never; + query?: { + page?: number; + pageSize?: number; + }; header: { /** @description Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token. */ Authorization: string; @@ -14595,7 +15012,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": components["schemas"]["InventoryAdjustmentResponseDto"][]; + "application/json": components["schemas"]["InventoryAdjustmentsListResponseDto"]; }; }; }; @@ -15119,6 +15536,24 @@ export interface operations { onlyInactive?: boolean; /** @description Structure type for the accounts list */ structure?: "tree" | "flat"; + /** @description Custom view ID */ + customViewId?: number; + /** @description Filter roles array */ + filterRoles?: string[]; + /** @description Column to sort by */ + columnSortBy?: string; + /** @description Sort order */ + sortOrder?: "DESC" | "ASC"; + /** @description Stringified filter roles */ + stringifiedFilterRoles?: string; + /** @description Search keyword */ + searchKeyword?: string; + /** @description View slug */ + viewSlug?: string; + /** @description Page number */ + page?: number; + /** @description Page size */ + pageSize?: number; }; header: { /** @description Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token. */ @@ -15414,11 +15849,14 @@ export interface operations { }; requestBody?: never; responses: { + /** @description Items inventory cost list */ 200: { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["GetInventoryItemsCostResponseDto"]; + }; }; }; }; @@ -16983,6 +17421,7 @@ export interface operations { query?: never; header?: never; path: { + /** @description The resource model name (e.g., SaleInvoice, Customer, Item) */ resourceModel: string; }; cookie?: never; @@ -16994,7 +17433,9 @@ export interface operations { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["ResourceMetaResponseDto"]; + }; }; }; }; @@ -17021,10 +17462,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @description Payment link metadata */ - data?: Record; - }; + "application/json": components["schemas"]["GetInvoicePaymentLinkResponseWrapperDto"]; }; }; /** @description Payment link not found */ @@ -17059,12 +17497,7 @@ export interface operations { [name: string]: unknown; }; content: { - "application/json": { - /** @description Stripe checkout session ID */ - id?: string; - /** @description Stripe checkout session URL */ - url?: string; - }; + "application/json": components["schemas"]["CreateStripeCheckoutSessionResponseDto"]; }; }; /** @description Payment link not found */ @@ -17120,11 +17553,14 @@ export interface operations { }; requestBody?: never; responses: { + /** @description Successfully retrieved Stripe Connect link */ 200: { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["GetStripeConnectLinkResponseDto"]; + }; }; }; }; @@ -17135,25 +17571,13 @@ export interface operations { path?: never; cookie?: never; }; - requestBody?: never; - responses: { - 201: { - headers: { - [name: string]: unknown; - }; - content?: never; + requestBody: { + content: { + "application/json": components["schemas"]["ExchangeStripeOAuthBodyDto"]; }; }; - }; - StripeIntegrationController_createAccountLink: { - parameters: { - query?: never; - header?: never; - path?: never; - cookie?: never; - }; - requestBody?: never; responses: { + /** @description Successfully exchanged OAuth code */ 201: { headers: { [name: string]: unknown; @@ -17171,12 +17595,13 @@ export interface operations { }; requestBody?: never; responses: { + /** @description Successfully created Stripe account */ 201: { headers: { [name: string]: unknown; }; content: { - "application/json": { account_id: string }; + "application/json": components["schemas"]["CreateStripeAccountResponseDto"]; }; }; }; @@ -17190,16 +17615,41 @@ export interface operations { }; requestBody: { content: { - "application/json": { account?: string }; + "application/json": components["schemas"]["CreateStripeAccountSessionBodyDto"]; }; }; responses: { + /** @description Successfully created account session */ 201: { headers: { [name: string]: unknown; }; content: { - "application/json": { client_secret: string }; + "application/json": components["schemas"]["CreateStripeAccountSessionResponseDto"]; + }; + }; + }; + }; + StripeIntegrationController_createAccountLink: { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateStripeAccountLinkBodyDto"]; + }; + }; + responses: { + /** @description Successfully created account link */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CreateStripeAccountLinkResponseDto"]; }; }; }; @@ -19601,7 +20051,9 @@ export interface operations { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["CreditNoteStateResponseDto"]; + }; }; }; }; @@ -19823,11 +20275,14 @@ export interface operations { }; requestBody?: never; responses: { + /** @description Credit note refunds retrieved successfully. */ 200: { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["RefundCreditNoteResponseDto"][]; + }; }; }; }; @@ -19859,6 +20314,33 @@ export interface operations { }; }; }; + CreditNoteRefundsController_getRefundCreditNoteTransaction: { + parameters: { + query?: never; + header: { + /** @description Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token. */ + Authorization: string; + /** @description Required if Authorization is a JWT token. The organization ID to operate within. */ + "organization-id": string; + }; + path: { + refundCreditId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Refund credit note transaction retrieved successfully. */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["RefundCreditNoteResponseDto"]; + }; + }; + }; + }; CreditNoteRefundsController_deleteRefundCreditNote: { parameters: { query?: never; @@ -19904,7 +20386,9 @@ export interface operations { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["AppliedCreditNoteInvoiceResponseDto"][]; + }; }; /** @description Invalid input data */ 400: { @@ -19943,7 +20427,9 @@ export interface operations { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["CreditNoteInvoiceToApplyResponseDto"][]; + }; }; /** @description Invalid input data */ 400: { @@ -20477,17 +20963,17 @@ export interface operations { }; BillPaymentsController_getBillPaymentNewPageEntries: { parameters: { - query?: never; + query: { + /** @description The vendor id */ + vendorId: number; + }; header: { /** @description Value must be 'Bearer ' where is an API key prefixed with 'bc_' or a JWT token. */ Authorization: string; /** @description Required if Authorization is a JWT token. The organization ID to operate within. */ "organization-id": string; }; - path: { - /** @description The vendor id */ - vendorId: number; - }; + path?: never; cookie?: never; }; requestBody?: never; @@ -20656,7 +21142,7 @@ export interface operations { /** @description Custom view ID */ customViewId?: number; /** @description Filter roles array */ - filterRoles?: unknown[][]; + filterRoles?: string[]; /** @description Column to sort by */ columnSortBy?: string; /** @description Sort order */ @@ -27546,11 +28032,14 @@ export interface operations { }; requestBody?: never; responses: { + /** @description Returns the organization build job details */ 200: { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["OrganizationBuildJobResponseDto"]; + }; }; }; }; @@ -27953,7 +28442,9 @@ export interface operations { headers: { [name: string]: unknown; }; - content?: never; + content: { + "application/json": components["schemas"]["DateFormatResponseDto"][]; + }; }; }; };