How to use the mangopaysdk.tools.resttool.RestTool function in mangopaysdk

To help you get started, we’ve selected a few mangopaysdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apiclients.py View on Github external
"""Get client data for Basic Access Authentication.
        param string clientId Client identifier
        param string clientName Beautiful name for presentation
        param string clientEmail Client's email
        return Client object
        """

        urlMethod = self._getRequestUrl('authentication_base')
        requestType = self._getRequestType('authentication_base')
        requestData = {
            'ClientId' : clientId,
            'Name' : clientName,
            'Email' : clientEmail,
        }

        rest = RestTool(self._root, False)
        response = rest.Request(urlMethod, requestType, requestData)
        return self._castResponseToEntity(response, 'Client');
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apibase.py View on Github external
def _getObject (self, methodKey, entityId, responseClassName = None, secondEntityId = None):
        """Get entity object from API.
        param string methodKey Key with request data
        param int entityId Entity identifier
        param object responseClassName Name of entity class from response
        param int secondEntityId Entity identifier for second entity
        return object Response data
        """
        urlMethod = self._buildUrl(methodKey, entityId, secondEntityId)

        rest = RestTool(self._root, True)
        response = rest.Request(urlMethod, self._getRequestType(methodKey))

        if responseClassName != None:
            return self._castResponseToEntity(response, responseClassName)
        return response
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apibase.py View on Github external
def _createObjectIdempotent (self, idempotencyKey, methodKey, entity, responseClassName = None, entityId = None, secondEntityId = None):
        """Create object in API.
        param string idempotencyKey Idempotency key for this request
        param string methodKey Key with request data
        param object entity Entity object
        param object responseClassName Name of entity class from response
        param int entityId Entity identifier
        param int secondEntityId Releated entity identifier
        return dictionary Response data
        """
        urlMethod = self._buildUrl(methodKey, entityId, secondEntityId)

        if entity != None:
            requestData = self._buildRequestData(entity)

        rest = RestTool(self._root, True)
        response = rest.RequestIdempotent(idempotencyKey, urlMethod, self._getRequestType(methodKey), requestData)

        if responseClassName != None:
            return self._castResponseToEntity(response, responseClassName)
        return response
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apibase.py View on Github external
def _saveObject (self, methodKey, entity, responseClassName = None, entityId = None, secondEntityId = None):
        """Save object in API.
        param string methodKey Key with request data
        param object entity Entity object to save
        param object responseClassName Name of entity class from response
        return object Response data
        """
        if (entityId == None):
            entityId = entity.Id
        urlMethod = self._buildUrl(methodKey, entityId, secondEntityId)
        requestData = self._buildRequestData(entity)

        rest = RestTool(self._root, True)
        response = rest.Request(urlMethod, self._getRequestType(methodKey), requestData)

        if responseClassName != None:
            return self._castResponseToEntity(response, responseClassName)
        return response
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apibase.py View on Github external
def _getList (self, methodKey, pagination, responseClassName = None, entityId = None, filter = None, sorting = None):
        """Get list with entities object from API.
        param string methodKey Key with request data
        param pagination Pagination object
        param object responseClassName Name of entity class from response
        param int entityId Entity identifier
        param object filter Object to filter data
        param object sorting Object to sort data
        return object Response data
        """
        urlMethod = self._buildUrl(methodKey, entityId)

        if pagination == None:
            pagination = Pagination()

        rest = RestTool(self._root, True)
        additionalUrlParams = {}
        if (filter != None):
            additionalUrlParams['filter'] = filter
        if (sorting != None):
            additionalUrlParams['sort'] = sorting.GetSortParameter()

        response = rest.Request(urlMethod, self._getRequestType(methodKey), None, pagination, additionalUrlParams)

        if responseClassName != None:
            return self._castResponseToEntity(response, responseClassName)
        return response
github Mangopay / mangopay2-python-sdk / mangopaysdk / tools / apioauth.py View on Github external
def CreateToken(self):
        """Get token information for OAuth Authentication.
        return MangoPay OAuthToken object with token information
        """
        urlMethod = self._getRequestUrl('authentication_oauth')
        requestType = self._getRequestType('authentication_oauth')
        requestData = {
            'grant_type' : 'client_credentials'
        }

        rest = RestTool(self._root, False)
        response = rest.Request(urlMethod, requestType, requestData)
        token = self._castAuthResponseToEntity(response)
        return token