Skip to content

Conversation

@ryohidaka
Copy link
Contributor

概要

  • 支出データの登録・更新時にreceipt_idを指定できるようにしました。
  • receipt_idを指定することで、ブラウザ版やモバイルアプリ版の「品目一覧表示」に対応したデータが登録できるようになります。

動作確認

receipt_idを生成

  • APIから登録した際は、サーバー側で発番されないため、生成したものを使用しました。
receipt_id = random.randint(10**9, 10**10 - 1)
print(f"レシートID: {receipt_id}")
# レシートID: xxxxxxxxxxx

receipt_idを指定したテストデータを登録

api = ZaimAPI(...)
payment_url = "https://api.zaim.net/v2/home/money/payment"
today = datetime.date.today()

# 1件目のデータを登録する
data1 = {
    "mapping": 1,
    "category_id": "101",
    "genre_id": "10101",
    "name": "食料品テスト",
    "amount": 100,
    "date": today,
    "receipt_id": receipt_id,
}
api.auth.post(payment_url, data1)

# 2件目のデータを登録する
data2 = {
    "mapping": 1,
    "category_id": "102",
    "genre_id": "10201",
    "name": "消耗品テスト",
    "amount": 200,
    "date": today,
    "receipt_id": receipt_id,
}
api.auth.post(payment_url, data2)

登録したデータが1つの支出にまとまっていることをブラウザ版で確認

@liebe-magi
Copy link
Owner

@ryohidaka
新規機能の実装ありがとうございました。
こちらの環境でも問題なく動作することを確認しました。
マージさせていただきます。

@liebe-magi liebe-magi merged commit 3b77615 into liebe-magi:develop Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants