Mangopay/mangopay2-python-sdk

PayIn "execution_date" should be a datetime instead of date

Closed this issue · 2 comments

As per response examples in docs for viewing a PayIn, the response contains ExecutionDate which is a timestamp and can be converted into a datetime:

...
>>> import datetime, import requests
>>> response = requests.get(f'{api_url}/v2.01/{client_id}/payins/{payin_id}/', auth=(client_id, api_key))
>>> datetime.datetime.fromtimestamp(response.json()['ExecutionDate'])
datetime.datetime(2020, 11, 23, 12, 24, 28)

But the python client returns a date:

...
>>> import mangopay
>>> from mangopay.resources import PayIn
>>> mangopay.client_id = client_id
>>> mangopay.apikey = api_key
>>> mangopay.sandbox = True
>>> payin = mangopay.resources.PayIn.get(payin_id)
>>> payin.execution_date
datetime.date(2020, 11, 23)

Please update the client to also return a datetime. Thanks!

Hi @jcerjak
I'll look into it

@mangomaxoasis
Can we also do this for other unix timestamps?
the ones we require are bellow:

  • Wallet: creation_date
  • Transfer: creation_date, execution_date
  • Card: creation_date
  • Card Registration: creation_date
  • Payin: execution_date
  • DirectPayin: creation_date
  • PreAuthorisation: expiration_date
  • BankAccount: creation_date
  • BankWirePayOut: execution_date
  • Refund: execution_date
  • Transaction: execution_date
  • Repudiation: execution_date
  • UboDeclaration: creation_date

If you don't have the time, we can create a PR for this to be reviewed. cc: @berkkarahan @tayfun