niteoweb.ipn.core 1.5.3
Support for Instant Payment Notifications in Plone.
License: BSD
Keywords: Plone IPN

=================
niteoweb.ipn.core
=================

A Plone add-on package that acts as a base for supporting different Instant
Payment Notification providers (such as PayPal, JVZoo, Click2Sell, etc.)

* `Source code @ GitHub <https://github.com/niteoweb/niteoweb.ipn.core>`_
* `Releases @ PyPI <http://pypi.python.org/pypi/niteoweb.ipn.core>`_
* `Continuous Integration @ Travis-CI <http://travis-ci.org/niteoweb/niteoweb.ipn.core>`_

Subpackages
===========

You probably do not want to use this package on its own, but rather use one
of its sub-packages:

 * `niteoweb.ipn.jvzoo <http://pypi.python.org/pypi/niteoweb.ipn.jvzoo>`_
 * `niteoweb.ipn.c2s (WIP) <http://pypi.python.org/pypi/niteoweb.ipn.c2s>`_

How it works
============

This package acts as a base layer for ``niteoweb.ipn.*`` packages. It provides
the code that these sub-packages would have to otherwise duplicate:

 * Creating a new member.
 * Updating an existing member.
 * Disabling an existing member.
 * Firing off events that your project code can catch and perform custom tasks
   on.

The following information is stored as member properties for later use:

    ``product_id``
        IPN provider's `Product ID` of the purchased item.

    ``affiliate``
        Affiliate who referred the buyer.

    ``valid_to``
        Date until the member's subscription is valid.

    ``history``
        History of actions taken on the member. Useful for analyses later on.


Assumptions
===========

* Emails are used as usernames.
* "Disabling" a member means to revoke her Member role and put her in the
  `Disabled` group, while removing her from all other groups.
* "Enabling" a member means to create a new member (if she doesn't exist yet),
  grant her the Member role (if she doesn't have it yet) and add her to the
  Product Group.
* "Product Group" is a group that contains members that have purchased the same
  product. Product group IDs are equal to Product IDs -- this is how they are
  linked together.
* When niteoweb.ipn.core creates a new member object, the registration email is
  **not** sent. Your third-party code should take care of this (for example by
  subscribing to the IPrincipalCreatedEvent emitted by PAS).
* Whenever a member is enabled, a 'valid_to' property is set on the member
  object to represent until which day should this member be allowed to use the
  site. You then need to setup a cronjob that calls ``@@validity`` view every
  day to disable those members whose validity period has elapsed. In the
  plone.app.registry control panel you can set a secret that needs to be passed
  as a request parameter to the ``@@validity`` view.

Installation
============

You probably do not want to install `niteoweb.ipn.core` directly, but rather
use one of ``niteoweb.ipn.*`` sub-packages.

Changelog
=========

1.5.4 (unreleased)
------------------

- Nothing changed yet.


1.5.3 (2014-03-07)
------------------

- Add optional ``note`` parameter to enable_member method.
  [matejc]


1.5.2 (2014-01-26)
------------------

- Another fix to include CHANGELOG.rst in the release.
  [zupo]


1.5.1 (2014-01-26)
------------------

- Include .rst files in release.
  [zupo]


1.5 (2014-01-26)
----------------

- Also set ``product_id`` on already existing members.
  [zupo]


1.4 (2013-10-07)
----------------

- @@validity view raises ConflictError on busy site, solved by
  committing transaction after every disabled user.
  [Matej Cotman]


1.3 (2013-01-08)
----------------

- Prefix log entries with current user's username.
  [zupo]


1.2 (2013-01-05)
----------------

- The ``product_id`` parameter is not always needed for in ``disable_member``
  so don't make it required.
  [zupo]

- The @@validity view now supports *dry-run* mode.
  [zupo]

- The @@validity view now prints processing results to the browser.
  [zupo]

- Better ``valid_to`` default value.
  [zupo]


1.1 (2013-01-02)
----------------

- Use ``ipn_`` as a prefix for product group IDs.
  [zupo]


1.0 (2012-12-27)
----------------

- Initial release.
  [zupo]

License (3-clause BSD)
======================

Copyright (c) 2013, NiteoWeb Ltd.. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

 * Neither the name of NiteoWeb Ltd.. nor the names of its contributors may
   be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL NITEOWEB LTD. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.