Permalink
Browse files

improved readability of client.py docstring test. Project is now igno…

…ring *.pyc files and README has been updated with some useful details.
  • Loading branch information...
1 parent 068dbe4 commit 83173c53e1e3dbfc34935c419a4b4e93d594fc02 Ben Keating committed Oct 22, 2010
Showing with 68 additions and 43 deletions.
  1. +1 −0 .gitignore
  2. +32 −14 README.md
  3. +35 −29 payflowpro/tests/client.py
View
@@ -0,0 +1 @@
+*.pyc
View
@@ -1,28 +1,27 @@
-# Python Paypal PayflowPro Client
+# PayPal's PayflowPro Python Client
``python-payflowpro`` (or simply ``payflowpro`` within the Python environment)
provides an interface to the PayPal PayflowPro API (HTTPS Interface) making it
-easy for you to collect and manaage payments within your python-based applications.
+easy for you to collect and manage payments within your python-based
+applications.
This project is a fork of [James Murty](jamurty@gmail.com) &
[John D'Agostino](john.dagostino@gmail.com)'s python-payflowpro project hosted
on [Google Code](http://code.google.com/p/python-payflowpro/).
-
__Specifically, It allows you to:__
* Submit Sales Transactions
* Submit Authorization & Delayed Capture Transactions
-* Security Code (CVV, CVC2, CVV2) & Address Verification (Requires Verification
-module. Additional costs apply.)
+* Security Code (CVV, CVC2, CVV2) & Address Verification (Requires
+Verification module. Additional costs apply.)
* Create Recurring Billing Profiles (Requires Recurring Billing module.
Additional costs apply.)
* Modify & Reactivate Recurring Billing Profiles
* Display payment history of a Recurring Billing Profile
* Cancel A Recurring Billing Profile (aka 'Freezing')
* Inquiry Transactions (One-time & Recurring Billing Profile)
-
__Payment Methods Supported (TENDER\_TYPES)__
* Automated clearinghouse
@@ -31,7 +30,6 @@ __Payment Methods Supported (TENDER\_TYPES)__
* Telecheck
* PayPal
-
__Transactions Types Supported (TRANSACTION\_TYPES)__
* Sale transaction
@@ -45,18 +43,38 @@ __Transactions Types Supported (TRANSACTION\_TYPES)__
* Recurring *(Optional. Requires Recurring Billing module.
Additional costs apply.)*
-
## Requirements
* Python 2.5+
+* [PayPal "Payflow" Services Account](https://registration.paypal.com/) on PayPal.com
+ * Optional: Recurring Billing module
+ * Optional: Fraud Protection module
The recurring billing functionality of this library requires the PayflowPro
-account to have the Recurring Billing module activated (additional costs apply).
-Likewise with the Security Code & Address Verification module. Unless you have
-the appropriate modules enabled within your Paypal Payflow Pro Account (This is
-set via the [Paypal Manager](https://manager.paypal.com)), passing Street
-Addresses and Security Codes will not be ran through verification.
-
+account to have the Recurring Billing module activated (additional costs
+apply). Likewise with the Security Code & Address Verification module. Unless
+you have the appropriate modules enabled within your Paypal Payflow Pro
+Account (This is set via the [Paypal Manager](https://manager.paypal.com)),
+passing Street Addresses and Security Codes will not be ran through
+verification.
+
+## Installation
+
+You can install python-payflowpro one of two ways:
+
+* run ``python setup.py install`` within the ``python-payflowpro`` directory
+* ``ln -s /path/to/python-payflowpro/payflowpro /path/to/site-packages/``
+
+Both approaches give you the same thing. You can test your installation by
+starting a interactive prompt:
+
+ $ python
+ Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
+ [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import payflowpro
+ >>> payflowpro.VERSION
+ (0, 3, 'pre')
## Usage
View
@@ -1,58 +1,64 @@
r"""
->>> from payflowpro.classes import (CreditCard, Amount, Profile, Address,
- Tracking, Response, CustomerInfo)
->>> from payflowpro.client import PayflowProClient, find_classes_in_list,
- find_class_in_list
+>>> from payflowpro.classes import CreditCard, Amount, Profile, Address, \
+... Tracking, Response, CustomerInfo
+>>> from payflowpro.client import PayflowProClient, find_classes_in_list, \
+... find_class_in_list
>>> PARTNER_ID = "paypal"
>>> VENDOR_ID = "foobar"
>>> USERNAME = "foobar"
>>> PASSWORD = "password123"
>>> client = PayflowProClient(partner=PARTNER_ID, vendor=VENDOR_ID,
- username=USERNAME, password=PASSWORD)
+... username=USERNAME, password=PASSWORD)
->>> credit_card = CreditCard(acct=5555555555554444, expdate="1212")
+>>> credit_card = CreditCard(acct=4111111111111111, expdate="0114")
->>> responses, unconsumed_data = client.sale(credit_card,
-... Amount(amt=15, currency="AUD"),
-... extras=[Address(street="24285 Elm",
-... zip="00382")])
+>>> responses, unconsumed_data = client.sale(
+... credit_card,
+... Amount(amt=15, currency="USD"),
+... extras=[Address(street="2842 Magnolia St.", zip="94608")])
->>> responses, unconsumed_data = client.authorization(credit_card,
-... Amount(amt=13, currency="AUD"))
+>>> responses, unconsumed_data = client.authorization(
+... credit_card, Amount(amt=13, currency="USD"))
>>> transaction_id = responses[0].pnref
>>> responses, unconsumed_data = client.capture(transaction_id)
->>> client_inquiry = client.inquiry(original_pnref=transaction_id,
-... extras=[Tracking(verbosity='M')])[0]
+>>> client_inquiry = client.inquiry(
+... original_pnref=transaction_id, extras=[Tracking(verbosity='M')])[0]
->>> profile = Profile(profilename='test_profile_002', start='07282008',
-... term=0, payperiod='WEEK', desc="I'm just testing..."),
+>>> profile = Profile(profilename='test_profile_002', start='07282008',
+... term=0, payperiod='WEEK', desc="I'm just testing...")
->>> responses, unconsumed_data = client.profile_add(profile=profile,
-... credit_card=credit_card,
-... amount=Amount(amt=30.00))
+>>> responses, unconsumed_data = client.profile_add(
+... profile=profile, credit_card=credit_card, amount=Amount(amt=30.00))
->>> responses, unconsumed_data = client.profile_modify(profile_id='RT0000000002',
-... extras=[Profile(optionaltrx='S',
-... optionaltrxamt=12.00),
-... Address(street="123 Somewhere St", city='Sydney', state='NSW', zip="2060"),
-... CustomerInfo(custcode='8675', email='test@example.com', firstname='Joe', lastname='Bloggs'),
-... Tracking(comment1="Order #43",)])
+>>> responses, unconsumed_data = client.profile_modify(
+... profile_id='RT0000000002', extras=[
+... Profile(optionaltrx='S', optionaltrxamt=12.00),
+... Address(street="123 Somewhere St", city='Sydney', state='NSW',
+... zip="2060"),
+... CustomerInfo(custcode='8675', email='test@example.com',
+... firstname='Joe', lastname='Bloggs'),
+... Tracking(comment1="Order #43",)])
+
+>>> results, unconsumed_data = client.profile_inquiry(
+... profile_id='RT0000000001', payment_history_only=True)
->>> results, unconsumed_data = client.profile_inquiry(profile_id='RT0000000001', payment_history_only=True)
>>> recurring_payments = results[-1]
->>> responses, unconsumed_data = client.profile_inquiry(profile_id='RT0000000001')
+>>> responses, unconsumed_data = client.profile_inquiry(
+... profile_id='RT0000000001')
>>> address = find_class_in_list(Address, responses)
->>> results, unconsumed_data = client.profile_cancel(profile_id='RT0000000001')
+>>> results, unconsumed_data = client.profile_cancel(
+... profile_id='RT0000000001')
->>> results, unconsumed_data = client.profile_reactivate(profile_id='RT0000000001', extras=[Profile(start="07282008")])
+>>> results, unconsumed_data = client.profile_reactivate(
+... profile_id='RT0000000001', extras=[Profile(start="07282008")])
"""
if __name__=="__main__":

0 comments on commit 83173c5

Please sign in to comment.