Exemplo n.º 1
0
 public void MakeRefund(SubscribeResponseHolder sub, Invoice inv)
 {
     Refund refund = new Refund();
     refund.AccountId = sub.SubRes.AccountId;
     refund.Amount = inv.Amount;
     refund.AmountSpecified = true;
     refund.Type = "Electronic";
     refund.PaymentId = sub.SubRes.PaymentId;
     List<ResponseHolder> createRes = zs.Create(new List<zObject> { refund }, false);
 }
Exemplo n.º 2
0
        public List<SubscribeResponseHolder> Subscribe(List<SubscribeRequest> input)
        {
            List<SubscribeResponseHolder> results = new List<SubscribeResponseHolder>();
            SubscribeResult[] res = new SubscribeResult[]{};
            bool done = false;
            int subscribeNum = 50;
            while (!done)
            {
                List<SubscribeRequest> doWork = new List<SubscribeRequest>() { };

                if (input.Count > subscribeNum)
                {
                    List<SubscribeRequest> subList = input.GetRange(0, subscribeNum);
                    for (int i = 0; i < subscribeNum; i++)
                    {
                        SubscribeRequest temp = subList[i];
                        doWork.Add(temp);
                        input.Remove(temp);
                    }
                }
                else
                {
                    done = true;
                    doWork = input;
                }
                CheckTime();
                try
                {
                    res = svc.subscribe(sh, doWork.ToArray());
                }
                catch (FaultException e)
                {
                    SubscribeResponseHolder error = new SubscribeResponseHolder();
                    error.Message = e.Message;
                    error.Success = false;
                    results.Add(error);
                    return results;
                }
                foreach (SubscribeResult sr in res)
                {
                    SubscribeResponseHolder temp = new SubscribeResponseHolder();
                    if (sr.Success)
                    {
                        temp.Success = true;
                        temp.SubRes = sr;
                    }
                    else
                    {
                        temp.Success = false;
                        temp.Message = sr.Errors[0].Message;
                    }
                    results.Add(temp);
                }
            }
            return results;
        }