Beispiel #1
0
    def testCreateInvoice(self):
        CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
        CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
        USERNAME = os.environ['PARASUT_USERNAME']
        PASSWORD = os.environ['PARASUT_PASSWORD']

        client_obj = Client(client_id=CLIENT_ID,
                            client_secret=CLIENT_SECRET,
                            username=USERNAME,
                            password=PASSWORD,
                            sandbox=True)

        client_obj.initialize()

        # You can get request parameters from
        # https://apidocs.parasut.com/#operation/createContact
        data = {
            "data": {
                "type": "contacts",
                "attributes": {
                    "email": "*****@*****.**",
                    "name": "string",
                    "short_name": "string",
                    "contact_type": "person",
                    "tax_office": "string",
                    "tax_number": "string",
                    "district": "string",
                    "city": "string",
                    "address": "string",
                    "phone": "string",
                    "fax": "string",
                    "is_abroad": True,
                    "archived": True,
                    "iban": "string",
                    "account_type": "customer"
                },
                "relationships": {
                    "category": {
                        "data": {
                            "type": "item_categories"
                        }
                    },
                    "contact_people": {
                        "data": [{
                            "type": "contact_people",
                            "attributes": {
                                "name": "string",
                                "email": "*****@*****.**",
                                "phone": "string",
                                "notes": "string"
                            }
                        }]
                    }
                }
            }
        }

        obj = client_obj.functions.createContact(data)
        print(obj.json())
Beispiel #2
0
    def testIndexInvoice(self):
        CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
        CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
        USERNAME = os.environ['PARASUT_USERNAME']
        PASSWORD = os.environ['PARASUT_PASSWORD']

        client_obj = Client(client_id=CLIENT_ID,
                            client_secret=CLIENT_SECRET,
                            username=USERNAME,
                            password=PASSWORD,
                            sandbox=True)

        client_obj.initialize()
        client_obj.functions.indexInvoice()
        print(client_obj.companyId)
Beispiel #3
0
 def testClient03(self):
     with self.assertRaises(TypeError):
         CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
         CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
         USERNAME = os.environ['PARASUT_USERNAME']
         Client(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET,
                username=USERNAME)
Beispiel #4
0
    def testClient1(self):
        CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
        CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
        USERNAME = os.environ['PARASUT_USERNAME']
        PASSWORD = os.environ['PARASUT_PASSWORD']

        Client(client_id=CLIENT_ID,
               client_secret=CLIENT_SECRET,
               username=USERNAME,
               password=PASSWORD)
Beispiel #5
0
    def testClient2(self):
        CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
        CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
        USERNAME = os.environ['PARASUT_USERNAME']
        PASSWORD = os.environ['PARASUT_PASSWORD']

        Client(client_id=CLIENT_ID,
               client_secret=CLIENT_SECRET,
               username=USERNAME,
               password=PASSWORD,
               base_url='https://www.example.com',
               token_url='https://www.example.com/oauth/token')
Beispiel #6
0
 def testClient02(self):
     with self.assertRaises(TypeError):
         CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
         CLIENT_SECRET = os.environ['PARASUT_CLIENT_SECRET']
         Client(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
Beispiel #7
0
 def testClient01(self):
     with self.assertRaises(TypeError):
         CLIENT_ID = os.environ['PARASUT_CLIENT_ID']
         Client(client_id=CLIENT_ID)
Beispiel #8
0
 def testClient00(self):
     with self.assertRaises(TypeError):
         Client()