This blog post will elaborate on how Tax Information is being displayed on the public page of an event. In current implementation, the user gets to know the total tax inclusive amount only after he/she decides to place an order but no such information was given to them on the public ticket page itself.
Example : In initial implementation, the user gets to know that the order is of only $120 and no information is given about the additional 30% being charged and taking the total to $156.
To tackle this issue, I added two hybrid components to the ticket object to handle the two tax cases :
- Inclusion in the price : In European and Asian Countries , the tax amount is included in the ticket price itself. For this case, I created the following parameter to store the tax amount included in gross amount.
// app/models/ticket.js |
- Added on the ticket price : In basic US tax policy, the tax amount is added on top of the ticket price. For such cases I have added a new attribute to ticket model which calculates the total amount payable for that particular ticket with tax inclusion
// app/models/ticket.js |
Now, the public ticket page has to be edited accordingly. The design I decided to follow is inspired by eventbrite itself :
For this implementation, I modified the ticket list template to accommodate the changes in the following way :
// app/components/public/ticket-list.hbs td id="{{ticket.id}}_price"> if (and taxInfo (not-eq ticket.type 'free'))}} if showTaxIncludedMessage}} small class="ui gray-text small"> small > small class="ui gray-text small"> small > if }} div > small class="ui gray-text tiny aligned right">({{taxInfo.name}})</ small > div > if }} td > |
Hence making the new public ticket list display to look like this in case of tax amount inclusion and additional charge as follows
Discount Code application cases:
In the cases when a user applies the discount code, the ticket price need to be updated, hence, the tax applied has to be updated accordingly. I achieved this by updating the two computed properties of the ticket model on each togglePromotionalCode and applyPromotionalCode action. When a promotional code is applied, the appropriate attribute is updated according to the discount offered.
// app/components/public/ticket-list.js |
Similarly, on toggling the discount code off, the ticket’s computed properties are set back to their initial value using the same formula kept during the time of initialization which has been achieved in the following manner.
// app/components/public/ticket-list.js |
This particular change makes sure that the tax amount is calculated properly as per the discounted amount and thus eliminates the possibility of overcharging the attendee.
In conclusion, this feature has been implemented keeping in mind the consumer’s interest in using the Open Event Frontend and the ease of tax application on the public level with minimum required network requests.
Resources
Related Work and Code Repository