[STRIPE] OA Transaction Intent Management System 2025 – 09 Dec

Background:

The system simulates a transaction intent management tool to handle the process from initialization to completion and calculate the final balances of merchants' accounts. Transaction states include:

  • PENDING: The transaction is created and awaiting processing.
  • IN_PROGRESS: The transaction is being processed.
  • DONE: The transaction is completed, and the balance is updated.

Core Features:

  1. START (optional): Initializes a merchant account with an initial balance and an optional refund limit.
  2. NEW: Creates a transaction intent for the specified account with the given amount in the PENDING state.
  3. PROCESS: Moves a transaction from PENDING to IN_PROGRESS.
  4. COMPLETE: Moves a transaction from IN_PROGRESS to DONE and adds the amount to the merchant's balance.

Example:

Input:

START account1 0
NEW txn1 account1 50
PROCESS txn1
COMPLETE txn1

Output:

account1 50

Extended Features:

  1. MODIFY: Updates the amount for a PENDING transaction intent.
  2. CANCEL: Reverts a transaction from IN_PROGRESS to PENDING.
  3. RETURN: Processes a refund for a DONE transaction and deducts the amount from the account's balance.

Example:

Input:

START account1 0
NEW txn1 account1 50
PROCESS txn1
CANCEL txn1
PROCESS txn1
COMPLETE txn1
RETURN txn1

Output:

account1 0

Time-Limited Refunds:

Each command includes a marker indicating the timestamp. Merchants can set a refund time limit; transactions can only be refunded within this limit.

  • If no limit is set, refunds are allowed indefinitely.
  • A limit of 0 means no refunds are allowed.

Example:

Input:

1 START account1 0 5
2 NEW txn1 account1 100
8 COMPLETE txn1
11 RETURN txn1
16 RETURN txn1

Output:

account1 100

Task Objective:

Process a list of commands to manage transaction intents and output the final balances of all accounts.

Input Format:

A time-ordered list of commands.

Output Format:

A list of account balances in ascending order by account ID.

Output Example:

["account1 50", "account2 100"]


我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *