Class: Liqpay::Response
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- Liqpay::Response
- Defined in:
- lib/liqpay/response.rb
Constant Summary collapse
- SUCCESS_STATUSES =
%w(success wait_secure)
- ATTRIBUTES =
%w(public_key order_id amount currency description type status transaction_id sender_phone)
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Amount of payment.
-
#currency ⇒ Object
readonly
Currency of payment.
-
#sender_phone ⇒ Object
readonly
Payer’s phone.
-
#status ⇒ Object
readonly
Status of payment.
-
#transaction_id ⇒ Object
readonly
LiqPAY’s internal transaction ID.
Attributes inherited from BaseOperation
Instance Method Summary collapse
-
#initialize(params = {}, options = {}) ⇒ Response
constructor
A new instance of Response.
- #signature_fields ⇒ Object
-
#success? ⇒ Boolean
Returns true, if the transaction was successful.
Methods inherited from BaseOperation
Constructor Details
#initialize(params = {}, options = {}) ⇒ Response
Returns a new instance of Response.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/liqpay/response.rb', line 27 def initialize(params = {}, = {}) super() ATTRIBUTES.each do |attribute| instance_variable_set "@#{attribute}", params[attribute] end @request_signature = params["signature"] decode! end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Amount of payment. MUST match the requested amount
14 15 16 |
# File 'lib/liqpay/response.rb', line 14 def amount @amount end |
#currency ⇒ Object (readonly)
Currency of payment. MUST match the requested currency
16 17 18 |
# File 'lib/liqpay/response.rb', line 16 def currency @currency end |
#sender_phone ⇒ Object (readonly)
Payer’s phone
25 26 27 |
# File 'lib/liqpay/response.rb', line 25 def sender_phone @sender_phone end |
#status ⇒ Object (readonly)
Status of payment. One of ‘
failure
success
wait_secure - success, but the card wasn't known to the system
21 22 23 |
# File 'lib/liqpay/response.rb', line 21 def status @status end |
#transaction_id ⇒ Object (readonly)
LiqPAY’s internal transaction ID
23 24 25 |
# File 'lib/liqpay/response.rb', line 23 def transaction_id @transaction_id end |
Instance Method Details
#signature_fields ⇒ Object
43 44 45 |
# File 'lib/liqpay/response.rb', line 43 def signature_fields [amount, currency, public_key, order_id, type, description, status, transaction_id, sender_phone] end |
#success? ⇒ Boolean
Returns true, if the transaction was successful
39 40 41 |
# File 'lib/liqpay/response.rb', line 39 def success? SUCCESS_STATUSES.include? self.status end |