Class: Invoice

messages~ Invoice


new Invoice(connection, attrs)

A DZINCRTE Invoice message. From the Whitepaper:

Invoices are primarily needed to establish a meaningful reputation evaluation of the seller. When a buyer purchases an item from a seller, funds must be sent to the seller following an invoice declaration. Funds received by sellers without a preceding invoice, should not add credit to the seller’s reputation.

The output address for this transaction type is addressed to the buyer, and not to the seller, so as to aid with reputation assessment.

receiverAddr: Invoices should be addressed to the public address of the buyer who will be paying for an item.

NOTE: All attributes that are specified below are also getter properties that can be accessed on this instantiated object.

Parameters:
Name Type Description
connection Driver

blockchain connection

attrs object

Attributes that this Invoice contains

Properties
Name Type Description
amountDue Integer

The amount due, denoted in satoshis, which does not include tipping fees.

expirationIn Integer

The expiration time of this invoice. "Times" are to be indicated in the number of blocks that this listing is available for. Omitting this field indicates no expiration.

Extends

Methods


getPayments(cb)

Retrieve all Payment messages (aka reviews) which are in response to this invoice. Typically there will be one, but some ambiguity in the whitepaper allows for reputation to consider subsequent reviews after the first.

Parameters:
Name Type Description
cb function

Callback to receive Payment messages in the form: function(err, payments)


isValid(cb)

Determine whether this message has been properly formatted, and is 'in consensus' with the Drop Zone protocol. Further documentation for this validation result, and it's error messages can be found in the async-validate library.

Parameters:
Name Type Description
cb function

Callback to receive the results of the validity test form: function(err, res)

Inherited From:

save(cb)

Save this message into the blockchain, if it hasn't yet been persisted, and was instantiated without a txid.

NOTE: Validation is not performed as part of this method. It's entirely possible to persist a message into the blockchain that will be ommitted from search/scan results by clients. Validation is performed as part of #find() not #save().

Parameters:
Name Type Description
cb function

Callback which receives the mempool-persisted message in the form: function(err, message)

NOTE: Due to transaction-maleability, the persisted txid may change at the time of actual confirmation. This method merely broadcasts the message into the mempool.

Inherited From:

toTransaction()

Return a hash object representing the serialized components of this transaction suitable for passing onto TxEncode.

Inherited From:
Returns:
Type
object