コード例 #1
0
        public void FindPayLinkByDate_NoResults()
        {
            var response = PayLinkService.FindPayLink(1, 10)
                           .OrderBy(PayLinkSortProperty.TimeCreated, SortDirection.Ascending)
                           .Where(SearchCriteria.StartDate, startDate.AddYears(-1))
                           .And(SearchCriteria.EndDate, endDate.AddYears(-1))
                           .Execute();

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Results);
            Assert.AreEqual(0, response.Results.Count);
            Assert.AreEqual(0, response.TotalRecordCount);
        }
コード例 #2
0
        public void FindPayLinkByDate()
        {
            var response = PayLinkService.FindPayLink(1, 10)
                           .OrderBy(PayLinkSortProperty.TimeCreated, SortDirection.Ascending)
                           .Where(SearchCriteria.StartDate, startDate)
                           .And(SearchCriteria.EndDate, endDate)
                           .Execute();

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Results);
            /** @var PayLinkSummary $randomPayLink */
            var randomPayLink = response.Results[0];

            Assert.IsNotNull(randomPayLink);
            Assert.IsInstanceOfType(randomPayLink, typeof(PayLinkSummary));
        }
コード例 #3
0
        public void EditPayLink()
        {
            var response = PayLinkService.FindPayLink(1, 10)
                           .OrderBy(PayLinkSortProperty.TimeCreated, SortDirection.Ascending)
                           .Where(SearchCriteria.StartDate, startDate)
                           .And(SearchCriteria.EndDate, endDate)
                           .Execute();

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Results);
            /** @var PayLinkSummary $randomPayLink */
            var randomPayLink = response.Results[0];

            Assert.IsNotNull(randomPayLink);
            Assert.IsInstanceOfType(randomPayLink, typeof(PayLinkSummary));
            Assert.IsNotNull(randomPayLink.Id);

            var payLink = new PayLinkData();

            payLink.Name       = "Test of Test";
            payLink.UsageMode  = PaymentMethodUsageMode.Multiple;
            payLink.Type       = PayLinkType.PAYMENT;
            payLink.UsageLimit = 5;
            //payLink.IsShippable = false;
            var amount       = 10.08m;
            var editResponse = PayLinkService.Edit(randomPayLink.Id)
                               .WithAmount(amount)
                               .WithPayLinkData(payLink)
                               .WithDescription("Update Paylink description")
                               .Execute();

            Assert.AreEqual("SUCCESS", editResponse.ResponseCode);
            Assert.AreEqual(PayLinkStatus.ACTIVE.ToString(), editResponse.ResponseMessage);
            Assert.AreEqual(amount, editResponse.BalanceAmount);
            Assert.IsNotNull(editResponse.PayLinkResponse.Url);
            Assert.IsNotNull(editResponse.PayLinkResponse.Id);
        }