Exemplo n.º 1
0
 def __init__(self):
     self._packages = []
     self._packages.append(
         Package(City="Wrocław",
                 PostalCode="50-043",
                 StreetAddress="Ruska 38",
                 ClientId=1,
                 DeliveryType="Ekonomiczny",
                 DeclaredValue=100))
     self._packages.append(
         Package(City="Wrocław",
                 PostalCode="51-152",
                 StreetAddress="Piłsudskiego 7",
                 ClientId=2,
                 DeliveryType="Standard"))
     self._packages.append(
         Package(City="Wrocław",
                 PostalCode="53-659",
                 StreetAddress="Sikorskiego 10",
                 ClientId=3,
                 DeliveryType="Standard",
                 DeclaredValue=50))
     self._packages.append(
         Package(City="Wrocław",
                 PostalCode="53-609",
                 StreetAddress="Fabryczna 12",
                 ClientId=4,
                 DeliveryType="Ekonomiczny",
                 DeclaredValue=200))
Exemplo n.º 2
0
 def CreatePackageNoPickupsNoReturn():
     return Package(City="Wrocław",
                    PostalCode="51-152",
                    StreetAddress="Piłsudskiego 7",
                    ClientId=1,
                    DeliveryType="Standard",
                    DeclaredValue=100)
Exemplo n.º 3
0
 def CreateUnpackedPickups():
     package = Package(City="Wrocław",
                       PostalCode="51-152",
                       StreetAddress="Piłsudskiego 7",
                       ClientId=1,
                       DeliveryType="Standard",
                       DeclaredValue=100)
     package.AddDeliveryProduct("Pan Tadeusz", 1)
     package.AddDeliveryProduct("Biblia", 3)
     package.AddDeliveryProduct(".net oczami developera", 1)
     return package.GetPackageProducts()
Exemplo n.º 4
0
 def CreatePackageManyPickupNoReturn():
     package = Package(City="Wrocław",
                       PostalCode="51-152",
                       StreetAddress="Piłsudskiego 7",
                       ClientId=1,
                       DeliveryType="Standard",
                       DeclaredValue=100)
     package.AddDeliveryProduct("Pan Tadeusz", 1)
     package.AddDeliveryProduct("Biblia", 3)
     package.AddDeliveryProduct(".net oczami developera", 1)
     # Status == Pakowanie
     package.GetStatus().NextDeliveryStep()
     return package
Exemplo n.º 5
0
 def CreateUnconfirmedReturn():
     package = Package(City="Wrocław",
                       PostalCode="51-152",
                       StreetAddress="Piłsudskiego 7",
                       ClientId=1,
                       DeliveryType="Standard",
                       DeclaredValue=100)
     package.AddDeliveryProduct("Pan Tadeusz", 1)
     package.AddDeliveryProduct("Biblia", 3)
     package.AddDeliveryProduct(".net oczami developera", 1)
     package.MarkPackedProduct("Pan Tadeusz")
     package.MarkPackedProduct("Biblia")
     package.MarkPackedProduct(".net oczami developera")
     package.MakeReturn(
         "Odbiorca twierdzi, że niczego nie zamawiał. Nie przyjął przesyłki."
     )
     return package.GetReturn()
Exemplo n.º 6
0
 def CreateDeliveredPackageManyPickupPackedNoReturn():
     package = Package(City="Wrocław",
                       PostalCode="51-152",
                       StreetAddress="Piłsudskiego 7",
                       ClientId=1,
                       DeliveryType="Standard",
                       DeclaredValue=100)
     package.AddDeliveryProduct("Pan Tadeusz", 1)
     package.AddDeliveryProduct("Biblia", 3)
     package.AddDeliveryProduct(".net oczami developera", 1)
     package.GetStatus().NextDeliveryStep()
     package.MarkPackedProduct("Pan Tadeusz")
     package.MarkPackedProduct("Biblia")
     package.MarkPackedProduct(".net oczami developera")
     package.GetStatus().NextDeliveryStep()
     # Status == Dostarczone
     package.GetStatus().NextDeliveryStep()
     package.DeliveryDate = datetime(2020, 5, 21)
     return package
Exemplo n.º 7
0
 def NewDelivery(self, city: str, postalCode: str, streetAddress: str,
                 client_id: int, delivery_method: str, value: int,
                 items: {str: int}):
     if not city or not isinstance(city, str) \
             or not postalCode or not isinstance(postalCode, str)\
             or not streetAddress or not isinstance(streetAddress, str) \
             or not isinstance(client_id, int) or client_id<0\
             or not delivery_method or not isinstance(delivery_method, str) \
             or not isinstance(value, int) or value<0\
             or not items or not isinstance(items, dict):
         raise ValueError("Invalid parameters type")
     package = Package(City=city,
                       PostalCode=postalCode,
                       StreetAddress=streetAddress,
                       ClientId=client_id,
                       DeliveryType=delivery_method,
                       DeclaredValue=value)
     for item, quantity in items.items():
         package.AddDeliveryProduct(product_name=item, quantity=quantity)
     self.packageRepository.Insert(package)