コード例 #1
0
        public void EditPayLink_MissingDescription()
        {
            var exceptionCaught = false;

            try {
                PayLinkService.Edit(Guid.NewGuid().ToString())
                .WithAmount(AMOUNT)
                .WithPayLinkData(payLink)
                .Execute();
            }
            catch (GatewayException e) {
                exceptionCaught = true;
                Assert.AreEqual("40005", e.ResponseMessage);
                Assert.AreEqual("Status Code: BadRequest - Request expects the following field description", e.Message);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
コード例 #2
0
        public void EditPayLink_MissingPayLinkData()
        {
            var exceptionCaught = false;

            try {
                PayLinkService.Edit(Guid.NewGuid().ToString())
                .WithAmount(AMOUNT)
                .WithPayLinkData(null)
                .WithDescription("Update Paylink description")
                .Execute();
            }
            catch (BuilderException e) {
                exceptionCaught = true;
                Assert.AreEqual("PayLinkData cannot be null for this transaction type.", e.Message);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
コード例 #3
0
        public void EditPayLink_RandomPayLinkId()
        {
            var exceptionCaught = false;

            try {
                PayLinkService.Edit(Guid.NewGuid().ToString())
                .WithAmount(AMOUNT)
                .WithPayLinkData(payLink)
                .WithDescription("Update Paylink description")
                .Execute();
            }
            catch (GatewayException e) {
                exceptionCaught = true;
                Assert.AreEqual("40108", e.ResponseMessage);
                Assert.AreEqual("Status Code: BadRequest - You cannot update a link that has a 400 status", e.Message);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
コード例 #4
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);
        }