Bumping version for release.
[PyCIM.git] / CIM14 / IEC61968 / PaymentMetering / Vendor.py
blob81e7767862f3c0f5d9a2cfa17a915dce83c8fcc7
1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class Vendor(IdentifiedObject):
20 """The entity that owns PointOfSale and contracts with Cashier to receipt payments and vend tokens using the payment system. Vendor has a private contract with and is managed by Merchant who is a type of Organisation. Vendor is accountable to Merchant for revenue collected, who is in turn accountable to Supplier.
21 """
23 def __init__(self, PointOfSales=None, MerchantAccount=None, Cashiers=None, VendorShifts=None, *args, **kw_args):
24 """Initialises a new 'Vendor' instance.
26 @param PointOfSales: All points of sale this Vendor controls.
27 @param MerchantAccount: Merchant account against which this vendor sells tokens or recept payments.
28 @param Cashiers: All Cachiers managed by this Vendor.
29 @param VendorShifts: All vendor shifts opened and owned by this vendor.
30 """
31 self._PointOfSales = []
32 self.PointOfSales = [] if PointOfSales is None else PointOfSales
34 self._MerchantAccount = None
35 self.MerchantAccount = MerchantAccount
37 self._Cashiers = []
38 self.Cashiers = [] if Cashiers is None else Cashiers
40 self._VendorShifts = []
41 self.VendorShifts = [] if VendorShifts is None else VendorShifts
43 super(Vendor, self).__init__(*args, **kw_args)
45 _attrs = []
46 _attr_types = {}
47 _defaults = {}
48 _enums = {}
49 _refs = ["PointOfSales", "MerchantAccount", "Cashiers", "VendorShifts"]
50 _many_refs = ["PointOfSales", "Cashiers", "VendorShifts"]
52 def getPointOfSales(self):
53 """All points of sale this Vendor controls.
54 """
55 return self._PointOfSales
57 def setPointOfSales(self, value):
58 for x in self._PointOfSales:
59 x.Vendor = None
60 for y in value:
61 y._Vendor = self
62 self._PointOfSales = value
64 PointOfSales = property(getPointOfSales, setPointOfSales)
66 def addPointOfSales(self, *PointOfSales):
67 for obj in PointOfSales:
68 obj.Vendor = self
70 def removePointOfSales(self, *PointOfSales):
71 for obj in PointOfSales:
72 obj.Vendor = None
74 def getMerchantAccount(self):
75 """Merchant account against which this vendor sells tokens or recept payments.
76 """
77 return self._MerchantAccount
79 def setMerchantAccount(self, value):
80 if self._MerchantAccount is not None:
81 filtered = [x for x in self.MerchantAccount.Vendors if x != self]
82 self._MerchantAccount._Vendors = filtered
84 self._MerchantAccount = value
85 if self._MerchantAccount is not None:
86 if self not in self._MerchantAccount._Vendors:
87 self._MerchantAccount._Vendors.append(self)
89 MerchantAccount = property(getMerchantAccount, setMerchantAccount)
91 def getCashiers(self):
92 """All Cachiers managed by this Vendor.
93 """
94 return self._Cashiers
96 def setCashiers(self, value):
97 for x in self._Cashiers:
98 x.Vendor = None
99 for y in value:
100 y._Vendor = self
101 self._Cashiers = value
103 Cashiers = property(getCashiers, setCashiers)
105 def addCashiers(self, *Cashiers):
106 for obj in Cashiers:
107 obj.Vendor = self
109 def removeCashiers(self, *Cashiers):
110 for obj in Cashiers:
111 obj.Vendor = None
113 def getVendorShifts(self):
114 """All vendor shifts opened and owned by this vendor.
116 return self._VendorShifts
118 def setVendorShifts(self, value):
119 for x in self._VendorShifts:
120 x.Vendor = None
121 for y in value:
122 y._Vendor = self
123 self._VendorShifts = value
125 VendorShifts = property(getVendorShifts, setVendorShifts)
127 def addVendorShifts(self, *VendorShifts):
128 for obj in VendorShifts:
129 obj.Vendor = self
131 def removeVendorShifts(self, *VendorShifts):
132 for obj in VendorShifts:
133 obj.Vendor = None