A method and system for simulating a real payment process in a test environment

By using the local DNS server to resolve the payment platform domain name to the simulated payment server in the test environment and importing a self-signed certificate, the testing cost and financial risks caused by using real funds for payment are solved, and a safe and efficient payment process simulation is achieved.

CN119539809BActive Publication Date: 2025-06-06BAO DAFANG TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510105538.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-23
Publication Date
2025-06-06
Estimated Expiration
2045-01-23

AI Technical Summary

Technical Problem

The existing testing environment needs to pay multiple orders repeatedly when simulated payment scenarios. Paying with real funds will lead to outflow of funds, increase testing costs, and involve transaction compliance issues.

Method used

In the test environment, use the local DNS server to resolve the domain name of the real payment platform to the IP address of the pre-built simulated payment server, and import the self-signed certificate of the simulated payment server into the client. The imitation circuit and key of the pre-constructed payment logic are sent to the client through the simulated payment server, which encrypts the payment request based on the key and sends it to the simulated server. The imitation server parses the encrypted payment request based on the obfuscation circuit and the key and generates a payment response.

Benefits of technology

This enables the simulation of real payment processes in a test environment without involving real funds transfer, avoiding financial risks, and ensuring the privacy and computing security of payment requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539809B_ABST
    Figure CN119539809B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for simulating a real payment process in a test environment, comprising: utilizing a local DNS server in the test environment to resolve the domain name of a real payment platform to an IP address of a pre-built simulated payment server, and importing the self-signed certificate of the simulated payment server into a client; utilizing the simulated payment server to send a pre-built obfuscation circuit of a payment logic and a corresponding key to the client; utilizing the client to encrypt a payment request based on the key, obtain an encrypted payment request and send it to the simulation server; parsing the encrypted payment request based on the obfuscation circuit and key of the payment logic by the simulation server, generating a payment response, and returning the payment response to the client; the present application can realize payment simulation under any platform and payment method, does not involve real funds, and provides a security verification mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software payment, and in particular to a method and system for simulating a real payment process in a test environment. Background Art

[0002] Online payment technology has developed and is widely used in various transaction occasions. With the rapid development of e-commerce and mobile payment, the stability, security and reliability of the payment system have become crucial. In the development and testing process of the payment system, simulating real payment scenarios, multiple payment methods and various abnormal situations is a key step to ensure the quality of the payment system.

[0003] In order to verify the payment scenario, the existing test environment needs to pay multiple orders repeatedly. During the test process, the use of real funds for payment will cause funds to flow out of the account, which not only increases the test cost, but also may lead to unnecessary financial risks. Especially when errors or anomalies occur during the test process, the test cost and financial risk are higher; and the transaction of real funds involves the issue of transaction compliance. Summary of the invention

[0004] In order to overcome the above-mentioned deficiencies of the prior art, the present invention proposes a method for simulating a real payment process in a test environment, comprising:

[0005] Using a local DNS server in the test environment, the domain name of the real payment platform is resolved to the IP address of the pre-built simulated payment server, and the self-signed certificate of the simulated payment server is imported into the client;

[0006] After the import is completed, the pre-built obfuscation circuit of the payment logic and the corresponding key are sent to the client using the simulated payment server;

[0007] The client encrypts the payment request based on the key to obtain an encrypted payment request and sends it to the simulation server; the simulation server parses the encrypted payment request based on the obfuscation circuit and key of the payment logic, generates a payment response, and returns the payment response to the client.

[0008] Optionally, the obfuscation circuit of the payment logic and the corresponding key are pre-constructed in the following manner:

[0009] In the simulated payment server, converting the preset payment logic into a Boolean circuit;

[0010] creating a key for each logic gate in the Boolean circuit;

[0011] The Boolean circuit is obfuscated based on the key to obtain the obfuscated circuit of the payment logic and the key corresponding to the obfuscated circuit of the payment logic.

[0012] Optionally, parsing the encrypted payment request and generating a payment response by the simulation server based on the obfuscation circuit and key of the payment logic includes:

[0013] The simulation server performs obfuscation circuit calculation on the encrypted payment request based on the key of the payment logic and the logic gates in the obfuscation circuit of the payment logic to obtain an encryption calculation result;

[0014] Utilizing the key to parse the encrypted calculation result to obtain a plaintext result;

[0015] A payment response having the same response format as that of the real payment platform is generated based on the plain text result.

[0016] Optionally, the performing obfuscation circuit calculation on the encrypted payment request based on the key of the payment logic and the logic gates in the obfuscation circuit of the payment logic by the simulation server to obtain an encryption calculation result includes:

[0017] Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result;

[0018] Based on the logic gate of the payment amount in the obfuscated circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result;

[0019] The payment method verification result and the payment amount verification result are used as logic gates for comprehensive verification of the payment request in the obfuscation circuit to obtain the encrypted calculation result of the encrypted payment request.

[0020] Optionally, the plain text result includes payment success and payment failure;

[0021] The generating, based on the plain text result, a payment response with the same response format as that of the real payment platform comprises:

[0022] When the plain text result is a successful payment, the simulated payment server is used to generate a successful payment response in the same format as the real payment platform; the successful payment response includes order information, payment amount and successful payment mark;

[0023] When the plain text result is a payment failure, using the simulated payment server to generate a payment failure response in the same format as the real payment platform;

[0024] If no plain text result is obtained within a preset time, the simulated payment server is used to generate a payment timeout response in the same format as that of the real payment platform.

[0025] Optionally, returning the payment response to the client includes:

[0026] Signing the payment response using the same digital signature algorithm as that of the real payment platform to generate a digital signature;

[0027] The digital signature and the payment response are simultaneously sent to the client, so that the client can verify the integrity and validity of the payment response based on the digital signature.

[0028] Optionally, the pre-construction process of the simulated payment server is as follows:

[0029] Build the server system architecture based on the simulation requirements of the payment process, and configure the basic network settings of the server to obtain the initial simulation payment server;

[0030] In the web server of the initial simulated payment server, configuring the self-signed certificate of the initial simulated server;

[0031] and configuring multiple payment methods in the user interface of the initial simulated payment server;

[0032] Based on the multiple payment methods, multiple API endpoints are configured in the initial simulation server to obtain a simulated payment server;

[0033] The multiple API endpoints correspond to multiple payment methods and update modules of the payment methods respectively.

[0034] Optionally, after configuring multiple API endpoints in the initial simulated payment server, the method further includes:

[0035] Creating a virtual account, a funds flow module and a clearing mechanism module in the initial simulated payment server;

[0036] The funds flow module is used to, after the simulated payment server completes the payment response, deduct or add an amount from the virtual account based on the payment amount in the payment response, and update the account balance of the virtual account;

[0037] The settlement mechanism module is used to settle the account balance in the virtual account based on preset settlement rules.

[0038] Optionally, importing the self-signed certificate of the simulated payment server into the client includes:

[0039] Exporting the self-signed certificate of the simulated payment server into a format recognizable by the client;

[0040] The exported self-signed certificate is transmitted to the client through the simulated payment server, and a trusted certificate list on the client is configured.

[0041] Based on the same inventive concept, the present invention proposes a simulation system for a real payment process in a test environment, comprising:

[0042] A domain name resolution module, used to resolve the domain name of the real payment platform to the IP address of the pre-built simulated payment server by using the local DNS server in the test environment, and import the self-signed certificate of the simulated payment server into the client;

[0043] A payment logic sending module, used to send the pre-built obfuscation circuit of the payment logic and the corresponding key to the client using the simulated payment server after the import is completed;

[0044] The payment response module is used to encrypt the payment request based on the key using the client, obtain the encrypted payment request and send it to the simulation server; parse the encrypted payment request through the obfuscation circuit and key of the payment logic of the simulation server, generate a payment response, and return the payment response to the client.

[0045] Optionally, the system further includes a payment logic processing module, which is used to:

[0046] In the simulated payment server, converting the preset payment logic into a Boolean circuit;

[0047] creating a key for each logic gate in the Boolean circuit;

[0048] The Boolean circuit is obfuscated based on the key to obtain the obfuscated circuit of the payment logic and the key corresponding to the obfuscated circuit of the payment logic.

[0049] Optionally, the payment response module is specifically used to:

[0050] The simulation server performs obfuscation circuit calculation on the encrypted payment request based on the key of the payment logic and the logic gates in the obfuscation circuit of the payment logic to obtain an encryption calculation result;

[0051] Utilizing the key to parse the encrypted calculation result to obtain a plaintext result;

[0052] A payment response having the same response format as that of the real payment platform is generated based on the plain text result.

[0053] Optionally, the payment response module is specifically used to:

[0054] Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result;

[0055] Based on the logic gate of the payment amount in the obfuscated circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result;

[0056] The payment method verification result and the payment amount verification result are used as logic gates for comprehensive verification of the payment request in the obfuscation circuit to obtain the encrypted calculation result of the encrypted payment request.

[0057] Optionally, the payment response module is specifically used to:

[0058] When the plain text result is a successful payment, the simulated payment server is used to generate a successful payment response in the same format as the real payment platform; the successful payment response includes order information, payment amount and successful payment mark;

[0059] When the plain text result is a payment failure, using the simulated payment server to generate a payment failure response in the same format as the real payment platform;

[0060] If no plain text result is obtained within a preset time, the simulated payment server is used to generate a payment timeout response in the same format as that of the real payment platform.

[0061] Optionally, the payment response module is specifically used to:

[0062] Signing the payment response using the same digital signature algorithm as that of the real payment platform to generate a digital signature;

[0063] The digital signature and the payment response are simultaneously sent to the client, so that the client can verify the integrity and validity of the payment response based on the digital signature.

[0064] Optionally, the system further includes a server building module, configured to:

[0065] Build the server system architecture based on the simulation requirements of the payment process, and configure the basic network settings of the server to obtain the initial simulation payment server;

[0066] In the web server of the initial simulated payment server, configuring the self-signed certificate of the initial simulated server;

[0067] and configuring multiple payment methods in the user interface of the initial simulated payment server;

[0068] Based on the multiple payment methods, multiple API endpoints are configured in the initial simulation server to obtain a simulated payment server;

[0069] The multiple API endpoints correspond to multiple payment methods and update modules of the payment methods respectively.

[0070] Optionally, the server construction module is further used to:

[0071] Creating a virtual account, a funds flow module and a clearing mechanism module in the initial simulated payment server;

[0072] The funds flow module is used to, after the simulated payment server completes the payment response, deduct or add an amount from the virtual account based on the payment amount in the payment response, and update the account balance of the virtual account;

[0073] The settlement mechanism module is used to settle the account balance in the virtual account based on preset settlement rules.

[0074] Optionally, the domain name resolution module is specifically used to:

[0075] Exporting the self-signed certificate of the simulated payment server into a format recognizable by the client;

[0076] The exported self-signed certificate is transmitted to the client through the simulated payment server, and a trusted certificate list on the client is configured.

[0077] In another aspect, the present application further provides an electronic device, comprising: at least one processor and a memory; the memory and the processor are connected via a bus;

[0078] The memory is used to store one or more programs;

[0079] When the one or more programs are executed by the at least one processor, the method for simulating a real payment process in a test environment as described above is implemented.

[0080] On the other hand, the present application also provides a computer-readable storage medium having an execution program stored thereon, which, when executed, implements the method for simulating a real payment process in a test environment as described above.

[0081] Compared with the closest prior art, the present invention has the following beneficial effects:

[0082] The present invention provides a method and system for simulating a real payment process in a test environment, comprising: using a local DNS server in the test environment to resolve the domain name of a real payment platform to the IP address of a pre-built simulated payment server, and importing the self-signed certificate of the simulated payment server into a client; after the import is completed, using the simulated payment server to send the pre-built obfuscation circuit of the payment logic and the corresponding key to the client; using the client to encrypt the payment request based on the key, obtain the encrypted payment request and send it to the simulation server; using the simulation server to parse the encrypted payment request based on the obfuscation circuit and key of the payment logic, generate a payment response, and return the payment response to the client; in the present invention, by resolving the domain name of the real payment platform to the simulated payment server, it is possible to simulate the payment process of different payment platforms in different test environments; importing the self-signed certificate into the client to ensure the communication interaction between the client and the simulated payment server; using the pre-built simulated payment server, based on the obfuscation circuit of the payment logic and the encrypted payment request, payment interaction simulation is performed, which can protect the privacy and computing security of the user's payment request while ensuring that no real funds transfer is involved to avoid financial risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] Figure 1 A flow chart of a method for simulating a real payment process in a test environment provided by the present invention;

[0084] Figure 2 A schematic diagram of the structure of a simulation system for a real payment process in a test environment provided by the present invention;

[0085] Figure 3 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0086] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.

[0087] Example 1

[0088] The present invention provides a method for simulating a real payment process in a test environment, such as Figure 1 As shown, including:

[0089] S1. In the test environment, use the local DNS server to resolve the domain name of the real payment platform to the IP address of the pre-built simulated payment server, and import the self-signed certificate of the simulated payment server into the client;

[0090] S2. After the import is completed, the pre-built obfuscation circuit of the payment logic and the corresponding key are sent to the client using the simulated payment server;

[0091] S3. Using the client to encrypt the payment request based on the key, obtain the encrypted payment request and send it to the simulation server; using the simulation server to parse the encrypted payment request based on the obfuscation circuit and key of the payment logic, generate a payment response, and return the payment response to the client.

[0092] In step S1, S1-1, in the test environment, the domain name of the real payment platform is resolved to the IP address of the pre-built simulated payment server using the local DNS server. The specific process is:

[0093] In the test environment, use the local DNS (Domain Name System) server to point the domain name of the real payment platform to the IP (Internet Protocol) address of the test environment, that is, resolve the domain name of the real payment platform to the IP address of the simulated payment server used for testing.

[0094] The process of resolving the domain name of the real payment platform to the simulated payment server includes the following:

[0095] In the domain name information zone file of the local DNS server, add a required CNAME record (CanonicalName, alias record) to point the domain name of the payment platform to the IP address of the simulated payment server, which is applicable to the entire test environment.

[0096] The domain name resolution method provided in this solution does not require modification of the client application code, and can flexibly switch between different test environments. It ensures that the test user accesses a simulated environment and tests the payment process in a simulated environment to ensure that no real funds are transferred.

[0097] The pre-construction process of the above simulated payment server is as follows:

[0098] Build the server system architecture based on the simulation requirements of the payment process, and configure the basic network settings of the server to obtain the initial simulation payment server;

[0099] In the web server of the initial simulated payment server, configuring the self-signed certificate of the initial simulated server;

[0100] and configuring multiple payment methods on the user interface of the initial simulated payment server, including but not limited to credit cards, bank transfers and third-party payment platforms;

[0101] Based on the multiple payment methods, multiple API endpoints are configured in the initial simulation server to obtain a simulated payment server;

[0102] The multiple API endpoints correspond to multiple payment methods and update modules of the payment methods, respectively, allowing the payment method to be switched without restarting the server for different testing scenarios.

[0103] The process of configuring the self-signed certificate of the initial simulation server is as follows:

[0104] A private key is generated by using OpenSSL (Open Secure Sockets Layer), a certificate signing request is created based on the private key, a self-signed certificate is generated based on the certificate signing request by using OpenSSL, during the generation process, the domain name of the payment platform is input as the CN (Common Name) of the certificate, and the generated private key and self-signed certificate are configured to the Web server of the simulated payment server.

[0105] Configure the generated certificate and private key on the Web server simulating the payment server so that it can communicate securely with the client through the HTTPS (HyperText Transfer Protocol Secure) protocol.

[0106] After configuring multiple API endpoints in the initial mock payment server above, also include:

[0107] Creating a virtual account, a funds flow module and a clearing mechanism module in the initial simulated payment server;

[0108] The funds flow module is used to, after the simulated payment server completes the payment response, deduct or add an amount from the virtual account based on the payment amount in the payment response, and update the account balance of the virtual account;

[0109] The clearing mechanism module is used to settle the account balance in the virtual account based on the preset clearing rules, and verify the fund status after payment, reconciliation and settlement process to ensure the integrity and accuracy of fund flow. Different clearing rules can be configured in the clearing mechanism module, such as T+0, T+1, etc., where T represents the trading day, T+0 represents the completion of clearing and delivery on the trading day, and T+1 represents the completion of clearing and delivery on the first trading day after the trading, to meet different business needs.

[0110] The virtual account has an initial account balance and account information. The virtual account is used to simulate transactions of fund inflow and outflow, including payment, refund and transfer operations, to ensure that each transaction can correctly update the account balance.

[0111] The construction process of the simulated payment server also includes writing corresponding response logic on the simulated payment server according to different payment requests, specifically including: when the payment is successful, returning the same payment success response as the real payment platform; when the payment fails, returning the same payment failure response as the real payment platform. If the payment times out, returning the same payment timeout response as the real payment platform. It is used to simulate the real payment response to ensure the accuracy of the test, and can simulate various payment scenarios and abnormal situations.

[0112] S1-2, importing the self-signed certificate of the simulated payment server into the client, including:

[0113] Export the self-signed certificate of the simulated payment server into a format recognizable by the client, such as PEM (Privacy Enhanced Mail, a text file format of privacy enhanced mail) or CER (Certificate, a certificate file format);

[0114] The exported self-signed certificate is transmitted to the client through the simulated payment server, and a trusted certificate list on the client is configured.

[0115] Among them, if the client is a mobile device, the self-signed certificate is transmitted to the mobile device via email, and the self-signed certificate is configured in the trusted certificate list of the mobile device; if the client is a mobile application test, the self-signed certificate is packaged into the application, or the self-signed certificate is trusted in the application code.

[0116] It is used to ensure that the client application trusts the self-signed certificate of the simulated payment server, successfully establishes an HTTPS connection, and does not interrupt communication due to an untrusted certificate, thereby ensuring the security of communication between the client and the simulated payment server.

[0117] Before using the simulated payment server to send the pre-built obfuscation circuit of the payment logic and the corresponding key to the client in step S2, it also includes: confirming that the domain name of the real payment platform has been correctly resolved to the IP address of the simulated payment server. Specifically including:

[0118] The client is used to send a payment request to a simulated payment server according to the configuration switch. The simulated payment server receives the payment request and returns a simulated payment response. After multiple verifications, it is ensured that all payment requests pass through the simulated payment server to avoid mistakenly sending the payment request used for testing to the real payment platform.

[0119] Step S2: After the import is completed, the pre-built obfuscation circuit of the payment logic and the corresponding key are sent to the client using the simulated payment server.

[0120] Specifically, the pre-built obfuscation circuit of the payment logic and the corresponding key are sent to the client by using the simulated payment server through the HTTPS connection established above, ensuring that the data transmission between the client and the simulated payment server is encrypted to prevent the data from being stolen or tampered with.

[0121] The obfuscation circuit of the payment logic and the corresponding key are pre-built in the following manner:

[0122] In the simulated payment server, converting the preset payment logic into a Boolean circuit;

[0123] creating a key for each logic gate in the Boolean circuit;

[0124] The Boolean circuit is obfuscated based on the key to obtain the obfuscated circuit of the payment logic and the key corresponding to the obfuscated circuit of the payment logic. The obfuscation process includes encrypting the output of each logic gate and creating an obfuscation table, which stores the encrypted output results.

[0125] Here, a key is created for each logic gate in a Boolean circuit as follows:

[0126] For each logic gate in the Boolean circuit, a pair of random keys are generated: one corresponding to an output of 0 and another corresponding to an output of 1. These keys are used to encrypt the output of the logic gate so that only a party holding the correct key can decrypt and obtain the gate's output value.

[0127] In step S3, S3-1, the client encrypts the payment request based on the key to obtain the encrypted payment request and sends it to the simulation server.

[0128] S3-2. The simulation server parses the encrypted payment request based on the obfuscation circuit and key of the payment logic to generate a payment response.

[0129] The simulation server performs obfuscation circuit calculation on the encrypted payment request based on the key of the payment logic and the logic gates in the obfuscation circuit of the payment logic to obtain an encryption calculation result;

[0130] Utilizing the key to parse the encrypted calculation result to obtain a plaintext result;

[0131] Generates a payment response based on the plain text result in the same response format as the real payment platform

[0132] The step of performing obfuscation circuit calculation on the encrypted payment request to obtain an encrypted calculation result specifically includes:

[0133] Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result;

[0134] Based on the logic gate of the payment amount in the obfuscated circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result;

[0135] The payment method verification result and the payment amount verification result are used as logic gates for comprehensive verification of the payment request in the obfuscation circuit to obtain the encrypted calculation result of the encrypted payment request.

[0136] The above-mentioned plain text results include payment success and payment failure; the payment response generated based on the plain text results in the same response format as the real payment platform specifically includes:

[0137] Based on the response logic pre-written in the simulated payment server, when the plain text result is a successful payment, the simulated payment server is used to generate a successful payment response in the same format as the real payment platform; the successful payment response includes order information, payment amount and successful payment mark;

[0138] When the plain text result is a payment failure, using the simulated payment server to generate a payment failure response in the same format as the real payment platform;

[0139] If no plain text result is obtained within a preset time, the simulated payment server is used to generate a payment timeout response in the same format as that of the real payment platform.

[0140] S3-3, returning the payment response to the client, including:

[0141] The payment response is signed using the same digital signature algorithm as that of the real payment platform to generate a digital signature; the digital signature and the payment response are simultaneously sent to the client for verifying the integrity and validity of the payment response based on the digital signature by the client.

[0142] Specifically, the payment response is signed using the same digital signature algorithm as the real payment platform, such as RSA (Rivest Shamir Adleman, a public key encryption algorithm) or ECDSA (Elliptic Curve Digital Signature Algorithm), to generate a digital signature;

[0143] The digital signature and the payment response are sent to the client at the same time, the digital signature is parsed by the client, the parsed digital signature is compared with the payment response, and it is verified whether the payment response has been tampered with during the sending process, so as to ensure the integrity and validity of the payment response.

[0144] This solution provides a simulation module for simulating real payment scenarios, namely, a simulated payment server. In the test environment, the simulated payment server interacts with the client, covering the entire process of initiating payment requests, gateway interaction, and responses from third-party payment platforms, ensuring a high degree of consistency with the real payment process. And by presetting payment logic, payment response, and virtual clearing mechanism, it ensures that it can deal with various payment problems and comprehensively test the payment process. Among them, through the payment failure and payment timeout response in the payment response, it is possible to simulate abnormal payment situations and ensure stability when facing different payment problems; through virtual fund accounts and fund clearing mechanisms, the flow and clearing process of funds in real payments are simulated, and the fund status, reconciliation, and settlement processes after payment are verified, which can ensure the integrity of the payment process.

[0145] This solution also ensures data security during the payment process and the integrity and validity of the payment response through the security verification mechanism of encrypted transmission and digital signature algorithm during the test. The HTTPS protocol and encryption algorithm are used to ensure the security of payment data during transmission, thereby ensuring the consistency of the security mechanism between the simulated payment environment and the real payment environment, thereby improving the accuracy and reliability of the test.

[0146] To summarize, in this solution, by resolving the domain name of the real payment platform to the simulated payment server, it is possible to simulate the payment process of different payment platforms in different test environments. The import of self-signed certificates can ensure the communication interaction between the client and the simulated payment server. By using the obfuscated circuit of the payment logic and the encrypted payment request to simulate the payment interaction, it is possible to protect the privacy and computing security of the user's payment request while ensuring that no real funds transfer is involved to avoid financial risks.

[0147] Example 2

[0148] Based on the same inventive concept, the present invention also provides a simulation system for a real payment process in a test environment, such as Figure 2 As shown, including:

[0149] A domain name resolution module, used to resolve the domain name of the real payment platform to the IP address of the pre-built simulated payment server by using the local DNS server in the test environment, and import the self-signed certificate of the simulated payment server into the client;

[0150] A payment logic sending module, used to send the pre-built obfuscation circuit of the payment logic and the corresponding key to the client using the simulated payment server after the import is completed;

[0151] The payment response module is used to encrypt the payment request based on the key using the client, obtain the encrypted payment request and send it to the simulation server; parse the encrypted payment request through the obfuscation circuit and key of the payment logic of the simulation server, generate a payment response, and return the payment response to the client.

[0152] In a possible implementation, the system further includes a payment logic processing module, which is used to:

[0153] In the simulated payment server, converting the preset payment logic into a Boolean circuit;

[0154] creating a key for each logic gate in the Boolean circuit;

[0155] The Boolean circuit is obfuscated based on the key to obtain the obfuscated circuit of the payment logic and the key corresponding to the obfuscated circuit of the payment logic.

[0156] In a possible implementation, the payment response module is specifically used to:

[0157] The simulation server performs obfuscation circuit calculation on the encrypted payment request based on the key of the payment logic and the logic gates in the obfuscation circuit of the payment logic to obtain an encryption calculation result;

[0158] Utilizing the key to parse the encrypted calculation result to obtain a plaintext result;

[0159] A payment response having the same response format as that of the real payment platform is generated based on the plain text result.

[0160] In a possible implementation, the payment response module is specifically used to:

[0161] Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result;

[0162] Based on the logic gate of the payment amount in the obfuscated circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result;

[0163] The payment method verification result and the payment amount verification result are used as logic gates for comprehensive verification of the payment request in the obfuscation circuit to obtain the encrypted calculation result of the encrypted payment request.

[0164] In a possible implementation, the payment response module is specifically used to:

[0165] When the plain text result is a successful payment, the simulated payment server is used to generate a successful payment response in the same format as the real payment platform; the successful payment response includes order information, payment amount and successful payment mark;

[0166] When the plain text result is a payment failure, using the simulated payment server to generate a payment failure response in the same format as the real payment platform;

[0167] If no plain text result is obtained within a preset time, the simulated payment server is used to generate a payment timeout response in the same format as that of the real payment platform.

[0168] In a possible implementation, the payment response module is specifically used to:

[0169] Signing the payment response using the same digital signature algorithm as that of the real payment platform to generate a digital signature;

[0170] The digital signature and the payment response are simultaneously sent to the client, so that the client can verify the integrity and validity of the payment response based on the digital signature.

[0171] In a possible implementation, the system further includes a server building module, which is used to:

[0172] Build the server system architecture based on the simulation requirements of the payment process, and configure the basic network settings of the server to obtain the initial simulation payment server;

[0173] In the web server of the initial simulated payment server, configuring the self-signed certificate of the initial simulated server;

[0174] and configuring multiple payment methods in the user interface of the initial simulated payment server;

[0175] Based on the multiple payment methods, multiple API endpoints are configured in the initial simulation server to obtain a simulated payment server;

[0176] The multiple API endpoints correspond to multiple payment methods and update modules of the payment methods respectively.

[0177] In a possible implementation, the server building module is further used to:

[0178] Creating a virtual account, a funds flow module and a clearing mechanism module in the initial simulated payment server;

[0179] The funds flow module is used to, after the simulated payment server completes the payment response, deduct or add an amount from the virtual account based on the payment amount in the payment response, and update the account balance of the virtual account;

[0180] The settlement mechanism module is used to settle the account balance in the virtual account based on preset settlement rules.

[0181] In a possible implementation, the domain name resolution module is specifically used to:

[0182] Exporting the self-signed certificate of the simulated payment server into a format recognizable by the client;

[0183] The exported self-signed certificate is transmitted to the client through the simulated payment server, and a trusted certificate list on the client is configured.

[0184] Example 3

[0185] like Figure 3 As shown, the present invention also provides an electronic device, which may be a computer device, a single-chip device, an intelligent mobile device, etc. The electronic device in this embodiment may include a processor, a memory, a transceiver component, etc. The memory, the processor, and the transceiver component are connected via a bus; the memory may be used to store an execution program, and an exemplary execution program may include instructions; the processor is used to execute the instructions stored in the memory. The memory may also be used to store data, which may be called and / or modified when the instructions are executed.

[0186] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in a storage medium to implement corresponding method processes or corresponding functions, so as to realize the steps of a simulation method of a real payment process in a test environment in the above-mentioned embodiment.

[0187] Example 4

[0188] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the storage medium here can include both built-in storage media in electronic devices and extended storage media supported by electronic devices. The storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor loads and executes one or more instructions stored in the storage medium, which can implement the steps of the simulation method of a real payment process in a test environment in the above embodiment.

[0189] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0190] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0191] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0192] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0193] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit its protection scope. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present invention, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the application, but these changes, modifications or equivalent substitutions are all within the protection scope of the claims to be approved.

Claims

1. A method for simulating a real payment process in a test environment, characterized in that: include: Using a local DNS server in the test environment, the domain name of the real payment platform is resolved to the IP address of the pre-built simulated payment server, and the self-signed certificate of the simulated payment server is imported into the client; After the import is completed, the pre-built obfuscation circuit of the payment logic and the corresponding key are sent to the client using the simulated payment server; Encrypting the payment request using the client based on the key to obtain the encrypted payment request and sending it to the simulated payment server; The encrypted payment request is parsed by the simulated payment server based on the obfuscation circuit and key of the payment logic to generate a payment response, including: Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result; Based on the logic gate of the payment amount in the obfuscated circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result; Using the payment method verification result and the payment amount verification result as logic gates for comprehensive verification of the payment request in the obfuscation circuit to obtain an encrypted calculation result of the encrypted payment request; Utilizing the key to parse the encrypted calculation result to obtain a plaintext result; A payment response having the same response format as that of the real payment platform is generated based on the plaintext result, and the payment response is returned to the client.

2. The method according to claim 1, characterized in that The obfuscation circuit of the payment logic and the corresponding key are pre-built in the following manner: In the simulated payment server, converting the preset payment logic into a Boolean circuit; creating a key for each logic gate in the Boolean circuit; The Boolean circuit is obfuscated based on the key to obtain the obfuscated circuit of the payment logic and the key corresponding to the obfuscated circuit of the payment logic.

3. The method according to claim 1, characterized in that The plain text result includes payment success and payment failure; The generating, based on the plain text result, a payment response with the same response format as that of the real payment platform comprises: When the plain text result is a successful payment, the simulated payment server is used to generate a successful payment response in the same format as the real payment platform; the successful payment response includes order information, payment amount and successful payment mark; When the plain text result is a payment failure, using the simulated payment server to generate a payment failure response in the same format as that of the real payment platform; If no plain text result is obtained within a preset time, the simulated payment server is used to generate a payment timeout response in the same format as that of the real payment platform.

4. The method according to claim 1, characterized in that The step of returning the payment response to the client comprises: Signing the payment response using the same digital signature algorithm as that of the real payment platform to generate a digital signature; The digital signature and the payment response are simultaneously sent to the client, so that the client can verify the integrity and validity of the payment response based on the digital signature.

5. The method according to claim 1, characterized in that The pre-construction process of the simulated payment server is as follows: Build the server system architecture based on the simulation requirements of the payment process, and configure the basic network settings of the server to obtain the initial simulation payment server; In the web server of the initial simulated payment server, configuring a self-signed certificate of the initial simulated payment server; and configuring multiple payment methods in the user interface of the initial simulated payment server; Based on the multiple payment methods, multiple API endpoints are configured in the initial simulated payment server to obtain a simulated payment server; The multiple API endpoints correspond to multiple payment methods and update modules of the payment methods respectively.

6. The method according to claim 5, characterized in that After configuring multiple API endpoints in the initial simulated payment server, the method further includes: Creating a virtual account, a funds flow module and a clearing mechanism module in the initial simulated payment server; The funds flow module is used to, after the simulated payment server completes the payment response, deduct or add an amount from the virtual account based on the payment amount in the payment response, and update the account balance of the virtual account; The settlement mechanism module is used to settle the account balance in the virtual account based on preset settlement rules.

7. The method according to claim 1, characterized in that Importing the self-signed certificate of the simulated payment server into the client includes: Exporting the self-signed certificate of the simulated payment server into a format recognizable by the client; The exported self-signed certificate is transmitted to the client through the simulated payment server, and a trusted certificate list on the client is configured.

8. A simulation system for a real payment process in a test environment, characterized in that: include: A domain name resolution module, used to resolve the domain name of the real payment platform to the IP address of the pre-built simulated payment server by using the local DNS server in the test environment, and import the self-signed certificate of the simulated payment server into the client; A payment logic processing module, used to send the pre-built obfuscation circuit of the payment logic and the corresponding key to the client by using the simulated payment server after the import is completed; The payment response module is used to encrypt the payment request based on the key using the client, obtain the encrypted payment request and send it to the simulated payment server; parse the encrypted payment request through the obfuscation circuit and key based on the payment logic of the simulated payment server, and generate a payment response, specifically for: Using the simulated payment server, based on the logic gate of the payment method in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment method in the encrypted payment request is valid, and obtain a payment method verification result; Based on the logic gate of the payment amount in the obfuscation circuit of the payment logic and the corresponding key, verify whether the payment amount in the encrypted payment request is valid, and obtain the payment amount verification result; use the payment method verification result and the payment amount verification result as the logic gate of the comprehensive verification of the payment request in the obfuscation circuit to obtain the encryption calculation result of the encrypted payment request; The encrypted calculation result is parsed using the key to obtain a plaintext result; a payment response having the same response format as that of the real payment platform is generated based on the plaintext result, and the payment response is returned to the client.

Citation Information

Patent Citations

  • Method for automatically generating mock service based on SDK

    CN113590465A