WEBVTT 00:01.680 --> 00:08.310 So last time we had almost a complete transaction, just wasn't saving the expiry date in the form of 00:08.310 --> 00:13.680 expiry month and expiry year, and that's because in insert transaction in Model Stojko, we didn't 00:13.680 --> 00:14.900 actually tell us to do so. 00:14.910 --> 00:21.440 So let's fix that expiry month and expiry year. 00:21.450 --> 00:26.070 And I want to put the comma in there this time and I will add the two placeholders. 00:26.310 --> 00:29.040 Question mark, question mark. 00:29.340 --> 00:32.300 And I'm putting those right after bank return code. 00:32.880 --> 00:41.160 So let's put in TAIEX and expiry month and then dot expiry year. 00:43.340 --> 00:44.850 OK, so that's a good start. 00:44.880 --> 00:50.400 So once I actually save this and start the application and run a test transaction, I should have the 00:50.400 --> 00:51.980 expiry month and expiry year. 00:52.410 --> 00:55.830 I also have the bank return code and I'm saving this in transactions. 00:55.830 --> 01:00.750 But if we go back and look at what we're displaying here, there's two other things we probably want 01:00.750 --> 01:01.560 to save as well. 01:01.560 --> 01:05.910 For example, getting this payment intent, that might be something. 01:05.910 --> 01:10.140 Well, it's almost certainly something we're going to have to do if we want to do a refund at some point. 01:10.860 --> 01:13.740 We're not saving that and we're also not saving payment method. 01:14.010 --> 01:19.710 So let's go back and update our database, our models and so forth to capture both payment method and 01:19.710 --> 01:20.550 payment intent. 01:20.550 --> 01:22.310 And we'll store those in the transaction tables. 01:22.320 --> 01:24.040 That seems like a logical place to put it. 01:24.990 --> 01:30.630 So back to our idea and let's open our terminal and clear the screen, make sure we're in the right 01:30.630 --> 01:31.190 directory. 01:31.230 --> 01:31.740 I am. 01:31.750 --> 01:37.950 I mean, the level of my directory and I'll type to migrate fears or so to generate fees 01:41.550 --> 01:45.090 and calls to transaction. 01:45.210 --> 01:46.260 That should be sufficient. 01:47.070 --> 01:48.690 That will create my two migrations. 01:48.690 --> 01:54.990 So I hope my terminal opened my migration's folder and open the two new ones. 01:55.650 --> 02:03.000 There's the up and there's the down and we have code we can copy here from up and down for when we added 02:03.000 --> 02:04.800 customer ID to a table. 02:06.210 --> 02:12.450 So this will add the column and I'll go back to my up migration newly generated. 02:12.810 --> 02:14.520 We're going to add this to transactions 02:17.340 --> 02:18.810 and I'll just call it payment content 02:22.710 --> 02:29.010 and it will be a string and we'll make it default to an empty string. 02:29.550 --> 02:32.850 That way we won't get an error is we have existing rows in. 02:34.800 --> 02:44.150 And our down migration or copy that down from this one and open my newly generated down migration and 02:44.160 --> 02:45.510 again, that's Transaction's. 02:48.060 --> 02:50.610 And we're going to drop payment intent 02:53.550 --> 02:55.980 and we also need payment method, so I'll just add it right now. 02:57.300 --> 03:04.170 Payment method and from my outmigration of duplicate that and call it payment method. 03:07.620 --> 03:14.610 Now, if we did everything right, I should be able to run from the terminal, so to migrate and there 03:14.610 --> 03:14.970 it is. 03:15.000 --> 03:17.500 Let's go look at the database and make sure those columns are in there. 03:18.390 --> 03:19.470 Look at the structure. 03:19.950 --> 03:23.340 Refresh this and their payment intent and payment method. 03:23.370 --> 03:26.020 Two hundred and thirty five characters should be sufficient. 03:27.300 --> 03:30.540 So let's go to our models and add those. 03:32.130 --> 03:36.210 So models that go find transaction or a. 03:38.710 --> 03:39.220 Where is it? 03:39.490 --> 03:40.070 There it is. 03:40.100 --> 03:43.940 OK, and we will add and I'll put them right here. 03:43.960 --> 03:49.330 It doesn't matter where they go, payment intent will be a string. 03:55.850 --> 04:03.320 Strings and in Jason, I'll call that Hamit intent, 04:07.730 --> 04:09.890 duplicate that line and make it payment method. 04:14.850 --> 04:15.750 Payment method. 04:19.340 --> 04:20.910 And format, the whole thing. 04:23.000 --> 04:29.000 Now let's go find that insert payment or insert transaction and add those two columns to it, insert 04:29.000 --> 04:32.470 transaction, so I'll put them right after expiry here. 04:33.560 --> 04:34.880 Payment, intent 04:38.120 --> 04:43.550 and payment method at a comma, and that's coming right after expiry year. 04:45.440 --> 04:53.780 So tax and payment, intent and tax and payment method and a comma. 04:54.890 --> 04:57.050 OK, so now we need to update our handlers. 04:57.860 --> 05:05.780 So let's go to our handlers and find the part where we're actually building that transaction, which 05:05.780 --> 05:08.090 is right here. 05:09.230 --> 05:11.630 So after bank return, Kotal payment. 05:16.070 --> 05:20.540 Intent, and that will be equal to, I believe, payment of intent. 05:21.920 --> 05:24.380 That's a string, yes, and then payment method 05:27.080 --> 05:28.190 and payment method. 05:31.050 --> 05:37.800 So if I format this and open my terminal and clear the screen and type make start. 05:42.490 --> 05:48.210 Everything is running, let's go back to our Web browser and run one more transaction so products buy 05:48.210 --> 05:48.900 one widget. 05:50.060 --> 06:05.010 This will be for Bruce Wayne Bruce at Wayne Enterprises dot com, Bruce Wayne and his credit card, 06:08.340 --> 06:10.600 zero for twenty nine four four four. 06:12.030 --> 06:13.620 So now I want to charge the card. 06:16.980 --> 06:17.780 I have an error. 06:18.330 --> 06:19.240 Let's find the error. 06:20.190 --> 06:22.440 It's always an error with skill when I'm working. 06:23.730 --> 06:26.190 Column count doesn't match value at row one. 06:27.340 --> 06:30.770 And this is from handler Stocco eighty nine. 06:30.780 --> 06:32.820 So I know where that is right here. 06:32.830 --> 06:33.990 Save transaction. 06:34.590 --> 06:38.220 Let's go to insert transaction and see what we have. 06:38.670 --> 06:44.580 One, two, three, four, five, six, seven, eight, nine, 10, 11. 06:44.580 --> 06:49.110 And there's going to be nine, one, two, three, four, five, six, seven, eight, nine. 06:49.590 --> 06:52.320 Something else I always forgot to do was to update the placeholders. 06:52.920 --> 06:54.710 So let's stop the application. 06:54.810 --> 06:56.070 Start the application. 06:58.140 --> 06:59.640 Actually, I have to stop it this way. 06:59.670 --> 07:00.330 Make stop. 07:01.710 --> 07:02.460 Make start. 07:05.020 --> 07:06.770 And it's now running good. 07:06.790 --> 07:13.330 So let's go try that again back one screen and we'll just refresh this page to make sure everything's 07:13.330 --> 07:17.940 current JavaScript error so I can close this, OK? 07:17.980 --> 07:18.910 Clark Kent 07:23.260 --> 07:27.020 Clark at Daily Planet dot com. 07:28.090 --> 07:37.230 Clark Kent working for two zero three twenty nine or five six. 07:38.230 --> 07:43.480 And now when I look in the database, if everything goes well, we should have all of the information 07:43.480 --> 07:48.800 we need, including the expiry month, expiry year payment method and payment intent. 07:48.820 --> 07:49.670 So let's check that out. 07:50.710 --> 07:51.820 Back to the database. 07:51.820 --> 07:54.220 Look at transactions, look at the content. 07:54.400 --> 07:58.270 Refresh this and we should have this one. 07:58.300 --> 07:59.110 Very good. 07:59.400 --> 08:02.380 OK, and we have the expire month. 08:02.390 --> 08:05.730 We have the expire year, the payment intent and the payment method. 08:06.100 --> 08:06.540 Perfect. 08:07.270 --> 08:12.040 So now we have all the information we need to do things like refunding a transaction. 08:12.040 --> 08:16.840 And we've saved all of the necessary information that we're capturing from our front end. 08:17.020 --> 08:19.780 OK, so it's time to move on.