feat: add validation and logging for payment method resolution
This commit is contained in:
parent
595e08459d
commit
bfa58638a0
@ -37,6 +37,18 @@ export class FactuGESPaymentResolver {
|
|||||||
companyId: UniqueID;
|
companyId: UniqueID;
|
||||||
factugesId: string;
|
factugesId: string;
|
||||||
}): Promise<Result<ResolvedPaymentMethod, Error>> {
|
}): 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);
|
const reference = this.deps.paymentReferenceProvider.findByFactuGESId(params.factugesId);
|
||||||
|
|
||||||
if (reference.isNone()) {
|
if (reference.isNone()) {
|
||||||
|
|||||||
@ -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",
|
"id": "019c2834-a766-7787-a626-fa89cac3a8a1",
|
||||||
"company_id": "5e4dc5b3-96b9-4968-9490-14bd032fec5f",
|
"company_id": "5e4dc5b3-96b9-4968-9490-14bd032fec5f",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user