银关类交易

发行用户通

商户在井通银关可以申请一个银关账号用于发行用户通。经过申请和批准后,井通公司会分配商户一个井通区块链银关账号, 包含有一组商户编号(custom ID)和商户密钥(custom key),可发行相应的用户通给其用户。发行用户通的总额度和有效期 由商户和井通银关之间协定。商户发行的用户通总数量不得超过总额度,而且用户通仅在有效期内可以在井通区块链上流通。 用户通的发行情况可以在井通银关的商户界面中查询到。

详细商户申请和使用信息可参考井通银关网站(https://fingate.jingtum.com/#/info/questions) 或测试银关网站(https://tfingate.jingtum.com/#/info/questions)。 发行通没有异步模式。

Java Example

// get fingate instance
FinGate fingate = FinGate.getInstance();
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

// construct receive wallet
Wallet wallet1 = new Wallet("snqFcHzRe2......QYzxEEbW");

// issue custom tum to wallet above
boolean isSuccessful = fingate.issueCustomTum("810000000......201800220020000001",
1000, wallet1.getAddress());

Python Example

# get fingate instance
fingate = FinGate();
# set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

# set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

# construct receive wallet
my_wallet = Wallet("shVC2gdG......gijqk4EsuqDF");

# issue custom tum to wallet above
ret = fingate.issueCustomTum("820000000800002......0000001", "123.45", my_wallet.getAddress());

PHP Example

// get fingate instance
$fingate = FinGate::getInstance();
// set development mode(optional)
$fingate->setMode($FinGate->modes::DEVLOPMENT);

// set fingate custom parameters
$fingate->setToken("00000008");
$fingate->setKey("5361ef......458f37b");

// construct receive wallet
$my_wallet = new Wallet("snqFcH......pQYzxEEbW");

// issue custom tum to wallet above
$res = $fingate->issueCustomTum('820000000800002......0000001', 1119.16, $my_wallet->getAddress());

Node.JS Example

// get fingate instance
var fingate = require('jingtum-sdk').FinGate;
var Wallet = require('jingtum-sdk').Wallet;
// set fingate account
fingate.setAccount("snqFcH......pQYzxEEbW");
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken('00000008');
fingate.setKey('5361ef......458f37b');

// construct receive wallet
var my_wallet = new Wallet('shNKNxg......AKBFy5W5kK');

// issue custom tum to wallet above
fingate.issueCustomTum('820000000800002......0000001', '10000.05', my_wallet.getAddress(),
    function (err, data) {
    //process result
});

查询发行状态

当银关提交用户通发行命令后,可通过用户通发行时使用的客户端流水号(UUID)来查询用户通发行的状态。 返回的用户通的发行状态包括用户通的发行数量,时间,在区块链上的交易哈希值(HASH)和发行状态。

Java Example

// get fingate instance
FinGate fingate = FinGate.getInstance();
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

// query issue status by query order
IssueRecord ir = fingate.queryIssue("PREFIX67936661125163618000001");

Python Example

# get fingate instance
fingate = FinGate();
# set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

# set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

# query issue status by query order
ir = fingate.queryIssue("PREFIX67936661125163618000001");

PHP Example

// get fingate instance
$fingate = FinGate::getInstance();
// set development mode(optional)
$fingate->setMode($FinGate->modes::DEVLOPMENT);

// set fingate custom parameters
$fingate->setToken("00000008");
$fingate->setKey("5361ef......458f37b");

// query issue status by query order
$res = $fingate->queryIssue("PREFIX67936661125163618000001");

Node.JS Example

// get fingate instance
var fingate = require('jingtum-sdk').FinGate;
var Wallet = require('jingtum-sdk').Wallet;
// set fingate account
fingate.setAccount("snqFcH......pQYzxEEbW");
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken('00000008');
fingate.setKey('5361ef......458f37b');

// query issue status by query order
fingate.queryIssue({'order':'PREFIX67936620161125163618000001'}, function (err, data) {
    //process result
});

查询用户通状态

银关可通过用户通的代码查询已经发行的用户通状态。 当前用户通的状态包括用户通的名称,总额度,已经发行的数量,用户通的类型和面值,以及用户通的有效起始和结束时间等信息。

Java Example

// get fingate instance
FinGate fingate = FinGate.getInstance();
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

// get tum status
TumInfo ti = fingate.queryCustomTum("8300000027000020160415201704150120000003");

Python Example

# get fingate instance
fingate = FinGate();
# set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

# set fingate custom parameters
fingate.setToken("00000008");
fingate.setKey("5361ef......458f37b");

# get tum status
ret = fingate.queryCustomTum("8300000027000020160415201704150120000003");

PHP Example

// get fingate instance
$fingate = FinGate::getInstance();
// set development mode(optional)
$fingate->setMode($FinGate->modes::DEVLOPMENT);

// set fingate custom parameters
$fingate->setToken("00000008");
$fingate->setKey("5361ef......458f37b");

// get tum status
$res = $fingate->queryCustomTum("8300000027000020160415201704150120000003");

Node.JS Example

// get fingate instance
var fingate = require('jingtum-sdk').FinGate;
var Wallet = require('jingtum-sdk').Wallet;
// set fingate account
fingate.setAccount("snqFcH......pQYzxEEbW");
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set fingate custom parameters
fingate.setToken('00000008');
fingate.setKey('5361ef......458f37b');

// get tum status
fingate.queryCustomTum('820000000......0000001', function (err, data) {
    //process result
});

查询市场深度

市场深度是市场里面对于某个货币对的所有挂单,通过市场深度功能,可以获得卖单和买单列表的结果。

Java Example

// get fingate instance
FinGate fingate = FinGate.getInstance();
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set order book pair
String pair = new String("CNY:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS/USD:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS");

// get order book
finGate.getOrderBook(pair, new OrderBookListener() {
    @override
    public void onComplete(result) {
        // process result
    }
});

Python Example

# get fingate instance
fingate = FinGate();
# set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

# set order book pair
pair = "CNY:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS/USD:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS";

# get order book
finGate.getOrderBook(pair, callback);

PHP Example

// get fingate instance
$fingate = FinGate::getInstance();
// set development mode(optional)
$fingate->setMode($FinGate->modes::DEVLOPMENT);

// set order book pair
$pair = "CNY:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS/USD:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS";

// get order book
$finGate->getOrderBook(pair, $callback);

Node.JS Example

// get fingate instance
var fingate = require('jingtum-sdk').FinGate;
// set fingate account
fingate.setAccount("snqFcH......pQYzxEEbW");
// set development mode(optional)
fingate.setMode(FinGate.DEVLOPMENT);

// set order book pair
var pair = 'CNY:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS/USD:jBciDE8Q3uJjf111VeiUNM775AMKHEbBLS';

// get order book
finGate.getOrderBook(pair, function(err, data) {
    // process result
});