mirror of
https://github.com/bumi/blockstream_satellite
synced 2025-06-16 17:55:35 +00:00
Slightly better error handling
Allows to inspect the transmitted file and returns the lnd response in case of a payment error
This commit is contained in:
parent
e8acab0da9
commit
adda9e1879
@ -7,7 +7,7 @@ require 'securerandom'
|
|||||||
module BlockstreamSatellite
|
module BlockstreamSatellite
|
||||||
class Order
|
class Order
|
||||||
|
|
||||||
attr_accessor :attributes
|
attr_accessor :attributes, :file
|
||||||
|
|
||||||
def initialize(attributes)
|
def initialize(attributes)
|
||||||
self.attributes = attributes.with_indifferent_access
|
self.attributes = attributes.with_indifferent_access
|
||||||
@ -37,7 +37,7 @@ module BlockstreamSatellite
|
|||||||
options[:file] = UploadIO.new(options[:file], 'text/plain')
|
options[:file] = UploadIO.new(options[:file], 'text/plain')
|
||||||
response = BlockstreamSatellite.client.post('order', options)
|
response = BlockstreamSatellite.client.post('order', options)
|
||||||
if response.success?
|
if response.success?
|
||||||
Order.new(response.body)
|
Order.new(response.body).tap { |o| o.file = options[:file] }
|
||||||
else
|
else
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
@ -59,8 +59,12 @@ module BlockstreamSatellite
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pay
|
def pay
|
||||||
BlockstreamSatellite.client.pay(self.payreq)
|
response = BlockstreamSatellite.client.pay(self.payreq)
|
||||||
self.refresh
|
if response.payment_error == ''
|
||||||
|
self.refresh
|
||||||
|
else
|
||||||
|
response
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def bump(bid_increase)
|
def bump(bid_increase)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user