示例#1
0
        public HomeController(IStockService stockService)
        {
            _stockServer = stockService;


            // initialise each consumer
            AddConsumer    add    = new AddConsumer(_stockServer);
            DeleteConsumer delete = new DeleteConsumer(_stockServer);
            UpdateConsumer update = new UpdateConsumer(_stockServer);

            // initialise each thread
            Thread addThread    = new Thread(new ThreadStart(add.ReceiveMessage));
            Thread deleteThread = new Thread(new ThreadStart(delete.ReceiveMessage));
            Thread updateThread = new Thread(new ThreadStart(update.ReceiveMessage));

            // start each receiving connection to the queue
            add.CreateConnection();
            delete.CreateConnection();
            update.CreateConnection();

            // start each thread
            addThread.Start();
            deleteThread.Start();
            updateThread.Start();
        }
示例#2
0
 public ConsumerAggregateData(UpdateConsumer consumer, AdjustBalance balance, AddFingerImageToConsumer finger, RemoveFingerImageFromConsumer removeFinger)
 {
     UpdateConsumerCommand              = consumer;
     AdjustBalanceCommand               = balance;
     AddFingerImageToConsumerCommand    = finger;
     RemoveFingerImageToConsumerCommand = removeFinger;
 }
示例#3
0
 public static UpdateConsumer ToUpdateConsumerCommand(this UpdateConsumer originalAggregate, object domainEvent)
 {
     return(new UpdateConsumer(
                legacyEmployeeId: originalAggregate.LegacyEmployeeId,
                uniqueId: originalAggregate.UniqueId,
                userName: domainEvent is UserNameSet ? ((UserNameSet)domainEvent).UserName : originalAggregate.UserName,
                //scannerId: GetApplicableValue(domainEvent, (ScannerIdSet e) => e.ScannerId, originalAggregate.ScannerId),
                scannerId: domainEvent is ScannerIdSet ? ((ScannerIdSet)domainEvent).ScannerId : originalAggregate.ScannerId,
                firstName: domainEvent is FirstNameSet ? ((FirstNameSet)domainEvent).FirstName : originalAggregate.FirstName,
                lastName: domainEvent is LastNameSet ? ((LastNameSet)domainEvent).LastName : originalAggregate.LastName,
                eMailAddress: domainEvent is EMailAddressSet ? ((EMailAddressSet)domainEvent).EMailAddress : originalAggregate.EMailAddress,
                pin: domainEvent is PinSet ? ((PinSet)domainEvent).Pin : originalAggregate.Pin,
                isActive: domainEvent is IsActiveSet ? ((IsActiveSet)domainEvent).IsActive : originalAggregate.IsActive,
                mobilePhone: domainEvent is MobilePhoneSet ? ((MobilePhoneSet)domainEvent).MobilePhone : originalAggregate.MobilePhone,
                clientAccount: domainEvent is ClientAccountSet ? ((ClientAccountSet)domainEvent).ClientAccount : originalAggregate.ClientAccount,
                cardId:
                domainEvent is CardAdded ? ((CardAdded)domainEvent).CardId :
                domainEvent is CardRemoved && string.Equals(((CardRemoved)domainEvent).CardId, originalAggregate.CardId) ? string.Empty :
                originalAggregate.ClientAccount
                ));
 }
        /// <summary>
        /// Updates customer addresses
        /// <a href="https://developers.klarna.com/api/#order-management-api-update-customer-addresses">
        ///     https://developers.klarna.com/api/#order-management-api-update-customer-addresses
        /// </a>
        /// </summary>
        /// <param name="orderId">Id of order to update</param>
        /// <param name="customerAddresses">The <see cref="UpdateConsumer"/>object</param>
        /// <returns></returns>
        public Task UpdateCustomerAddresses(string orderId, UpdateConsumer customerAddresses)
        {
            var url = ApiUrlHelper.GetApiUrlForController(ApiSession.ApiUrl, ApiControllerUri, $"{orderId}/customer-details");

            return(Patch(url, customerAddresses));
        }