예제 #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);
        }
예제 #2
0
        /// <summary>
        /// Returns the price of the current Order combined.
        /// Use this instead of place() when testing
        /// </summary>
        public JObject payWith()
        {
            // 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", "Cash" }
                }
            };
            return(response);
        }