private async Task CreateAndAssignIntegrationEvents(string[] buyerClientIDs, string localBuyerClientID, string token)
        {
            var checkoutEvent = SeedConstants.CheckoutEvent(_settings);
            await _oc.IntegrationEvents.SaveAsync(checkoutEvent.ID, checkoutEvent, token);

            var localCheckoutEvent = SeedConstants.LocalCheckoutEvent(_settings);
            await _oc.IntegrationEvents.SaveAsync(localCheckoutEvent.ID, localCheckoutEvent, token);

            await _oc.ApiClients.PatchAsync(localBuyerClientID, new PartialApiClient { OrderCheckoutIntegrationEventID = "HeadStartCheckoutLOCAL" }, token);

            await Throttler.RunAsync(buyerClientIDs, 500, 20, clientID =>
                                     _oc.ApiClients.PatchAsync(clientID, new PartialApiClient {
                OrderCheckoutIntegrationEventID = "HeadStartCheckout"
            }, token));
        }
예제 #2
0
        private async Task CreateAndAssignIntegrationEvents(string[] buyerClientIDs, string localBuyerClientID, string token, EnvironmentSeed seed = null)
        {
            var middlewareBaseUrl = seed != null ? seed.MiddlewareBaseUrl : _settings.EnvironmentSettings.MiddlewareBaseUrl;
            var webhookHashKey    = seed != null ? seed.OrderCloudSettings.WebhookHashKey : _settings.OrderCloudSettings.WebhookHashKey;
            var checkoutEvent     = SeedConstants.CheckoutEvent(middlewareBaseUrl, webhookHashKey);
            await _oc.IntegrationEvents.SaveAsync(checkoutEvent.ID, checkoutEvent, token);

            var localCheckoutEvent = SeedConstants.LocalCheckoutEvent(webhookHashKey);
            await _oc.IntegrationEvents.SaveAsync(localCheckoutEvent.ID, localCheckoutEvent, token);

            await _oc.ApiClients.PatchAsync(localBuyerClientID, new PartialApiClient { OrderCheckoutIntegrationEventID = "HeadStartCheckoutLOCAL" }, token);

            await Throttler.RunAsync(buyerClientIDs, 500, 20, clientID =>
                                     _oc.ApiClients.PatchAsync(clientID, new PartialApiClient {
                OrderCheckoutIntegrationEventID = "HeadStartCheckout"
            }, token));
        }
        private async Task CreateOrUpdateAndAssignIntegrationEvents(string token, EnvironmentSeed seed = null)
        {
            var storefrontApiClientIDs = await GetStoreFrontClientIDs(token);

            var apiClients = await GetApiClients(token);

            var localBuyerClientID = apiClients.BuyerLocalUiApiClient.ID;

            // this gets called by both the /seed command and the post-staging restore so we need to handle getting settings from two sources
            var middlewareBaseUrl = seed != null ? seed.MiddlewareBaseUrl : _settings.EnvironmentSettings.MiddlewareBaseUrl;
            var webhookHashKey    = seed != null ? seed.OrderCloudSettings.WebhookHashKey : _settings.OrderCloudSettings.WebhookHashKey;
            var checkoutEvent     = SeedConstants.CheckoutEvent(middlewareBaseUrl, webhookHashKey);
            await _oc.IntegrationEvents.SaveAsync(checkoutEvent.ID, checkoutEvent, token);

            var localCheckoutEvent = SeedConstants.LocalCheckoutEvent(webhookHashKey);
            await _oc.IntegrationEvents.SaveAsync(localCheckoutEvent.ID, localCheckoutEvent, token);

            await _oc.ApiClients.PatchAsync(localBuyerClientID, new PartialApiClient { OrderCheckoutIntegrationEventID = "HeadStartCheckoutLOCAL" }, token);

            await Throttler.RunAsync(storefrontApiClientIDs, 500, 20, clientID =>
                                     _oc.ApiClients.PatchAsync(clientID, new PartialApiClient {
                OrderCheckoutIntegrationEventID = "HeadStartCheckout"
            }, token));
        }