Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a class capable of purchasing and selling, with a percentage of available money allocated to it.

interface
template S

The sell parameters for implementing classes.

Type Parameters

  • P

    The purchase parameters for implementing classes.

Hierarchy

  • IPurchaseable

Implemented by

Index

Methods

  • canPurchase(params: P): boolean
  • Checks whether the user can purchase based on parameters params.

    Parameters

    • params: P

      Parameters for this transaction.

    Returns boolean

    Whether this transaction is possible.

  • getAvailableMoney(): number
  • Gets the amount of money available to this store.

    Returns number

    Available money according to specified budget.

  • getPurchaseCost(params: P): number
  • Get cost of purchase with parameters params.

    Parameters

    • params: P

      Parameters for this transaction.

    Returns number

    Cost of the transaction.

  • purchase(params: P): Promise<boolean>
  • Purchase an item with parameters params if there is money available.

    Parameters

    • params: P

      Parameters for this transaction.

    Returns Promise<boolean>

    Whether the transaction was successful.

Generated using TypeDoc