@Test public void checkForUpdates() { mockServer.expect(requestTo("https: .andExpect(method(POST)) .andExpect(body(readCompactedJsonResource(jsonResource("data/iap-check-for-updates")))) .andRespond(withResponse(jsonResource("data/iap-update-response"), responseHeaders)); List<Product> products = new ArrayList<Product>(); products.add(new Product("1234", 3)); products.add(new Product("FOOBAR", 1)); List<Product> updates = urbanAirship.inAppPurchaseOperations().checkForUpdates(products); assertEquals(1, updates.size()); assertEquals("1234", updates.get(0).getProductId()); assertEquals(4, updates.get(0).getCurrentRevision()); assertEquals("https: mockServer.verify(); }
public List<Product> checkForUpdates(List<Product> products) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<List<Product>> requestEntity = new HttpEntity<List<Product>>(products, headers); return restOperations.exchange(IAP_URL + "updates", POST, requestEntity, ProductList.class).getBody(); }
InAppPurchaseTemplate implements InAppPurchaseOperations { public List<Product> checkForUpdates(List<Product> products) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<List<Product>> requestEntity = new HttpEntity<List<Product>>(products, headers); return restOperations.exchange(IAP_URL + "updates", POST, requestEntity, ProductList.class).getBody(); } }
InAppPurchaseTemplate implements InAppPurchaseOperations { public List<Product> checkForUpdates(List<Product> products) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<List<Product>> requestEntity = new HttpEntity<List<Product>>(products, headers); return restOperations.exchange(IAP_URL + "updates", POST, requestEntity, ProductList.class).getBody(); } InAppPurchaseTemplate(RestOperations restOperations); }
InAppPurchaseTemplate implements InAppPurchaseOperations { public List<Product> checkForUpdates(List<Product> products) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<List<Product>> requestEntity = new HttpEntity<List<Product>>(products, headers); return restOperations.exchange(IAP_URL + "updates", POST, requestEntity, ProductList.class).getBody(); } InAppPurchaseTemplate(RestOperations restOperations); List<InventoryItem> getInventory(); String getDownloadUrl(String productId); String getDownloadUrl(String productId, ContentReceipt receipt); List<Product> checkForUpdates(List<Product> products); }
InAppPurchaseTemplate implements InAppPurchaseOperations { public List<Product> checkForUpdates(List<Product> products) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<List<Product>> requestEntity = new HttpEntity<List<Product>>(products, headers); return restOperations.exchange(IAP_URL + "updates", POST, requestEntity, ProductList.class).getBody(); } InAppPurchaseTemplate(RestOperations restOperations); List<InventoryItem> getInventory(); String getDownloadUrl(String productId); String getDownloadUrl(String productId, ContentReceipt receipt); List<Product> checkForUpdates(List<Product> products);  }