Method and system for asynchronously notifying payment result based on incremental timing compensation

By setting up an incremental timing compensation asynchronous notification mechanism in the E-Billing system, the problem that the merchant platform cannot receive transaction result notifications is solved, and reliable delivery of payment results and efficient use of resources are achieved.

CN118657523APending Publication Date: 2024-09-17WUHAN ZBANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410697257.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

In the existing technology, merchant platforms are often unable to receive transaction result notifications from the E-Connect system due to network problems, or the processing results fed back to the E-Connect system are not received, resulting in a waste of connection resources and repeated notifications.

Method used

Using the method of asynchronous notification based on incremental timing compensation, after receiving the order payment results of the core payment platform through the E-Connect transaction module, the event notification message is encapsulated and published, and the maximum number of failures and the time interval for each sending are set. If the first notification fails , then enter the re-issuance processing stage, using scheduled tasks and delayed processing queues to re-send messages until the re-send is successful or the number of failures reaches the upper limit for manual intervention.

Benefits of technology

It realizes timely compensation of asynchronous notification payment results to the merchant platform, avoiding resource waste and repeated notifications, and ensuring the reliability and efficiency of notifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657523A
    Figure CN118657523A
Patent Text Reader

Abstract

The invention provides a method and system for asynchronously notifying a payment result based on incremental timing compensation, and the method comprises the steps: packaging and transmitting a notification message after an E-account transaction module receives a final order result of a core payment platform; after receiving the notification message, the E-account transaction sub-module carries out first notification processing on the platform merchant; wherein before the notification message is sent, the maximum number of failures, the time interval of sending each time and the number of notification times are set; if the first notification is successfully sent, the process is ended; if the first notification fails, entering a reissuing processing stage of the message notification; at the moment, the timed task retrieves the database table, searches the notification message to be reissued, and sends the notification message to the delay processing queue for reissuing processing; and performing manual intervention until reissuing succeeds or the number of times of reissuing failures reaches an upper limit. The invention provides a technical scheme for asynchronously notifying a payment result based on incremental timing compensation, and the transaction result can be asynchronously notified to a merchant platform in a timely and punctual manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Internet distributed microservice architecture, and in particular to a method and system for asynchronously notifying payment results based on incremental timed compensation. Background Art

[0002] The core payment system completes the creation, completion and refund of transaction orders by connecting to UnionPay and NetsUnion. When a payment order is paid, UnionPay or NetsUnion will asynchronously notify the core payment system of the payment result, and then the core payment system will synchronize the payment result to the E-Account system. Finally, the E-Account system will notify each merchant to complete the closed-loop business of an order. However, due to network problems or other reasons, the merchant platform often cannot receive the transaction results notified by the E-Account system, or the processing results fed back to the E-Account system are not received by the system. The E-Account system cannot always send asynchronous notifications to the merchant platform, because this will greatly waste connection resources and will repeatedly notify the merchant platform. At this time, a compensation notification payment result mechanism is needed. Summary of the invention

[0003] In view of the technical problems existing in the prior art, the present invention provides a method for asynchronously notifying payment results based on incremental timing compensation, and provides a technical solution for asynchronously notifying payment results based on incremental timing compensation, which can compensate asynchronously and notify the merchant platform of transaction results on time.

[0004] According to a first aspect of the present invention, the present invention provides a method for asynchronously notifying payment results based on incremental timing compensation, comprising the following steps:

[0005] After receiving the order payment result from the core payment platform, the E-account transaction module encapsulates and publishes an event notification message to allow the order payment result to enter the notification process;

[0006] After receiving the notification message, the E-account transaction submodule performs the first notification processing on the platform merchant; before the notification message is sent, the maximum number of failures, the time interval for each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; if the first notification fails, it enters the message notification resending processing stage; at this time, the scheduled task searches the database table, finds the notification message to be resent, and sends it to the delayed processing queue for resending; until the resending is successful or the number of resending failures reaches the upper limit, manual intervention is performed.

[0007] Based on the above technical solution, the present invention can also make the following improvements.

[0008] Optionally, the E-account transaction module receives the final result of the order from the core payment platform, encapsulates and publishes the Kafka event event_topic.

[0009] Optionally, after the E-account transaction module receives the order payment result from the core payment platform, encapsulating and publishing an event notification message to allow the order payment result to enter the notification process includes:

[0010] Step 1.1: After the message notification module sends the notification message for the first time, the queue sets the maximum number of failed sends and the time interval between each send;

[0011] Step 1.2: The E-account transaction module notifies the merchant to send a transaction notification; if the notification fails to be sent, it will be reissued; if it is less than the preset time, it will be sent to the delayed processing queue;

[0012] Step 1.3: After the delay queue waits for the initial default value, the reissue notification is handed over to the reissue queue for processing and the notification reissue logic is executed.

[0013] Optionally, the maximum number of failed transmissions is 11 times, of which the first transmission is 1 time.

[0014] Optionally, the time interval for each sending is set to any of the following:

[0015] 0s,5s,10s,2min,5min,10min,30min,1h,2h,6h,15h, where 0s is the default value set when the message notification is sent for the first time.

[0016] Optionally, after receiving the kafka event event_topic, the E-account transaction submodule webhook performs the first notification processing on the platform merchant.

[0017] Optionally, the scheduled task searches a database table to find the notification message to be reissued, and sends it to a delayed processing queue for reissue processing; until the reissue is successful or the number of reissue failures reaches an upper limit, manual intervention includes:

[0018] Step 2.1: The delayed notification queue collects notifications from the first failed notifications, as well as the scheduled task that searches the database table every minute for notifications to be sent, and sorts the notification messages to be sent in the order of the sending time;

[0019] Step 2.2: Consume the delayed notification queue in sequence, and the thread waits until the current time is equal to the sending time of the notification message, and then sends the message to be sent to the resending queue;

[0020] Step 2.3: Consume the resend queue, add 1 to the notification count, and determine whether the number of failed resends is greater than the default maximum number of retries. If the number of retries exceeds the maximum number of retries, store the event in the final state table and display it on the background management page, waiting for manual processing, and no longer send the notification of the failure.

[0021] Step 2.4: If the number of notifications does not reach the maximum number of notifications, send a transaction success notification to the user again.

[0022] Optionally, in step 2.4: if the sending is successful, the event is stored in the final state table, and the notification process ends successfully; if the notification fails, the next notification time interval array configured in the background calculates the next notification time, and the following processing is performed based on whether the next notification time interval exceeds the preset time:

[0023] According to the current number of failures, the next sending time interval is obtained. If the time interval is within the preset interval, the Kafka event is published to the delay queue and waits for retry;

[0024] If the time interval is longer than the preset interval, the event is packaged and stored in the retrieval database table, waiting for the scheduled task to wake up and try again.

[0025] According to a second aspect of the present invention, there is provided a system for asynchronously notifying payment results based on incremental timing compensation, comprising:

[0026] The business module is used to encapsulate and publish an event notification message after the E-account transaction module receives the order payment result from the core payment platform, so that the order payment result enters the notification process;

[0027] The message notification module is used to process the first notification to the platform merchant after the E-account transaction submodule receives the notification message; before sending the notification message, the maximum number of failures, the time interval between each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; if the first notification fails, it enters the message notification resending processing stage;

[0028] The background management module is used to retrieve the database table through scheduled tasks, find the notification messages to be reissued, and send them to the delayed processing queue for reissue processing; until the reissue is successful or the number of reissue failures reaches the upper limit, manual intervention is performed.

[0029] According to a third aspect of the present invention, there is provided an electronic device comprising a memory and a processor, wherein the processor is configured to implement the steps of the above-mentioned method of asynchronously notifying payment results based on incremental timing compensation when executing a computer program stored in the memory.

[0030] Technical effects and advantages of the present invention:

[0031] The present invention provides a method and system for asynchronously notifying payment results based on incremental timed compensation. Based on Kafka asynchronous notification, multiple topic event isolation processing mechanisms are adopted, such as event_topic event only processes notification events sent by the trade transaction module for the first time; delayed_event_topic event is only used to process the waiting of messages to be sent; retry_event_topic event only processes events of sending notifications again after the first failure. In this way, new transaction notifications will not be blocked by old failed notifications.

[0032] The present invention uses thread waiting and timed tasks to jointly process notification events. Thread waiting can accurately publish the next notification event within 1 minute of the current time. Timed tasks process the next notification event more than 1 minute from the current time, avoiding long-term thread waiting and wasting system resources.

[0033] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a system interaction flow chart of a method for asynchronously notifying payment results based on incremental timing compensation provided by an embodiment of the present invention;

[0035] Figure 2 This is the first flow chart of message notification provided by an embodiment of the present invention;

[0036] Figure 3 The present invention provides a flow chart of the scheduled task reissuance process. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] It should be noted that the embodiments of the present invention are aimed at the technical problem that the merchant platform cannot receive the transaction results notified by the E-account system, or the processing results fed back to the E-account system are not received by the system.

[0039] To this end, the embodiment of the present invention provides a method and system for asynchronously notifying payment results based on incremental timing compensation based on the technical solution of asynchronously notifying payment results.

[0040] In this example, after receiving the payment result notification from the core payment system, the E-account system will publish an event to allow the order result to enter the notification process. If the platform's processing result is not received or the sending fails, the payment result of this order will be stored in the warehouse, waiting to invoke the scheduled task to pull out the compensation notification order that meets the notification conditions. Finally, the next notification time is calculated through the configured notification time interval parameters, and then the merchant is notified and the database is updated; until the feedback of successful processing is received from the platform or the number of notifications exceeds the maximum number of notifications, the time interval adds up to about one day. If the merchant is still notified of the failed order after more than one day, the merchant will no longer be notified. The reconciliation file generated by the reconciliation system will be available for the merchant platform to download after T+1 day for self-reconciliation and synchronization of payment results.

[0041] It can be understood that, based on the defects in the background technology, the embodiment of the present invention provides a method for asynchronously notifying payment results based on incremental timing compensation. The steps of the embodiment of the present invention are as follows: Figure 1 As shown: the method specifically comprises the following steps:

[0042] Step 1: After receiving the order payment result from the core payment platform, the E-account transaction module encapsulates and publishes an event notification message to allow the order payment result to enter the notification process;

[0043] Step 2: After receiving the notification message, the E-account transaction submodule performs the first notification processing on the platform merchant; before sending the notification message, the maximum number of failures, the time interval for each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; if the first notification fails, it enters the message notification resending processing stage; at this time, the scheduled task searches the database table, finds the notification message to be resent, and sends it to the delayed processing queue for resending; until the resending is successful or the number of resending failures reaches the upper limit, manual intervention is performed.

[0044] In step 1 above, the E-account submodule trade receives the final order result from the core payment platform, encapsulates it and publishes the Kafka event event_topic;

[0045] It should be noted that the first notification is handled in the same manner as the Figure 2 After the E-account transaction module receives the order payment result from the core payment platform, it encapsulates and publishes an event notification message to allow the order payment result to enter the notification process, which specifically includes the following steps:

[0046] Step 1.1: After the message notification module sends the first queue event_topic to receive the notification message, set the maximum number of failed sends and the time interval between each send. The default time interval is 0s, 5s, 10s, 2min, 5min, 10min, 30min, 1h, 2h, 6h, 15h; the maximum number of sends is 11 times, and the current number of sends is 1 time.

[0047] Step 1.2: EZT notification sends transaction notification to the merchant. If the notification fails to be sent, it needs to be resent. The current number of times sent is the first time, the time interval is 0s, which is less than the preset time of 1min, and is sent to the delayed processing queue delayed_event_topic of kafka. Among them, the preset time of 1min can be adjusted according to the business volume: when the business volume is small, the preset time can be appropriately extended to reduce the resource consumption of data storage; when the business volume is large, the preset time can be appropriately reduced to prevent the delayed processing queue delayed_event_topic from blocking and timeout, and memory leakage.

[0048] Step 1.3: After the delayed_event_topic queue waits for 0 seconds, it sends the resend notification to the resend queue retry_event_topic for processing and executes the notification resend logic.

[0049] In the above step 2, after receiving the kafka event event_topic, the E-account transaction submodule webhook performs the first notification processing on the platform merchant.

[0050] Before sending a notification message, set the maximum number of failures and the time interval between each sending, and set the number of notifications to 1. If the first notification is sent successfully, the process ends. If the first notification fails, enter the message notification resending processing stage; the scheduled task searches the database table delayed_events every minute, finds the notification message to be resent, and sends it to the delayed processing queue for resending. Until the resending is successful or the number of resending failures reaches the upper limit, manual intervention is required.

[0051] The steps for reissuing notification are the same as Figure 3 , specifically including the following steps:

[0052] Step 2.1: The delayed notification queue delayed_event_topic collects notifications from the first failed notifications and the scheduled task checks the delayed_events table every minute to be sent after 10 seconds to 60 seconds, and sorts these notification messages to be sent in the order of sending time.

[0053] Step 2.2: Consume the delayed notification queue delayed_event_topic in sequence, and the thread waits until the current time is equal to the sending time of the notification message, and then sends the message to be sent to the retry queue retry_event_topic.

[0054] Step 2.3: Consume the delayed_event_topic resend queue, add 1 to the notification count, and determine whether the number of failed resends is greater than the default maximum number of retries of 11. If the number of retries exceeds 11, store the event in the events final state table, display it on the backend management page, wait for manual processing, and no longer send the failed notification;

[0055] Step 2.4: If the number of notifications does not reach the maximum number of notifications, send the transaction success notification to the user again. If the sending is successful, the event is stored in the events final state table, and the notification process ends successfully. If the notification fails, the next notification time is calculated by the next notification time interval array configured in the background. According to whether the next notification time interval exceeds the preset time, the following processing is performed:

[0056] According to the current number of failures, the next sending time interval is obtained. If the time interval is within 1 minute, the Kafka event is published to the delayed_event_topic delay queue to wait for retry;

[0057] If the time interval is longer than 1 minute, the event is packaged and stored in the delayed_events table, waiting for the scheduled task in step 1 to wake up and try again.

[0058] Among them, the maximum number of failed attempts is 11 times, and the corresponding waiting time interval after each failure is 0s, 5s, 10s, 2min, 5min, 10min, 30min, 1h, 2h, 6h, 15h. This value is the default value set when the message notification is sent for the first time.

[0059] In summary, the embodiment of the present invention is based on kafka asynchronous notification and adopts multiple topic event isolation processing mechanisms, such as event_topic event only processes notification events sent by the trade transaction module for the first time; delayed_event_topic event is only used to process the waiting of messages to be sent; retry_event_topic event only processes events of sending notifications again after the first failure. In this way, new transaction notifications will not be blocked by old failed notifications. At the same time, thread waiting and timed tasks are used to jointly process notification events. Thread waiting can accurately publish events within 1 minute of the next notification event from the current time. Timed tasks process events where the next notification event is more than 1 minute away from the current time, avoiding long-term thread waiting and wasting system resources.

[0060] According to a second aspect of the present invention, there is provided a system for asynchronously notifying payment results based on incremental timing compensation, comprising:

[0061] The business module is used to encapsulate and publish an event notification message after the E-account transaction module receives the order payment result from the core payment platform, so that the order payment result enters the notification process;

[0062] The message notification module is used to process the first notification to the platform merchant after the E-account transaction submodule receives the notification message; before sending the notification message, the maximum number of failures, the time interval between each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; if the first notification fails, it enters the message notification resending processing stage;

[0063] The background management module is used to retrieve the database table through scheduled tasks, find the notification messages to be reissued, and send them to the delayed processing queue for reissue processing; until the reissue is successful or the number of reissue failures reaches the upper limit, manual intervention is performed.

[0064] It can be understood that the system of asynchronous notification of payment results based on incremental timing compensation provided by the present invention corresponds to the method of asynchronous notification of payment results based on incremental timing compensation provided in the aforementioned embodiments. The relevant technical features of the system of asynchronous notification of payment results based on incremental timing compensation can refer to the relevant technical features of the method of asynchronous notification of payment results based on incremental timing compensation, which will not be repeated here.

[0065] In addition, an embodiment of the present invention further provides an electronic device, which may include: a processor, a communications interface, a memory, and a communication bus, wherein the processor, the communications interface, and the memory communicate with each other via the communication bus. The processor may call logic instructions in the memory to execute the steps of the above-mentioned method for asynchronously notifying payment results based on incremental timing compensation.

[0066] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.

[0067] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0068] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0069] 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 it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for asynchronously notifying payment results based on incremental timed compensation, It is characterized in that The method comprises the following steps: After receiving the order payment result from the core payment platform, the E-account transaction module encapsulates and publishes an event notification message to allow the order payment result to enter the notification process; After receiving the notification message, the E-account transaction submodule performs the first notification process on the platform merchant; before sending the notification message, the maximum number of failures, the time interval between each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; If the first notification fails, the message notification resending process will begin. At this point, the scheduled task searches the database table to find the notification message to be resent, and sends it to the delayed processing queue for resending. This process continues until the resending succeeds or the number of resending failures reaches the upper limit, at which point manual intervention is performed.

2. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 1, It is characterized in that The E-account transaction module receives the final result of the order from the core payment platform, encapsulates and publishes the Kafka event event_topic.

3. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 2, It is characterized in that After the E-account transaction module receives the order payment result from the core payment platform, it encapsulates and publishes an event notification message to allow the order payment result to enter the notification process, including: Step 1.1: After the message notification module sends the notification message for the first time, the queue sets the maximum number of failed sends and the time interval between each send; Step 1.2: The E-account transaction module notifies the merchant to send a transaction notification; if the notification fails to be sent, it will be reissued; if it is less than the preset time, it will be sent to the delayed processing queue; Step 1.3: After the delay queue waits for the initial default value, the reissue notification is handed over to the reissue queue for processing and the notification reissue logic is executed.

4. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 3, It is characterized in that The maximum number of failed transmissions is 11 times, of which the first transmission is 1 time.

5. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 3, It is characterized in that The time interval for each transmission is set to any of the following: 0s,5s,10s,2min,5min,10min,30min,1h,2h,6h,15h, where 0s is the default value set when the message notification is sent for the first time.

6. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 1, It is characterized in that After receiving the kafka event event_topic, the E-account transaction submodule webhook performs the first notification process on the platform merchant.

7. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 1, It is characterized in that The scheduled task searches the database table to find the notification message to be reissued, and sends it to the delayed processing queue for reissue processing; Until the reissue is successful or the number of reissue failures reaches the upper limit, manual intervention includes: Step 2.1: The delayed notification queue collects notifications from the first failed notifications, as well as the scheduled task that searches the database table every minute for notifications to be sent, and sorts the notification messages to be sent in the order of the sending time; Step 2.2: Consume the delayed notification queue in sequence, and the thread waits until the current time is equal to the sending time of the notification message, and then sends the message to be sent to the resending queue; Step 2.3: Consume the resend queue, add 1 to the notification count, and determine whether the number of failed resends is greater than the default maximum number of retries. If the number of retries exceeds the maximum number of retries, store the event in the final state table and display it on the background management page, waiting for manual processing, and no longer send the notification of the failure. Step 2.4: If the number of notifications does not reach the maximum number of notifications, send a transaction success notification to the user again.

8. A method for asynchronously notifying payment results based on incremental timing compensation according to claim 7, It is characterized in that In step 2.4: If the sending is successful, the event is stored in the final state table, and the notification process is successfully completed; When the notification fails, the next notification time is calculated by the next notification time interval array configured in the background. Depending on whether the next notification time interval exceeds the preset time, the following processing is performed: According to the current number of failures, the next sending time interval is obtained. If the time interval is within the preset interval, the Kafka event is published to the delay queue and waits for retry; If the time interval is longer than the preset interval, the event is packaged and stored in the retrieval database table, waiting for the scheduled task to wake up and try again.

9. A system for asynchronously notifying payment results based on incremental timed compensation, It is characterized in that include: The business module is used to encapsulate and publish an event notification message after the E-account transaction module receives the order payment result from the core payment platform, so that the order payment result enters the notification process; The message notification module is used to process the first notification to the platform merchant after the E-account transaction submodule receives the notification message; before sending the notification message, the maximum number of failures, the time interval between each sending, and the number of notifications are set; if the first notification is sent successfully, the process ends; if the first notification fails, it enters the message notification resending processing stage; The background management module is used to retrieve the database table through scheduled tasks, find the notification messages to be reissued, and send them to the delayed processing queue for reissue processing; until the reissue is successful or the number of reissue failures reaches the upper limit, manual intervention is performed.

10. An electronic device, It is characterized in that It comprises a memory and a processor, wherein the processor is used to implement a method for asynchronously notifying payment results based on incremental timing compensation as described in any one of claims 1 to 8 when executing a computer program stored in the memory.