Class: Supreme::Status

Inherits:
Response show all
Defined in:
lib/supreme/response.rb

Overview

Response to a check request

Instance Attribute Summary

Attributes inherited from Response

#body

Instance Method Summary collapse

Methods inherited from Response

#error?, for, #initialize

Constructor Details

This class inherits a constructor from Supreme::Response

Instance Method Details

#amountObject



64
65
66
# File 'lib/supreme/response.rb', line 64

def amount
  text('//amount')
end

#currencyObject



68
69
70
# File 'lib/supreme/response.rb', line 68

def currency
  text('//currency')
end

#customerObject



111
112
113
114
115
116
117
# File 'lib/supreme/response.rb', line 111

def customer
  {
    'name' => text('//consumerName'),
    'account' => text('//consumerAccount'),
    'city' => text('//consumerCity')
  }
end


72
73
74
# File 'lib/supreme/response.rb', line 72

def paid
  text('//payed')
end

#paid?Boolean

A payment will return paid? for just one request. If you issue it too early you might never get a truthy value from this.

Returns:

  • (Boolean)


78
79
80
# File 'lib/supreme/response.rb', line 78

def paid?
  paid == 'true'
end

#statusObject

Returns the status of the payment. This is probably the best way to check if the payment has succeeded. It returns one of the following values:

  • Open – Payment is still processing.

  • Success – The payment was successful.

  • Cancelled – The payment was explicitly cancelled by the customer.

  • Failure – The payment failed.

  • Expired – The customer abandoned the payment, we don’t expect them to finish it.

  • CheckedBefore – You’ve requested the payment status before.

You can also check the status of the payment with one of the boolean accessors: open?, success?, cancelled?, failed?, expired?, and checked_before?.



94
95
96
# File 'lib/supreme/response.rb', line 94

def status
  text('//status')
end

#transaction_idObject



60
61
62
# File 'lib/supreme/response.rb', line 60

def transaction_id
  text('//transaction_id')
end