Sha256: 76e9fe9c3e319fe1a64ee092ac4b15d17de0207e2011ec467515ce0adb18a11c
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 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.new(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 = [] data[:payments].each do |data| payments << Tikkie::Api::Responses::Payment.new(data) end payments end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tikkie-api-0.1.1 | lib/tikkie/api/responses/payment_request.rb |
tikkie-api-0.1.0 | lib/tikkie/api/responses/payment_request.rb |