mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Story#112043941 - adding more logs to find out when invoices are not sent
This commit is contained in:
parent
72478dbb43
commit
6a63feb5dd
1 changed files with 8 additions and 2 deletions
|
@ -3,13 +3,19 @@ class Directo < ActiveRecord::Base
|
||||||
|
|
||||||
def self.send_receipts
|
def self.send_receipts
|
||||||
new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where.not(cancelled_at: nil)
|
new_trans = Invoice.where(invoice_type: "DEB", in_directo: false).where.not(cancelled_at: nil)
|
||||||
|
Rails.logger.info("[DIRECTO] Will try to send #{new_trans.count} invoices")
|
||||||
|
|
||||||
new_trans.find_in_batches(batch_size: 10).each do |group|
|
new_trans.find_in_batches(batch_size: 10).each do |group|
|
||||||
mappers = {} # need them as no direct connection between invoice
|
mappers = {} # need them as no direct connection between invoice
|
||||||
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
||||||
xml.invoices {
|
xml.invoices {
|
||||||
group.each do |invoice|
|
group.each do |invoice|
|
||||||
next if invoice.account_activity.nil? || invoice.account_activity.bank_transaction.nil?
|
|
||||||
next if invoice.account_activity.bank_transaction.sum.nil? || invoice.account_activity.bank_transaction.sum != invoice.sum_cache
|
if invoice.account_activity.nil? || invoice.account_activity.bank_transaction.nil? ||
|
||||||
|
invoice.account_activity.bank_transaction.sum.nil? || invoice.account_activity.bank_transaction.sum != invoice.sum_cache
|
||||||
|
Rails.logger.info("[DIRECTO] Invoice #{invoice.number} has been skipped")
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
num = invoice.number
|
num = invoice.number
|
||||||
mappers[num] = invoice
|
mappers[num] = invoice
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue