Exemplo n.º 1
0
    def get_purchased_items(self):
        items = [
            PurchasedItem(
                name=item.product_name, sku=item.product_sku,
                quantity=item.quantity,
                price=item.unit_price_gross.quantize(Decimal('0.01')),
                currency=settings.DEFAULT_CURRENCY)
            for item in self.order.get_items()]

        voucher = self.order.voucher
        if voucher is not None:
            items.append(PurchasedItem(
                name=self.order.discount_name,
                sku='DISCOUNT',
                quantity=1,
                price=-self.order.discount_amount.net,
                currency=self.currency))
        return items
Exemplo n.º 2
0
    def get_purchased_items(self):
        lines = [
            PurchasedItem(
                name=line.product_name, sku=line.product_sku,
                quantity=line.quantity,
                price=line.unit_price_gross.quantize(Decimal('0.01')).amount,
                currency=line.unit_price.currency)
            for line in self.order.get_lines()]

        voucher = self.order.voucher
        if voucher is not None:
            lines.append(
                PurchasedItem(
                    name=self.order.discount_name,
                    sku='DISCOUNT',
                    quantity=1,
                    price=-self.order.discount_amount.amount,
                    currency=self.order.discount_amount.currency))
        return lines
Exemplo n.º 3
0
 def get_purchased_items(self):
     items = []
     for item in self.order.items.all():
         x = PurchasedItem(name=item.item_name,
                           sku='SKU',
                           quantity=item.quantity_ordered,
                           price=item.item_price,
                           currency='GBP')
         items.append(x)
     return items
Exemplo n.º 4
0
 def get_purchased_items(self, id):
     # Get proper product
     item = get_object_or_404(Clothing_Post, id=id)
     # yield PurchasedItem(name=item.Name, sku=item.Name[:4],
     #                     quantity=1, price=item.Price, currency='USD')
     yield PurchasedItem(name='The Hound of the Baskervilles',
                         sku='BSKV',
                         quantity=9,
                         price=Decimal(10),
                         currency='USD')
Exemplo n.º 5
0
 def get_purchased_items(self):
     items = [
         PurchasedItem(name=item.product_name,
                       quantity=item.quantity,
                       price=item.unit_price_gross,
                       sku=item.product.sku,
                       currency=settings.SATCHLESS_DEFAULT_CURRENCY)
         for item in self.order.get_items()
     ]
     return items
Exemplo n.º 6
0
 def get_purchased_items(self):
     items = [
         PurchasedItem(name=item.product_name,
                       sku=item.product_sku,
                       quantity=item.quantity,
                       price=item.unit_price_gross.quantize(
                           Decimal('0.01')),
                       currency=settings.DEFAULT_CURRENCY)
         for item in self.order.get_items()
     ]
     return items
Exemplo n.º 7
0
 def get_purchased_items(self):
     has_items = bool(self.order.items)
     if has_items:
         name = "Order #{}".format(self.order_id)
         service_type = (
             self.order.get_service_type_display().lower().replace(
                 " ", "-"))
         sku = "order-{}-{}".format(service_type, self.order_id)
         currency = self.currency
         amount = self.total
         yield PurchasedItem(
             name=name,
             quantity=1,
             sku=sku,
             price=amount,
             currency=currency,
         )
Exemplo n.º 8
0
 def get_purchased_items(self):
     yield PurchasedItem(name='The Hound of the Baskervilles',
                         price=Decimal(10),
                         currency='USD',
                         quantity=9,
                         sku='BSKV')
Exemplo n.º 9
0
 def get_purchased_items(self):
     # you'll probably want to retrieve these from an associated order
     yield PurchasedItem(name='The Hound of the Baskervilles', sku='BSKV',
                         quantity=9, price=Decimal(10), currency='USD')
Exemplo n.º 10
0
 def purchased_item(self):
     return PurchasedItem(name=self.name,
                          sku=self.sku,
                          quantity=self.quantity,
                          price=self.price,
                          currency=self.currency)