|
|
@@ -234,7 +234,7 @@ class OrderPlacementMixin(CheckoutSessionMixin):
|
|
234
|
234
|
order is submitted.
|
|
235
|
235
|
"""
|
|
236
|
236
|
# Send confirmation message (normally an email)
|
|
237
|
|
- self.send_confirmation_message(order)
|
|
|
237
|
+ self.send_confirmation_message(order, self.communication_type_code)
|
|
238
|
238
|
|
|
239
|
239
|
# Flush all session data
|
|
240
|
240
|
self.checkout_session.flush()
|
|
|
@@ -254,27 +254,8 @@ class OrderPlacementMixin(CheckoutSessionMixin):
|
|
254
|
254
|
def get_success_url(self):
|
|
255
|
255
|
return reverse('checkout:thank-you')
|
|
256
|
256
|
|
|
257
|
|
- def send_confirmation_message(self, order, **kwargs):
|
|
258
|
|
- code = self.communication_type_code
|
|
259
|
|
- ctx = {'user': self.request.user,
|
|
260
|
|
- 'order': order,
|
|
261
|
|
- 'site': get_current_site(self.request),
|
|
262
|
|
- 'lines': order.lines.all()}
|
|
263
|
|
-
|
|
264
|
|
- if not self.request.user.is_authenticated():
|
|
265
|
|
- # Attempt to add the anon order status URL to the email template
|
|
266
|
|
- # ctx.
|
|
267
|
|
- try:
|
|
268
|
|
- path = reverse('customer:anon-order',
|
|
269
|
|
- kwargs={'order_number': order.number,
|
|
270
|
|
- 'hash': order.verification_hash()})
|
|
271
|
|
- except NoReverseMatch:
|
|
272
|
|
- # We don't care that much if we can't resolve the URL
|
|
273
|
|
- pass
|
|
274
|
|
- else:
|
|
275
|
|
- site = Site.objects.get_current()
|
|
276
|
|
- ctx['status_url'] = 'http://%s%s' % (site.domain, path)
|
|
277
|
|
-
|
|
|
257
|
+ def send_confirmation_message(self, order, code, **kwargs):
|
|
|
258
|
+ ctx = self.get_message_context(order)
|
|
278
|
259
|
try:
|
|
279
|
260
|
event_type = CommunicationEventType.objects.get(code=code)
|
|
280
|
261
|
except CommunicationEventType.DoesNotExist:
|
|
|
@@ -296,6 +277,29 @@ class OrderPlacementMixin(CheckoutSessionMixin):
|
|
296
|
277
|
logger.warning("Order #%s - no %s communication event type",
|
|
297
|
278
|
order.number, code)
|
|
298
|
279
|
|
|
|
280
|
+ def get_message_context(self, order):
|
|
|
281
|
+ ctx = {
|
|
|
282
|
+ 'user': self.request.user,
|
|
|
283
|
+ 'order': order,
|
|
|
284
|
+ 'site': get_current_site(self.request),
|
|
|
285
|
+ 'lines': order.lines.all()
|
|
|
286
|
+ }
|
|
|
287
|
+
|
|
|
288
|
+ if not self.request.user.is_authenticated():
|
|
|
289
|
+ # Attempt to add the anon order status URL to the email template
|
|
|
290
|
+ # ctx.
|
|
|
291
|
+ try:
|
|
|
292
|
+ path = reverse('customer:anon-order',
|
|
|
293
|
+ kwargs={'order_number': order.number,
|
|
|
294
|
+ 'hash': order.verification_hash()})
|
|
|
295
|
+ except NoReverseMatch:
|
|
|
296
|
+ # We don't care that much if we can't resolve the URL
|
|
|
297
|
+ pass
|
|
|
298
|
+ else:
|
|
|
299
|
+ site = Site.objects.get_current()
|
|
|
300
|
+ ctx['status_url'] = 'http://%s%s' % (site.domain, path)
|
|
|
301
|
+ return ctx
|
|
|
302
|
+
|
|
299
|
303
|
# Basket helpers
|
|
300
|
304
|
# --------------
|
|
301
|
305
|
|