Skip to content

Instantly share code, notes, and snippets.

@jas02
Created October 19, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jas02/b9128b236c94285c49bdf3ed726b9339 to your computer and use it in GitHub Desktop.
Save jas02/b9128b236c94285c49bdf3ed726b9339 to your computer and use it in GitHub Desktop.
from oscar.apps.checkout import views
from oscar.apps.payment import models
# Subclass the core Oscar view so we can customise
class PaymentDetailsView(views.PaymentDetailsView):
#template_name = 'cash_on_delivery/payment_details.html'
#template_name_preview = 'cash_on_delivery/preview.html'
template_name = 'cash_on_delivery/preview.html'
def handle_payment(self, order_number, total, **kwargs):
source_type, __ = models.SourceType.objects.get_or_create(
name="CashOnDelivery")
source = models.Source(
source_type=source_type,
amount_allocated=total.incl_tax)
self.add_payment_source(source)
# Record payment event
self.add_payment_event('cash-on-delivery', total.incl_tax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment