@GET
  @Path("{taxMapId}")
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retrievedSingleTaxMap(
      @PathParam("taxMapId") final Long taxMapId, @Context final UriInfo uriInfo) {

    context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);
    TaxMapData taxMapData = taxMapReadPlatformService.retrievedSingleTaxMapData(taxMapId);
    final ApiRequestJsonSerializationSettings settings =
        apiRequestParameterHelper.process(uriInfo.getQueryParameters());
    if (settings.isTemplate()) {
      final List<ChargeCodeData> chargeCodeData =
          this.taxMapReadPlatformService.retrivedChargeCodeTemplateData();
      final Collection<MCodeData> taxTypeData =
          this.mCodeReadPlatformService.getCodeValue(CodeNameConstants.CODE_TYPE);
      final List<PriceRegionData> priceRegionData =
          this.regionalPriceReadplatformService.getPriceRegionsDetails();
      taxMapData.setChargeCodesForTax(chargeCodeData);
      taxMapData.setTaxTypeData(taxTypeData);
      taxMapData.setPriceRegionData(priceRegionData);
      taxMapData.setDate(DateUtils.getLocalDateOfTenantForClient());
    }
    return this.apiJsonSerializer.serialize(settings, taxMapData, RESPONSE_TAXMAPPING_PARAMETERS);
  }
  @GET
  @Path("{productId}")
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retrieveOne(
      @PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {

    this.context
        .authenticatedUser()
        .validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME);

    SavingsProductData savingProductData =
        this.savingProductReadPlatformService.retrieveOne(productId);

    final Collection<ChargeData> charges =
        this.chargeReadPlatformService.retrieveSavingsProductCharges(productId);

    savingProductData = SavingsProductData.withCharges(savingProductData, charges);

    final ApiRequestJsonSerializationSettings settings =
        this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());

    if (savingProductData.hasAccountingEnabled()) {
      final Map<String, Object> accountingMappings =
          this.accountMappingReadPlatformService.fetchAccountMappingDetailsForSavingsProduct(
              productId, savingProductData.accountingRuleTypeId());
      final Collection<PaymentTypeToGLAccountMapper> paymentChannelToFundSourceMappings =
          this.accountMappingReadPlatformService
              .fetchPaymentTypeToFundSourceMappingsForSavingsProduct(productId);
      Collection<ChargeToGLAccountMapper> feeToGLAccountMappings =
          this.accountMappingReadPlatformService.fetchFeeToIncomeAccountMappingsForSavingsProduct(
              productId);
      Collection<ChargeToGLAccountMapper> penaltyToGLAccountMappings =
          this.accountMappingReadPlatformService
              .fetchPenaltyToIncomeAccountMappingsForSavingsProduct(productId);
      savingProductData =
          SavingsProductData.withAccountingDetails(
              savingProductData,
              accountingMappings,
              paymentChannelToFundSourceMappings,
              feeToGLAccountMappings,
              penaltyToGLAccountMappings);
    }

    if (settings.isTemplate()) {
      savingProductData = handleTemplateRelatedData(savingProductData);
    }

    return this.toApiJsonSerializer.serialize(
        settings, savingProductData, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
  }
Beispiel #3
0
  @GET
  @Path("{chargeId}")
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retrieveCharge(
      @PathParam("chargeId") final Long chargeId, @Context final UriInfo uriInfo) {

    context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);

    final ApiRequestJsonSerializationSettings settings =
        apiRequestParameterHelper.process(uriInfo.getQueryParameters());

    ChargeData charge = this.readPlatformService.retrieveCharge(chargeId);
    if (settings.isTemplate()) {
      ChargeData templateData = this.readPlatformService.retrieveNewChargeDetails();
      charge = ChargeData.withTemplate(charge, templateData);
    }

    return this.toApiJsonSerializer.serialize(settings, charge, CHARGES_DATA_PARAMETERS);
  }
  @GET
  @Path("{guarantorId}")
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retrieveGuarantorDetails(
      @Context final UriInfo uriInfo,
      @PathParam("loanId") final Long loanId,
      @PathParam("guarantorId") final Long guarantorId) {
    this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);

    GuarantorData guarantorData =
        this.guarantorReadPlatformService.retrieveGuarantor(loanId, guarantorId);

    final ApiRequestJsonSerializationSettings settings =
        this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
    if (settings.isTemplate()) {
      final Collection<CodeValueData> allowedClientRelationshipTypes =
          this.codeValueReadPlatformService.retrieveCodeValuesByCode(
              GuarantorConstants.GUARANTOR_RELATIONSHIP_CODE_NAME);
      final Collection<CodeValueData> allowedGncbTypes =
          this.codeValueReadPlatformService.retrieveCodeValuesByCode(
              GuarantorConstants.GNCB_RELATIONSHIP_CODE_NAME);
      final List<EnumOptionData> guarantorTypeOptions =
          GuarantorEnumerations.guarantorType(GuarantorType.values());
      final Collection<PortfolioAccountData> accountLinkingOptions = null;
      guarantorData =
          GuarantorData.templateOnTop(
              guarantorData,
              guarantorTypeOptions,
              allowedClientRelationshipTypes,
              allowedGncbTypes,
              accountLinkingOptions);
    }

    return this.apiJsonSerializerService.serialize(
        settings, guarantorData, RESPONSE_DATA_PARAMETERS);
  }