Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

Managing Ibanity end users

With this usage scenario of the lino_xl.lib.peppol plugin you can manage a list of Ibanity end users. To activate this scenario, set the with_suppliers plugin setting to True. This scenario requires the site operator to be an Ibanity hosting provider.

All code snippets on this page (lines starting with >>>) are being tested as part of our development workflow. The following snippet initializes a demo project to use throughout this page.

>>> from lino_book.projects.noi1r.startup import *

The tests in this document are skipped unless you have Ibanity credentials installed. See How to set up your credentials for details.

>>> if not dd.plugins.peppol.credentials:
...     pytest.skip('this doctest requires Ibanity credentials')

Clean up from (incomplete) previous test runs:

>>> def tidy_up():
...     peppol.Supplier.objects.all().delete()
...     countries.Place.objects.filter(name="Leuven").delete()
>>> tidy_up()

Database models

class lino_xl.lib.peppol.Supplier

Django model used to represent an Ibanity supplier

Data checkers

class lino_xl.lib.peppol.SuppliersListChecker

Checks whether all suppliers that were registered by this Ibanity hosting provider have a Supplier row on this Lino site.

class lino_xl.lib.peppol.SupplierChecker

Synchronizes this Supplier row with the data registered in the Ibanity API.

Note that SuppliersListChecker and SupplierChecker are manual checkers. We do not want these checkers to run automatically during checkdata, only when called manually, because it requires Ibanity credentials, which are not available e.g. on GitLab.

Onboarding states

class lino_xl.lib.peppol.OnboardingStates

A choicelist with values for the Supplier.onboarding_state field.

>>> rt.show(peppol.OnboardingStates)
======= ============ ============
 value   name         text
------- ------------ ------------
 10      draft        Draft
 20      created      Created
 30      approved     Approved
 40      rejected     Rejected
 50      onboarded    Onboarded
 60      offboarded   Offboarded
======= ============ ============

Suppliers

>>> ar = rt.login("robin")
>>> rt.show(peppol.Suppliers)
No data to display
>>> peppol.SuppliersListChecker.update_unbound_problems(ar, fix=True)
- peppol.SuppliersListChecker : (★) No entry for 273c1bdf-6258-4484-b6fb-74363721d51f.
(★) Unknown city Leuven ((in Belgium)
(★) Some fields need update: city, country, email, ibans, names, onboarding_state, phone, street, street_no, vat_id, zip_code
Found 0 and fixed 1 checkdata messages for peppol.SuppliersListChecker (Check for missing or invalid suppliers).
>>> rt.show(peppol.Suppliers)
====================================== ======================= ============== ================== ==================================
 Supplier ID                            Names                   VAT id         Onboarding state   Last sync
-------------------------------------- ----------------------- -------------- ------------------ ----------------------------------
 273c1bdf-6258-4484-b6fb-74363721d51f   Company; Company S.A.   BE1234567890   Created            ...
====================================== ======================= ============== ================== ==================================

Clean up after this test run:

>>> tidy_up()