Implementing payments on a Monday
Tags: webdev, discuss, productivity
Published: 2022-06-27 21:03:56

Some few years ago I worked for an (undisclosed) company in Cyprus. We had a dedicated software developer exclusively working on payments, and I was supposed to take over his job. The payments module contained some 50,000+ lines of code, and was a mess of Biblical proportions. For the record, the thing supported like 20+ different payment providers, and withdrawals in addition to deposits, but it was scattered with things like `Sleep(30000)` (to wait for the payment provider to invoke our web hook before continuing execution of some endpoint, seriously! I am _not_ kidding!), in addition to God knows what more. In case you missed the point, let me type it out for you in code ...

```
// Waiting for payment provider to invoke web hook.
System.Threading.Current.Sleep(30000);
```

Occasionally the thing would even work ^_^

I begged my manager to allow me to rewrite it, without success. Even after I could prove by looking at our logs that 25% of all payments were simply rejected because our web server was too slow because of all the above `Sleep` invocations, and other weird parts (Microsoft Workflow Foundation anyone? Remember that one?), I still weren't allowed to rewrite it. This was a monster web server, serving about 500-1,000 payments per day, and we had to create a daemon on it to reboot IIS during the night because of all the memory leaks and socket leaks resulting in that once every 24 hours the thing would become completely locked up and dysfunctional.

## I replaced him in 10 hours with Hyperlambda today

Today I implemented Stripe subscription payments, and yes, I mean _today_. I started around lunch time, and it's 11:29PM now where I live, and fundamentally the thing is more or less done. It consists of about 377 lines of code, and besides from one or two nice to have features, such as web hooks, that I'll probably do later, the thing is more or less done.

Of course, I only did the backend integration, and once it is set into production, and you can use it to pay for cloudlets, the only reason why it'll be truly awesome, is because of my amazing team members; Shirin creating the frontend, Mohsen ensuring it runs in a super secure and stable K8s cluster, and Mo having created an amazing flow and design for the thing, and probably Sharvin having had some _"marketing objections"_ towards how the flow ends up I assume.

However, I want to emphasise that the thing we had a _dedicated full time software developer_ for at one of my previous companies, working 40+ hours per week, for 2.5 years (he had been there for 2.5 years), I did _on a Monday using Hyperlambda_. And before you ask, the guy had 20 years of experience as a software developer, and he could recite every single software development _"best practice"_ by heart, such as SOLID, Design Patterns, Micro Service, DDD, etc, etc, etc ...

## Need subscription payments?

[Get a (free) cloudlet here](https://aista.com/?secret=devto), go to the plugins section, and install the _"Stripe module"_. Screenshot below.

![Stripe subscription plugin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovuvmpo3hcmj8ks3k6w8.png)

Yup, not only did I create the thing _on a Monday_, but I also [open source licensed it](https://github.com/polterguy/stripe), and uploaded it as a dynamically installable plugin in Magic. Once installed, it'll create its own database automatically, and you'll have endpoints to both accept credit card information, pass it on to Stripe, for then to process subscription payments - Implying automatic payments deducted from your users accounts' in a recurring fashion. And it doesn't store credit card information locally, so no needs to worry about PCI compliance ...

## Why am I writing this?

Because of my favourite word; **KISS**, and my favourite programming language; **Hyperlambda**. KISS means _"Keep It Stupid Simple"_, and is an axiom I wish more software developers would follow. However, it's like an evolutionary local optimum, where instead of simplifying stuff, they ask themselves [how many useless buzzword technologies can I stuff into this project to ensure my CV becomes more valuable](https://dev.to/polterguy/cv-based-software-development-4555)?

And I'm quite frankly tired of this way of creating software. Simply for no other reasons, than the fact of that when sh*t hits the fan, and everything breaks down, they hire somebody like me to try to clean up the mess, and of course at that point the only way to salvage the project is to apply `SHIFT+DELETE` refactoring on it ...

I love this Erik Naggum rant where he goes all in on Perl, so let me rewrite it slightly to become more modern to prove a point ...

> The inexperienced developer had one problem. "I know he said, I'll just use SOLID, OOP, and Design Patterns." The inexperienced software developer now has 4 problems ...

Please, do me a favour [use Hyperlambda](https://aista.com/?secret=devto). I'm the guy who'll inevitably at some point have to clean up your mess ... :/