mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 20:27:30 +02:00
Better naming for variables
This commit is contained in:
parent
3f92640ad2
commit
21543d8416
3 changed files with 12 additions and 11 deletions
|
@ -9,7 +9,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: https://github.com/internetee/directo.git
|
||||
revision: 6fb158c1589c609b2519d8e8658c11de52bd3d9d
|
||||
revision: 7bac1d5ca413e3cce25a7adad3c0e8d7f8cd673e
|
||||
branch: directo-api
|
||||
specs:
|
||||
directo (0.1.0)
|
||||
|
|
|
@ -4,14 +4,15 @@ module Concerns
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
def as_directo_json
|
||||
inv = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
||||
inv['customer_code'] = buyer.accounting_customer_code
|
||||
inv['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
||||
inv['transaction_date'] = account_activity.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
||||
inv['language'] = buyer.language == 'en' ? 'ENG' : ''
|
||||
inv['invoice_lines'] = compose_directo_product
|
||||
invoice = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
||||
invoice['customer_code'] = buyer.accounting_customer_code
|
||||
invoice['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
||||
invoice['transaction_date'] = account_activity
|
||||
.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
||||
invoice['language'] = buyer.language == 'en' ? 'ENG' : ''
|
||||
invoice['invoice_lines'] = compose_directo_product
|
||||
|
||||
inv
|
||||
invoice
|
||||
end
|
||||
|
||||
def compose_directo_product
|
||||
|
|
|
@ -10,16 +10,16 @@ module Concerns
|
|||
activities = monthly_activites(month)
|
||||
return unless activities.any?
|
||||
|
||||
inv = {
|
||||
invoice = {
|
||||
'number': 1,
|
||||
'customer_code': accounting_customer_code,
|
||||
'language': language == 'en' ? 'ENG' : '', 'currency': activities.first.currency,
|
||||
'date': month.end_of_month.strftime('%Y-%m-%d')
|
||||
}.as_json
|
||||
|
||||
inv['invoice_lines'] = prepare_invoice_lines(month: month, activities: activities)
|
||||
invoice['invoice_lines'] = prepare_invoice_lines(month: month, activities: activities)
|
||||
|
||||
inv
|
||||
invoice
|
||||
end
|
||||
|
||||
def prepare_invoice_lines(month:, activities:)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue