Class: Barion::GiftCardPurchase
Overview
Represents a Gift card purchase in Barion engine
Instance Method Summary
collapse
#deserialize, #deserialize_options, #key_names, #process_response, #serializable_hash
Instance Method Details
#amount ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/models/barion/gift_card_purchase.rb', line 46
def amount
value = super
return nil if value.nil?
case currency
when nil
value
when 'HUF'
value.round
else
value.round(2)
end
end
|
#currency ⇒ Object
60
61
62
63
64
|
# File 'app/models/barion/gift_card_purchase.rb', line 60
def currency
return nil if purchase.nil? || purchase.payment.nil?
purchase.payment.currency
end
|
#serialize_options ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'app/models/barion/gift_card_purchase.rb', line 33
def serialize_options
{ except: %i[id created_at updated_at currency],
map: {
keys: {
_all: :camelize
},
values: {
_all: proc { |v| v.respond_to?(:camelize) ? v.camelize : v },
amount: :as_string
}
} }
end
|