Exemple #1
0
        public void GetMerchantOrderDetails()
        {
            ClientModuleIntegrationTestingUtilities.RemoveAnyGiftCardCreditOnConsumerUserAccount();

            IQueryMerchantData queryClient = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <IQueryMerchantData>();

            var ordered = ClientModuleIntegrationTestingUtilities.PlaceOrderAtTestMerchantWithTestConsumer(1000);

            var queriedOrderDetails = queryClient.GetMerchantOrderDetails(
                ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken,
                LevelUpTestConfiguration.Current.MerchantId,
                ordered.OrderIdentifier);

            Assert.AreEqual(queriedOrderDetails.OrderIdentifier, ordered.OrderIdentifier);
            Assert.AreEqual(queriedOrderDetails.SpendAmount, ordered.SpendAmount);
            Assert.AreEqual(queriedOrderDetails.TipAmount, ordered.TipAmount);
            Assert.AreEqual(queriedOrderDetails.Total, ordered.Total);
        }
Exemple #2
0
        public void GetMerchantOrderDetailsShouldSucceed()
        {
            const int    merchantId         = 34;
            const string uuid               = "123b75b0806011e29e960800200c9a66";
            string       expectedRequestUrl = string.Format(ClientModuleFunctionalTestingUtilities.SANDBOX_URL_PREFIX + "/v15/merchants/{0}/orders/{1}", merchantId, uuid);

            RestResponse expectedResponse = new RestResponse
            {
                StatusCode = HttpStatusCode.OK,
                Content    = string.Format("{{" +
                                           "\"order\": {{" +
                                           "\"cashier\": \"Andrew Jones\"," +
                                           "\"created_at\": \"2014-12-17T11:24:26-05:00\"," +
                                           "\"identifier_from_merchant\": \"1001\"," +
                                           "\"location_id\": 5698," +
                                           "\"loyalty_id\": 633172," +
                                           "\"refunded_at\": null," +
                                           "\"register\": \"3\"," +
                                           "\"transacted_at\": \"2014-12-17T11:24:26-05:00\"," +
                                           "\"user_display_name\": \"Test U.\"," +
                                           "\"uuid\": \"123b75b0806011e29e960800200c9a66\"," +
                                           "\"items\": [" +
                                           "{{" +
                                           "\"item\": {{" +
                                           "\"description\": \"Leftovers featuring pickled cabbage\"," +
                                           "\"name\": \"BiBimBap\"," +
                                           "\"quantity\": 2," +
                                           "\"sku\": \"1111\"," +
                                           "\"category\": \"Korean\"," +
                                           "\"upc\": \"9999\"," +
                                           "\"children\": []," +
                                           "\"charged_price_amount\": 200," +
                                           "\"standard_price_amount\": 200" +
                                           "}}" +
                                           "}}," +
                                           "{{" +
                                           "\"item\": {{" +
                                           "\"description\": \"Lovely sprockets with gravy\"," +
                                           "\"name\": \"Sprockets\"," +
                                           "\"quantity\": 7," +
                                           "\"sku\": \"1234\"," +
                                           "\"category\": \"Weird stuff\"," +
                                           "\"upc\": \"4321\"," +
                                           "\"children\": []," +
                                           "\"charged_price_amount\": 100," +
                                           "\"standard_price_amount\": 100" +
                                           "}}" +
                                           "}}" +
                                           "]," +
                                           "\"earn_amount\": 0," +
                                           "\"merchant_funded_credit_amount\": 12," +
                                           "\"spend_amount\": 10," +
                                           "\"tip_amount\": 2," +
                                           "\"total_amount\": 12" +
                                           "}}" +
                                           "}}")
            };

            IQueryMerchantData client = ClientModuleFunctionalTestingUtilities.GetMockedLevelUpModule <IQueryMerchantData>(
                expectedResponse, expectedRequestUrl: expectedRequestUrl);
            var details = client.GetMerchantOrderDetails("not_checking_this", merchantId, uuid);

            Assert.AreEqual(details.LoyaltyId, 633172);
        }