예제 #1
0
        private async Task UpdateVenuesWithExternalPaymentProvider(int companyId)
        {
            try
            {
                var companyResult = await companies.FetchCompany(companyId).ConfigureAwait(false);

                if (companyResult.IsSuccess)
                {
                    var company = companyResult.Value.Value;

                    var accessToken = await cryptoHelper.DecryptString(company.ExternalAccessToken).ConfigureAwait(false);

                    if (!string.IsNullOrWhiteSpace(accessToken))
                    {
                        messagePublisher.DirectPublish(
                            constants.VenueSyncQueueName,
                            constants.VenueSyncExchangeRoutingKey,
                            constants.VenueSyncExchangeName,
                            constants.VenueSyncExchangeQueueName,
                            new Message <DtoVenueSyncMessage>
                        {
                            Type = constants.VenueSynch,
                            Data = new DtoVenueSyncMessage(Guid.NewGuid(), VenueSyncAction.Update, accessToken, company)
                        });
                    }
                }
            }
            catch (Exception e)
            {
                // TODO: Something here
            }
        }