Beispiel #1
0
        protected void SubscriptionGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int          subscriptionId = AlwaysConvert.ToInt(e.CommandArgument);
            Subscription subscription   = SubscriptionDataSource.Load(subscriptionId);

            switch (e.CommandName)
            {
            case "Activate":
                subscription.Activate();
                SubscriptionGrid.DataBind();
                break;

            case "Deactivate":
                subscription.Deactivate();
                SubscriptionGrid.DataBind();
                break;

            case "CancelSubscription":
                subscription.Delete();
                SubscriptionGrid.DataBind();
                break;
            }

            BindSubscriptions();
        }
Beispiel #2
0
        public void ShouldActivateSubscriptionAndUpdateLastUpdateDate()
        {
            var subscription = new Subscription(null);
            var creationDate = subscription.LastUpdate;

            subscription.Deactivate();
            subscription.Activate();

            subscription.IsActive.Should().BeTrue();
            subscription.LastUpdate.Should().BeAfter(creationDate);
        }
        public void Should_Activate_Subscription()
        {
            ActivateSubscriptionRequest request = new ActivateSubscriptionRequest
            {
                Locale                    = Locale.TR.ToString(),
                ConversationId            = "123456789",
                SubscriptionReferenceCode = "subscriptionReferenceCode"
            };

            IyzipayResourceV2 response = Subscription.Activate(request, options);

            PrintResponse(response);

            Assert.AreEqual(Status.SUCCESS.ToString(), response.Status);
            Assert.IsNotNull(response.SystemTime);
            Assert.Null(response.ErrorMessage);
        }
        public void TestaSubscription()
        {
            var name     = new Name("Douglas", "Lopes");
            var document = new Document("34843436801", EDocumentType.Cpf);
            var email    = new Email("*****@*****.**");
            var address  = new Address("", "", "", "", "", "", "");
            var student  = new Student(name, document, email, address);

            var expected = 0;
            var paypal   = new PayPalPayment(DateTime.Now, DateTime.Now, 100, 200, address, "1234", document, email, "123");
            var sub      = new Subscription(DateTime.Now);

            sub.AddPayment(paypal);
            sub.Activate();

            student.AddSubscription(sub);

            student.Notifications.AsParallel().ForAll(p => Console.WriteLine(p.Message));

            Assert.AreEqual(expected, student.Notifications.Count);
        }
Beispiel #5
0
        public void Should_Activate_Subscription()
        {
            string randomString = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            CreateProductRequest createProductRequest = new CreateProductRequest
            {
                Description    = "product-description",
                Locale         = Locale.TR.ToString(),
                Name           = $"product-name-{randomString}",
                ConversationId = "123456789"
            };

            ResponseData <ProductResource> createProductResponse = Product.Create(createProductRequest, _options);

            CreatePlanRequest createPlanRequest = new CreatePlanRequest()
            {
                Locale               = Locale.TR.ToString(),
                Name                 = $"plan-name-{randomString}",
                ConversationId       = "123456789",
                TrialPeriodDays      = 3,
                Price                = "5.23",
                CurrencyCode         = Currency.TRY.ToString(),
                PaymentInterval      = PaymentInterval.WEEKLY.ToString(),
                RecurrenceCount      = 12,
                PaymentIntervalCount = 1,
                PlanPaymentType      = PlanPaymentType.RECURRING.ToString(),
                ProductReferenceCode = createProductResponse.Data.ReferenceCode
            };

            PlanResource planResource = Plan.Create(createPlanRequest, _options).Data;

            SubscriptionInitializeRequest subscriptionInitializeRequest = new SubscriptionInitializeRequest
            {
                Locale   = Locale.TR.ToString(),
                Customer = new CheckoutFormCustomer
                {
                    Email          = $"iyzico-{randomString}@iyzico.com",
                    Name           = "customer-name",
                    Surname        = "customer-surname",
                    BillingAddress = new Address
                    {
                        City        = "İstanbul",
                        Country     = "Türkiye",
                        Description = "billing-address-description",
                        ContactName = "billing-contact-name",
                        ZipCode     = "010101"
                    },
                    ShippingAddress = new Address
                    {
                        City        = "İstanbul",
                        Country     = "Türkiye",
                        Description = "shipping-address-description",
                        ContactName = "shipping-contact-name",
                        ZipCode     = "010102"
                    },

                    GsmNumber      = "+905350000000",
                    IdentityNumber = "55555555555"
                },
                PaymentCard = new CardInfo
                {
                    CardNumber           = "5528790000000008",
                    CardHolderName       = "iyzico",
                    ExpireMonth          = "12",
                    ExpireYear           = "2029",
                    Cvc                  = "123",
                    RegisterConsumerCard = true
                },
                ConversationId            = "123456789",
                PricingPlanReferenceCode  = planResource.ReferenceCode,
                SubscriptionInitialStatus = SubscriptionStatus.PENDING.ToString()
            };

            ResponseData <SubscriptionCreatedResource> initializeResponse = Subscription.Initialize(subscriptionInitializeRequest, _options);

            ActivateSubscriptionRequest request = new ActivateSubscriptionRequest
            {
                Locale                    = Locale.TR.ToString(),
                ConversationId            = "123456789",
                SubscriptionReferenceCode = initializeResponse.Data.ReferenceCode
            };

            IyzipayResourceV2 response = Subscription.Activate(request, _options);

            PrintResponse(response);

            Assert.AreEqual(Status.SUCCESS.ToString(), response.Status);
            Assert.IsNotNull(response.SystemTime);
            Assert.Null(response.ErrorMessage);
        }