+ pm.lock.Lock()
+ defer pm.lock.Unlock()
+
+ registeredProvider, shouldReturn, returnValue := pm.checkIfProviderIsRegistered(registrationId, ctx)
+ if shouldReturn {
+ return returnValue
+ }
+
+ updatedProvider, shouldReturn1, returnValue1 := getProviderFromRequest(ctx)
+ if shouldReturn1 {
+ return returnValue1
+ }
+
+ if updatedProvider.ApiProvDomInfo != nil {
+ registeredProvider.ApiProvDomInfo = updatedProvider.ApiProvDomInfo
+ }
+
+ shouldReturn, returnValue = pm.updateFunctions(updatedProvider, registeredProvider, ctx)
+ if shouldReturn {
+ return returnValue
+ }
+
+ err := ctx.JSON(http.StatusOK, pm.onboardedProviders[registrationId])
+ if err != nil {
+ // Something really bad happened, tell Echo that our handler failed
+ return err
+ }
+
+ return nil
+}
+
+func (pm *ProviderManager) checkIfProviderIsRegistered(registrationId string, ctx echo.Context) (provapi.APIProviderEnrolmentDetails, bool, error) {