Package org.ngengine.lnurl
Class LnUrlPay
- java.lang.Object
-
- org.ngengine.lnurl.LnUrlPay
-
- All Implemented Interfaces:
LnUrlService
public class LnUrlPay extends java.lang.Object implements LnUrlService
An lnurl pay request service
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLnUrlPay.Metadata
-
Field Summary
Fields Modifier and Type Field Description static intMAX_METADATA_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description protectedLnUrlPay(long maxSendable, long minSendable, java.net.URI callback, int commentAllowed, java.util.Collection<LnUrlPay.Metadata> metadata, LnUrlPayerData payerData)protectedLnUrlPay(long maxSendable, long minSendable, java.net.URI callback, int commentAllowed, java.util.Collection<LnUrlPay.Metadata> metadata, LnUrlPayerData payerData, java.lang.String nostrPubkey, boolean allowNostr)protectedLnUrlPay(java.util.Map<java.lang.String,java.lang.Object> data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSend(long amount)org.ngengine.platform.AsyncTask<LnUrlPaymentResponse>fetchInvoice(long amount, java.lang.String comment, LnUrlPayerData payerData)org.ngengine.platform.AsyncTask<LnUrlPaymentResponse>fetchInvoice(long amount, java.lang.String comment, LnUrlPayerData payerData, java.lang.String nostrZapRequest)org.ngengine.platform.AsyncTask<LnUrlPaymentResponse>fetchInvoice(long amount, java.lang.String comment, LnUrlPayerData payerData, java.time.Duration timeout, java.util.Map<java.lang.String,java.lang.String> headers)org.ngengine.platform.AsyncTask<LnUrlPaymentResponse>fetchInvoice(long amount, java.lang.String comment, LnUrlPayerData payerData, java.time.Duration timeout, java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String nostrZapRequest)java.net.URIgetCallback()java.net.URIgetCallback(long amount, java.lang.String comment, LnUrlPayerData payerData)java.net.URIgetCallback(long amount, java.lang.String comment, LnUrlPayerData payerData, java.lang.String nostrZapRequest)intgetMaxCommentLength()longgetMaxSendable()java.util.List<LnUrlPay.Metadata>getMetadata()longgetMinSendable()java.lang.StringgetName()A human readable name for the service.java.lang.StringgetNostrPubkey()LnUrlPayerDatagetPayerData()protected static booleanisAssignableTo(java.util.Map<java.lang.String,java.lang.Object> data)booleanisCommentAllowed()booleanisNostrAllowed()java.util.Map<java.lang.String,java.lang.Object>toMap()Return the serializable representation of this service
-
-
-
Field Detail
-
MAX_METADATA_SIZE
public static final int MAX_METADATA_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LnUrlPay
protected LnUrlPay(long maxSendable, long minSendable, java.net.URI callback, int commentAllowed, java.util.Collection<LnUrlPay.Metadata> metadata, LnUrlPayerData payerData, java.lang.String nostrPubkey, boolean allowNostr)
-
LnUrlPay
protected LnUrlPay(long maxSendable, long minSendable, java.net.URI callback, int commentAllowed, java.util.Collection<LnUrlPay.Metadata> metadata, LnUrlPayerData payerData)
-
LnUrlPay
protected LnUrlPay(java.util.Map<java.lang.String,java.lang.Object> data)
-
-
Method Detail
-
isAssignableTo
protected static boolean isAssignableTo(java.util.Map<java.lang.String,java.lang.Object> data)
-
isCommentAllowed
public boolean isCommentAllowed()
-
getMaxCommentLength
public int getMaxCommentLength()
-
getPayerData
public LnUrlPayerData getPayerData()
-
canSend
public boolean canSend(long amount)
-
getMaxSendable
public long getMaxSendable()
-
getMinSendable
public long getMinSendable()
-
getMetadata
public java.util.List<LnUrlPay.Metadata> getMetadata()
-
isNostrAllowed
public boolean isNostrAllowed()
-
getNostrPubkey
public java.lang.String getNostrPubkey()
-
getCallback
public java.net.URI getCallback()
-
getCallback
public java.net.URI getCallback(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData)
-
getCallback
public java.net.URI getCallback(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData, @Nullable java.lang.String nostrZapRequest)
-
fetchInvoice
public org.ngengine.platform.AsyncTask<LnUrlPaymentResponse> fetchInvoice(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fetchInvoice
public org.ngengine.platform.AsyncTask<LnUrlPaymentResponse> fetchInvoice(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData, @Nullable java.lang.String nostrZapRequest) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fetchInvoice
public org.ngengine.platform.AsyncTask<LnUrlPaymentResponse> fetchInvoice(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData, @Nullable java.time.Duration timeout, @Nullable java.util.Map<java.lang.String,java.lang.String> headers) throws java.lang.Exception
- Throws:
java.lang.Exception
-
fetchInvoice
public org.ngengine.platform.AsyncTask<LnUrlPaymentResponse> fetchInvoice(long amount, @Nullable java.lang.String comment, @Nullable LnUrlPayerData payerData, @Nullable java.time.Duration timeout, @Nullable java.util.Map<java.lang.String,java.lang.String> headers, @Nullable java.lang.String nostrZapRequest) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getName
public java.lang.String getName()
Description copied from interface:LnUrlServiceA human readable name for the service. Used for debugging and logging purposes.- Specified by:
getNamein interfaceLnUrlService- Returns:
- the name of the service
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()
Description copied from interface:LnUrlServiceReturn the serializable representation of this service- Specified by:
toMapin interfaceLnUrlService- Returns:
- the service data, the same way it was received from the LNURL endpoint.
-
-