Cards, "Three", payments

    I had the opportunity, and my experience suggests that if there is an opportunity, it is better to use it, since it is.
    Lock, Stock and Two Smoking Barrels


    About how we created a network of payment terminals, Habr already knows - we wrote about this last summer . Today we decided to tell what is inside the terminals, next to the terminals and around them. And there is no intrigue that is inside - inside each MegaFon payment terminal there is a computer and peripherals. But when at one point quite a lot of factors converge that need to be linked into a workable system, then there are sophisticated actions worthy of the attention of Guy Ritchie.



    About the characteristics of the built-in terminal computer has also been written. Recall that this is a fairly productive system running Windows Embedded Standard 7

    • Processor: Intel Original LGA-1155 Pentium G2130 (3 GHz)
    • Motherboard: Asus P8B75-M Soc-1155 iB75 DDR3 mATX AC`97 8ch GbLAN SATA3 VGA + DVI + HDMI
    • RAM: DDR3 2048Mb 1333MHz Crucial (ST25664BA1339)
    • Video card: Palit PCI-E NV GF210 512Mb 32bit (TC) DDR3 625/589

    In the last topic, habruzers suggested making a bitcoin mining farm on them, but we did not try .

    The computer is packaged in a specially designed outdoor chassis with two monitors:



    The case is sturdy, vandal resistant, but not designed for outdoor use. It was not intended for all street trials and works only indoors. Two monitors are needed solely for marketing purposes: firstly, to distinguish them from other terminals, and secondly, an advertisement is played on an additional large screen, which again attracts attention, and, of course, generates income from scrollable videos.

    When designing the hardware-software complex of the terminals, we realized that they would be updated “on-the-air” - on the fly, without specialists leaving the place, from the “center”. Moreover, now not only the operating system proper is updated, but also the firmware of the complex’s devices - bill acceptors, for example. The introduction of a new function, a monitoring system, financial reporting - any changes are made simultaneously to the entire network. And protection against fraudulent activities is also increasing.

    Scene: Lobby


    The theater begins with a hanger, a movie with a cry of "Motor!", And payment terminals begin with a bill acceptor.

    Our system is equipped with the CashCode validator (we won’t be able to name the exact model) of the well-known Canadian company Crane Payment Innovation (CPI). It is alleged that CPI in the Russian market takes a leading place and more than 200 thousand devices have already been sold.

    Correct recognition of banknotes is a very important, one might say, key function of a payment terminal. Despite the fact that credit cards are becoming more prevalent, Russians still prefer to use cash. The Central Bank of the Russian Federation regularly publishes statistics on cash turnover , and, as can be seen from the graph, the amount of money, at least, does not decrease:



    Some may be interested in the principle of the bill acceptor - how does a machine distinguish real money from paper? We answer: quite simply - with sensors. But, of course, the equipment does not deal with pattern recognition in order to read the face value of each individual bill - everything is much simpler. Banknotes of various denominations differ, firstly, in size and weight, and secondly, in special marks visible in infrared or ultraviolet light, and thirdly, there are magnetic marks on the notes. The process and algorithms for rejecting banknotes are quite interesting (for example, you can read about the machine-readable features of various banknotes on the website of the Central Bank of the Russian Federation ) or even look, but this is not the purpose of our story - we can only say that the validators used in our terminals recognize almost all fake banknotes. But between the fraudsters and the “coin houses” there is a long, never-ending war, like a “shield and sword” and with varying success. We are not lagging behind the new products, and our devices quickly receive new data for their recognition, although scammers use rather sophisticated fake methods. For example, for some time there was such a way to turn one five-thousandth bill into two:



    We believe that the reliability of bill acceptors used in terminals is sufficient for industrial operation.

    This is how the bill validator scheme looks from the device supplier’s website:



    The “cash reception” complex, it should be noted, includes not only the bill validator, but also the very necessary and useful devices attached to it - a stacker (sorter and stacker of notes) and, of course, a special safe where the accumulated money is stored.

    But it would be naive to believe that the villains will confine themselves to fake banknotes - there are many more ways to deceive automatic money receivers, which are not accepted in the media. For example, the so-called "fishing" (abroad it is also called fishing) is a fraudulent way to deceive the automation of a cash receiver, the essence of which is to pull a read bill back for a pre-attached fishing line-leash. The fraud process is very similar to fishing. Here is a bill prepared for fishing and not having passed this operation:



    And they fight it in the same way - hooking. Moreover, there are several options for the fight - rough “iron”, when special combs with sharp edges are built into the path of the bill, which mechanically cut unauthorized modifications of treasury bills. The manufacturer does not provide such improvements.

    Another way is more civilized: an attempt to pull out a bill after reading it is fixed by a special sensor, and the automation sends an amplified impulse to the roller engine - all kinds of “leashes” simply breaks off, while the bill is not taken into account in the amount of credited funds. In addition, the banknote itself also fits into the reader in a special way, excluding its removal - note that the validator is pulled down. The bill first stretches forward, and then at an acute angle - down. Pulling it back will be difficult.

    Scene "Bar"


    Guy Ritchie's heroes not only steal (not in the most efficient way, actually), but also cheat on taxes. MegaFon terminals are very law-abiding in this respect - a fiscal check is issued to the user for each operation. Checks are printed on a special thermal printer, and all operations are recorded on the fiscal registrar. Printer brand: VKP-80II, and fiscal registrar - PayVKP-80K.

    In fact, this is a fairly simple device, which, however, can be talked about for quite some time:



    But the device is quite famous and widespread. More interesting are the rules for working with fiscal checks accepted in our company. MegaFon reports on each transaction, each payment, and all operations are recorded in EKLZ (stands for Electronic Control Tape Protected) - a special “black box” registered by the Federal Tax Service that is installed in each terminal and records all operations without the possibility of changing them, which provides a reliable mechanism for reporting.

    Firstly, a check is an official document with which you can report, for example, in accounting. Therefore, in the event that a ribbon has ended in a particular terminal, it stops accepting payments.

    Secondly, in the event of a failure or mistake (have you ever been mistaken when entering the phone number?), The check serves as a document that will be reconciled and all problems resolved - the check is the primary document. Therefore, each check contains a unique number for each transaction, by which it will be possible to resolve misunderstandings that may occur.

    Thirdly, on the check there are contact numbers of technical support services, where the user will be helped with resolving payment problems.

    And fourthly, we enforce all the laws of the Russian Federation related to the reception of cash. Today there are still payment terminals that do not provide fiscal checks, which is a violation of the federal law of May 222003 N 54-ФЗ “On the use of cash registers when making cash settlements and (or) settlements using payment cards”. We honor laws and comply with all their requirements.

    Of course, the terminal device is not limited to the printer and bill acceptor. The terminal also contains an autonomous power source, which, according to the standards, supports the operation of the device for at least four hours. There is a communication module in addition to the standard Ethernet - GSM / GPRS-modem, there is a small keyboard for entering digital data (pin-pad).

    But we are approaching the denouement.

    Scene: "Shooting"



    Edd has been playing cards since he was able to raise the deck. He soon discovered that he had a huge advantage. It’s not that he is a good player and not that he thinks well when playing, the fact is that he perfectly monitors people's reactions, no matter how they hide them, but everyone has reactions, especially when it comes to money .
    Lock, Stock and Two Smoking Barrels


    There are a lot of payment system terminals. They are different and from different operators. The difference of the MegaFon terminal network is that in addition to simple payments in cash to the telecom operator (by the way, we accept payments for other operators and without commission), or for payment of other services, our terminals are able to work with public toll cards transport. You can replenish the balance of the Troika transport card for travel on public transport in Moscow and the Moscow Region.

    There are two options for replenishing the Troika card, which can conditionally be called “direct” and “remote” replenishment. Both options are available at MegaFon terminals.

    Direct recharge


    Top-up “Three” is very simple: 1. either enter the card number in the terminal, 2. or bring the card to the reader of the terminal, deposit money and voila! - you can go about your business.

    Just in words, but difficult inside: to interact with transport cards, NFC ( Near field communication ) technology is used .

    The principle of operation of contactless RFID cards, which are Troika cards, is as follows:



    The Reader creates an alternating magnetic field of a given frequency. The circuit of the card, brought to the reader, tuned to the resonance, creates an EMF and a current appears in the circuit. This current is rectified by the diode and accumulated by capacitor C2. The energy stored on capacitor C2 is used to power the chip, which contains a microprocessor and memory.

    Energy, it must be said, is enough to light up a simple LED: The



    oscillating circuit, which consists of the capacitor C1 and the antenna inductance, is controlled by a field-effect transistor, to the gate of which the chip transmits control pulses. But unlike the reader, the card does not have enough power to create a response electromotive force, which the reader could catch. Therefore, the field-effect transistor simply “slows down” the oscillatory circuit, and the reader receives information as a result of an increase in losses in its own active oscillatory circuit.

    The subtlety of working with such cards is that the memory of the card chip is very limited - the used Mifare Classic (or Mifare Plus) cards have only 7 bytes for an unchanging unique card code and another 1 or 4 KB (depending on the type of card) custom and card configuration data. For protection, the proprietary Crypto-1 encryption algorithm is used , which turned out to be too simple and poorly protected from fake. Experiments on the security of Troika cards have already been described by the Harazhitelami.

    As a result, the protection of the entire system was carried out at several levels, and above all, in organizational measures and with the help of permanent monitoring of the use of cards.

    Therefore, the replenishment of Troika through the MegaFon payment terminal occurs according to a special algorithm that takes into account security requirements.

    So, the card contains a unique crypto identifier and a memory bank, which can contain the number of tickets and / or the amount of money. Only numerical indicators are stored on the map, and the information itself is contained on the servers of the transport system. Therefore, replenishment of the card occurs only online, and so far, only the balance can be replenished from the terminal. Tickets will still have to go to the ticket offices of the Moscow Metro. But we are working with the Metro to expand the capabilities of the service.

    To replenish the balance of Troika, the user applies the card to the NFC reader and the terminal receives the card indicators.



    Next, the terminal itself is authorized on the transport system server, and a specific card is authenticated. The response contains the following information:

    Amount of cash on the card
    Number of trips
    Permission to record a specific card
    Maximum amount to be recorded.

    The first two points are clear and simple, but the third and fourth need to be clarified. “Permission to write” is connected with the fight against fraud. If a particular card is simply suspected of fraud, it is immediately blocked. Now it is impossible to write any information on it - the system blocks. A special check is printed out for the user (remember about the printer?), Which must be addressed to the Metro ticket office using the relevant details. There are a lot of reasons for blocking, for example, cloning, which is calculated by trying to reuse the card faster than the system installed, or if the user moves around the city too quickly, according to the system, some of them were discussed in the article that we quoted earlier. Enough "unusual behavior" and the system can put your card in the "black list".

    The maximum amount of the record is the limit for replenishment of the card. Currently, it is set at 3,000 rubles for all cards - the system will not allow you to record a large amount.

    After all the information about a specific card has been received by the terminal, the following occurs:

    The interface displays the amount that can be accepted on the card (not exceeding the limit).
    The user enters the recharge amount.
    The amount to be credited, plus, the agreed amount already on the card is sent to the Metro server.
    The Troika system answers the terminal with the approval of the transaction and sends a bitmap, which must be written to the card's memory.
    In case of an error (for example, the card was removed before the bitmap recording process is completed) - the terminal displays an error check. Unfortunately, the error can be corrected only in passenger agencies e.

    Remote recharge



    The “Three” card can be replenished remotely. No, this does not mean that you don’t have to go to the terminal at all - to be able to work offline when making payments in public transport, where there is no permanent connection with the Metro transport system, you need to write the bitmap of the “electronic ticket” to the card’s memory. And this can only be done by physically bringing the card to the reader. But money can be transferred to a card account using modern telecommunication means - via SMS or using popular payment systems.

    The principle of “remote replenishment” is as follows: we transfer money to the Troika virtual account in the Metro system, and write the recharge to the card later, when visiting the Metro or in the MegaFon salon on the way to the bus stop.

    You can top up the card through the web interface on the Troika website .

    And in order to replenish Troika from the personal account of a mobile subscriber, you need to send an SMS to 3116 with the text:

    troika <card number> <recharge amount>

    This process looks like on your phone:

    1. Send the card number and the amount of troika ... "



    2. In response, an SMS with a variable code comes in, which must be confirmed in a response message. This was done in order to protect your money from accidental debiting:



    3. After a short time, an SMS arrives with a message that the payment has been made:



    Money will be debited from the MegaFon subscriber’s personal account and will be credited to the Troika system without commission.

    4. The final stage - we approach the MegaFon terminal or the Metro information terminal, and write the generated bitmap to the card. No additional information is required - the system already knows the unique card number and the amount to be credited.

    Our terminal:



    Moscow Metro:



    So far, the terminal remains the most familiar replenishment method that you can use without going down the subway, for example, on the way to the bus or tram stop, which makes using Troika much more accessible.

    By the way, our terminals are installed in almost every MegaFon salon. You can find the nearest salon on the map or by requesting a list using the USSD command * 123 #



    The final scene "Apartment after disassembly"


    Not all peripheral devices that are available inside the MegaFon payment terminal are listed. So far we have not told you about how we plan to use NFC to communicate with mobile phones and you can use a barcode scanner.

    We will talk about them a little later in our hublog.


    Also popular now: