Beispiel #1
0
        public async Task <DeliveryPayment> GetDeliveryPayment(int affiliateId, int customerId)
        {
            if (affiliateId < 1 ||
                customerId < 1)
            {
                return(null);
            }
            else
            {
                string json = await base.GetJsonAsync("/webapplication/servicecenter/getinvoice", new Dictionary <string, object>() { { "affiliateId", affiliateId }, { "customerid", customerId } }).ConfigureAwait(false);

                DeliveryPayment deliveryPayment = JsonConvert.DeserializeObject <DeliveryPayment>(json);

                if (deliveryPayment.CustomerGroupId != 0)
                {
                    deliveryPayment.CustomerGroupName = CustomerGroups.Single(x => x.CustomerGroupId == deliveryPayment.CustomerGroupId).CustomerGroupName;
                }

                return(deliveryPayment);
            }
        }
Beispiel #2
0
        public async Task <Summary> GetSummary(int affiliateId, int customerId)
        {
            if (affiliateId < 1 ||
                customerId < 1)
            {
                return(null);
            }
            else
            {
                string json = await base.GetJsonAsync("/webapplication/servicecenter/getinvoice", new Dictionary <string, object>() { { "affiliateId", affiliateId }, { "customerid", customerId } }).ConfigureAwait(false);

                Summary summary = JsonConvert.DeserializeObject <Summary>(json);

                if (summary != null &&
                    summary.CustomerGroupId != 0)
                {
                    summary.CustomerGroupName = CustomerGroups.Single(x => x.CustomerGroupId == summary.CustomerGroupId).CustomerGroupName;
                }

                return(summary);
            }
        }
Beispiel #3
0
        public async Task <Invoice> GetOrCreateInvoice(string userName, int affiliateId, int customerId)
        {
            if (string.IsNullOrEmpty(userName) ||
                affiliateId < 0 ||
                customerId < 1)
            {
                return(null);
            }
            else
            {
                string json = await base.GetJsonAsync("/webapplication/servicecenter/getorcreateinvoice", new Dictionary <string, object>() { { "userName", userName }, { "affiliateId", affiliateId }, { "customerid", customerId } }).ConfigureAwait(false);

                Invoice invoice = JsonConvert.DeserializeObject <Invoice>(json);

                if (invoice.CustomerGroupId != 0)
                {
                    invoice.CustomerGroupName = CustomerGroups.Single(x => x.CustomerGroupId == invoice.CustomerGroupId).CustomerGroupName;
                }

                return(invoice);
            }
        }