Skip to content

Allow access to metadata#53

Merged
som-m merged 2 commits intoomise:masterfrom
som-m:fix-52
Mar 25, 2021
Merged

Allow access to metadata#53
som-m merged 2 commits intoomise:masterfrom
som-m:fix-52

Conversation

@som-m
Copy link
Copy Markdown
Contributor

@som-m som-m commented Mar 12, 2021

Summary

>>> transfer.metadata.recipient_name
Traceback (most recent call last):
  File "/Users/chanapa/Downloads/projects/omise-python/omise/__init__.py", line 147, in __getattr__
    return _as_object(value)
  File "/Users/chanapa/Downloads/projects/omise-python/omise/__init__.py", line 106, in _as_object
    class_ = _get_class_for(data['object'])
KeyError: 'object'
  • Add test

QA

You should be able to access metadata.

  1. Create a transfer with metadata.
transfer = omise.Transfer.create(
	amount = 100000,
	metadata = dict(
		recipient_id = '0001',
		recipient_name = 'Somchai'
	)
)
  1. Access metadata.
>>> transfer.id
'trsf_test_5n6maxqnnscx4046wqn'
>>> transfer.metadata.recipient_name
'Somchai'

@som-m som-m marked this pull request as ready for review March 15, 2021 03:42
@som-m som-m requested review from danfowler and rezigned March 15, 2021 03:43
@som-m som-m merged commit bfcf283 into omise:master Mar 25, 2021
@nakarinh14
Copy link
Copy Markdown

nakarinh14 commented Feb 5, 2022

@danfowler @rezigned

Hello Omise team, I know it has been a year since the last commit on this repo but can we at least get a minor official release that contains this fix?

The latest release 0.11.0 with pip install omise still got this breaking change, and needs to explicitly install the master branch for the fix.

General developers might not know about this and get confused, and I think it would be nice if the fix is present in the official release.

@amborish-omise
Copy link
Copy Markdown

Hello @nakarinh14 , thanks for the feedback, We are looking at this one and will release a fix soon.

@danfowler
Copy link
Copy Markdown
Contributor

Hello @nakarinh14, sorry for the delay. We've released 0.12.0 that includes this change.

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.

Can't access a metadata object

5 participants