petermcd / monzo-api

Python package to interact with the API provided by Monzo bank
MIT License
29 stars 5 forks source link

[BUG] Receipt Delete Failing #43

Closed petermcd closed 2 years ago

petermcd commented 2 years ago

Describe the bug Deleting a receipt fails due to bad request

To Reproduce

from datetime import datetime, timedelta

from monzo.handlers.filesystem import FileSystem
from monzo.authentication import Authentication
from monzo.endpoints.receipt import Receipt, ReceiptItem

TWO_DAYS_AGO = datetime.now() - timedelta(days=2)

handler = FileSystem(file='monzo.json')

credentials = handler.fetch()

auth = Authentication(
    client_id=credentials['client_id'],
    client_secret=credentials['client_secret'],
    redirect_url='',
    access_token=credentials['access_token'],
    access_token_expiry=credentials['expiry'],
    refresh_token=credentials['refresh_token'],
)

TRANSACTION_ID = 'REPLACE WITH TRANSACTION ID'
EXTERNAL_ID = 'ABC12345'

auth.register_callback_handler(credentials)

item = ReceiptItem(
    description='Test item',
    amount=1410,
    currency='GBP',
)

receipt = Receipt(
    auth=auth,
    transaction_id=TRANSACTION_ID,
    external_id=EXTERNAL_ID,
    transaction_total=1410,
    transaction_currency='GBP',
    items=[item],
)

Receipt.create(auth=auth, receipt=receipt)

receipt.delete(receipt=receipt)

Expected behavior Receipt to be deleted

Environment (please complete the following information):

Additional context N/A

petermcd commented 2 years ago

Closing as repeat of #38