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())
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)
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)
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)
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')
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)
def testClient01(self): with self.assertRaises(TypeError): CLIENT_ID = os.environ['PARASUT_CLIENT_ID'] Client(client_id=CLIENT_ID)
def testClient00(self): with self.assertRaises(TypeError): Client()