futoin-xferengine

Neutral clustered multi-currency transaction engine with limits

Usage no npm install needed!

<script type="module">
  import futoinXferengine from 'https://cdn.skypack.dev/futoin-xferengine';
</script>

README

NPM Version NPM Downloads Build Status stable

NPM

About

Work in progress. Technology preview, even though partially used in production.

Universal cluster focused transaction engine concept implementation.

Documentation --> FutoIn Guide

Reference implementation of:

FTN19: FutoIn Interface - Transaction Engine
Version: 1.0

Features:

  • Market cases (aka transaction domains):
    • Deposits & Withdrawals
    • Retail
    • Payments
    • Online Gaming
    • Fee bound to transaction (both deducted & extra)
  • Multi-currency
    • ISO fiat currencies
    • Crypto currency namespace
    • Any custom currency namespace
  • Advanced limits per transaction domain:
    • Per-account statistics
    • Daily, Weekly, Monthly limits for amounts & transaction count
    • Overdraft for balance
    • Dedicated "External" accounts for integration limits of third-party systems
  • Clustering with protocol level interaction
  • External Wallet (Seamless Wallet)
  • DB-based event stream for reliable state distribution for ad-hoc systems

Supported database types

  • MySQL
  • PostgreSQL
  • SQLite
  • Potentially, any other SQL-compliant supported by futoin-database

BIG FAT WARNING

Please DO NOT use it unless you really understand what it is. The package is published as essential open source part of derived custom closed source projects of different vendors.

Installation for Node.js

Command line:

$ yarn add futoin-xferengine 

or

$ npm install futoin-xferengine --save

Concept

More detailed concept is in the FTN19 spec.

Examples

1.

API documentation

The concept is described in FutoIn specification: FTN19: FutoIn Interface - Transaction Engine v1.x

Classes

AccountsFace

Accounts Face

AccountsService

Accounts Service

BaseFace

Base Face with neutral common registration functionality

BaseService

Base Service with common registration logic

BonusFace

Bonus Face

BonusService

Bonus Service

CachedAccountsFace

Efficient cached AccountsFace with event-based cache invalidation

Keeps local cache of limits and invalidates based on LIVE events.

CachedLimitsFace

Efficient cached LimitsFace with event-based cache invalidation

Keeps local cache of limits and invalidates based on LIVE events.

DepositFace

Deposits Face

DepositService

Deposits Service

DepositTools

XferTools with focus on Deposits use case

GamingFace

Gaming Face

GamingService

Gaming Service

GamingTools

XferTools with focus on Gaming use case

GenericFace

Generic Face

GenericService

Generic Service

LimitsFace

Limits Face

LimitsService

Limits Service

MessageFace

Message Face

MessageService

Message Service

MessageTools

XferTools with focus on Message processing

PaymentFace

Payments Face

PaymentService

Payments Service

PaymentTools

XferTools with focus on Payments use case

PeerFace

Peer Face

PeerService

Peer Service

RetailFace

Payments Face

RetailService

Retail Service

RetailTools

XferTools with focus on Retail use case

UUIDTool

Extended UUIDTool with focus on collision safety in whole history of particular instance.

WithdrawFace

Witdrawals Face

WithdrawService

Withdrawals Service

XferCCM

Special CCM implementation for XferCore

CurrencyCacheInfoFace

An efficient version of Currency/InfoFace.

Keeps local cache of currencies and exchange rates. Listens on related event stream for changes as LIVE component.

CurrencyInfoFace

Currency Information Face

CurrencyInfoService

Currency Manage Service

CurrencyManageFace

Currency Management Face

CurrencyManageService

Currency Manage Service

AccountsFace

Accounts Face

Kind: global class

AccountsService

Accounts Service

Kind: global class

BaseFace

Base Face with neutral common registration functionality

Kind: global class
Note: Not official API

BaseFace.LATEST_VERSION

Latest supported FTN17 version

Kind: static property of BaseFace

BaseFace.PING_VERSION

Latest supported FTN4 version

Kind: static property of BaseFace

BaseFace.register(as, ccm, name, endpoint, [credentials], [options])

CCM registration helper

Kind: static method of BaseFace

Param Type Default Description
as AsyncSteps steps interface
ccm AdvancedCCM CCM instance
name string CCM registration name
endpoint * see AdvancedCCM#register
[credentials] * see AdvancedCCM#register
[options] object {} interface options
[options.version] string "1.0" interface version to use

BaseService

Base Service with common registration logic

Kind: global class

baseService._checkType(type, val) ⇒ boolean

Check value against type in spec of implemented interface

Kind: instance method of BaseService
Returns: boolean - result of check

Param Type Description
type string name of defined type
val * value to check

BaseService.register(as, executor, options) ⇒ LimitsService

Register futoin.xfers.limits interface with Executor

Kind: static method of BaseService
Returns: LimitsService - instance

Param Type Description
as AsyncSteps steps interface
executor Executor executor instance
options object implementation defined options

BonusFace

Bonus Face

Kind: global class

BonusService

Bonus Service

Kind: global class

CachedAccountsFace

Efficient cached AccountsFace with event-based cache invalidation

Keeps local cache of limits and invalidates based on LIVE events.

Kind: global class

CachedAccountsFace.register(as, ccm, name, endpoint, [credentials], [options])

CCM registration helper

Kind: static method of CachedAccountsFace

Param Type Default Description
as AsyncSteps steps interface
ccm AdvancedCCM CCM instance
name string CCM registration name
endpoint * see AdvancedCCM#register
[credentials] * see AdvancedCCM#register
[options] object {} interface options
[options.version] string "<latest>" interface version to use

CachedLimitsFace

Efficient cached LimitsFace with event-based cache invalidation

Keeps local cache of limits and invalidates based on LIVE events.

Kind: global class

CachedLimitsFace.register(as, ccm, name, endpoint, [credentials], [options])

CCM registration helper

Kind: static method of CachedLimitsFace

Param Type Default Description
as AsyncSteps steps interface
ccm AdvancedCCM CCM instance
name string CCM registration name
endpoint * see AdvancedCCM#register
[credentials] * see AdvancedCCM#register
[options] object {} interface options
[options.version] string "<latest>" interface version to use

DepositFace

Deposits Face

Kind: global class

DepositService

Deposits Service

Kind: global class

DepositTools

XferTools with focus on Deposits use case

Kind: global class

GamingFace

Gaming Face

Kind: global class

GamingService

Gaming Service

Kind: global class

GamingTools

XferTools with focus on Gaming use case

Kind: global class

GenericFace

Generic Face

Kind: global class

GenericService

Generic Service

Kind: global class

LimitsFace

Limits Face

Kind: global class

LimitsService

Limits Service

Kind: global class

MessageFace

Message Face

Kind: global class

MessageService

Message Service

Kind: global class

MessageTools

XferTools with focus on Message processing

Kind: global class

PaymentFace

Payments Face

Kind: global class

PaymentService

Payments Service

Kind: global class

PaymentTools

XferTools with focus on Payments use case

Kind: global class

PeerFace

Peer Face

Kind: global class

PeerService

Peer Service

Kind: global class

RetailFace

Payments Face

Kind: global class

RetailService

Retail Service

Kind: global class

RetailTools

XferTools with focus on Retail use case

Kind: global class

UUIDTool

Extended UUIDTool with focus on collision safety in whole history of particular instance.

Kind: global class

UUIDTool.addXfer(xfer, val)

Call on xfer to ensure whole history uniqueness (just in case)

Kind: static method of UUIDTool

Param Type Description
xfer XferBuilder xfer builder object
val string UUID in Base64 format without padding

UUIDTool.genXfer(xfer) ⇒ string

Generate UUID v4 in scope of transaction

Kind: static method of UUIDTool
Returns: string - UUID encoded in Base64 without padding

Param Type Description
xfer XferBuilder xfer builder object

WithdrawFace

Witdrawals Face

Kind: global class

WithdrawService

Withdrawals Service

Kind: global class

XferCCM

Special CCM implementation for XferCore

Kind: global class

xferCCM.registerServices(as, executor)

Register all services required for operation

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
executor Executor internal protected executor

xferCCM.registerEventServices(as, executor)

Register event services required for operation

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
executor Executor internal protected executor

xferCCM.registerCurrencyServices(as, executor)

Register currency services required for operation

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
executor Executor internal protected executor

xferCCM.registerLimitServices(as, executor)

Register limit services required for operation

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
executor Executor internal protected executor

xferCCM.registerAccountServices(as, executor)

Register account services required for operation

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
executor Executor internal protected executor

xferCCM.makeManualAlias(iface, key) ⇒ string

Get manual alias for specific iface & key combination

Kind: instance method of XferCCM
Returns: string - - manual key to be used with registerOnDemand()

Param Type Description
iface string interface identifier
key string arbitrary key, typically account #

xferCCM.registerOnDemand(iface, flavour, callback)

Register callback for on-demand interface creation

Kind: instance method of XferCCM

Param Type Description
iface string full iface identifier
flavour string a type of interface implementation
callback callable callback to register interface

xferCCM.xferIface(as, iface, account)

Get interface with on-demand logic

Kind: instance method of XferCCM

Param Type Description
as AsyncSteps async step interface
iface string full iface identifier
account string related account ID

CurrencyCacheInfoFace

An efficient version of Currency/InfoFace.

Keeps local cache of currencies and exchange rates. Listens on related event stream for changes as LIVE component.

Kind: global class

CurrencyCacheInfoFace.register(as, ccm, name, endpoint, [credentials], [options])

CCM registration helper

Kind: static method of CurrencyCacheInfoFace

Param Type Default Description
as AsyncSteps steps interface
ccm AdvancedCCM CCM instance
name string CCM registration name
endpoint * see AdvancedCCM#register
[credentials] * see AdvancedCCM#register
[options] object {} interface options
[options.version] string "<latest>" interface version to use

CurrencyInfoFace

Currency Information Face

Kind: global class

CurrencyInfoService

Currency Manage Service

Kind: global class

CurrencyManageFace

Currency Management Face

Kind: global class

CurrencyManageService

Currency Manage Service

Kind: global class

documented by jsdoc-to-markdown.