@Override void putMyJSON(JSONObject attachment) { attachment.put("purchase", Convert.toUnsignedLong(purchaseId)); attachment.put("goodsData", Convert.toHexString(goods.getData())); attachment.put("goodsNonce", Convert.toHexString(goods.getNonce())); attachment.put("discountNQT", discountNQT); attachment.put("goodsIsText", goodsIsText); }
@Override void putMyBytes(ByteBuffer buffer) { buffer.putLong(purchaseId); buffer.putInt( goodsIsText ? goods.getData().length | Integer.MIN_VALUE : goods.getData().length); buffer.put(goods.getData()); buffer.put(goods.getNonce()); buffer.putLong(discountNQT); }
DigitalGoodsDelivery(ByteBuffer buffer, byte transactionVersion) throws RiseException.NotValidException { super(buffer, transactionVersion); this.purchaseId = buffer.getLong(); int length = buffer.getInt(); goodsIsText = length < 0; if (length < 0) { length &= Integer.MAX_VALUE; } this.goods = EncryptedData.readEncryptedData(buffer, length, Constants.MAX_DGS_GOODS_LENGTH); this.discountNQT = buffer.getLong(); }
@Override int getMySize() { return 8 + 4 + goods.getSize() + 8; }