public void Should_Retrieve_Product() { string randomString = $"{DateTime.Now:yyyyMMddHHmmssfff}"; CreateProductRequest createProductRequest = new CreateProductRequest { Description = "product-description", Locale = Locale.TR.ToString(), Name = $"product-name-{randomString}", ConversationId = "123456789" }; ProductResource productResource = Product.Create(createProductRequest, _options).Data; RetrieveProductRequest retrieveProductRequest = new RetrieveProductRequest { Locale = Locale.TR.ToString(), ConversationId = "123456789", ProductReferenceCode = productResource.ReferenceCode }; ResponseData <ProductResource> response = Product.Retrieve(retrieveProductRequest, _options); PrintResponse(response); Assert.AreEqual(response.Status, Status.SUCCESS.ToString()); Assert.AreEqual($"product-name-{randomString}", response.Data.Name); Assert.AreEqual("product-description", response.Data.Description); Assert.IsNotNull(response.Data.ReferenceCode); Assert.IsNotNull(response.SystemTime); Assert.Null(response.ErrorMessage); }
public void Should_Retrieve_Product() { string randomString = $"{DateTime.Now:yyyyMMddHHmmssfff}"; RetrieveProductRequest retrieveProductRequest = new RetrieveProductRequest { Locale = Locale.TR.ToString(), ConversationId = "123456789", ProductReferenceCode = "productReferenceCode" }; ResponseData <ProductResource> response = Product.Retrieve(retrieveProductRequest, options); PrintResponse(response); Assert.AreEqual(response.Status, Status.SUCCESS.ToString()); Assert.AreEqual("productReferenceCode", response.Data.ReferenceCode); Assert.IsNotNull(response.SystemTime); Assert.Null(response.ErrorMessage); }
// Async public static async Task <ResponseData <ProductResource> > RetrieveAsync(RetrieveProductRequest request, Options options) { string uri = $"{options.BaseUrl}/v2/subscription/products/{request.ProductReferenceCode}"; return(await RestHttpClientV2.Create().GetAsync <ResponseData <ProductResource> >(uri, GetHttpHeadersWithUrlParams(request, uri, options))); }