Skip to content

Commit

Permalink
last fix
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed Mar 4, 2024
1 parent bd751aa commit 53a9dcc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions server/lib/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ export const getHostFee = async (order: OrderModelInterface): Promise<number> =>
return calcFee(totalAmount - taxAmount - platformTipAmount, hostFeePercent);
};

/*
export const getPlatformFee = async (order: OrderModelInterface): Promise<number> => {
const totalAmount = order.totalAmount || 0;
const taxAmount = order.taxAmount || 0;
Expand All @@ -1125,6 +1126,7 @@ export const getPlatformFee = async (order: OrderModelInterface): Promise<number
return calcFee(totalAmount - taxAmount - platformTipAmount, platformFeePercent);
};
*/

export const isPlatformTipEligible = async (order: OrderModelInterface): Promise<boolean> => {
if (!isNil(order.platformTipEligible)) {
Expand Down
8 changes: 4 additions & 4 deletions server/models/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions test/test-helpers/fake-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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](
{
Expand Down

0 comments on commit 53a9dcc

Please sign in to comment.