-
Notifications
You must be signed in to change notification settings - Fork 0
/
modelSaleTransaction.py
55 lines (37 loc) · 1.81 KB
/
modelSaleTransaction.py
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
from google.appengine.ext import ndb
import ndbTools
from modelFees import Fees
from modelShipping import Shipping
class SaleItem(ndb.Model):
inventory = ndb.KeyProperty(kind='Inventory')
salePrice = ndb.FloatProperty()
saleTax = ndb.FloatProperty()
saleQuantity = ndb.IntegerProperty()
class SaleTransaction(ndb.Model):
saleDate = ndb.DateProperty()
saleDateTime = ndb.DateTimeProperty()
saleTime = ndb.TimeProperty()
saleItems = ndb.StructuredProperty(SaleItem, repeated=True)
sellingMethod = ndb.StringProperty() # change this to key later; each selling method will be like "Ebay (type) | jumboshrimps (account)"
sellingMethodFees = ndb.StructuredProperty(Fees, repeated=True) # change this to key "Fees" later
sellingMethodFeePaymentMethod = ndb.StringProperty() # change this to key later; will be all payment methods that are outgoing
paymentMethod = ndb.KeyProperty(kind='PaymentMethod') # will be all payment methods that are incoming
paymentMethodFees = ndb.StructuredProperty(Fees, repeated=True)
buyerName = ndb.StringProperty()
buyerEmail = ndb.StringProperty()
#buyerAddress = ndb.StructuredProperty() #
saleShippingPrice = ndb.FloatProperty()
shipping = ndb.StructuredProperty(Shipping, repeated=True)
returnTransactions = ndb.KeyProperty(kind='ReturnTransaction', repeated=True)
returnCosts = ndb.FloatProperty()
totalFees = ndb.ComputedProperty(lambda self: ComputeTotalFees(self))
profit = ndb.ComputedProperty(lambda self: ComputeProfit(self))
itemReturn = ndb.ComputedProperty(lambda self: ComputeReturn(self))
def AddSaleTransaction(d):
return ndbTools.AddData(SaleTransaction, d, parent=d['store']['key'])
def ComputeTotalFees(self):
return 0
def ComputeProfit(self):
return 0
def ComputeReturn(self):
return 0