Class: Inpay::Postback
- Inherits:
-
Object
show all
- Defined in:
- lib/inpay/postback.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(request, secret_key) ⇒ Postback
Returns a new instance of Postback.
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/inpay/postback.rb', line 10
def initialize request, secret_key
raise NoDataError if request.nil? || request.raw_post.to_s.blank?
@secret_key = secret_key
@remote_ip = request.remote_ip
@params = {}
@raw = ''
parse(request.raw_post)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
50
51
52
|
# File 'lib/inpay/postback.rb', line 50
def method_missing(method, *args)
params[method.to_s] || super
end
|
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
8
9
10
|
# File 'lib/inpay/postback.rb', line 8
def error
@error
end
|
#params ⇒ Object
Returns the value of attribute params.
8
9
10
|
# File 'lib/inpay/postback.rb', line 8
def params
@params
end
|
#raw ⇒ Object
Returns the value of attribute raw.
8
9
10
|
# File 'lib/inpay/postback.rb', line 8
def raw
@raw
end
|
Instance Method Details
#approved? ⇒ Boolean
30
31
32
|
# File 'lib/inpay/postback.rb', line 30
def approved?
status == :approved
end
|
#cancelled? ⇒ Boolean
34
35
36
|
# File 'lib/inpay/postback.rb', line 34
def cancelled?
status == :cancelled
end
|
#error? ⇒ Boolean
46
47
48
|
# File 'lib/inpay/postback.rb', line 46
def error?
status == :error
end
|
#genuine? ⇒ Boolean
acknowledge postback data
#pending? ⇒ Boolean
22
23
24
|
# File 'lib/inpay/postback.rb', line 22
def pending?
status == :pending
end
|
#refund_pending? ⇒ Boolean
42
43
44
|
# File 'lib/inpay/postback.rb', line 42
def refund_pending?
status == :refund_pending
end
|
#refunded? ⇒ Boolean
38
39
40
|
# File 'lib/inpay/postback.rb', line 38
def refunded?
status == :refunded?
end
|
#status ⇒ Object
62
63
64
|
# File 'lib/inpay/postback.rb', line 62
def status
@status ||= (params[:invoice_status] ? params[:invoice_status].to_sym : nil)
end
|
#sum_too_low? ⇒ Boolean
26
27
28
|
# File 'lib/inpay/postback.rb', line 26
def sum_too_low?
status == :sum_too_low
end
|