Skip to content

Commit

Permalink
* Changed LineItem's product_id to string from int
Browse files Browse the repository at this point in the history
* Added CC PaymentDetails token field
  • Loading branch information
Omri Mosseri committed Jun 5, 2016
1 parent efefe5d commit 1bb2d6d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Riskified.SDK.Sample/OrderTransmissionExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private static OrderCheckout GenerateOrderCheckout(string orderNum)

var items = new[]
{
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: 48484,sku: "1272727"),
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: "48484",sku: "1272727"),
new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3)
};

Expand Down Expand Up @@ -342,7 +342,8 @@ private static Order GenerateOrder(int orderNum)
cvvResultCode: "n",
creditCardBin: "124580",
creditCardCompany: "Visa",
creditCardNumber: "XXXX-XXXX-XXXX-4242");
creditCardNumber: "XXXX-XXXX-XXXX-4242",
creditCardToken: "2233445566778899");

var noChargeAmount = new NoChargeDetails(
refundId: "123444",
Expand Down Expand Up @@ -370,7 +371,7 @@ private static Order GenerateOrder(int orderNum)

var items = new[]
{
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: 48484,sku: "1272727",deliveredTo: DeliveredToType.StorePickup, delivered_at:new DateTime(2016, 12, 8, 14, 12, 12, DateTimeKind.Local)),
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: "48484", sku: "1272727",deliveredTo: DeliveredToType.StorePickup, delivered_at:new DateTime(2016, 12, 8, 14, 12, 12, DateTimeKind.Local)),
new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3, seller: new Seller(customer: customer,correspondence: 1, priceNegotiated: true, startingPrice: 120)),
// Events Tickets Industry
new LineItem(title: "Concert",
Expand Down Expand Up @@ -502,7 +503,7 @@ private static Order PayPalGenerateOrder(int orderNum)

var items = new[]
{
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: 48484,sku: "1272727"),
new LineItem(title: "Bag",price: 55.44,quantityPurchased: 1,productId: "48484", sku: "1272727"),
new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3)
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ public class CreditCardPaymentDetails : IPaymentDetails
/// <param name="creditCardBin">The issuer identification number (IIN), formerly known as bank identification number (BIN) ] of the customer's credit card. This is made up of the first few digits of the credit card number</param>
/// <param name="creditCardCompany">The name of the company who issued the customer's credit card</param>
/// <param name="creditCardNumber">The 4 last digits of the customer's credit card number, with most of the leading digits redacted with Xs</param>
public CreditCardPaymentDetails(string avsResultCode, string cvvResultCode, string creditCardBin, string creditCardCompany, string creditCardNumber)
public CreditCardPaymentDetails(string avsResultCode,
string cvvResultCode,
string creditCardBin,
string creditCardCompany,
string creditCardNumber,
string creditCardToken = null)
{
AvsResultCode = avsResultCode;
CvvResultCode = cvvResultCode;
CreditCardBin = creditCardBin;
CreditCardCompany = creditCardCompany;
CreditCardNumber = creditCardNumber;
CreditCardToken = creditCardToken;
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Riskified.SDK/Model/OrderElements/LineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public LineItem(string title,
int quantityPurchased,

//optional
int? productId = null,
string productId = null,
string sku = null,
string condition = null,
bool? requiresShipping = null,
Expand Down Expand Up @@ -106,9 +106,9 @@ public void Validate(Validations validationType = Validations.Weak)
InputValidators.ValidatePositiveValue(QuantityPurchased.Value, "Quantity Purchased");

// optional fields validations
if(ProductId.HasValue)
if(ProductId != null)
{
InputValidators.ValidateZeroOrPositiveValue(ProductId.Value, "Product Id");
InputValidators.ValidateValuedString(ProductId, "Product Id");
}

if(Seller != null)
Expand All @@ -133,7 +133,7 @@ public void Validate(Validations validationType = Validations.Weak)
/// The Product ID number
/// </summary>
[JsonProperty(PropertyName = "product_id")]
public int? ProductId { get; set; }
public string ProductId { get; set; }

/// <summary>
/// Quantity of the item that was purchased
Expand Down
4 changes: 2 additions & 2 deletions Riskified.SDK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.9")]
[assembly: AssemblyFileVersion("2.0.4.9")]
[assembly: AssemblyVersion("2.0.5.0")]
[assembly: AssemblyFileVersion("2.0.5.0")]

0 comments on commit 1bb2d6d

Please sign in to comment.