public class Invoice extends MinimalInvoice implements Payment
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
bolt11Invoice |
static java.lang.String |
CLAIM_NAME |
protected java.lang.String |
description |
protected java.time.Instant |
expireDate |
protected CryptoAmount |
invoiceAmount |
protected java.time.Instant |
invoiceDate |
protected NodeInfo |
nodeInfo |
protected boolean |
settled |
protected CryptoAmount |
settledAmount |
protected java.time.Instant |
settlementDate |
protected java.lang.String |
sourceNode |
preImageHash
Constructor and Description |
---|
Invoice()
Empty Constructor
|
Invoice(byte[] preImageHash,
java.lang.String bolt11Invoice,
java.lang.String description,
CryptoAmount invoiceAmount,
NodeInfo nodeInfo,
java.time.Instant expireDate,
java.time.Instant invoiceDate)
Default constructor, for unsettled invoice.
|
Invoice(byte[] preImageHash,
java.lang.String bolt11Invoice,
java.lang.String description,
CryptoAmount invoiceAmount,
NodeInfo nodeInfo,
java.time.Instant expireDate,
java.time.Instant invoiceDate,
boolean settled,
CryptoAmount settledAmount,
java.time.Instant settlementDate)
Default constructor, for settled invoice.
|
Invoice(javax.json.JsonObject jsonObject)
JSON Parseable constructor
|
Invoice(org.jose4j.jwt.JwtClaims jwtClaims)
Parse from JWTClaims constructor
|
Modifier and Type | Method and Description |
---|---|
void |
convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder)
Method that should set the objects property to Json representation.
|
java.lang.String |
getBolt11Invoice() |
java.lang.String |
getClaimName() |
java.lang.String |
getDescription() |
java.time.Instant |
getExpireDate() |
CryptoAmount |
getInvoiceAmount() |
java.time.Instant |
getInvoiceDate() |
NodeInfo |
getNodeInfo() |
CryptoAmount |
getSettledAmount() |
java.time.Instant |
getSettlementDate() |
java.lang.String |
getSourceNode() |
boolean |
isSettled() |
void |
parseJson(javax.json.JsonObject jsonObject)
Method to read all properties from a JsonObject into this value object.
|
void |
setBolt11Invoice(java.lang.String bolt11Invoice) |
void |
setDescription(java.lang.String description) |
void |
setExpireDate(java.time.Instant expireDate) |
void |
setInvoiceAmount(CryptoAmount invoiceAmount) |
void |
setInvoiceDate(java.time.Instant invoiceDate) |
void |
setNodeInfo(NodeInfo nodeInfo) |
void |
setSettled(boolean settled) |
void |
setSettledAmount(CryptoAmount settledAmount) |
void |
setSettlementDate(java.time.Instant settlementDate) |
void |
setSourceNode(java.lang.String sourceNode) |
getPreImageHash, setPreImageHash
add, addB58, addNotRequired, addNotRequiredB58, getBoolean, getBooleanIfSet, getByteArrayFromB58, getByteArrayFromB58IfSet, getByteArrayFromB64, getByteArrayFromB64IfSet, getByteArrayFromHex, getByteArrayFromHexIfSet, getDate, getDateIfSet, getDouble, getDoubleIfSet, getInt, getIntIfSet, getJsonArray, getJsonArrayIfSet, getJsonObject, getJsonObjectIfSet, getLong, getLongIfSet, getString, getStringIfSet, toJson, toJsonAsString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPreImageHash
public static final java.lang.String CLAIM_NAME
protected java.lang.String bolt11Invoice
protected java.lang.String description
protected CryptoAmount invoiceAmount
protected NodeInfo nodeInfo
protected java.time.Instant expireDate
protected java.time.Instant invoiceDate
protected boolean settled
protected CryptoAmount settledAmount
protected java.time.Instant settlementDate
protected java.lang.String sourceNode
public Invoice()
public Invoice(byte[] preImageHash, java.lang.String bolt11Invoice, java.lang.String description, CryptoAmount invoiceAmount, NodeInfo nodeInfo, java.time.Instant expireDate, java.time.Instant invoiceDate)
preImageHash
- the generated preImageHash from PreImageData which acts as an unique id for the payment.bolt11Invoice
- the bolt11 invoice to display for the requester.description
- description to display in the invoice. (Optional).invoiceAmount
- the amount in the invoice. (Optional)nodeInfo
- information about the lightning handlers lightning node. (Optional)expireDate
- the time the invoice will expire.invoiceDate
- the time this invoice was created.public Invoice(byte[] preImageHash, java.lang.String bolt11Invoice, java.lang.String description, CryptoAmount invoiceAmount, NodeInfo nodeInfo, java.time.Instant expireDate, java.time.Instant invoiceDate, boolean settled, CryptoAmount settledAmount, java.time.Instant settlementDate)
preImageHash
- the generated preImageHash from PreImageData which acts as an unique id for the payment.bolt11Invoice
- the bolt11 invoice to display for the requester.description
- description to display in the invoice. (Optional).invoiceAmount
- the amount in the invoice. (Optional)nodeInfo
- information about the lightning handlers lightning node. (Optional)expireDate
- the time the invoice will expire.invoiceDate
- the time this invoice was created.settled
- if the payment was done successfully.settledAmount
- the amount that was settled. (Optional)settlementDate
- the time the payment was settled with the LightningHandler. (Optional)public Invoice(javax.json.JsonObject jsonObject) throws javax.json.JsonException
jsonObject
- the json object to parsejavax.json.JsonException
public Invoice(org.jose4j.jwt.JwtClaims jwtClaims)
jwtClaims
- the JWT Tokens Claim set to extract data from.public java.lang.String getBolt11Invoice()
public void setBolt11Invoice(java.lang.String bolt11Invoice)
bolt11Invoice
- the bolt11 invoice to display for the requester.public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- to display in the invoice. (Optional).public CryptoAmount getInvoiceAmount()
public void setInvoiceAmount(CryptoAmount invoiceAmount)
invoiceAmount
- the amount in the invoice. (Optional)public NodeInfo getNodeInfo()
public void setNodeInfo(NodeInfo nodeInfo)
nodeInfo
- information about the lightning handlers lightning node. (Optional)public java.time.Instant getExpireDate()
public void setExpireDate(java.time.Instant expireDate)
expireDate
- the time the invoice will expire.public java.time.Instant getInvoiceDate()
public void setInvoiceDate(java.time.Instant invoiceDate)
invoiceDate
- the time this invoice was created.public boolean isSettled()
public void setSettled(boolean settled)
settled
- if the payment was done successfully.public CryptoAmount getSettledAmount()
public void setSettledAmount(CryptoAmount settledAmount)
settledAmount
- the amount that was settled.public java.time.Instant getSettlementDate()
public void setSettlementDate(java.time.Instant settlementDate)
settlementDate
- the time the payment was settled with the LightningHandler.public java.lang.String getSourceNode()
public void setSourceNode(java.lang.String sourceNode)
sourceNode
- the source node of the node creating the order, used in a distributed environment
where the paywalled service and lightning handler is in different systems.public void convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder) throws javax.json.JsonException
convertToJson
in class MinimalInvoice
jsonObjectBuilder
- the json object build to use to set key/values in jsonjavax.json.JsonException
- if problems occurred converting object to JSON.public void parseJson(javax.json.JsonObject jsonObject) throws javax.json.JsonException
parseJson
in class MinimalInvoice
jsonObject
- the json object to read key and values from and set object properties.javax.json.JsonException
- if problems occurred converting object from JSON.public java.lang.String getClaimName()
getClaimName
in class MinimalInvoice