snap-cloud / snapcon

An event management tool tailored to Snap!Con. Forked from OSEM
https://snapcon.org
MIT License
9 stars 9 forks source link

187376318 ticket purchases curr conversion #372

Closed tiffanylamm closed 3 months ago

tiffanylamm commented 6 months ago

Pivotal Tracker Link

What this PR does:

This pull request fixes the currency conversion issues(correct number and symbol) in the conference_registrations view and the payment summary view. Now all views dealing with tickets should correctly implement the currency conversion logic.

Include screenshots, videos, etc.

Screenshot 2024-04-24 at 2 08 55 PM

Screenshot 2024-04-24 at 2 09 08 PM

Who authored this PR?

@tiffanylamm

How should this PR be tested?

Most of the changes were changes to the view so they should be viewable at deployment. I also added testing for the changes to show in the conference_registration_controller.

Are there any complications to deploying this?

Merge https://github.com/snap-cloud/snapcon/pull/371 first.

I made two migrations.

db/migrate/20240422200831_add_amount_paid_cents_to_ticket_purchases.rb I added a new attribute called amount_paid_cents to the ticket_purchase model. Before the code was delegating :price to the ticket model which returned a money object with the original ticket's price and currency. By adding amount_paid_cents I was able to monetize it so that there's a way to access the purchase's amount paid and currency. db/migrate/20240417212948_set_currency_for_null_ticket_purchase_currency.rb This migration makes it so that each ticket_purchase whose currency field is null to be 'USD' instead. I was running into issues because of records that were in the ticket_purchase model before currency was added as a field being NULL when they all should be 'USD'

Checklist: