e24paymentpipe Documentation

Similar documents
TPS Documentation. Release Thomas Roten

Roman Numeral Converter Documentation

Python wrapper for Viscosity.app Documentation

Python simple arp table reader Documentation

PyCRC Documentation. Release 1.0

Python Project Example Documentation

chatterbot-weather Documentation

Simple libtorrent streaming module Documentation

Aircrack-ng python bindings Documentation

django-idioticon Documentation

I2C LCD Documentation

sainsmart Documentation

Release Nicholas A. Del Grosso

Release Fulfil.IO Inc.

Redis Timeseries Documentation

Django Wordpress API Documentation

Poulpe Documentation. Release Edouard Klein

Simple Binary Search Tree Documentation

Pykemon Documentation

google-search Documentation

DNS Zone Test Documentation

django-reinhardt Documentation

smartfilesorter Documentation

django-cas Documentation

OpenUpgrade Library Documentation

withenv Documentation

django CMS Export Objects Documentation

Python Schema Generator Documentation

gunny Documentation Release David Blewett

pyldavis Documentation

Game Server Manager Documentation

doconv Documentation Release Jacob Mourelos

pydrill Documentation

Mantis STIX Importer Documentation

Google Domain Shared Contacts Client Documentation

Python AMT Tools Documentation

django-users2 Documentation

dj-libcloud Documentation

Frontier Documentation

open-helpdesk Documentation

Python State Machine Documentation

django-telegram-bot Documentation

eventbrite-sdk-python Documentation

AnyDo API Python Documentation

Release Ralph Offinger

Poetaster. Release 0.1.1

xmljson Documentation

Python AutoTask Web Services Documentation

API Wrapper Documentation

Aldryn Installer Documentation

ejpiaj Documentation Release Marek Wywiał

dicompyler-core Documentation

dublincore Documentation

Python State Machine Documentation

Python data pipelines similar to R Documentation

xmodels Documentation

django-responsive2 Documentation

django-composite-foreignkey Documentation

smsghussd Documentation

Airoscript-ng Documentation

yardstick Documentation

pvl Documentation Release William Trevor Olson

Python Finite State Machine. Release 0.1.5

django-stored-messages Documentation

gpib-ctypes Documentation

nacelle Documentation

Dragon Mapper Documentation

django-composite-foreignkey Documentation

syslog-ng Apache Kafka destination

django-private-chat Documentation

Infoblox Client Documentation

PyZillow Documentation

PyCon APAC 2014 Documentation

invenio-groups Documentation

OTX to MISP. Release 1.4.2

lazy-object-proxy Release 1.3.1

CID Documentation. Release Francis Reyes

Connexion Sqlalchemy Utils Documentation

Job Submitter Documentation

Microlab Instruments Documentation

django-bootstrap3 Documentation

Gearthonic Documentation

ProxySQL Tools Documentation

Durga Documentation. Release dev2. transcode

invenio-formatter Documentation

MT940 Documentation. Release Rick van Hattem (wolph)

cwmon-mysql Release 0.5.0

pytest-benchmark Release 2.5.0

Release Manu Phatak

Archan. Release 2.0.1

mlpy Documentation Release Astrid Jackson

timegate Documentation

Face Recognition Documentation

Regressors Documentation

python-hologram-api Documentation

MyAnimeList Scraper. Release 0.3.0

Coinbase Pro Asyncronous Websocket Client Documentation

redis-lock Release 3.2.0

otree Virtual Machine Manager Documentation

Lazarus Documentation

Transcription:

e24paymentpipe Documentation Release 1.2.0 Burhan Khalid Oct 30, 2017

Contents 1 e24paymentpipe 3 1.1 Features.................................................. 3 1.2 Todo................................................... 3 2 Installation 5 3 Quickstart 7 3.1 Payment Flow Diagram......................................... 7 3.2 Minimal Example............................................ 8 4 Contributing 11 4.1 Types of Contributions.......................................... 11 4.2 Get Started!................................................ 12 4.3 Pull Request Guidelines......................................... 13 5 Credits 15 5.1 Development Lead............................................ 15 5.2 Contributors............................................... 15 6 History 17 6.1 1.2.0 (2015-12-29)............................................ 17 6.2 1.1.2 (2014-11-03)............................................ 17 6.3 1.1 (2014-08-12)............................................. 17 6.4 0.1.0 (2011-02-12)............................................ 17 6.5 0.1.1 (2011-02-14)............................................ 17 6.6 0.1.2 (2011-12-16)............................................ 18 6.7 0.2.0 (2011-12-28)............................................ 18 7 Module Reference 19 7.1 Main Methods / Public Interface..................................... 19 7.2 Properties................................................. 20 8 Indices and tables 23 i

ii

Contents: Contents 1

2 Contents

CHAPTER 1 e24paymentpipe This package provides a Python implementation for ACI s e24paymentpipe Merchant Gateway Note: For legacy reasons, the name of the module is kept the same as the one from ACI s toolkit. This does not conform to PEP-8 guidelines. Free software: BSD license Documentation: http://e24paymentpipe.rtfd.org. Features Written in Python from scratch (not an existing port) Supports both newer and legacy terminal resource (.cgn) file formats Reasonably well documented Proven code - running in production since 2011 Compatible with Python 3.4, Python 2.7 Todo Add support for credit card payments, including refunds. Create comprehensive test suite 3

4 Chapter 1. e24paymentpipe

CHAPTER 2 Installation At the command line: $ easy_install e24paymentpipe Or, if you have virtualenvwrapper installed: $ mkvirtualenv e24paymentpipe $ pip install e24paymentpipe 5

6 Chapter 2. Installation

CHAPTER 3 Quickstart In order to use this module, you need to obtain a resource file and the alias for your terminal from your payment provider. This file will allow the module to connect to the gateway server to initialize your transaction workflow. Payment Flow Diagram This diagram illustrates the typical flow for the e24paymentpipe gateway, and how the various components fit together: 7

This module provides the functionality contained in the block marked e24paymentpipe. In a typical use case, you would write the functionality defined in the blue box in order to integrate the payment gateway with and existing system. The green highlighted boxes show where the user will be redirected to. For a sample implementation of this gateway, check out https://github.com/burhan/e24-sample-cart Minimal Example The quick demo for the impatient: from e24paymentpipe import Gateway pgw = Gateway('resource.cgn', 'alias') pgw.error_url = 'http://example.com/error' pgw.response_url = 'http://example.com/response' pgw.amount = 1.0 gw_info = pgw.get_payment_url() The snippet above will create a transaction in KWD, the default currency for the system. To override this, see the module documentation. 8 Chapter 3. Quickstart

The get_payment_url() method will return a dictionary with two keys paymentid and paymenturl. You need to store the paymentid in your database (as part of the transaction requirements) and then attach it at the end of the paymenturl to start the transaction initiation process. 3.2. Minimal Example 9

10 Chapter 3. Quickstart

CHAPTER 4 Contributing Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: Types of Contributions Report Bugs Report bugs at https://github.com/burhan/e24paymentpipe/issues. If you are reporting a bug, please include: Your operating system name and version. Any details about your local setup that might be helpful in troubleshooting. Detailed steps to reproduce the bug. Fix Bugs Look through the GitHub issues for bugs. Anything tagged with bug is open to whoever wants to implement it. Implement Features Look through the GitHub issues for features. Anything tagged with feature is open to whoever wants to implement it. 11

Write Documentation e24paymentpipe could always use more documentation, whether as part of the official e24paymentpipe docs, in docstrings, or even on the web in blog posts, articles, and such. Submit Feedback The best way to send feedback is to file an issue at https://github.com/burhan/e24paymentpipe/issues. If you are proposing a feature: Explain in detail how it would work. Keep the scope as narrow as possible, to make it easier to implement. Remember that this is a volunteer-driven project, and that contributions are welcome :) Get Started! Ready to contribute? Here s how to set up e24paymentpipe for local development. 1. Fork the e24paymentpipe repo on GitHub. 2. Clone your fork locally: $ git clone git@github.com:your_name_here/e24paymentpipe.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development: $ mkvirtualenv e24paymentpipe $ cd e24paymentpipe/ $ python setup.py develop 4. Create a branch for local development: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox: $ flake8 e24paymentpipe tests $ python setup.py test $ tox To get flake8 and tox, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub: $ git add. $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. 12 Chapter 4. Contributing

Pull Request Guidelines Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for Python 2.7 and for PyPy. Check https://travis-ci.org/burhan/e24paymentpipe/ pull_requests and make sure that the tests pass for all supported Python versions. 4.3. Pull Request Guidelines 13

14 Chapter 4. Contributing

CHAPTER 5 Credits Development Lead Burhan Khalid <burhan.khalid@gmail.com> Contributors None yet. Why not be the first? 15

16 Chapter 5. Credits

CHAPTER 6 History 1.2.0 (2015-12-29) Now compatible with Python 3.4! Added requests as a dependency 1.1.2 (2014-11-03) Fixed issue iterating over UDF dictionary keys Fixed issue where unicode was being passed to sanitize unicode strings are not allowed in UDF fields 1.1 (2014-08-12) Refactored class methods to utils.py PEP-8 cleanup Version bump 0.1.0 (2011-02-12) First release on Github. 0.1.1 (2011-02-14) Added custom exceptions 17

0.1.2 (2011-12-16) Optimized error checking Added character filters for UDF as per latest payment provider update 0.2.0 (2011-12-28) Version branch created with major changes in the codebase Cleaned up the API and interface 18 Chapter 6. History

CHAPTER 7 Module Reference If you haven t already done so, please read the quickstart for an overview of the payment process and a quick example on usage of this module. Main Methods / Public Interface class Gateway(resource, alias[, currency=414, lang= ENG ]) This is the main class that creates parses the terminal resource file and creates the gateway link in order to initiate the payment process. Parameters resource (str) The full path name the the resource file provided by the payment processor alias (str) The alias for the terminal. See your payment processor for more information currency (int) The ISO 4217 numeric code for the currency of the transaction. See ISO 4217 for more. lang (str) The language supported by the gateway. See your payment processor s documentation for the languages supported. Defaults to ENG for US English. static sanitize(s) string Returns the string stripped of characters not allowed in the transaction id or the UDF (user defined fields) The following characters are stripped: 19

Symbol Hex Name ~ x7e TILDE x60 LEFT SINGLE QUOTATION MARK, GRAVE ACCENT! x21 EXCLAMATION POINT (bang) # x23 NUMBER SIGN (pound sign) $ x24 DOLLAR SIGN % x25 PERCENT SIGN ^ x5e CIRCUMFLEX ACCENT x7c VERTICAL LINE (pipe) x5c REVERSE SLANT (REVERSE SOLIDUS, backslash, backslant) : x3a COLON x27 APOSTROPHE, RIGHT SIN- GLE QUOTATION MARK, ACUTE ACCENT (single quote) x22 QUOTATION MARK, DIAERE- SIS / x2f SLANT (SOLIDUS, slash) Parameters s (str) The string to be sanitized Returns Sanitized string, with characters not allowed removed Return type str get_payment_url() dict This function returns a two element dictionary with the paymentid and the paymenturl that is needed to redirect the user to the gateway. In order to call this method, the gateway needs to be correctly initialized and configured. Raises ValueError if the object is not configured correctly Returns A dictionary of payment id and payment url from the gateway Return type dict Properties Properties are used to set various gateway parameters, and to ensure that all parameters are correctly sanitized. All properties are accessed from instances of the gateway object. 20 Chapter 7. Module Reference

Property Name Description Required/Optional udf Set or get the user defined fields (UDF). Please note the following restrictions: 1. You can only send data for a maximum of 5 fields. Optional 2. If passing a dictionary, the keys must be named UDF[1..5] 3. When setting the field, if a tuple or list is passed, the keys are generated automatically. 4. All values are automatically processed by sanitize() error_url amount trackid response_url The fully qualified URL to the error handler for the gateway. See the quickstart for more information The amount for this transaction, this should be a floating point number. The default and the minimum is 1.0. Invalid values will raise a TypeError. The tracking id for this transaction. It must be a unique value. Like the udf fields, it is also sanitized. A default value based on the current timestamp is generated if not provided. The fully qualified URL for all affirmative responses from the gateway. See quickstart Required Required Optional Required 7.2. Properties 21

22 Chapter 7. Module Reference

CHAPTER 8 Indices and tables genindex modindex search 23

24 Chapter 8. Indices and tables

Index G Gateway (built-in class), 19 get_payment_url(), 20 S sanitize(), 19 25