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

Implement payment in multiple currencies #369

Closed Edge7481 closed 6 months ago

Edge7481 commented 6 months ago

Note: This PR depends on PRs up to #368

Pivotal Tracker Link

What this PR does:

Unfortunately quite a large PR that completes the payment process. Ideally I could've split the db migrations and frontend items into separate PRs, but the migration requires changing the parameters for a lot of tests.

  1. Update ticket_purchase and payment records to store a required currency field
  2. Where amounts are calculated, it is updated to store the converted local currency, using convert_currency. I avoid changing existing logic for calculating total price supplied from Ticket model as much as possible.
  3. Update payments page to display the correct converted amount and symbol
  4. Update payments page to pass the correct currency when accessing stripe's API

Include screenshots, videos, etc.

image

Who authored this PR?

me

How should this PR be tested?

Added several tests in payment and ticket_purchase models that validate the existence of currency.

It's kind of difficult to know how I can improving testing. I think for now the most important part is ensuring that payments are stored correct. The features test case ensures that the ticket_purchase records the correct amount and currency, but it may need more comprehensive testing. Also, may need testing for currency conversion functionality in the event that an existing currency was used to complete a transaction, but that currency is later removed. Will need to check for interaction with the db

Are there any complications to deploying this?

Will need a migration

Checklist:

cycomachead commented 6 months ago

@Edge7481

Oh, now this one has some merge conflicts. Does the ENV['SHOW_CURRENCY_SELECTOR'] config need to exist anymore? It seems like actually it can be removed.

Edge7481 commented 6 months ago

huh when i tried to resolve the merge conflicts on github's online editor it automatically synced my dev branch with snap-cloud/main.