Class: Bitkassa::PaymentResponse
- Inherits:
-
Object
- Object
- Bitkassa::PaymentResponse
- Defined in:
- lib/bitkassa/payment_response.rb
Overview
A PaymentResponse
represents the immediate response after requesting a payment. It can will parse the JSON and contain the information nessecary to determine the status of the payment request.
Instance Attribute Summary collapse
-
#address ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#amount ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#bitcoin_url ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#error ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#expire ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#payment_id ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#payment_url ⇒ Object
Refer to
Initialize
for the description of all attributes. -
#success ⇒ Object
Refer to
Initialize
for the description of all attributes.
Class Method Summary collapse
-
.from_json(json) ⇒ Object
Generate a PaymentResponse from a JSON payload.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ PaymentResponse
constructor
Initialize a new payment response.
Constructor Details
#initialize(attributes) ⇒ PaymentResponse
Initialize a new payment response. Usually done by a PaymentRequest
.
Attributes:
-
payment_id
, Unique ID assigned to this payment by Bitkassa -
payment_url
, The Bitcoin payment URL which you can show (as link and/or QR) for the customer to pay from his wallet (if you’re hosting your own payment page) -
address
The Bitcoin address where the customer is supposed to send his payment. -
amount
, The amount in satoshis to be paid. -
expire
, Unix timestamp when the payment expires (typically 15 minutes after start) -
error
, Reason why the payment could not be initiated. Only set when payment errord. -
success
, Confirmation that the API call was processed successfull
38 39 40 41 42 43 |
# File 'lib/bitkassa/payment_response.rb', line 38 def initialize(attributes) attributes.each do |key, value| setter_method = "#{key}=".to_sym send(setter_method, value) end end |
Instance Attribute Details
#address ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def address @address end |
#amount ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def amount @amount end |
#bitcoin_url ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def bitcoin_url @bitcoin_url end |
#error ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def error @error end |
#expire ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def expire @expire end |
#payment_id ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def payment_id @payment_id end |
#payment_url ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def payment_url @payment_url end |
#success ⇒ Object
Refer to Initialize
for the description of all attributes.
8 9 10 |
# File 'lib/bitkassa/payment_response.rb', line 8 def success @success end |
Class Method Details
.from_json(json) ⇒ Object
Generate a PaymentResponse from a JSON payload.
18 19 20 |
# File 'lib/bitkassa/payment_response.rb', line 18 def self.from_json(json) new(JSON.parse(json)) end |