Skip to content

Commit

Permalink
Merge pull request #66 from ivanviragine/feature/preferences-search
Browse files Browse the repository at this point in the history
Add preferences search method
  • Loading branch information
romerosilva-meli authored Aug 16, 2023
2 parents 565fca4 + f56029c commit 466528c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mercadopago/resources/preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,19 @@ def create(self, preference_object, request_options=None):

return self._post(uri="/checkout/preferences", data=preference_object,
request_options=request_options)

def search(self, filters=None, request_options=None):
"""[Click here for more info](https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences_search/get) # pylint: disable=line-too-long
Args:
filters (dict): The search filters parameters
request_options (mercadopago.config.request_options, optional): An instance of
RequestOptions can be pass changing or adding custom options to ur REST call.
Defaults to None.
Returns:
dict: Preference find response
"""

return self._get(uri="/checkout/preferences/search", filters=filters,
request_options=request_options)
5 changes: 5 additions & 0 deletions tests/test_preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ def test_all(self):
self.assertEqual(preference_saved["response"]["items"][0]["title"],
preference_object["items"][0]["title"])

preference_saved = self.sdk.preference().search()

self.assertEqual(preference_saved["response"]["elements"][0]["items"][0],
preference_object["items"][0]["title"])


if __name__ == "__main__":
unittest.main()

0 comments on commit 466528c

Please sign in to comment.