Class: PinPayment::Refund
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#charge ⇒ Object
readonly
Returns the value of attribute charge.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
-
.create(charge_or_token) ⇒ PinPayment::Refund
Uses the pin API to create a refund.
Instance Method Summary collapse
- #status ⇒ String
-
#success? ⇒ Boolean
TODO: API documentation only shows success as being “null” in the JSON response, so not sure this is possible.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PinPayment::Base
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/pin_payment/refund.rb', line 3 def amount @amount end |
#charge ⇒ Object
Returns the value of attribute charge.
3 4 5 |
# File 'lib/pin_payment/refund.rb', line 3 def charge @charge end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/pin_payment/refund.rb', line 3 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
3 4 5 |
# File 'lib/pin_payment/refund.rb', line 3 def currency @currency end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/pin_payment/refund.rb', line 3 def token @token end |
Class Method Details
.create(charge_or_token) ⇒ PinPayment::Refund
Uses the pin API to create a refund.
10 11 12 13 14 |
# File 'lib/pin_payment/refund.rb', line 10 def self.create charge_or_token token = charge_or_token.is_a?(Charge) ? charge_or_token.token : charge_or_token response = post(URI.parse(PinPayment.api_url).tap{|uri| uri.path = "/1/charges/#{token}/refunds" }) new(response.delete('token'), response) end |
Instance Method Details
#status ⇒ String
25 26 27 |
# File 'lib/pin_payment/refund.rb', line 25 def status end |
#success? ⇒ Boolean
TODO: API documentation only shows success as being “null” in the JSON response, so not sure this is possible. All my refunds on the test site end up in a “Pending” state so not entirely sure on this one.
20 21 22 |
# File 'lib/pin_payment/refund.rb', line 20 def success? @success == true end |