Coder Social home page Coder Social logo

williamren / django-oscar-sagepay-direct Goto Github PK

View Code? Open in Web Editor NEW

This project forked from django-oscar/django-oscar-sagepay-direct

0.0 2.0 0.0 2.62 MB

Oscar extension for using Sagepay's "Direct" integration functionality

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.52% Python 87.13% HTML 12.36%

django-oscar-sagepay-direct's Introduction

Sagepay package for django-oscar

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: [email protected].

Continuous integration status:

image

Installation

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.

Usage

The main entry point into this package is the oscar_sagepay.facade module, which provides the following functionality:

Authenticate

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 instance
  • currency is the 3 character currency code
  • bankcard is an oscar.apps.payment.models.Bankcard instance
  • shipping_address is an oscar.apps.order.models.ShippingAddress instance
  • billing_address is an oscar.apps.order.models.BillingAddress instance
  • description (optional) is a short description of the transaction
  • order_number (optional) is an order number associated with the transaction

Authorise

Perform 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 request
  • amount is a decimal.Decimal instance
  • description (optional) is a short description of the transaction
  • order_number (optional) is an order number associated with the transaction

Refund

Perform 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 request
  • amount is a decimal.Decimal instance
  • description (optional) is a short description of the transaction
  • order_number (optional) is an order number associated with the transaction

Void

Perform 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 request
  • order_number (optional) is an order number associated with the transaction

Checkout

For an example of how this facade can be used used in an Oscar site, see the sandbox site that is part of this repo.

Settings

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 codes
  • OSCAR_SAGEPAY_AVSCV2 (default: 2) - the Sagepay setting for AV2CV2 behaviour.

Contributing

Install locally by creating a virtualenv and running:

(sagepay) $ make 

Run tests with:

(sagepay) $ py.test 

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:

(sagepay) $ make sandbox 

and run the server using:

(sagepay) $ sandbox/manage.py runserver

django-oscar-sagepay-direct's People

Contributors

codeinthehole avatar costas-basdekis avatar

Watchers

william avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.