Class: Barion::PaymentTransaction
Overview
Barion Transaction implementation
Instance Method Summary
collapse
#deserialize, #key_names, #process_response, #serializable_hash
Instance Method Details
#currency=(val = nil) ⇒ Object
77
78
79
|
# File 'app/models/barion/payment_transaction.rb', line 77
def currency=(val = nil)
super(val || payment&.currency)
end
|
#deserialize_options ⇒ Object
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'app/models/barion/payment_transaction.rb', line 106
def deserialize_options
{
except: %i[items],
map: {
keys: {
_all: :underscore,
POSTransactionId: 'pos_transaction_id'
},
values: {
_all: proc { |v| v.respond_to?(:underscore) ? v.underscore : v },
_except: %w[Currency]
}
}
}
end
|
#serialize_options ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'app/models/barion/payment_transaction.rb', line 91
def serialize_options
{ except: %i[id status created_at updated_at transaction_type related_id],
include: %i[items],
map: {
keys: {
_all: :camelize,
pos_transaction_id: 'POSTransactionId'
},
values: {
_all: proc { |v| v.respond_to?(:camelize) ? v.camelize : v },
_except: %w[items pos_transaction_id payee comment]
}
} }
end
|
#set_defaults ⇒ Object
81
82
83
84
|
# File 'app/models/barion/payment_transaction.rb', line 81
def set_defaults
self.currency = payment&.currency if currency.nil?
self.payee = ::Barion.config.default_payee if payee.nil?
end
|
#total=(value) ⇒ Object
86
87
88
89
|
# File 'app/models/barion/payment_transaction.rb', line 86
def total=(value)
value = calc_item_totals if value.nil?
super(value)
end
|