preface

I haven’t sent a document for a long time, because the company has an urgent project to catch up with the schedule. Overtime work, such as eating and drinking water, has been in the state of code farming for a long time. The reason why I take time out to send this article is that the project has just been launched, but a new colleague’s code caused an accident in the production environment, resulting in a batch of short payments, which almost made the whole team’s efforts in this period of time in vain. Therefore, in line with the principle of a good person’s life and safety, I still take time out of my busy schedule to record the accident in the form of an article, hoping to do payment related functions of peers can take it as a reference.


after

1. Wrapping your resume is not wrong

As we all know, every year to this time is a company personnel changes the most frequent time, some are to take the year-end bonus leave, some people are riding a donkey to see the book, find the next home and then leave, anyway, this time is the legend of the gold three silver four. If the company has an urgent project at this time, it must be a period when you and I are suffering and everyone is suffering together. Therefore, in order to cope with this situation, the personnel department is under great pressure to recruit, but it may not be able to find the right one. Our company hired a new colleague after the New Year, who was recruited specially for this urgent project. I have read the resume and have three years of working experience, familiar with Java, SpringBoot, SpringCloud, SpringCloudAlibaba, docker and K8S. I can use front-end VUE and UNIAPP, have experience in wechat small program development, and am familiar with wechat Pay and Alipay payment development. In fact, the front familiar with Java, Springboot, SpringCloud and so on, we have not met the interview not to write, basically not serious, after the docker, K8S is just an addition, because no one to the company will let the development colleagues to operate, can point the front-end vue is a plus. The most important thing is the last sentence, familiar with the development of wechat Pay and Alipay payment, which hit the soft side of hr, because the supervisor specially told HR to give priority to the payment function, so HR strongly recommended to the supervisor after calling to know about it. Competent look after sent to me see, we actually have several in my heart, this resume the project inside a see be packaged, because everyone is so come over, write the 3 years of experience, but most only 1 year or 2 years, can occasionally encountered inexperienced but blind to write for 3 years, for small and medium-sized companies, the interviewer packaging resume is not a problem, important is they can work. One day, the supervisor asked me to interview this colleague together, which was very good. We asked basic questions about the technologies written in his project, and we could basically answer the main questions. The supervisor was also satisfied with them and told the hr department to let him work after the interview.


Can work may not work

New colleagues to a induction week, after simple training, will immediately into the emergency project, but this is a new project, do not need extra familiar with existing business, he began after the product review assignment work, because the personnel changes caused by the backlog of work, I and another colleague have employee handover work on hand, need daily maintenance of old projects, And participate in new project development at the same time, some not, director of considering this, the new project WeChat pay related functions to a new colleague, because he did write this part will resume, and even I think he is obviously at the interview will be, and done behind proved just he cooked well… From the beginning of the project, I found that he could do a lot of things, but there were more problems. For example, git tools can only pull and push, and I didn’t know how to solve code conflicts, which suddenly lowered his level in my mind created by the interview. Or he likes to use try.. Catch, we add it to every interface, we don’t know that we have unified exception management, we add e.printStackTrace() to catch, Log. Error (” XXXX :{}”, LLDB etMessage()) : = LLDB () : = LLDB () : = LLDB (); And he said, “Can you print things like that?” At this time, I was already covered with a haze, and also found that he seemed to be a little dissatisfied with my repeated visits to him. Most of the time when you are busy, you are not the leader. You don’t want to take care of yourself. I am too lazy to take care of him any more. It turned out that my mentality was also one of the hidden dangers. The results of team development were decided by all of us together.


The accident comes like a tornado

Wait until the project into the test phase, test out many bugs, but overall is good, after the new colleague responsible for the part of the also passed the test, I thought he actually very capable, paying for the business still has a lot of pain points, he can finish it alone is not easy, although your resume packaged can work still can be. After the project was launched, we all breathed a sigh of relief. After all, it was an urgent project, which also involved the strategic planning of the company this year. The completion of the project was a relief for our old colleague and a proof of self-worth for our new colleague. How can you say that sentence, is a blessing not a curse, a curse to hide, however, this year a snake person is said to have committed tai sui, just started this year, I was shot in the indirectly, project launched less than a month, one day morning client suddenly appeared a large number of brief paragraph, a direct loss of nearly one hundred thousand yuan, but stagnation point personnel is more, we also have put on record, emergency After receiving the notice, I immediately turned off the switch and waited until the peak period passed before turning on the switch to continue to run, otherwise it is likely to continue to cause greater losses. Fortunately, the rest of the afternoon was calm and there was no further problem. We immediately judged that it was caused by the peak traffic in the morning according to our experience. After checking the logs, it was found that a large number of business confirmation failures occurred in the callback of wechat refund, resulting in a large number of short payments. As to analyze and solve the process in the back analysis section will show that here mention a mouth, a new colleague know this problem is caused by yourself after all white, when he spoke not neatly, have also been other colleagues complain a few words, like less poor, looking at let a person sad, accident treatment after he left to go. I can feel the accident of his entire programmer life is a big blow, also look for before he left he said some words of comfort, such as the code snippet after correction also sent him as a reference, I this person comparison softhearted, hide to get along with colleagues so sad for a period of time, still pushing him to familiar with the old company personnel, help him to find a new job, There’s only so much I can do. Finally recovered the loss about 670 thousand at customer side, there are 8 after don’t come back, because is short, the somebody else not refund you didn’t also way, it is still in our stagnation point personnel response in a timely manner, otherwise may this year and the client’s business to yellow, company later when the cause of the accident, also not say we written code has a problem, It was all attributed to the timeout of the call business confirmation interface, and the amount not recovered was compensated. The most important reason was that the relationship between the leadership was very hard, so the disaster was passed.


Analysis of the

As mentioned above, after checking the logs, it was found that a large number of business confirmation failures occurred in the callback after the successful refund of wechat, resulting in a large number of short payments. So a lot of little apes wonder what I mean by that. Here is the necessary process in the development of wechat Pay and other payment functions:

Payment: Create business order –> Create payment order –> Wake up payment cashier –> Input password or fingerprint payment –> Enter payment callback processing –> Change payment status and business status refund: Create a refund order –> initiate a refund –> Enter the refund callback process –> Change payment status and business status

The main process is like this, and there are some details. Here, we focus on the callback processing for this accident. When a payment is completed, wechat will send to our callback interface for the final business processing. But if your project is not the company has its own products, but to the customer, involving customer own a business system, then it is likely to need in the callback to call customer business confirmation interface provided by the system, simply put, is the payment completed or are you going to tell the customer system failed to make the business system to do some own logic to handle.

I take the business of the accident project as an example. The premise of the payment link of the customer system is to take the number from the number source pool, and the number must be returned or sold when the refund is made. Here is not just a simple implementation of wechat payment, but an important business logic implementation.

We can think about, we in the end is to take the number and then pay or pay and then take the number, the same, when the refund we want to refund first and then retreat number, or retreat number and then refund?

I believe that if you are not often engaged in payment related business, you will definitely make mistakes without experience. Here is the problem our new colleague made:

In the case of a refund, his code logic says refund first and then refund number, during peak traffic, because try… Catch wrote in a refund, when the result of unexpected exception happens, just start automatically refund, die die of client business system also has a problem, eventually leading to refund execution is successful, call client business system back number confirmation interface when they fail, the result is the money back to the user first, number didn’t return (people alive, money didn’t), This is a short payment in the client’s business system.

What is the normal logic, I take this case to comb out the next clear:

1) When making payment, the payment must be completed first, and then the business of the business system shall be processed. For example, here is to pay first and then take the number, the advantage is that, under normal circumstances, nothing, abnormal circumstances or payment failure does not follow up, or pay success but the subsequent take number failure, so that your service customer side did not lose, the loss is the user, because the user has paid, this is a long sum of money, The customer only needs to review the user response and refund the user. On the contrary, if you write backwards, one of the consequences is that the user took the number first, but the payment failed, the user can still take the number to use, which is a loss to the customer, the money did not receive the number can also be used.

2) When refunding, it is necessary to complete business confirmation before performing the refund. For example, here is the first retreat number, and then refund, so either retreat number failure will not go down, or retreat number success, but refund failure, loss is still the user’s money, the customer how did not lose, the formation of a long sum of money, review after the confirmation of no problem to refund to the user. On the contrary, if you write the wrong, the consequences is to get a refund, but failed to confirm back, client number hasn’t come back, but the money has been into the user account, the client lost, also have to find the user come back, if the user doesn’t give you didn’t also way, because it is your own mistakes, it’s a way to describe a serious accident.

The logic of case analysis is not only applicable here, but also applicable in other scenarios. You can take a look and carefully figure out the development of any function that deals with money. It is not difficult to realize the payment function at all. No matter what your business logic says, as long as the customers you serve do not lose money under normal and abnormal circumstances, then your payment logic is correct.


conclusion

Now there are many new technologies, learning tired not to say, but also volume, I sincerely give you a bit of advice: 1), reduce the pathological pursuit for hot popular technology, focused to a solid basic skills, after entering the company need to use the development tools, development process, standard code, and so on more learning, because even if you put the distributed technology again, these tools are not familiar with building a house, it is easy to be wise hands and feet; 2), the first thing to enter the company, familiar with the business scene, which is often the foundation of your future in the company, the longer you work, the more you will understand; 3) Do not over-package your resume. There is nothing wrong with over-packaging. Many people do this to make a living, but over-packaging will bring hidden dangers. It is best not to involve in the introduction of payment in the resume, can be said to have participated in, but can not form a highlight, because money related skills are not simple, more on the resume of the project to polish more effective.


Pure hand dozen, feel to have a drop to help, trouble point praise or collect ~~~~~~ can also pay attention to me, I focus on the fun in sharing work and actual combat experience oh ~~~~~~~~