Class: GoCardlessPro::Resources::Payment
- Inherits:
-
Object
- Object
- GoCardlessPro::Resources::Payment
- Defined in:
- lib/gocardless_pro/resources/payment.rb
Overview
Payment objects represent payments from a [customer](#core-endpoints-customers) to a [creditor](#core-endpoints-creditors), taken against a Direct Debit [mandate](#core-endpoints-mandates).
GoCardless will notify you via a [webhook](#appendix-webhooks) whenever the state of a payment changes.
Defined Under Namespace
Classes: Links
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#amount_refunded ⇒ Object
readonly
Returns the value of attribute amount_refunded.
-
#charge_date ⇒ Object
readonly
Returns the value of attribute charge_date.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#faster_ach ⇒ Object
readonly
Returns the value of attribute faster_ach.
-
#fx ⇒ Object
readonly
Returns the value of attribute fx.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#retry_if_possible ⇒ Object
readonly
Returns the value of attribute retry_if_possible.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #api_response ⇒ Object
-
#initialize(object, response = nil) ⇒ Payment
constructor
Initialize a payment resource instance.
-
#links ⇒ Object
Return the links that the resource has.
-
#to_h ⇒ Object
Provides the payment resource as a hash of all its readable attributes.
Constructor Details
#initialize(object, response = nil) ⇒ Payment
Initialize a payment resource instance
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gocardless_pro/resources/payment.rb', line 26 def initialize(object, response = nil) @object = object @amount = object['amount'] @amount_refunded = object['amount_refunded'] @charge_date = object['charge_date'] @created_at = object['created_at'] @currency = object['currency'] @description = object['description'] @faster_ach = object['faster_ach'] @fx = object['fx'] @id = object['id'] @links = object['links'] @metadata = object['metadata'] @reference = object['reference'] @retry_if_possible = object['retry_if_possible'] @status = object['status'] @response = response end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def amount @amount end |
#amount_refunded ⇒ Object (readonly)
Returns the value of attribute amount_refunded.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def amount_refunded @amount_refunded end |
#charge_date ⇒ Object (readonly)
Returns the value of attribute charge_date.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def charge_date @charge_date end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def description @description end |
#faster_ach ⇒ Object (readonly)
Returns the value of attribute faster_ach.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def faster_ach @faster_ach end |
#fx ⇒ Object (readonly)
Returns the value of attribute fx.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def fx @fx end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def id @id end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def @metadata end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def reference @reference end |
#retry_if_possible ⇒ Object (readonly)
Returns the value of attribute retry_if_possible.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def retry_if_possible @retry_if_possible end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
21 22 23 |
# File 'lib/gocardless_pro/resources/payment.rb', line 21 def status @status end |
Instance Method Details
#api_response ⇒ Object
46 47 48 |
# File 'lib/gocardless_pro/resources/payment.rb', line 46 def api_response ApiResponse.new(@response) end |
#links ⇒ Object
Return the links that the resource has
51 52 53 |
# File 'lib/gocardless_pro/resources/payment.rb', line 51 def links @payment_links ||= Links.new(@links) end |
#to_h ⇒ Object
Provides the payment resource as a hash of all its readable attributes
56 57 58 |
# File 'lib/gocardless_pro/resources/payment.rb', line 56 def to_h @object end |