mirror of
https://git.auk.su/Dinect/bonus-import-tools.git
synced 2025-12-28 18:10:01 +00:00
add binus_payment for payoff bonus
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -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/
|
||||
|
||||
|
||||
7
.idea/bonus-import-tools.iml
generated
Normal file
7
.idea/bonus-import-tools.iml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="GOOGLE" />
|
||||
<option name="myDocStringFormat" value="Google" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (bonus-import-tools)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (bonus-import-tools)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
55
.idea/workspace.xml
generated
Normal file
55
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f4f7e635-920d-44f4-bec8-086a143eb7dd" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"associatedIndex": 6
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2qkBxyT1u9WAVxlJ08arkubLFF3" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Python.app.executor": "Run",
|
||||
"Python.dinect_api.executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"com.codeium.enabled": "true",
|
||||
"git-widget-placeholder": "<unknown>",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"last_opened_file_path": "D:/DM/auk/bonus-import-tools",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-python-sdk-495700d161d3-aa17d162503b-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-243.22562.220" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="f4f7e635-920d-44f4-bec8-086a143eb7dd" name="Changes" comment="" />
|
||||
<created>1735196942967</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1735196942967</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
||||
2
app.py
2
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'
|
||||
|
||||
2
csv/transaction-1.csv.20241227-175031.old
Normal file
2
csv/transaction-1.csv.20241227-175031.old
Normal file
@@ -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
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user