public void Should_RetrieveAll_Plan() { 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 }; Plan.Create(createPlanRequest, _options); RetrieveAllPlanRequest request = new RetrieveAllPlanRequest { Locale = Locale.TR.ToString(), ConversationId = "123456789", ProductReferenceCode = createProductResponse.Data.ReferenceCode, Count = 1, Page = 1 }; ResponsePagingData <PlanResource> response = Plan.RetrieveAll(request, _options); PrintResponse(response); Assert.AreEqual(response.Status, Status.SUCCESS.ToString()); Assert.AreEqual(1, response.Data.Items.Count); Assert.AreEqual(1, response.Data.CurrentPage); Assert.IsNotNull(response.SystemTime); Assert.Null(response.ErrorMessage); }
public void Should_RetrieveAll_Plan() { RetrieveAllPlanRequest request = new RetrieveAllPlanRequest { Locale = Locale.TR.ToString(), ConversationId = "123456789", ProductReferenceCode = "productReferenceCode", Count = 1, Page = 1 }; ResponsePagingData <PlanResource> response = Plan.RetrieveAll(request, options); PrintResponse(response); Assert.AreEqual(response.Status, Status.SUCCESS.ToString()); Assert.AreEqual(1, response.Data.Items.Count); Assert.AreEqual(1, response.Data.CurrentPage); Assert.IsNotNull(response.SystemTime); Assert.Null(response.ErrorMessage); }
public static ResponsePagingData <PlanResource> RetrieveAll(RetrieveAllPlanRequest request, Options options) { string uri = $"{options.BaseUrl}/v2/subscription/products/{request.ProductReferenceCode}/pricing-plans{GetQueryParams(request)}"; return(RestHttpClientV2.Create().Get <ResponsePagingData <PlanResource> >(uri, GetHttpHeadersWithUrlParams(request, uri, options))); }