Class: Bitkassa::PaymentRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/bitkassa/payment_request.rb

Overview

Make a PaymentRequest.

This will return the payment-response whith all returned information. A payment-request consists of a payload containing the information for the payment and an authentication message, being a signed version of the payload.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Request

#initialize, #perform

Constructor Details

This class inherits a constructor from Bitkassa::Request

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def amount
  @amount
end

#currencyObject

Returns the value of attribute currency.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def description
  @description
end

#meta_infoObject

Returns the value of attribute meta_info.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def meta_info
  @meta_info
end

#return_urlObject

Returns the value of attribute return_url.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def return_url
  @return_url
end

#update_urlObject

Returns the value of attribute update_url.



10
11
12
# File 'lib/bitkassa/payment_request.rb', line 10

def update_url
  @update_url
end

Instance Method Details

#attributesObject

Attributes for the payload

  • attributes Hash:

** currency String required. “EUR” or “BTC” ** amount Integer required, amount to be paid in cents or satoshis ** description, ** return_url, ** update_url, ** meta_info



26
27
28
29
30
31
32
33
34
35
# File 'lib/bitkassa/payment_request.rb', line 26

def attributes
  {
    currency: @currency,
    amount: @amount,
    description: @description,
    return_url: @return_url,
    update_url: @update_url,
    meta_info: @meta_info
  }
end

#can_perform?Boolean

Override can_perform the require “currency” and “amount”

Returns:

  • (Boolean)


39
40
41
42
43
# File 'lib/bitkassa/payment_request.rb', line 39

def can_perform?
  return false if currency.nil?
  return false if amount.nil?
  super
end

#payload_actionObject

Payload action is “start_payment”



47
48
49
# File 'lib/bitkassa/payment_request.rb', line 47

def payload_action
  "start_payment"
end