forked from ej2/python-quickbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatchrequest.py
More file actions
106 lines (74 loc) · 2.29 KB
/
batchrequest.py
File metadata and controls
106 lines (74 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from six import python_2_unicode_compatible
from ..mixins import ToJsonMixin, FromJsonMixin
class BatchOperation(object):
CREATE = "create"
UPDATE = "update"
DELETE = "delete"
@python_2_unicode_compatible
class FaultError(FromJsonMixin):
qbo_object_name = "Error"
def __init__(self):
super(FaultError, self).__init__()
self.Message = ""
self.code = ""
self.Detail = ""
self.element = ""
def __str__(self):
return "Code: {0} Message: {1} Detail: {2}".format(self.code, self.Message, self.Detail)
def __repr__(self):
return self.__str__()
class Fault(FromJsonMixin):
list_dict = {
"Error": FaultError
}
qbo_object_name = "Fault"
def __init__(self):
super(Fault, self).__init__()
self.type = ""
self.original_object = None
self.Error = []
def __repr__(self):
return "{0} Errors".format(len(self.Error))
class BatchItemResponse(FromJsonMixin):
qbo_object_name = "BatchItemResponse"
def __init__(self):
super(BatchItemResponse, self).__init__()
self.bId = ""
self.list_dict = {}
self.class_dict = {
"Fault": Fault
}
self._original_object = None
self.Fault = None
def set_object(self, obj):
self.class_dict[obj.qbo_object_name] = obj
setattr(self, obj.qbo_object_name, obj)
self._original_object = obj
def get_object(self):
return self._original_object
class BatchResponse(object):
def __init__(self):
self.batch_responses = []
self.original_list = []
self.successes = []
self.faults = []
class BatchItemRequest(ToJsonMixin):
class_dict = {}
list_dict = {}
qbo_object_name = "BatchItemRequest"
def __init__(self):
self.bId = ""
self.operation = ""
self._original_object = None
def set_object(self, obj):
self.class_dict[obj.qbo_object_name] = obj
setattr(self, obj.qbo_object_name, obj)
self._original_object = obj
def get_object(self):
return self._original_object
class IntuitBatchRequest(ToJsonMixin):
list_dict = {
"BatchItemRequest": BatchItemRequest
}
def __init__(self):
self.BatchItemRequest = []