public async Task <IHttpActionResult> Put(ShipmentDeliveryFactorCommand command) { var commandResponse = await Bus.Send <ShipmentDeliveryFactorCommand, ShipmentDeliveryFactorCommandResponse>(command); var response = new ResponseModel { Message = "تحویل فاکتو با موفقعیت انجام شد", Success = true, ResponseData = commandResponse }; return(Ok(response)); }
public async Task <ShipmentDeliveryFactorCommandResponse> Handle(ShipmentDeliveryFactorCommand command) { var factor = _repository.AsQuery().SingleOrDefault(p => p.Id == command.Id); if (factor == null) { throw new DomainException("فاکتور یافت نشد"); } if (factor.FactorState != FactorState.Paid) { throw new DomainException("فاکتور پرداخت نشد است"); } factor.DeliveryShipment(); await _fcmNotification.SendToIds(factor.Shop.GetPushTokens(), "Delivery invoice", "Invoice has been delivered to you", NotificationType.DeliveryFactor, AppType.Shop, NotificationSound.Shopper, factor.Id.ToString()); return(new ShipmentDeliveryFactorCommandResponse()); }