Skip to content

Commit

Permalink
Fix/2229-zero-sum-orders-stuck (#2230)
Browse files Browse the repository at this point in the history
* invalidate query on skip payment status

* multiply orderline item price by quantity
  • Loading branch information
Magnusrm authored Jul 10, 2024
1 parent 0ca385c commit 7bff9ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/features/payment/usePerformPaymentMutation.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useMutation } from '@tanstack/react-query';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import type { AxiosError } from 'axios';

import { useAppMutations } from 'src/core/contexts/AppQueriesProvider';
import { useCurrentLanguage } from 'src/features/language/LanguageProvider';

export const usePerformPayActionMutation = (partyId?: string, instanceGuid?: string) => {
const queryClient = useQueryClient();
const { doPerformAction } = useAppMutations();
const selectedLanguage = useCurrentLanguage();
return useMutation({
Expand All @@ -24,6 +25,8 @@ export const usePerformPayActionMutation = (partyId?: string, instanceGuid?: str
onSuccess: (data) => {
if (data?.redirectUrl) {
window.location.href = data.redirectUrl;
} else {
queryClient.invalidateQueries({ queryKey: ['fetchPaymentInfo'] });
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/layout/PaymentDetails/PaymentDetailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const PaymentDetailsTable = ({ orderDetails, tableTitle, description, ...
<Table.Cell>{orderLine.name}</Table.Cell>
<Table.Cell align='right'>{orderLine.quantity}</Table.Cell>
<Table.Cell align='right'>
{orderLine.priceExVat} {orderDetails?.currency}
{orderLine.priceExVat * orderLine.quantity} {orderDetails?.currency}
</Table.Cell>
</Table.Row>
))}
Expand Down

0 comments on commit 7bff9ca

Please sign in to comment.