diff --git a/server/lib/payments.ts b/server/lib/payments.ts index 141663773975..a587654fe6a2 100644 --- a/server/lib/payments.ts +++ b/server/lib/payments.ts @@ -1116,6 +1116,7 @@ export const getHostFee = async (order: OrderModelInterface): Promise => return calcFee(totalAmount - taxAmount - platformTipAmount, hostFeePercent); }; +/* export const getPlatformFee = async (order: OrderModelInterface): Promise => { const totalAmount = order.totalAmount || 0; const taxAmount = order.taxAmount || 0; @@ -1125,6 +1126,7 @@ export const getPlatformFee = async (order: OrderModelInterface): Promise => { if (!isNil(order.platformTipEligible)) { diff --git a/server/models/Transaction.ts b/server/models/Transaction.ts index fcc538406a47..f942fd996580 100644 --- a/server/models/Transaction.ts +++ b/server/models/Transaction.ts @@ -1551,10 +1551,10 @@ Transaction.fetchHost = async ( host = await Collective.findByPk(transaction.HostCollectiveId); } if (!host) { - throw new Error(`transaction.HostCollectiveId should always bet set`); - // console.warn(`transaction.HostCollectiveId should always bet set`); - // const collective = await Collective.findByPk(transaction.CollectiveId); - // host = await collective.getHostCollective(); + // throw new Error(`transaction.HostCollectiveId should always bet set`); + console.warn(`transaction.HostCollectiveId should always bet set`); + const collective = await Collective.findByPk(transaction.CollectiveId); + host = await collective.getHostCollective(); } return host; }; diff --git a/test/test-helpers/fake-data.ts b/test/test-helpers/fake-data.ts index ef84fff51c33..ba8c0e48c439 100644 --- a/test/test-helpers/fake-data.ts +++ b/test/test-helpers/fake-data.ts @@ -771,10 +771,10 @@ export const fakeTransaction = async ( const amount = (transactionData.amount as number) || randAmount(10, 100) * 100; const CreatedByUserId = transactionData.CreatedByUserId || (await fakeUser()).id; const FromCollectiveId = transactionData.FromCollectiveId || (await fakeCollective()).id; - const HostCollectiveId = transactionData.HostCollectiveId || (await fakeCollective()).id; + // const HostCollectiveId = transactionData.HostCollectiveId || (await fakeCollective()).id; const collective = transactionData.CollectiveId ? await models.Collective.findByPk(transactionData.CollectiveId) - : await fakeCollective({ HostCollectiveId }); + : await fakeCollective(); const createMethod = createDoubleEntry ? 'createDoubleEntry' : 'create'; const transaction = await models.Transaction[createMethod]( {