@@ -212,53 +212,3 @@ def run(self, start_date=None, end_date=None, ignored_memos=None):
212212 self .new_transactions ,
213213 ignore_conflicts = True ,
214214 )
215-
216-
217- class CSVCoraCreditCardImporter :
218- def __init__ (self , transactions_file , bank_account , user ):
219- self .categories = get_categories ()
220- self .new_transactions = []
221-
222- self .transactions_file = transactions_file
223- self .bank_account = bank_account
224- self .user = user
225-
226- def run (self , start_date = None , end_date = None , ignored_memos = None ):
227- csv_content = self .transactions_file .read ().decode ()
228-
229- reader = csv .DictReader (io .StringIO (csv_content ))
230- for transaction in reader :
231- transaction_date = datetime .datetime .strptime (
232- transaction ["Data" ], "%d/%m/%Y"
233- ).date ()
234- transaction_amount = - 1 * decimal .Decimal (
235- transaction ["Valor" ].replace ("." , "" ).replace ("," , "." )
236- )
237- transaction_notes = "" .join (
238- [
239- transaction ["Moeda" ],
240- transaction ["Valor Moeda Local" ],
241- ]
242- )
243-
244- self .new_transactions .append (
245- Transaction (
246- reference = uuid .uuid4 (),
247- date = transaction_date ,
248- description = transaction ["Descrição" ].strip (),
249- amount = transaction_amount ,
250- notes = transaction_notes ,
251- bank_account = self .bank_account ,
252- source = "cora-csv-import" ,
253- created_by = self .user ,
254- )
255- )
256-
257- transactions = Transaction .objects .bulk_create (
258- self .new_transactions ,
259- update_conflicts = True ,
260- update_fields = ["description" , "amount" ],
261- unique_fields = ["reference" ],
262- )
263-
264- return transactions
0 commit comments