This documentation describes implementation of the MintChip API on the Microsoft .NET platform.

The public interfaces and classes that define the .NET API for MintChip are contained in the Mint.MintChip.Contract namespace. The following class diagram illustrates these interfaces and classes.

MintChip API Class Diagram

The main interface of the API is the IMintChip. It is responsible for supporting the following MintChip functionality:

  • Processing credit transactions by loading the Value Messages and incrementing the chip’s balance.
  • Processing debit transactions by creating the Value Messages and decrementing the chip’s balance.
  • Reading the transaction log and returning a collection of debit or credit transaction records.
  • Providing the chip’s status, which consists of the data that may change over the chip’s life time: the balance, the maximum allowed debit and credit amounts, current and remaining numbers of the transaction records.
  • Providing the chip’s properties, which consist of the data that never changes since the chip’s initialization: the ID, the currency code, the public certificate and the chip version.

The rest of the interfaces and classes depicted in the above class diagram are designed to work with the IMintChip interface in support of the above listed functions.

MintChip .NET API Usage

A typical approach to using the MintChip .NET API in a .NET application involves the following steps:

  • Reference the following assemblies:
    • Mint.MintChip.Api
    • Mint.MintChip.Contract
    • Mint.MintChip.Core

  • Import types defined in the following namespaces:
    CopyC#
    using Mint.MintChip.Api;
    using Mint.MintChip.Contract;

  • Use Mint.MintChip.Api.MintChipFactory to instantiate a class that implements the IMintChip interface, which is the main interface to invoke the MintChip functionality:

    CopyC#
    IMintChip mintChip = MintChipFactory.Instance.CreateMintChip();


  • Use Mint.MintChip.Api.MessageFactory to instantiate message types:

    CopyC#
    IValueRequestMessage request = MessageFactory.Instance.CreateValueRequestMessage(mintChipId, amount, CurrencyCode.CAD);


  • Call methods of the IMintChip interface and be prepared to handle the MintChipException:
    CopyC#
    try 
    {
        IValueMessage valueMessage = mintChip.CreateValueMessage(request);
    } 
    catch (MintChipException ex) 
    {
        // TODO Handle the exception
    }

Namespaces

NamespaceDescription
Mint.MintChip.Api
The Mint.MintChip.Api namespace contains classes that implement the MintChip functionality on the Windows platform.
It provides two main public factory classes:
  • MintChipFactory - class responsible for instantiating a concrete implementation of the IMintChip for the Windows.
  • MessageFactory - class responsible for instantiating MintChip message types.
Mint.MintChip.Contract

The Mint.MintChip.Contract namespace contains public interfaces and classes that define the MintChip API on the Microsoft .NET platform.

Mint.MintChip.Core
The Mint.MintChip.Core namespace includes .NET interfaces and classes that provide core implementation of the MintChip public API. This namespace is intended to be used to implement a full set of the MintChip public API for a specific platform. For example, for Windows 7 platform.

This namespace includes two abstract classes that should be inherited by the concrete classes in a specific implementation:
  • MintChipFactory – class responsible for instantiating a concrete implementation of the IMintChip interface
  • MessageFactory - class responsible for instantiating MintChip message types