WEBVTT

00:05.140 --> 00:06.740
Hi everyone welcome back.

00:06.910 --> 00:12.850
So in this video we're going to be starting a new API which is basically we're going to call a bank

00:13.090 --> 00:13.650
a B.

00:13.690 --> 00:14.220
OK.

00:14.320 --> 00:20.920
Now we're going to be thinking about developing how we can develop a bank of very very basic bank account

00:21.310 --> 00:27.250
that supports severals features so you could open an account with the bank price of different accounts

00:27.550 --> 00:32.770
and then you can add some money into the bank account and then you can transfer some money from one

00:32.900 --> 00:33.900
hand to the other.

00:33.940 --> 00:34.880
OK.

00:35.020 --> 00:37.790
You can also there's a there's the bank here right.

00:37.830 --> 00:38.970
This is the bank.

00:39.100 --> 00:44.590
And then you can take a loan from the banks you can take one long year from from the bank and then it

00:44.620 --> 00:48.220
adds to your debt and then it Asadi.

00:48.360 --> 00:50.690
So you have more debt but you have more cash.

00:50.800 --> 00:53.930
So it increases your cash and increases your debt.

00:54.300 --> 00:54.790
OK.

00:54.850 --> 00:59.950
So you have all these transactions that we want to ensure that the transactions between the accounts

01:00.280 --> 01:02.860
are correct and there is no problem.

01:02.860 --> 01:07.040
So if you're taking money from one account you're adding it to the other again.

01:07.090 --> 01:07.820
OK.

01:07.840 --> 01:14.190
And the bank account also of course has its own bank account like like cash and so on.

01:14.230 --> 01:14.980
OK.

01:15.280 --> 01:22.900
So in this in this tutorial a set of videos actually we're going to be developing a restful API to support

01:22.900 --> 01:23.910
a couple of features.

01:23.920 --> 01:25.650
OK so let's do this.

01:25.660 --> 01:29.740
We're going to support a couple just the first one is going to be the register.

01:29.780 --> 01:30.330
OK.

01:30.340 --> 01:36.010
So we want the user to be able to register into your API results so the ad.

01:36.170 --> 01:37.690
OK so bad.

01:37.930 --> 01:47.230
Basically allows you to add the money to your bank account so you can for example pay as paying someone

01:47.230 --> 01:52.420
cash and then in the bank you can pay them cash give them cash in real life.

01:52.630 --> 01:55.050
And then they can add some money to your bank account.

01:55.060 --> 01:59.360
So that is like inserting money or or.

01:59.510 --> 02:01.800
No the opposite of withdrawing money.

02:01.810 --> 02:02.600
OK.

02:02.970 --> 02:08.180
And you can also transfer OK so you can transfer from one account to the other.

02:08.240 --> 02:14.250
So let's say you have $100 you can transfer it into your friend's account or pay.

02:14.560 --> 02:18.120
The other thing you were also do is to check balance.

02:18.130 --> 02:24.370
OK so we want the ability for a user to be able to check his balance and make sure that his balances

02:24.880 --> 02:31.260
like how he left it or if you just got his paycheck then it's it's increased in the right way.

02:31.270 --> 02:32.040
OK.

02:32.350 --> 02:35.950
There's also going to be implementing take a loan.

02:36.340 --> 02:39.870
And we're going to be implementing pay loan.

02:39.940 --> 02:40.490
OK.

02:40.660 --> 02:47.810
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

02:47.830 --> 02:49.640
you only have $4000.

02:49.720 --> 02:52.890
So you take a loan from the bank for $1000.

02:52.900 --> 02:58.340
You pay for the car and then you have a debt of $1000 a day.

02:58.960 --> 03:05.240
Now once you have extra money in your account let's say you just got your paycheck for another $5000.

03:05.410 --> 03:12.490
So now you can repay the bank account using your cash right so you can pay $1000 for your account and

03:12.490 --> 03:16.650
give it to the bank right away so you can pay the loan that you took previous.

03:17.020 --> 03:17.520
All right.

03:17.560 --> 03:23.620
So these are the six features that we'll be implementing and also these are the six resources so if

03:23.620 --> 03:26.090
I may add resources here.

03:26.260 --> 03:28.470
OK so these are the resources.

03:28.480 --> 03:32.390
Now let's talk about the your L and the or else should be straightforward.

03:32.410 --> 03:32.890
OK.

03:33.010 --> 03:39.700
So a registry is always going to be asked to cash register right as usual and is going to be add slash

03:39.730 --> 03:49.140
and transfer is going to be at last transfer and a check balance is going to me and slash balance making

03:50.290 --> 03:58.680
take loans going to be slashed a loan and payday loans are going to be slash pay loan.

03:58.680 --> 03:59.460
All right.

03:59.710 --> 03:59.930
OK.

03:59.930 --> 04:00.540
So let's take.

04:00.580 --> 04:03.120
Talk about the parameters of the work are out.

04:03.130 --> 04:07.630
Do we need for each of these resources for registration.

04:07.630 --> 04:14.950
Well as usual we want the username and the password OK for ADD.

04:15.080 --> 04:18.330
Well we need the username.

04:18.440 --> 04:18.920
OK.

04:18.950 --> 04:24.520
So user name password and the amount to add to the user.

04:24.530 --> 04:24.850
Right.

04:24.850 --> 04:29.390
So let's say I win at 200 dollars into this account to this past.

04:29.450 --> 04:30.460
OK.

04:31.010 --> 04:33.560
And then the third thing is transfer.

04:33.560 --> 04:40.770
So first of all I need my username to also authorize the transfers so I need my username and password

04:41.960 --> 04:48.010
and then I also use the username of the person I'm sending money to someone to call that to.

04:48.050 --> 04:53.950
OK so the person you do is an account or username.

04:54.230 --> 05:00.620
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

05:00.620 --> 05:02.980
transferring to that person to do.

05:03.350 --> 05:04.150
OK.

05:04.430 --> 05:11.900
So let's let's me and we draw a line here to make sure that we're dividing them equally and none of

05:11.900 --> 05:14.320
them seem on the other ones.

05:14.450 --> 05:15.210
OK.

05:15.590 --> 05:17.050
OK so what about balance.

05:17.060 --> 05:25.390
Well I need the username and the password right because I don't want anybody else to know my my my balance

05:25.610 --> 05:30.830
except it means I need to verify that this is indeed me who is checking my balance.

05:30.850 --> 05:31.680
OK.

05:32.320 --> 05:34.190
OK what about cloned.

05:34.240 --> 05:39.700
Well I need the user name and username password and the amount.

05:39.700 --> 05:42.100
How much do you want to take in loans.

05:42.100 --> 05:47.430
Right now you are getting $100 $200 loan and therefore the payday loan.

05:47.430 --> 05:54.790
I also need my username and password so I need to authorize some payment right so I can't let just anyone

05:54.840 --> 05:58.060
to do my name and right now would be ridiculous.

05:58.060 --> 05:59.330
So our author.

05:59.350 --> 06:03.910
So I need to give my username and password to authorize someone to to pay it.

06:03.960 --> 06:05.610
Then I also need to say amounts.

06:05.620 --> 06:07.510
So how much do I want to repay.

06:07.540 --> 06:15.590
So let's say I have debt to the bank if for example $1000 that maybe I only want to pay 500 of it.

06:15.640 --> 06:18.350
So I only have 500 a net gain.

06:18.580 --> 06:22.750
So how much do you want to send or how much do you want to pay your debt.

06:22.780 --> 06:23.350
OK.

06:23.530 --> 06:27.280
So these are the parameters now for the method.

06:27.580 --> 06:32.440
Well as you might have guessed all of them were sending some information to a server very we're not

06:32.440 --> 06:35.580
just getting resources we're posting something.

06:35.670 --> 06:45.730
So as the name might suggest Well we have post post post post so all of them are post.

06:45.760 --> 06:46.330
OK.

06:46.420 --> 06:50.770
So all of them is the message the method the method is post.

06:50.790 --> 06:51.450
OK.

06:51.810 --> 06:52.090
OK.

06:52.130 --> 06:55.750
So what about the state this goes OK so status goes.

06:55.870 --> 06:57.160
Let's talk about that.

06:57.400 --> 07:01.040
Well there's a few of them which are actually universal.

07:01.060 --> 07:05.340
OK so some status goes are going to be used in all of them.

07:05.350 --> 07:05.870
OK.

07:06.040 --> 07:08.210
So there's of course 200.

07:08.560 --> 07:09.180
OK.

07:09.310 --> 07:11.930
So 200 can be used in all of them right.

07:11.980 --> 07:16.290
Because that means everything went according to plan and there is no problems.

07:16.300 --> 07:17.260
OK.

07:17.920 --> 07:18.250
OK.

07:18.250 --> 07:19.640
What about some errors.

07:19.660 --> 07:21.310
Let's discuss some errors.

07:21.310 --> 07:23.970
So one of the errors is invalid user right.

07:23.980 --> 07:29.860
So for registration or any any of them the user might have given us.

07:29.860 --> 07:35.710
And if you look here you always give username password username password username password use any password

07:35.710 --> 07:37.800
username password and username password.

07:37.810 --> 07:38.410
OK.

07:38.770 --> 07:46.060
So one of the areas that might be in all of them is three Oelwein which means invalid username or three

07:46.060 --> 07:49.960
or two which means invalid password matching the user name.

07:49.990 --> 07:50.500
OK.

07:50.680 --> 07:55.390
So any of these might have two hundred three or one or zero.

07:55.420 --> 07:57.950
These are the universal status codes right.

07:57.970 --> 08:02.620
These are shared between all and all of them are guaranteed to kick.

08:02.620 --> 08:08.390
Can we turn one of these data goes right because any of them might have an invalid username three or

08:08.410 --> 08:13.560
once you do an invalid user name or an invalid password right.

08:13.690 --> 08:18.980
Or they might have just succeeded and you got to 200 basis so far so good.

08:19.270 --> 08:21.710
Now let's talk about three or three.

08:21.730 --> 08:22.890
Not enough money.

08:22.900 --> 08:23.410
OK.

08:23.500 --> 08:29.670
So I'm going to say this serial threes or maybe I'll read here so your theory is not enough money again

08:29.680 --> 08:31.690
so I'll do an x on the dollar sign.

08:31.690 --> 08:32.980
So not enough money.

08:33.190 --> 08:36.750
So which ones happens when you want it.

08:36.760 --> 08:39.250
Well when does this happen.

08:39.250 --> 08:44.770
Well when you want to pay someone or transfer someone some money but you don't have enough money.

08:44.800 --> 08:45.640
OK.

08:45.940 --> 08:48.090
OK so when does this happen.

08:48.130 --> 08:52.270
Well when you're transferring money so this can happen right Years 3 0 3.

08:52.270 --> 08:55.820
You don't have enough money so you can transfer it to someone.

08:55.830 --> 09:01.310
Right if you would try to transfer $200 and you only have $100 then you can do that right.

09:01.420 --> 09:03.080
Unless you take a loan.

09:03.550 --> 09:08.450
Another thing is if you try to pay for the low if you try to pay for a loan.

09:08.710 --> 09:15.940
So for example you have a low enough $1000 and you try to pay $500 but you don't have $500 and that

09:15.940 --> 09:17.630
should set off a 303.

09:17.650 --> 09:17.890
Right.

09:17.890 --> 09:19.380
Not enough money.

09:19.910 --> 09:20.810
All right.

09:20.980 --> 09:23.420
OK so we've talked about three or three.

09:23.420 --> 09:25.390
Now what about 3 0 4.

09:25.600 --> 09:27.320
Well what when does this happen.

09:27.370 --> 09:34.570
Well if someone Shiki tries to game the system by putting some amount of money which is less than or

09:34.570 --> 09:37.050
equal to zero or less than zero.

09:37.060 --> 09:37.860
OK.

09:38.170 --> 09:46.480
When that happens well what would happen if I say that I want to pay someone negative $5 then that means

09:46.540 --> 09:50.210
I'm adding into my account $5 right.

09:50.500 --> 09:53.800
So someone was either actually banks which how this bug me.

09:53.810 --> 09:59.620
You'd be surprised that people would put negative amounts and then this bank would wouldn't accept their

09:59.620 --> 10:00.610
operation.

10:00.610 --> 10:05.410
So if I for example I say I'm am so sorry for the US.

10:05.530 --> 10:06.720
There's not enough space here.

10:06.730 --> 10:14.080
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

10:14.080 --> 10:15.220
five dollars.

10:15.400 --> 10:22.480
Then what happens is the system ends up transferring five dollars from his account into his account

10:23.150 --> 10:24.510
that's crazy right.

10:24.640 --> 10:27.800
So we don't want our system to be that dumb.

10:27.820 --> 10:28.310
Right.

10:28.360 --> 10:34.330
So any of them which has an amount I'm going to add an additional airs three or four years which happens

10:34.330 --> 10:36.430
when the money is less than or equal to zero.

10:36.430 --> 10:40.420
So here for example is three or four years three or four.

10:40.420 --> 10:41.810
So amount is here.

10:41.950 --> 10:47.970
Here's also a mountaineer's amounts of three or four and three or four.

10:48.280 --> 10:49.250
OK.

10:49.660 --> 10:52.950
So these are all the years that we might have.

10:52.990 --> 10:57.260
So we might add some while we're coding the the application.

10:57.270 --> 11:03.910
But for now these are all the errors and the right protocol diagram that we're on hydro and we're going

11:03.910 --> 11:09.040
to stop here and in the next video we're going to start building this API according to this team over

11:09.040 --> 11:10.270
here.

11:10.270 --> 11:14.680
All right then so I'll post a video here and I'll see you in the next video.

11:14.680 --> 11:16.810
So until the next video happy any.
