diff --git a/mercadopago/resources/preference.py b/mercadopago/resources/preference.py index 6d537b7..1afe86d 100644 --- a/mercadopago/resources/preference.py +++ b/mercadopago/resources/preference.py @@ -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) \ No newline at end of file diff --git a/tests/test_preference.py b/tests/test_preference.py index e1eb982..b9281f9 100644 --- a/tests/test_preference.py +++ b/tests/test_preference.py @@ -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()