How to use the mangopaysdk.types.pagination.Pagination 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 / tests / testmandates.py View on Github external
def test_Mandates_Get_For_Bank_Account(self):
        user = self.getJohn()
        bankAccountId = self.getJohnsAccount().Id
        returnUrl = 'http://test.test'

        mandatePost = Mandate()
        mandatePost.BankAccountId = bankAccountId
        mandatePost.Culture = 'EN'
        mandatePost.ReturnURL = returnUrl

        mandateCreated = self.sdk.mandates.Create(mandatePost)

        sorting = Sorting()
        sorting.AddField("CreationDate", SortDirection.DESC)
        mandates = self.sdk.mandates.GetForBankAccount(user.Id, bankAccountId, Pagination(), sorting)

        self.assertIsNotNone(mandates)
        self.assertIsNotNone(mandates[0])
        self.assertTrue(mandateCreated.Id == mandates[0].Id)
github Mangopay / mangopay2-python-sdk / tests / testdisputes.py View on Github external
def refreshClientDisputes(self):
        sorting = Sorting()
        sorting.AddField("CreationDate", SortDirection.DESC)
        pagination = Pagination(1, 100)
        self._clientDisputes = self.sdk.disputes.GetAll(pagination, None, sorting)

        self.assertIsNotNone(self._clientDisputes, 'INITIALIZATION FAILURE - cannot test disputes')
        self.assertTrue(len(self._clientDisputes) > 0, 'INITIALIZATION FAILURE - cannot test disputes')
        return
github Mangopay / mangopay2-python-sdk / tests / testdisputes.py View on Github external
def test_Disputes_SubmitDisputeDocument(self):
        self.refreshClientDisputes()
        
        dispute = None
        disputeDocument = None

        filter = FilterDisputeDocuments()
        filter.Status = DisputeDocumentStatus.CREATED

        for d in self._clientDisputes:
            if (d.Status == DisputeStatus.PENDING_CLIENT_ACTION or d.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION):
                dd = self.sdk.disputes.GetDocumentsForDispute(d.Id, Pagination(1, 1), filter)[0]
                if (dd != None):
                    dispute = d
                    disputeDocument = dd
                    break

        if (dispute == None):
            for d in self._clientDisputes:
                if (d.Status == DisputeStatus.PENDING_CLIENT_ACTION or d.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION):
                    documentPost = DisputeDocument()
                    documentPost.Type = DisputeDocumentType.DELIVERY_PROOF
                    disputeDocument = self.sdk.disputes.CreateDocument(documentPost, d.Id)

        self.assertIsNotNone(dispute, 'Cannot test submitting dispute\'s documents because there\'s no dispute with expected status in the disputes list.')

        self.assertIsNotNone(disputeDocument, 'Cannot test submitting dispute\'s documents because there\'s no dispute document that can be updated.')
github Mangopay / mangopay2-python-sdk / tests / testevents.py View on Github external
def test_Events_GetEvents_Page_Of_Type(self):
        self.pageLength = 3
        pagination = Pagination(1, self.pageLength)
        filter = FilterTransactions()
        self.type = EventType.PAYIN_NORMAL_CREATED
        filter.EventType = self.type

        event = self.sdk.events.Get(pagination, filter)
        self.assertTrue(len(event) <= self.pageLength)
        if (len(event) > 0):
            self.assertEqual(event[0].EventType, self.type)
        if (len(event) > 1):
            self.assertEqual(event[1].EventType, self.type)
        if (len(event) > 2):
            self.assertEqual(event[2].EventType, self.type)
github Mangopay / mangopay2-python-sdk / tests / testdisputes.py View on Github external
def test_Disputes_GetFilteredDisputes(self):

        now = int(time.time())

        filterAfter = FilterTransactions()
        filterBefore = FilterTransactions()
        filterAfter.AfterDate = now
        filterBefore.BeforeDate = now

        pagination = Pagination()

        result1 = self.sdk.disputes.GetAll(pagination, filterAfter)
        result2 = self.sdk.disputes.GetAll(pagination, filterBefore)

        self.assertIsNotNone(result1)
        self.assertIsNotNone(result2)
        self.assertTrue(len(result1) == 0)
        self.assertTrue(len(result2) > 0)
github Mangopay / mangopay2-python-sdk / tests / testkycdocuments.py View on Github external
def test_KycDocuments_GetAll_SortByCreationDate(self):
        pagination = Pagination(1, 10)
        sorting = Sorting()
        sorting.AddField('CreationDate', SortDirection.DESC)

        list = self.sdk.kycdocuments.GetAll(pagination, sorting)

        self.assertTrue(list[0].CreationDate >= list[1].CreationDate)
github Mangopay / mangopay2-python-sdk / tests / testdisputes.py View on Github external
def test_Disputes_GetTransactions(self):
        self.refreshClientDisputes()

        dispute = None

        for d in self._clientDisputes:
            if (d.DisputeType == DisputeType.NOT_CONTESTABLE):
                dispute = d
                break

        self.assertIsNotNone(dispute, 'Cannot test getting dispute\'s transactions because there\'s no not contestable dispute in the disputes list.')

        pagination = Pagination(1, 10)
        transactions = self.sdk.disputes.GetTransactions(dispute.Id, pagination)

        self.assertIsNotNone(transactions)
        self.assertTrue(len(transactions) > 0)
github Mangopay / mangopay2-python-sdk / tests / testapiusers.py View on Github external
def test_Users_GetKycDocuments(self):
        kycDocument = self.getUserKycDocument()
        user = self.getJohn()
        pagination = Pagination(1, 10)
        self.sdk.users.GetKycDocuments(user.Id, pagination)
        pagination.Page = pagination.TotalPages
        getKycDocuments = self.sdk.users.GetKycDocuments(user.Id, pagination)

        kycFromList = self.getEntityFromList(kycDocument.Id, getKycDocuments)
        self.assertIsInstance(kycFromList, KycDocument)
        self.assertEqualInputProps(kycDocument, kycFromList)
github Mangopay / mangopay2-python-sdk / tests / testmandates.py View on Github external
def test_Mandates_Get_For_User(self):
        user = self.getJohn()
        bankAccountId = self.getJohnsAccount().Id
        returnUrl = 'http://test.test'

        mandatePost = Mandate()
        mandatePost.BankAccountId = bankAccountId
        mandatePost.Culture = 'EN'
        mandatePost.ReturnURL = returnUrl

        mandateCreated = self.sdk.mandates.Create(mandatePost)

        sorting = Sorting()
        sorting.AddField("CreationDate", SortDirection.DESC)
        mandates = self.sdk.mandates.GetForUser(user.Id, Pagination(), sorting)

        self.assertIsNotNone(mandates)
        self.assertIsNotNone(mandates[0])
        self.assertTrue(mandateCreated.Id == mandates[0].Id)
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