lib/paidy/charge.rb in paidy-0.0.5 vs lib/paidy/charge.rb in paidy-0.0.6
- old
+ new
@@ -17,13 +17,14 @@
def initialize(id)
@id = id
@capture_id = nil
@amount = nil
+ @status = nil
end
- attr_reader :id, :capture_id, :amount
+ attr_reader :id, :capture_id, :amount, :status
def capture
res = Paidy.request(:post, "#{base_path}/captures", {}, {})
@capture_id = res['captures'][0]['id']
@@ -56,9 +57,10 @@
def refresh
res = Paidy.request(:get, "payments/#{id}")
@amount = res['amount']
+ @status = res['status']
if res['status'] == 'closed' && res['captures'].present?
@capture_id = res['captures'][0]['id']
end
end