lib/paidy/charge.rb in paidy-0.0.4 vs lib/paidy/charge.rb in paidy-0.0.5

- old
+ new

@@ -16,13 +16,14 @@ end def initialize(id) @id = id @capture_id = nil + @amount = nil end - attr_reader :id, :capture_id + attr_reader :id, :capture_id, :amount def capture res = Paidy.request(:post, "#{base_path}/captures", {}, {}) @capture_id = res['captures'][0]['id'] @@ -53,9 +54,11 @@ end end def refresh res = Paidy.request(:get, "payments/#{id}") + + @amount = res['amount'] if res['status'] == 'closed' && res['captures'].present? @capture_id = res['captures'][0]['id'] end end