Add SuspendedPayment{Create,Finish,Cancel}

* Add SusPay core tests
* Rename SusPay -> SuspendedPayment (code review)
* Rename cancelAfter -> allowCancelAfter
* Rename suspendedPayment{Finish,Execution}
This commit is contained in:
sentientwaffle
2015-08-31 07:24:55 -07:00
parent 6e98629f9b
commit b134081293
29 changed files with 733 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
/* eslint-disable no-new, max-len, no-comma-dangle, indent */
/* eslint-disable no-new, max-len, no-comma-dangle, indent, max-nested-callbacks */
'use strict';
@@ -14,7 +14,9 @@ const Amount = require('ripple-lib').Amount;
const PathFind = require('ripple-lib')._test.PathFind;
const Log = require('ripple-lib')._test.Log;
let options, remote, callback;
let options;
let remote;
let callback;
const ADDRESS = 'r4qLSAzv4LZ9TLsR7diphGwKnSEAMQTSjS';
const LEDGER_INDEX = 9592219;
@@ -2095,4 +2097,50 @@ describe('Remote', function() {
]
});
});
it('Construct SuspendedPaymentCreate transaction', function() {
const tx = remote.createTransaction('SuspendedPaymentCreate', {
account: TX_JSON.Account,
destination: TX_JSON.Destination,
amount: TX_JSON.Amount
});
assert.deepEqual(tx.tx_json, {
Flags: 0,
TransactionType: 'SuspendedPaymentCreate',
Account: TX_JSON.Account,
Destination: TX_JSON.Destination,
Amount: TX_JSON.Amount
});
});
it('Construct SuspendedPaymentFinish transaction', function() {
const tx = remote.createTransaction('SuspendedPaymentFinish', {
account: TX_JSON.Account,
owner: TX_JSON.Account,
paymentSequence: 1234
});
assert.deepEqual(tx.tx_json, {
Flags: 0,
TransactionType: 'SuspendedPaymentFinish',
Account: TX_JSON.Account,
Owner: TX_JSON.Account,
OfferSequence: 1234
});
});
it('Construct SuspendedPaymentCancel transaction', function() {
const tx = remote.createTransaction('SuspendedPaymentCancel', {
account: TX_JSON.Account,
owner: TX_JSON.Account,
paymentSequence: 1234
});
assert.deepEqual(tx.tx_json, {
Flags: 0,
TransactionType: 'SuspendedPaymentCancel',
Account: TX_JSON.Account,
Owner: TX_JSON.Account,
OfferSequence: 1234
});
});
});