Beispiel #1
0
        public CompletePayment(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
        public RequestUserAccess(ApplicationManagerClient appMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr)
        {
            this.idMgr = idMgr;

            this.secMgr = secMgr;

            this.appMgr = appMgr;
        }
        public Refresh(IEnterprisesBillingManagerService entBillingMgr, IIdentityAccessService idAccessSvc, ISecurityDataTokenService secMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.idAccessSvc = idAccessSvc;

            this.secMgr = secMgr;
        }
        public BillingStripeWebhook(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.secMgr = secMgr;

            this.idMgr = idMgr;
        }
Beispiel #5
0
        public ResetStateCheck(IEnterprisesBillingManagerService entBillingMgr, IIdentityAccessService idMgr, ISecurityDataTokenService secMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
        public SendDeviceMessage(IApplicationsIoTService appIoTArch, ILogger <SendDeviceMessage> log, ISecurityDataTokenService secMgr)
        {
            this.appIoTArch = appIoTArch;

            this.log = log;

            this.secMgr = secMgr;
        }
        public ChangeSubscription(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
        public virtual async Task DetermineRequiredOptIns(ISecurityDataTokenService secMgr, string entLookup, string username)
        {
            var tosDataToken = await secMgr.GetDataToken("LCU-USER-BILLING.TermsOfService", entLookup, username);

            var eaDataToken = await secMgr.GetDataToken("LCU-USER-BILLING.EnterpriseAgreement", entLookup, username);

            State.RequiredOptIns = new List <string>();

            if (!tosDataToken.Status || tosDataToken.Model.Lookup != "LCU-USER-BILLING.TermsOfService")
            {
                State.RequiredOptIns.Add("ToS");
            }

            if (!eaDataToken.Status || eaDataToken.Model.Lookup != "LCU-USER-BILLING.EnterpriseAgreement")
            {
                State.RequiredOptIns.Add("EA");
            }
        }
Beispiel #9
0
        public Refresh(IApplicationsIoTService appIoTArch, IEnterprisesAPIManagementService entApiArch, IEnterprisesAsCodeService eacSvc, IEnterprisesManagementService entMgr, IEnterprisesHostingManagerService entHostMgr,
                       IIdentityAccessService idMgr, ILogger <Refresh> log, ISecurityDataTokenService secMgr)
        {
            this.appIoTArch = appIoTArch;

            this.entApiArch = entApiArch;

            this.eacSvc = eacSvc;

            this.entMgr = entMgr;

            this.entHostMgr = entHostMgr;

            this.idMgr = idMgr;

            this.log = log;

            this.secMgr = secMgr;
        }
        public LoadSubscriptionDetails(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.secMgr = secMgr;
        }
        public TelemetrySyncOrchestration(ILogger <TelemetrySyncOrchestration> log, ISecurityDataTokenService secMgr)
        {
            this.log = log;

            this.secMgr = secMgr;
        }
        public ToggleTelemetrySync(ILogger <ToggleTelemetrySync> log, ISecurityDataTokenService secMgr)
        {
            this.secMgr = secMgr;

            this.log = log;
        }
        public ToggleEmulatedEnabled(ILogger <ToggleEmulatedEnabled> log, ISecurityDataTokenService secMgr)
        {
            this.log = log;

            this.secMgr = secMgr;
        }
        public virtual async Task Refresh(IEnterprisesBillingManagerService entBillingMgr, IIdentityAccessService idAccessSvc, ISecurityDataTokenService secMgr, string entLookup, string username, string licenseType)
        {
            ResetStateCheck();

            await LoadBillingPlans(entBillingMgr, entLookup, licenseType);

            SetUsername(username);

            await DetermineRequiredOptIns(secMgr, entLookup, username);

            await ListLicenses(idAccessSvc, entLookup, username, licenseType);
        }
        public virtual async Task CompletePayment(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr, string entLookup,
                                                  string username, string methodId, string customerName, string plan, int trialPeriodDays, string projectId)
        {
            State.CustomerName = customerName;

            State.PaymentMethodID = methodId;

            var planOption = this.State.Plans.First(p => p.Lookup == plan);

            var licenseTypeCore = planOption.Metadata["LicenseType"].ToString();

            var licenseTypes = planOption.Metadata.ContainsKey("LicenseTypeOverrides") ?
                               planOption.Metadata["LicenseTypeOverrides"].ToString().Split('|', StringSplitOptions.RemoveEmptyEntries) :
                               new[] { licenseTypeCore };

            var completeResp = await entBillingMgr.CompleteStripeSubscription(
                new CompleteStripeSubscriptionRequest()
            {
                CustomerName    = State.CustomerName,
                PaymentMethodID = methodId,
                Plan            = plan,
                TrialPeriodDays = trialPeriodDays,
                Username        = username
            }, entLookup, licenseTypeCore);

            State.PaymentStatus = completeResp.Status;

            if (State.PaymentStatus.Code == 0)
            {
                State.PurchasedPlanLookup = plan;

                var tosResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.TermsOfService",
                    Name        = "LCU-USER-BILLING.TermsOfService",
                    Description = "Billing Terms of Service",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                }, entLookup, email : username, projectId : Guid.Parse(projectId));

                var eaResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.EnterpriseAgreement",
                    Name        = "LCU-USER-BILLING.EnterpriseAgreement",
                    Description = "Billing Enterprise Agreement",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                }, entLookup, email : username, projectId : Guid.Parse(projectId));

                var licenseResponse = await idMgr.IssueLicense(new License()
                {
                    Details        = JsonConvert.SerializeObject(planOption.Metadata),
                    ExpirationDate = DateTimeOffset.Now.AddYears(50),
                    IsLocked       = false
                }, entLookup, username, projectId, plan, licenseTypeCore);

                State.PaymentStatus = licenseResponse.Status;

                State.SubscriptionID = completeResp.SubscriptionID;

                State.SuccessRedirect = planOption.Metadata["SuccessRedirect"].ToString();
            }

            else
            {
                //TODO handle when payment fails but subscription is assigned
            }
        }
        public UpdateTelemetrySync(ILogger <UpdateTelemetrySync> log, ISecurityDataTokenService secMgr)
        {
            this.log = log;

            this.secMgr = secMgr;
        }
Beispiel #17
0
        public ToggleDetailsPane(ILogger <ToggleDetailsPane> log, ISecurityDataTokenService secMgr)
        {
            this.log = log;

            this.secMgr = secMgr;
        }
        public virtual async Task UpdatePaymentInfo(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, string entLookup,
                                                    string username, string methodId, string customerName)
        {
            State.CustomerName = customerName;

            State.PaymentMethodID = methodId;

            var updateResp = await entBillingMgr.UpdateStripeSubscription(entLookup,
                                                                          new UpdateStripeSubscriptionRequest()
            {
                CustomerName    = State.CustomerName,
                PaymentMethodID = methodId,
                Username        = username
            });

            State.PaymentStatus = updateResp.Status;

            if (State.PaymentStatus)
            {
                var tosResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.TermsOfService",
                    Name        = "LCU-USER-BILLING.TermsOfService",
                    Description = "Billing Terms of Service",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                });

                var eaResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.EnterpriseAgreement",
                    Name        = "LCU-USER-BILLING.EnterpriseAgreement",
                    Description = "Billing Enterprise Agreement",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                });
            }
        }
        public UpdatePaymentInfo(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr)
        {
            this.entBillingMgr = entBillingMgr;

            this.secMgr = secMgr;
        }
        public virtual async Task ChangeSubscription(IEnterprisesBillingManagerService entBillingMgr, ISecurityDataTokenService secMgr, IIdentityAccessService idMgr, string entLookup,
                                                     string username, string customerName, string plan)
        {
            //cancel existing subscription
            var cancelResp = await entBillingMgr.CancelSubscriptionByUser(username, entLookup);

            var planOption = this.State.Plans.First(p => p.Lookup == plan);

            var licenseType = planOption.Metadata["LicenseType"].ToString();

            //Remove license access
            await idMgr.RevokeLicense(entLookup, username, licenseType);

            // create new subscription
            var completeResp = await entBillingMgr.CompleteStripeSubscription(
                new CompleteStripeSubscriptionRequest()
            {
                CustomerName    = State.CustomerName,
                Plan            = plan,
                Username        = username,
                TrialPeriodDays = 0
            }, entLookup, licenseType);

            State.PaymentStatus = completeResp.Status;

            if (State.PaymentStatus)
            {
                State.PurchasedPlanLookup = plan;

                var tosResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.TermsOfService",
                    Name        = "LCU-USER-BILLING.TermsOfService",
                    Description = "Billing Terms of Service",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                });

                var eaResp = await secMgr.SetDataToken(new DataToken()
                {
                    Lookup      = "LCU-USER-BILLING.EnterpriseAgreement",
                    Name        = "LCU-USER-BILLING.EnterpriseAgreement",
                    Description = "Billing Enterprise Agreement",
                    Value       = DateTimeOffset.UtcNow.ToString(),
                });

                //issue new license access
                // var setLicenseAccessResp = await idMgr.IssueLicenseAccess(new LicenseAccessToken()
                // {
                //     AccessStartDate = System.DateTime.Now,
                //     Details = planOption.JSONConvert<MetadataModel>(),
                //     EnterpriseLookup = entLookup,
                //     Lookup = licenseType,
                //     TrialPeriodDays = 0,
                //     Username = username
                // }, entLookup);

                // var setLicenseAccessResp = await idMgr.IssueLicense(new License()
                // {
                //     Details = planOption.JSONConvert<string>(),
                //     Lookup = licenseType,
                //     Type = licenseType,
                // }, entLookup);

                // State.PaymentStatus = setLicenseAccessResp.Status;

                State.SubscriptionID = completeResp.SubscriptionID;

                State.SuccessRedirect = planOption.Metadata["SuccessRedirect"].ToString();
            }

            await ListLicenses(idMgr, entLookup, username, licenseType);

            State.Loading = false;
        }