openreceive-server 0.4.32 → 0.4.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 582a8613ce59b7d84ea9a44187a59310bf3b7de3303019fbdbfd9d157d058ae5
4
- data.tar.gz: 5dd95002fc7959950707337be1aabba9bee871ed912bd2b9ca7d051f36c83136
3
+ metadata.gz: 7075e36feae2599d146d162333596b27744ded371e1cdfd42d37bb4e782f9e64
4
+ data.tar.gz: 39bb15273ba1aa3825da4b314d1e73d978871c374883a47c6535a7779ed52727
5
5
  SHA512:
6
- metadata.gz: 45fbc50b9e65af1bfe655d33e318df2f6c0de572e143a2bbf4683d4c68bcc2a95006c412f21910734ac4452fc702073409fa7c47b858b70923ef084ba4d71591
7
- data.tar.gz: a9e27cb0741b99660064783062c53bee4cf6e53a47852b39927d867ea2f343f508f0399ef2ee966f0ef8897e1cc7b41a5406260fbd362366c06b73a1c0b1c6ff
6
+ metadata.gz: 792e7ff1448b4d5c370b3f6e087171565e55c77baff5568226505f138d4785f94ca72885ff9cdd3749077d319c78f90570450117505983c81d4aff157921ff7d
7
+ data.tar.gz: 8a4427048d3d3f6fc3d855456a57d42bf07a7286b6033b995f1d61a744db138cc9e47b8a7008936d830e0db5b4e7ffe286341d0ca6215c351d8237931d611e07
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.33 - 2026-11-09
4
+
5
+ - Fixed: a process started while the wallet's relay is down now starts.
6
+ Checkouts answer a retryable `503 WALLET_UNAVAILABLE` and try the wallet
7
+ again after a short wait. A code that is wrong still stops the start.
8
+ - Fixed: `POST /checkouts/prepare` answers a `paid` object for a paid reference,
9
+ so a checkout reopened on another device shows its receipt. `POST /checkouts`
10
+ and `POST /swaps` refuse a paid reference with 409 before asking for a price.
11
+ - Fixed: a swap the provider refuses answers `502` "The swap provider refused
12
+ this request.", and a provider 429, an outage or an exhausted call budget
13
+ answers a retryable `503`. All of them were "Internal server error.".
14
+
3
15
  ## 0.4.32 - 2026-11-07
4
16
 
5
17
  Release with the complete 0.4.32 package family. No runtime changes from
data/README.md CHANGED
@@ -42,6 +42,9 @@ NWC connection advertises spend methods (`pay_invoice`, `multi_pay_invoice`,
42
42
  `pay_keysend`, `multi_pay_keysend`) unless
43
43
  `allow_spend_capable_wallet` or `OPENRECEIVE_ALLOW_SPEND_CAPABLE_NWC` overrides it; the
44
44
  shared reconciliation decision table lives in `OpenReceive::Server::Reconciliation`.
45
+ A wallet whose relay does not answer at start-up does not stop the service: it
46
+ logs one line, wallet calls answer a retryable `503 WALLET_UNAVAILABLE`, and the
47
+ first one after a short wait (1 s, doubling to 60 s) checks the wallet again.
45
48
 
46
49
  ## Minimal Rack example
47
50
 
@@ -49,7 +52,10 @@ shared reconciliation decision table lives in `OpenReceive::Server::Reconciliati
49
52
  # config.ru — run with: rackup
50
53
  require "openreceive/server"
51
54
 
52
- service = OpenReceive::Server::Service.new(nwc_client: MyNwcClient.new)
55
+ # With `gem "nwc-ruby"` in the Gemfile; or pass your own NWC client.
56
+ service = OpenReceive::Server::Service.new(
57
+ nwc_client: OpenReceive::NwcRubyReceiveClient.from_uri(ENV.fetch("NWC_URI"))
58
+ )
53
59
 
54
60
  run OpenReceive::Server::RackApp.new(
55
61
  service: service,
@@ -65,6 +65,8 @@ module OpenReceive
65
65
  reference = required_reference(body)
66
66
  guard("checkout.prepare", request, { reference: reference })
67
67
  resolved = resolve_host("checkout.prepare", request, reference, body)
68
+ next success(200, paid_prepare(reference, resolved), request_id) if resolved["paid"]
69
+
68
70
  prepared = @service.prepare_checkout("amount" => required_amount(resolved))
69
71
  body = prepared.merge("reference" => reference)
70
72
  description = resolved_description(resolved)
@@ -271,6 +273,19 @@ module OpenReceive
271
273
 
272
274
  private
273
275
 
276
+ # The prepare answer for a reference that is already paid, built from its row.
277
+ def paid_prepare(reference, resolved)
278
+ checkout = resolved.fetch("checkout")
279
+ swap = resolved["swap"] == true
280
+ paid = { "payment_hash" => resolved.fetch("payment_hash"), "rail" => swap ? "swap" : "lightning" }
281
+ paid["bolt11"] = checkout.fetch("bolt11") unless swap
282
+ paid["paid_at"] = resolved["paid_at"] if resolved["paid_at"]
283
+ {
284
+ "reference" => reference, "amount_msats" => checkout.fetch("amount_msats"),
285
+ "fiat_quote" => checkout["fiat_quote"], "payment_methods" => [], "paid" => paid
286
+ }
287
+ end
288
+
274
289
  def public_checkout(checkout)
275
290
  checkout.reject { |key, _| key.to_s == "created_at_source" }
276
291
  end
@@ -440,22 +455,23 @@ module OpenReceive
440
455
 
441
456
  # Redacting an unexpected exception must not also swallow it: the host's
442
457
  # error reporter (Rails.error, which feeds Sentry/Honeybadger/the Rails
443
- # error subscribers) or logger receives it before the opaque 500 goes on
444
- # the wire. The fallback log line carries class and origin only — never
445
- # the message, which could quote request bodies, NWC URIs, invoices, or
446
- # preimages.
458
+ # error subscribers) receives it, and the log gets a line, before the
459
+ # opaque 500 goes on the wire. The log line is written even when
460
+ # Rails.error exists: a default app subscribes nothing to it, and a
461
+ # trial's Rails shop logged only "Completed 500 Internal Server Error".
462
+ # The line carries class and origin only — never the message, which
463
+ # could quote request bodies, NWC URIs, invoices, or preimages.
447
464
  def report_unexpected_error(error, request_id)
448
465
  if defined?(::Rails) && ::Rails.respond_to?(:error) && ::Rails.error
449
466
  # Detached diagnostic: no cause, stack or attached provider configuration.
450
467
  safe_error = RuntimeError.new(OpenReceive::Nwc.redact_error_text(error.message))
451
468
  ::Rails.error.report(safe_error, handled: true, source: "openreceive")
452
- else
453
- origin = Array(error.backtrace).first
454
- line = "[openreceive] unexpected #{error.class} (request_id=#{request_id})" \
455
- "#{origin.nil? ? '' : " at #{origin}"}"
456
- logger = defined?(::Rails) && ::Rails.respond_to?(:logger) ? ::Rails.logger : nil
457
- logger.nil? ? warn(line) : logger.error(line)
458
469
  end
470
+ origin = Array(error.backtrace).first
471
+ line = "[openreceive] unexpected #{error.class} (request_id=#{request_id})" \
472
+ "#{origin.nil? ? '' : " at #{origin}"}"
473
+ logger = defined?(::Rails) && ::Rails.respond_to?(:logger) ? ::Rails.logger : nil
474
+ logger.nil? ? warn(line) : logger.error(line)
459
475
  rescue StandardError
460
476
  nil
461
477
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "socket"
4
+ require "timeout"
3
5
  require "openreceive"
4
6
  require "openreceive/server/errors"
5
7
  require "openreceive/server/wallet_info"
@@ -24,8 +26,55 @@ module OpenReceive
24
26
  # compares against already-normalized names from WalletInfo.summarize.
25
27
  SPEND_METHODS = WalletInfo::SPEND_METHODS
26
28
 
29
+ # What the payer reads when a swap provider call fails: the JS
30
+ # throughProvider's words, one per transport failure class.
31
+ SWAP_PROVIDER_REFUSED_MESSAGE = "The swap provider refused this request."
32
+ SWAP_PROVIDER_RATE_LIMITED_MESSAGE = "The swap provider is rate limited. Please try again shortly."
33
+ SWAP_PROVIDER_UNREACHABLE_MESSAGE = "The swap provider is temporarily unreachable. Please try again shortly."
34
+
35
+ # A wallet check that could not reach the relay runs again on the first
36
+ # wallet call after this wait. The wait doubles after each failure up to
37
+ # the cap, and a pass resets it. There is no timer or thread, so an idle
38
+ # process makes no wallet calls. The schedule of the Node stack's
39
+ # createRetryingBoot.
40
+ WALLET_RETRY_FIRST_SECONDS = 1
41
+ WALLET_RETRY_MAX_SECONDS = 60
42
+ # What the payer reads until the wallet check passes: the Node stack's
43
+ # words for a stack that did not start.
44
+ WALLET_NOT_READY_MESSAGE = "The payment service is not available. Please try again shortly."
45
+ # The canonical codes of a wallet that could not be reached at all, as
46
+ # opposed to one that answered with something wrong.
47
+ UNREACHABLE_WALLET_CODES = %w[WALLET_UNAVAILABLE TIMEOUT].freeze
48
+
49
+ # The wallet check could not reach the relay. Never a refusal: the service
50
+ # starts and checks again later. The message is redacted.
51
+ class WalletUnreachable < StandardError; end
52
+ private_constant :WalletUnreachable
53
+
54
+ # Whether a wallet call failed before reaching the wallet: the relay
55
+ # refused, dropped or never answered the connection, or the call ran out
56
+ # of time. A malformed code, a wallet that answers without the receive
57
+ # methods, an encryption mismatch, and a relay that answers but holds no
58
+ # info event for the wallet (a wrong relay or pubkey) are not this.
59
+ def self.wallet_unreachable?(error)
60
+ # nwc-ruby's InfoUnavailableError subclasses its NotSentError, but the
61
+ # relay answered. Read by name, as the error normalizer reads names:
62
+ # this gem does not load nwc-ruby.
63
+ return false if error.class.ancestors.any? { |klass| klass.name.to_s.end_with?("InfoUnavailableError") }
64
+ return true if error.is_a?(SystemCallError) || error.is_a?(SocketError) ||
65
+ error.is_a?(IOError) || error.is_a?(Timeout::Error)
66
+ return true if defined?(::OpenSSL::SSL::SSLError) && error.is_a?(::OpenSSL::SSL::SSLError)
67
+
68
+ UNREACHABLE_WALLET_CODES.include?(OpenReceive::Nwc.normalize_wallet_error(error)["code"])
69
+ end
70
+
27
71
  attr_reader :price_currencies
28
72
 
73
+ # nil once the wallet check has passed. Otherwise why it has not,
74
+ # redacted: the relay could not be reached, or a later check reached a
75
+ # wallet that fails it.
76
+ attr_reader :wallet_pending
77
+
29
78
  # `swap_providers: nil` (the default) auto-builds FixedFloat-compatible
30
79
  # providers from LSC_URI_PRIMARY / LSC_URI_BACKUP, exactly like the JS
31
80
  # createOpenReceive. Pass an explicit array (possibly empty) to override.
@@ -36,11 +85,21 @@ module OpenReceive
36
85
  # and GET /rates then fail with their not-configured errors.
37
86
  # `logger:` is an optional standard Logger-shaped sink (debug/info/
38
87
  # warn/error) for operational events such as swap-provider API calls.
88
+ #
89
+ # The constructor is the wallet check, and it refuses a wallet that is
90
+ # wrong: one that cannot receive, speaks no supported encryption, or can
91
+ # spend without the override. A wallet whose relay cannot be reached is
92
+ # not refused: the service starts, logs one line, and every wallet call
93
+ # answers the retryable 503 WALLET_UNAVAILABLE until the check passes.
94
+ # The first wallet call after the wait (WALLET_RETRY_FIRST_SECONDS,
95
+ # doubling to WALLET_RETRY_MAX_SECONDS) checks again. `monotonic:` is the
96
+ # clock that wait reads, for tests.
39
97
  def initialize(nwc_client:, price_provider: nil, swap_providers: nil, price_currencies: ["USD"],
40
98
  clock: -> { Time.now.to_i }, allow_spend_capable_wallet: false, env: ENV,
41
- logger: nil)
99
+ logger: nil, monotonic: nil)
42
100
  @nwc = nwc_client
43
101
  @clock = clock
102
+ @monotonic = monotonic || -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }
44
103
  @env = env
45
104
  @logger = logger
46
105
  @price_currencies = Array(price_currencies || ["USD"]).map { |value| value.to_s.upcase }
@@ -54,9 +113,37 @@ module OpenReceive
54
113
  attach_swap_provider_runtime!
55
114
  # The override relaxes only the spend refusal: receive-readiness and
56
115
  # encryption are still enforced, exactly as in the JS preflight.
57
- wallet_preflight!(
58
- allow_spend_capable: allow_spend_capable_wallet || spend_override_from_env?
59
- )
116
+ @allow_spend_capable = allow_spend_capable_wallet || spend_override_from_env?
117
+ @wallet_lock = Mutex.new
118
+ @wallet_pending = nil
119
+ @wallet_failed_at = 0.0
120
+ @wallet_retry_seconds = WALLET_RETRY_FIRST_SECONDS
121
+ begin
122
+ wallet_preflight!(allow_spend_capable: @allow_spend_capable)
123
+ rescue WalletUnreachable => e
124
+ # A relay that is down, slow or refusing at start-up says nothing
125
+ # about the code, so the shop starts and the check waits.
126
+ @wallet_pending = e.message
127
+ @wallet_failed_at = @monotonic.call
128
+ log_wallet(
129
+ :error,
130
+ "wallet.unreachable: OpenReceive could not reach the wallet's relay at start-up " \
131
+ "(#{e.message}). The first checkout after #{@wallet_retry_seconds} s tries again."
132
+ )
133
+ end
134
+ end
135
+
136
+ # Returns once the wallet check has passed; every wallet call goes
137
+ # through here. Until then it raises the retryable 503
138
+ # WALLET_UNAVAILABLE, after checking again when the wait since the last
139
+ # failure is over: the call that finds the wait over runs the check,
140
+ # concurrent callers wait for its outcome, and on a pass the call goes on
141
+ # to the wallet. A later check refuses what the constructor refuses, so a
142
+ # wallet that cannot receive, or can spend, stays off.
143
+ def ensure_wallet!
144
+ return if @wallet_pending.nil?
145
+
146
+ @wallet_lock.synchronize { check_wallet_again! }
60
147
  end
61
148
 
62
149
  def prepare_checkout(input)
@@ -270,10 +357,12 @@ module OpenReceive
270
357
  "metadata" => data["metadata"],
271
358
  "expiry_seconds" => expiry
272
359
  )
273
- order = stringify(call_provider(provider, :create_swap,
274
- "pay_in_asset" => asset,
275
- "bolt11" => checkout.fetch("bolt11"),
276
- "invoice_amount_msats" => checkout.fetch("amount_msats")))
360
+ order = stringify(through_provider do
361
+ call_provider(provider, :create_swap,
362
+ "pay_in_asset" => asset,
363
+ "bolt11" => checkout.fetch("bolt11"),
364
+ "invoice_amount_msats" => checkout.fetch("amount_msats"))
365
+ end)
277
366
  swap_data = {
278
367
  "version" => 1,
279
368
  "provider_order" => order.reject { |key, _| key == "raw" }
@@ -288,7 +377,7 @@ module OpenReceive
288
377
  recovery = normalize_swap_data(swap_data)
289
378
  provider_name = recovery.fetch("provider_order").fetch("provider")
290
379
  provider = provider_by_name(provider_name)
291
- current = stringify(call_provider(provider, :get_status, recovery.fetch("provider_order")))
380
+ current = stringify(through_provider { call_provider(provider, :get_status, recovery.fetch("provider_order")) })
292
381
  public_swap(current, normalize_payment_hash(payment_hash), required_string(reference, "reference"))
293
382
  rescue KeyError => e
294
383
  raise ValidationError, e.message
@@ -303,11 +392,11 @@ module OpenReceive
303
392
  )
304
393
  provider_name = recovery.fetch("provider_order").fetch("provider")
305
394
  provider = provider_by_name(provider_name)
306
- current = stringify(call_provider(provider, :get_status, recovery.fetch("provider_order")))
395
+ current = stringify(through_provider { call_provider(provider, :get_status, recovery.fetch("provider_order")) })
307
396
  unless current["state"] == "refund_required"
308
397
  raise ConflictError, "Swap cannot be refunded from provider state #{current['state']}."
309
398
  end
310
- call_provider(provider, :request_refund, current, address)
399
+ through_provider { call_provider(provider, :request_refund, current, address) }
311
400
  get_swap(reference: host_reference, payment_hash: hash, swap_data: recovery)
312
401
  rescue KeyError => e
313
402
  raise ValidationError, e.message
@@ -349,15 +438,14 @@ module OpenReceive
349
438
  )
350
439
  end
351
440
 
352
- # Fail-closed boot preflight, mirroring the JS client preflight: a
441
+ # Fail-closed wallet check, mirroring the JS client preflight: a
353
442
  # connection that can report capabilities must be receive-ready and speak
354
443
  # an encryption mode we implement, and — unless the host overrides —
355
444
  # must not advertise spend methods.
356
445
  #
357
- # A read failure is NOT treated as transient. Booting blind only defers
358
- # the failure to the first customer checkout, where it costs a lost sale
359
- # instead of a loud boot error, so an info method that cannot answer
360
- # fails the boot.
446
+ # A read that could not reach the relay raises WalletUnreachable, which
447
+ # the callers defer: a relay that is down says nothing about the code.
448
+ # Any other read failure is a refusal.
361
449
  def wallet_preflight!(allow_spend_capable:)
362
450
  raw_info = read_wallet_info
363
451
  # The client exposes no info method at all: there is nothing to
@@ -396,9 +484,66 @@ module OpenReceive
396
484
  # surface it as itself rather than as a preflight failure.
397
485
  raise
398
486
  rescue StandardError => e
487
+ raise WalletUnreachable, redacted_failure(e) if self.class.wallet_unreachable?(e)
488
+
399
489
  raise WalletPreflightError, "could not read wallet info (#{e.class}: #{e.message})."
400
490
  end
401
491
 
492
+ # ensure_wallet! under the lock.
493
+ def check_wallet_again!
494
+ # Read again under the lock: the call that held it may have passed.
495
+ return if @wallet_pending.nil?
496
+ raise wallet_not_ready if @monotonic.call - @wallet_failed_at < @wallet_retry_seconds
497
+
498
+ @wallet_retry_seconds = [@wallet_retry_seconds * 2, WALLET_RETRY_MAX_SECONDS].min
499
+ begin
500
+ wallet_preflight!(allow_spend_capable: @allow_spend_capable)
501
+ rescue WalletUnreachable => e
502
+ @wallet_pending = e.message
503
+ @wallet_failed_at = @monotonic.call
504
+ log_wallet(
505
+ :warn,
506
+ "wallet.unreachable: OpenReceive still cannot reach the wallet's relay " \
507
+ "(#{e.message}). The first checkout after #{@wallet_retry_seconds} s tries again."
508
+ )
509
+ raise wallet_not_ready
510
+ rescue StandardError => e
511
+ @wallet_pending = redacted_failure(e)
512
+ @wallet_failed_at = @monotonic.call
513
+ log_wallet(
514
+ :error,
515
+ "wallet.refused: OpenReceive reached the wallet's relay, but the wallet check " \
516
+ "failed, so checkouts stay off (#{@wallet_pending}). The first checkout after " \
517
+ "#{@wallet_retry_seconds} s checks again."
518
+ )
519
+ raise wallet_not_ready
520
+ end
521
+ @wallet_pending = nil
522
+ @wallet_retry_seconds = WALLET_RETRY_FIRST_SECONDS
523
+ log_wallet(:info, "wallet.reachable: OpenReceive reached the wallet's relay and the wallet check passed.")
524
+ end
525
+
526
+ def wallet_not_ready
527
+ WalletFailureError.new(
528
+ "code" => "WALLET_UNAVAILABLE", "message" => WALLET_NOT_READY_MESSAGE, "retryable" => true
529
+ )
530
+ end
531
+
532
+ # The wallet check's lines reach a log even when the host passed no
533
+ # logger: the shop runs on without its wallet until they are read.
534
+ def log_wallet(level, message)
535
+ if @logger
536
+ @logger.public_send(level, message)
537
+ else
538
+ warn "[openreceive] #{message}"
539
+ end
540
+ end
541
+
542
+ # One line, redacted: the spend refusal's own text runs over several.
543
+ def redacted_failure(error)
544
+ OpenReceive::Nwc.redact_error_text("#{error.class}: #{error.message}").gsub(/\s*\n\s*/, " ")
545
+ end
546
+
402
547
  def spend_override_from_env?
403
548
  raw = @env["OPENRECEIVE_ALLOW_SPEND_CAPABLE_NWC"].to_s.strip.downcase
404
549
  return false if raw.empty?
@@ -724,15 +869,42 @@ module OpenReceive
724
869
  # create_swap) would invoke it a second time — two invoices for one
725
870
  # attempt. Wallet failures normalize to the shared error vocabulary.
726
871
  def call_nwc(method, input)
727
- if keyword_style?(@nwc.method(method))
728
- @nwc.public_send(method, **input.transform_keys(&:to_sym))
729
- else
730
- @nwc.public_send(method, input)
872
+ ensure_wallet!
873
+ begin
874
+ if keyword_style?(@nwc.method(method))
875
+ @nwc.public_send(method, **input.transform_keys(&:to_sym))
876
+ else
877
+ @nwc.public_send(method, input)
878
+ end
879
+ rescue ValidationError, WalletContractError, NotImplementedHttpError
880
+ raise
881
+ rescue StandardError => e
882
+ raise WalletFailureError, OpenReceive::Nwc.normalize_wallet_error(e)
731
883
  end
732
- rescue ValidationError, WalletContractError, NotImplementedHttpError
884
+ end
885
+
886
+ # Run one outbound provider call, mapping its transport failures to the
887
+ # 502/503 the swap routes declare (the JS throughProvider). A provider
888
+ # refusal, outage, 429 or this process's weight budget is not an
889
+ # OpenReceive bug: unmapped, it would reach the payer as the opaque 500.
890
+ # The provider's own text is logged for the operator, never sent.
891
+ def through_provider
892
+ yield
893
+ rescue ServiceError
733
894
  raise
734
895
  rescue StandardError => e
735
- raise WalletFailureError, OpenReceive::Nwc.normalize_wallet_error(e)
896
+ failure = Swap.classify_transport_failure(e)
897
+ raise if failure.nil?
898
+
899
+ @logger&.warn("swap.provider.#{failure}: #{OpenReceive::Nwc.redact_error_text("#{e.class}: #{e.message}")}")
900
+ raise ServiceError.new(502, "INTERNAL", SWAP_PROVIDER_REFUSED_MESSAGE) if failure == "refused"
901
+
902
+ raise ServiceError.new(
903
+ 503,
904
+ "INTERNAL",
905
+ failure == "rate_limited" ? SWAP_PROVIDER_RATE_LIMITED_MESSAGE : SWAP_PROVIDER_UNREACHABLE_MESSAGE,
906
+ retryable: true
907
+ )
736
908
  end
737
909
 
738
910
  def call_provider(provider, method, *args)
@@ -84,6 +84,23 @@ module OpenReceive
84
84
  error.respond_to?(:weight_budget?) && error.weight_budget? == true
85
85
  end
86
86
 
87
+ # A provider call's failure as "unreachable" (no answer: network,
88
+ # timeout, 5xx, unparsable body), "rate_limited" (a 429, or this
89
+ # process's own weight budget) or "refused" (the provider answered no);
90
+ # nil when the error is not a provider transport failure at all. Twin of
91
+ # the JS classifySwapTransportFailure.
92
+ def classify_transport_failure(error)
93
+ return "rate_limited" if weight_budget_error?(error)
94
+ return nil unless error.is_a?(FixedFloatApiError)
95
+ return "rate_limited" if error.kind == "rate_limited" || error.http_status == 429
96
+ if %w[timeout network invalid_json].include?(error.kind) ||
97
+ (!error.http_status.nil? && error.http_status >= 500)
98
+ return "unreachable"
99
+ end
100
+
101
+ "refused"
102
+ end
103
+
87
104
  # Payer-facing copy per availability reason (mirrors
88
105
  # fixedFloatAvailabilityMessage).
89
106
  def availability_message(reason)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OpenReceive
4
4
  module Server
5
- VERSION = "0.4.32"
5
+ VERSION = "0.4.33"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openreceive-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.32
4
+ version: 0.4.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenReceive
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.4.32
18
+ version: 0.4.33
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.4.32
25
+ version: 0.4.33
26
26
  description: |
27
27
  Accept Bitcoin Lightning payments directly into a wallet you control, from your
28
28
  Ruby or Rack application. OpenReceive provides invoice creation, payment checks,