Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: chrisglass/django-shop
...
head fork: chrisglass/django-shop
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
Commits on Feb 14, 2012
@per42 per42 Added swedish translation
Also fixed a misspelling in the english-english translation
045ad14
@chrisglass Merge pull request #141 from per42/master
Added Swedish translation
2bb2cde
Commits on Feb 20, 2012
@per42 per42 Updates order status after shipping and payment
A signal was emitted to set the status to CONFIRMED after the shipping
stage, but no one listens to it. Now the status is directly modified.

Similarly, status is directly set to COMPLETED after payment. The cart
is also emptied at this stage. It was already there, but only when the
backend payment is done, and the user redirected to the "Thank you"
page. Now that logic has been copied to the confirm_payment API
function, so that the order is COMPLETED as soon as payment is made.
This is important when using tha PayPal IPN backend, since the user is
redirected back the site later than - if at all, the IPN is sent. 

Not tested!
was
already there,
13ddf80
Commits on Feb 22, 2012
@chrisglass Merge pull request #142 from per42/13ddf80ef69789a2433c8e4d13022a6842…
…1ad90e

Updates order status after shipping and payment
1a08812
@chrisglass Merge branch 'master' of github.com:divio/django-shop into fix-curren…
…cyfield-limitation
21ba6c1
View
2  shop/locale/en/LC_MESSAGES/django.po
@@ -134,7 +134,7 @@ msgstr ""
#: models/ordermodel.py:99
msgid "The payment backend use to process the purchase"
-msgstr ""
+msgstr "The payment backend used to process the purchase"
#: models/ordermodel.py:103
msgid "Order payment"
View
BIN  shop/locale/sv/LC_MESSAGES/django.mo
Binary file not shown
View
357 shop/locale/sv/LC_MESSAGES/django.po
@@ -0,0 +1,357 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Per <per.rosengren@gmail.com>, 2012.
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-02-14 13:05+0800\n"
+"PO-Revision-Date: 2012-02-14 13:05+0800\n"
+"Last-Translator: Per <per.rosengren@gmail.com>\n"
+"Language-Team: Stunning\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Virtaal 0.7.1\n"
+
+#: .\addressmodel\models.py:12
+#, python-format
+msgid ""
+"\n"
+"Name: %(name)s,\n"
+"Address: %(address)s,\n"
+"Zip-Code: %(zipcode)s,\n"
+"City: %(city)s,\n"
+"State: %(state)s,\n"
+"Country: %(country)s\n"
+msgstr ""
+"\n"
+"Namn: %(name)s,\n"
+"Adress: %(address)s,\n"
+"Postnummer: %(zipcode)s,\n"
+"Ort: %(city)s,\n"
+"Län: %(state)s,\n"
+"Land: %(country)s\n"
+
+#: .\addressmodel\models.py:32 .\addressmodel\models.py:48
+msgid "Country"
+msgstr "Land"
+
+#: .\addressmodel\models.py:33
+msgid "Countries"
+msgstr "Länder"
+
+#: .\addressmodel\models.py:42 .\models\defaults\bases.py:26
+msgid "Name"
+msgstr "Namn"
+
+#: .\addressmodel\models.py:43 .\addressmodel\models.py:52
+msgid "Address"
+msgstr "Adress"
+
+#: .\addressmodel\models.py:44
+msgid "Address2"
+msgstr "Adress2"
+
+#: .\addressmodel\models.py:45
+msgid "Zip Code"
+msgstr "Postnummer"
+
+#: .\addressmodel\models.py:46
+msgid "City"
+msgstr "Stad"
+
+#: .\addressmodel\models.py:47
+msgid "State"
+msgstr "Län"
+
+#: .\addressmodel\models.py:53
+msgid "Addresses"
+msgstr "Adresser"
+
+#: .\admin\orderadmin.py:44
+msgid "Shipping"
+msgstr "Frakt"
+
+#: .\admin\orderadmin.py:47
+msgid "Billing"
+msgstr "Betalning"
+
+#: .\models\ordermodel.py:45 .\models\ordermodel.py:59
+#: .\models\ordermodel.py:92 .\models\defaults\bases.py:339
+#: .\models\defaults\bases.py:416 .\models\defaults\order.py:13
+msgid "Order"
+msgstr "Beställning"
+
+#: .\models\ordermodel.py:46
+msgid "Extra info"
+msgstr "Extra info"
+
+#: .\models\ordermodel.py:50 .\models\ordermodel.py:51
+msgid "Order extra info"
+msgstr "Beställning extra info"
+
+#: .\models\ordermodel.py:60 .\models\ordermodel.py:78
+msgid "Label"
+msgstr "Etikett"
+
+#: .\models\ordermodel.py:61 .\models\ordermodel.py:79
+#: .\models\ordermodel.py:94
+msgid "Amount"
+msgstr "Belopp"
+
+#: .\models\ordermodel.py:64
+msgid "Is shipping"
+msgstr "Fraktas"
+
+#: .\models\ordermodel.py:68
+msgid "Extra order price field"
+msgstr "Extra beställnings-pris-fält"
+
+#: .\models\ordermodel.py:69
+msgid "Extra order price fields"
+msgstr "Extra beställnings-pris-fält"
+
+#: .\models\ordermodel.py:77 .\models\defaults\bases.py:431
+#: .\models\defaults\orderitem.py:11
+msgid "Order item"
+msgstr "Beställningsobjekt"
+
+#: .\models\ordermodel.py:83
+msgid "Extra order item price field"
+msgstr "Extra beställningsobjekt-pris-fält"
+
+#: .\models\ordermodel.py:84
+msgid "Extra order item price fields"
+msgstr "Extra beställningsobjekt-pris-fält"
+
+#: .\models\ordermodel.py:96
+msgid "Transaction ID"
+msgstr "Transaktions-ID"
+
+#: .\models\ordermodel.py:97
+msgid "The transaction processor's reference"
+msgstr "Transaktions-processorns referens"
+
+#: .\models\ordermodel.py:99
+msgid "Payment method"
+msgstr "Betalningsmetod"
+
+#: .\models\ordermodel.py:100
+msgid "The payment backend use to process the purchase"
+msgstr "Betalningssystem att genomföra köpet med"
+
+#: .\models\ordermodel.py:104
+msgid "Order payment"
+msgstr "Betalning av beställning"
+
+#: .\models\ordermodel.py:105
+msgid "Order payments"
+msgstr "Betalningar av beställningar"
+
+#: .\models\defaults\bases.py:27
+msgid "Slug"
+msgstr "Slug"
+
+#: .\models\defaults\bases.py:28
+msgid "Active"
+msgstr "Aktiv"
+
+#: .\models\defaults\bases.py:30
+msgid "Date added"
+msgstr "Tillagd datum"
+
+#: .\models\defaults\bases.py:32
+msgid "Last modified"
+msgstr "Senast ändrad"
+
+#: .\models\defaults\bases.py:33 .\models\defaults\bases.py:423
+#: .\templates\shop\cart.html.py:18
+#: .\templates\shop\templatetags\_order.html.py:28
+msgid "Unit price"
+msgstr "Enhetspris"
+
+#: .\models\defaults\bases.py:38 .\models\defaults\bases.py:422
+#: .\models\defaults\product.py:17
+msgid "Product"
+msgstr "Produkt"
+
+#: .\models\defaults\bases.py:39 .\models\defaults\product.py:18
+msgid "Products"
+msgstr "Produkter"
+
+#: .\models\defaults\bases.py:77 .\models\defaults\cart.py:10
+msgid "Cart"
+msgstr "Varukorg"
+
+#: .\models\defaults\bases.py:78 .\models\defaults\cart.py:11
+msgid "Carts"
+msgstr "Varukorgar"
+
+#: .\models\defaults\bases.py:263 .\models\defaults\cartitem.py:10
+msgid "Cart item"
+msgstr "Vara"
+
+#: .\models\defaults\bases.py:264 .\models\defaults\cartitem.py:11
+msgid "Cart items"
+msgstr "Varor"
+
+#: .\models\defaults\bases.py:312
+msgid "Processing"
+msgstr "Behandlar"
+
+#: .\models\defaults\bases.py:313
+msgid "Selecting payment"
+msgstr "Väljer betalning"
+
+#: .\models\defaults\bases.py:314
+msgid "Confirmed"
+msgstr "Bekräftad"
+
+#: .\models\defaults\bases.py:315
+msgid "Completed"
+msgstr "Genomfört"
+
+#: .\models\defaults\bases.py:316
+msgid "Shipped"
+msgstr "Skickad för leverans"
+
+#: .\models\defaults\bases.py:317
+msgid "Cancelled"
+msgstr "Avbruten"
+
+#: .\models\defaults\bases.py:322
+msgid "User"
+msgstr "Användare"
+
+#: .\models\defaults\bases.py:324
+msgid "Status"
+msgstr "Status"
+
+#: .\models\defaults\bases.py:325
+msgid "Order subtotal"
+msgstr "Beställning delsumma"
+
+#: .\models\defaults\bases.py:326
+#: .\templates\shop\templatetags\_order.html.py:62
+msgid "Order Total"
+msgstr "Beställning totalt"
+
+#: .\models\defaults\bases.py:327
+msgid "Shipping address"
+msgstr "Leveransadress"
+
+#: .\models\defaults\bases.py:329
+msgid "Billing address"
+msgstr "Betalningsadress"
+
+#: .\models\defaults\bases.py:332
+msgid "Created"
+msgstr "Skapad"
+
+#: .\models\defaults\bases.py:334
+msgid "Updated"
+msgstr "Uppdaterat"
+
+#: .\models\defaults\bases.py:340 .\models\defaults\order.py:14
+msgid "Orders"
+msgstr "Beställningar"
+
+#: .\models\defaults\bases.py:343
+#, python-format
+msgid "Order ID: %(id)s"
+msgstr "Beställnings-ID: %(id)s"
+
+#: .\models\defaults\bases.py:418
+msgid "Product reference"
+msgstr "Produktreferens"
+
+#: .\models\defaults\bases.py:420 .\templates\shop\cart.html.py:17
+#: .\templates\shop\templatetags\_order.html.py:27
+msgid "Product name"
+msgstr "Produktnamn"
+
+#: .\models\defaults\bases.py:424 .\templates\shop\cart.html.py:19
+#: .\templates\shop\templatetags\_order.html.py:29
+msgid "Quantity"
+msgstr "Antal"
+
+#: .\models\defaults\bases.py:425
+msgid "Line subtotal"
+msgstr "Kedje-delsumma"
+
+#: .\models\defaults\bases.py:426
+msgid "Line total"
+msgstr "Kedja totalt"
+
+#: .\models\defaults\bases.py:432 .\models\defaults\orderitem.py:12
+msgid "Order items"
+msgstr "Beställningsobjekt"
+
+#: .\templates\shop\cart.html.py:5
+msgid "Your shopping cart"
+msgstr "Din varukorg"
+
+#: .\templates\shop\cart.html.py:42
+#: .\templates\shop\templatetags\_order.html.py:49
+msgid "Line Total"
+msgstr "Kedja totalt"
+
+#: .\templates\shop\cart.html.py:48
+msgid "Cart Subtotal"
+msgstr "Varukorg delsumma"
+
+#: .\templates\shop\cart.html.py:56
+msgid "Cart Total"
+msgstr "Varukorg totalt"
+
+#: .\templates\shop\cart.html.py:60
+msgid "Update Shopping Cart"
+msgstr "Uppdatera varukorg"
+
+#: .\templates\shop\cart.html.py:65
+msgid "Empty Shopping Cart"
+msgstr "Töm varukorg"
+
+#: .\templates\shop\cart.html.py:69
+msgid "Proceed to checkout"
+msgstr "Gå till kassan"
+
+#: .\templates\shop\cart.html.py:74
+msgid "Shopping cart is empty"
+msgstr "Varukorgen är tom"
+
+#: .\templates\shop\order_list.html.py:5
+msgid "Order list"
+msgstr "Beställningslista"
+
+#: .\templates\shop\welcome.html.py:11
+msgid "Hello"
+msgstr "Hej"
+
+#: .\templates\shop\welcome.html.py:12
+msgid "Your orders"
+msgstr "Dina beställningar"
+
+#: .\templates\shop\templatetags\_order.html.py:4
+msgid "Order ID:"
+msgstr "Beställnings-ID:"
+
+#: .\templates\shop\templatetags\_order.html.py:8
+msgid "Order Status"
+msgstr "Beställningsstatus"
+
+#: .\templates\shop\templatetags\_order.html.py:14
+msgid "Shipping Address"
+msgstr "Leveransadress"
+
+#: .\templates\shop\templatetags\_order.html.py:18
+msgid "Billing Address"
+msgstr "Betalningsadress"
+
+#: .\templates\shop\templatetags\_order.html.py:54
+msgid "Order Subtotal"
+msgstr "Beställning delsumma"
View
24 shop/payment/api.py
@@ -1,15 +1,17 @@
# -*- coding: utf-8 -*-
"""
-This file defines the interafces one should implement when either creating a
+This file defines the interfaces one should implement when either creating a
new payment module or willing to use modules with another shop system.
"""
from decimal import Decimal
from shop.models.ordermodel import OrderPayment
+from shop.models.ordermodel import Order
+from shop.models.cartmodel import Cart
from shop.shop_api import ShopAPI
+from shop.order_signals import completed
from django.core.urlresolvers import reverse
-
class PaymentAPI(ShopAPI):
"""
This object's purpose is to expose an API to the shop system.
@@ -41,7 +43,18 @@ def confirm_payment(self, order, amount, transaction_id, payment_method,
amount=Decimal(amount),
transaction_id=transaction_id,
payment_method=payment_method)
- # Save is not used in the particular case.
+
+ if save and self.is_order_payed(order):
+ # Set the order status:
+ order.status = Order.COMPLETED
+ order.save()
+ completed.send(sender=self, order=order)
+
+ # Empty the customers basket, to reflect that the purchase was
+ # completed
+ cart_object = Cart.objects.get(user=order.user)
+ cart_object.empty()
+
#==========================================================================
# URLS
@@ -52,6 +65,11 @@ def get_finished_url(self):
A helper for backends, so that they can call this when their job
is finished i.e. The payment has been processed from a user perspective
This will redirect to the "Thanks for your order" page.
+
+ To confirm the payment, call confirm_payment before this function.
+ For example, for PayPal IPN, the payment is confirmed upon receipt
+ of an Instant Payment Notification, and later this function is called
+ when the user is directed back from PayPal.
"""
return reverse('thank_you_for_your_order')
View
3  shop/shipping/api.py
@@ -2,6 +2,7 @@
from shop.shop_api import ShopAPI
from shop.order_signals import payment_selection
from shop.models.ordermodel import ExtraOrderPriceField
+from shop.models.ordermodel import Order
from django.shortcuts import redirect
@@ -58,6 +59,8 @@ def finished(self, order):
is finished i.e. shipping costs are added to the order.
This will redirect to the "select a payment method" page.
"""
+ order.status = Order.CONFIRMED
+ order.save()
# Emit the signal to say we're now selecting payment
payment_selection.send(self, order=order)
return redirect('checkout_payment')

No commit comments for this range

Something went wrong with that request. Please try again.