Example #1
0
 /// <summary>
 /// Validates the Order checkout object fields (All fields except merchendOrderId are optional)
 /// Sends a new order checkout to Riskified Servers (without Submit for analysis)
 /// </summary>
 /// <param name="order">The Order checkout to create</param>
 /// <returns>The order checkout notification result containing status,description and sent order id in case of successful transfer</returns>
 /// <exception cref="OrderFieldBadFormatException">On bad format of the order (missing fields data or invalid data)</exception>
 /// <exception cref="RiskifiedTransactionException">On errors with the transaction itself (network errors, bad response data)</exception>
 public OrderNotification Checkout(OrderCheckout orderCheckout)
 {
     return SendOrderCheckout(orderCheckout, HttpUtils.BuildUrl(_riskifiedBaseWebhookUrl, "/api/checkout_create"));
 }
        private static OrderCheckout GenerateOrderCheckout(string orderNum)
        {
            var orderCheckout = new OrderCheckout(orderNum);
            
            // Fill optional fields
            var customer = new Customer(
                firstName: "John",
                lastName: "Doe",
                id: "405050606",
                ordersCount: 4,
                email: "*****@*****.**",
                verifiedEmail: true,
                createdAt: new DateTime(2013, 12, 8, 14, 12, 12, DateTimeKind.Local), // make sure to initialize DateTime with the correct timezone
                notes: "No additional info");

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

            orderCheckout.Customer = customer;
            orderCheckout.LineItems = items;


            return orderCheckout;

        }