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()
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
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()
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
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)