コード例 #1
0
 @Override
 @Transactional("blTransactionManager")
 public void removePaymentFromOrder(Order order, PaymentInfo paymentInfo) {
   PaymentInfo paymentInfoToRemove = null;
   for (PaymentInfo info : order.getPaymentInfos()) {
     if (info.equals(paymentInfo)) {
       paymentInfoToRemove = info;
     }
   }
   if (paymentInfoToRemove != null) {
     try {
       securePaymentInfoService.findAndRemoveSecurePaymentInfo(
           paymentInfoToRemove.getReferenceNumber(), paymentInfo.getType());
     } catch (WorkflowException e) {
       // do nothing--this is an acceptable condition
       LOG.debug("No secure payment is associated with the PaymentInfo", e);
     }
     order.getPaymentInfos().remove(paymentInfoToRemove);
     paymentInfo = paymentInfoDao.readPaymentInfoById(paymentInfoToRemove.getId());
     paymentInfoDao.delete(paymentInfo);
   }
 }
コード例 #2
0
 @Override
 @Transactional("blTransactionManager")
 public void removePaymentsFromOrder(Order order, PaymentInfoType paymentInfoType) {
   List<PaymentInfo> infos = new ArrayList<PaymentInfo>();
   for (PaymentInfo paymentInfo : order.getPaymentInfos()) {
     if (paymentInfoType == null || paymentInfoType.equals(paymentInfo.getType())) {
       infos.add(paymentInfo);
     }
   }
   order.getPaymentInfos().removeAll(infos);
   for (PaymentInfo paymentInfo : infos) {
     try {
       securePaymentInfoService.findAndRemoveSecurePaymentInfo(
           paymentInfo.getReferenceNumber(), paymentInfo.getType());
     } catch (WorkflowException e) {
       // do nothing--this is an acceptable condition
       LOG.debug("No secure payment is associated with the PaymentInfo", e);
     }
     order.getPaymentInfos().remove(paymentInfo);
     paymentInfo = paymentInfoDao.readPaymentInfoById(paymentInfo.getId());
     paymentInfoDao.delete(paymentInfo);
   }
 }