Migration of tenants from Conta DIY to Patron

Introduction

After the successful migration of all users, the next step is to migrate alle tenants from Conta DIY to Patron. There are multiple issues that must be resolved, both before migration and during operation after migration. This document will identify these issues and provide a milestone plan on the tasks before, during and after migration.

Milestones

5.4 - 23.04.2025

  • Migration tool started

  • Personal tenant support in Patron frontend

5.5 - 21.05.2025

  • Finish of migration tool for tenants with testing

  • Finish all events for users and tenants

  • Support for SUS companies in Patron. Starte-AS integration?

  • Start work with exposing data for PowerBI

5.6 - 25.06.2025

  • Async update of user and tenant data from Conta DIY through Patron, triggering update event

5.7 - 23.07.2025

  • Migration of tenants without purchases done, services write to master (patron). Purchases still managed by DIY.

  • Events makes sure user and tenant data are in sync

  • Start work with product/subscription migration

5.8 - 20.08.2025

  • Finish product/subscription migration tool, with testing.

  • Finish work with APIs for PowerBI

5.9 - 24.09.2025

  • Production with product/subscription managed by Patron.

Epics

Migration Tool

Conta DIY has en endpoint that can be used to export all tenants and push them to Patron. We need a migration cli tool that uses the admin endpoint in Conta DIY to export tenants and then imports them into Patron.

Users

User authentication is synced since Conta DIY uses it for authentication. UserProfile data is not synced between firestore and Conta DIY. Other services (salary, pracsys, finsta, patron) has no local information about a user, and only refers to them by user id.

Questions

  • How should changes from Conta DIY get written to firestore?

    • The best would be that DIY writes user profile changes directly to firestore using patron apis (master). DIY may also update it locally directly, but should also rely on events for updates coming from other sources.

Tenants

Conta DIY receives events when tenants are created and updated, but currently does nothing with them. This way they can keep their data in sync. This is the same as all other services do (salary, pracsys, finsta).

Questions

  • After migration, how should new tenants created in Conta DIY be created in Patron?

    • We should not create tenants in DIY directly after migration. Use Patron api.

  • How should we handle blocking of tenants?

    • A tenant should be blocked in patron, event is triggered, and tenant is updated in diy if needed.

  • Tenant info should be fetched from patron when page loads. How will DIY handle this? (resiliently)

  • How are we going to do sync fra Conta DIY → Patron?

    • DIY should update common tenant data in Patron directly. Depend on events to stay updated.

Personal Tenants

The Patron frontend expects that every tenant has an organization number. The pages "work" with tenants without organization number, but some of the elements looks wrong. We also need support to create personal tenants in the registration pages.

Questions

  • Should we only allow registration of personal tenants when purchasing Conta Standard/Smart?

    • Turn it the other way around, only allow to purchase standard/smart when personal tenant is created


Purchases/Products/Provision

Conta Standard and Conta Smart is purchasable from Patron. We need to determine what other products should be purchasable from Patron and how to handle invoicing, upgrade, downgrade, cancellation etc. We already have events for purchases that Conta DIY can respond to.

Questions

  • How should we handle cancellation of Conta Standard/Smart from Patron?

  • How should we handle renew of subscription and upgrade/downgrade of Conta Standard/Smart from Patron?

    • When all subscription management is managed by patron, DIY must use Patron API to upgrade, downgrade anc cancel subscriptions

  • Can DIY do renewal of subscriptions through patron as a migration strategy?

    • Beta purchases first, then all new purchases, and then gradually all existing subscriptions managed by patron

  • How should we handle Conta Cloud and subscription cancellation, export of data etc

Invoicing

Today we have a manual invoice job that runs on demand. This job creates a draft invoice in Conta DIY and marks the period in Patron as invoiced. The draft is later accepted manually by Sandra. There is a big risk to move all invoicing to Patron in one go.

One suggestion is that purchases of Conta Standard/Smart directly in Patron should be invoiced in Patron. This requires that these products is somehow marked in Conta DIY so they don’t get invoiced from there.

The invoicing job needs an overhaul to run automatically with service accounts using custom tailored apis in diy for fetching and creating customers. It also needs to have knowledge of all products for Conta AS in DIY.

Export to PowerBI

We must expose anonymous data to PowerBI so management can track usage of our services. In DIY they expose selected db-tables directly. We do not want to do this.

Questions

  • What type of data is wanted/needed for each service?

  • Is it enough to expose the data on json-endpoints with basic auth?

  • How do they collect the data?

Nice to have

Redesigned start page

Start page must be redesigned to fit needs of all tenants that can use our products. This means improving the flow for managing access, subscription and tenant settings/details, as well as onboarding new customers. Customer onboarding will firstly be managed by DIY using patron APIs, but will in time be moved to start page as one common place to do customer onboarding.

Shorter tenant ids

We want shorter tenant ids to make it easier for integration partners to use our services. Also, more human readable ids will be used HRIs).

Tenant and User lifecycle

We must implement support for tenant lifecycle from provisioning to cancellation of subscription to deletion. Also includes export of tenant data. User deletion relates in the sense that we cannot delete a user that is the sole owner of a tenant.

Work on DIY side

Need to collect info about what needs to be done on DIY side