コード例 #1
0
  private void addAcceptedPaymentTypeForATransaction(
      List<AcceptedPaymentType> addAcceptedPaymentTypes, TrxnTypes transactionType)
      throws Exception {

    for (TransactionAcceptedPaymentTypes transactionAcceptedPaymentTypes :
        currentAcceptedPaymentTypes) {
      TrxnTypes transType = transactionAcceptedPaymentTypes.getTransactionType();
      if (transType.equals(transactionType)) {
        List<AcceptedPaymentType> paymentTypes = GetSavePaymentTypes(transType);
        List<AcceptedPaymentType> acceptedPaymentTypes =
            transactionAcceptedPaymentTypes.getAcceptedPaymentTypes();
        if ((acceptedPaymentTypes != null) && (acceptedPaymentTypes.size() > 0)) {
          for (PaymentTypes paymentType : PaymentTypes.values()) {
            if (Find(paymentType, acceptedPaymentTypes) == false) {
              AcceptedPaymentType acceptedPaymentType = new AcceptedPaymentType();
              Short paymentTypeId = paymentType.getValue();
              PaymentTypeEntity paymentTypeEntity = new PaymentTypeEntity(paymentTypeId);
              acceptedPaymentType.setPaymentTypeEntity(paymentTypeEntity);
              TransactionTypeEntity transactionEntity = new TransactionTypeEntity();
              transactionEntity.setTransactionId(transType.getValue());
              acceptedPaymentType.setTransactionTypeEntity(transactionEntity);
              addAcceptedPaymentTypes.add(acceptedPaymentType);
              paymentTypes.add(acceptedPaymentType);
            }
          }
        }
      }
    }
  }
コード例 #2
0
 private void compare(
     List<PaymentTypeEntity> entityList, List<AcceptedPaymentType> acceptedPaymentTypeList) {
   Assert.assertTrue(entityList.size() == acceptedPaymentTypeList.size());
   for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypeList) {
     Assert.assertTrue(FindEntity(entityList, acceptedPaymentType.getPaymentTypeEntity()));
   }
 }
コード例 #3
0
 private boolean Find(PaymentTypes paymentType, List<AcceptedPaymentType> acceptedPaymentTypes) {
   for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypes) {
     if (acceptedPaymentType.getPaymentTypeEntity().getId().shortValue()
         == paymentType.getValue().shortValue()) {
       return true;
     }
   }
   return false;
 }
コード例 #4
0
 private boolean FindAcceptedPaymentType(
     AcceptedPaymentType acceptedPaymentType, List<AcceptedPaymentType> acceptedPaymentTypes) {
   for (AcceptedPaymentType newAcceptedPaymentType : acceptedPaymentTypes) {
     if ((newAcceptedPaymentType.getTransactionTypeEntity().getTransactionId().shortValue()
             == acceptedPaymentType.getTransactionTypeEntity().getTransactionId().shortValue())
         && (newAcceptedPaymentType.getPaymentTypeEntity().getId().shortValue())
             == acceptedPaymentType.getPaymentTypeEntity().getId().shortValue()) {
       return true;
     }
   }
   return false;
 }
コード例 #5
0
 private boolean IsDeleted(AcceptedPaymentType a, List<AcceptedPaymentType> list) {
   if ((list == null) || (list.size() == 0)) {
     return true;
   }
   for (AcceptedPaymentType type : list) {
     if ((type.getTransactionTypeEntity().getTransactionId().shortValue()
             == a.getTransactionTypeEntity().getTransactionId().shortValue())
         && (type.getPaymentTypeEntity().getId().shortValue()
             == a.getPaymentTypeEntity().getId().shortValue())) {
       return false;
     }
   }
   return true;
 }
コード例 #6
0
  public List<PaymentTypeEntity> getAcceptedPaymentTypesForATransaction(
      Short localeId, Short transactionId) throws PersistenceException {

    HashMap<String, Object> queryParameters = new HashMap<String, Object>();
    queryParameters.put("transactionId", transactionId);

    List<AcceptedPaymentType> acceptedPaymentTypeList =
        executeNamedQuery(
            NamedQueryConstants.GET_ACCEPTED_PAYMENT_TYPES_FOR_A_TRANSACTION, queryParameters);
    List<PaymentTypeEntity> paymentTypeList = new ArrayList<PaymentTypeEntity>();
    for (AcceptedPaymentType acceptedPaymentType : acceptedPaymentTypeList) {
      PaymentTypeEntity paymentTypeEntity = acceptedPaymentType.getPaymentTypeEntity();
      // the localeId is set so when the paymentTypeEntity.getName is
      // called the localeId will be used
      // to determine what the name to match with that localeId
      paymentTypeList.add(paymentTypeEntity);
    }

    return paymentTypeList;
  }