Class: Tinkoff::Payment

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Payment

Returns a new instance of Payment.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tinkoff/payment.rb', line 9

def initialize(response)
  @terminal_key = response['TerminalKey']
  @amount = response['Amount']
  @order_id = response['OrderId']
  @success = response['Success']
  @status = response['Status']
  @payment_id = response['PaymentId']
  @error_code = response['ErrorCode']
  @payment_url = response['PaymentURL']
  @message = response['Message']
  @details = response['Details']

  # Attributes for Cancel method
  @original_amount = response['OriginalAmount']
  @new_amount = response['NewAmount']
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



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

def amount
  @amount
end

#detailsObject (readonly)

Returns the value of attribute details.



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

def details
  @details
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



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

def error_code
  @error_code
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#new_amountObject (readonly)

Attributes for Cancel method



7
8
9
# File 'lib/tinkoff/payment.rb', line 7

def new_amount
  @new_amount
end

#order_idObject (readonly)

Returns the value of attribute order_id.



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

def order_id
  @order_id
end

#original_amountObject (readonly)

Attributes for Cancel method



7
8
9
# File 'lib/tinkoff/payment.rb', line 7

def original_amount
  @original_amount
end

#payment_idObject (readonly)

Returns the value of attribute payment_id.



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

def payment_id
  @payment_id
end

#payment_urlObject (readonly)

Returns the value of attribute payment_url.



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

def payment_url
  @payment_url
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#successObject (readonly)

Returns the value of attribute success.



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

def success
  @success
end

#terminal_keyObject (readonly)

Returns the value of attribute terminal_key.



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

def terminal_key
  @terminal_key
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/tinkoff/payment.rb', line 26

def failure?
  !@success
end

#success?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/tinkoff/payment.rb', line 30

def success?
  !failure?
end