When making a purchase at an establishment with our credit or debit card, a fee is charged by the acquiring companies on each transaction. This fee is called MDR (Merchant Discount Rate). The acquirer passes on the purchase price to the shopkeeper, the MDR is deducted, thus, the shopkeeper receives the net value of the transaction.
Card companies such as VISA, Elo, MasterCard, Hipercard, etc., have different transfer rules, besides having different rates for each type of card (individual or corporate). We call this interchange fee.
Stone must calculate the amounts to be paid on a monthly basis based on all transactions in the period and transfer the amounts to each entity.
For every request to change a card company's rule or fee, Stone should change the system in order to calculate the amount to be paid.
Stone would like to disengage the engine from the authorizer service and that all dynamic rules occured quickly and easily, without the need to perform any deployments. Besides that, the service should start running in real time, without creating batches of processing, so that metrics could be obtained in real time.
Challenge: CREATE A ROBUST MICRO SERVICE OF INTERCHANGE CALCULATION THAT WOULD BE ABLE TO MEET ALL TRANSACTIONS CARRIED OUT BY STONE.
CREATION OF MICROSERVICE
At first, we understood the microservices model used at Stone. We analyzed points that could be improved and followed up with what was appropriate.
We created a microservice following all good development practices, using centralized logging services, auditing, Kubernetes cluster, CI/CD etc., services that were already being used well at Stone.
DEVELOPING A TEST SUITE
We believe that the main development technique which guarantees the quality of the system in the long run is the development of a strong suite of automated tests and that this suite constantly evolves with coding. In this project we carried out three layer tests, unit tests, integration and End to End with a total of more than 80% of the project's coverage.
FRAUD RISK ANALYSIS
Before putting it into production, we performed several load tests, reaching up to 1k requests per second.
With the microservice finalized, we put them into production in parallel with the old service, confronting the calculation of both. First, we compared the operation with the old service, identified the correct one and the business rules were validated.
- .Net Core - Memory Cache - PostgreSQL - Redis - Azure Devops
We put the first card company in production and the customer was very satisfied with the result. We were assertive in the "cents". After the validation of the first company, we put other companies on the air and we are already going to the third.