Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Invoice emails errors fixed and integration test #6804

Merged
merged 8 commits into from
Feb 6, 2020

Conversation

mrsaicharan1
Copy link
Member

@mrsaicharan1 mrsaicharan1 commented Feb 1, 2020

Fixes #6486

Short description of what this resolves:

The invoice emails which were supposed to be sent out every month would error out if a ticket fee wasn't sent in the admin section.

Changes proposed in this pull request:

  • Handled the TicketFee Error
  • Added integration test to test calculation
  • Corrected Invoice Calculation Logic

tests/all/integration/api/helpers/test_scheduled_jobs.py Outdated Show resolved Hide resolved
tests/all/integration/api/helpers/test_scheduled_jobs.py Outdated Show resolved Hide resolved
tests/all/integration/api/helpers/test_scheduled_jobs.py Outdated Show resolved Hide resolved
tests/all/integration/api/helpers/test_scheduled_jobs.py Outdated Show resolved Hide resolved
tests/all/integration/api/helpers/test_scheduled_jobs.py Outdated Show resolved Hide resolved
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
app/api/helpers/scheduled_jobs.py Outdated Show resolved Hide resolved
@mrsaicharan1 mrsaicharan1 force-pushed the monthly-error branch 2 times, most recently from caa165f to acc054e Compare February 1, 2020 12:09
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
app/factories/ticket_holder.py Outdated Show resolved Hide resolved
test_order.amount = 100
test_order.event = test_event
# ticket holder factory
test_ticket_holder = AttendeeFactory()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local variable 'test_ticket_holder' is assigned to but never used

fix: fixed factory
@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Feb 2, 2020

The event invoice is calculated as:
(number of tickets purchased over the last month x ticket_price x percentage_ticket_fee). This was being calculated prior to this as well but the net revenue(gross_revenue - event invoice) was being stored in the Event Invoice Model. Fixed that up as well.

@mrsaicharan1 mrsaicharan1 force-pushed the monthly-error branch 3 times, most recently from 0ad1b1b to e251230 Compare February 2, 2020 08:30
@mrsaicharan1 mrsaicharan1 changed the title [WIP]fix: Invoice emails errors fixed and integration test fix: Invoice emails errors fixed and integration test Feb 2, 2020
@auto-label auto-label bot added the fix label Feb 2, 2020
@codecov
Copy link

codecov bot commented Feb 2, 2020

Codecov Report

Merging #6804 into development will not change coverage.
The diff coverage is 97.95%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #6804   +/-   ##
============================================
  Coverage        65.86%   65.86%           
============================================
  Files              307      307           
  Lines            15382    15382           
============================================
  Hits             10131    10131           
  Misses            5251     5251
Impacted Files Coverage Δ
app/api/schema/events.py 91.47% <ø> (ø) ⬆️
app/factories/session.py 100% <ø> (ø) ⬆️
app/factories/role_invite.py 100% <ø> (ø) ⬆️
.../all/integration/api/helpers/test_csv_jobs_util.py 98.86% <ø> (ø) ⬆️
app/factories/attendee.py 100% <ø> (ø) ⬆️
app/factories/user_token_blacklist.py 100% <100%> (ø) ⬆️
app/models/role_invite.py 92.1% <100%> (ø) ⬆️
app/models/access_code.py 93.33% <100%> (ø) ⬆️
...all/integration/api/helpers/test_scheduled_jobs.py 100% <100%> (ø) ⬆️
app/api/server_version.py 83.33% <100%> (ø) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f124456...4d61720. Read the comment docs.

@mrsaicharan1 mrsaicharan1 force-pushed the monthly-error branch 4 times, most recently from fb78f0d to f780044 Compare February 2, 2020 09:13
if ticket_fees > ticket_fee_maximum:
ticket_fees = ticket_fee_maximum
net_revenue = gross_revenue - ticket_fees
invoice_amount = gross_revenue * (ticket_fee_percentage / 100)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the Absorb Fees option as of now. Pass fees onto attendees can be implemented as well as a part of the upcoming features.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diru1100 Hi, would be great if you could review the logic for this. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, Eventbrite seems to calculate it in the same way. The only difference is that they add a fixed rate to the calculated amount too. 2% + 0.79$

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal I think this should be good to go.

@mrsaicharan1
Copy link
Member Author

If the invoice calculation is fine here, we can go ahead with the test over here #6820

@iamareebjamal
Copy link
Member

Do you want to add the test here itself?

@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Feb 6, 2020 via email

@iamareebjamal iamareebjamal merged commit 42c409b into fossasia:development Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Monthly invoice mails are erroring out
4 participants