Class: MonopayRuby::Invoices::AdvancedInvoice
- Inherits:
-
SimpleInvoice
- Object
- Base
- SimpleInvoice
- MonopayRuby::Invoices::AdvancedInvoice
- Defined in:
- lib/monopay-ruby/invoices/advanced_invoice.rb
Constant Summary
Constants inherited from SimpleInvoice
SimpleInvoice::API_CREATE_INVOICE_URL, SimpleInvoice::DEFAULT_CURRENCY, SimpleInvoice::INVOICE_ID_KEY, SimpleInvoice::PAGE_URL_KEY
Constants inherited from Base
Instance Attribute Summary collapse
-
#additional_params ⇒ Object
readonly
Returns the value of attribute additional_params.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
Attributes inherited from SimpleInvoice
#destination, #error_messages, #invoice_id, #page_url, #redirect_url, #reference, #webhook_url
Instance Method Summary collapse
-
#create(amount, additional_params: {}) ⇒ Boolean
Create invoice for Monobank API.
Methods inherited from SimpleInvoice
Constructor Details
This class inherits a constructor from MonopayRuby::Invoices::SimpleInvoice
Instance Attribute Details
#additional_params ⇒ Object (readonly)
Returns the value of attribute additional_params.
8 9 10 |
# File 'lib/monopay-ruby/invoices/advanced_invoice.rb', line 8 def additional_params @additional_params end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/monopay-ruby/invoices/advanced_invoice.rb', line 8 def amount @amount end |
Instance Method Details
#create(amount, additional_params: {}) ⇒ Boolean
Create invoice for Monobank API
This method sets up the required instance variables and then calls the create
method from the parent class with the relevant parameters.
26 27 28 29 30 31 32 33 |
# File 'lib/monopay-ruby/invoices/advanced_invoice.rb', line 26 def create(amount, additional_params: {}) @amount = amount @additional_params = additional_params @destination = @additional_params.dig(:merchantPaymInfo, :destination) @reference = @additional_params.dig(:merchantPaymInfo, :reference) super(amount, destination: @destination, reference: @reference) end |