Sha256: de97d698a6335bf04d105aceab6941bb617204ba53819e5912be596e7639bd65
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true require 'bigdecimal' require 'time' module Tikkie module Api module Responses # Response for a payment request. class PaymentRequest < Base def payment_request_token data[:paymentRequestToken] end def amount decimal = BigDecimal(data[:amountInCents]) decimal /= 100.0 decimal end def currency data[:currency] end def created_at Time.parse(data[:created]) if data[:created] end def expired_at Time.parse(data[:expired]) if data[:expired] end # see PaymentRequestStatus def status data[:status] end def expired? status == Tikkie::Api::Types::PaymentRequestStatus::EXPIRED end def bank_account_yielded_too_fast? data[:bankAccountYieldedTooFast] end def external_id data[:externalId] end def payments @payments ||= begin payments = [] if data[:payments] data[:payments].each do |data| payments << Tikkie::Api::Responses::Payment.new(data) end end payments end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tikkie-api-0.2.2 | lib/tikkie/api/responses/payment_request.rb |