async def METHOD_NAME(client, order_id, invoice_id, currency, amount, success):
    currency = currency.upper()
    transactions = (await client.list_transactions(order_id)).get("transactions", [])
    base_tx = None
    for transaction in transactions:
        if any(x in transaction["gateway"].lower() for x in SHOPIFY_KEYWORDS):
            base_tx = transaction
            break
    if base_tx is None:
        return
    if currency != base_tx["currency"].upper():
        return
    kind = "capture"
    parent_id = base_tx["id"]
    status = "success" if success else "failure"
    txes_on_same_invoice = [tx for tx in transactions if tx["authorization"] == invoice_id]
    successful_txes = [tx for tx in txes_on_same_invoice if tx["status"] == "success"]
    successful_captures = [tx for tx in successful_txes if tx["kind"] == "capture"]
    refunds = [tx for tx in txes_on_same_invoice if tx["kind"] == "refund"]
    # if we are working with a non-success registration, but see that we have previously registered this invoice as a success,
    # we switch to creating a "void" transaction, which in shopify terms is a refund.
    if not success and len(successful_captures) > 0 and len(successful_captures) - len(refunds) > 0:
        kind = "void"
        parent_id = successful_captures[-1]["id"]
        status = "success"
    # if we are working with a success registration, but can see that we have already had a successful transaction saved, exit
    elif success and len(successful_captures) > 0 and len(successful_captures) - len(refunds) > 0:
        return
    await client.create_transaction(
        order_id,
        {
            "transaction": {
                "parent_id": parent_id,
                "currency": currency,
                "amount": currency_table.format_decimal(currency, amount),
                "kind": kind,
                "gateway": "Bitcart",
                "source": "external",
                "authorization": invoice_id,
                "status": status,
            }
        },
    )