From f35d9caabb45028037c6613752103ff75ccdc7db Mon Sep 17 00:00:00 2001 From: Omri Mosseri Date: Tue, 20 Oct 2015 13:26:07 +0300 Subject: [PATCH] add customer phone and line item delivered to (erez) --- .../OrderTransmissionExample.cs | 3 ++- Riskified.SDK/Model/OrderElements/Customer.cs | 4 +++- .../Model/OrderElements/DeliveredToType.cs | 18 ++++++++++++++++++ Riskified.SDK/Model/OrderElements/LineItem.cs | 11 +++++++++-- Riskified.SDK/Properties/AssemblyInfo.cs | 4 ++-- Riskified.SDK/Riskified.SDK.csproj | 1 + 6 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 Riskified.SDK/Model/OrderElements/DeliveredToType.cs diff --git a/Riskified.SDK.Sample/OrderTransmissionExample.cs b/Riskified.SDK.Sample/OrderTransmissionExample.cs index c311e59..aa7a07f 100644 --- a/Riskified.SDK.Sample/OrderTransmissionExample.cs +++ b/Riskified.SDK.Sample/OrderTransmissionExample.cs @@ -296,7 +296,8 @@ private static Order GenerateOrder(int orderNum) email: "test@example.com", verifiedEmail: true, createdAt: new DateTime(2013, 12, 8, 14, 12, 12), - notes: "No additional info"); + notes: "No additional info", + phone: "55523369"); // putting sample billing details var billing = new AddressInformation( diff --git a/Riskified.SDK/Model/OrderElements/Customer.cs b/Riskified.SDK/Model/OrderElements/Customer.cs index 02293ee..9651138 100644 --- a/Riskified.SDK/Model/OrderElements/Customer.cs +++ b/Riskified.SDK/Model/OrderElements/Customer.cs @@ -20,7 +20,7 @@ public class Customer : IJsonSerializable /// Signs if the email was verified by the merchant is some way (optional) /// The time of creation of the customer card (optional) /// Additional notes regarding the customer (optional) - public Customer(string firstName, string lastName,string id, int? ordersCount = null,string email = null, bool? verifiedEmail = null, DateTime? createdAt = null, string notes = null, SocialDetails[] social = null) + public Customer(string firstName, string lastName, string id, int? ordersCount = null, string email = null, bool? verifiedEmail = null, DateTime? createdAt = null, string notes = null, SocialDetails[] social = null, string phone = null) { FirstName = firstName; LastName = lastName; @@ -104,6 +104,8 @@ public void Validate(Validations validationType = Validations.Weak) [JsonProperty(PropertyName = "buyer_anonymous_id")] public string AnonymousId { get; set; } + [JsonProperty(PropertyName = "phone")] + public string Phone { get; set; } } } diff --git a/Riskified.SDK/Model/OrderElements/DeliveredToType.cs b/Riskified.SDK/Model/OrderElements/DeliveredToType.cs new file mode 100644 index 0000000..d478b88 --- /dev/null +++ b/Riskified.SDK/Model/OrderElements/DeliveredToType.cs @@ -0,0 +1,18 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace Riskified.SDK.Model.OrderElements +{ + // Used on the line item level, the pickup location for that product + public enum DeliveredToType + { + [EnumMember(Value = "shipping_address")] + ShippingAddress, + [EnumMember(Value = "store_pickup")] + StorePickup + } +} diff --git a/Riskified.SDK/Model/OrderElements/LineItem.cs b/Riskified.SDK/Model/OrderElements/LineItem.cs index e7b1967..50e6405 100644 --- a/Riskified.SDK/Model/OrderElements/LineItem.cs +++ b/Riskified.SDK/Model/OrderElements/LineItem.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Riskified.SDK.Utils; using System; @@ -15,7 +16,7 @@ public class LineItem : IJsonSerializable /// The Product ID number (optional) /// The stock keeping unit of the product (optional) public LineItem(string title, double price, int quantityPurchased, int? productId = null, string sku = null, string condition = null, bool? requiresShipping = null, Seller seller = null, - string eventSubCategoryName = null, string eventName = null, string eventSectionName = null, DateTime? eventDate = null) + string eventSubCategoryName = null, string eventName = null, string eventSectionName = null, DateTime? eventDate = null, DeliveredToType deliveredTo = DeliveredToType.ShippingAddress) { Title = title; @@ -32,6 +33,7 @@ public LineItem(string title, double price, int quantityPurchased, int? productI EventName = eventName; EventSectionName = eventSectionName; EventDate = eventDate; + DeliveredTo = deliveredTo; } /// @@ -160,6 +162,11 @@ public void Validate(Validations validationType = Validations.Weak) [JsonProperty(PropertyName = "brand")] public string Brand { get; set; } + /// + /// The devlivered_to will tell us where is the customer would like to get the product + /// + [JsonProperty(PropertyName = "delivered_to")] + [JsonConverter(typeof(StringEnumConverter))] + public DeliveredToType DeliveredTo { get; set; } } - } diff --git a/Riskified.SDK/Properties/AssemblyInfo.cs b/Riskified.SDK/Properties/AssemblyInfo.cs index 92a3a14..7fe61e1 100644 --- a/Riskified.SDK/Properties/AssemblyInfo.cs +++ b/Riskified.SDK/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.3.10")] -[assembly: AssemblyFileVersion("2.0.3.10")] +[assembly: AssemblyVersion("2.0.3.11")] +[assembly: AssemblyFileVersion("2.0.3.11")] diff --git a/Riskified.SDK/Riskified.SDK.csproj b/Riskified.SDK/Riskified.SDK.csproj index d730ff7..579c8f9 100644 --- a/Riskified.SDK/Riskified.SDK.csproj +++ b/Riskified.SDK/Riskified.SDK.csproj @@ -49,6 +49,7 @@ +