Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed Feb 27, 2024
1 parent b52913d commit c51a80a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions server/lib/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,13 +1064,13 @@ export const getApplicationFee = async (order: OrderModelInterface): Promise<num
return applicationFee;
};

export const getPlatformTip = (object: OrderModelInterface): number => {
if (!isNil(object.platformTipAmount)) {
return object.platformTipAmount;
export const getPlatformTip = (order: OrderModelInterface): number => {
if (!isNil(order.platformTipAmount)) {
return order.platformTipAmount;
}
// Legacy form, but still being used sometime (to be verified and removed)
if (!isNil(object.data?.platformTip)) {
return object.data?.platformTip;
if (!isNil(order.data?.platformTip)) {
return order.data?.platformTip;
}
return 0;
};
Expand All @@ -1081,7 +1081,7 @@ export const getPlatformFeePercent = async (
): Promise<number> => {
// Platform Fees are back!

// Make sure paymentMethod is set
// Make sure payment method is available
if (!order.paymentMethod && order.PaymentMethodId) {
order.paymentMethod = await order.getPaymentMethod();
}
Expand Down Expand Up @@ -1132,7 +1132,8 @@ export const isPlatformTipEligible = async (order: OrderModelInterface): Promise
return order.collective.settings.platformTips;
}

if (!order.paymentMethod) {
// Make sure payment method is available
if (!order.paymentMethod && order.PaymentMethodId) {
order.paymentMethod = await order.getPaymentMethod();
}

Expand Down

0 comments on commit c51a80a

Please sign in to comment.