Share via


CashChanger.DispenseChange Method (POS for .NET v1.14 SDK Documentation)

3/2/2014

Dispenses the specified amount of cash.

Namespace: Microsoft.PointOfService
Assembly: Microsoft.PointOfService (in microsoft.pointofservice.dll)

Syntax

'Declaration
Public MustOverride Sub DispenseChange ( _
    amount As Integer _
)
public abstract void DispenseChange (
    int amount
)
public:
virtual void DispenseChange (
    int amount
) abstract
public abstract void DispenseChange (
    int amount
)
public abstract function DispenseChange (
    amount : int
)

Parameters

  • amount
    Indicates the change to be dispensed.

Remarks

Dispenses the specified amount of cash from the cash changer into the exit represented by CurrentExit.

It is up to the cash changer to determine which combination of bills and coins satisfies the request, based on the current CurrencyCode and the amounts and denominations of coins and bills available.

DispenseChange is performed synchronously if AsyncMode is false, and asynchronously if AsyncMode is true.

DispenseChange can throw general exceptions and PosControlExceptions with the following values in ErrorCode.

Value

Meaning

Busy

The specified change cannot be dispensed because an asynchronous method is in progress.

Illegal

One of the following errors occurred:

  • A negative or zero amount is specified.

  • The amount cannot be dispensed based on the values specified in ExitCashList for the current exit.

  • Change cannot be dispensed because cash acceptance was in progress.

Extended

An extended error has occurred.

The following value may be set in ErrorCodeExtended if P:Microsoft.PointOfService.PosControlException.ErrorCode is Extended.

Value

Meaning

ExtendedErrorOverDispense

The specified cash cannot be dispensed because of a cash shortage.

Example

Given a POS device that offers booklets of stamps for $7.50 in United States currency (USD) and given a deposit of $20, the Cash Changer should then distribute $12.50 in change.

The amount passed to DispenseChange is 1250, representing 1250 in the base US currency unit: in this case, cents.

The supported denominations and cash supply of the device determine the actual form of the change distribution. Given a Cash Changer that can distribute bills in increments of 10-, 5-, or 1-dollars, and coins in 25-, 10- and 5-cent denominations, the actual distribution might be any of the following, given variances in cash amounts in the device:

  • one 10-dollar bill, two 1-dollar bills, and two 25-cent coins

  • two 5-dollar bills and ten 25-cent coins

  • one 5-dollar bill, seven 1-dollar bills, and five 10-cent coins

  • or any other combination of these types of bills and coins that satisfy the request.

If no combination of available bills and coins could satisfy the request, a PosControlException is thrown, with either an Illegal or ExtendedErrorOverDispense error code depending on the reason the change could not be dispensed.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

CashChanger Class
CashChanger Members
Microsoft.PointOfService Namespace
AsyncMode
CurrentExit