Class: Docproof::PaymentProcessor
- Inherits:
-
Object
- Object
- Docproof::PaymentProcessor
- Defined in:
- lib/docproof/payment_processor.rb,
lib/docproof/payment_processor/coinbase.rb
Defined Under Namespace
Classes: Coinbase, MissingCredentials, MissingDependency
Constant Summary collapse
- BTC_IN_SATOSHIS =
100_000_000
- MINIMUM_PRICE_IN_BTC =
0.005
Instance Attribute Summary collapse
-
#bitcoin_address ⇒ Object
readonly
Returns the value of attribute bitcoin_address.
-
#price_in_btc ⇒ Object
readonly
Returns the value of attribute price_in_btc.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PaymentProcessor
constructor
A new instance of PaymentProcessor.
- #perform! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ PaymentProcessor
Returns a new instance of PaymentProcessor.
14 15 16 17 18 19 20 21 |
# File 'lib/docproof/payment_processor.rb', line 14 def initialize(={}) @bitcoin_address = ['pay_address'] || ['payment_address'] # `price` given by the API is in satoshis (100_000_000 satoshis = 1 BTC) # and it is only available after successfully `register!` a document. @price_in_btc = MINIMUM_PRICE_IN_BTC @price_in_btc = ['price'].to_f / BTC_IN_SATOSHIS if ['price'] end |
Instance Attribute Details
#bitcoin_address ⇒ Object (readonly)
Returns the value of attribute bitcoin_address.
11 12 13 |
# File 'lib/docproof/payment_processor.rb', line 11 def bitcoin_address @bitcoin_address end |
#price_in_btc ⇒ Object (readonly)
Returns the value of attribute price_in_btc.
11 12 13 |
# File 'lib/docproof/payment_processor.rb', line 11 def price_in_btc @price_in_btc end |