mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +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
|
GIT
|
||||||
remote: https://github.com/internetee/directo.git
|
remote: https://github.com/internetee/directo.git
|
||||||
revision: 6fb158c1589c609b2519d8e8658c11de52bd3d9d
|
revision: 7bac1d5ca413e3cce25a7adad3c0e8d7f8cd673e
|
||||||
branch: directo-api
|
branch: directo-api
|
||||||
specs:
|
specs:
|
||||||
directo (0.1.0)
|
directo (0.1.0)
|
||||||
|
|
|
@ -4,14 +4,15 @@ module Concerns
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def as_directo_json
|
def as_directo_json
|
||||||
inv = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
invoice = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
||||||
inv['customer_code'] = buyer.accounting_customer_code
|
invoice['customer_code'] = buyer.accounting_customer_code
|
||||||
inv['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
invoice['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
||||||
inv['transaction_date'] = account_activity.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
invoice['transaction_date'] = account_activity
|
||||||
inv['language'] = buyer.language == 'en' ? 'ENG' : ''
|
.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
||||||
inv['invoice_lines'] = compose_directo_product
|
invoice['language'] = buyer.language == 'en' ? 'ENG' : ''
|
||||||
|
invoice['invoice_lines'] = compose_directo_product
|
||||||
|
|
||||||
inv
|
invoice
|
||||||
end
|
end
|
||||||
|
|
||||||
def compose_directo_product
|
def compose_directo_product
|
||||||
|
|
|
@ -10,16 +10,16 @@ module Concerns
|
||||||
activities = monthly_activites(month)
|
activities = monthly_activites(month)
|
||||||
return unless activities.any?
|
return unless activities.any?
|
||||||
|
|
||||||
inv = {
|
invoice = {
|
||||||
'number': 1,
|
'number': 1,
|
||||||
'customer_code': accounting_customer_code,
|
'customer_code': accounting_customer_code,
|
||||||
'language': language == 'en' ? 'ENG' : '', 'currency': activities.first.currency,
|
'language': language == 'en' ? 'ENG' : '', 'currency': activities.first.currency,
|
||||||
'date': month.end_of_month.strftime('%Y-%m-%d')
|
'date': month.end_of_month.strftime('%Y-%m-%d')
|
||||||
}.as_json
|
}.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
|
end
|
||||||
|
|
||||||
def prepare_invoice_lines(month:, activities:)
|
def prepare_invoice_lines(month:, activities:)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue