Class: MonoMerchant::Wallet::Payment
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- MonoMerchant::Wallet::Payment
- Defined in:
- lib/mono-merchant/wallet/payment.rb
Overview
Create payment for card token todo DRY it with Invoice::Create
Constant Summary
Constants inherited from ApiRequest
ApiRequest::API_URL, ApiRequest::DEFAULT_CURRENCY
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#card_token ⇒ Object
readonly
Returns the value of attribute card_token.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#customer_emails ⇒ Object
readonly
Returns the value of attribute customer_emails.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#initiation_kind ⇒ Object
readonly
Returns the value of attribute initiation_kind.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#redirect_url ⇒ Object
readonly
Returns the value of attribute redirect_url.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#webhook_url ⇒ Object
readonly
Returns the value of attribute webhook_url.
Attributes inherited from ApiRequest
Instance Method Summary collapse
-
#initialize(card_token, amount, currency = DEFAULT_CURRENCY, by_client: false, items: [], reference: nil, redirect_url: nil, webhook_url: nil, email: nil, destination: nil, comment: nil) ⇒ Payment
constructor
A new instance of Payment.
Methods inherited from ApiRequest
Constructor Details
#initialize(card_token, amount, currency = DEFAULT_CURRENCY, by_client: false, items: [], reference: nil, redirect_url: nil, webhook_url: nil, email: nil, destination: nil, comment: nil) ⇒ Payment
Returns a new instance of Payment.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mono-merchant/wallet/payment.rb', line 10 def initialize(card_token, amount, currency = DEFAULT_CURRENCY, by_client: false, items: [], reference: nil, redirect_url: nil, webhook_url: nil, email: nil, destination: nil, comment: nil) @card_token = card_token @amount = convert_to_cents(amount) @destination = destination @reference = reference @comment = comment @customer_emails = [email] if email @redirect_url = redirect_url @webhook_url = webhook_url @currency = Money::Currency.new(currency) # todo: append barcode, uktzed, tax, discounts etc. @items = items.map { |i| Invoice::Item.new(i).to_hash.presence } @initiation_kind = by_client ? 'client' : 'merchant' super() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MonoMerchant::ApiRequest
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def amount @amount end |
#card_token ⇒ Object (readonly)
Returns the value of attribute card_token.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def card_token @card_token end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def comment @comment end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def currency @currency end |
#customer_emails ⇒ Object (readonly)
Returns the value of attribute customer_emails.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def customer_emails @customer_emails end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def destination @destination end |
#initiation_kind ⇒ Object (readonly)
Returns the value of attribute initiation_kind.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def initiation_kind @initiation_kind end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def items @items end |
#redirect_url ⇒ Object (readonly)
Returns the value of attribute redirect_url.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def redirect_url @redirect_url end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def reference @reference end |
#webhook_url ⇒ Object (readonly)
Returns the value of attribute webhook_url.
8 9 10 |
# File 'lib/mono-merchant/wallet/payment.rb', line 8 def webhook_url @webhook_url end |