Skip to content

Latest commit

 

History

History
112 lines (76 loc) · 3.22 KB

SPEC.md

File metadata and controls

112 lines (76 loc) · 3.22 KB

Data File Format Specification

Aspect Detail
Version 0.5
Written by GochoMugo [email protected]

The data used in the application in its computations is fed through data files placed in this directory. This allows the application logic code remain independent of the different networks available.

spec:

The data files are written in JSON format.

Network

A single data file can only hold one Network object.

Key Type Description
name Name Name of the Network
meta Metadata Metadata associated with the network
transactions [Transaction] Transactions supported by the network
ussd_codes [USSDCode] The available shortcodes

Metadata

Key Type Description
spec String Specification version the file adheres to
date_updated Date Date on which the data was last updated
url String A valid URL to the network's homepage, preferably to the page concerning money transactions

Transaction

Key Type Description
name Name Type of the transaction
classes [Class] The different classes of the transaction
amount_input boolean false if an amount, as input to the transaction, is not applicable. Defaults to true.

Class

Key Type Description
name Name Name of the class of the transaction
ranges [Range] The ranges in the transaction class
amount Cost Amount charged to the user. This should be provided only if parent Transaction has amount_input set to false.
message String Optional. Accompanying message for any raised errors, due to amount

Range

Key Type Description
low Cost Lower-bound of the Range
high Cost Upper-bound of the Range
amount Cost Amount charged to user

Cost

This type is based on the native Number type in JSON with these few additions:

  • "-Infinity": implies -Infinity
  • "+Infinity": implies +Infinity
  • -1: raises AmountNotAllowedError, inferring that the provided amount is forbidden for this transaction
  • -2: raises AmountNotFoundError, inferring that the amount for this transaction can not be determined using our data (depends on external factors, e.g. merchant reputation)

USSDCode

This is a USSD code, supported by the network.

Key Type Description
code string The actual USSD code. For example, *144#
description string Describes the use of the code

Name

This is a string, uniquely identifying the named object.

Date

Date, in YYYY-MM-DD format. See this W3C document for more information.