From 807012528ebd27d081b4c3384788e4bd103de6f3 Mon Sep 17 00:00:00 2001 From: Daniel Barcellos Date: Fri, 2 Aug 2024 10:59:02 -0300 Subject: [PATCH 1/5] feat(subaccounts): add routes structre --- .../src/contract/companies/subaccounts.ts | 100 +++++++++++++++--- .../core/src/schemas/companies/subaccounts.ts | 73 +++++++++++++ 2 files changed, 158 insertions(+), 15 deletions(-) create mode 100644 packages/core/src/schemas/companies/subaccounts.ts diff --git a/packages/core/src/contract/companies/subaccounts.ts b/packages/core/src/contract/companies/subaccounts.ts index 2971bc2..f5c3816 100644 --- a/packages/core/src/contract/companies/subaccounts.ts +++ b/packages/core/src/contract/companies/subaccounts.ts @@ -1,20 +1,90 @@ -import { initContract } from '@ts-rest/core' +import { initContract } from '@ts-rest/core'; +import { z } from 'zod'; +import { listPlansResponseSchema, listPlansParamsSchema, createPlanResponseSchema, createPlanBodySchema, updatePlanBodySchema } from '../../schemas/plans.js'; -const c = initContract() + +const c = initContract(); export const subaccounts = c.router( - { - // Todo: Listar Subcontas - // Todo: Obter Documentos Necessários - // Todo: Criar Subconta CPF - // Todo: Criar Subconta CNPJ - // Todo: Enviar Documentos Necessários CPF - // Todo: Enviar Documentos Necessários CNPJ - // Todo: Editar Subconta - // Todo: Reativar Subconta - // Todo: Desativar Subconta + { + /** + * Retrieves a list of plans. + * + * @method GET + * @path /plans + * @responses 200 - The list of plans. + * @query - The query parameters for listing plans. + */ + list: { + method: 'GET', + path: '/', + responses: { + 200: listPlansResponseSchema, + }, + query: listPlansParamsSchema, + }, + /** + * Creates a new plan. + * + * @method POST + * @path /plans + * @responses 200 - The created plan. + * @body - The request body for creating a plan. + */ + create: { + method: 'POST', + path: '/', + responses: { + 200: createPlanResponseSchema, + }, + body: createPlanBodySchema, + }, + /** + * Updates a plan. + * + * @method PUT + * @path /plans/:planId/:typeId + * @pathParams - The path parameters for updating a plan. + * @responses 200 - The updated plan. + * @body - The request body for updating a plan. + */ + update: { + method: 'PUT', + path: '/:planId/:typeId', + pathParams: z.object({ + planId: z.union([z.coerce.number().positive(), z.coerce.string()]), + typeId: z.enum(['galaxPayId', 'myId']), + }), + responses: { + 200: createPlanResponseSchema, + }, + body: updatePlanBodySchema, }, - { - pathPrefix: '/subaccounts', + /** + * Deletes a plan. + * + * @method DELETE + * @path /plans/:planId/:typeId + * @pathParams - The path parameters for deleting a plan. + * @responses 200 - The deletion status. + * @body - An empty object. + */ + delete: { + method: 'DELETE', + path: '/:planId/:typeId', + pathParams: z.object({ + planId: z.union([z.coerce.number().positive(), z.coerce.string()]), + typeId: z.enum(['galaxPayId', 'myId']), + }), + responses: { + 200: z.object({ + type: z.boolean(), + }), + }, + body: c.noBody(), }, -) + }, + { + pathPrefix: '/subaccounts', + }, +); diff --git a/packages/core/src/schemas/companies/subaccounts.ts b/packages/core/src/schemas/companies/subaccounts.ts new file mode 100644 index 0000000..909e8d1 --- /dev/null +++ b/packages/core/src/schemas/companies/subaccounts.ts @@ -0,0 +1,73 @@ +import { z } from 'zod'; +import { transformArrayToString } from '../../utils'; +import { periodicitySchema } from '../_/common'; + +export const planStatusSchema = z.enum(['active', 'inactive']); + +export const listPlansParamsSchema = z.object({ + myIds: z + .union([z.array(z.coerce.string()), z.coerce.string()]) + .optional() + .transform(transformArrayToString), + galaxPayIds: z + .union([z.array(z.coerce.string()), z.coerce.string()]) + .optional() + .transform(transformArrayToString), + createdAtFrom: z.string().optional(), + createdAtTo: z.string().optional(), + createdAtOrUpdatedAtFrom: z.string().optional(), + createdAtOrUpdatedAtTo: z.string().optional(), + status: z.enum(['active', 'inactive']).optional(), + startAt: z.coerce.number(), + limit: z.coerce.number().min(0).max(100), + order: z + .enum([ + 'createdAt.asc', + 'createdAt.desc', + 'updatedAt.asc', + 'updatedAt.desc', + ]) + .optional(), +}); + +export const planPricesSchema = z.object({ + payment: z.enum(['creditcard', 'boleto']), + value: z.coerce.number(), +}); + +export type PlanPrices = z.input; + +export type ListPlansParams = z.input; + +export const createPlanBodySchema = z.object({ + myId: z.string(), + name: z.string(), + periodicity: periodicitySchema, + quantity: z.coerce.number(), + additionalInfo: z.string().optional(), + PlanPrices: z.array(planPricesSchema), +}); + +export const planSchema = createPlanBodySchema.extend({ + galaxPayId: z.coerce.number(), +}); + +export const listPlansResponseSchema = z.object({ + totalQtdFoundInPage: z.coerce.number(), + Plans: z.array(planSchema), +}); + +export type ListPlanResponse = z.input; + +export const createPlanResponseSchema = z.object({ + type: z.boolean(), + Plan: planSchema, +}); + +export type CreatePlanBody = z.input; + +export type CreatePlanResponse = z.input; + +export const updatePlanBodySchema = createPlanBodySchema.deepPartial(); + +export type UpdatePlanBody = z.input; From d53395e98c6ca2353f6be62e7ba2340b85a897c2 Mon Sep 17 00:00:00 2001 From: Daniel Barcellos Date: Mon, 5 Aug 2024 16:42:31 -0300 Subject: [PATCH 2/5] feat(subaccounts): add crud for cnpj and cpf --- .../src/contract/companies/subaccounts.ts | 259 ++++++++++++------ packages/core/src/contract/index.ts | 4 + packages/core/src/schemas/common.ts | 32 +++ packages/core/src/schemas/companies/common.ts | 68 +++++ .../core/src/schemas/companies/subaccounts.ts | 193 ++++++++++--- 5 files changed, 439 insertions(+), 117 deletions(-) create mode 100644 packages/core/src/schemas/companies/common.ts diff --git a/packages/core/src/contract/companies/subaccounts.ts b/packages/core/src/contract/companies/subaccounts.ts index f5c3816..abcb6ee 100644 --- a/packages/core/src/contract/companies/subaccounts.ts +++ b/packages/core/src/contract/companies/subaccounts.ts @@ -1,90 +1,191 @@ import { initContract } from '@ts-rest/core'; import { z } from 'zod'; -import { listPlansResponseSchema, listPlansParamsSchema, createPlanResponseSchema, createPlanBodySchema, updatePlanBodySchema } from '../../schemas/plans.js'; - +import { listMandatoryDocumentsResponseSchema, sendMandatoryDocumentsResponseSchema, sendMandatoryDocumentsCpfRequestSchema, listSubAccountsResponseSchema, listSubAccountsParamsSchema, createSubAccounResponseSchema, createSubAccountCpfBodySchema, createSubAccountCnpjBodySchema, updateSubAccountResponseSchema, updateSubAccountsBodySchema } from '../../schemas/companies/subaccounts.js'; const c = initContract(); -export const subaccounts = c.router( - { - /** - * Retrieves a list of plans. - * - * @method GET - * @path /plans - * @responses 200 - The list of plans. - * @query - The query parameters for listing plans. - */ - list: { - method: 'GET', - path: '/', - responses: { - 200: listPlansResponseSchema, - }, - query: listPlansParamsSchema, +/** + * Defines the subaccounts router object. + * + * @example + * ```ts + * import { initClient } from '@ts-rest/core' + * import { subaccounts } from '@cel_cash/core/contract' + * + * const client = initClient(subaccounts, { + * baseUrl: 'https://api.celcoin.com.br' + * }) + * + * const subaccountsList = await client.list({ ... }) + * const createdSubaccount = await client.createWithCnpj({ ... }) + * const updatedSubaccount = await client.update({ ... }) + * const deletedSubaccount = await client.delete({ ... }) + * ``` + */ +export const subaccounts = c.router({ + /** + * Retrieves a list of mandatory documents. + * Require access_token to have company.read scope. + * + * @method GET + * @path /company/mandatory-documents + * @responses 200 - The list of mandatory documents. + */ + listMandatoryDocuments: { + method: 'GET', + path: '/mandatory-documents', + responses: { + 200: listMandatoryDocumentsResponseSchema, }, - /** - * Creates a new plan. - * - * @method POST - * @path /plans - * @responses 200 - The created plan. - * @body - The request body for creating a plan. - */ - create: { - method: 'POST', - path: '/', - responses: { - 200: createPlanResponseSchema, - }, - body: createPlanBodySchema, + }, + /** + * Sends mandatory documents with CPF. + * Require access_token to have company.write scope. + * + * @method POST + * @path /company/mandatory-documents + * @responses 200 - If succeeded or not. + * @body - The request body for sending mandatory documents. + */ + sendMandatoryDocumentsCpf: { + method: 'POST', + path: '/mandatory-documents', + responses: { + 200: sendMandatoryDocumentsResponseSchema, }, - /** - * Updates a plan. - * - * @method PUT - * @path /plans/:planId/:typeId - * @pathParams - The path parameters for updating a plan. - * @responses 200 - The updated plan. - * @body - The request body for updating a plan. - */ - update: { - method: 'PUT', - path: '/:planId/:typeId', - pathParams: z.object({ - planId: z.union([z.coerce.number().positive(), z.coerce.string()]), - typeId: z.enum(['galaxPayId', 'myId']), - }), - responses: { - 200: createPlanResponseSchema, - }, - body: updatePlanBodySchema, + body: sendMandatoryDocumentsCpfRequestSchema, + }, + /** + * Creates a new mandatory documents with CNPJ. + * Require access_token to have company.write scope. + * + * @method POST + * @path /company/mandatory-documents + * @responses 200 - If succeeded or not. + * @body - The request body for sending mandatory documents. + */ + sendMandatoryDocumentsCnpj: { + method: 'POST', + path: '/mandatory-documents', + responses: { + 200: sendMandatoryDocumentsResponseSchema, }, - /** - * Deletes a plan. - * - * @method DELETE - * @path /plans/:planId/:typeId - * @pathParams - The path parameters for deleting a plan. - * @responses 200 - The deletion status. - * @body - An empty object. - */ - delete: { - method: 'DELETE', - path: '/:planId/:typeId', - pathParams: z.object({ - planId: z.union([z.coerce.number().positive(), z.coerce.string()]), - typeId: z.enum(['galaxPayId', 'myId']), - }), - responses: { - 200: z.object({ - type: z.boolean(), - }), - }, - body: c.noBody(), + body: sendMandatoryDocumentsCpfRequestSchema, + }, + /** + * Retrieves a list of subAccounts. + * Require access_token to have company.read scope. + * + * @method GET + * @path /company/subaccount + * @responses 200 - The list of subAccounts. + * @query - The query parameters for listing subAccounts. + */ + list: { + method: 'GET', + path: '/subaccounts', + responses: { + 200: listSubAccountsResponseSchema, + }, + query: listSubAccountsParamsSchema, + }, + /** + * Creates a new subAccount with CPF. + * Require access_token to have company.write scope. + * + * @method POST + * @path /company/subaccount + * @responses 200 - The created company subAccount. + * @body - The request body for creating a subAccount. + */ + createWithCpf: { + method: 'POST', + path: '/subaccount', + responses: { + 200: createSubAccounResponseSchema, }, + body: createSubAccountCpfBodySchema, }, - { - pathPrefix: '/subaccounts', + /** + * Creates a new subAccount with CNPJ. + * Require access_token to have company.write scope. + * + * @method POST + * @path /company/subaccount + * @responses 200 - The created company subAccount. + * @body - The request body for creating a subAccount. + */ + createWithCnpj: { + method: 'POST', + path: '/subaccount', + responses: { + 200: createSubAccounResponseSchema, + }, + body: createSubAccountCnpjBodySchema, + }, + /** + * Updates a subAccount. + * Require access_token to have company.write scope. + * + * @method PUT + * @path /company/subaccount/:subAccountId/:typeId + * @pathParams - The path parameters for updating a subAccount. + * @responses 200 - The updated subAccount. + * @body - The request body for updating a subAccount. + */ + update: { + method: 'PUT', + path: '/subaccount/:subAccountId', + pathParams: z.object({ + subAccountId: z.union([z.coerce.number().positive(), z.coerce.string()]), + }), + responses: { + 200: updateSubAccountResponseSchema, + }, + body: updateSubAccountsBodySchema, + }, + /** + * Reactivate a subAccount. + * Require access_token to have company.write scope. + * + * @method PUT + * @path /company/subaccount/active/:subAccountId + * @pathParams - The path parameters for updating a subAccount. + * @responses 200 - The updated subAccount. + * @body - The request body for updating a subAccount. + */ + active: { + method: 'PUT', + path: '/subaccount/active/:subAccountId', + pathParams: z.object({ + subAccountId: z.union([z.coerce.number().positive(), z.coerce.string()]), + }), + responses: { + 200: updateSubAccountResponseSchema, + }, + body: updateSubAccountsBodySchema, + }, + /** + * Deletes a subAccount. + * Require access_token to have company.write scope. + * + * @method DELETE + * @path /company/subaccount/:subAccountId/:typeId + * @pathParams - The path parameters for deleting a subAccount. + * @responses 200 - The deletion status. + * @body - An empty object. + */ + delete: { + method: 'DELETE', + path: '/subaccount/:subAccountId', + pathParams: z.object({ + subAccountId: z.union([z.coerce.number().positive(), z.coerce.string()]), + }), + responses: { + 200: z.object({ + type: z.boolean(), + }), + }, + body: c.noBody(), }, -); +}); diff --git a/packages/core/src/contract/index.ts b/packages/core/src/contract/index.ts index 6629283..8e2927f 100644 --- a/packages/core/src/contract/index.ts +++ b/packages/core/src/contract/index.ts @@ -10,6 +10,7 @@ import { plans } from './plans.js' import { subscriptions } from './subscriptions.js' import { transactions } from './transactions.js' import { pix, transfer } from './transfer.js' +import { subaccounts } from './companies/subaccounts.js' export type Antecipation = Client export type Auth = Client @@ -23,6 +24,7 @@ export type Subscriptions = Client export type Transactions = Client export type Pix = Client export type Transfer = Client +export type Subaccounts = Client export type Contract = { antecipation: Antecipation @@ -36,6 +38,7 @@ export type Contract = { transactions: Transactions pix: Pix transfer: Transfer + subaccounts: Subaccounts } export { @@ -51,4 +54,5 @@ export { transactions, pix, transfer, + subaccounts } diff --git a/packages/core/src/schemas/common.ts b/packages/core/src/schemas/common.ts index 3d93eee..2c774d0 100644 --- a/packages/core/src/schemas/common.ts +++ b/packages/core/src/schemas/common.ts @@ -100,6 +100,38 @@ export const addressSchema = z.object({ state: z.string(), }) +export const professionalSchema = z.object({ + internalName: z.enum([ + 'lawyer', + 'doctor', + 'accountant', + 'realtor', + 'broker', + 'physicalEducator', + 'physiotherapist', + 'others', + ]), + street: z.string(), + number: z.string(), + complement: z.string().optional(), + neighborhood: z.string(), + city: z.string(), + state: z.string(), +}); + +export const apiAuthSchema = z.object({ + galaxId: z.string(), + galaxHash: z.string(), + publicToken: z.string(), + confirmHashWebhook: z.string(), +}); + +export const verificationSchema = z.object({ + status: z.string(), + Reasons: z.array(z.string()), +}); + + export const extraFieldSchema = z.object({ tagName: z.string(), value: z.string(), diff --git a/packages/core/src/schemas/companies/common.ts b/packages/core/src/schemas/companies/common.ts new file mode 100644 index 0000000..2f688b7 --- /dev/null +++ b/packages/core/src/schemas/companies/common.ts @@ -0,0 +1,68 @@ +import { z } from 'zod'; +import { addressSchema } from '../common.js'; + +export const professionalSchema = z.object({ + internalName: z.enum([ + 'lawyer', + 'doctor', + 'accountant', + 'realtor', + 'broker', + 'physicalEducator', + 'physiotherapist', + 'others', + ]), + street: z.string(), + number: z.string(), + complement: z.string().optional(), + neighborhood: z.string(), + city: z.string(), + state: z.string(), +}); + +export const apiAuthSchema = z.object({ + galaxId: z.string(), + galaxHash: z.string(), + publicToken: z.string(), + confirmHashWebhook: z.string(), +}); + +export const verificationSchema = z.object({ + status: z.string(), + Reasons: z.array(z.string()), +}); + +export const configBaseSchema = z.object({ + confirmHashWebhook: z.string(), + taxWithdraw: z.number(), + taxPixDone: z.number(), + taxPixBoleto: z.number(), + taxPixReceived: z.number(), + taxPixTransaction: z.number(), +}); + +export const userBaseSchema = z.object({ + galaxPayId: z.number(), + master: z.boolean(), + email: z.string(), + name: z.string(), + document: z.string(), + phone: z.string(), +}); + +export const companyBaseSchema = z.object({ + galaxPayId: z.number(), + name: z.string(), + document: z.string(), + nameDisplay: z.string(), + active: z.boolean(), + emailContact: z.string(), + urlLogo: z.string(), + createdAt: z.string(), + canAccessPlatform: z.boolean(), + updatedAt: z.string(), + Address: addressSchema, + Professional: professionalSchema, + ApiAuth: apiAuthSchema, + Verification: verificationSchema, +}); diff --git a/packages/core/src/schemas/companies/subaccounts.ts b/packages/core/src/schemas/companies/subaccounts.ts index 909e8d1..3dfb5ef 100644 --- a/packages/core/src/schemas/companies/subaccounts.ts +++ b/packages/core/src/schemas/companies/subaccounts.ts @@ -1,73 +1,190 @@ import { z } from 'zod'; -import { transformArrayToString } from '../../utils'; -import { periodicitySchema } from '../_/common'; - -export const planStatusSchema = z.enum(['active', 'inactive']); - -export const listPlansParamsSchema = z.object({ - myIds: z +import { addressSchema, apiAuthSchema, professionalSchema, verificationSchema } from '../../schemas/common.js'; +import { transformArrayToString } from '../../utils/transform.js'; +import { companyBaseSchema, configBaseSchema, userBaseSchema } from './common.js'; +export const listSubAccountsParamsSchema = z.object({ + galaxPayIds: z .union([z.array(z.coerce.string()), z.coerce.string()]) .optional() .transform(transformArrayToString), - galaxPayIds: z + documents: z .union([z.array(z.coerce.string()), z.coerce.string()]) .optional() .transform(transformArrayToString), - createdAtFrom: z.string().optional(), - createdAtTo: z.string().optional(), - createdAtOrUpdatedAtFrom: z.string().optional(), - createdAtOrUpdatedAtTo: z.string().optional(), - status: z.enum(['active', 'inactive']).optional(), - startAt: z.coerce.number(), limit: z.coerce.number().min(0).max(100), + startAt: z.coerce.number(), order: z .enum([ 'createdAt.asc', 'createdAt.desc', - 'updatedAt.asc', - 'updatedAt.desc', + 'galaxPayId.asc', + 'galaxPayId.desc', ]) .optional(), }); -export const planPricesSchema = z.object({ - payment: z.enum(['creditcard', 'boleto']), - value: z.coerce.number(), +export type ListSubAccountsParams = z.input; + +export const createSubAccountBaseSchema = z.object({ + name: z.string(), + document: z.string(), + phone: z.string(), + emailContact: z.string(), + logo: z.string().optional(), + canAccessPlatform: z.boolean().optional(), + softDescriptor: z.string(), + Address: addressSchema, }); -export type PlanPrices = z.input; +export const createSubAccountCpfBodySchema = createSubAccountBaseSchema.extend({ + Professional: professionalSchema, +}); -export type ListPlansParams = z.input; +export const createSubAccountCnpjBodySchema = createSubAccountBaseSchema.extend( + { + responsibleDocument: z.string(), + typeCompany: z.enum([ + 'ltda', + 'eireli', + 'association', + 'individualEntrepreneur', + 'mei', + 'sa', + 'slu', + ]), + cnae: z.string(), + }, +); -export const createPlanBodySchema = z.object({ - myId: z.string(), - name: z.string(), - periodicity: periodicitySchema, - quantity: z.coerce.number(), - additionalInfo: z.string().optional(), - PlanPrices: z.array(planPricesSchema), +export const createSubAccounResponseSchema = z.object({ + type: z.boolean(), + Company: z.object({ + galaxPayId: z.number(), + galaxHash: z.string(), + name: z.string(), + document: z.string(), + nameDisplay: z.string(), + active: z.boolean(), + emailContact: z.string(), + urlLogo: z.string(), + publicToken: z.string(), + canAccessPlatform: z.boolean(), + createdAt: z.string(), + updatedAt: z.string(), + Address: addressSchema, + Professional: professionalSchema, + ApiAuth: apiAuthSchema, + Verification: verificationSchema, + }), }); -export const planSchema = createPlanBodySchema.extend({ +export const subAccountsSchema = createSubAccountCpfBodySchema.extend({ galaxPayId: z.coerce.number(), }); -export const listPlansResponseSchema = z.object({ +export const listSubAccountsResponseSchema = z.object({ totalQtdFoundInPage: z.coerce.number(), - Plans: z.array(planSchema), + SubAccounts: z.array(subAccountsSchema), }); -export type ListPlanResponse = z.input; +export type ListSubAccountsResponse = z.input< + typeof listSubAccountsResponseSchema +>; -export const createPlanResponseSchema = z.object({ +export type CreateSubAccountsCpfBody = z.input< + typeof createSubAccountCpfBodySchema +>; + +export type CreateSubAccountsResponse = z.input< + typeof createSubAccounResponseSchema +>; + +export const updateSubAccountsBodySchema = z.object({ + Address: addressSchema, + logo: z.string(), + canAccessPlatform: z.boolean(), +}); + +export const updateSubAccountResponseSchema = z.object({ type: z.boolean(), - Plan: planSchema, + Company: companyBaseSchema.extend({ + galaxHash: z.string(), + publicToken: z.string(), + Users: z.array(userBaseSchema), + BoletoDays: z.array(z.object({ day: z.number(), value: z.number() })), + Config: configBaseSchema, + }), }); -export type CreatePlanBody = z.input; +export const listMandatoryDocumentsResponseSchema = z.object({ + type: z.boolean(), + Info: z.object({ + Fields: z.object({ name: z.string(), description: z.string() }), + Associate: z.array(z.object({ name: z.string(), description: z.string() })), + Documents: z.object({ + Company: z.object({ name: z.string(), description: z.string() }), + Personal: z.object({ + CNH: z.array(z.object({ name: z.string(), description: z.string() })), + RG: z.array(z.object({ name: z.string(), description: z.string() })), + }), + }), + }), +}); -export type CreatePlanResponse = z.input; +export const sendMandatoryDocumentsCpfRequestSchema = z.object({ + Fields: z.object({ + motherName: z.string(), + birthDate: z.string(), + monthlyIncome: z.number(), + about: z.string(), + socialMediaLink: z.string(), + }), + Documents: z.object({ + Personal: z.object({ + CNH: z.object({ + selfie: z.string(), + picture: z.array(z.string()), + address: z.string(), + }), + RG: z.object({ + selfie: z.string(), + front: z.string(), + back: z.string(), + address: z.string(), + }), + }), + }), +}); -export const updatePlanBodySchema = createPlanBodySchema.deepPartial(); +export const sendMandatoryDocumentsCnpjRequestSchema = z.object({ + Fields: z.object({ + monthlyIncome: z.number(), + about: z.string(), + socialMediaLink: z.string(), + }), + Associate: z.array( + z.object({ + document: z.string(), + name: z.string(), + motherName: z.string(), + birthDate: z.string(), + type: z.string(), + }), + ), + Documents: z.object({ + Company: z.object({ + lastContract: z.string(), + cnpjCard: z.string(), + electionRecord: z.string(), + statute: z.string(), + }), + Personal: z.object({ + CNH: z.object({ selfie: z.string(), picture: z.array(z.string()) }), + RG: z.object({ selfie: z.string(), front: z.string(), back: z.string() }), + }), + }), +}); -export type UpdatePlanBody = z.input; +export const sendMandatoryDocumentsResponseSchema = z.object({ + type: z.boolean(), +}); From 96565da8b1587215943e18cb20eefc9d627b91cc Mon Sep 17 00:00:00 2001 From: Daniel Barcellos Date: Wed, 7 Aug 2024 09:34:38 -0300 Subject: [PATCH 3/5] add create subacount body type --- packages/core/src/schemas/companies/subaccounts.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/src/schemas/companies/subaccounts.ts b/packages/core/src/schemas/companies/subaccounts.ts index 3dfb5ef..90f20b0 100644 --- a/packages/core/src/schemas/companies/subaccounts.ts +++ b/packages/core/src/schemas/companies/subaccounts.ts @@ -94,6 +94,9 @@ export type ListSubAccountsResponse = z.input< export type CreateSubAccountsCpfBody = z.input< typeof createSubAccountCpfBodySchema >; +export type CreateSubAccountsCnpjBody = z.input< + typeof createSubAccountCnpjBodySchema +>; export type CreateSubAccountsResponse = z.input< typeof createSubAccounResponseSchema From 352b3d40451a4cfb535354abfb338f09233688ac Mon Sep 17 00:00:00 2001 From: Daniel Barcellos Date: Thu, 8 Aug 2024 10:15:11 -0300 Subject: [PATCH 4/5] add auth to schemas --- packages/core/src/contract/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/contract/index.ts b/packages/core/src/contract/index.ts index 8e2927f..3f1afc7 100644 --- a/packages/core/src/contract/index.ts +++ b/packages/core/src/contract/index.ts @@ -39,6 +39,7 @@ export type Contract = { pix: Pix transfer: Transfer subaccounts: Subaccounts + auth: Auth } export { From 0ae32ca12136b2e152a2fbeeb1571a6ce9b73503 Mon Sep 17 00:00:00 2001 From: Daniel Barcellos Date: Thu, 8 Aug 2024 10:17:12 -0300 Subject: [PATCH 5/5] remove auth --- packages/core/src/contract/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/src/contract/index.ts b/packages/core/src/contract/index.ts index 3f1afc7..8e2927f 100644 --- a/packages/core/src/contract/index.ts +++ b/packages/core/src/contract/index.ts @@ -39,7 +39,6 @@ export type Contract = { pix: Pix transfer: Transfer subaccounts: Subaccounts - auth: Auth } export {