diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/_extensions/autojsdoc/parser/types.py | 2 | ||||
| -rw-r--r-- | doc/_extensions/odoo_ext/translator.py | 2 | ||||
| -rw-r--r-- | doc/cla/corporate/brahoo.md | 15 | ||||
| -rw-r--r-- | doc/cla/individual/anilkesariya.md | 12 | ||||
| -rw-r--r-- | doc/cla/individual/ark74.md | 11 | ||||
| -rw-r--r-- | doc/cla/individual/mhamra.md | 11 | ||||
| -rw-r--r-- | doc/reference/orm.rst | 6 | ||||
| -rw-r--r-- | doc/webservices/iap.rst | 88 | ||||
| -rw-r--r-- | doc/webservices/images/creating_service.png | bin | 0 -> 78911 bytes | |||
| -rw-r--r-- | doc/webservices/images/menu.png | bin | 0 -> 30694 bytes | |||
| -rw-r--r-- | doc/webservices/images/package.png | bin | 6157 -> 49251 bytes | |||
| -rw-r--r-- | doc/webservices/images/service_create.png | bin | 6003 -> 0 bytes | |||
| -rw-r--r-- | doc/webservices/images/service_created.png | bin | 0 -> 69933 bytes | |||
| -rw-r--r-- | doc/webservices/images/service_list.png | bin | 0 -> 27027 bytes | |||
| -rw-r--r-- | doc/webservices/images/service_packs.png | bin | 9722 -> 0 bytes | |||
| -rw-r--r-- | doc/webservices/images/service_select.png | bin | 6456 -> 0 bytes |
16 files changed, 121 insertions, 26 deletions
diff --git a/doc/_extensions/autojsdoc/parser/types.py b/doc/_extensions/autojsdoc/parser/types.py index 8737b26ecc9..69836f46ac4 100644 --- a/doc/_extensions/autojsdoc/parser/types.py +++ b/doc/_extensions/autojsdoc/parser/types.py @@ -44,6 +44,8 @@ def tokenize(typespec): yield (LITERAL, ast.literal_eval(string)) elif toktype == token.ENDMARKER: return + elif toktype == token.NEWLINE: + pass else: raise ValueError("Unknown typespec token %s" % token.tok_name[toktype]) diff --git a/doc/_extensions/odoo_ext/translator.py b/doc/_extensions/odoo_ext/translator.py index cf6c149d063..491f02a2ad3 100644 --- a/doc/_extensions/odoo_ext/translator.py +++ b/doc/_extensions/odoo_ext/translator.py @@ -220,7 +220,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object): else: opts = {} - def warner(msg): + def warner(msg, **kw): self.builder.warn(msg, (self.builder.current_docname, node.line)) highlighted = self.builder.highlighter.highlight_block( node.rawsource, lang, opts=opts, warn=warner, linenos=linenos, diff --git a/doc/cla/corporate/brahoo.md b/doc/cla/corporate/brahoo.md new file mode 100644 index 00000000000..04e4d39cb31 --- /dev/null +++ b/doc/cla/corporate/brahoo.md @@ -0,0 +1,15 @@ +The Netherlands, 2018-10-24 + +Brahoo B.V. agrees to the terms of the Odoo Corporate Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Cas Vissers c.vissers@brahoo.nl https://github.com/CasVissers + +List of contributors: + +Cas Vissers c.vissers@brahoo.nl https://github.com/CasVissers
\ No newline at end of file diff --git a/doc/cla/individual/anilkesariya.md b/doc/cla/individual/anilkesariya.md new file mode 100644 index 00000000000..2b4158360eb --- /dev/null +++ b/doc/cla/individual/anilkesariya.md @@ -0,0 +1,12 @@ +India, 17, Sept - 2018 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Anil Kesariya anil.r.kesariya@gmail.com https://github.com/AnilKesariya + diff --git a/doc/cla/individual/ark74.md b/doc/cla/individual/ark74.md new file mode 100644 index 00000000000..e729859d95f --- /dev/null +++ b/doc/cla/individual/ark74.md @@ -0,0 +1,11 @@ +Mexico, 2018-10-24 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Luis Guzman ark@switnet.org https://github.com/ark74 diff --git a/doc/cla/individual/mhamra.md b/doc/cla/individual/mhamra.md new file mode 100644 index 00000000000..260fee70284 --- /dev/null +++ b/doc/cla/individual/mhamra.md @@ -0,0 +1,11 @@ +Argentina, 2018-10-18 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Marcelo Ariel Hamra marcelo.hamra@gmail.com https://github.com/mhamra diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst index 73b96552c21..d2c8f812f74 100644 --- a/doc/reference/orm.rst +++ b/doc/reference/orm.rst @@ -1010,17 +1010,17 @@ them (e.g. to change their default sort order): .. literalinclude:: ../../odoo/addons/test_documentation_examples/extension.py :language: python - :lines: 5- + :lines: 7- .. literalinclude:: ../../odoo/addons/test_documentation_examples/tests/test_extension.py :language: python - :lines: 8,13 + :lines: 10,15 will yield: .. literalinclude:: ../../odoo/addons/test_documentation_examples/tests/test_extension.py :language: text - :lines: 11 + :lines: 13 .. note:: it will also yield the various :ref:`automatic fields <reference/orm/model/automatic>` unless they've been disabled diff --git a/doc/webservices/iap.rst b/doc/webservices/iap.rst index 23467c267c3..003fe2cf07f 100644 --- a/doc/webservices/iap.rst +++ b/doc/webservices/iap.rst @@ -81,8 +81,11 @@ Overview The Credits +.. note:: The credits went from integer to float value starting **October 2018** + Integer values are still supported. + Every service provided through the In-App platform can be used by the - clients with tokens or *credits*. The credits are an integer unit and + clients with tokens or *credits*. The credits are an float unit and their monetary value depends on the service and is decided by the provider. This could be: @@ -157,7 +160,8 @@ The first step is to register your service on the IAP endpoint (production and/or test) before you can actually query user accounts. To create a service, go to your *Portal Account* on the IAP endpoint (https://iap.odoo.com for production, https://iap-sandbox.odoo.com for testing, the endpoints are -*independent* and *not synchronized*). +*independent* and *not synchronized*). Alternatively, you can go to your portal +on Odoo (https://iap.odoo.com/my/home) and select *In-App Services*. .. note:: @@ -166,33 +170,45 @@ production, https://iap-sandbox.odoo.com for testing, the endpoints are on sandbox to ease the tests. Log in then go to :menuselection:`My Account --> Your In-App Services`, click -Create and provide the name of your service. +Create and provide the informations of your service. -The now created service has *two* important fields: +The service has *four* important fields: * :samp:`name` - :class:`ServiceName`: this will identify your service in the - client's :ref:`app <iap-odoo-app>` communicates directly with IAP. -* :samp:`key` - :class:`ServiceKey`: the developer key that identifies you in - IAP (see :ref:`your service <iap-service>`) and allows to draw credits from - the client's account. - + client's :ref:`app <iap-odoo-app>` communicates directly with IAP, choose it + carefully! .. warning:: The :class:`ServiceName` is unique and should usually match the name of your - Odoo App. + Odoo Client App. + +* :samp:`Icon` - :class:`Icon`: A generic icon that will serve as default for your + :ref:`packages <iap-packages>` +* :samp:`key` - :class:`ServiceKey`: the developer key that identifies you in + IAP (see :ref:`your service <iap-service>`) and allows to draw credits from + the client's account. It will be shown only once upon creation of the service + and can be regenerated at will. .. danger:: Your :class:`ServiceKey` *is a secret*, leaking your service key allows other application developers to draw credits bought for your service(s). -.. image:: images/service_select.png +* :samp:`privacy policy` - :class:`PrivacyPolicy`: This is an url to the privacy + policy of your service. This should explicitly mention the **information you collect**, + How you **use it, its relevance** to make your service work and inform the + client on how they can **access, update or delete their personal information**. + +.. image:: images/menu.png + :align: center + +.. image:: images/service_list.png :align: center -.. image:: images/service_create.png +.. image:: images/creating_service.png :align: center -.. image:: images/service_packs.png +.. image:: images/service_created.png :align: center You can then create *credit packs* which clients can purchase in order to @@ -203,9 +219,10 @@ use your service. Packages -------- -The credit packages are essentially a product with 4 characteristics. +The credit packages are essentially a product with 5 characteristics. * Name: the name of the package, +* Icon: A specific icon for the package. If not provided, it will fallback on the service icon * Description: details on the package that will appear on the shop page as well as the invoice, * Credits: the amount of credits the client is entitled to when buying the package, @@ -362,7 +379,6 @@ parameters we can use to make things clearer to the end-user: .. patch:: - .. TODO:: how do you test your service? JSON-RPC2_ Transaction API @@ -394,13 +410,13 @@ Authorize :param ServiceKey key: :param UserToken account_token: - :param int credit: + :param float credit: :param str description: optional, helps users identify the reason for charges on their accounts. :returns: :class:`TransactionToken` if the authorization succeeded. :raises: :class:`~odoo.exceptions.AccessError` if the service token is invalid :raises: :class:`~odoo.addons.iap.models.iap.InsufficientCreditError` if the account does - :raises: ``TypeError`` if the ``credit`` value is not an integer + :raises: ``TypeError`` if the ``credit`` value is not an integer or a float .. code-block:: python @@ -434,7 +450,7 @@ Capture :param TransactionToken token: :param ServiceKey key: - :param int credit_to_capture: (new - 15 Jan 2018) optional parameter to capture a smaller amount of credits than authorized + :param float credit_to_capture: (new - 15 Jan 2018) optional parameter to capture a smaller amount of credits than authorized :raises: :class:`~odoo.exceptions.AccessError` .. code-block:: python @@ -534,6 +550,33 @@ care how they are implemented Raised by any unexpeted behaviour at the discretion of the App developer (*you*). + +Test the API +------------ + +In order to test the developped app, we propose a sandbox platform that allows you to: + +1. Test the whole flow from the client's point of view - Actual services and transactions + that can be consulted. (again this requires to change the endpoint, see the danger note + in :ref:`Service <iap-service>`) +2. Test the API. + +The latter consists in specific tokens that will work on **IAP-Sandbox only**. + +* token ``000000``: represents a non-existing account. Returns + an :class:`~odoo.addons.iap.models.iap.InsufficientCreditError` on authorize attempt. +* token ``000111``: Represents an account without sufficient credits to perform any service. + Returns an :class:`~odoo.addons.iap.models.iap.InsufficientCreditError` on authorize attempt. +* token ``111111``: Represents an account with enough credits to perform any service. + An authorize attempt will return a dummy transacion token that is processed by the capture + and cancel routes. + +.. note:: + + * Those tokens are only active on the IAP-Sanbox server. + * The service key is completely ignored with this flow, If you want to run a robust test + of your service, you should ignore these tokens. + Odoo Helpers ============ @@ -548,7 +591,7 @@ Charging .. note:: A new functionality was introduced to capture a different amount of credits than reserved. - As this patch was added on the 15th of January 2018, you will need to upgrade your ``iap`` module in order to use it. + As this patch was added on the **15th of January 2018**, you will need to upgrade your ``iap`` module in order to use it. The specifics of the new functionality are highlighted in the code. .. class:: odoo.addons.iap.models.iap.charge(env, key, account_token, credit[, description, credit_template]) @@ -567,12 +610,12 @@ Charging configuration key :param ServiceKey key: :param UserToken token: - :param int credit: + :param float credit: :param str description: :param Qweb template credit_template: .. code-block:: python - :emphasize-lines: 10,13,14,15 + :emphasize-lines: 11,13,14,15 @route('/deathstar/superlaser', type='json') def superlaser(self, user_account, @@ -583,7 +626,8 @@ Charging 0.0 is none, 1.0 is full power """ credits = int(MAXIMUM_POWER * factor) - with charge(request.env, SERVICE_KEY, user_account, credits) as transaction: + description = "We will demonstrate the power of this station on your home planet of Alderaan." + with charge(request.env, SERVICE_KEY, user_account, credits, description) as transaction: # TODO: allow other targets transaction.credit = max(credits, 2) # Sales ongoing one the energy price, diff --git a/doc/webservices/images/creating_service.png b/doc/webservices/images/creating_service.png Binary files differnew file mode 100644 index 00000000000..dec807ade45 --- /dev/null +++ b/doc/webservices/images/creating_service.png diff --git a/doc/webservices/images/menu.png b/doc/webservices/images/menu.png Binary files differnew file mode 100644 index 00000000000..50e1ed0267a --- /dev/null +++ b/doc/webservices/images/menu.png diff --git a/doc/webservices/images/package.png b/doc/webservices/images/package.png Binary files differindex 0cc934caa2f..aca5959f7db 100644 --- a/doc/webservices/images/package.png +++ b/doc/webservices/images/package.png diff --git a/doc/webservices/images/service_create.png b/doc/webservices/images/service_create.png Binary files differdeleted file mode 100644 index 93c673467d6..00000000000 --- a/doc/webservices/images/service_create.png +++ /dev/null diff --git a/doc/webservices/images/service_created.png b/doc/webservices/images/service_created.png Binary files differnew file mode 100644 index 00000000000..1cb7a78c921 --- /dev/null +++ b/doc/webservices/images/service_created.png diff --git a/doc/webservices/images/service_list.png b/doc/webservices/images/service_list.png Binary files differnew file mode 100644 index 00000000000..d2b37f6255c --- /dev/null +++ b/doc/webservices/images/service_list.png diff --git a/doc/webservices/images/service_packs.png b/doc/webservices/images/service_packs.png Binary files differdeleted file mode 100644 index 3086d698ea4..00000000000 --- a/doc/webservices/images/service_packs.png +++ /dev/null diff --git a/doc/webservices/images/service_select.png b/doc/webservices/images/service_select.png Binary files differdeleted file mode 100644 index e3ceda4e339..00000000000 --- a/doc/webservices/images/service_select.png +++ /dev/null |
