6 namespace org { namespace ldk { namespace structs {
10 * A `Refund` is a request to send an [`Bolt12Invoice`] without a preceding [`Offer`].
12 * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
13 * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
16 * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
17 * [`Offer`]: crate::offers::offer::Offer
19 public class Refund : CommonBase {
20 internal Refund(object _dummy, long ptr) : base(ptr) { }
22 if (ptr != 0) { bindings.Refund_free(ptr); }
25 internal long clone_ptr() {
26 long ret = bindings.Refund_clone_ptr(this.ptr);
32 * Creates a copy of the Refund
34 public Refund clone() {
35 long ret = bindings.Refund_clone(this.ptr);
37 if (ret >= 0 && ret <= 4096) { return null; }
38 org.ldk.structs.Refund ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Refund(null, ret); }
39 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
44 * A complete description of the purpose of the refund. Intended to be displayed to the user
45 * but with the caveat that it has not been verified in any way.
47 public PrintableString description() {
48 long ret = bindings.Refund_description(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
52 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57 * Duration since the Unix epoch when an invoice should no longer be sent.
59 * If `None`, the refund does not expire.
61 public Option_u64Z absolute_expiry() {
62 long ret = bindings.Refund_absolute_expiry(this.ptr);
64 if (ret >= 0 && ret <= 4096) { return null; }
65 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
66 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
71 * Whether the refund has expired.
73 public bool is_expired() {
74 bool ret = bindings.Refund_is_expired(this.ptr);
80 * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
81 * displayed to the user but with the caveat that it has not been verified in any way.
83 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
85 public PrintableString issuer() {
86 long ret = bindings.Refund_issuer(this.ptr);
88 if (ret >= 0 && ret <= 4096) { return null; }
89 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
90 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
95 * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
96 * privacy by obfuscating its node id.
98 public BlindedPath[] paths() {
99 long ret = bindings.Refund_paths(this.ptr);
101 if (ret >= 0 && ret <= 4096) { return null; }
102 int ret_conv_13_len = InternalUtils.getArrayLength(ret);
103 BlindedPath[] ret_conv_13_arr = new BlindedPath[ret_conv_13_len];
104 for (int n = 0; n < ret_conv_13_len; n++) {
105 long ret_conv_13 = InternalUtils.getU64ArrayElem(ret, n);
106 org.ldk.structs.BlindedPath ret_conv_13_hu_conv = null; if (ret_conv_13 < 0 || ret_conv_13 > 4096) { ret_conv_13_hu_conv = new org.ldk.structs.BlindedPath(null, ret_conv_13); }
107 if (ret_conv_13_hu_conv != null) { ret_conv_13_hu_conv.ptrs_to.AddLast(this); };
108 ret_conv_13_arr[n] = ret_conv_13_hu_conv;
110 bindings.free_buffer(ret);
111 return ret_conv_13_arr;
115 * An unpredictable series of bytes, typically containing information about the derivation of
118 * [`payer_id`]: Self::payer_id
120 public byte[] payer_metadata() {
121 long ret = bindings.Refund_payer_metadata(this.ptr);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
129 * A chain that the refund is valid for.
131 public byte[] chain() {
132 long ret = bindings.Refund_chain(this.ptr);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
140 * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
142 * [`chain`]: Self::chain
144 public long amount_msats() {
145 long ret = bindings.Refund_amount_msats(this.ptr);
151 * Features pertaining to requesting an invoice.
153 public InvoiceRequestFeatures features() {
154 long ret = bindings.Refund_features(this.ptr);
156 if (ret >= 0 && ret <= 4096) { return null; }
157 org.ldk.structs.InvoiceRequestFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceRequestFeatures(null, ret); }
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
163 * The quantity of an item that refund is for.
165 public Option_u64Z quantity() {
166 long ret = bindings.Refund_quantity(this.ptr);
168 if (ret >= 0 && ret <= 4096) { return null; }
169 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
170 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
175 * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
178 * [`paths`]: Self::paths
180 public byte[] payer_id() {
181 long ret = bindings.Refund_payer_id(this.ptr);
183 if (ret >= 0 && ret <= 4096) { return null; }
184 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
189 * Payer provided note to include in the invoice.
191 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
193 public PrintableString payer_note() {
194 long ret = bindings.Refund_payer_note(this.ptr);
196 if (ret >= 0 && ret <= 4096) { return null; }
197 org.ldk.structs.PrintableString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrintableString(null, ret); }
198 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
203 * Serialize the Refund object into a byte array which can be read by Refund_read
205 public byte[] write() {
206 long ret = bindings.Refund_write(this.ptr);
208 if (ret >= 0 && ret <= 4096) { return null; }
209 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
214 * Read a Refund object from a string
216 public static Result_RefundBolt12ParseErrorZ from_str(string s) {
217 long ret = bindings.Refund_from_str(InternalUtils.encodeString(s));
219 if (ret >= 0 && ret <= 4096) { return null; }
220 Result_RefundBolt12ParseErrorZ ret_hu_conv = Result_RefundBolt12ParseErrorZ.constr_from_ptr(ret);