class PagSeguro::TransactionRefund::RequestSerializer
Attributes
refund[R]
The refund that will be serialized.
Public Class Methods
new(refund)
click to toggle source
# File lib/pagseguro/transaction_refund/request_serializer.rb, line 7 def initialize(refund) @refund = refund end
Public Instance Methods
to_params()
click to toggle source
# File lib/pagseguro/transaction_refund/request_serializer.rb, line 11 def to_params {}.tap do |data| data[:transactionCode] = refund.transaction_code data[:refundValue] = to_amount(refund.value) end.delete_if { |_, value| value.nil? } end
Private Instance Methods
to_amount(amount)
click to toggle source
# File lib/pagseguro/transaction_refund/request_serializer.rb, line 19 def to_amount(amount) "%.2f" % BigDecimal(amount.to_s.to_f.to_s).round(2).to_s("F") if amount end