private OrderPaymentStatus EvaluatePaymentStatus(Order o, OrderPaymentSummary s) { OrderPaymentStatus result = OrderPaymentStatus.Unknown; if (s.AmountDue < 0) { // Refund Due = Overpaid result = OrderPaymentStatus.Overpaid; } else { if (s.AmountDue == 0) { result = OrderPaymentStatus.Paid; } else { // Amount Due = positive at this point if (s.TotalCredit > 0) { result = OrderPaymentStatus.PartiallyPaid; } else { result = OrderPaymentStatus.Unpaid; } } } o.PaymentStatus = result; return(result); }
public async Task <bool> Delete(OrderPaymentStatus OrderPaymentStatus) { if (await ValidateId(OrderPaymentStatus)) { } return(OrderPaymentStatus.IsValidated); }
public static string OrderPaymentStatus(OrderPaymentStatus e) { var result = string.Empty; switch (e) { case Orders.OrderPaymentStatus.Overpaid: result = "Overpaid"; break; case Orders.OrderPaymentStatus.Paid: result = "Paid"; break; case Orders.OrderPaymentStatus.PartiallyPaid: result = "Partially Paid"; break; case Orders.OrderPaymentStatus.Unknown: result = "Unknown"; break; case Orders.OrderPaymentStatus.Unpaid: result = "Unpaid"; break; } return(result); }
private void OnPaymentChanged(OrderPaymentStatus previousPaymentStatus, Order o, MerchantTribeApplication app) { BusinessRules.OrderTaskContext context = new BusinessRules.OrderTaskContext(app); context.Order = o; context.UserId = o.UserID; context.Inputs.Add("bvsoftware", "PreviousPaymentStatus", previousPaymentStatus.ToString()); BusinessRules.Workflow.RunByName(context, BusinessRules.WorkflowNames.PaymentChanged); }
public virtual IActionResult GetAllOrders(OrderPaymentStatus status) { var orders = _orderService.GetAll(status); var dtos = orders.ToList().Select(x => x.ToDto()).ToList(); return(new JsonResult(dtos)); }
public async Task <OrderPaymentStatus> Get(long Id) { OrderPaymentStatus OrderPaymentStatus = await UOW.OrderPaymentStatusRepository.Get(Id); if (OrderPaymentStatus == null) { return(null); } return(OrderPaymentStatus); }
public static string GetOrderPaymentStatus(OrderPaymentStatus paymentStatus, string culture = null) { var value = OrderPaymentStatusesLocalization.GetFormattedString(paymentStatus.ToString(), culture); if (string.IsNullOrEmpty(value)) { value = OrderPaymentStatusesLocalization.GetString(OrderPaymentStatus.Unknown.ToString(), culture); } return(value); }
public OrderPaymentStatus EvaluatePaymentStatus(Order o) { OrderPaymentSummary s = new OrderPaymentSummary(); s.Populate(o, this); OrderPaymentStatus result = EvaluatePaymentStatus(o, s); s = null; return(result); }
public Company_OrderPaymentStatusDTO(OrderPaymentStatus OrderPaymentStatus) { this.Id = OrderPaymentStatus.Id; this.Code = OrderPaymentStatus.Code; this.Name = OrderPaymentStatus.Name; this.Errors = OrderPaymentStatus.Errors; }
public CustomerSalesOrder_OrderPaymentStatusDTO(OrderPaymentStatus OrderPaymentStatus) { this.Id = OrderPaymentStatus.Id; this.Code = OrderPaymentStatus.Code; this.Name = OrderPaymentStatus.Name; this.Errors = OrderPaymentStatus.Errors; }
/// <summary> /// Counts the number of orders for given search criteria /// </summary> /// <param name="orderStatusId">order status Id of the orders to search</param> /// <param name="paymentStatus">payment status of the orders to search</param> /// <param name="shipmentStatus">shipment status of the orders to search</param> /// <param name="startDate">starting date for search</param> /// <param name="endDate">ending date for search</param> /// <returns>The number of orders for given search criteria</returns> public static int SearchCount(int orderStatusId, OrderPaymentStatus paymentStatus, OrderShipmentStatus shipmentStatus, DateTime startDate, DateTime endDate) { //COUNT ORDER IDS THAT FIT THE CRITERIA StringBuilder countQuery = new StringBuilder(); countQuery.Append("SELECT COUNT(*) AS SearchCount"); countQuery.Append(" FROM ac_Orders"); countQuery.Append(" WHERE StoreId = @storeId"); if (orderStatusId != 0) { countQuery.Append(" AND OrderStatusId = @orderStatusId"); } if (paymentStatus != OrderPaymentStatus.Unspecified) { countQuery.Append(" AND PaymentStatusId = @paymentStatusId"); } if (shipmentStatus != OrderShipmentStatus.Unspecified) { countQuery.Append(" AND ShipmentStatusId = @shipmentStatusId"); } if (startDate > DateTime.MinValue) { countQuery.Append(" AND OrderDate >= @startDate"); } if (endDate > DateTime.MinValue) { countQuery.Append(" AND OrderDate <= @endDate"); } Database database = Token.Instance.Database; DbCommand countCommand = database.GetSqlStringCommand(countQuery.ToString()); database.AddInParameter(countCommand, "@storeId", System.Data.DbType.Int32, Token.Instance.StoreId); if (orderStatusId != 0) { database.AddInParameter(countCommand, "@orderStatusId", System.Data.DbType.Int32, orderStatusId); } if (startDate > DateTime.MinValue) { database.AddInParameter(countCommand, "@startDate", System.Data.DbType.DateTime, startDate); } if (endDate > DateTime.MinValue) { database.AddInParameter(countCommand, "@endDate", System.Data.DbType.DateTime, endDate); } if (paymentStatus != OrderPaymentStatus.Unspecified) { database.AddInParameter(countCommand, "@paymentStatus", System.Data.DbType.Byte, paymentStatus); } if (shipmentStatus != OrderShipmentStatus.Unspecified) { database.AddInParameter(countCommand, "@shipmentStatus", System.Data.DbType.Byte, shipmentStatus); } return(AlwaysConvert.ToInt(database.ExecuteScalar(countCommand))); }
private void OnPaymentChanged(OrderPaymentStatus previousPaymentStatus, Order o) { var context = new OrderTaskContext(Context) { Order = o, UserId = o.UserID, PreviousPaymentStatus = previousPaymentStatus }; Workflow.RunByName(context, WorkflowNames.PaymentChanged); }
public async Task <bool> UpdateOrderPaymentStatus(string paymentIntentId, OrderPaymentStatus order_pymnt_status) { var sql = @"UPDATE customer_orders SET order_pymnt_status = @order_pymnt_status WHERE paymentIntentId = @paymentIntentId"; using (var connection = this.GetOpenConnection()) { int rows = await connection.ExecuteAsync(sql, new { order_pymnt_status = order_pymnt_status.ToString(), paymentIntentId = paymentIntentId }); return(rows != 0); } }
/// <summary> /// Initializes a new instance of the OrderFilter class. /// </summary> public OrderFilter() { _OrderDateStart = DateTime.MinValue; _OrderDateEnd = DateTime.MaxValue; _OrderIdRange = string.Empty; _OrderNumberRange = string.Empty; _PaymentStatus = OrderPaymentStatus.Unspecified; _ShipmentStatus = OrderShipmentStatus.Unspecified; _OrderStatus = new IdList(); _Keyword = string.Empty; _KeywordField = KeywordFieldType.All; }
/// <summary> /// Helper to convert enum to a valid string sent/received in from the API /// <returns>String</returns> /// </summary> public static String OrderPaymentStatusToString(OrderPaymentStatus value) { switch (value) { case OrderPaymentStatus.Pending: return("0"); case OrderPaymentStatus.Authorized: return("100"); case OrderPaymentStatus.Captured: return("200"); case OrderPaymentStatus.PartiallyCaptured: return("201"); } return(""); }
/// <summary> /// Default constructor /// </summary> public OrderSearchCriteria() { _OrderDateStart = DateTime.MinValue; _OrderDateEnd = DateTime.MaxValue; _OrderIdRange = string.Empty; _OrderIdStart = 0; _OrderIdEnd = 0; _OrderNumberRange = string.Empty; _OrderNumberStart = 0; _OrderNumberEnd = 0; _PaymentStatus = OrderPaymentStatus.Unspecified; _ShipmentStatus = OrderShipmentStatus.Unspecified; _OrderStatus = new IdList(); _Filter = new Collection <MatchCriteria>(); }
internal static void UpdatePaymentStatus(Order order, OrderPaymentStatus paymentStatus) { bool saveDirty = order.IsDirty; order.PaymentStatus = paymentStatus; string updateQuery = "UPDATE ac_Orders SET PaymentStatusId = @paymentStatus WHERE OrderId = @orderId"; Database database = Token.Instance.Database; using (System.Data.Common.DbCommand updateCommand = database.GetSqlStringCommand(updateQuery)) { database.AddInParameter(updateCommand, "@paymentStatus", System.Data.DbType.Byte, (byte)paymentStatus); database.AddInParameter(updateCommand, "@orderId", System.Data.DbType.Int32, order.OrderId); if (database.ExecuteNonQuery(updateCommand) > 0) { order.IsDirty = saveDirty; } } }
public async Task <OrderPaymentStatus> Get(long Id) { OrderPaymentStatus OrderPaymentStatus = await DataContext.OrderPaymentStatus.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new OrderPaymentStatus() { Id = x.Id, Code = x.Code, Name = x.Name, }).FirstOrDefaultAsync(); if (OrderPaymentStatus == null) { return(null); } return(OrderPaymentStatus); }
public bool AddPaymentTransactionToOrder(Order o, OrderTransaction t, MerchantTribeApplication app) { // Save Order First if no bvin Orders.Upsert(o); t.OrderId = o.bvin; t.OrderNumber = o.OrderNumber; t.StoreId = o.StoreId; if (Transactions.Create(t)) { OrderPaymentStatus previous = o.PaymentStatus; EvaluatePaymentStatus(o); OnPaymentChanged(previous, o, app); return(Orders.Update(o)); } return(false); }
public virtual IList <Order> GetAll(OrderPaymentStatus status) { var OrdersQuery = _orderRepo.TableNoTracking; switch (status) { case OrderPaymentStatus.paid: OrdersQuery = OrdersQuery.Where(o => o.IsPaid == true); break; case OrderPaymentStatus.notpaid: OrdersQuery = OrdersQuery.Where(o => o.IsPaid == false); break; default: break; } return(OrdersQuery.ToList()); }
public async Task <bool> ValidateId(OrderPaymentStatus OrderPaymentStatus) { OrderPaymentStatusFilter OrderPaymentStatusFilter = new OrderPaymentStatusFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = OrderPaymentStatus.Id }, Selects = OrderPaymentStatusSelect.Id }; int count = await UOW.OrderPaymentStatusRepository.Count(OrderPaymentStatusFilter); if (count == 0) { OrderPaymentStatus.AddError(nameof(OrderPaymentStatusValidator), nameof(OrderPaymentStatus.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <bool> Create(OrderPaymentStatus OrderPaymentStatus) { return(OrderPaymentStatus.IsValidated); }
public Order(OrderPaymentStatus paymentStatus) { PaymentStatus = paymentStatus.ToString().ToLower(); }
public static OrderCollection Search(int orderStatusId, OrderPaymentStatus paymentStatus, OrderShipmentStatus shipmentStatus, DateTime startDate, DateTime endDate, string sortExpression) { return(OrderDataSource.Search(orderStatusId, paymentStatus, shipmentStatus, startDate, endDate, 0, 0, sortExpression)); }
public async Task <bool> UpdateOrderPaymentStatus(string paymentIntentId, OrderPaymentStatus order_payment_status) { return(await unitOfWork.Orders.UpdateOrderPaymentStatus(paymentIntentId, order_payment_status)); }
private void OnPaymentChanged(OrderPaymentStatus previousPaymentStatus, Order o, MerchantTribeApplication app) { BusinessRules.OrderTaskContext context = new BusinessRules.OrderTaskContext(app); context.Order = o; context.UserId = o.UserID; context.Inputs.Add("bvsoftware", "PreviousPaymentStatus", previousPaymentStatus.ToString()); BusinessRules.Workflow.RunByName(context, BusinessRules.WorkflowNames.PaymentChanged); }
public static OrderCollection Search(int orderStatusId, OrderPaymentStatus paymentStatus, OrderShipmentStatus shipmentStatus, DateTime startDate, DateTime endDate, int maximumRows, int startRowIndex, string sortExpression) { //SET DEFAULT SORT if (string.IsNullOrEmpty(sortExpression)) { sortExpression = "OrderDate DESC"; } //CREATE THE DYNAMIC SQL TO LOAD OBJECT StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT"); if (maximumRows > 0) { selectQuery.Append(" TOP " + (startRowIndex + maximumRows).ToString()); } selectQuery.Append(" " + Order.GetColumnNames(string.Empty)); selectQuery.Append(" FROM ac_Orders"); selectQuery.Append(" WHERE StoreId = @storeId"); if (orderStatusId != 0) { selectQuery.Append(" AND OrderStatusId = @orderStatusId"); } if (paymentStatus != OrderPaymentStatus.Unspecified) { selectQuery.Append(" AND PaymentStatusId = @paymentStatus"); } if (shipmentStatus != OrderShipmentStatus.Unspecified) { selectQuery.Append(" AND ShipmentStatusId = @shipmentStatus"); } if (startDate > DateTime.MinValue) { selectQuery.Append(" AND OrderDate >= @startDate"); } if (endDate > DateTime.MinValue) { selectQuery.Append(" AND OrderDate <= @endDate"); } selectQuery.Append(" ORDER BY " + sortExpression); //BUILD THE COMMAND Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); database.AddInParameter(selectCommand, "@storeId", System.Data.DbType.Int32, Token.Instance.StoreId); if (orderStatusId != 0) { database.AddInParameter(selectCommand, "@orderStatusId", System.Data.DbType.Int32, orderStatusId); } if (startDate > DateTime.MinValue) { database.AddInParameter(selectCommand, "@startDate", System.Data.DbType.DateTime, startDate); } if (endDate > DateTime.MinValue) { database.AddInParameter(selectCommand, "@endDate", System.Data.DbType.DateTime, endDate); } if (paymentStatus != OrderPaymentStatus.Unspecified) { database.AddInParameter(selectCommand, "@paymentStatus", System.Data.DbType.Byte, paymentStatus); } if (shipmentStatus != OrderShipmentStatus.Unspecified) { database.AddInParameter(selectCommand, "@shipmentStatus", System.Data.DbType.Byte, shipmentStatus); } //EXECUTE THE COMMAND OrderCollection results = new OrderCollection(); int thisIndex = 0; int rowCount = 0; using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows))) { if (thisIndex >= startRowIndex) { Order order = new Order(); Order.LoadDataReader(order, dr); results.Add(order); rowCount++; } thisIndex++; } dr.Close(); } return(results); }
public async Task <bool> UpdateOrderPaymentStatus(string paymentIntentId, OrderPaymentStatus order_payment_status) { return(await customerService.UpdateOrderPaymentStatus(paymentIntentId, order_payment_status)); }