Skip to content

[TRNF-7286] Feat(v2): Add entity onboardings and multipart uploads#100

Merged
JoMarchant merged 5 commits into
masterfrom
feat/entities-onboarding
Jun 23, 2026
Merged

[TRNF-7286] Feat(v2): Add entity onboardings and multipart uploads#100
JoMarchant merged 5 commits into
masterfrom
feat/entities-onboarding

Conversation

@JoMarchant

@JoMarchant JoMarchant commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Contexto

Soporte en el SDK para el nuevo flujo de onboarding de entities de la API pública v2 (/v2/entities/{id}/onboardings).

Qué hay de nuevo?

  • Se exponen los siguientes endpoints para el proceso de onboarding de entities:
    • POST /v2/entities
    • POST /v2/entities/{id}/onboardings
    • PUT /v2/entities/{id}/onboardings/{id}/shareholders/{id}/document
    • PUT /v2/entities/{id}/onboardings/{id}/documents/{slot_key}
    • POST /v2/entities/{id}/onboardings/{id}/submit
  • Se agrega soporte de multipart/form-data en el cliente HTTP.

Tests

Unitarios para el cliente multipart, los recursos y el manager (incluyendo las subidas de documentos). Probado end-to-end localmente contra fintoc-rails + pacioli (crear onboarding → subir documentos → submit).

Consideraciones

Las subidas multipart no se firman con JWS.

Rollback

¿Es seguro hacer rollback?

¿Cuáles son los pasos para hacer rollback?
Normal

@JoMarchant JoMarchant self-assigned this Jun 22, 2026
@JoMarchant JoMarchant force-pushed the feat/entities-onboarding branch 4 times, most recently from 2a7e94f to 5a5f717 Compare June 22, 2026 20:07
Add a `form` request option and a `resourceUpload` handler so managers can send multipart bodies via FormData, letting form-data set the Content-Type boundary. JWS signing is skipped for multipart requests. Declares the form-data dependency explicitly.
Onboarding, OnboardingShareholder and OnboardingDocument resources for the v2 entity onboarding response.
Onboardings are nested under entities (fintoc.v2.entities.onboardings), mirroring account_statements: list, get, create, submit, and slot + shareholder document uploads (via resourceUpload, errors mapped to typed Fintoc errors). Also enables fintoc.v2.entities.create.
@JoMarchant JoMarchant force-pushed the feat/entities-onboarding branch from 5a5f717 to a83c195 Compare June 22, 2026 20:29
@JoMarchant JoMarchant marked this pull request as ready for review June 22, 2026 20:34
@JoMarchant JoMarchant requested review from tlarrain and vacodoceo June 22, 2026 20:35

@tlarrain tlarrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dejé comms y dudas

});
const data = await client.request({ path, method: 'put', form });
return objetize(
klass,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

que sea con k es a propósito? jajaja

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seguí el patrón que estaba en las otras clases nomás jeje, según yo igual es común para evitar el clash con class que es un keyword

Comment thread src/spec/mocks/client/axiosInstance.ts Outdated
const innerParams = Object.fromEntries(query.map((x) => x.split('=')));
const completeParams = { ...innerParams, ...(params === undefined ? {} : params) };
const usableURL = url?.split('//').slice(-1)[0].split('/').slice(1).join('/').split('?')[0] || '';
const isMultipart = data !== undefined && typeof data !== 'string';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esta es la forma real de definir si algo es multipart? si es una imagen esto también sería true y no necesariamente sería multipart

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn, no se me ocurrió

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voy a ver otra forma

@@ -1,4 +1,5 @@
import { Method } from 'axios';
import FormData from 'form-data';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necesitamos esta librería? creo que usar el soporte nativo de Javascript sería mejor opción

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pucha si, estamos con node-10 como min requirement del SDK

return this.uploadFile(path, file);
}

@canRaiseHTTPError

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

este necesita esto vs los otros por alguna razón específica?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

con el refactor queda gucci

const klass = await getResourceClass(
(this.constructor as typeof OnboardingsManager).resource,
);
return resourceUpload<Onboarding>(this._client, path, klass, file);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no estoy seguro como se podría hacer, pero me tinca que uno podría extender el manager y que esto sea un método miembro de la clase, para poder hacer this.uploadResource(path, klass, file). Creo que quedaría más nice de ser posible. Si se enreda mucho la cosa lo podemos dejar así. Siento que pasarle el this._client es medio hacky y se podría evitar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voy con esto, es un buen refactor

@JoMarchant JoMarchant requested a review from tlarrain June 22, 2026 21:13
@JoMarchant

Copy link
Copy Markdown
Contributor Author

@tlarrain moví el upload a manager mixin y ahora valido el tipo de data para ver si es form

@JoMarchant JoMarchant changed the title Feat(v2): Add entity onboardings and multipart uploads [TRNF-7286] Feat(v2): Add entity onboardings and multipart uploads Jun 22, 2026

@tlarrain tlarrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quedó mucho más nice, congrats!

@JoMarchant JoMarchant merged commit b6b7223 into master Jun 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants