Пример #1
0
        // Convenience method to poll a Checkout node till its ready property is True
        private void PollCheckoutReady(CheckoutPollFinishedHandler callback)
        {
            PollUpdatedHandler isReady = (updatedQueryRoot) => {
                var checkout = (Checkout)updatedQueryRoot.node();
                return(checkout.ready());
            };

            PollCheckoutNode(DefaultQueries.checkout.Poll, isReady, callback);
        }
Пример #2
0
        // Convenience method to poll a Checkout node till its available shipping rates' ready property is True
        private void PollCheckoutAvailableShippingRatesReady(CheckoutPollFinishedHandler callback)
        {
            PollUpdatedHandler isReady = (updatedQueryRoot) => {
                var checkout = (Checkout)updatedQueryRoot.node();
                return(checkout.availableShippingRates().ready());
            };

            PollCheckoutNode(DefaultQueries.checkout.AvailableShippingRatesPoll, isReady, callback);
        }
Пример #3
0
        // Polls a Checkout, till isReady returns True.
        private void PollCheckoutNode(CheckoutPollQuery checkoutQuery, PollUpdatedHandler isReady, CheckoutPollFinishedHandler callback)
        {
            QueryRootQuery query = new QueryRootQuery();

            checkoutQuery(query, CurrentCheckout.id());

            Client.PollQuery(isReady, query, (response, error) => {
                if (error != null)
                {
                    callback(null, error);
                }
                else
                {
                    Checkout checkout = (Checkout)response.node();
                    callback(checkout, null);
                }
            });
        }