Ejemplo n.º 1
0
    def test_001_reverse_transaction_200(self):
        payload = {
            "user_handle": user_handle,
            "amount": 200,
            "card_name": "visa"
        }

        response = Transaction.issue_sila(app, payload, eth_private_key)
        self.assertEqual(response.get("success"), True)

        payload = {
            "user_handle": user_handle,
            'search_filters': {
                'bank_account_name': 'visa'
            }
        }
        response1 = User.get_transactions(app, payload, eth_private_key)
        while response1['transactions'][0]['status'] == "pending":
            time.sleep(50)
            response1 = User.get_transactions(app, payload, eth_private_key)

        payload = {
            "user_handle": user_handle,
            "transaction_id": response["transaction_id"]
        }
        response2 = Transaction.reverseTransaction(app, payload,
                                                   eth_private_key)
        self.assertTrue(response2.get('success'))
 def test_get_transactions_filter_by_account_name(self):
     payload = {
         "user_handle": user_handle,
         'search_filters': {
             'bank_account_name': 'default'
         }
     }
     response = User.get_transactions(app, payload)
     self.assertTrue(response.get('success'))
 def test_get_transactions_200(self):
     payload = {
         "user_handle": user_handle,
         "search_filters": {
             'page': 1,
             'per_page': 1,
             'show_timelines': True
         }
     }
     response = User.get_transactions(app, payload, eth_private_key)
     self.assertTrue(response["success"])
     self.assertEqual(len(response["transactions"]), 1)
     self.assertEqual(response["transactions"][0]["processing_type"],
                      ProcessingTypes.STANDARD_ACH)
     self.assertIsNotNone(response.get('transactions')[0].get('timeline'))
    def test_get_transactions_200_with_filters(self):
        payload = {
            'user_handle': user_handle,
            'search_filters': {
                'statuses': ['success'],
                'transaction_types': ['issue']
            }
        }
        response = User.get_transactions(app, payload, eth_private_key)

        self.assertTrue(response.get('success'))
        self.assertGreater(len(response.get('transactions')), 1)
        self.assertEqual(
            response.get('transactions')[0].get('status'), 'success')
        self.assertEqual(
            response.get('transactions')[0].get('transaction_type'), 'issue')
    def test_get_transactions_200(self):
        lai = False
        di = False
        si = False
        dslt = False
        dlai = False

        payload = {
            "user_handle": user_handle,
            "search_filters": {
                'page': 1,
                'per_page': 13,
                'show_timelines': True
            }
        }
        response = User.get_transactions(app, payload)
        self.assertTrue(response["success"])
        self.assertIsNotNone(response["reference"])
        self.assertEqual(len(response["transactions"]), 13)
        self.assertIsNotNone(response.get('transactions')[0].get('timeline'))
        self.assertIsNotNone(
            response.get('transactions')[0].get('sila_ledger_type'))
        for item in response.get("transactions"):
            if item.get("ledger_account_id") and not lai:
                self.assertIsNotNone(item["ledger_account_id"])
                lai = True
            if item.get("destination_id") and not di:
                self.assertIsNotNone(item["destination_id"])
                di = True
            if item.get("source_id") and not si:
                self.assertIsNotNone(item["source_id"])
                si = True
            if item.get("destination_sila_ledger_type") and not dslt:
                self.assertIsNotNone(item["destination_sila_ledger_type"])
                dslt = True
            if item.get("destination_ledger_account_id") and not dlai:
                self.assertIsNotNone(item["destination_ledger_account_id"])
                dlai = True
        self.assertTrue(lai)
        self.assertTrue(di)
        self.assertTrue(si)
        self.assertTrue(dslt)
        self.assertTrue(dlai)
    def test_get_transactions_200_with_error_code(self):
        payload = {
            "user_handle": user_handle,
            "search_filters": {
                'page': 1,
                'per_page': 1,
                'show_timelines': True,
                'min_sila_amount': 410,
                'max_sila_amount': 430
            }
        }
        response = User.get_transactions(app, payload)

        self.assertTrue(response["success"])
        self.assertIsNotNone(response["reference"])
        self.assertEqual(len(response["transactions"]), 1)
        self.assertEqual(response["transactions"][0]["error_code"],
                         'ACH_RETURN')
        self.assertIsNotNone(response.get('transactions')[0].get('error_msg'))
        self.assertIsNotNone(
            response.get('transactions')[0].get('return_code'))
        self.assertIsNotNone(
            response.get('transactions')[0].get('return_desc'))
    def test_get_transactions_400(self):
        payload = {"user_handle": ""}

        response = User.get_transactions(app, payload, eth_private_key)
        self.assertFalse(response.get('success'))
        self.assertEqual(response.get('status_code'), 400)