Analysis, study and summary of a third-party payment platform database

   I have been engaged in the development of general WEB systems before, and have done a lot of projects. Now one of the main tasks I do is to communicate with customers, design a data model, and design the main functional pages.
   I have never done financial business, so I found the database structure of a third-party payment platform from Baidu Wenku, analyzed it, and summarized it in plain language to master the business design of the financial system.

   The address of Baidu Wenku is: http://wenku.baidu.com/view/48f79722964bcf84b9d57bf1 1.

   Basic platform core library
   1. Account: First of all, both individuals and enterprises have an account table on your platform, which is required. Record the basic information of the bookkeeping, think about the information on your bank checking book. Of course, there are 5 amounts to be noted, total, withdrawable, frozen.... But there are a few fields that I don't understand, such as calculating the cumulative amount, the total amount of the previous period, and so on. Yes, I have never noticed how the bank's current demand calculates the interest. The interest rate is changing, the amount is changing, how is it calculated? I checked the
   bank's quarterly interest settlement, and the 20th of the last month of each quarter is the interest settlement date.
   Each change is calculated in head * duration of days = calculated product, of course, it starts from the total amount of the previous period.
   The quarterly interest is the cumulative number * the daily interest rate of the interest accrual date (annual interest/360, not 365 because of bank regulations)
   There is also a security control value on the table, which is MD5+BASE64, which is the hash value to prevent important data from changing. , summary information. BASE64 means that all characters become basic, which is understandable.
   This, this table understands clearly! ! !

   2. Freeze and cancel the running water meter: There is nothing to talk about, it is the same information as the log of this operation on an account.

   3. The flow and frozen flow table of account capital changes: similar to the records of each deposit and withdrawal, of course, there are many types of changes. Record the total amount before and after each change, etc. In particular, note that there is an associated pipeline ID. For example, when we recharge, the total amount has changed, but how is it recharged, which bank card was recharged, whether it was successful, etc. The detailed information is not in this table, but it is recorded in the recharge transaction flow table that follows.
     It seems that there will be a lot of redundancy, but the design is correct, the recording angle is different, the specific situation of each change is of course very important, but the account angle focuses on the total amount change.

   4. Transaction flow related table: The 9 tables here are the detailed information of 9 kinds of transactions, and each transaction will be recorded in the relevant table. The details will be added later if necessary.

   5. Accounting: When it comes to accounting, maybe we don't know much about software, and it feels a bit professional. I haven't learned it, but we can also master the basic business by analyzing these tables.
    Let’s talk about the last two tables first: subject details and certificate details. This name can be known as the information of a specific business.
(There are remarks behind: For each specific business, only operate the voucher table and set up business associations. Then automatically register 2 accounts and 2 amounts to the account details table. At the end of the day, summarize the account details table to the account journal table.)
    It is more clear that only the voucher is operated in the business, and the voucher will be associated with the ID of the transaction flow. For example, for a change of funds, an increase and a decrease for both parties of the transaction will inevitably record the changes in the two subjects of the industry and record them in the subject schedule.
    Other account types, voucher types, and correspondence between account vouchers can be considered as maintained dictionary items. Subjects are understood from the name as a way of classification. Credentials are understood to be documents such as credentials and certificates. It just so happens that I have the receipts for withdrawing money a few days ago: the general receipts of the Postal Savings Bank of China, which are usually printed out and signed for the customer. There may be several copies, and everyone keeps a copy. Because there must be paper evidence with manual signatures, it is not realistic to have it all electronic.
    As for the subject journal: it is the statistics of the subjects generated every day, why every day? This is a requirement.
    As for the trial balance sheet: it is the comparison of account changes and account changes in two different dimensions. The data from the two perspectives should be consistent, and it should be a balance of data from different recording methods generated by the same transaction. Only with comparison can problems be found in time, so it should be a standard practice. Financial platforms have no room for sloppiness.

    6. System parameters: here is the pure number that records the serial number of each water meter, which is continuously accumulated on the day. Because the day starts from the beginning, Oracle's seq cannot be used, so I won't talk much.

    7. Channel: In name, this channel is a channel for each transaction. What does it mean specifically? I found that in the latter 3.11, there are channel types and channel management, for example, there are 5 types of online banking, intra-city, and bank-enterprise. The more important table is: the channel management table, the important fields in it are "the merchant number assigned to the platform by the payment channel", as well as the URL, IP, queue, class name and other information.
    There is also a channel account correspondence table at the back. The channel and the transaction type share the same PK, and there is an account number. Then the channel is the merchant number of this platform on other platforms such as other banks. My platform is a merchant of a certain bank. And you can open several accounts. Similar to how I am a customer of a certain bank, I have several bank accounts, debit cards, credit cards, etc. I can open several credit cards before. For the platform, the account opened is related to the type of transaction.
    Continue to check some information on the Internet [zhihu]:
"The bank interface refers to the technical interface provided by the bank, etc. The
bank channel is the encapsulation of the bank interface, and includes detailed information such as specific cooperative banks and channels. For example, the same A certain payment interface of a commercial bank, not total to total, the payment company may access at the Beijing branch and Shanghai branch at the same time.
The payment channel is a business encapsulation of the bank channel, including channel costs, minimum merchant rates and other information.
Payment products are products provided by third-party payment, such as express payment.
The design of payment channel routing generally adopts a rule engine or similar scheme (for example, based on groovy). If it simply meets the current business needs of the enterprise, the ugliest If-Else method can also be used. "
    Find some more information: Reserve funds are
    also known as precipitation funds or reserves. Third-party payment reserves refer to reserves that exist on third-party payment platforms and are reserved in banks for upcoming payment transactions. Buyers pay to Confirming the receipt of goods and the seller's collection are always separated by several trading days, and the funds "precipitated" in the accounts of third-party payment institutions are "reserve funds". Later, it was found that there can only be one regulatory bank for the reserve funds. For a cooperative bank, it seems that the policy is still being fine-tuned, because for the safety of the reserve fund. The reserve fund is divided into custody (inter-bank), collection and payment (within the same bank), and remittance (summarize, clear 0 every day, go to Payment account) account, bank channel routing system is one of the core systems of all third-party payment.
   (Here is https://www.zhihu.com/question/34352468, the explanation of gray cells is clear)
    For example, Xiaoming is fancy on the Internet I purchased a product and used Alipay for payment. When using Alipay to pay, I chose Xiaoming's China Merchants Bank card. After the payment is successful, Xiaoming's China Merchants Bank account will deduct the funds, and Alipay will tell the seller that the payment is successful. The seller ships the goods. On the next day, China Merchants Bank will settle the deducted funds of Xiaoming to Alipay. At this time, the money will be settled by the bank to the corporate account opened by Alipay in China Merchants Bank. Since Xiaoming has not confirmed the receipt of the goods , or the receipt may not be confirmed until a week later, then during this period, the money will stay in Alipay's corporate account. Its Alipay account number, it only needs to keep the account, it is all in the reserve fund, but if the consignee wants cash, it will be transferred from the result of the optimal routing plan to the other party's bank account, which is generally the same as the other party's. The payment account of the same bank is transferred to the account of the consignee, if the payment account of Alipay has a position.)

    Well, the channel concept is almost here. The process of some transactions is also very clear. Some other concepts, such as clearing, settlement, settlement, Settlement of Accounts, netting, and position position are also simple to know. English may be better understood.
    There are a lot of things written above, so let's really analyze the design of the table:
    The channel parameters and return codes of 252 and 253 are some configuration items, so I won't say much. 251 is a clearing instruction, which means initiating a clearing task for a channel, a record of the basic situation of payment sessions of a certain business in a channel, and the execution of an order, regardless of the amount. 254 is the channel transaction flow. Since it is a flow, it is the transaction information of each channel. Generally, it is closely related to the payment transaction flow. As long as it is not a transaction within the platform, it must deal with the channel. Anyway, the information is very complete. There are also many fields. 255 is the batch table of the channel for batch transactions, and there are many transactions in batch transactions. There is a settleDate in it that is actually called the netting date. Anyway, I pay attention to the naming problem. The accurate name can reduce the calculation in the brain, and can better consider more complicated things. The 257, 258 channel reconciliation table and the inequity detailed table refer to the reconciliation between the two sides of the channel, whether the loan is correct or not. The details are to find the inequity, which transaction to record, if it is a batch, record the next batch, which may have to be processed manually. In practice, I know that someone signed up for the marathon, and the payment was successful, but the website said it was unsuccessful, because the system was not done well. This can be regarded as a transaction, but it needs to be manually rolled back or corrected manually.
    2.5. (12.13.14) are the same-city reconciliation instructions, reconciliation table and reconciliation details. The PK in the instruction is the running water, that is, there is an instruction for each reconciliation. The reconciliation table and details have the number of pen and amount, and the difference can be seen from the PK. The reconciliation table corresponds to each reconciliation message, and there can be multiple messages in one day. There are more business numbers in the details, which means that the details are generated according to the business, not to every business. The download response and response details of 15/16 seem to be for companies to check the situation in one day, the general and detailed situation. It should not be complicated, and there is no need to study it without data and page descriptions.

   (Writing here, the network at home has crashed, and I am already writing the fund. The ITEYE page is refreshed, but it is not submitted in the background, and the automatically saved content has not been restored. I faint... In addition, I will return to the viewing page after saving, generally it should Continue editing, or use different buttons...)


   Second, the system maintenance, permissions, etc. of the system management database
   are not much different from the design of other platforms, so I won't study much.
   The key point is the account: the
   balance table of the settlement account, which is the amount of money in the settlement account of my platform in the accounts of each partner bank.
   Sub-account type, as mentioned earlier, platform customers can have multiple sub-accounts, and there may be mutual transfer if there are types. In addition, sub-accounts will be bound with the customer's bank card, then the customer's bank card information has a table, and there is a binding table; binding changes also have a flow table. The customer's bank account number is also verified, and there is a record for verification, and it may be verified multiple times a day, all recorded in a table.
   3.4.8 is to bind the collection account of the payment on behalf of the customer. According to the agreement with the platform, the platform will pay the water, electricity and coal to the relevant bank account of the utility company. There must be a record. Of course, a specific transaction is recorded separately.
   Customer information: This is the situation of customers on the platform. Of course, customers include individuals and enterprises. The article said whether to consider two separate tables, because the fields are quite different, it is also possible.
   Business information is also recorded.
   Other customer levels, opened services, related agreements, handling fees, quotas, etc. will not be discussed, it is relatively simple.
   Take a look at the three tables 3.11.7 (recording funds transfer instructions between Kuaipay settlement accounts) and 3.12.3/4. The settlement account is the payment account opened by the platform in each cooperative bank mentioned above, and the supervision account It is the reserve fund deposit account. When the position is insufficient, it will be transferred.
 
   3. Fund-related databases
   Let’s first look at a concept: redemption is the transfer from wealth management products or funds to your account balance. Withdrawal is to transfer the account balance to your bank card.
   Account opening information: Only fund sub-accounts can be opened on the fund business platform.
   Business table: Subscription, cancellation and redemption are three core businesses, so there are three related transaction tables, all of which are related to fund orders, indicating that it is the real fund purchase behavior.
   There is also a deposit and withdrawal transaction table, which is about the relationship between the sub-account and the bank account. It should only refer to the fund business sub-account. This has little to do with the operation of the fund itself.
   Fund transactions generally have a T+* problem, and the exchange closes at 15:00 on the same day.
  [The transfer of funds for redemption is T+2, that is to say, if you apply for redemption today (T day), after the market closes today (that is, tonight), the fund management company will count all redemption applications, and then pass the custodian. After the review, it will be reported to [Zhongdeng Company]; in the daytime tomorrow (T+1 day), after the gangsters of Zhongdeng Company go to work, they will count the purchase and redemption applications received on the previous day (T day), and then Post the funds, and to put it bluntly, give the money to whoever should give it, and give the fund share to whomever; and then wait for the day after tomorrow (T+2 day), if you redeem it, then the money will go to your account on this day; If you subscribe, the fund shares will go to your account. ]
   In fact, the fund side is relatively simple, the customer has a fund sub-account. Fund management companies can withdraw their own funds and cannot withdraw funds entrusted by clients for other purposes. The funds entrusted by customers are deposited in special accounts and can only be used for stock and bond trading. This is strictly regulated like the reserves of third-party payment companies.
   In addition, it refers to the instruction table, which shows the transaction instructions with the supervision bank, including the number of successful transactions, the successful amount and other information. Could it be that the subscription of the fund is directly transferred from the platform to the special custody account of the fund company in the supervision bank? This is not difficult, someone will tell you. I just checked by the way: the relationship between supervision, custody, and depository banks. There is a saying that supervision is a supervisory agency, and the depository guarantees the flow of funds between the client's information and the supervised account, and will not be misappropriated by the fund company.

    4. Summary:
    From a database design on the Internet, you can basically learn a lot of the above financial-related businesses and their relationships, and with some other articles on the Internet, you can almost understand the payment business. However, some articles see that there are many policy changes, which will inevitably affect the business system.
   
    Because I have never understood the relevant system before, there are inevitably mistakes and deficiencies in the analysis. Welcome to correct me! !

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326484108&siteId=291194637