diff --git a/.gitignore b/.gitignore
index 7e144ff..4462e77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -172,5 +172,5 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
+.idea/
diff --git a/.idea/bonus-import-tools.iml b/.idea/bonus-import-tools.iml
new file mode 100644
index 0000000..0070e87
--- /dev/null
+++ b/.idea/bonus-import-tools.iml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..7131d62
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..62c5cb3
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ",
+ "ignore.virus.scanning.warn.message": "true",
+ "last_opened_file_path": "D:/DM/auk/bonus-import-tools",
+ "settings.editor.selected.configurable": "preferences.pluginManager"
+ }
+}]]>
+
+
+
+
+
+
+
+
+
+
+
+ 1735196942967
+
+
+ 1735196942967
+
+
+
+
\ No newline at end of file
diff --git a/app.py b/app.py
index defb409..d4213dd 100644
--- a/app.py
+++ b/app.py
@@ -67,7 +67,7 @@ def run_import():
if file_extension == '.csv':
files.append(os.path.join(r, file))
- print('Scan .scv files: ', files)
+ print('Scan .csv files: ', files)
for f in files:
log_file_name = f'{f}-{time.strftime("%Y%m%d-%H%M%S", time.localtime())}.log'
diff --git a/csv/transaction-1.csv.20241227-175031.old b/csv/transaction-1.csv.20241227-175031.old
new file mode 100644
index 0000000..57e6018
--- /dev/null
+++ b/csv/transaction-1.csv.20241227-175031.old
@@ -0,0 +1,2 @@
+user_id, card, phone, summ_total, summ_discount, sum_with_discount, bonus_amount, transaction_date, transaction_time, doc_id
+1003, ,+79609238010,0.0,0.0,0.0,-121,2002-03-11,21:05:36,чек-100
diff --git a/dinect_api.py b/dinect_api.py
index 1564f92..45e917c 100644
--- a/dinect_api.py
+++ b/dinect_api.py
@@ -191,7 +191,7 @@ def bonuses_update(
base_url = url + 'users/' + str(user_id) + '/purchases/'
params = {
"doc_id": doc_id,
- "bonus_amount": bonus_amount,
+# "bonus_amount": bonus_amount,
"sum_total": summ_total,
"sum_discount": sum_discount,
"sum_with_discount ": sum_with_discount,
@@ -200,6 +200,12 @@ def bonuses_update(
"override": 'True'
# "date": '2024-08-03 12:53:07',
}
+ bonus_amount_numeric = float(bonus_amount)
+ if bonus_amount_numeric >= 0:
+ params["bonus_amount"] = bonus_amount
+ else:
+ params["bonus_payment"] = bonus_amount[1:]
+
r = requests.post(base_url, headers=headers, json=params)
if r.status_code == 201:
return True, r.json()