Class: Bluepay::TransactionBase
- Inherits:
-
Base
- Object
- Base
- Bluepay::TransactionBase
show all
- Includes:
- BP10EMU
- Defined in:
- lib/bluepay/transaction_base.rb
Constant Summary
Constants included
from BP10EMU
BP10EMU::PATH
Constants included
from Parameters
Parameters::BOOLEAN_CONVERTER, Parameters::DEFAULT_CONVERTER
Instance Attribute Summary collapse
Attributes inherited from Base
#request, #response
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from BP10EMU
#data
Methods included from Interface
#data, #path
Methods included from Parameters
#bluepay_params, #converted_params, included, #params
#hash, #tps
Constructor Details
7
8
9
10
|
# File 'lib/bluepay/transaction_base.rb', line 7
def initialize(*args)
super(*args)
self.source = params.delete(:source)
end
|
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
5
6
7
|
# File 'lib/bluepay/transaction_base.rb', line 5
def source
@source
end
|
Class Method Details
.create!(params = {}) ⇒ Object
12
13
14
|
# File 'lib/bluepay/transaction_base.rb', line 12
def self.create!(params={})
new(params).create!
end
|
Instance Method Details
#create! ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bluepay/transaction_base.rb', line 16
def create!
@request = Request.new(self)
@response = request.execute!
_params = response.params
(class << self; self; end).class_eval do
_params.each { |k, v| define_method(k) { v } }
end
self
end
|
#request_params ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/bluepay/transaction_base.rb', line 40
def request_params
_params = bluepay_params
_params.merge!(source.bluepay_params) if source
_params.merge!(tps(
:transaction_type,
:amount,
:rebilling,
:reb_first_date,
:reb_expr,
:reb_cycles,
:reb_amount,
:rrno,
:mode
))
_params
end
|
#to_h ⇒ Object
27
28
29
|
# File 'lib/bluepay/transaction_base.rb', line 27
def to_h
response.data
end
|