Class: Moneybookers::PaymentGateway::Response
- Inherits:
-
Object
- Object
- Moneybookers::PaymentGateway::Response
- Defined in:
- lib/moneybookers/payment_gateway/response.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #amount ⇒ Object
- #currency ⇒ Object
-
#initialize(params) ⇒ Response
constructor
A new instance of Response.
- #mb_transaction_id ⇒ Object
- #pay_on_demand_authorized? ⇒ Boolean
- #pay_on_demand_id ⇒ Object
- #processed? ⇒ Boolean
- #signature_verified?(args = {}) ⇒ Boolean
- #status ⇒ Object
- #status_code ⇒ Object
Constructor Details
#initialize(params) ⇒ Response
Returns a new instance of Response.
5 6 7 8 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 5 def initialize(params) raise ArgumentError.new("Params must be passed as a hash") unless params.kind_of?(Hash) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 3 def params @params end |
Instance Method Details
#amount ⇒ Object
36 37 38 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 36 def amount params["mb_amount"] end |
#currency ⇒ Object
40 41 42 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 40 def currency params["mb_currency"] end |
#mb_transaction_id ⇒ Object
44 45 46 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 44 def mb_transaction_id params["mb_transaction_id"] end |
#pay_on_demand_authorized? ⇒ Boolean
28 29 30 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 28 def processed? and (params["rec_payment_type"] == "on-demand") end |
#pay_on_demand_id ⇒ Object
32 33 34 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 32 def pay_on_demand_id params["rec_payment_id"] if end |
#processed? ⇒ Boolean
24 25 26 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 24 def processed? status == "processed" end |
#signature_verified?(args = {}) ⇒ Boolean
48 49 50 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 48 def signature_verified?(args={}) Moneybookers::Signature::Status.new(signature_params.merge(args)).match?(params["md5sig"]) end |
#status ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 14 def status case status_code when "2" then "processed" when "0" then "pending" when "-1" then "cancelled" when "-2" then "failed" when "-3" then "chargeback" end end |
#status_code ⇒ Object
10 11 12 |
# File 'lib/moneybookers/payment_gateway/response.rb', line 10 def status_code params["status"] end |