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

Implement prepayment processing in billable invoice #77

Open
QuanMPhm opened this issue Aug 8, 2024 · 3 comments
Open

Implement prepayment processing in billable invoice #77

QuanMPhm opened this issue Aug 8, 2024 · 3 comments
Assignees
Milestone

Comments

@QuanMPhm
Copy link
Contributor

QuanMPhm commented Aug 8, 2024

As the first step to implementing prepayments, we need to implement prepayment processing to the billable invoice. Prepayment processing will require several steps and important requirements:

  • Information needed for prepayment processing are stored in private CSVs. The location of these CSVs are still in discussion in Add new CSVs for prepaid group billing #80
  • All discounts (New-PI credit, BU sudsidy) must be applied before a group's prepayment credits are used
  • Another thing to note about discounts, all invoices except the BU-internal invoice must show that the BU subsidy is not applied, but the final balance must show that the subsidy has been applied (the balance must be decreased by the amount of the subsidy, even if the prepaid group has enough balance to fully pay for the project)
  • Prepayment credits are applied the same the month they have been added.

Several new prepaid-related rows are to be added to the billable invoice, empty if the project does not belong to a prepaid group:

  • Prepaid Group Name - Group Name
  • Prepaid Group Institution - Determined from Group Contact Email
  • Prepaid Group Balance - Sum of the project's group's current credits, debits, and their debits from the current invoice
  • Prepaid Group Amount Used - The amount from the prepaid group's balance used to pay for the project/allocation cost

These rows should also be shown in all invoices derived from the billable invoice. This includes the HU-BU or NERC Total invoice, the PI-specific invoices, and the BU Internal invoices.

Detailed specifications of this feature is in the Prepaid Development Scaffolding document.

@QuanMPhm QuanMPhm self-assigned this Aug 8, 2024
@QuanMPhm
Copy link
Contributor Author

QuanMPhm commented Aug 20, 2024

@knikolla @naved001 Should the processing script fetch the prepaid group tables (i.e the debits, credits tables) by making calls to the github API, or should it expect these files to be passed via the CLI like with the nonbillable-related files?

@knikolla
Copy link
Contributor

@QuanMPhm the same way as it works with the non billable projects. The script expects a file argument passed.

@QuanMPhm
Copy link
Contributor Author

In the prepayment scaffolding, we agreed that the Prepayment credit should be applied after all other discounts (New-PI credit, BU subsidy), intent being that PIs should benefit from discounts before paying with their money.

That being said, we’re also told that the BU subsidy should be applied, but not visible in any of the invoices except the BU Internal invoice. This leads to a bit of messiness in our current code since the BU Internal invoice is made after (and is based on) the billable invoice. This means implementing the Prepaid credit would require some restructuring of the current code. @knikolla @naved001 My proposed restructuring is the following:

During the process() step for the billable invoice, could I apply the BU subsidy and add the Subsidy column to the dataframe, but filter it out and “undo” the subsidy during the export() step? When we arrive at the process() step for the BU Internal invoice, I can “redo” the subsidy before exporting. Would this be a good way to restructure the code?

@QuanMPhm QuanMPhm changed the title Implement invoice prepayment groups Implement prepayment processing in billable invoice Aug 30, 2024
@knikolla knikolla added this to the Prepayments milestone Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants