Skip to content

Commit 5efb063

Browse files
authored
Merge pull request #60 from rich-spitkovsky-riskified/policy-abuse
TIS-252: add support for policy object
2 parents 813b904 + 66e7ec4 commit 5efb063

11 files changed

+43
-9
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
sdk_net
22
=======
33

4+
version: 2.1.2.9
5+
-----------------
6+
47
An implementation of the Riskified API in C# for .NET
58
Refer to the [documentation](http://apiref.riskified.com) for more details.
69

Riskified.SDK/Model/OrderElements/AccommodationLineItem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public AccommodationLineItem(
2727
Seller seller = null,
2828
DeliveredToType? deliveredTo = null,
2929
DateTime? deliveredAt = null,
30+
Policy policy = null,
3031
// accommodation specific
3132
string roomType = null,
3233
string city = null,
@@ -39,7 +40,7 @@ public AccommodationLineItem(
3940
string accommodationType = null
4041
) : base(title: title, price: price, quantityPurchased: quantityPurchased, productId: productId, sku: sku, condition: condition,
4142
requiresShipping: requiresShipping, seller: seller, deliveredTo: deliveredTo, delivered_at: deliveredAt,
42-
category: category, subCategory: subCategory, brand: brand, productType: OrderElements.ProductType.Accommodation)
43+
category: category, subCategory: subCategory, brand: brand, productType: OrderElements.ProductType.Accommodation, policy: policy)
4344
{
4445
RoomType = roomType;
4546
City = city;

Riskified.SDK/Model/OrderElements/DigitalLineItem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public DigitalLineItem(
2525
Seller seller = null,
2626
DeliveredToType? deliveredTo = null,
2727
DateTime? deliveredAt = null,
28+
Policy policy = null,
2829

2930
// giftcard specific
3031
string senderName = null,
@@ -43,7 +44,7 @@ public DigitalLineItem(
4344
condition: condition,
4445
requiresShipping: requiresShipping, seller: seller, deliveredTo: deliveredTo, delivered_at: deliveredAt,
4546
category: category, subCategory: subCategory, brand: brand,
46-
productType: OrderElements.ProductType.Digital)
47+
productType: OrderElements.ProductType.Digital, policy: policy)
4748
{
4849
SenderName = senderName;
4950
DisplayName = displayName;

Riskified.SDK/Model/OrderElements/DiscountCode.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ public class DiscountCode : IJsonSerializable
1010
/// </summary>
1111
/// <param name="moneyDiscountSum">The amount of money (in the currency specified in the order) that was discounted (optional) </param>
1212
/// <param name="code">The discount code (optional) </param>
13-
public DiscountCode(double? moneyDiscountSum = null, string code = null)
13+
public DiscountCode(double? moneyDiscountSum = null, string code = null, Policy policy = null)
1414
{
1515
MoneyDiscountSum = moneyDiscountSum;
1616
Code = code;
17+
Policy = policy;
1718
}
1819

1920
/// <summary>
@@ -32,7 +33,10 @@ public void Validate(Validations validationType = Validations.Weak)
3233
[JsonProperty(PropertyName = "code")]
3334
public string Code { get; set; }
3435

35-
36+
[JsonProperty(PropertyName = "policy")]
37+
public Policy Policy { get; set; }
38+
39+
3640
}
3741

3842
}

Riskified.SDK/Model/OrderElements/EventTicketLineItem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public EventTicketLineItem(
2525
Seller seller = null,
2626
DeliveredToType? deliveredTo = null,
2727
DateTime? deliveredAt = null,
28+
Policy policy = null,
2829
// event ticket specific
2930
string section = null,
3031
DateTime? eventDate = null,
@@ -37,7 +38,7 @@ public EventTicketLineItem(
3738
condition: condition,
3839
requiresShipping: requiresShipping, seller: seller, deliveredTo: deliveredTo, delivered_at: deliveredAt,
3940
category: category, subCategory: subCategory, brand: brand,
40-
productType: OrderElements.ProductType.EventTicket)
41+
productType: OrderElements.ProductType.EventTicket, policy: policy)
4142
{
4243
Section = section;
4344
EventDate = eventDate;

Riskified.SDK/Model/OrderElements/LineItem.cs

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public LineItem(string title,
3131
string brand = null,
3232
string category = null,
3333
string subCategory = null,
34+
Policy policy = null,
3435
RegistryType? registryType = null)
3536
{
3637

@@ -50,6 +51,7 @@ public LineItem(string title,
5051
SubCategory = subCategory;
5152
DeliveredAt = delivered_at;
5253
Brand = brand;
54+
Policy = policy;
5355
RegistryType = registryType;
5456
}
5557

@@ -160,6 +162,9 @@ public virtual void Validate(Validations validationType = Validations.Weak)
160162
[JsonProperty(PropertyName = "delivered_at")]
161163
public DateTime? DeliveredAt { get; set; }
162164

165+
[JsonProperty(PropertyName = "policy")]
166+
public Policy Policy { get; set; }
167+
163168

164169
[JsonProperty(PropertyName = "registry_type")]
165170
[JsonConverter(typeof (StringEnumConverter))]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
using Riskified.SDK.Utils;
3+
4+
namespace Riskified.SDK.Model.OrderElements
5+
{
6+
public class Policy
7+
{
8+
public Policy(bool? evaluate)
9+
{
10+
Evaluate = evaluate;
11+
}
12+
13+
[JsonProperty(PropertyName = "evaluate")]
14+
public bool? Evaluate { get; set; }
15+
}
16+
}

Riskified.SDK/Model/OrderElements/RideTicketLineItem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public RideTicketLineItem(
2626
Seller seller = null,
2727
DeliveredToType? deliveredTo = null,
2828
DateTime? deliveredAt = null,
29+
Policy policy = null,
2930
// ride item specific
3031
DateTime? pickupDate = null,
3132
float? pickupLatitude = null,
@@ -52,7 +53,7 @@ public RideTicketLineItem(
5253
condition: condition,
5354
requiresShipping: requiresShipping, seller: seller, deliveredTo: deliveredTo, delivered_at: deliveredAt,
5455
category: category, subCategory: subCategory, brand: brand,
55-
productType: OrderElements.ProductType.RideTicket)
56+
productType: OrderElements.ProductType.RideTicket, policy: policy)
5657
{
5758
PickupDate = pickupDate;
5859
PickupLatitude = pickupLatitude;

Riskified.SDK/Model/OrderElements/TravelTicketLineItem.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public TravelTicketLineItem(
2626
Seller seller = null,
2727
DeliveredToType? deliveredTo = null,
2828
DateTime? deliveredAt = null,
29+
Policy policy = null,
2930
// travel ticket specific
3031
string legId = null,
3132
string departurePortCode = null,
@@ -47,7 +48,7 @@ public TravelTicketLineItem(
4748
condition: condition,
4849
requiresShipping: requiresShipping, seller: seller, deliveredTo: deliveredTo, delivered_at: deliveredAt,
4950
category: category, subCategory: subCategory, brand: brand,
50-
productType: OrderElements.ProductType.TravelTicket)
51+
productType: OrderElements.ProductType.TravelTicket, policy: policy)
5152
{
5253
LegId = legId;
5354
DeparturePortCode = departurePortCode;

Riskified.SDK/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.1.2.8")]
35-
[assembly: AssemblyFileVersion("2.1.2.8")]
34+
[assembly: AssemblyVersion("2.1.2.9")]
35+
[assembly: AssemblyFileVersion("2.1.2.9")]

Riskified.SDK/Riskified.SDK.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<Compile Include="Model\OrderElements\RideTicketLineItem.cs" />
140140
<Compile Include="Model\OrderCheckoutElements\AuthenticationType.cs" />
141141
<Compile Include="Model\OrderCheckoutElements\AuthenticationResult.cs" />
142+
<Compile Include="Model\OrderElements\Policy.cs" />
142143
</ItemGroup>
143144
<ItemGroup>
144145
<None Include="packages.config" />

0 commit comments

Comments
 (0)