Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支出のパラメータにreceipt_idを追加 #39

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pyzaim/pyzaim.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,17 @@ def insert_payment_simple(
comment=None,
name=None,
place=None,
receipt_id=None,
):
genre_id = self.genre_stoi[genre]
category_id = self.genre_to_category[genre_id]
if from_account is not None:
from_account_id = self.account_stoi[from_account]
else:
from_account_id = None
return self.insert_payment(date, amount, category_id, genre_id, from_account_id, comment, name, place)
return self.insert_payment(
date, amount, category_id, genre_id, from_account_id, comment, name, place, receipt_id
)

def insert_payment(
self,
Expand All @@ -130,6 +133,7 @@ def insert_payment(
comment=None,
name=None,
place=None,
receipt_id=None,
):
data = {
"mapping": 1,
Expand All @@ -146,6 +150,8 @@ def insert_payment(
data["name"] = name
if place is not None:
data["place"] = place
if receipt_id is not None:
data["receipt_id"] = receipt_id
return self.auth.post(self.payment_url, data=data)

def update_payment_simple(
Expand All @@ -158,6 +164,7 @@ def update_payment_simple(
comment=None,
name=None,
place=None,
receipt_id=None,
):
genre_id = self.genre_stoi[genre]
category_id = self.genre_to_category[genre_id]
Expand All @@ -175,6 +182,7 @@ def update_payment_simple(
comment,
name,
place,
receipt_id,
)

def update_payment(
Expand All @@ -188,6 +196,7 @@ def update_payment(
comment=None,
name=None,
place=None,
receipt_id=None,
):
data = {
"mapping": 1,
Expand All @@ -205,6 +214,8 @@ def update_payment(
data["name"] = name
if place is not None:
data["place"] = place
if receipt_id is not None:
data["receipt_id"] = receipt_id
return self.auth.put("{}/{}".format(self.payment_url, data_id), data=data)

def delete_payment(self, data_id):
Expand Down