<commit_before>=====
Usage
=====

.. toctree::
   :maxdepth: 2

Basics
======

The main entry point into the plugin is the :class:`adyen.scaffold.Scaffold`
class::

   >>> from adyen.scaffold import Scaffold
   >>> scaffold = Scaffold()

Of course, one can use Oscar's ``get_class`` function instead::

   >>> from oscar.core.loading import get_class
   >>> Scaffold = get_class('adyen.scaffold', 'Scaffold')
   >>> sclaffold = Scaffold()

``Scaffold`` should be the only class used in your application, and you can
consider it as the public interface of the plugin.

Payment form
============

The first step in the Adyen HPP workflow is to generate the form that will be
submitted from your e-commerce site to the Adyen HPP. This form must contain
several fields as described in the Adyen HPP Documentation.

You can get both from the scaffold::

   >>> sclaffold = Scaffold()
   >>> form_action_url = scaffold.get_form_action(request)
   >>> form_fields = scaffold.get_form_fields(request, payment_data)

This should be used in the last view of your checkout before the payment return
view - for example, in ``get_context_data`` to add the form URL and form
fields.

.. seealso::

   You can check the docstring of
   :meth:`adyen.scaffold.Scaffold.get_form_action` and
   :meth:`adyen.scaffold.Scaffold.get_form_fields` for more information.


Handle payment return
=====================

When customers authorise a payment through the Adyen HPP, they are redirected<commit_msg>Short list of payment data items<commit_after>=====
Usage
=====

.. toctree::
   :maxdepth: 2

Basics
======

The main entry point into the plugin is the :class:`adyen.scaffold.Scaffold`
class::

   >>> from adyen.scaffold import Scaffold
   >>> scaffold = Scaffold()

Of course, one can use Oscar's ``get_class`` function instead::

   >>> from oscar.core.loading import get_class
   >>> Scaffold = get_class('adyen.scaffold', 'Scaffold')
   >>> sclaffold = Scaffold()

``Scaffold`` should be the only class used in your application, and you can
consider it as the public interface of the plugin.

Payment form
============

The first step in the Adyen HPP workflow is to generate the form that will be
submitted from your e-commerce site to the Adyen HPP. This form must contain
several fields as described in the Adyen HPP Documentation.

You can get both from the scaffold::

   >>> sclaffold = Scaffold()
   >>> form_action_url = scaffold.get_form_action(request)
   >>> form_fields = scaffold.get_form_fields(request, payment_data)

This should be used in the last view of your checkout before the payment return
view - for example, in ``get_context_data`` to add the form URL and form
fields.

.. seealso::

   You can check the docstring of
   :meth:`adyen.scaffold.Scaffold.get_form_action` and
   :meth:`adyen.scaffold.Scaffold.get_form_fields` for more information.

List of payment data items
--------------------------

+--------------------+-----------------------+--------------------------------+----------+
| Key                | Adyen Form Field      | Description                    | Required |
+====================+=======================+================================+==========+
| ``order_number``   | ``merchantReference`` | Order Number                   | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``client_id``      | ``shopperReference``  | Customer's identifier          | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``client_email``   | ``shopperEmail``      | Customer's email               | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``currency_code``  | ``currencyCode``      | Currency code                  | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``amount``         | ``paymentAmount``     | Payment amount (in cent)       | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``shopper_locale`` | ``shopperLocale``     | Customer's locale              | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``country_code``   | ``countryCode``       | Merchant's Country             | Yes      |
+--------------------+-----------------------+--------------------------------+----------+
| ``source_type``    | ``allowedMethods``    | Selected ``SourceType`` object | No       |
+--------------------+-----------------------+--------------------------------+----------+
| ``return_url``     | ``resURL``            | Custom Payment Return URL      | No       |
+--------------------+-----------------------+--------------------------------+----------+


Handle payment return
=====================

When customers authorise a payment through the Adyen HPP, they are redirected
{'fraction_non_alphanumeric': 0.298989898989899, 'fraction_numerical': 0.00040404040404040404, 'mean_word_length': 1.758217270194986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1258586', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1181, 'n_words': 411}