Class: Tinkoff::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/tinkoff/notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Notification

Returns a new instance of Notification.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tinkoff/notification.rb', line 6

def initialize(params)
  @terminal_key = params['TerminalKey']
  @order_id = params['OrderId']
  @success = params['Success'] == 'true'
  @status = params['Status']
  @payment_id = params['PaymentId'].to_i
  @error_code = params['ErrorCode']
  @amount = params['Amount'].to_i
  @rebill_id = params['RebillId'].to_i
  @card_id = params['CardId'].to_i
  @pan = params['Pan']
  @token = params['Token']
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def amount
  @amount
end

#card_idObject (readonly)

Returns the value of attribute card_id.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def card_id
  @card_id
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def error_code
  @error_code
end

#order_idObject (readonly)

Returns the value of attribute order_id.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def order_id
  @order_id
end

#panObject (readonly)

Returns the value of attribute pan.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def pan
  @pan
end

#payment_idObject (readonly)

Returns the value of attribute payment_id.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def payment_id
  @payment_id
end

#rebill_idObject (readonly)

Returns the value of attribute rebill_id.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def rebill_id
  @rebill_id
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def status
  @status
end

#successObject (readonly)

Returns the value of attribute success.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def success
  @success
end

#terminal_keyObject (readonly)

Returns the value of attribute terminal_key.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def terminal_key
  @terminal_key
end

#tokenObject (readonly)

Returns the value of attribute token.



3
4
5
# File 'lib/tinkoff/notification.rb', line 3

def token
  @token
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/tinkoff/notification.rb', line 24

def failure?
  !@success
end

#success?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/tinkoff/notification.rb', line 20

def success?
  @success
end