Coverage for /home/tribaal/workspace/django-shop/shop/payment/api : 88.46%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
This file defines the interfaces one should implement when either creating a new payment module or willing to use modules with another shop system. """
""" This object's purpose is to expose an API to the shop system. Ideally, shops (django SHOP or others) should implement this API, so that payment plugins are interchangeable between systems.
This implementation is the interface reference for django SHOP
Don't forget that since plenty of methods are common to both ShopPaymentAPI and ShopShippingAPI(), they are defined in the ShopAPI base class! """
#========================================================================== # Payment-specific #==========================================================================
save=True): """ Marks the specified amount for the given order as paid. This allows to hook in more complex behaviors (like saving a history of payments in a Payment model) The optional save argument allows backends to explicitly not save the order yet """ order=order, # How much was paid with this particular transfer amount=Decimal(amount), transaction_id=transaction_id, payment_method=payment_method)
# Set the order status:
# empty the related cart cart.empty()
#========================================================================== # URLS #========================================================================== # Theses simply return URLs to make redirections easier. """ 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. """
""" A helper for backends to let them redirect to a generic "order was cancelled" URL of their choosing. """ return reverse('checkout_payment') |