This package provides integration between django-oscar and Sagepay's Direct APIs. It is still in the early stage of development - please ask any questions using the Oscar mailing list: django-oscar@googlegroups.com.
Continuous integration status:
Install package using either:
$ pip install django-oscar-sagepay-direct
or:
$ pip install git+git://github.com/tangentlabs/django-oscar-sagepay-direct#egg=django-oscar-sagepay-direct
Add oscar_sagepay
to INSTALLED_APPS
and specify your vendor name:
OSCAR_SAGEPAY_VENDOR = 'tangentlabs'
You will also need to install django-oscar
too.
The main entry point into this package is the oscar_sagepay.facade
module, which provides the following functionality:
Perform an 'AUTHENTICATE' request:
from decimal import Decimal as D from oscar_sagepay import facade tx_id = facade.authenticate(amount, currency, bankcard, shipping_address, billing_address, description, order_number)
where:
amount
is a decimal.Decimal
instancecurrency
is the 3 character currency codebankcard
is an oscar.apps.payment.models.Bankcard
instanceshipping_address
is an oscar.apps.order.models.ShippingAddress
instancebilling_address
is an oscar.apps.order.models.BillingAddress
instancedescription
(optional) is a short description of the transactionorder_number
(optional) is an order number associated with the transactionPerform an 'AUTHORISE' request:
from decimal import Decimal as D from oscar_sagepay import facade tx_id = facade.authorise(tx_id, amount, description, order_number)
where:
tx_id
is the transaction ID of a successful AUTHENTICATE requestamount
is a decimal.Decimal
instancedescription
(optional) is a short description of the transactionorder_number
(optional) is an order number associated with the transactionPerform a 'REFUND' request against a previous 'AUTHORISE':
from decimal import Decimal as D from oscar_sagepay import facade tx_id = refund(tx_id, amount, description, order_number)
where:
tx_id
is the transaction ID of a successful AUTHORISE requestamount
is a decimal.Decimal
instancedescription
(optional) is a short description of the transactionorder_number
(optional) is an order number associated with the transactionPerform a 'VOID' request against a previous 'AUTHORISE':
from decimal import Decimal as D from oscar_sagepay import facade tx_id = void(tx_id, order_number)
where:
tx_id
is the transaction ID of a successful AUTHORISE requestorder_number
(optional) is an order number associated with the transactionFor an example of how this facade can be used used in an Oscar site, see the sandbox site that is part of this repo.
These settings are available:
OSCAR_SAGEPAY_VENDOR
- your vendor name (passed as Vendor
to Sagepay).OSCAR_SAGEPAY_VPS_PROTOCOL
(default: 3.0
) - the VPS protocol (passed as VPSProtocol
to Sagepay).OSCAR_SAGEPAY_TEST_MODE
(default: True
) - whether to use the live or test Sagepay servers.OSCAR_SAGEPAY_TX_CODE_PREFIX
(default: oscar
) - a prefix string to prepend to generated TX codesOSCAR_SAGEPAY_AVSCV2
(default: 2
) - the Sagepay setting for AV2CV2 behaviour.Install locally by creating a virtualenv and running:
Run tests with:
To run end-to-end tests, you'll need a test account with Sagepay configured to respond to your IP address and to not response randomly to DIRECT requests (as is the default). Set your vendor name in sandbox/private_settings.py
and run:
(sagepay) $ py.test --external
Build a sandbox site using:
and run the server using:
(sagepay) $ sandbox/manage.py runserver
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4