Hi everyone welcome back.
So in this video we're going to be starting a new API which is basically we're going to call a bank
a B.
OK.
Now we're going to be thinking about developing how we can develop a bank of very very basic bank account
that supports severals features so you could open an account with the bank price of different accounts
and then you can add some money into the bank account and then you can transfer some money from one
hand to the other.
OK.
You can also there's a there's the bank here right.
This is the bank.
And then you can take a loan from the banks you can take one long year from from the bank and then it
adds to your debt and then it Asadi.
So you have more debt but you have more cash.
So it increases your cash and increases your debt.
OK.
So you have all these transactions that we want to ensure that the transactions between the accounts
are correct and there is no problem.
So if you're taking money from one account you're adding it to the other again.
OK.
And the bank account also of course has its own bank account like like cash and so on.
OK.
So in this in this tutorial a set of videos actually we're going to be developing a restful API to support
a couple of features.
OK so let's do this.
We're going to support a couple just the first one is going to be the register.
OK.
So we want the user to be able to register into your API results so the ad.
OK so bad.
Basically allows you to add the money to your bank account so you can for example pay as paying someone
cash and then in the bank you can pay them cash give them cash in real life.
And then they can add some money to your bank account.
So that is like inserting money or or.
No the opposite of withdrawing money.
OK.
And you can also transfer OK so you can transfer from one account to the other.
So let's say you have $100 you can transfer it into your friend's account or pay.
The other thing you were also do is to check balance.
OK so we want the ability for a user to be able to check his balance and make sure that his balances
like how he left it or if you just got his paycheck then it's it's increased in the right way.
OK.
There's also going to be implementing take a loan.
And we're going to be implementing pay loan.
OK.
So loan is let's say you don't have enough money so I say you want to buy a car and it costs $5000 but
you only have $4000.
So you take a loan from the bank for $1000.
You pay for the car and then you have a debt of $1000 a day.
Now once you have extra money in your account let's say you just got your paycheck for another $5000.
So now you can repay the bank account using your cash right so you can pay $1000 for your account and
give it to the bank right away so you can pay the loan that you took previous.
All right.
So these are the six features that we'll be implementing and also these are the six resources so if
I may add resources here.
OK so these are the resources.
Now let's talk about the your L and the or else should be straightforward.
OK.
So a registry is always going to be asked to cash register right as usual and is going to be add slash
and transfer is going to be at last transfer and a check balance is going to me and slash balance making
take loans going to be slashed a loan and payday loans are going to be slash pay loan.
All right.
OK.
So let's take.
Talk about the parameters of the work are out.
Do we need for each of these resources for registration.
Well as usual we want the username and the password OK for ADD.
Well we need the username.
OK.
So user name password and the amount to add to the user.
Right.
So let's say I win at 200 dollars into this account to this past.
OK.
And then the third thing is transfer.
So first of all I need my username to also authorize the transfers so I need my username and password
and then I also use the username of the person I'm sending money to someone to call that to.
OK so the person you do is an account or username.
So I also need to and I also need the amount I need to know how many how much or how much money I'm
transferring to that person to do.
OK.
So let's let's me and we draw a line here to make sure that we're dividing them equally and none of
them seem on the other ones.
OK.
OK so what about balance.
Well I need the username and the password right because I don't want anybody else to know my my my balance
except it means I need to verify that this is indeed me who is checking my balance.
OK.
OK what about cloned.
Well I need the user name and username password and the amount.
How much do you want to take in loans.
Right now you are getting $100 $200 loan and therefore the payday loan.
I also need my username and password so I need to authorize some payment right so I can't let just anyone
to do my name and right now would be ridiculous.
So our author.
So I need to give my username and password to authorize someone to to pay it.
Then I also need to say amounts.
So how much do I want to repay.
So let's say I have debt to the bank if for example $1000 that maybe I only want to pay 500 of it.
So I only have 500 a net gain.
So how much do you want to send or how much do you want to pay your debt.
OK.
So these are the parameters now for the method.
Well as you might have guessed all of them were sending some information to a server very we're not
just getting resources we're posting something.
So as the name might suggest Well we have post post post post so all of them are post.
OK.
So all of them is the message the method the method is post.
OK.
So what about the state this goes OK so status goes.
Let's talk about that.
Well there's a few of them which are actually universal.
OK so some status goes are going to be used in all of them.
OK.
So there's of course 200.
OK.
So 200 can be used in all of them right.
Because that means everything went according to plan and there is no problems.
OK.
What about some errors.
Let's discuss some errors.
So one of the errors is invalid user right.
So for registration or any any of them the user might have given us.
And if you look here you always give username password username password username password use any password
username password and username password.
OK.
So one of the areas that might be in all of them is three Oelwein which means invalid username or three
or two which means invalid password matching the user name.
OK.
So any of these might have two hundred three or one or zero.
These are the universal status codes right.
These are shared between all and all of them are guaranteed to kick.
Can we turn one of these data goes right because any of them might have an invalid username three or
once you do an invalid user name or an invalid password right.
Or they might have just succeeded and you got to 200 basis so far so good.
Now let's talk about three or three.
Not enough money.
OK.
So I'm going to say this serial threes or maybe I'll read here so your theory is not enough money again
so I'll do an x on the dollar sign.
So not enough money.
So which ones happens when you want it.
Well when does this happen.
Well when you want to pay someone or transfer someone some money but you don't have enough money.
OK.
OK so when does this happen.
Well when you're transferring money so this can happen right Years 3 0 3.
You don't have enough money so you can transfer it to someone.
Right if you would try to transfer $200 and you only have $100 then you can do that right.
Unless you take a loan.
Another thing is if you try to pay for the low if you try to pay for a loan.
So for example you have a low enough $1000 and you try to pay $500 but you don't have $500 and that
should set off a 303.
Right.
Not enough money.
All right.
OK so we've talked about three or three.
Now what about 3 0 4.
Well what when does this happen.
Well if someone Shiki tries to game the system by putting some amount of money which is less than or
equal to zero or less than zero.
OK.
When that happens well what would happen if I say that I want to pay someone negative $5 then that means
I'm adding into my account $5 right.
So someone was either actually banks which how this bug me.
You'd be surprised that people would put negative amounts and then this bank would wouldn't accept their
operation.
So if I for example I say I'm am so sorry for the US.
There's not enough space here.
But if I'm paid and then I'm transferring money to B and I say I want to transfer it to to be negative
five dollars.
Then what happens is the system ends up transferring five dollars from his account into his account
that's crazy right.
So we don't want our system to be that dumb.
Right.
So any of them which has an amount I'm going to add an additional airs three or four years which happens
when the money is less than or equal to zero.
So here for example is three or four years three or four.
So amount is here.
Here's also a mountaineer's amounts of three or four and three or four.
OK.
So these are all the years that we might have.
So we might add some while we're coding the the application.
But for now these are all the errors and the right protocol diagram that we're on hydro and we're going
to stop here and in the next video we're going to start building this API according to this team over
here.
All right then so I'll post a video here and I'll see you in the next video.
So until the next video happy any.