Distributed transaction processing method and device for financial transaction

By using a dynamic state machine to modify the transaction status field of the authorization list in real time in the credit card financial transaction system and generate a transaction status snapshot, the problem of incomplete transaction status records in the existing technology is solved, and accurate backtracking and auditing of transaction status is achieved , improves the reliability of the system.

CN119494724APending Publication Date: 2025-02-21AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411743605.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-30
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

The existing technology lacks complete records of the transaction status of credit card financial transactions and effective cross-microservice transaction management, resulting in insufficient information during transaction auditing and backtracking, affecting the reliability of the system and data audit capabilities.

Method used

By detecting the distributed transactions of credit cards, they obtain their basic information and distributed transaction transaction information, use dynamic state machines to modify the transaction status fields in the authorization list in real time, and generate and store transaction status snapshots to achieve a complete record of transaction status and Cross-microservice transaction management.

Benefits of technology

It realizes the complete record of the detailed status of credit card financial transactions, ensures accurate traceability and audit of transaction status, and improves the reliability of the system and data management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494724A_ABST
    Figure CN119494724A_ABST
Patent Text Reader

Abstract

The invention provides a distributed transaction processing method and device for financial transactions, and the method comprises the steps: obtaining the basic information of a credit card and distributed transaction transaction information corresponding to a distributed transaction when detecting that the credit card carries out the distributed transaction; using a dynamic state machine to modify a transaction state field corresponding to the credit card in the authorization detail list in real time based on the basic information and the distributed transaction transaction information to obtain a new authorization detail list; and generating a snapshot in real time according to the new authorization detail list and storing the snapshot in a database. According to the credit card distributed financial transaction design based on the authorization flow table, the consistency of distributed transactions can be effectively ensured on the application level by ingeniously associating the component state of the distributed transaction technical scheme with the business logic. By means of the design, the completion condition of the transaction can be inquired in real time, overall transaction troubleshooting is facilitated, the current state snapshot of the financial transaction can be generated, and accurate transaction state backtracking is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial transactions, and in particular to a distributed transaction processing method and device for financial transactions. Background Art

[0002] As banking systems migrate from mainframe platforms to distributed microservice architectures, credit card transaction businesses are gradually split into multiple microservice units. These microservices complete complex business logic through combined calls and rely on different data sources for operations.

[0003] Credit card financial transactions need to consider the consistency of distributed transaction data. However, the current transaction flow table of credit card financial transactions only records basic transaction information, such as card number and account number, and does not save transaction status snapshots. This makes it impossible to accurately restore the detailed status of the transaction when it is necessary to trace back the transaction history.

[0004] Based on this, the main problem of the existing technology is the lack of complete records of transaction status and effective cross-microservice transaction management. For some non-financial transactions, the system does not save enough operation logs, or the record retention time is short, which leads to insufficient information during transaction auditing and backtracking, affecting the reliability of the system and data auditing capabilities. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a distributed transaction processing method and device for financial transactions to solve the problem that the detailed status of current transactions is difficult to fully record.

[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0007] A first aspect of the present invention discloses a distributed transaction processing method for financial transactions, the method comprising:

[0008] When a distributed transaction is detected by a credit card, basic information of the credit card and distributed transaction information corresponding to the distributed transaction are obtained;

[0009] Using a dynamic state machine to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information, a new authorization details table is obtained; the authorization details table stores basic information of multiple credit cards, and the basic information includes transaction information and account information;

[0010] A snapshot is generated in real time according to the new authorization details table and stored in the database.

[0011] Preferably, the use of a dynamic state machine to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information to obtain a new authorization details table includes:

[0012] Using a dynamic state machine to update the basic information of the credit card in the authorization details table according to the basic information, and extracting the transaction type in the distributed transaction information;

[0013] According to the transaction type and the distributed transaction information, the transaction status field corresponding to the credit card in the authorization list is modified in real time to obtain a new authorization list.

[0014] Preferably, the transaction type is a SAGA transaction, and the transaction status field corresponding to the credit card in the authorization list is modified in real time according to the transaction type and the distributed transaction information to obtain a new authorization list, including:

[0015] According to the SAGA transaction, the transaction status field corresponding to the credit card in the authorization details table is initialized to 000;

[0016] When the positive transaction information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001 to obtain a new authorization details table;

[0017] When the positive transaction information in the distributed transaction information indicates that the transaction is successful, storing the distributed transaction information in the authorization details table;

[0018] If the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction, the transaction status field is modified to 300 to obtain a new authorization details table;

[0019] If the distributed transaction information indicates that the distributed transaction is successful and triggers an account-erasing transaction, the transaction status field is modified to 100 to obtain a new authorization details table;

[0020] If the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction, the transaction status field is modified to 200 to obtain a new authorization details table.

[0021] Preferably, the transaction type is a TCC transaction, and the transaction status field corresponding to the credit card in the authorization list is modified in real time according to the transaction type and the distributed transaction information to obtain a new authorization list, including:

[0022] According to the TCC transaction, the transaction status field corresponding to the credit card in the authorization details table is initialized to 000;

[0023] When the attempt phase information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001 to obtain a new authorization details table;

[0024] When the attempt phase information in the distributed transaction information indicates that the transaction is successful, the transaction status field is modified to 010 to obtain a new authorization details table;

[0025] If the attempt phase information in the distributed transaction information indicates that the transaction is successful, and the distributed transaction information indicates that the confirmation phase is triggered, the distributed transaction information is added to the authorization details table, and the transaction status field is modified to 020 to obtain a new authorization details table;

[0026] If the attempt phase information in the distributed transaction information indicates that the transaction has failed, and the distributed transaction information indicates that the cancellation phase has been triggered, the transaction status field is modified to 030 to obtain a new authorization details table.

[0027] Preferably, the method further comprises:

[0028] When an exception query request is received, basic information of the credit card and distributed transaction information corresponding to the exception query request are obtained and displayed from the new authorization details table.

[0029] A second aspect of the present invention discloses a distributed transaction processing device for financial transactions, the device comprising:

[0030] An acquisition unit, configured to acquire basic information of the credit card and distributed transaction information corresponding to the distributed transaction when it is detected that a credit card is conducting a distributed transaction;

[0031] A modification unit, configured to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information using a dynamic state machine to obtain a new authorization details table; the authorization details table stores basic information of multiple credit cards, the basic information including transaction information and account information;

[0032] The storage unit is used to generate a snapshot in real time according to the new authorization details table and store it in a database.

[0033] Preferably, the modification unit comprises:

[0034] An updating module, used to update the basic information of the credit card in the authorization details table according to the basic information using a dynamic state machine, and extract the transaction type in the distributed transaction information;

[0035] The modification module is used to modify the transaction status field corresponding to the credit card in the authorization list in real time according to the transaction type and the distributed transaction information to obtain a new authorization list.

[0036] Preferably, the transaction type is a SAGA transaction, and the modification module includes:

[0037] A first initialization submodule, configured to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the SAGA transaction;

[0038] A first modification submodule is used to modify the transaction status field to 001 to obtain a new authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction has failed;

[0039] A storage submodule, configured to store the distributed transaction information into the authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction is successful;

[0040] A second modification submodule is used to modify the transaction status field to 300 to obtain a new authorization details table if the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction;

[0041] The third modification submodule is used to modify the transaction status field to 100 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers an account-erasing transaction;

[0042] The fourth modification submodule is used to modify the transaction status field to 200 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction.

[0043] Preferably, the transaction type is a TCC transaction, and the modification module includes:

[0044] A second initialization submodule is used to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the TCC transaction;

[0045] A fifth modification submodule, configured to modify the transaction status field to 001 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction has failed;

[0046] A sixth modification submodule, configured to modify the transaction status field to 010 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction is successful;

[0047] A seventh modification submodule is used for adding the distributed transaction information to the authorization details table and modifying the transaction status field to 020 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction is successful and the distributed transaction information indicates that the confirmation phase is triggered;

[0048] The eighth modification submodule is used to modify the transaction status field to 030 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction has failed and the distributed transaction information indicates that the cancellation phase has been triggered.

[0049] Preferably, the device further comprises:

[0050] The display unit is used to obtain and display the basic information of the credit card and the distributed transaction information corresponding to the query exception request from the new authorization details table when receiving the query exception request.

[0051] Based on the above-mentioned embodiment of the present invention, a distributed transaction processing method and device for financial transactions are provided. When a credit card is detected to be conducting a distributed transaction, the basic information of the credit card and the distributed transaction transaction information corresponding to the distributed transaction are obtained; the transaction status field corresponding to the credit card in the authorization details table is modified in real time based on the basic information and the distributed transaction transaction information by using a dynamic state machine to obtain a new authorization details table; a snapshot is generated in real time according to the new authorization details table and stored in the database. This method is based on the design of distributed financial transactions for credit cards based on the authorization flow table. By cleverly associating the status of the components of the distributed transaction technology solution with the business logic, the consistency of distributed transactions can be effectively guaranteed at the application level. This design can not only query the completion status of transactions in real time, which is convenient for global transaction troubleshooting, but also generate a snapshot of the current status of financial transactions to achieve accurate transaction status backtracking. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0053] Figure 1 A schematic diagram of a distributed scenario across microservices provided by an embodiment of the present invention;

[0054] Figure 2 A flowchart of a distributed transaction processing method for financial transactions provided by an embodiment of the present invention;

[0055] Figure 3A schematic diagram of the composition and workflow of the SAGA model provided in an embodiment of the present invention;

[0056] Figure 4 A schematic diagram of the composition and workflow of the TCC mode provided in an embodiment of the present invention;

[0057] Figure 5 A first schematic diagram of a transaction status field in a real-time modification authorization details table provided by an embodiment of the present invention;

[0058] Figure 6 A second schematic diagram of a transaction status field in a real-time modification authorization details table provided by an embodiment of the present invention;

[0059] Figure 7 A structural block diagram of a distributed transaction processing device for financial transactions provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0061] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0062] As can be seen from the background technology, as the banking system migrates from the host platform to the distributed microservice architecture, the credit card transaction business is gradually split into multiple microservice units. Figure 1 As shown in , these microservices (such as microservice 1 and microservice 2) complete complex business logic through combined calls and rely on different data sources (such as database A, database B, and database C) for operations. Therefore, in order to ensure data consistency across microservices in a distributed system, it is necessary to introduce distributed transactions to manage database operations. However, the current transaction flow table for credit card financial transactions lacks a complete record of transaction status and effective cross-microservice transaction management.

[0063] Therefore, an embodiment of the present invention provides a distributed transaction processing method and device for financial transactions. When a credit card is detected to be conducting a distributed transaction, the basic information of the credit card and the distributed transaction transaction information corresponding to the distributed transaction are obtained; a dynamic state machine is used to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction transaction information to obtain a new authorization details table; a snapshot is generated in real time according to the new authorization details table and stored in a database. This method is based on the design of distributed financial transactions for credit cards based on the authorization flow table. By cleverly associating the status of the components of the distributed transaction technology solution with the business logic, the consistency of distributed transactions can be effectively guaranteed at the application level. This design can not only query the completion status of transactions in real time, which is convenient for global transaction troubleshooting, but also generate a snapshot of the current status of financial transactions to achieve accurate transaction status backtracking.

[0064] See also Figure 2 , showing a flow chart of a distributed transaction processing method for financial transactions provided by an embodiment of the present invention.

[0065] It should be noted that, similar to traditional local transactions, distributed transactions are also composed of a series of operations, but these operations (i.e., branch transactions) are executed on multiple microservices. In addition to ensuring that each branch transaction meets the ACID characteristics, distributed transactions also need to coordinate the branch transactions to decide whether they are committed or rolled back to ensure the data consistency of the global transaction. Common distributed transaction solutions include the SAGA mode and the TCC mode. Figure 3 and Figure 4 The SAGA mode and TCC mode are introduced in the content.

[0066] Specifically, the SAGA model distributed transaction is a compensatory distributed transaction. Its core idea is to split the global transaction into multiple atomic branch transactions executed on microservices and coordinated by the SAGA transaction coordinator. When an exception occurs during the transaction execution, the transaction is rolled back through the compensation mechanism. Specifically, Figure 3 As shown in Figure 2, a complete SAGA transaction consists of multiple ordered branch transactions. Each branch transaction has a forward execution method T i and a corresponding compensation method C i , and each method is idempotent, that is, no matter whether the request is executed once or multiple times, the result is always consistent.

[0067] It is understandable that during the execution of a SAGA transaction, the SAGA transaction coordinator will call T1, T2, ..., T nIf all branch transactions are completed normally, the global transaction is considered successful. If an exception occurs when executing the i-th branch transaction, decide whether to retry forward or compensate backward based on business needs. Forward retry means retrying to call the forward method T i , and backward compensation is from C i-1 At the beginning, the compensation method is called in sequence to roll back the completed transaction and restore it to the original state. It should be noted that the forward branch transaction T in the SAGA transaction i and reverse compensation transaction C i Both directly operate on business data, which may lead to insufficient isolation between transactions.

[0068] Specifically, the TCC (Try-Confirm-Cancel) mode divides distributed transactions into two phases: the first phase is the Try operation, which is responsible for checking and reserving resources; the second phase is the Confirm operation or the Cancel operation, which is responsible for committing or rolling back the operations in the first phase. Figure 4 As shown, a complete TCC transaction consists of multiple branch transactions, and each branch transaction has three methods: Try, Confirm, and Cancel.

[0069] It is understandable that during the execution of a TCC transaction, the TCC transaction coordinator first calls the Try method of each branch transaction in turn to ensure that each branch transaction checks and reserves the resources it needs, such as querying the status, freezing the required balance, etc., and returns the execution result. If the Try methods of all branch transactions are completed successfully, it is considered that the global transaction can continue to be executed, and then the Confirm method of each branch transaction is called to formally execute the business logic and operate on the business data. If an exception occurs in the Try method of any branch transaction, it means that the global transaction cannot be completed. At this time, the coordinator will call the Cancel method of each branch transaction to roll back and release the previously reserved resources.

[0070] The authorization details table proposed by this method can be applied to both SAGA mode and TCC mode. The method includes:

[0071] Step S201: When it is detected that a credit card is conducting a distributed transaction, basic information of the credit card and distributed transaction transaction information corresponding to the distributed transaction are obtained.

[0072] In the specific implementation of step S201, when it is detected in real time that a credit card is conducting a distributed transaction, basic information of the credit card and distributed transaction transaction information corresponding to the distributed transaction are obtained.

[0073] It should be noted that the distributed transaction information includes the transaction type of the current distributed transaction, such as SAGA type and TCC type.

[0074] It is understandable that in a distributed transaction processing transaction system, real-time detection and acquisition of basic credit card information and distributed transaction information is the key to ensuring transaction security and consistency. Real-time detection and data capture of the transaction process can be achieved through payment gateways, distributed transaction management, database queries, event streams, and other methods.

[0075] Step S202: Using the dynamic state machine to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information, a new authorization details table is obtained.

[0076] It should be noted that the authorization details table is mainly responsible for recording transaction input, card account related information before and after the transaction, and transaction status. Among them, the transaction status and success or failure are mainly reflected in the transaction status field.

[0077] Specifically, the authorization details table stores basic information of multiple credit cards, where the basic information includes transaction information and account information. Transaction information includes, but is not limited to, the credit card number, transaction date, transaction log number, transaction code, external request serial number, management account number, transaction timestamp, transaction processing code, transaction amount, etc. Account information includes, but is not limited to, transaction card medium type, transaction card activation status, new card validity period, old card validity period, account debit balance (before account activation), account credit balance (before account activation), account debit balance (after account activation), account credit balance (after account activation), available balance after transaction, etc.

[0078] It can be understood that the transaction status field consists of a three-bit mask field, each of which represents:

[0079] Bit 1: SAGA transaction status flag: 0-normal, 1-erased, 2-cancelled, 3-compensated;

[0080] Bit 2: TCC status flag: 0-non-TCC, 1-Tried, 2-Confirmed, 3-Cancelled;

[0081] Bit 3: Transaction return status flag: 0-success, 1-failure.

[0082] In the process of implementing step S202, a dynamic state machine is used to update the basic information of the credit card in the authorization details list according to the basic information, and extract the transaction type (including SAGA type and TCC type) in the distributed transaction information; according to the transaction type and distributed transaction information, the transaction status field corresponding to the credit card in the authorization details list is modified in real time to obtain a new authorization details list.

[0083] It is understood that the specific process of real-time modification of the transaction status field in the authorization details table is detailed in the embodiment of the present invention. Figure 5 and Figure 6 The content in.

[0084] See also Figure 5 In the processes A1 to A6 shown, for a SAGA transaction type, the transaction is divided into a positive transaction phase and a compensation transaction phase.

[0085] Process A1: According to the SAGA transaction, initialize the transaction status field corresponding to the credit card in the authorization details table to 000 (such as Figure 5 The initial state is shown as 000).

[0086] Process A2: When the positive transaction information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001, and a new authorization details table (such as Figure 5 Failure state 001 is shown).

[0087] Process A3: When the positive transaction information in the distributed transaction information indicates that the transaction is successful, the distributed transaction information is stored in the authorization details table (such as Figure 5 Success state shown (000).

[0088] Process A4: If the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction, the transaction status field is modified to 300 to obtain a new authorization details table.

[0089] That is to say, after the main transaction phase is successful, if the subsequent branch transaction of the main transaction fails, the SAGA transaction coordinator triggers a compensation transaction. The compensation transaction phase reads the authorization flow previously stored in the authorization details table, and modifies the transaction status field to 300 to obtain a new authorization details table (such as Figure 5 Compensated state 300 is shown).

[0090] Process A5: If the distributed transaction information indicates that the distributed transaction is successful and triggers the account-erasing transaction, the transaction status field is modified to 100 to obtain a new authorization details table.

[0091] It is understandable that if an account deletion transaction is initiated after the positive transaction phase, the transaction status field is modified to 100, and a new authorization details table is obtained (such as Figure 5 The erased account status is shown as 100).

[0092] Process A6: If the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction, the transaction status field is modified to 200 and a new authorization details table is obtained.

[0093] It is understandable that if a cancellation transaction is initiated after the positive transaction phase, the transaction status field is modified to 200, and a new authorization details table is obtained (such as Figure 5 As shown in the revoked state 200).

[0094] It should be noted that after the transaction is erased or revoked, if the subsequent branch transaction fails and compensation is initiated, the transaction flow in the authorization details table is still read and the transaction status field is modified to 000 (such as Figure 5 Success state shown (000).

[0095] See also Figure 6 In the process B1 to process B5 shown, for a transaction type of TCC type, the transaction is divided into a TRY phase, a CONFIRM phase, and a CANCEL phase.

[0096] Process B1: According to the TCC transaction, the transaction status field corresponding to the credit card in the authorization details table is initialized to 000 (such as Figure 6 The initial state is shown as 000).

[0097] Process B2: When the attempt phase information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001 to obtain a new authorization details table.

[0098] It should be noted that the TRY stage only determines whether the transaction input is correct and whether the account limit can be occupied, but does not actually record the transaction. If the TRY stage fails to occupy the account, the transaction status field is modified to 001, and a new authorization details table is obtained (such as Figure 6 Failure state 001 is shown).

[0099] Process B3: When the attempt phase information in the distributed transaction information indicates that the transaction is successful, the transaction status field is modified to 010 to obtain a new authorization details table.

[0100] It should be noted that if the TRY phase is occupied successfully, the transaction status field is modified to 010, and a new authorization details table is obtained (such as Figure 6 The first stage is shown. Try state 010).

[0101] Process B4: If the attempt phase information in the distributed transaction information indicates that the transaction is successful, and the distributed transaction information indicates that the confirmation phase is triggered, the distributed transaction information is added to the authorization details table, and the transaction status field is modified to 020 to obtain a new authorization details table.

[0102] It is understandable that after the TRY phase, the TCC transaction coordinator determines whether all branch transactions are TRY successful. If so, the CONFIRM phase is triggered. In the confirmation phase, the flow in the authorization details table is read, and the transaction status field is modified to 020. The actual account entry operation is performed to obtain a new authorization details table (such as Figure 6 Second-order-CONFIRM state 020) is shown.

[0103] Process B5: If the attempt phase information in the distributed transaction information indicates that the transaction has failed, and the distributed transaction information indicates that the cancellation phase has been triggered, the transaction status field is modified to 030 to obtain a new authorization details table.

[0104] It is understandable that after the TRY phase ends, if the TCC transaction coordinator determines that all branch transactions are TRY successful, the CANCEL phase is triggered. In the cancel phase, the flow in the authorization details table is read, the basic information of the current credit card is restored to the content before the TRY phase is executed, and the transaction status field is modified to 030. Figure 6 Second-order-CANCEL state 030) is shown.

[0105] Step S203: Generate a snapshot in real time based on the new authorization details table and store it in the database.

[0106] It is understandable that the practice of generating snapshots in real time and storing them in the database can effectively ensure data consistency, reduce business risks, and provide historical data traceability and auditing functions. Through snapshots, data can be quickly restored in the event of a system failure, support operation isolation in a high-concurrency environment, and improve query performance and data analysis capabilities. Snapshots also facilitate version management and rollback operations, ensuring that the system can be quickly restored when problems occur and reducing the impact of errors. In general, the snapshot mechanism improves the stability, flexibility, and data management efficiency of the system.

[0107] In some specific embodiments, when a query exception request is received, basic information of the credit card and distributed transaction information corresponding to the query exception request are obtained and displayed from a new authorization details table.

[0108] Specifically, when an abnormal query request is received, the basic information of the credit card and distributed transaction information corresponding to the abnormal query request is obtained and displayed from the new authorization details table. By displaying this information, the system can help analyze whether there are abnormal transaction patterns, such as frequent transactions or abnormal amounts, and provide processing suggestions or trigger risk monitoring mechanisms based on the analysis results, further ensuring transaction security and system stability.

[0109] In the embodiment of the present invention, the credit card distributed financial transaction design based on the authorization flow table can effectively ensure the consistency of distributed transactions at the application level by cleverly associating the status of the distributed transaction technology solution components with the business logic. This design can not only query the completion status of the transaction in real time, which is convenient for global transaction troubleshooting, but also generate a snapshot of the current status of the financial transaction to achieve accurate transaction status backtracking. In addition, by associating the branch transaction status and business logic, the system can ensure the consistency of the transaction status of each branch in the distributed financial transaction, thereby greatly improving the reliability and traceability of transaction management.

[0110] Corresponding to the distributed transaction processing method for financial transactions disclosed in the above embodiment of the present invention, see Figure 7 , shows a structural block diagram of a distributed transaction processing device for financial transactions provided by an embodiment of the present invention. The device includes: an acquisition unit 701, a modification unit 702 and a storage unit 703.

[0111] The acquisition unit 701 is used to acquire basic information of the credit card and distributed transaction information corresponding to the distributed transaction when it is detected that a credit card is conducting a distributed transaction.

[0112] The modification unit 702 is used to utilize a dynamic state machine to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and distributed transaction information to obtain a new authorization details table; the authorization details table stores the basic information of multiple credit cards, and the basic information includes transaction information and account information.

[0113] The storage unit 703 is used to generate a snapshot in real time according to the new authorization details table and store it in the database.

[0114] In the embodiment of the present invention, the credit card distributed financial transaction design based on the authorization flow table can effectively ensure the consistency of distributed transactions at the application level by cleverly associating the status of the distributed transaction technology solution components with the business logic. This design can not only query the completion status of the transaction in real time, which is convenient for global transaction troubleshooting, but also generate a snapshot of the current status of the financial transaction to achieve accurate transaction status backtracking. In addition, by associating the branch transaction status and business logic, the system can ensure the consistency of the transaction status of each branch in the distributed financial transaction, thereby greatly improving the reliability and traceability of transaction management.

[0115] Combination Figure 7 As shown in the content, the modification unit 702 includes: an update module and a modification module.

[0116] The update module is used to update the basic information of the credit card in the authorization details table according to the basic information using the dynamic state machine, and extract the transaction type in the distributed transaction information.

[0117] The modification module is used to modify the transaction status field corresponding to the credit card in the authorization details table in real time according to the transaction type and distributed transaction information to obtain a new authorization details table.

[0118] Combination Figure 7 The content shown, the transaction type is SAGA transaction, the modification module includes: a first initialization submodule, a first modification submodule, a storage submodule, a second modification submodule, a third modification submodule and a fourth modification submodule.

[0119] The first initialization submodule is used to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the SAGA transaction.

[0120] The first modification submodule is used to modify the transaction status field to 001 to obtain a new authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction has failed.

[0121] The storage submodule is used to store the distributed transaction information into the authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction is successful.

[0122] The second modification submodule is used to modify the transaction status field to 300 to obtain a new authorization details table if the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction.

[0123] The third modification submodule is used to modify the transaction status field to 100 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers the account deletion transaction.

[0124] The fourth modification submodule is used to modify the transaction status field to 200 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction.

[0125] Combination Figure 7 The content shown, the transaction type is TCC transaction, the modification module includes: a second initialization submodule, a fifth modification submodule, a sixth modification submodule, a seventh modification submodule and an eighth modification submodule.

[0126] The second initialization submodule is used to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the TCC transaction.

[0127] The fifth modification submodule is used to modify the transaction status field to 001 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction has failed.

[0128] The sixth modification submodule is used to modify the transaction status field to 010 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction is successful.

[0129] The seventh modification submodule is used to add the distributed transaction information to the authorization details table and modify the transaction status field to 020 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction is successful and the distributed transaction information indicates that the confirmation phase is triggered.

[0130] The eighth modification submodule is used to modify the transaction status field to 030 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction has failed and the distributed transaction information indicates that the cancellation phase has been triggered.

[0131] Combination Figure 7 As shown, the device also includes: a display unit, which is used to obtain and display the basic information of the credit card and distributed transaction information corresponding to the query exception request from the new authorization details table when receiving the query exception request.

[0132] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0133] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0134] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A distributed transaction processing method for financial transactions, characterized in that: The method comprises: When a distributed transaction is detected by a credit card, basic information of the credit card and distributed transaction information corresponding to the distributed transaction are obtained; Using a dynamic state machine to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information, a new authorization details table is obtained; the authorization details table stores basic information of multiple credit cards, and the basic information includes transaction information and account information; A snapshot is generated in real time according to the new authorization details table and stored in the database.

2. The method according to claim 1, characterized in that The dynamic state machine is used to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information to obtain a new authorization details table, including: Using a dynamic state machine to update the basic information of the credit card in the authorization details table according to the basic information, and extracting the transaction type in the distributed transaction information; According to the transaction type and the distributed transaction information, the transaction status field corresponding to the credit card in the authorization list is modified in real time to obtain a new authorization list.

3. The method according to claim 2, characterized in that The transaction type is a SAGA transaction. According to the transaction type and the distributed transaction information, the transaction status field corresponding to the credit card in the authorization list is modified in real time to obtain a new authorization list, including: According to the SAGA transaction, the transaction status field corresponding to the credit card in the authorization details table is initialized to 000; When the positive transaction information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001 to obtain a new authorization details table; When the positive transaction information in the distributed transaction information indicates that the transaction is successful, storing the distributed transaction information in the authorization details table; If the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction, the transaction status field is modified to 300 to obtain a new authorization details table; If the distributed transaction information indicates that the distributed transaction is successful and triggers an account-erasing transaction, the transaction status field is modified to 100 to obtain a new authorization details table; If the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction, the transaction status field is modified to 200 to obtain a new authorization details table.

4. The method according to claim 2, characterized in that: The transaction type is a TCC transaction. According to the transaction type and the distributed transaction information, the transaction status field corresponding to the credit card in the authorization list is modified in real time to obtain a new authorization list, including: According to the TCC transaction, the transaction status field corresponding to the credit card in the authorization details table is initialized to 000; When the attempt phase information in the distributed transaction information indicates that the transaction has failed, the transaction status field is modified to 001 to obtain a new authorization details table; When the attempt phase information in the distributed transaction information indicates that the transaction is successful, the transaction status field is modified to 010 to obtain a new authorization details table; If the attempt phase information in the distributed transaction information indicates that the transaction is successful, and the distributed transaction information indicates that the confirmation phase is triggered, the distributed transaction information is added to the authorization details table, and the transaction status field is modified to 020 to obtain a new authorization details table; If the attempt phase information in the distributed transaction information indicates that the transaction has failed, and the distributed transaction information indicates that the cancellation phase has been triggered, the transaction status field is modified to 030 to obtain a new authorization details table.

5. The method according to claim 1, characterized in that The method further comprises: When an exception query request is received, basic information of the credit card and distributed transaction information corresponding to the exception query request are obtained and displayed from the new authorization details table.

6. A distributed transaction processing device for financial transactions, characterized in that: The device comprises: An acquisition unit, configured to acquire basic information of the credit card and distributed transaction information corresponding to the distributed transaction when a distributed transaction is detected. A modification unit, configured to modify the transaction status field corresponding to the credit card in the authorization details table in real time based on the basic information and the distributed transaction information using a dynamic state machine to obtain a new authorization details table; the authorization details table stores basic information of multiple credit cards, the basic information including transaction information and account information; The storage unit is used to generate a snapshot in real time according to the new authorization details table and store it in a database.

7. The device according to claim 6, characterized in that The modification unit comprises: An updating module, used for updating the basic information of the credit card in the authorization details table according to the basic information by using a dynamic state machine, and extracting the transaction type in the distributed transaction information; The modification module is used to modify the transaction status field corresponding to the credit card in the authorization list in real time according to the transaction type and the distributed transaction information to obtain a new authorization list.

8. The device according to claim 7, characterized in that The transaction type is a SAGA transaction, and the modification module includes: A first initialization submodule, configured to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the SAGA transaction; A first modification submodule is used to modify the transaction status field to 001 to obtain a new authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction has failed; A storage submodule, configured to store the distributed transaction information into the authorization details table when the positive transaction information in the distributed transaction information indicates that the transaction is successful; A second modification submodule is used to modify the transaction status field to 300 to obtain a new authorization details table if the distributed transaction information indicates that the next distributed transaction of the current transaction fails and triggers a compensation transaction; The third modification submodule is used to modify the transaction status field to 100 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers an account-erasing transaction; The fourth modification submodule is used to modify the transaction status field to 200 to obtain a new authorization details table if the distributed transaction information indicates that the distributed transaction is successful and triggers the cancellation of the transaction.

9. The device according to claim 7, characterized in that The transaction type is a TCC transaction, and the modification module includes: A second initialization submodule is used to initialize the transaction status field corresponding to the credit card in the authorization details table to 000 according to the TCC transaction; A fifth modification submodule, configured to modify the transaction status field to 001 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction has failed; A sixth modification submodule, configured to modify the transaction status field to 010 to obtain a new authorization details table when the attempt phase information in the distributed transaction information indicates that the transaction is successful; A seventh modification submodule is used for adding the distributed transaction information to the authorization details table and modifying the transaction status field to 020 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction is successful and the distributed transaction information indicates that the confirmation phase is triggered; The eighth modification submodule is used to modify the transaction status field to 030 to obtain a new authorization details table if the attempt phase information in the distributed transaction information indicates that the transaction has failed and the distributed transaction information indicates that the cancellation phase has been triggered.

10. The device according to claim 6, characterized in that The device also includes: The display unit is used to obtain and display the basic information of the credit card and the distributed transaction information corresponding to the query exception request from the new authorization details table when receiving the query exception request.