Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CentraSharp/Entities/CompleteOrderResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ public class CompleteOrderResponse
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }

/// <summary>
/// Error Message
/// </summary>
[JsonProperty("msg")]
public string Msg { get; set; }
}
}
32 changes: 32 additions & 0 deletions CentraSharp/Filters/CompleteOrderFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Newtonsoft.Json;
using PrimePenguin.CentraSharp.Infrastructure;

namespace PrimePenguin.CentraSharp.Filters
{
public class CompleteOrderFilter : Parameterizable
{
/// <summary>
/// status
/// </summary>
[JsonProperty("id")]
public int Id { get; set; }

/// <summary>
/// Authorization / capture
/// </summary>
[JsonProperty("status")]
public int Status { get; set; }

/// <summary>
/// Amount of the order
/// </summary>
[JsonProperty("amount")]
public double Amount { get; set; }

/// <summary>
/// OrderId
/// </summary>
[JsonProperty("orderId")]
public int OrderId { get; set; }
}
}
2 changes: 1 addition & 1 deletion CentraSharp/Services/Order/CreateOrderResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public class CreateOrderResponse
/// Order
/// </summary>
[JsonProperty("orders")]
public List<int> Order { get; set; }
public List<string> Order { get; set; }
}
}
7 changes: 4 additions & 3 deletions CentraSharp/Services/Order/OrderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ public virtual async Task<CreateOrderResponse> CreateAsync(CreateOrderFilter ord
/// <param name="orderId">Id of the object being updated.</param>
/// <param name="comment"></param>
/// <returns>The updated <see cref="Order" />.</returns>
public virtual async Task<CompleteOrderResponse> CompleteOrderAsync(long orderId, string comment)
public virtual async Task<CompleteOrderResponse> CompleteOrderAsync(CompleteOrderFilter order)
{
var req = PrepareRequest($"order/{orderId}");
var content = new JsonContent(comment);
var req = PrepareRequest($"order/{order.OrderId}");
var body = order.ToDictionary();
var content = new JsonContent(body);
return await ExecuteRequestAsync<CompleteOrderResponse>(req, HttpMethod.Post, content);
}
}
Expand Down
14 changes: 13 additions & 1 deletion CentraSharp/Services/Return/CentraReturnResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ public class CentraReturnResponse
[JsonProperty("return")]
public int Return { get; set; }

/// <summary>
/// Return Completed
/// </summary>
[JsonProperty("returnCompleted")]
public bool ReturnCompleted { get; set; }

/// <summary>
/// ReturnedItems
/// </summary>
[JsonProperty("returnedItems")]
public List<string> ReturnedItems { get; set; }
public string[] ReturnedItems { get; set; }

/// <summary>
/// ReturnedItems
/// </summary>
[JsonProperty("refund")]
public Dictionary<string,string> Refund { get; set; }

/// <summary>
/// Msg
Expand Down
6 changes: 4 additions & 2 deletions CentraSharp/Services/Return/ReturnService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ public virtual async Task<CentraReturnResponse> CreateReturnAsync(CentraReturnOp
var req = PrepareRequest("return");
var content = new JsonContent(new
{
shipment = returnOptions.Shipment,
returnStock = returnOptions.ReturnStock,
comment = returnOptions.Comment,
products = returnOptions.Products,
returnStock = returnOptions.ReturnStock,
shipment = returnOptions.Shipment


});
return await ExecuteRequestAsync<CentraReturnResponse>(req, HttpMethod.Post, content);
}
Expand Down
6 changes: 6 additions & 0 deletions CentraSharp/Services/Shipment/CompleteShipmentFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ namespace PrimePenguin.CentraSharp.Services.Shipment
{
public class CompleteShipmentFilter : Parameterizable
{
/// <summary>
/// Order ID to which the shipment belongs.
/// </summary>
[JsonProperty("order")]
public int Order { get; set; }

/// <summary>
/// Shipment ID for the shipment to complete.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions CentraSharp/Services/Shipment/CreateShipmentOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CreateShipmentOptions : Parameterizable
/// Key is lineID from the Get orders response and value is the quantity.
/// </summary>
[JsonProperty("products")]
public Dictionary<string, int> Products { get; set; }
public Dictionary<string, int?> Products { get; set; }

/// <summary>
/// Default: true. Mark the shipment as sent.
Expand Down Expand Up @@ -58,7 +58,7 @@ public class CreateShipmentOptions : Parameterizable
/// Number of packages in shipment. Only used if shipped is true
/// </summary>
[JsonProperty("packages")]
public int Packages { get; set; }
public int? Packages { get; set; }


}
Expand Down
6 changes: 3 additions & 3 deletions CentraSharp/Services/Shipment/CreateUpdateShipmentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public class CreateUpdateShipmentResponse
public string Status { get; set; }

/// <summary>
/// Shipmentsf
/// Shipment Id
/// </summary>
[JsonProperty("shipment")]
public Entities.Shipment Shipment { get; set; }
public string Shipment { get; set; }

/// <summary>
/// If status returns no, this value should send back a message why it failed.
Expand Down Expand Up @@ -44,6 +44,6 @@ public class CreateUpdateShipmentResponse
/// URL to a PDF invoice for the shipment. Will only be set if an invoice exists
/// </summary>
[JsonProperty("invoice")]
public string Invoice { get; set; }
public string[] Invoice { get; set; }
}
}
2 changes: 1 addition & 1 deletion CentraSharp/Services/Shipment/ShipmentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public virtual async Task<ListShipment> ListShipmentAsync(GetShipmentFilter opti
/// <returns></returns>
public virtual async Task<CompleteShipmentResponse> CompleteShipmentAsync(CompleteShipmentFilter options)
{
var req = PrepareRequest($"shipments/{options.Shipment}");
var req = PrepareRequest("shipment");
var body = options.ToDictionary();
var json = Newtonsoft.Json.JsonConvert.SerializeObject(body);
var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
Expand Down