【Day 633】Develop payment function for subscription service


These days, I joined a subscription service development team to help with coding payment functions. I was able to release it, so I want to reflect on that experience!

Project Overview

  • Created with Laravel.
  • Deploy to a Web hosting service.
  • Coding payment functions using the Japanese online payment service GMO Payment.
    • register and modify credit cards.
    • contract and withdrawal subscription.
    • settle monthly payments.

I joined this development team about 3 weeks before the release date. Until then, I didn't know what this service was. I had to start by getting domain knowledge.

However, there was little time to develop. I had to code even on holidays.

Worse, it was not complete with contracting the Japanese online payment service GMO Payment even on the day before the release date. Only the Test key was activated, not the Production key. That made the release date later and made clients angry.

In development, I only used test credit card numbers. I couldn't notice that ...

I learned a lot except how to code in this development. For example

  • I realized there was a lack of contract to use the online payment service for 1 week before release.

⇨ I had to check the contract of the service I used at first. Also, I should have checked I really could do something I wanted to realize.

  • I coded all of the functions before testing, but the requirement changed not to use many parts I had coded.

⇨If I hadn't much time, I should have coded and tested for minimum functions at first. I would not have waste time if I had done that.

In this development, all the decisions I didn't consider deeply got terrible results. I should have spent time thinking about it...

Learned with code that was written by others

I had a lot of opportunities to read code that others wrote because I joined this project late. There were many points I didn't know and could have learned.

Not to forget, I want to write down about part of that.

How to code input form in Laravel

I often coded the input form below in Laravel

// There are some errors in the validator
<input type="text" name="hoge" value="{{ old('hoge') }}">
// After User was authenticated
<input type="text" name="hoge" value="{{ $user->hoge }}">
// User wasn't authenticated
<input type="text" name="hoge" value="">

However, the above code could rewrite in a single line!

<input type="text" name="hoge" value="{{ isset($user->hoge) ? old('hoge', $user->hoge) : old('hoge') }}">

I didn't know the default value should write in old() second arguments...

The input form is one of the most essential components. I coded that component many times in development. I was glad to know how to code that simply.

  • About MVC

To be honest, I knew the word 'MVC', but I couldn't understand that word's meaning.

I often created Service Class as App\Service\HogeService.php and wrote common functions without knowing about the real meaning of Service Class. By google, Service Class seems to be used to reduce coding volume for Model Class.

I didn't often code in Model Class except for model definition. But, I should have written common functions in Model Class. I haven't needed to create Service Class.

The architecture I created was not MVC, and it was probably like MVCS.

From now on, I will write common functions in Model Class that should make the code simple.

Thank you for reading

Thank you for reading about my experience in development.

The more projects I developed, The more knowledge I haven't known increased. Is it endless...?

But, I only to do is keep trying. I'll do that!

Thank you!