public NativeOfferBuilder amount(Integer amount) { nativeOffer.setAmount(amount); return this; }
private OrderConfirmation createOrderConfirmation(String confirmationJwt) { OrderConfirmation orderConfirmation = new OrderConfirmation(); orderConfirmation.setStatus(OrderConfirmation.Status.COMPLETED); orderConfirmation.setJwtConfirmation(confirmationJwt); return orderConfirmation; }
public NativeOfferBuilder description(String description) { nativeOffer.setDescription(description); return this; }
public static NativeOffer toNativeOffer(@NonNull Offer offer) { NativeOfferBuilder nativeOfferBuilder = (offer.getOfferType() == OfferType.EARN) ? new NativeEarnOfferBuilder(offer.getId()) : new NativeSpendOfferBuilder(offer.getId()); return nativeOfferBuilder.title(offer.getTitle()).description(offer.getDescription()).amount(offer.getAmount()) .image(offer.getImage()).build(); } }
@Test public void removeNativeSpendOffer() throws Exception { NativeOffer nativeOffer = new NativeSpendOfferBuilder("1") .title("Native offer title") .description("Native offer desc") .amount(1000) .image("Native offer image") .build(); offerRepository.addNativeOffer(nativeOffer, true); assertEquals(1, offerRepository.getCachedOfferList().getOffers().size()); assertEquals(nativeOffer.getId(), offerRepository.getCachedOfferList().getOffers().get(0).getId()); Offer offer = OfferConverter.toOffer(nativeOffer); assertTrue(offerRepository.shouldDismissOnTap(offer.getId())); offerRepository.removeNativeOffer(nativeOffer); assertEquals(0, offerRepository.getCachedOfferList().getOffers().size()); }
@Nullable public static Offer toOffer(@NonNull NativeOffer nativeOffer) { OfferType offerType; try { offerType = OfferType.fromValue(nativeOffer.getOfferType().getValue()); } catch (Throwable throwable) { offerType = null; } if (offerType != null) { return new Offer().id(nativeOffer.getId()) .offerType(offerType) .title(nativeOffer.getTitle()) .description(nativeOffer.getDescription()) .amount(nativeOffer.getAmount()) .image(nativeOffer.getImage()) .contentType(ContentTypeEnum.EXTERNAL); } else { return null; } }
@Override public void onResponse(UserProfile response) { UserStats userStats = new UserStats(); com.kin.ecosystem.core.network.model.UserStats userNetworkStats = response.getStats(); if (userNetworkStats != null) { userStats.setEarnCount(userNetworkStats.getEarnCount().intValue()); userStats.setLastEarnDate(userNetworkStats.getLastEarnDate()); userStats.setSpendCount(userNetworkStats.getSpendCount().intValue()); userStats.setLastSpendDate(userNetworkStats.getLastSpendDate()); } callback.onResponse(userStats); }
private boolean isGreaterThenZero(Balance value) { return value.getAmount().compareTo(BigDecimal.ZERO) == 1; }
@Override public void onResponse(OrderConfirmation orderConfirmation) { countDownLatch.countDown(); assertEquals("A JWT CONFIRMATION", orderConfirmation.getJwtConfirmation()); assertEquals(OrderConfirmation.Status.COMPLETED, orderConfirmation.getStatus()); assertNull(orderRepository.getOpenOrder().getValue()); }
public NativeEarnOfferBuilder(@NonNull String id) { nativeOffer = new NativeEarnOffer(id); }
@Override public void onChanged(NativeOfferClickEvent nativeOffer) { assertEquals("5", nativeOffer.getNativeOffer().getId()); assertFalse(nativeOffer.isDismissOnTap()); } };
public NativeOfferBuilder title(String title) { nativeOffer.setTitle(title); return this; }
public NativeOfferBuilder image(String image) { nativeOffer.setImage(image); return this; }
public NativeSpendOfferBuilder(@NonNull String id){ nativeOffer = new NativeSpendOffer(id); }
public static Status fromValue(String text) { for (Status b : Status.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; } }
public static OfferType fromValue(String text) { for (OfferType b : OfferType.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; } }
private boolean isGreaterThenZero(Balance value) { return value.getAmount().compareTo(BigDecimal.ZERO) == 1; }
@Override public void onResponse(OrderConfirmation orderConfirmation) { countDownLatch.countDown(); assertEquals("A JWT CONFIRMATION", orderConfirmation.getJwtConfirmation()); assertEquals(OrderConfirmation.Status.COMPLETED, orderConfirmation.getStatus()); assertNull(orderRepository.getOpenOrder().getValue()); }
private void updateBalance(Balance balance) { int balanceValue = balance.getAmount().intValue(); if (view != null) { view.updateBalance(balanceValue); } }