Class: Buckaroo::Ideal::Response

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/buckaroo-ideal/response.rb

Constant Summary

Constants included from Util

Util::STRIP_ACCENTS_RE

Instance Attribute Summary collapse

Instance Method Summary collapse

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(timestamp)
  @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

#amountFloat (readonly)

Returns The amount that was transferred during the transaction.

Returns:

  • (Float)

    The amount that was transferred during the transaction



39
40
41
# File 'lib/buckaroo-ideal/response.rb', line 39

def amount
  @amount
end

#currencyString (readonly)

Returns The currency that was used during the transaction.

Returns:

  • (String)

    The currency that was used during the transaction



30
31
32
# File 'lib/buckaroo-ideal/response.rb', line 30

def currency
  @currency
end

#invoice_numberString (readonly)

Returns The invoice_number that was given to the Buckaroo::Ideal::Order.

Returns:

  • (String)

    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

#parametersHash (readonly)

Returns The raw parameters that form the heart of the response.

Returns:

  • (Hash)

    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

#referenceString (readonly)

Returns The reference that was given to the Buckaroo::Ideal::Order.

Returns:

  • (String)

    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

#signatureBuckaroo::Ideal::ResponseSignature (readonly)

Returns The signature of the transaction, which can be used to validate it’s authenticity.

Returns:



27
28
29
# File 'lib/buckaroo-ideal/response.rb', line 27

def signature
  @signature
end

#statusBuckaroo::Ideal::Status (readonly)

Returns The status of the transaction.

Returns:



15
16
17
# File 'lib/buckaroo-ideal/response.rb', line 15

def status
  @status
end

#test_modeBoolean (readonly)

Returns true if the transaction was a test, false if it was real

Returns:

  • (Boolean)

    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

#timeTime (readonly)

Returns The date and time of the transaction.

Returns:

  • (Time)

    The date and time of the transaction



33
34
35
# File 'lib/buckaroo-ideal/response.rb', line 33

def time
  @time
end

#timestampString (readonly)

Returns The timestamp of the transaction.

Returns:

  • (String)

    The timestamp of the transaction



36
37
38
# File 'lib/buckaroo-ideal/response.rb', line 36

def timestamp
  @timestamp
end

#transaction_idString (readonly)

Returns The unique code that is given to the transaction by Buckaroo’s Payment Gateway.

Returns:

  • (String)

    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

Returns:

  • (Boolean)


59
60
61
# File 'lib/buckaroo-ideal/response.rb', line 59

def valid?
  signature.valid?
end