p11
    Preparing search index...

    Function validateAndProcessGoods

    • This function validates the goods and processes them according to the transaction type.

      Parameters

      • goods: { amount: number; name: string }[]

        Array of goods to be processed

      • type: "Buy" | "Sell"

        Transaction type (Buy or Sell)

      Returns Promise<{ newGoods: any[]; totalValue: number }>

      • Array of new goods and total value of the transaction
      • Error if there is an issue processing the goods