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); }
public static String getPaymentString(OrderCheckout o) { if (o == OrderCheckout.CASH) { return("Dinheiro"); } if (o == OrderCheckout.CHECK) { return("Dinheiro"); } if (o == OrderCheckout.CREDIT_CARD) { return("Cartão De Crédito"); } if (o == OrderCheckout.MBWAY) { return("MB WAY"); } if (o == OrderCheckout.PAYPAL) { return("PAYPAL"); } return(""); }
private static OrderCheckout GenerateAdviseOrderCheckout(string orderNum) { var orderCheckout = new OrderCheckout(orderNum); var address = new AddressInformation( firstName: "Ben", lastName: "Rolling", address1: "27 5th avenue", city: "Manhattan", country: "United States", countryCode: "US", phone: "5554321234", address2: "Appartment 5", zipCode: "54545", province: "New York", provinceCode: "NY", company: "IBM", fullName: "Ben Philip Rolling"); AuthenticationResult ar = new AuthenticationResult("05"); var payments = new[] { new CreditCardPaymentDetails( avsResultCode: "Y", cvvResultCode: "n", creditCardBin: "124580", creditCardCompany: "Visa", creditCardNumber: "XXXX-XXXX-XXXX-4242", creditCardToken: "2233445566778899" ) { AuthenticationResult = ar } }; var lines = new[] { new ShippingLine(price: 22.22, title: "Mail") }; // This is an example for client details section var clientDetails = new ClientDetails( accept_language: "en-CA", user_agent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" ); // 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) }; var discountCodes = new[] { new DiscountCode(moneyDiscountSum: 7, code: "1") }; orderCheckout.Email = "*****@*****.**"; orderCheckout.Currency = "USD"; orderCheckout.UpdatedAt = DateTime.Now; // make sure to initialize DateTime with the correct timezone orderCheckout.Gateway = "authorize_net"; orderCheckout.CustomerBrowserIp = "165.12.1.1"; orderCheckout.TotalPrice = 100.60; orderCheckout.CartToken = "a68778783ad298f1c80c3bafcddeea02f"; orderCheckout.ReferringSite = "nba.com"; orderCheckout.LineItems = items; orderCheckout.DiscountCodes = discountCodes; orderCheckout.ShippingLines = lines; orderCheckout.PaymentDetails = payments; orderCheckout.Customer = customer; orderCheckout.BillingAddress = address; orderCheckout.ShippingAddress = address; orderCheckout.ClientDetails = clientDetails; return(orderCheckout); }
private void PresentSelectionMenu() { Console.WriteLine("============================================================================="); Console.WriteLine("============================= WAG MAIN MENU ================================="); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine("(A) ADD AN ITEM TO YOUR ORDER "); Console.WriteLine("(D) DISPLAY YOUR CURRENT ORDER "); Console.WriteLine("(R) REMOVE AN ITEM FROM YOUR ORDER"); Console.WriteLine("(C) CONFIRM ORDER AND CHECKOUT"); Console.WriteLine("(X) CANCEL ORDER AND EXIT"); Console.WriteLine(); Console.Write("PLEASE MAKE A SELECTION AND THEN PRESS \"ENTER\": "); string userChoice = Console.ReadLine(); //Get a selection from the customer //Customer may Add an item, Display the current order, Remove an item, // Proceed to customer checkout, or Cancel the order and exit switch (userChoice.ToUpper()) { case "A": // Code to Add a new product to the Order Form Console.Clear(); displayCatalogTitle(); presentProducts(); getUserCatalogChoice(); break; case "D": // Code to Display the Order Form displayOrderFormTitle(); printItAll(); Console.WriteLine("PRESS ANY KEY TO CONTINUE..."); Console.ReadKey(); Console.Clear(); PresentSelectionMenu(); break; case "R": // Code to remove the item from the list printItAll(); Console.WriteLine(); Console.WriteLine("ARE YOU SURE YOU WISH TO REMOVE AN ITEM FROM YOUR ORDER?"); Console.Write("(Y) YES -or- PRESS ANY OTHER KEY TO CANCEL, AND THEN PRESS \"ENTER\": "); string removeAnswer = Console.ReadLine(); if (removeAnswer.ToUpper() == "Y") { Console.WriteLine("WHICH LINE ITEM NUMBER WOULD YOU LIKE TO REMOVE?"); string removeLine = Console.ReadLine(); ///Make sure it is a number first! int check = 0; //Get a selection from the customer //if the user entry is not a number while (!Int32.TryParse(removeLine, out check)) { Console.WriteLine("PLEASE SELECT A LINE ITEM NUMBER TO REMOVE: "); userChoice = Console.ReadLine(); } int lineItem = Math.Abs(check); if ((lineItem > WagCustomerTypeAndOrder.MasterOrderForm.Count) || (check <= 0)) { Console.WriteLine("THE LINE ITEM YOU ENTERED COULD NOT BE FOUND."); Console.WriteLine("PRESS ANY KEY TO CONTINUE..."); Console.ReadKey(); Console.Clear(); PresentSelectionMenu(); } else { Console.WriteLine("ARE YOU SURE YOU WISH TO REMOVE LINE ITEM #" + lineItem + "?"); Console.Write("(Y) YES -or- PRESS ANY OTHER KEY TO CANCEL, AND THEN PRESS \"ENTER\": "); string confirmRemoval = Console.ReadLine().ToUpper(); if (confirmRemoval == "Y") { WagCustomerTypeAndOrder.MasterOrderForm.RemoveAt(lineItem - 1); Console.Clear(); displayOrderFormTitle(); printItAll(); Console.WriteLine("PRESS ANY KEY TO CONTINUE..."); Console.ReadKey(); Console.Clear(); PresentSelectionMenu(); } else { Console.Clear(); PresentSelectionMenu(); } } } else { Console.Clear(); PresentSelectionMenu(); } break; case "C": // Code to Proceed to Checkout OrderCheckout myorderCheckout = new OrderCheckout(); break; case "X": // Code to Cancel the order and Exit Console.WriteLine(); Console.WriteLine("ARE YOU SURE YOU WISH TO CANCEL YOUR ORDER AND EXIT?"); Console.Write("(Y) YES -or- PRESS ANY OTHER KEY TO CANCEL, AND THEN PRESS \"ENTER\": "); string exitAnswer = Console.ReadLine(); if (exitAnswer.ToUpper() == "Y") { Environment.Exit(0); } else { Console.Clear(); PresentSelectionMenu(); } break; default: // Code to execute if no proper selection was made. Console.Clear(); PresentSelectionMenu(); break; } }
/* * Advise API to support PSD2 */ public OrderNotification Advise(OrderCheckout orderCheckout) { return(SendOrderCheckout(orderCheckout, HttpUtils.BuildUrl(_env, "/api/advise"))); }
/// <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(_env, "/api/checkout_create"))); }
/// <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"))); }