Skip to content

Commit

Permalink
fix: exclude the commission from the ticket price
Browse files Browse the repository at this point in the history
  • Loading branch information
sneko committed Jan 9, 2025
1 parent f396be4 commit 3ef27f3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/core/ticketing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,18 @@ export class BilletwebTicketingSystemClient implements TicketingSystemClient {
const ticketCategoriesDataJson = await ticketCategoriesResponse.json();
const ticketCategories = JsonGetTicketCategoriesResponseSchema.parse(ticketCategoriesDataJson);

const schemaTicketCategories = ticketCategories.map((ticketCategory) =>
LiteTicketCategorySchema.parse({
const schemaTicketCategories = ticketCategories.map((ticketCategory) => {
// The price includes the commission fee from the ticketing system
// We do not need it for users to declare the right amounts
const price = ticketCategory.commission !== false ? ticketCategory.price - ticketCategory.commission : ticketCategory.price;

return LiteTicketCategorySchema.parse({
internalTicketingSystemId: ticketCategory.id,
name: ticketCategory.name,
description: ticketCategory.description,
price: ticketCategory.price,
})
);
price: price,
});
});

// From the workaround we get the appropriate event entity
const event = events.find((e) => e.id === eventId);
Expand Down

0 comments on commit 3ef27f3

Please sign in to comment.