コード例 #1
0
  public void validate(List<PanOrderLineDto> orderLines)
      throws InvoicingSolutionValidationException, SQLException {
    List<SegmentTariffDto> segmentTariffs = billingData.getSegmentTariffs();

    long numIncludedTariffs = 0L;
    long numMatchedLines = 0L;

    for (SegmentTariffDto segmentTariff : segmentTariffs) {
      if (billingData.getProgram().isPrepayment()) {
        if (!segmentTariff.getEventTypeId().isTrafficTransaction()) {
          numIncludedTariffs++;
        }
      } else {
        numIncludedTariffs++;
      }

      if (validateTariffAgainstOrderLines(segmentTariff, orderLines)) {
        numMatchedLines++;
      }
    }

    Assert.assertTrue(
        "Number of matched segmentTariffs differs",
        numIncludedTariffs * billingData.getAffiliates().size() == numMatchedLines);
  }
コード例 #2
0
  private boolean validateTariffAgainstOrderLines(
      SegmentTariffDto segmentTariff, List<PanOrderLineDto> orderLines) {
    Long eventId =
        segmentTariff.getEventTypeId().getId() == 50L
            ? 305L
            : segmentTariff.getEventTypeId().getId();
    Long SegmentId = segmentTariff.getId();

    for (PanOrderLineDto orderLine : orderLines) {
      if (isEqual(orderLine.getSegmentTariffId(), SegmentId)
          && isEqual(orderLine.getSalesPart(), eventId)) {
        boolean matched = false;

        if (segmentTariff.getEventTypeId().isTrafficTransaction()
            || segmentTariff.getEventTypeId().isTrackBackEvent()
            || segmentTariff.getEventTypeId().isFileHostingEvent()) {
          matched = validateTraffic(segmentTariff, orderLine);
        }

        if (segmentTariff.getEventTypeId().isManualTransactionEvent()) {
          matched = validateManualTransaction(segmentTariff, orderLine);
        }

        if (segmentTariff.getEventTypeId().isDigitalWalletEvent()) {
          matched = validateDigitalWallet(segmentTariff, orderLine);
        }

        if (matched) {
          return true;
        }
      }
    }

    return false;
  }