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

Allow access to metadata #53

Merged
merged 2 commits into from
Mar 25, 2021
Merged

Allow access to metadata #53

merged 2 commits into from
Mar 25, 2021

Conversation

som-m
Copy link
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

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

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

@danfowler
Copy link
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