Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
filterAfter = FilterTransactions()
filterBefore = FilterTransactions()
filterAfter.AfterDate = now
filterBefore.BeforeDate = now
pagination = Pagination()
result1 = self.sdk.disputes.GetDocumentsForClient(pagination, filterAfter)
result2 = self.sdk.disputes.GetDocumentsForClient(pagination, filterBefore)
self.assertIsNotNone(result1)
self.assertIsNotNone(result2)
self.assertTrue(len(result1) == 0)
self.assertTrue(len(result2) > 0)
filterType = FilterTransactions()
filterType.Type = result2[0].Type
result3 = self.sdk.disputes.GetDocumentsForClient(pagination, filterType)
self.assertIsNotNone(result3)
self.assertTrue(len(result3) > 0)
for dd in result3:
self.assertTrue(dd.Type, result2[0].Type)
def test_Disputes_GetFilteredDisputeDocuments(self):
now = int(time.time()) + 100
filterAfter = FilterTransactions()
filterBefore = FilterTransactions()
filterAfter.AfterDate = now
filterBefore.BeforeDate = now
pagination = Pagination()
result1 = self.sdk.disputes.GetDocumentsForClient(pagination, filterAfter)
result2 = self.sdk.disputes.GetDocumentsForClient(pagination, filterBefore)
self.assertIsNotNone(result1)
self.assertIsNotNone(result2)
self.assertTrue(len(result1) == 0)
self.assertTrue(len(result2) > 0)
filterType = FilterTransactions()
filterType.Type = result2[0].Type
def test_Disputes_GetFilteredDisputeDocuments(self):
now = int(time.time()) + 100
filterAfter = FilterTransactions()
filterBefore = FilterTransactions()
filterAfter.AfterDate = now
filterBefore.BeforeDate = now
pagination = Pagination()
result1 = self.sdk.disputes.GetDocumentsForClient(pagination, filterAfter)
result2 = self.sdk.disputes.GetDocumentsForClient(pagination, filterBefore)
self.assertIsNotNone(result1)
self.assertIsNotNone(result2)
self.assertTrue(len(result1) == 0)
self.assertTrue(len(result2) > 0)
filterType = FilterTransactions()
filterType.Type = result2[0].Type
result3 = self.sdk.disputes.GetDocumentsForClient(pagination, filterType)
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)
def test_Wallets_Transactions_SortByCreationDate(self):
wallet = self.getJohnsWallet()
#create 2 pay-in objects
self.getJohnsPayInCardWeb()
time.sleep(2)
self.getJohnsPayInCardWeb()
sorting = Sorting()
sorting.AddField('CreationDate', SortDirection.DESC)
pagination = Pagination(1, 20)
filter = FilterTransactions()
filter.Type = TransactionType.PAYIN
transactions = self.sdk.wallets.GetTransactions(wallet.Id, pagination, filter, sorting)
self.assertTrue(transactions[0].CreationDate > transactions[1].CreationDate)
def test_Wallets_Transactions(self):
john = self.getJohn()
wallet = self.getJohnsWallet()
payIn = self.getJohnsPayInCardWeb()
pagination = Pagination(1, 1)
filter = FilterTransactions()
filter.Type = TransactionType.PAYIN
transactions = self.sdk.wallets.GetTransactions(wallet.Id, pagination, filter)
self.assertEqual(len(transactions), 1)
self.assertIsInstance(transactions[0], Transaction)
self.assertEqual(transactions[0].AuthorId, john.Id)
self.assertEqualInputProps(transactions[0], payIn)
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)