Class: CoinJarCheckout::IPN
- Inherits:
-
Object
- Object
- CoinJarCheckout::IPN
- Defined in:
- lib/coinjar-checkout/ipn.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#bitcoin_address ⇒ Object
Returns the value of attribute bitcoin_address.
-
#bitcoin_amount ⇒ Object
Returns the value of attribute bitcoin_amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#fee ⇒ Object
Returns the value of attribute fee.
-
#ipn_digest ⇒ Object
Returns the value of attribute ipn_digest.
-
#merchant_invoice ⇒ Object
Returns the value of attribute merchant_invoice.
-
#merchant_reference ⇒ Object
Returns the value of attribute merchant_reference.
-
#status ⇒ Object
Returns the value of attribute status.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #fetch_order ⇒ Object
-
#initialize(args) ⇒ IPN
constructor
A new instance of IPN.
- #reset(args) ⇒ Object
- #valid? ⇒ Boolean
- #verify ⇒ Object
Constructor Details
#initialize(args) ⇒ IPN
Returns a new instance of IPN.
6 7 8 |
# File 'lib/coinjar-checkout/ipn.rb', line 6 def initialize(args) reset(args) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def amount @amount end |
#bitcoin_address ⇒ Object
Returns the value of attribute bitcoin_address.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def bitcoin_address @bitcoin_address end |
#bitcoin_amount ⇒ Object
Returns the value of attribute bitcoin_amount.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def bitcoin_amount @bitcoin_amount end |
#currency ⇒ Object
Returns the value of attribute currency.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def currency @currency end |
#fee ⇒ Object
Returns the value of attribute fee.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def fee @fee end |
#ipn_digest ⇒ Object
Returns the value of attribute ipn_digest.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def ipn_digest @ipn_digest end |
#merchant_invoice ⇒ Object
Returns the value of attribute merchant_invoice.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def merchant_invoice @merchant_invoice end |
#merchant_reference ⇒ Object
Returns the value of attribute merchant_reference.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def merchant_reference @merchant_reference end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def status @status end |
#uuid ⇒ Object
Returns the value of attribute uuid.
4 5 6 |
# File 'lib/coinjar-checkout/ipn.rb', line 4 def uuid @uuid end |
Instance Method Details
#fetch_order ⇒ Object
18 19 20 |
# File 'lib/coinjar-checkout/ipn.rb', line 18 def fetch_order CoinJarCheckout::Order.find(uuid) end |
#reset(args) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/coinjar-checkout/ipn.rb', line 22 def reset(args) args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end self end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/coinjar-checkout/ipn.rb', line 14 def valid? verify end |
#verify ⇒ Object
10 11 12 |
# File 'lib/coinjar-checkout/ipn.rb', line 10 def verify ipn_digest == OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('sha256'), CoinJarCheckout.secret, "#{uuid}#{amount}#{currency}#{status}") end |