@Test public void fieldsSetAsExpectedForDefaultRequest() { ChargeRequest request = new ChargeRequest.Builder(1_00, CurrencyCode.USD).build(); Intent intent = client.createChargeIntent(request); assertThat(intent.hasExtra(EXTRA_POINT_OF_SALE_CLIENT_ID)).isTrue(); assertThat(intent.hasExtra(EXTRA_TOTAL_AMOUNT)).isTrue(); assertThat(intent.hasExtra(EXTRA_API_VERSION)).isTrue(); assertThat(intent.hasExtra(EXTRA_SDK_VERSION)).isTrue(); assertThat(intent.hasExtra(EXTRA_CURRENCY_CODE)).isTrue(); assertThat(intent.hasExtra(EXTRA_REQUEST_METADATA)).isTrue(); assertThat(intent.hasExtra(EXTRA_TENDER_TYPES)).isTrue(); assertThat(intent.hasExtra(EXTRA_CUSTOMER_ID)).isFalse(); assertThat(intent.hasExtra(EXTRA_LOCATION_ID)).isFalse(); assertThat(intent.hasExtra(EXTRA_AUTO_RETURN_TIMEOUT_MS)).isFalse(); }
@NonNull @Override public Intent createChargeIntent(@NonNull ChargeRequest chargeRequest) { nonNull(chargeRequest, "chargeRequest"); List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); return createPinnedChargeIntent(chargeRequest, pointOfSalePackage); }
RealPosClient implements PosClient { @NonNull @Override public Intent createChargeIntent(@NonNull ChargeRequest chargeRequest) { nonNull(chargeRequest, "chargeRequest"); List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); return createPinnedChargeIntent(chargeRequest, pointOfSalePackage); } }
RealPosClient implements PosClient { @NonNull @Override public Intent createChargeIntent(@NonNull ChargeRequest chargeRequest) { nonNull(chargeRequest, "chargeRequest"); List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); return createPinnedChargeIntent(chargeRequest, pointOfSalePackage); } RealPosClient(Context context, String clientId); }
RealPosClient implements PosClient { @NonNull @Override public Intent createChargeIntent(@NonNull ChargeRequest chargeRequest) { nonNull(chargeRequest, "chargeRequest"); List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); return createPinnedChargeIntent(chargeRequest, pointOfSalePackage); } RealPosClient(Context context, String clientId); @NonNull @Override Intent createChargeIntent(@NonNull ChargeRequest chargeRequest); @Override boolean isPointOfSaleInstalled(); @Override void launchPointOfSale(); @Override void openPointOfSalePlayStoreListing(); @NonNull @Override ChargeRequest.Success parseChargeSuccess(@NonNull Intent data); @NonNull @Override ChargeRequest.Error parseChargeError(@NonNull Intent data); }
RealPosClient implements PosClient { @NonNull @Override public Intent createChargeIntent(@NonNull ChargeRequest chargeRequest) { nonNull(chargeRequest, "chargeRequest"); List<ResolveInfo> activities = queryChargeActivities(); PackageInfo pointOfSalePackage = findPointOfSaleWithHighestVersion(activities); return createPinnedChargeIntent(chargeRequest, pointOfSalePackage); } RealPosClient(Context context, String clientId); @NonNull @Override Intent createChargeIntent(@NonNull ChargeRequest chargeRequest); @Override boolean isPointOfSaleInstalled(); @Override void launchPointOfSale(); @Override void openPointOfSalePlayStoreListing(); @NonNull @Override ChargeRequest.Success parseChargeSuccess(@NonNull Intent data); @NonNull @Override ChargeRequest.Error parseChargeError(@NonNull Intent data);  }