Exemple #1
0
        private async Task <BuyerMarkup> CreateMarkup(BuyerMarkup markup, string buyerID, string token)
        {
            // to move from xp to contentdocs, that logic will go here instead of a patch
            var updatedBuyer = await _oc.Buyers.PatchAsync(buyerID, new PartialBuyer()
            {
                xp = new { MarkupPercent = markup.Percent }
            }, token);

            return(new BuyerMarkup()
            {
                Percent = (int)updatedBuyer.xp.MarkupPercent
            });
        }
Exemple #2
0
        private async Task <BuyerMarkup> UpdateMarkup(BuyerMarkup markup, string buyerID, string token)
        {
            // to move from xp to contentdocs, that logic will go here instead of a patch
            // currently duplicate of the function above, this might need to be duplicated since there wont be a need to save the contentdocs assignment again
            var updatedBuyer = await _oc.Buyers.PatchAsync(buyerID, new PartialBuyer()
            {
                xp = new { MarkupPercent = markup.Percent }
            }, token);

            return(new BuyerMarkup()
            {
                Percent = (int)updatedBuyer.xp.MarkupPercent
            });
        }
Exemple #3
0
        public async Task <SuperHSBuyer> Get(string buyerID, string token = null)
        {
            var request = token != null?_oc.Buyers.GetAsync <HSBuyer>(buyerID, token) : _oc.Buyers.GetAsync <HSBuyer>(buyerID);

            var buyer = await request;

            // to move into content docs logic
            var markupPercent = buyer.xp?.MarkupPercent ?? 0;
            var markup        = new BuyerMarkup()
            {
                Percent = markupPercent
            };

            return(new SuperHSBuyer()
            {
                Buyer = buyer,
                Markup = markup
            });
        }
Exemple #4
0
        private async Task <BuyerMarkup> CreateMarkup(BuyerMarkup markup, string buyerID, string accessToken, IOrderCloudClient oc)
        {
            // if we're seeding then use the passed in oc client
            // to support multiple environments and ease of setup for new orgs
            // else used the configured client
            var token    = oc == null ? null : accessToken;
            var ocClient = oc ?? _oc;

            // to move from xp to contentdocs, that logic will go here instead of a patch
            var updatedBuyer = await ocClient.Buyers.PatchAsync(buyerID, new PartialBuyer()
            {
                xp = new { MarkupPercent = markup.Percent }
            }, token);

            return(new BuyerMarkup()
            {
                Percent = (int)updatedBuyer.xp.MarkupPercent
            });
        }
Exemple #5
0
        public async Task <SuperHSBuyer> Get(string buyerID)
        {
            var configReq = GetImpersonationByBuyerID(buyerID);
            var buyer     = await _oc.Buyers.GetAsync <HSBuyer>(buyerID);

            var config = await configReq;

            // to move into content docs logic
            var markupPercent = buyer.xp?.MarkupPercent ?? 0;
            var markup        = new BuyerMarkup()
            {
                Percent = markupPercent
            };

            return(new SuperHSBuyer()
            {
                Buyer = buyer,
                Markup = markup,
                ImpersonationConfig = config
            });
        }