ArboreumDev / credit-union-frontend

Frontend in Next.js + Typescript + GraphQL
https://frontend-two-sandy.vercel.app
1 stars 0 forks source link

payment 2 period mapping #172

Open djudjuu opened 3 years ago

djudjuu commented 3 years ago

Problem:

depending on whether a payment is too small, just right or too big. it is being disitributed differenlty amongst lenders & supporters. Consequently, we run into complications if we allow multiple repayments per period: The Scheduler assumes all payments arrived at once and will thus treat money from first & second payment the same way. As we currently distribute the money right after it comes in, this might not be possible.

Solutions

A) we just allow one repayment per period.

B) We keep the money in escrow until the end of the period and only release it then.

C) We do some math with the schedules and figure out how distribute the second tranche based on the previous ones

=> I say we go with A for now & C down the road

gparuthi commented 3 years ago

I think for the demo, we go with A with:

How do I calculate the time period dates?

djudjuu commented 3 years ago

How do I calculate the time period dates?

we need to derive them from the start_date. One payment period is 30 days. so for the x-th (0 based) period we need to say please pay your installment before: day_of_start_date +(x+1)*30days

@gsVAM can you confirm that?

(personally I think that this is a bit bad, as we ask the borrower to pay earlier and earlier every installment (due to some month having 31 days...)...so if we start on the 1 of April, they eventually have to pay on the 28th of august (I think, not checked)....kind of weird...anyhow, for now we need to go with it and adjust it at some later point

gsVAM commented 3 years ago

So there is a way to fix this last part you mentioned. The scheduler accommodates the first period length being shorter than normal , you can use this to “adjust” things so that repayment dates line up “correctly”. I say “correctly” cause it’s still a hack given that period length may be Inconsistent. That isn’t difficult to accommodate (the loan scheduler let’s you define periods however you want) — the issue is that interest per period must be the same and technically this will also slightly vary if 30 days vs 31. So we can take that extra day that will be dropped and prepend it to the first period so say for a 6 month loan taken out on jan 15 we can append 3 extra days (first Prd Len = 18/30) and now have all payments fall on the 1st starting with feb 1.

On Wed, Jan 13, 2021 at 11:12 AM djudjuu notifications@github.com wrote:

How do I calculate the time period dates?

we need to derive them from the start_date. One payment period is 30 days. so for the x-th (0 based) period we need to say please pay your installment before: day_of_start_date +(x+1)*30days

@gsVAM https://github.com/gsVAM can you confirm that?

(personally I think that this is a bit bad, as we ask the borrower to pay earlier and earlier every installment (due to some month having 31 days...)...so if we start on the 1 of April, they eventually have to pay on the 28th of august (I think, not checked)....kind of weird...anyhow, for now we need to go with it and adjust it at some later point

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ArboreumDev/frontend/issues/172#issuecomment-759347772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEM27ZOIDTAL4P63Y57NQRDSZVWZJANCNFSM4V7DGAHQ .

djudjuu commented 3 years ago

you can use this to “adjust” things so that repayment dates line up “correctly

cool, thanks for the detailed answer. The question remains though, how can we in the frontend derive the end-date of the x-th period, just knowing its start-date. Mind, the frontend is only talking to the scheduler via API, so there is no straight way to use it.

say my start-date is the 3rd of feb. Does that mean it follows that the periods end on march 3, april 3, june 3, ... (or would it be the 4th?

@gsVAM

gsVAM commented 3 years ago

i imagine there is a JS library that does that, my thinking is something as follows:

(1) Ask user one of 3 options as to when they would like to pay (start, middle, or end of month) Sidenote: This first-period length must always be <1 (2) based off this we assign a day of month that they will repay (3) calculate the first period length = (closest_repayment_date-start_date)+(extra days for months with 31 days and subtracting two days if feb)

Each period will end on the day of the repayment date, and the new period begins the day after

Does this make sense?

On Wed, Jan 13, 2021 at 11:29 AM djudjuu notifications@github.com wrote:

you can use this to “adjust” things so that repayment dates line up “correctly

cool, thanks for the detailed answer. The question remains though, how can we in the frontend derive the end-date of the x-th period, just knowing its start-date. Mind, the frontend is only talking to the scheduler via API, so there is no straight way to use it.

say my start-date is the 3rd of feb. Does that mean it follows that the periods end on march 3, april 3, june 3, ... (or would it be the 4th?

@gsVAM https://github.com/gsVAM

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ArboreumDev/frontend/issues/172#issuecomment-759357234, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEM27ZLYVEIKBGT2TZNN2FLSZVYYXANCNFSM4V7DGAHQ .

djudjuu commented 3 years ago

I think for starters we can just the loan-schedule and append that info somewhere in the terms. computing it in two different places sounds like a recipe for overlooking weird edge cases.