当前位置:网站首页>Reflection on a case of bus card being stolen and swiped

Reflection on a case of bus card being stolen and swiped

2020-11-07 20:37:35 Poet stepping on the knife

Demand cause

It was a sunny morning , The writer is carrying a handsome backpack as usual , Comb your hair like an adult , Put on a smart suit and go to the bus stop , On the way to work , Good luck. , The bus will arrive soon , After brushing the bus code, I got involved in the sea of people with the help of external forces, waiting for the next time for external forces to help me get off .

The morning is always fast , After lunch, I was preparing to lie on the table for lunch break when I received a wechat push fee deduction notice .

Received this kind of inexplicable deduction notice , My first feeling was that the number was stolen , Who stole my bus code ?

But the next second , A programmer's intuition tells himself that developers should not make such low-level mistakes , Bus code is equivalent to payment bar code to some extent , How can we not refresh , I personally tested it. It's really dynamic .

What's the reason for that ? Next, let's invite the protagonist of today “ Enjoy before pay ”, I believe that reading the whole content is very good to explain the previous “ Steal brush ” Problem. .

Concept

Enjoy first, pay later, literally means to enjoy the service first and then pay , Great for the user experience , At the end of the service, you don't have to worry about paying , The deduction is made automatically by the system , Especially for some high-frequency scenarios , Like sharing a bike , Subway, bus, etc .

Use scenarios

1. Transportation : Drop taxi , Sharing bicycles, etc , After the user gets off the car, the system will pay automatically , Save user time ;

2. The new retail : Some smart containers , When you close the door after you select the goods, the system will make deduction , I used it before e Smart containers at home , Very good experience ;

3. Network limited environment : For example, when the bus passes through some sections with bad network , Unable to deduct fees in real time , But we can't delay passengers , This situation is very suitable for saving offline orders in the internal card machine , When the network is good, send the order data to the server, and the system will make up for it ( This is the reason for the delay in bus fare deduction mentioned above , Morning should be the network is not good, did not synchronize the order up );

Usage flow

The author's city can use wechat bus code for payment when taking subway or bus , You need to open it before using it , The opening process is as follows :

step 1: Open the car code applet , The first time will prompt to open

step 2: Click on “ Go to open ", This will bring you to a guide page , Check the agreement and click “ Open now ”

step 3: And then it comes to “ Open secret free payment ”, Click on “ Open secret free payment ” It means the opening process is over


At this time, your bus code has been opened , It means you can use it to take the subway 、 It's a bus , Here is a flow chart to understand the overall process .

emphasis

There are several core points in the whole process that deserve attention :

1. Open secret free payment means that the user does not need to enter a password when paying , Automatically deducted by the system , What kind of deduction does the system use ? The author looked through the relevant documents , Wechat is called entrusted withholding agreement id, Alipay is called the withholding agreement ;

2. The bus swipe card machine needs to save the offline order , When the equipment is disconnected from the network, there will be local , After networking, it will be sent to the cloud for compensation ;

3. Travel code needs to support offline payment , When the user's mobile phone is disconnected, it will not affect the user's ride ;

4. There needs to be a recovery mechanism , After the user takes the car, when the background of the card machine has not been deducted, the user has turned off the secret free payment , It means that the previous order cannot be deducted , As shown in the figure below, users close secret free payment in wechat .

Process refinement

Users sign up for secret free payment


       User signing process

User ride

Here are two key points to highlight :

1. When the user opens the ride code applet , According to the user's mobile phone network status, the applet decides different generation strategies of the car code , If there is a network, call the back-end service to get the ride code , If there is no network, it will be generated locally , I guess the rule of code generation is qrCode=encrypt(" user id, Time stamps, etc ”, encryption key), If there is no network, the last encryption of local cache will be used key, Otherwise, the server will update the encryption dynamically key;

2. After the user swipes the card , Machines will first generate local orders , If there is a network, the local order will be sent to the background service , The purpose of sending here is to prompt the user to “ Successful ride ”, Here's the picture 3.1,3.2 Shown ;

       User swipe card process

Bus code backstage deduction

1. Background pull order to be deducted ;

2. Query user withholding agreement id, If the user has terminated the contract, mark the order as payment failure and insert the arrearage record to prepare for the next recovery ;

3. If the user does not terminate the contract , Call wechat secret free payment interface , If the payment is successful, the order will be marked as paid successfully , If the payment fails, mark the order as payment failure and insert the arrears record to prepare for the next recovery ( The handling here is a little rough , If the user's balance is insufficient, the background can delay the retrying , Until the maximum number of retries , Here, for example, simplify the processing );

       Background deduction process

To pursue - Remind users to pay back

When the user is in arrears, the backstage uses the platform ( WeChat , Alipay ) Provides the ability to remind users to repay , Delete the user's arrearage record after the user has paid back , If the user continues to use the service without repayment , The next process will introduce .

       Remind users to pay back
 

       Arrears record

To pursue - Limit the use of the service by defaulting users


       Restrict the use of services
 

       Restrict the use of service interactions

summary

“ Enjoy before pay ” As a more popular way of consumption now , It does bring us a lot of convenience , But the emergence of everything is bound to have advantages and disadvantages , I'd like to briefly talk about my understanding here .

advantage :

1. It's really convenient for individuals , After using the service, you don't have to pay for it , Automatically deducted by the system , Good user experience ;

2. For businesses, it reduces the settlement cycle , Avoid some situations where you need to make a collection ( The author used to call an online car appointment and forgot to pay , I've received the driver's payment call );

shortcoming :

1. For individuals , At the same time, it also brings some risks , It's like giving your payment password to someone else ;

2. For businesses, they may face certain asset losses , After all, there are so many Laolai in the society ;

版权声明
本文为[Poet stepping on the knife]所创,转载请带上原文链接,感谢