예제 #1
0
        public void DeleteAnticipation(BulkAnticipation anticipation)
        {
            var request  = CreateRequest("DELETE", "/bulk_anticipations/" + anticipation.Id);
            var response = request.Execute();

            anticipation.LoadFrom(response.Body);
        }
예제 #2
0
        public void CancelAnticipation(BulkAnticipation anticipation)
        {
            var request  = CreateRequest("POST", "/bulk_anticipations/" + anticipation.Id + "/" + "cancel");
            var response = request.Execute();

            anticipation.LoadFrom(response.Body);
        }
        public String[] TAntecipaçao()
        {
            PagarMeService.DefaultApiKey = "ak_test_jbIXhrHXHOaUUNKtUVrkT9HGL60SSg";
            var recipient        = PagarMeService.GetDefaultService().Recipients.Find("re_ck0zjmw1s007ier6eysyd3agj");
            var bulkAnticipation = new BulkAnticipation()
            {
                Timeframe       = TimeFrame.Start,
                PaymentDate     = DateTime.Today.AddDays(3),
                RequestedAmount = 5300,
                Build           = true
            };

            try
            {
                recipient.CreateAnticipation(bulkAnticipation);
                string[] retorno = new string[3];
                retorno[0] = bulkAnticipation.Id;
                retorno[1] = bulkAnticipation.Amount.ToString();
                retorno[2] = recipient.Id;
                return(retorno);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                string[] retorno = new string[2];
                retorno[0] = Convert.ToString(ex);
                retorno[1] = "";
                retorno[2] = "";
                return(retorno);
            }
        }
예제 #4
0
        public void CreateAnticipation(BulkAnticipation anticipation)
        {
            var request = CreateRequest("POST", "/bulk_anticipations");

            request.Query = anticipation.BuildQueryForKeys(anticipation.ToDictionary(SerializationType.Plain));
            var response = request.Execute();

            anticipation.LoadFrom(response.Body);
        }
예제 #5
0
        public void CreateAnticipation()
        {
            BulkAnticipation anticipation = CreateBulkAnticipation();

            Recipient recipient = CreateRecipient();

            recipient.Save();

            Transaction transaction = CreateCreditCardSplitRuleTransaction(recipient);

            transaction.Save();

            recipient.CreateAnticipation(anticipation);

            Assert.IsTrue(anticipation.Status == Enumeration.BulkAnticipationStatus.Pending);
        }
예제 #6
0
        public void ReturnAllAnticipations()
        {
            BulkAnticipation anticipation = CreateBulkAnticipation();

            Recipient recipient = CreateRecipient();

            recipient.Save();

            Transaction transaction = CreateCreditCardSplitRuleTransaction(recipient);

            transaction.Save();

            recipient.CreateAnticipation(anticipation);

            Assert.IsTrue(recipient.Anticipations.FindAll(new BulkAnticipation()).Count() == 1);
        }
예제 #7
0
        public void DeleteAnticipation()
        {
            BulkAnticipation anticipation = CreateBulkAnticipationWithBuildTrue();

            Recipient recipient = CreateRecipient();

            recipient.Save();

            Transaction transaction = CreateCreditCardSplitRuleTransaction(recipient);

            transaction.Save();

            recipient.CreateAnticipation(anticipation);
            Assert.IsTrue(anticipation.Status == PagarMe.Enumeration.BulkAnticipationStatus.Building);

            recipient.DeleteAnticipation(anticipation);
            Assert.IsNull(anticipation.Id);
        }