Example #1
0
        /// <summary>
        /// Returns the price of the current Order combined.
        /// Use this instead of place() when testing.
        /// </summary>
        /// <param name="card">The Payment.CreditCard object to pay with.</param>
        public JObject payWith(Payment.CreditCard card)
        {
            // Get the price to check that everything worked okay
            JObject response = send(URLs.priceURL(store.country), true);

            // Throw an exception if we messed up.
            if (response["Status"].ToString() == "-1")
            {
                throw new Exception("Dominos returned -1 due to order being, \"" + errorReason(response["Order"]) + "\" | Response: " + response.ToString());
            }

            data["Payments"] = new JArray
            {
                new JObject
                {
                    { "Type", "CreditCard" },
                    { "Expiration", card.expirationDate },
                    { "Amount", double.Parse(response["Order"]["Amounts"]["Customer"].ToString()) },
                    { "CardType", card.cardType.ToString().ToUpper() },
                    { "Number", long.Parse(card.number) },
                    { "SecurityCode", long.Parse(card.cvv) },
                    { "PostalCode", long.Parse(card.zip) }
                }
            };

            return(response);
        }
Example #2
0
        /// <summary>
        /// This *hopefully* places an Order to Dominos.
        /// Not really sure if this works, not really going to pay.
        /// This requires testing.
        /// </summary>
        /// <param name="creditCard">The credit card one is paying with. null if paying in cash.</param>
        public JObject placeOrder(Payment.CreditCard creditCard)
        {
            if (creditCard.cardType == Payment.CreditCard.CreditCardType.MAX)
            {
                throw new Exception("Credit Card is not a valid type!");
            }
            if (creditCard == null)
            {
                payWith();
            }
            else
            {
                payWith(creditCard);
            }
            JObject response = send(URLs.placeURL(store.country), false);

            if (response["Status"].ToString() == "-1")
            {
                throw new Exception("Dominos returned -1 due to order being, \"" + errorReason(response["Order"]) + "\" | Response: " + response.ToString());
            }

            return(response);
        }
Example #3
0
 /// <summary>
 /// Hopefully places an order from our Store using the Order and CreditCard
 /// </summary>
 /// <param name="order">The order we place</param>
 /// <param name="card">The card to pay with (null if using cash)</param>
 public void placeOrder(Order order, Payment.CreditCard card)
 {
     order.placeOrder(card);
 }