Class: Buckaroo::Ideal::Response
- Inherits:
-
Object
- Object
- Buckaroo::Ideal::Response
- Includes:
- Util
- Defined in:
- lib/buckaroo-ideal/response.rb
Constant Summary
Constants included from Util
Instance Attribute Summary collapse
-
#amount ⇒ Float
readonly
The amount that was transferred during the transaction.
-
#currency ⇒ String
readonly
The currency that was used during the transaction.
-
#invoice_number ⇒ String
readonly
The invoice_number that was given to the
Buckaroo::Ideal::Order
. -
#parameters ⇒ Hash
readonly
The raw parameters that form the heart of the response.
-
#reference ⇒ String
readonly
The reference that was given to the
Buckaroo::Ideal::Order
. -
#signature ⇒ Buckaroo::Ideal::ResponseSignature
readonly
The signature of the transaction, which can be used to validate it’s authenticity.
-
#status ⇒ Buckaroo::Ideal::Status
readonly
The status of the transaction.
-
#test_mode ⇒ Boolean
readonly
Returns
true
if the transaction was a test,false
if it was real. -
#time ⇒ Time
readonly
The date and time of the transaction.
-
#timestamp ⇒ String
readonly
The timestamp of the transaction.
-
#transaction_id ⇒ String
readonly
The unique code that is given to the transaction by Buckaroo’s Payment Gateway.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Response
constructor
A new instance of Response.
- #valid? ⇒ Boolean
Methods included from Util
#compact, #from_cents, #from_numeric_boolean, #to_cents, #to_normalized_string, #to_numeric_boolean
Constructor Details
#initialize(params = {}) ⇒ Response
Returns a new instance of Response.
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/buckaroo-ideal/response.rb', line 45 def initialize(params = {}) @parameters = params @transaction_id = parameters['bpe_trx'] @reference = parameters['bpe_reference'] @invoice_number = parameters['bpe_invoice'] @currency = parameters['bpe_currency'] @timestamp = parameters['bpe_timestamp'] @time = Time.parse() @amount = from_cents(parameters['bpe_amount']) @test_mode = from_numeric_boolean(parameters['bpe_mode']) @status = Status.new(parameters['bpe_result']) @signature = ResponseSignature.new(self, parameters['bpe_signature2']) end |
Instance Attribute Details
#amount ⇒ Float (readonly)
Returns The amount that was transferred during the transaction.
39 40 41 |
# File 'lib/buckaroo-ideal/response.rb', line 39 def amount @amount end |
#currency ⇒ String (readonly)
Returns The currency that was used during the transaction.
30 31 32 |
# File 'lib/buckaroo-ideal/response.rb', line 30 def currency @currency end |
#invoice_number ⇒ String (readonly)
Returns The invoice_number that was given to the Buckaroo::Ideal::Order
.
23 24 25 |
# File 'lib/buckaroo-ideal/response.rb', line 23 def invoice_number @invoice_number end |
#parameters ⇒ Hash (readonly)
Returns The raw parameters that form the heart of the response.
8 9 10 |
# File 'lib/buckaroo-ideal/response.rb', line 8 def parameters @parameters end |
#reference ⇒ String (readonly)
Returns The reference that was given to the Buckaroo::Ideal::Order
.
19 20 21 |
# File 'lib/buckaroo-ideal/response.rb', line 19 def reference @reference end |
#signature ⇒ Buckaroo::Ideal::ResponseSignature (readonly)
Returns The signature of the transaction, which can be used to validate it’s authenticity.
27 28 29 |
# File 'lib/buckaroo-ideal/response.rb', line 27 def signature @signature end |
#status ⇒ Buckaroo::Ideal::Status (readonly)
Returns The status of the transaction.
15 16 17 |
# File 'lib/buckaroo-ideal/response.rb', line 15 def status @status end |
#test_mode ⇒ Boolean (readonly)
Returns true
if the transaction was a test, false
if it was real
43 44 45 |
# File 'lib/buckaroo-ideal/response.rb', line 43 def test_mode @test_mode end |
#time ⇒ Time (readonly)
Returns The date and time of the transaction.
33 34 35 |
# File 'lib/buckaroo-ideal/response.rb', line 33 def time @time end |
#timestamp ⇒ String (readonly)
Returns The timestamp of the transaction.
36 37 38 |
# File 'lib/buckaroo-ideal/response.rb', line 36 def @timestamp end |
#transaction_id ⇒ String (readonly)
Returns The unique code that is given to the transaction by Buckaroo’s Payment Gateway.
12 13 14 |
# File 'lib/buckaroo-ideal/response.rb', line 12 def transaction_id @transaction_id end |
Instance Method Details
#valid? ⇒ Boolean
59 60 61 |
# File 'lib/buckaroo-ideal/response.rb', line 59 def valid? signature.valid? end |