+/// Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and
+/// enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual
+/// [`Bolt12Invoice`] once it is received.
+///
+/// Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by
+/// the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request.
+/// The optional parameters are used in the builder, if `Some`:
+/// - `quantity` for [`InvoiceRequest::quantity`] which must be set if
+/// [`Offer::expects_quantity`] is `true`.
+/// - `amount_msats` if overpaying what is required for the given `quantity` is desired, and
+/// - `payer_note` for [`InvoiceRequest::payer_note`].
+///
+/// If `max_total_routing_fee_msat` is not specified, The default from
+/// [`RouteParameters::from_payment_params_and_value`] is applied.
+///
+/// # Payment
+///
+/// The provided `payment_id` is used to ensure that only one invoice is paid for the request
+/// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has
+/// been sent.
+///
+/// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the
+/// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the
+/// payment will fail with an [`Event::InvoiceRequestFailed`].
+///
+/// # Privacy
+///
+/// Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`]
+/// as the introduction node and a derived payer id for payer privacy. As such, currently, the
+/// node must be announced. Otherwise, there is no way to find a path to the introduction node
+/// in order to send the [`Bolt12Invoice`].
+///
+/// # Limitations
+///
+/// Requires a direct connection to an introduction node in [`Offer::paths`] or to
+/// [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding
+/// [`Bolt12Invoice::payment_paths`].
+///
+/// # Errors
+///
+/// Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link
+/// or if the provided parameters are invalid for the offer.
+///
+/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+/// [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
+/// [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note
+/// [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+/// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
+/// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::Offer, mut quantity: crate::c_types::derived::COption_u64Z, mut amount_msats: crate::c_types::derived::COption_u64Z, mut payer_note: crate::c_types::derived::COption_StrZ, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ {
+ let mut local_quantity = if quantity.is_some() { Some( { quantity.take() }) } else { None };
+ let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None };
+ let mut local_payer_note = { /*payer_note*/ let payer_note_opt = payer_note; if payer_note_opt.is_none() { None } else { Some({ { { payer_note_opt.take() }.into_string() }})} };
+ let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None };
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer(offer.get_native_ref(), local_quantity, local_amount_msats, local_payer_note, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat);
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() };
+ local_ret
+}
+
+/// Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion
+/// message.
+///
+/// The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a
+/// [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding
+/// [`PaymentPreimage`].
+///
+/// # Limitations
+///
+/// Requires a direct connection to an introduction node in [`Refund::paths`] or to
+/// [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each
+/// node meeting the aforementioned criteria, but there's no guarantee that they will be
+/// received and no retries will be made.
+///
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, refund: &crate::lightning::offers::refund::Refund) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_refund_payment(refund.get_native_ref());
+ let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() };
+ local_ret
+}
+