Class: Supreme::Status
Overview
Response to a check request
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
- #amount ⇒ Object
- #currency ⇒ Object
- #customer ⇒ Object
- #paid ⇒ Object
-
#paid? ⇒ Boolean
A payment will return paid? for just one request.
-
#status ⇒ Object
Returns the status of the payment.
- #transaction_id ⇒ Object
Methods inherited from Response
Constructor Details
This class inherits a constructor from Supreme::Response
Instance Method Details
#amount ⇒ Object
64 65 66 |
# File 'lib/supreme/response.rb', line 64 def amount text('//amount') end |
#currency ⇒ Object
68 69 70 |
# File 'lib/supreme/response.rb', line 68 def currency text('//currency') end |
#customer ⇒ Object
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 |
#paid ⇒ Object
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.
78 79 80 |
# File 'lib/supreme/response.rb', line 78 def paid? paid == 'true' end |
#status ⇒ Object
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_id ⇒ Object
60 61 62 |
# File 'lib/supreme/response.rb', line 60 def transaction_id text('//transaction_id') end |