Merge pull request #432 from darkdarkdragon/develop-RLJS-370-3

testing - add memo field into payment transaction so parsePaymentMemo…
This commit is contained in:
Chris Clark
2015-07-17 14:21:46 -07:00
3 changed files with 30 additions and 4 deletions

View File

@@ -17,7 +17,13 @@ function parsePaymentMemos(tx) {
if (!Array.isArray(tx.Memos) || tx.Memos.length === 0) {
return undefined;
}
return tx.Memos.map((m) => m.Memo);
return tx.Memos.map((m) => {
return utils.removeUndefined({
type: m.Memo.parsed_memo_type,
format: m.Memo.parsed_memo_format,
data: m.Memo.parsed_memo_data
});
});
}
function parsePayment(tx: Object): Object {

View File

@@ -3,8 +3,14 @@
"type": "payment",
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"sequence": 4,
"id": "4C37C92576DEB000D13B07F4D3F99F968BD86B6B83A840BEFFB2BFC8A042A81B",
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
"specification": {
"memos": [
{
"type": "client",
"format": "rt1.5.2"
}
],
"source": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"amount": {
@@ -87,9 +93,15 @@
{
"type": "payment",
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"id": "4C37C92576DEB000D13B07F4D3F99F968BD86B6B83A840BEFFB2BFC8A042A81B",
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
"sequence": 4,
"specification": {
"memos": [
{
"type": "client",
"format": "rt1.5.2"
}
],
"source": {
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
"amount": {

View File

@@ -134,7 +134,15 @@ module.exports = function(port) {
mock.on('request_account_tx', function(request, conn) {
if (request.account === addresses.ACCOUNT) {
conn.send(fixtures.misc.accountTransactionsResponse(request));
const options = {
memos: [{
Memo: {
MemoFormat: '7274312E352E32',
MemoType: '636C69656E74'
}
}]
};
conn.send(fixtures.misc.accountTransactionsResponse(request, options));
} else {
assert(false, 'Unrecognized account address: ' + request.account);
}