Class: Pay
- Inherits:
-
Object
- Object
- Pay
- Defined in:
- lib/mozpay/base.rb
Constant Summary collapse
- @@purchaseQueue =
This array keeps track of the tokens waiting for marketplace responses
{}
Class Method Summary collapse
-
.checkQueue(token) ⇒ Object
Check purchaseQueue to see if token has resolved.
-
.hi ⇒ Object
This is here solely to make sure I set up tests correctly.
-
.request(payload) ⇒ Object
Encode a JWT payment request.
Class Method Details
.checkQueue(token) ⇒ Object
Check purchaseQueue to see if token has resolved
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mozpay/base.rb', line 22 def self.checkQueue(token) status = @@purchaseQueue[token] if status if status != 'processing' delete @@purchaseQueue[token] end return status || 'notfound' else return 'notfound' end end |
.hi ⇒ Object
This is here solely to make sure I set up tests correctly.
7 8 9 |
# File 'lib/mozpay/base.rb', line 7 def self.hi return "Hello world!" end |
.request(payload) ⇒ Object
Encode a JWT payment request.
94 95 96 97 98 |
# File 'lib/mozpay/base.rb', line 94 def self.request(payload) jwt_encoded = JWT.encode(payload, config.mozPaySecret, "HS256") purchaseQueue[payload[productData]] = 'processing'; return jwt_encoded end |