Skip to content

Commit abc7aac

Browse files
authored
Merge pull request #149 from ordercloud-api/dev
Updates for latest api version
2 parents 7edeb2f + 275ad8c commit abc7aac

10 files changed

Lines changed: 87 additions & 136 deletions

File tree

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/NEW_TASK.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/OrderCloud.SDK/Generated/ErrorCodes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ public static class Promotion
671671
public const string ExpirationPrecedsStart = "Promotion.ExpirationPrecedsStart";
672672
/// <summary>Promotion is expired.</summary>
673673
public const string Expired = "Promotion.Expired";
674-
/// <summary>Promotion cannot be used on this order.</summary>
674+
/// <summary>Order does not meet eligibility requirements for this promotion.</summary>
675675
public const string NotEligible = "Promotion.NotEligible";
676676
/// <summary>Promotion is not yet valid.</summary>
677677
public const string NotYetValid = "Promotion.NotYetValid";

src/OrderCloud.SDK/Generated/Models.cs

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ public class AccessTokenBasic : OrderCloudModel
3737
/// <summary>Access token of the access token basic.</summary>
3838
public string access_token { get => GetProp<string>("access_token"); set => SetProp<string>("access_token", value); }
3939
}
40+
public class AddedPromo : OrderCloudModel
41+
{
42+
/// <summary>ID of the added promo. Can only contain characters Aa-Zz, 0-9, -, and _.</summary>
43+
public string ID { get => GetProp<string>("ID"); set => SetProp<string>("ID", value); }
44+
/// <summary>ID of the line item. Can only contain characters Aa-Zz, 0-9, -, and _.</summary>
45+
public string LineItemID { get => GetProp<string>("LineItemID"); set => SetProp<string>("LineItemID", value); }
46+
/// <summary>Amount of the added promo.</summary>
47+
public decimal Amount { get => GetProp<decimal>("Amount"); set => SetProp<decimal>("Amount", value); }
48+
}
4049
public class Address : OrderCloudModel
4150
{
4251
/// <summary>ID of the address. Can only contain characters Aa-Zz, 0-9, -, and _. Searchable: priority level 1. Sortable: priority level 2.</summary>
@@ -1027,13 +1036,16 @@ public class ExtendedOrder : OrderCloudModel
10271036
public decimal TaxCost { get => GetProp<decimal>("TaxCost"); set => SetProp<decimal>("TaxCost", value); }
10281037
/// <summary>Gratuity of the extended order. Must be at least 0. Sortable.</summary>
10291038
public decimal Gratuity { get => GetProp<decimal>("Gratuity", 0); set => SetProp<decimal>("Gratuity", value); }
1039+
/// <summary>Fees associated with order or line items</summary>
1040+
[ApiReadOnly]
1041+
public decimal Fees { get => GetProp<decimal>("Fees", 0); set => SetProp<decimal>("Fees", value); }
10301042
/// <summary>Sum of all Promotion.Amounts applied to the order.</summary>
10311043
[ApiReadOnly]
10321044
public decimal PromotionDiscount { get => GetProp<decimal>("PromotionDiscount"); set => SetProp<decimal>("PromotionDiscount", value); }
10331045
/// <summary>Inherited from the user placing the order.</summary>
10341046
[ApiReadOnly]
10351047
public string Currency { get => GetProp<string>("Currency"); set => SetProp<string>("Currency", value); }
1036-
/// <summary>Subtotal + TaxCost + ShippingCost + Gratuity - PromotionDiscount</summary>
1048+
/// <summary>Subtotal + TaxCost + ShippingCost + Gratuity + Fees - PromotionDiscount</summary>
10371049
[ApiReadOnly]
10381050
public decimal Total { get => GetProp<decimal>("Total"); set => SetProp<decimal>("Total", value); }
10391051
/// <summary>True if this Order has been passed from the Buyer to the Marketplace Owner.</summary>
@@ -1771,13 +1783,16 @@ public class Order : OrderCloudModel
17711783
public decimal TaxCost { get => GetProp<decimal>("TaxCost"); set => SetProp<decimal>("TaxCost", value); }
17721784
/// <summary>Gratuity of the order. Must be at least 0. Sortable.</summary>
17731785
public decimal Gratuity { get => GetProp<decimal>("Gratuity", 0); set => SetProp<decimal>("Gratuity", value); }
1786+
/// <summary>Fees associated with order or line items</summary>
1787+
[ApiReadOnly]
1788+
public decimal Fees { get => GetProp<decimal>("Fees", 0); set => SetProp<decimal>("Fees", value); }
17741789
/// <summary>Sum of all Promotion.Amounts applied to the order.</summary>
17751790
[ApiReadOnly]
17761791
public decimal PromotionDiscount { get => GetProp<decimal>("PromotionDiscount"); set => SetProp<decimal>("PromotionDiscount", value); }
17771792
/// <summary>Inherited from the user placing the order.</summary>
17781793
[ApiReadOnly]
17791794
public string Currency { get => GetProp<string>("Currency"); set => SetProp<string>("Currency", value); }
1780-
/// <summary>Subtotal + TaxCost + ShippingCost + Gratuity - PromotionDiscount</summary>
1795+
/// <summary>Subtotal + TaxCost + ShippingCost + Gratuity + Fees - PromotionDiscount</summary>
17811796
[ApiReadOnly]
17821797
public decimal Total { get => GetProp<decimal>("Total"); set => SetProp<decimal>("Total", value); }
17831798
/// <summary>True if this Order has been passed from the Buyer to the Marketplace Owner.</summary>
@@ -1872,6 +1887,8 @@ public class OrderCalculateResponse : OrderCloudModel
18721887
public decimal? ShippingTotal { get => GetProp<decimal?>("ShippingTotal"); set => SetProp<decimal?>("ShippingTotal", value); }
18731888
/// <summary>Tax total of the order calculate response.</summary>
18741889
public decimal? TaxTotal { get => GetProp<decimal?>("TaxTotal"); set => SetProp<decimal?>("TaxTotal", value); }
1890+
/// <summary>Fee total of the order calculate response.</summary>
1891+
public decimal? FeeTotal { get => GetProp<decimal?>("FeeTotal"); set => SetProp<decimal?>("FeeTotal", value); }
18751892
/// <summary>Http status code of the order calculate response.</summary>
18761893
public int? HttpStatusCode { get => GetProp<int?>("HttpStatusCode"); set => SetProp<int?>("HttpStatusCode", value); }
18771894
/// <summary>Unhandled error body of the order calculate response.</summary>
@@ -1997,7 +2014,7 @@ public class OrderReturn : OrderCloudModel
19972014
/// <summary>Last updated of the order return. Sortable.</summary>
19982015
[ApiReadOnly]
19992016
public DateTimeOffset LastUpdated { get => GetProp<DateTimeOffset>("LastUpdated"); set => SetProp<DateTimeOffset>("LastUpdated", value); }
2000-
/// <summary>Refund amount of the order return.</summary>
2017+
/// <summary>Sum of all RefundAmounts for Items. This value can be overridden by a user with the OrderAdmin role. To remove the override set the value to null.</summary>
20012018
public decimal? RefundAmount { get => GetProp<decimal?>("RefundAmount"); set => SetProp<decimal?>("RefundAmount", value); }
20022019
/// <summary>Comments of the order return. Max length 2000 characters.</summary>
20032020
public string Comments { get => GetProp<string>("Comments"); set => SetProp<string>("Comments", value); }
@@ -2799,6 +2816,24 @@ public class PromotionOverride : OrderCloudModel
27992816
/// <summary>Overrides the promotion's calculated discount to this amount.</summary>
28002817
public decimal Amount { get => GetProp<decimal>("Amount"); set => SetProp<decimal>("Amount", value); }
28012818
}
2819+
public class RefreshPromosResponse : OrderCloudModel
2820+
{
2821+
/// <summary>Promotions that were auto-applied.</summary>
2822+
public IList<AddedPromo> PromosAdded { get => GetProp<IList<AddedPromo>>("PromosAdded", new List<AddedPromo>()); set => SetProp<IList<AddedPromo>>("PromosAdded", value); }
2823+
/// <summary>Promotions that were removed due to ineligibility or other reason.</summary>
2824+
public IList<RemovedPromo> PromosRemoved { get => GetProp<IList<RemovedPromo>>("PromosRemoved", new List<RemovedPromo>()); set => SetProp<IList<RemovedPromo>>("PromosRemoved", value); }
2825+
}
2826+
public class RemovedPromo : OrderCloudModel
2827+
{
2828+
/// <summary>Error code of the removed promo.</summary>
2829+
public string ErrorCode { get => GetProp<string>("ErrorCode"); set => SetProp<string>("ErrorCode", value); }
2830+
/// <summary>ID of the removed promo. Can only contain characters Aa-Zz, 0-9, -, and _.</summary>
2831+
public string ID { get => GetProp<string>("ID"); set => SetProp<string>("ID", value); }
2832+
/// <summary>ID of the line item. Can only contain characters Aa-Zz, 0-9, -, and _.</summary>
2833+
public string LineItemID { get => GetProp<string>("LineItemID"); set => SetProp<string>("LineItemID", value); }
2834+
/// <summary>Reason of the removed promo.</summary>
2835+
public string Reason { get => GetProp<string>("Reason"); set => SetProp<string>("Reason", value); }
2836+
}
28022837
public class SearchIngestion : OrderCloudModel
28032838
{
28042839
/// <summary>Domain of the search ingestion. Required.</summary>

src/OrderCloud.SDK/Generated/Resources.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,12 +1048,15 @@ public interface ICartResource
10481048
/// <param name="promoCode">Promo code of the cart.</param>
10491049
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
10501050
Task DeletePromotionAsync(string promoCode, string accessToken = null);
1051-
/// <summary>AutoApply eligible promotions. Apply up to 100 eligible promotions to the cart.</summary>
1051+
/// <summary>Auto-apply promotions to the cart. Apply up to 100 eligible promotions where AutoApply=true.</summary>
10521052
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
10531053
Task<Order> ApplyPromotionsAsync(string accessToken = null);
1054-
/// <summary>AutoApply eligible promotions. Apply up to 100 eligible promotions to the cart.</summary>
1054+
/// <summary>Auto-apply promotions to the cart. Apply up to 100 eligible promotions where AutoApply=true.</summary>
10551055
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
10561056
Task<TOrder> ApplyPromotionsAsync<TOrder>(string accessToken = null) where TOrder : Order;
1057+
/// <summary>Refresh promotions on the cart. Re-calculates promotion discounts, removes promotions that are no longer valid, and adds eligible promotions where AutoApply=true (up to limit of 100)</summary>
1058+
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
1059+
Task<RefreshPromosResponse> RefreshPromotionsAsync(string accessToken = null);
10571060
/// <summary>Update cart FromUser. Only FirstName, LastName, and Email can be updated. Primarily used to facilitate guest checkout scenarios.</summary>
10581061
/// <param name="partialUser">The object that will be partially serialized to JSON and sent in the request body.</param>
10591062
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
@@ -4505,16 +4508,21 @@ public interface IOrdersResource
45054508
/// <param name="promoCode">Promo code of the order.</param>
45064509
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
45074510
Task<TOrder> RemovePromotionAsync<TOrder>(OrderDirection direction, string orderID, string promoCode, string accessToken = null) where TOrder : Order;
4508-
/// <summary>AutoApply eligible promotions. Apply up to 100 eligible promotions to an order.</summary>
4511+
/// <summary>Auto-apply promotions to an order. Apply up to 100 eligible promotions where AutoApply=true.</summary>
45094512
/// <param name="direction">Direction of the order, from the current user's perspective. Possible values: incoming, outgoing, all.</param>
45104513
/// <param name="orderID">ID of the order.</param>
45114514
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
45124515
Task<Order> ApplyPromotionsAsync(OrderDirection direction, string orderID, string accessToken = null);
4513-
/// <summary>AutoApply eligible promotions. Apply up to 100 eligible promotions to an order.</summary>
4516+
/// <summary>Auto-apply promotions to an order. Apply up to 100 eligible promotions where AutoApply=true.</summary>
45144517
/// <param name="direction">Direction of the order, from the current user's perspective. Possible values: incoming, outgoing, all.</param>
45154518
/// <param name="orderID">ID of the order.</param>
45164519
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
45174520
Task<TOrder> ApplyPromotionsAsync<TOrder>(OrderDirection direction, string orderID, string accessToken = null) where TOrder : Order;
4521+
/// <summary>Refresh promotions on an order. Re-calculates promotion discounts, removes promotions that are no longer valid, and adds eligible promotions where AutoApply=true (up to limit of 100)</summary>
4522+
/// <param name="direction">Direction of the order, from the current user's perspective. Possible values: incoming, outgoing, all.</param>
4523+
/// <param name="orderID">ID of the order.</param>
4524+
/// <param name="accessToken">Optional. Use to provide an existing token instead of authenticating implicitly.</param>
4525+
Task<RefreshPromosResponse> RefreshPromotionsAsync(OrderDirection direction, string orderID, string accessToken = null);
45184526
/// <summary>Validate an order in its current state.</summary>
45194527
/// <param name="direction">Direction of the order, from the current user's perspective. Possible values: incoming, outgoing, all.</param>
45204528
/// <param name="orderID">ID of the order.</param>
@@ -7081,6 +7089,7 @@ internal CartResource(OrderCloudClient client) : base(client) { }
70817089
public Task DeletePromotionAsync(string promoCode, string accessToken = null) => Request("v1", "cart", "promotions", promoCode).WithOAuthBearerToken(accessToken).DeleteAsync();
70827090
public Task<Order> ApplyPromotionsAsync(string accessToken = null) => ApplyPromotionsAsync<Order>(accessToken);
70837091
public Task<TOrder> ApplyPromotionsAsync<TOrder>(string accessToken = null) where TOrder : Order => Request("v1", "cart", "applypromotions").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson<TOrder>();
7092+
public Task<RefreshPromosResponse> RefreshPromotionsAsync(string accessToken = null) => Request("v1", "cart", "refreshpromotions").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson<RefreshPromosResponse>();
70847093
public Task<Order> PatchFromUserAsync(PartialUser partialUser, string accessToken = null) => PatchFromUserAsync<Order>(partialUser, accessToken);
70857094
public Task<TOrder> PatchFromUserAsync<TOrder>(PartialUser partialUser, string accessToken = null) where TOrder : Order => Request("v1", "cart", "fromuser").WithOAuthBearerToken(accessToken).PatchJsonAsync(ValidateModel(partialUser)).ReceiveJson<TOrder>();
70867095
public Task<ListPage<Payment>> ListPaymentsAsync(string search = null, string searchOn = null, string sortBy = null, int page = 1, int pageSize = 20, object filters = null, string accessToken = null) => ListPaymentsAsync<Payment>(search, searchOn, sortBy, page, pageSize, filters, accessToken);
@@ -7763,6 +7772,7 @@ internal OrdersResource(OrderCloudClient client) : base(client) { }
77637772
public Task<TOrder> RemovePromotionAsync<TOrder>(OrderDirection direction, string orderID, string promoCode, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction, orderID, "promotions", promoCode).WithOAuthBearerToken(accessToken).DeleteAsync().ReceiveJson<TOrder>();
77647773
public Task<Order> ApplyPromotionsAsync(OrderDirection direction, string orderID, string accessToken = null) => ApplyPromotionsAsync<Order>(direction, orderID, accessToken);
77657774
public Task<TOrder> ApplyPromotionsAsync<TOrder>(OrderDirection direction, string orderID, string accessToken = null) where TOrder : Order => Request("v1", "orders", direction, orderID, "applypromotions").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson<TOrder>();
7775+
public Task<RefreshPromosResponse> RefreshPromotionsAsync(OrderDirection direction, string orderID, string accessToken = null) => Request("v1", "orders", direction, orderID, "refreshpromotions").WithOAuthBearerToken(accessToken).PostAsync(null).ReceiveJson<RefreshPromosResponse>();
77667776
public Task ValidateAsync(OrderDirection direction, string orderID, string accessToken = null) => Request("v1", "orders", direction, orderID, "validate").WithOAuthBearerToken(accessToken).PostAsync(null);
77677777
}
77687778

0 commit comments

Comments
 (0)