bda.plone.checkout


Namebda.plone.checkout JSON
Version 2.0b1 PyPI version JSON
download
home_pageNone
SummaryCheckout
upload_time2024-04-17 13:48:42
maintainerNone
docs_urlNone
authorBlueDynamics Alliance
requires_pythonNone
licenseGNU General Public Licence
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================
bda.plone.checkout
==================

Checkout process and forms for ``bda.plone.shop``.


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

This package is part of the ``bda.plone.shop`` stack. Please refer to
`bda.plone.shop <https://github.com/bluedynamics/bda.plone.shop>`_ for
installation instructions.


Customizing the checkout form
=============================

To customize the checkout form you'll typically start off with your own
form having a custom ``provider_registry``.

You'll use the ``FieldsProvider`` objects that you're happy with and replace
those that need an adaption.

In this example, we'll add an additional field ``uid`` to the ``PersonalData``
provider an re-use the others:

.. code-block:: python

    from zope.i18nmessageid import MessageFactory
    from bda.plone.checkout.browser import form as coform


    _ = MessageFactory('my.package')
    my_provider_registry = coform.ProviderRegistry()


    class MyPersonalData(coform.PersonalData):
        fields_template = 'my.package.shop:forms/personal_data.yaml'
        message_factory = _


    my_provider_registry.add(coform.CartSummary)
    my_provider_registry.add(MyPersonalData)
    my_provider_registry.add(coform.BillingAddress)
    my_provider_registry.add(coform.DeliveryAddress)
    my_provider_registry.add(coform.ShippingSelection)
    my_provider_registry.add(coform.PaymentSelection)
    my_provider_registry.add(coform.OrderComment)
    my_provider_registry.add(coform.AcceptTermsAndConditions)


    class MyCheckoutForm(coform.CheckoutForm):
        """Customized checkout form to add UID field for company.
        """
        provider_registry = my_provider_registry

Copy ``bda/plone/checkout/browser/forms/personal_data.yaml`` to
``my/package/shop/forms/personal_data.yaml`` and make your changes.

This package uses `Yet Another FOrm WIdget Library`_ (`YAFOWIL`)
for rendering the checkout form.

.. _`Yet Another FOrm WIdget Library`: http://docs.yafowil.info/

We'll append a new field `uid` at the end of the ``personal data``
section:

.. code-block:: yaml

    - company:
        factory: "#field:text"
        value: context.get_value
        props:
            label: i18n:label_company:Company
            display_proxy: True
        mode: expr:context.mode
    - uid:
        factory: "#field:text"
        value: context.get_value
        props:
            label: i18n:label_companyuid:UID Number
            display_proxy: True
        mode: expr:context.mode 

(NOTE: it's not possible to mix i18n domains within a yaml file so
you're better off to add you translations to a separtate
``bda.plone.checkout.po`` file in your package's locales)

Now register your customized form by overriding the browser page
for your browserlayer or skinlayer:

.. code-block:: xml

    <browser:page
      for="*"
      name="checkoutform"
      class=".checkout.MyCheckoutForm"
      permission="zope2.View"
      layer=".browser.interfaces.IThemeSpecific" />

.. NOTE:: Your new field will automatically be included in the order data.

    However, by default, it will not show up in order emails, the order export
    (``@@exportorders``) or the order summary (``@@orders``).
    See `bda.plone.orders`_ for instructions how to add them there.

    .. _`bda.plone.orders`: https://github.com/bluedynamics/bda.plone.orders


Permissions
===========

bda.plone.checkout.PerformCheckout
----------------------------------

This permission controls whether a user can actually perform the checkout
process. Checkout related views are bound to this permission, thus, a visitor
without this permission granted gets redirected to the login / registration
form.

By default, this permission is set for roles:

* Manager
* Site Administrator
* Customer

In order to enable non-customers or anonymous users to perform the checkout,
edit ``rolemap.xml`` in your integration package as needed.


Create translations
===================

::

    $ cd src/bda/plone/checkout/
    $ ./i18n.sh


Contributors
============

- Robert Niederreiter (Author)
- Peter Holzer
- Harald Friessnegger

Changelog
=========

2.0b1 (2024-04-17)
------------------

- rewrite CSS resources to SCSS
  [petschki]

- Introduce ``checkout_button_factories`` and ``confirmation_button_factories``.
  [rnix, jensens]

- Consider ``IPayment.clear_session`` in checkout form.
  [rnix]

- At end of checkout post form to activate plone.protect CSRF authenticator.
  [jensens]

- No longer support for z3c.autoinclude.
  [jensens]

- More CSS classes on cart.
  [jensens]

- Reflect latest changes in cart/shipping.
  [jensens]

- Code style black. isort.
  [jensens]

- Update version and classifiers - 2.x targets Plone 5.1/5.2 without Archetypes
  [agitator]


1.0a1 (unreleased)
------------------

- Use sort order of ENABLED_COUNTRIES
  [agitator]

- Replace unittest2 with untittest
  [llisa123]

- Display cart item discount in cart overview.
  [rnix]

- Introduce ``bda.plone.checkout: Perform Checkout`` permission and bind
  checkout related views to it.
  [rnix]

- added ``data-context-url`` for sane ``cartData`` and ``validate_cart_item``
  calls on Plone 5.
  [agitator]

- Plone 5 update.
  [rnix, agitator]


0.5
---

- JSHint JavaScript.
  [thet]


0.4
---

- Always deliver shipping markup for cart overview. Displaying gets controlled
  by cart JS.
  [rnix]

- Implement ``skip`` property on ``ShippingSelection`` fields provider and
  skip shipping selection if not item in cart is shippable.
  [rnix]

- Use ``bda.plone.checkout.interfaces.ICheckoutSettings`` adapter instead
  of self in ``bda.plone.checkout.browser.form.CheckoutForm`` to handle
  ``skip_payment`` and ``skip_payment_redirect_url``.
  [rnix]

- Remove ``skip_payment`` and ``skip_payment_redirect_url`` attributes
  from ``bda.plone.checkout.interfaces.ICheckoutAdapter`` interface. They exist
  now as functions accepting data uid on
  ``bda.plone.checkout.interfaces.ICheckoutSettings``.
  [rnix]

- Introduce ``bda.plone.checkout.interfaces.ICheckoutSettings`` interface.
  [rnix]

- Implement ``skip`` property on ``PaymentSelection`` fields provider and
  skip payment selection if total cart price is 0.
  [rnix]

- Add ``bda.plone.checkout.interfaces.IFieldsProvider.skip`` attribute.
  [rnix]

- Adopt shipping handling to ``bda.plone.shipping`` >= 0.4.
  [rnix]

- Consider shipping method from cookie in checkout form.
  [rnix]

- Do not rely on acquisition and base link for `terms and conditions`
  on the navigation root. (path/to/navroot/<ID>)

  `ID` is configurable by patching
  ``bda.plone.checkout.browser.form.TERMS_AND_CONDITONS_ID``
  [fRiSi]


0.3
---

- Register pycountry translations and use them.
  [rnix]

- Adopt checkout summary to consider currency and discount.
  [rnix]

- Heading for ``accept_terms`` in checkout form. This better seperates this
  button visually from the rest.
  [thet]

- Prefill the checkout form with defaults from ``ICheckoutFormPresets`` adapter.
  [thet]

- Fix BrowserLayer order precedence.
  [thet]

- introduce ``bda.plone.checkout.ICheckoutFormPresets``.
  [rnix]


0.2
---

- introduce ``skip_payment`` and ``skip_payment_redirect_url`` on
  ``bda.plone.checkout.ICheckoutAdapter`` and consider in
  ``bda.plone.checkout.browser.form.CheckoutForm``.
  [rnix]


0.1
---

- initial work
  [rnix]

License
=======

Copyright (c) 2012-2019, BlueDynamics Alliance, Austria
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 the BlueDynamics Alliance 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 BlueDynamics Alliance ``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 BlueDynamics Alliance 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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bda.plone.checkout",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "BlueDynamics Alliance",
    "author_email": "dev@bluedynamics.com",
    "download_url": "https://files.pythonhosted.org/packages/38/0e/5a9b43d7aa420044334f1973acdaa1ddeff40424779ec12bb8a61ac9ddae/bda.plone.checkout-2.0b1.tar.gz",
    "platform": null,
    "description": "==================\nbda.plone.checkout\n==================\n\nCheckout process and forms for ``bda.plone.shop``.\n\n\nInstallation\n============\n\nThis package is part of the ``bda.plone.shop`` stack. Please refer to\n`bda.plone.shop <https://github.com/bluedynamics/bda.plone.shop>`_ for\ninstallation instructions.\n\n\nCustomizing the checkout form\n=============================\n\nTo customize the checkout form you'll typically start off with your own\nform having a custom ``provider_registry``.\n\nYou'll use the ``FieldsProvider`` objects that you're happy with and replace\nthose that need an adaption.\n\nIn this example, we'll add an additional field ``uid`` to the ``PersonalData``\nprovider an re-use the others:\n\n.. code-block:: python\n\n    from zope.i18nmessageid import MessageFactory\n    from bda.plone.checkout.browser import form as coform\n\n\n    _ = MessageFactory('my.package')\n    my_provider_registry = coform.ProviderRegistry()\n\n\n    class MyPersonalData(coform.PersonalData):\n        fields_template = 'my.package.shop:forms/personal_data.yaml'\n        message_factory = _\n\n\n    my_provider_registry.add(coform.CartSummary)\n    my_provider_registry.add(MyPersonalData)\n    my_provider_registry.add(coform.BillingAddress)\n    my_provider_registry.add(coform.DeliveryAddress)\n    my_provider_registry.add(coform.ShippingSelection)\n    my_provider_registry.add(coform.PaymentSelection)\n    my_provider_registry.add(coform.OrderComment)\n    my_provider_registry.add(coform.AcceptTermsAndConditions)\n\n\n    class MyCheckoutForm(coform.CheckoutForm):\n        \"\"\"Customized checkout form to add UID field for company.\n        \"\"\"\n        provider_registry = my_provider_registry\n\nCopy ``bda/plone/checkout/browser/forms/personal_data.yaml`` to\n``my/package/shop/forms/personal_data.yaml`` and make your changes.\n\nThis package uses `Yet Another FOrm WIdget Library`_ (`YAFOWIL`)\nfor rendering the checkout form.\n\n.. _`Yet Another FOrm WIdget Library`: http://docs.yafowil.info/\n\nWe'll append a new field `uid` at the end of the ``personal data``\nsection:\n\n.. code-block:: yaml\n\n    - company:\n        factory: \"#field:text\"\n        value: context.get_value\n        props:\n            label: i18n:label_company:Company\n            display_proxy: True\n        mode: expr:context.mode\n    - uid:\n        factory: \"#field:text\"\n        value: context.get_value\n        props:\n            label: i18n:label_companyuid:UID Number\n            display_proxy: True\n        mode: expr:context.mode \n\n(NOTE: it's not possible to mix i18n domains within a yaml file so\nyou're better off to add you translations to a separtate\n``bda.plone.checkout.po`` file in your package's locales)\n\nNow register your customized form by overriding the browser page\nfor your browserlayer or skinlayer:\n\n.. code-block:: xml\n\n    <browser:page\n      for=\"*\"\n      name=\"checkoutform\"\n      class=\".checkout.MyCheckoutForm\"\n      permission=\"zope2.View\"\n      layer=\".browser.interfaces.IThemeSpecific\" />\n\n.. NOTE:: Your new field will automatically be included in the order data.\n\n    However, by default, it will not show up in order emails, the order export\n    (``@@exportorders``) or the order summary (``@@orders``).\n    See `bda.plone.orders`_ for instructions how to add them there.\n\n    .. _`bda.plone.orders`: https://github.com/bluedynamics/bda.plone.orders\n\n\nPermissions\n===========\n\nbda.plone.checkout.PerformCheckout\n----------------------------------\n\nThis permission controls whether a user can actually perform the checkout\nprocess. Checkout related views are bound to this permission, thus, a visitor\nwithout this permission granted gets redirected to the login / registration\nform.\n\nBy default, this permission is set for roles:\n\n* Manager\n* Site Administrator\n* Customer\n\nIn order to enable non-customers or anonymous users to perform the checkout,\nedit ``rolemap.xml`` in your integration package as needed.\n\n\nCreate translations\n===================\n\n::\n\n    $ cd src/bda/plone/checkout/\n    $ ./i18n.sh\n\n\nContributors\n============\n\n- Robert Niederreiter (Author)\n- Peter Holzer\n- Harald Friessnegger\n\nChangelog\n=========\n\n2.0b1 (2024-04-17)\n------------------\n\n- rewrite CSS resources to SCSS\n  [petschki]\n\n- Introduce ``checkout_button_factories`` and ``confirmation_button_factories``.\n  [rnix, jensens]\n\n- Consider ``IPayment.clear_session`` in checkout form.\n  [rnix]\n\n- At end of checkout post form to activate plone.protect CSRF authenticator.\n  [jensens]\n\n- No longer support for z3c.autoinclude.\n  [jensens]\n\n- More CSS classes on cart.\n  [jensens]\n\n- Reflect latest changes in cart/shipping.\n  [jensens]\n\n- Code style black. isort.\n  [jensens]\n\n- Update version and classifiers - 2.x targets Plone 5.1/5.2 without Archetypes\n  [agitator]\n\n\n1.0a1 (unreleased)\n------------------\n\n- Use sort order of ENABLED_COUNTRIES\n  [agitator]\n\n- Replace unittest2 with untittest\n  [llisa123]\n\n- Display cart item discount in cart overview.\n  [rnix]\n\n- Introduce ``bda.plone.checkout: Perform Checkout`` permission and bind\n  checkout related views to it.\n  [rnix]\n\n- added ``data-context-url`` for sane ``cartData`` and ``validate_cart_item``\n  calls on Plone 5.\n  [agitator]\n\n- Plone 5 update.\n  [rnix, agitator]\n\n\n0.5\n---\n\n- JSHint JavaScript.\n  [thet]\n\n\n0.4\n---\n\n- Always deliver shipping markup for cart overview. Displaying gets controlled\n  by cart JS.\n  [rnix]\n\n- Implement ``skip`` property on ``ShippingSelection`` fields provider and\n  skip shipping selection if not item in cart is shippable.\n  [rnix]\n\n- Use ``bda.plone.checkout.interfaces.ICheckoutSettings`` adapter instead\n  of self in ``bda.plone.checkout.browser.form.CheckoutForm`` to handle\n  ``skip_payment`` and ``skip_payment_redirect_url``.\n  [rnix]\n\n- Remove ``skip_payment`` and ``skip_payment_redirect_url`` attributes\n  from ``bda.plone.checkout.interfaces.ICheckoutAdapter`` interface. They exist\n  now as functions accepting data uid on\n  ``bda.plone.checkout.interfaces.ICheckoutSettings``.\n  [rnix]\n\n- Introduce ``bda.plone.checkout.interfaces.ICheckoutSettings`` interface.\n  [rnix]\n\n- Implement ``skip`` property on ``PaymentSelection`` fields provider and\n  skip payment selection if total cart price is 0.\n  [rnix]\n\n- Add ``bda.plone.checkout.interfaces.IFieldsProvider.skip`` attribute.\n  [rnix]\n\n- Adopt shipping handling to ``bda.plone.shipping`` >= 0.4.\n  [rnix]\n\n- Consider shipping method from cookie in checkout form.\n  [rnix]\n\n- Do not rely on acquisition and base link for `terms and conditions`\n  on the navigation root. (path/to/navroot/<ID>)\n\n  `ID` is configurable by patching\n  ``bda.plone.checkout.browser.form.TERMS_AND_CONDITONS_ID``\n  [fRiSi]\n\n\n0.3\n---\n\n- Register pycountry translations and use them.\n  [rnix]\n\n- Adopt checkout summary to consider currency and discount.\n  [rnix]\n\n- Heading for ``accept_terms`` in checkout form. This better seperates this\n  button visually from the rest.\n  [thet]\n\n- Prefill the checkout form with defaults from ``ICheckoutFormPresets`` adapter.\n  [thet]\n\n- Fix BrowserLayer order precedence.\n  [thet]\n\n- introduce ``bda.plone.checkout.ICheckoutFormPresets``.\n  [rnix]\n\n\n0.2\n---\n\n- introduce ``skip_payment`` and ``skip_payment_redirect_url`` on\n  ``bda.plone.checkout.ICheckoutAdapter`` and consider in\n  ``bda.plone.checkout.browser.form.CheckoutForm``.\n  [rnix]\n\n\n0.1\n---\n\n- initial work\n  [rnix]\n\nLicense\n=======\n\nCopyright (c) 2012-2019, BlueDynamics Alliance, Austria\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this \n  list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this \n  list of conditions and the following disclaimer in the documentation and/or \n  other materials provided with the distribution.\n* Neither the name of the BlueDynamics Alliance nor the names of its \n  contributors may be used to endorse or promote products derived from this \n  software without specific prior written permission.\n      \nTHIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``AS IS`` AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
    "bugtrack_url": null,
    "license": "GNU General Public Licence",
    "summary": "Checkout",
    "version": "2.0b1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a39a58ba12584361d65fa5cb4495ae2435b9f4353c8396c868de6a22b9c082dc",
                "md5": "533845881c9ac51cdad82576882eb2c0",
                "sha256": "3d5b9dd22d282f1fc4749e02b9a990904fdfb8b717316dea7304b0f0ec55fc1e"
            },
            "downloads": -1,
            "filename": "bda.plone.checkout-2.0b1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "533845881c9ac51cdad82576882eb2c0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 48920,
            "upload_time": "2024-04-17T13:48:40",
            "upload_time_iso_8601": "2024-04-17T13:48:40.234157Z",
            "url": "https://files.pythonhosted.org/packages/a3/9a/58ba12584361d65fa5cb4495ae2435b9f4353c8396c868de6a22b9c082dc/bda.plone.checkout-2.0b1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "380e5a9b43d7aa420044334f1973acdaa1ddeff40424779ec12bb8a61ac9ddae",
                "md5": "10cc8abbac66be9b90f7572b3d364bd2",
                "sha256": "4421c2c6f29661a9faa3dc11663ec4f5c1b73093726991003fbe4bf92306ce42"
            },
            "downloads": -1,
            "filename": "bda.plone.checkout-2.0b1.tar.gz",
            "has_sig": false,
            "md5_digest": "10cc8abbac66be9b90f7572b3d364bd2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 35715,
            "upload_time": "2024-04-17T13:48:42",
            "upload_time_iso_8601": "2024-04-17T13:48:42.664835Z",
            "url": "https://files.pythonhosted.org/packages/38/0e/5a9b43d7aa420044334f1973acdaa1ddeff40424779ec12bb8a61ac9ddae/bda.plone.checkout-2.0b1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 13:48:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "bda.plone.checkout"
}
        
Elapsed time: 2.06595s