ČSOB Business Connector – PHP implementation

A few months ago I was asked to implement the connector in PHP 7.3 for new ČSOB API called Business Connector (CEB). If you have business bank account in ČSOB bank, you can activate the Business Connector in the internet banking. Afterwards this API will be available for you.

PHP implementation of CEB allows you to perform following tasks:

  • account information
  • list incoming/outgoing payments
  • generate import of payment batches

As mentioned the CEB connector is written in PHP 7.3 and you can find the source files on https://github.com/AsisTeam/csob-bc or you can install it into your project via composer require asisteam/csob-bc.

During the implementation I followed the implementation guide provided by ČSOB itself. Unfortunately there was no other open-source implementation of CEB even in different languages so I had no choice of inspiring myself in others code and I had to struggle with ČSOB certificates for a while. Anyway in the end there is a functional program that you can use for your own purpose as you wish and modify the code as you wish.

(more…)

Continue Reading

Marshalling empty slice to empty JSON array instead of null in Go

You’d better don’t make them angry and make them happy giving them the proper `[]` empty array value. How to do that? Easily.

When you are creating the new slice like var people []Person you created new slice with you get the nil pointer to people var. And then there is a comprehensively a null value in output JSON. But if you create new slice with people := make([]Person, 0) you get the desired output. Or you can use people := []Person{}for same result too. See the whole code below or try it in playground. Tell me if the Frontend colleague invited you for a beer then.

In JSON APIs you often need to return array of data. In your Go code you probably use the slice []NameOfTheType to keep the list of the items. But when it comes to marshalling to JSON when the slice is empty you may get the JSON output contains null instead of an empty array. You should (but most of the time should not) see the faces of frontend developers when they face null instead of expected [] and try to iterate over it in JS 🙂

(more…)

Continue Reading

TCP UDP request catcher

Very often during the software development I face the situation I need to log sent request fro my applications such as logs, metrics and so on. These request are in production directed to ELK stack, Prometheus, influxDB or to another 3rd party service. But for local development I don't want to run these services on my machine because of the resources consumption. I just want to verify if my app sent the data in proper format. Goreqbin is simple Go app that starts UDP and HTTP servers and logs all received requests. New servers and log methods may be easily added. Right now the output logging is to stdout only. It is good enough for me for development usage, but you are very welcome to contribute and and new output methods and/or new servers.

Continue Reading

Amqplib – RabbitMQ the easy way

If you have already worked with RabbitMQ message broker in Node.JS/Typescript you probably met the amqplib that is widely popular on NPM and used among many people. The library itself is very well documented and you may find a lot of interesting facts in the documentation. However, as my programming background is mainly based on modern php, I wanted to work with Rabbitmq connection, publisher and consumer structures in Objec-Oriented way. This lack of OOP I tried to solve with creation of the library that is built on the top of the mentioned amqplib and you may find it on NPM named amqplib-plus.

The goal of amqplib-plus library is to create classes for Connection, Publisher and Consumer. The whole library is written in typescript so you can easily integrate it to your own typescript projects or you can use compiled es6 javascript.

Amqplib-plus key features are:

  • connection auto-reconnect feature
  • easy to use object oriented publisher
  • easy to use object oriented consumer that runs user defined function on every consumed message

You can easily install it by running npm install amqplib-plus

(more…)

Continue Reading

ARES – Administrative Register of Economic Subjects

A few months ago I was asked to implement several open-source libraries in PHP for one czech company called Asisteam. One of them was a simple connector to ARES API (Czech economic subjects registry).

By calling this API endpoints you can get company details and/or validate whether some given company ID (IČO) really exists and correspond to some existing company known by Czech government and law.

You can find the library on github and you’re very welcome to use it and make pull requests if you know of any enhancement or bug fix.

(more…)

Continue Reading
Close Menu