class Starling::Resources::PaymentResource

A resource representing a Payment returned from the Payment API

Public Instance Methods

amount() click to toggle source

@return [Float] the amount of the payment

# File lib/starling/resources/payment_resource.rb, line 17
def amount
  present_float(parsed_data['amount'])
end
cancelled_at() click to toggle source

@return [Time, nil] the time when the payment was cancelled, or nil if it has not

been cancelled
# File lib/starling/resources/payment_resource.rb, line 67
def cancelled_at
  present_datetime(parsed_data['cancelledAt'])
end
currency() click to toggle source

@return [String] the currency of the payment

# File lib/starling/resources/payment_resource.rb, line 12
def currency
  parsed_data['currency']
end
id()
Alias for: payment_order_id
immediate() click to toggle source

@return [true, false] where the payment is immediate or scheduled for the future

# File lib/starling/resources/payment_resource.rb, line 38
def immediate
  parsed_data['immediate']
end
next_date() click to toggle source

@return [Date] the date of the next payment in the series

# File lib/starling/resources/payment_resource.rb, line 61
def next_date
  present_date(parsed_data['nextDate'])
end
payment_order_id() click to toggle source

@return [String] the Starling internal ID of the payment

# File lib/starling/resources/payment_resource.rb, line 6
def payment_order_id
  parsed_data['paymentOrderId']
end
Also aliased as: id
payment_type() click to toggle source

@return [Symbol] the type of the payment (e.g. `:standing_order`) (these values

do not seem to be accurate!)
# File lib/starling/resources/payment_resource.rb, line 73
def payment_type
  present_enum(parsed_data['paymentType'])
end
receiving_contact_account_id() click to toggle source

@return [String] the Starling internal ID of the contact account the payment

is/was sent to
# File lib/starling/resources/payment_resource.rb, line 28
def receiving_contact_account_id
  parsed_data['receivingContactAccountId']
end
recipient_name() click to toggle source

@return [String] the name of the recipient of the payment

# File lib/starling/resources/payment_resource.rb, line 33
def recipient_name
  parsed_data['recipientName']
end
recurrence_rule() click to toggle source

Returns a Hash describing the recurrence behaviour of the payment, or nil if the payment is not recurring. The values in the Hash will be parsed directly from JSON (e.g. dates will appear as strings).

TODO: Consider replacing this with its own resource

@return [Hash, nil] a Hash describing the recurrence behaviour of the payment,

with values parsed directly from JSON, or nil if the payment
is not recurring
# File lib/starling/resources/payment_resource.rb, line 51
def recurrence_rule
  parsed_data['recurrenceRule']
end
reference() click to toggle source

@return [String] the reference of the payment

# File lib/starling/resources/payment_resource.rb, line 22
def reference
  parsed_data['reference']
end
start_date() click to toggle source

@return [Date] the start date of the payment

# File lib/starling/resources/payment_resource.rb, line 56
def start_date
  present_date(parsed_data['startDate'])
end