feat: add validation and logging for payment method resolution

This commit is contained in:
David Arranz 2026-08-20 12:10:44 +02:00
parent 595e08459d
commit bfa58638a0
2 changed files with 19 additions and 0 deletions

View File

@ -37,6 +37,18 @@ export class FactuGESPaymentResolver {
companyId: UniqueID;
factugesId: string;
}): Promise<Result<ResolvedPaymentMethod, Error>> {
console.debug(
`Resolving payment method for company ${params.companyId} and FactuGES ID ${params.factugesId}`
);
if (!params.factugesId) {
return Result.fail(new Error("FactuGES ID is required to resolve payment method."));
}
if (!params.companyId) {
return Result.fail(new Error("Company ID is required to resolve payment method."));
}
const reference = this.deps.paymentReferenceProvider.findByFactuGESId(params.factugesId);
if (reference.isNone()) {

View File

@ -1,4 +1,11 @@
[
{
"id": "01a01e78-622e-769b-8980-b987850dad8e",
"company_id": "5e4dc5b3-96b9-4968-9490-14bd032fec5f",
"factuges_id": "10",
"description": "CONTADO",
"group": "General"
},
{
"id": "019c2834-a766-7787-a626-fa89cac3a8a1",
"company_id": "5e4dc5b3-96b9-4968-9490-14bd032fec5f",