Class: Pin::Refund

Inherits:
Base
  • Object
show all
Defined in:
lib/pin-payments/refund.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

find, first, #initialize, last

Constructor Details

This class inherits a constructor from Pin::Base

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def amount
  @amount
end

#chargeObject

Returns the value of attribute charge.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def charge
  @charge
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def currency
  @currency
end

#error_messageObject

Returns the value of attribute error_message.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def error_message
  @error_message
end

#successObject

Returns the value of attribute success.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def success
  @success
end

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/pin-payments/refund.rb', line 3

def token
  @token
end

Class Method Details

.all(charge_or_charge_id) ⇒ Object



17
18
19
# File 'lib/pin-payments/refund.rb', line 17

def all(charge_or_charge_id)
  super(path: path_for(charge_or_charge_id))
end

.create(charge_or_charge_id, amount = nil) ⇒ Object

provide a charge object, or charge ID, and it will be refunded optionally provide an amount in cents, greater than equal to 100, to refund defaults to the full amount of the charge



11
12
13
14
15
# File 'lib/pin-payments/refund.rb', line 11

def create(charge_or_charge_id, amount = nil)
  raise "`amount` must be greater than or equal to 100" if !amount.nil? && amount < 100

  super({amount: amount}, path_for(charge_or_charge_id))
end