A method and system for automatic payment test of a payment system
By encrypting and automatically delaying payment time in the payment system and using a delayed message queue to simulate the payment process, the problem of high payment testing costs is solved, and efficient and accurate payment testing is achieved.
Patent Information
- Application Number
- CN202410773390.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-06-17
AI Technical Summary
In the mobile internet industry, the payment testing process of aggregated payment systems requires a lot of funding and is difficult to simulate payments in different test scenarios within a specified time, resulting in insufficient testing efficiency and accuracy.
Automatic payment testing is achieved by encrypting the payment time in the HTTP request header and automatically simulating the payment process using a delayed message queue, including a payment request module, a payment information transmission module, a payment status modification module, and a payment notification module.
It reduces testing costs, improves testing efficiency and accuracy, and allows for flexible payment scheduling to meet the needs of various application users.
Smart Images

Figure CN118796680B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer communication technology, and in particular to a method and system for automatic payment testing of a payment system. Background Technology
[0002] In today's mobile internet industry, aggregated payment systems play a crucial role, providing common interface functions for multiple applications to facilitate payment integration. However, for applications with a wide variety of goods or high-priced items, testing this process may require substantial payment testing funding. Furthermore, different testing scenarios necessitate processing payments within specified timeframes to simulate various payment situations and ensure testing quality. Summary of the Invention
[0003] To overcome the above problems, the purpose of this invention is to provide a method for automatic payment testing of a payment system, which can automatically simulate payments, reduce payment testing costs, and improve the efficiency and accuracy of payment testing.
[0004] This invention is implemented using the following scheme: a method for automatic payment testing of a payment system, characterized in that the method includes the following steps:
[0005] Step 1: The tester sends the order amount and automatic delayed payment time to the payment system through the application system. The automatic delayed payment time is encrypted and sent to the HTTP request header as QA-Auto-Delay, and then an order request is sent to the payment system.
[0006] Step 2: After receiving the order request, the payment system generates a payment order number, requests the third-party payment interface with the received order amount to obtain the payment address, returns the payment address to the application system, and checks whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delay payment time, and sends the order number and delay time to the delay message queue.
[0007] Step 3: The automatic simulated payment system subscribes to the delayed message queue, obtains the order number from the received message, modifies the order data of this order number in the database to the paid status, and notifies the connected application system that the order has been paid.
[0008] Step 4: After the application system receives the payment notification, the tester confirms the application system's performance based on the payment details, and the test is complete.
[0009] Furthermore, the encryption method in step S1 is to perform DES symmetric encryption using the payment system agreement key.
[0010] Furthermore, step S2, "determining whether the HTTP request header contains QA-Auto-Delay, and if it does, decrypting it using the agreed key to obtain an automatic delayed payment time, and transmitting the order number and delay time to the delayed message queue," is further defined as follows: determining whether the HTTP request header contains QA-Auto-Delay; if not, skipping the step; if it does, decrypting it using the DES key to obtain the automatic delayed payment time, defining the automatic message queue name, then creating a message object, passing in the order number, calling the message sending method SendSync, and transmitting the order number and delay time message to the message queue.
[0011] Furthermore, the "judgment" in step S2 is further defined as obtaining the automatic delayed payment time through the Head["QA-Auto-Delay"] code; if it is empty, it means that the automatic delayed payment time does not exist.
[0012] 4. A system for automatic payment testing of a payment system, characterized in that: the system includes a payment request module, a payment information transmission module, a payment status modification module, and a payment notification module;
[0013] The request payment module: The tester sends the order amount and automatic delayed payment time to the payment system through the application system. The automatic delayed payment time is encrypted and sent to the QA-Auto-Delay header of the HTTP request to send an order request to the payment system.
[0014] The payment information transmission module: After receiving an order request, the payment system generates a payment order number, requests a third-party payment interface using the received order amount to obtain a payment address, returns the payment address to the application system, and determines whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delay payment time, and transmits the order number and delay time to the delay message queue.
[0015] The payment status modification module and the automatic simulated payment system subscribe to the delayed message queue, obtain the order number from the received message, modify the order data of this order number in the database to the paid status, and notify the connected application system that the order has been paid.
[0016] After receiving the payment notification, the tester confirms the application system's performance based on the payment details, and the test is complete.
[0017] Furthermore, the encryption method in the request payment module is DES symmetric encryption using the payment system's agreed key.
[0018] Furthermore, the "determining whether the HTTP request header contains QA-Auto-Delay, and if so, decrypting it using the agreed-upon key to obtain an automatic delayed payment time, and transmitting the order number and delay time to the delayed message queue" in the payment information transmission module is further defined as follows: determining whether the HTTP request header contains QA-Auto-Delay, skipping if not, and decrypting it using the DES key to obtain the automatic delayed payment time, defining the automatic message queue name, then creating a message object, passing in the order number, calling the message sending method SendSync, and transmitting the order number and delay time message to the message queue.
[0019] Furthermore, the "judgment" of the payment information transmission module is further defined as obtaining the automatic delayed payment time through the Head["QA-Auto-Delay"] code; if it is empty, it means that the delay does not exist.
[0020] The beneficial effects of this invention are as follows: This invention provides a method and system for automatic payment testing of a payment system, which can significantly reduce the payment testing expenses for testers by automatically simulating payments, and flexibly set payment times, which will help improve the efficiency and accuracy of payment testing and better meet the needs of various application parties. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the method flow of the present invention.
[0022] Figure 2 This is a system principle block diagram of the present invention. Detailed Implementation
[0023] The invention will now be further described with reference to the accompanying drawings.
[0024] Please see Figure 1 As shown, the present invention provides a method for automatic payment testing of a payment system, the method comprising the following steps:
[0025] Step 1: The tester sends the order amount and automatic delayed payment time to the payment system through the application system. The automatic delayed payment time is encrypted and sent to the HTTP request header as QA-Auto-Delay, and then an order request is sent to the payment system.
[0026] Step 2: After receiving the order request, the payment system generates a payment order number, requests the third-party payment interface with the received order amount to obtain the payment address, returns the payment address to the application system, and checks whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delay payment time, and sends the order number and delay time to the delay message queue.
[0027] Step 3: The automatic simulated payment system subscribes to the delayed message queue, obtains the order number from the received message, modifies the order data of this order number in the database to the paid status, and notifies the connected application system that the order has been paid.
[0028] Step 4: After the application system receives the payment notification, the tester confirms the application system's performance based on the payment details, and the test is complete.
[0029] The present invention will be further described below with reference to a specific embodiment:
[0030] A method for automatic payment testing of a payment system.
[0031] 1. Testers transmit the order amount and automatic payment delay time to the payment system through the application system. The automatic payment delay time is encrypted and included in the HTTP request header as QA-Auto-Delay, sending an order request to the payment system. After the application system is successfully integrated with the payment system, the tester needs to make the payment and wait for the payment notification. The tester should then see the payment status in the application system, such as an increase in the wallet balance or the order being paid and awaiting shipment in the e-commerce system. Testers can perform manual payments or test using the system's automatic payment testing method. An application system refers to a system that needs to integrate payment capabilities, such as a game store or online store. A payment system refers to a system with payment capabilities, which can be an aggregated payment system or a payment channel. For example, we are an aggregated payment system, and Alipay and WeChat are payment channels. The order request process of the payment system involves first requesting the order interface, obtaining the payment voucher, and then paying the user. After the user completes the payment, the partner will send a payment notification. QA-Auto-Delay, or "automatic payment delay time," is used to specify the automatic payment delay time for the interface.
[0032] The encryption method described in 1.1 is DES symmetric encryption using the payment system agreement key.
[0033] For example: 1. A tester needs to pay for a product worth 100 yuan. The application system sends the order amount (amount = 100) and the automatic delay payment time (delay = 1 second) to the payment system. Using the agreed-upon key with the payment system, it performs symmetric encryption (DES) to obtain delayDes = U2FsdGVkX1 / TgPBqejjaXeAhAh / o5pvN. This encrypted automatic delay payment time is then placed in the HTTP request header, i.e., Head[QA-Auto-Delay] = U2FsdGVkX1 / TgPBqejjaXeAhAh / o5pvN. Next, an order request is sent to the payment system: https: / / api.pay.com / create?amount=100&sign=xxx. The sign is the signature rule for the order interface in the order request, which is not the focus here and will not be described.
[0034] 2. After receiving an order request, the payment system generates a payment order number, requests the third-party payment interface with the received order amount to obtain the payment address, returns the payment address to the application system, and checks whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delay payment time, and then sends the order number and delay time to the delay message queue.
[0035] 2.1 The statement "Determine whether the HTTP request header contains QA-Auto-Delay. If it does, decrypt it using the agreed-upon key to obtain an automatic delayed payment time, and then send the order number and delay time to the delayed message queue" is further defined as follows: Determine whether the HTTP request header contains QA-Auto-Delay. If not, skip this step; if it does, decrypt it using the DES key to obtain the automatic delayed payment time, define the automatic message queue name, then create a message object, pass in the order number, call the message sending method SendSync, and transmit the order number and delay time message to the message queue.
[0036] 2.2 The "judgment" further involves retrieving the automatic delayed payment time through the Head["QA-Auto-Delay"] code; if it is empty, it means the time does not exist.
[0037] For example: 2. After receiving an order request, the payment system generates a payment order number, orderno=1716124298533-gHTd. This is because the payment function of the aggregated payment system connects to third-party payment systems such as Alipay and WeChat. The system requests an order with an order amount of 100 from the third-party payment system, such as https: / / pay3.xxx.com / order / pay?money=100&no=1716124298533-gHTd&x=... The third-party payment system will return a payment address, which is then sent back to the application system.
[0038] 2.1 Next, check if the HTTP request header contains QA-Auto-Delay. If not, skip this step. If it does, decrypt using the DES key to obtain the automatic delayed payment time delay = 1s. Define the automatic message queue as auto_pay, then create a message object and pass in the order number msg:=primitive.NewMessage(“auto_pay”, []byte("1716124298533-gHTd")), and set the message delay level to 1, i.e., 1s, msg.DelayTimeLevel = 1. Then call the message sending method SendSync to transmit the message to the message queue.
[0039] 3. The automatic simulated payment system subscribes to a delayed message queue, obtains the order number from the received message, modifies the order data for this order number in the database to the paid status, and notifies the connected application system that the order has been paid;
[0040] For example: 3. The automatic payment simulation system subscribes to the automatic message queue `auto_pay`, retrieves the order number `orderno = 1716124298533-gHTd` from the message queue, updates the payment status of the order data with order number `1716124298533-gHTd` in the order table of the database to "paid". It then notifies the connected application system of the order payment notification address that the order has been successfully paid, such as via `https: / / app.shop.com / pay / notify?no=1716124298533-gHTd&status=1&x=...`.
[0041] 4. After the application system receives the payment notification, the tester confirms the application system's behavior based on the payment status, and the test is complete. After receiving the payment notification, the tester can determine that the order has been paid based on the order number, and then confirms the application system's behavior, i.e., the application system displays "Order paid, awaiting shipment." The tester then completes this step. Different application systems may behave differently. For example, after completing the payment process, the integrated application system needs to display a pop-up message indicating payment success; this would be its desired behavior.
[0042] For example: 4. If the input delayed payment time is 10 minutes, then the application system will receive a payment notification after 10 minutes. The tester can then verify whether the application system performs normally after the user makes the payment in 10 minutes, such as whether the order cannot be shipped due to the long delay.
[0043] Please see Figure 2 As shown, the present invention also provides a system for automatic payment testing of a payment system, the system including a payment request module, a payment information transmission module, a payment status modification module, and a payment notification module;
[0044] The payment request module works as follows: Testers transmit the order amount and automatic payment delay time to the payment system through the application system. The automatic payment delay time is encrypted and passed as the QA-Auto-Delay header in the HTTP request, sending an order request to the payment system. After the application system has successfully integrated with the payment system, the tester needs to make the payment and wait for the payment notification. The tester should then see the payment confirmation in the application system, such as an increase in the wallet balance or a "paid order awaiting shipment" message in the e-commerce system. Testers can perform manual payments or test using the system's automatic payment testing method. An application system refers to a system that needs to integrate payment capabilities, such as a game store or online store. A payment system refers to a system with payment capabilities, which can be an aggregated payment system or a payment channel. For example, we are an aggregated payment system, and Alipay and WeChat are payment channels. The order request process of the payment system involves first requesting the order interface, obtaining the payment voucher, and then paying the user. After the user completes the payment, the partner will send a payment notification. QA-Auto-Delay, or "automatic payment delay time," is used to specify the automatic payment delay time for the interface.
[0045] The encryption method described in 1.1 is DES symmetric encryption using the payment system agreement key.
[0046] For example: 1. A tester needs to pay for a product worth 100 yuan. The application system sends the order amount (amount = 100) and the automatic delay payment time (delay = 1 second) to the payment system. Using the agreed-upon key with the payment system, it performs symmetric encryption (DES) to obtain delayDes = U2FsdGVkX1 / TgPBqejjaXeAhAh / o5pvN. This encrypted automatic delay payment time is then placed in the HTTP request header, i.e., Head[QA-Auto-Delay] = U2FsdGVkX1 / TgPBqejjaXeAhAh / o5pvN. Next, an order request is sent to the payment system: https: / / api.pay.com / create?amount=100&sign=xxx. The sign is the signature rule for the order interface in the order request, which is not the focus here and will not be described.
[0047] The payment information transmission module: After receiving an order request, the payment system generates a payment order number, requests a third-party payment interface using the received order amount to obtain a payment address, returns the payment address to the application system, and determines whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delay payment time, and transmits the order number and delay time to the delay message queue.
[0048] The "determine whether the HTTP request header contains QA-Auto-Delay; if it does, decrypt it using the agreed-upon key to obtain an automatic delayed payment time, and then transmit the order number and delay time to the delayed message queue" in the payment information transmission module is further defined as follows: determine whether the HTTP request header contains QA-Auto-Delay; if not, skip it; if it does, decrypt it using the DES key to obtain the automatic delayed payment time, define the automatic message queue name, then create a message object, pass in the order number, call the message sending method SendSync, and transmit the order number and delay time message to the message queue.
[0049] The "judgment" of the payment information transmission module is further defined by obtaining the automatic delayed payment time through the Head["QA-Auto-Delay"] code; if it is empty, it means that the delay does not exist.
[0050] For example: 2. After receiving an order request, the payment system generates a payment order number, orderno=1716124298533-gHTd. This is because the payment function of the aggregated payment system connects to third-party payment systems such as Alipay and WeChat. The system requests an order with an order amount of 100 from the third-party payment system, such as https: / / pay3.xxx.com / order / pay?money=100&no=1716124298533-gHTd&x=... The third-party payment system will return a payment address, which is then sent back to the application system.
[0051] The payment status modification module and the automatic simulated payment system subscribe to the delayed message queue, obtain the order number from the received message, modify the order data of this order number in the database to the paid status, and notify the connected application system that the order has been paid.
[0052] For example: 3. The automatic payment simulation system subscribes to the automatic message queue `auto_pay`, retrieves the order number `orderno = 1716124298533-gHTd` from the message queue, updates the payment status of the order data with order number `1716124298533-gHTd` in the order table of the database to "paid". It then notifies the connected application system of the order payment notification address that the order has been successfully paid, such as via `https: / / app.shop.com / pay / notify?no=1716124298533-gHTd&status=1&x=...`.
[0053] After receiving the payment notification, the tester checks the application system's performance based on the payment status, and the test is complete. If the application system receives the payment notification and the tester can confirm the order has been paid based on the order number, then the tester confirms the application system's performance; that is, the application system displays that the order has been paid and is awaiting shipment. The tester then completes this step of the test.
[0054] For example: 4. If the input delayed payment time is 10 minutes, then the application system will receive a payment notification after 10 minutes. The tester can then verify whether the application system performs normally after the user makes the payment in 10 minutes, such as whether the order cannot be shipped due to the long delay.
[0055] In summary, this invention provides a method and system for automatic payment testing of a payment system. By automatically simulating payments, testers can significantly reduce payment testing costs and flexibly set payment times, which will help improve the efficiency and accuracy of payment testing and better meet the needs of various application parties.
[0056] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.
Claims
1. A method for automatic payment testing of a payment system, characterized in that, The method includes the following steps: Step 1: The tester sends the order amount and automatic delayed payment time to the payment system through the application system. The automatic delayed payment time is encrypted and sent to the HTTP request header as QA-Auto-Delay, and then an order request is sent to the payment system. Step 2: After receiving the order request, the payment system generates a payment order number, uses the received order amount to request the third-party payment interface to obtain the payment address, returns the payment address to the application system, and checks whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delayed payment time, and then sends the order number and the delay time to the delayed message queue. Step 3: The automatic simulated payment system subscribes to the delayed message queue, obtains the order number from the received message, modifies the order data of this order number in the database to the paid status, and notifies the connected application system that the order has been paid. Step 4: After the application system receives the payment notification, the tester confirms the application system's performance based on the payment details, and the test is complete.
2. The method for automatic payment testing of a payment system according to claim 1, characterized in that, The encryption method described in step 1 is DES symmetric encryption using the payment system agreement key.
3. The method for automatic payment testing of a payment system according to claim 1, characterized in that, Step 2, "determine whether the HTTP request header contains QA-Auto-Delay. If it does, decrypt it using the agreed-upon key to obtain an automatic delayed payment time, and then send the order number and delay time to the delayed message queue," is further defined as follows: determine whether the HTTP request header contains QA-Auto-Delay. If not, skip this step; if it does, decrypt it using the DES key to obtain the automatic delayed payment time, define the automatic message queue name, then create a message object, pass in the order number, call the message sending method SendSync, and transmit the order number and delay time message to the message queue.
4. The method for automatic payment testing of a payment system according to claim 1, characterized in that, The "judgment" in step 2 further involves retrieving the automatic delayed payment time using the Head["QA-Auto-Delay"] code; if it is empty, it means the time does not exist.
5. A system for automatic payment testing of a payment system, characterized in that: The system includes a payment request module, a payment information transmission module, a payment status modification module, and a payment notification module. The request payment module: The tester sends the order amount and automatic delayed payment time to the payment system through the application system. The automatic delayed payment time is encrypted and sent to the QA-Auto-Delay header of the HTTP request to send an order request to the payment system. The payment information transmission module: After receiving an order request, the payment system generates a payment order number, requests a third-party payment interface using the received order amount to obtain a payment address, returns the payment address to the application system, and determines whether the HTTP request header contains QA-Auto-Delay. If it does, it decrypts the request using the agreed key to obtain an automatic delayed payment time, and transmits the order number and delay time to the delayed message queue. The payment status modification module and the automatic simulated payment system subscribe to the delayed message queue, obtain the order number from the received message, modify the order data of this order number in the database to the paid status, and notify the connected application system that the order has been paid. After receiving the payment notification, the tester confirms the application system's performance based on the payment details, and the test is complete.
6. The system for automatic payment testing of a payment system as described in claim 5, characterized in that, The encryption method used in the payment request module is DES symmetric encryption using the payment system's agreed-upon key.
7. The system for automatic payment testing of a payment system according to claim 5, characterized in that, The "determine whether the HTTP request header contains QA-Auto-Delay; if it does, decrypt it using the agreed-upon key to obtain an automatic delayed payment time, and then transmit the order number and delay time to the delayed message queue" in the payment information transmission module is further defined as follows: determine whether the HTTP request header contains QA-Auto-Delay; if not, skip it; if it does, decrypt it using the DES key to obtain the automatic delayed payment time, define the automatic message queue name, then create a message object, pass in the order number, call the message sending method SendSync, and transmit the order number and delay time message to the message queue.
8. The system for automatic payment testing of a payment system according to claim 5, characterized in that, The "judgment" of the payment information transmission module is further defined by obtaining the automatic delayed payment time through the Head["QA-Auto-Delay"] code; if it is empty, it means that the payment delay time does not exist.
Citation Information
Patent Citations
Method and apparatus for generating key in automated testing process
CN108337083A
Method and system for realizing high consistency of order payment states based on cloud payment center
CN116384993A