@Transactional public void processSuccessMsg(final ReceiptHeader onlinePaymentReceiptHeader,final PaymentResponse paymentResponse){
  final List<ReceiptDetail> existingReceiptDetails=new ArrayList<ReceiptDetail>(0);
  for (  final ReceiptDetail receiptDetail : onlinePaymentReceiptHeader.getReceiptDetails())   if (!FinancialsUtil.isRevenueAccountHead(receiptDetail.getAccounthead(),chartOfAccountsHibernateDAO.getBankChartofAccountCodeList(),persistenceService)) {
    final ReceiptDetail newReceiptDetail=new ReceiptDetail();
    if (receiptDetail.getOrdernumber() != null)     newReceiptDetail.setOrdernumber(receiptDetail.getOrdernumber());
    if (receiptDetail.getDescription() != null)     newReceiptDetail.setDescription(receiptDetail.getDescription());
    if (receiptDetail.getIsActualDemand() != null)     newReceiptDetail.setIsActualDemand(receiptDetail.getIsActualDemand());
    if (receiptDetail.getFunction() != null)     newReceiptDetail.setFunction(receiptDetail.getFunction());
    if (receiptDetail.getCramountToBePaid() != null)     newReceiptDetail.setCramountToBePaid(receiptDetail.getCramountToBePaid());
    newReceiptDetail.setCramount(receiptDetail.getCramount());
    newReceiptDetail.setAccounthead(receiptDetail.getAccounthead());
    newReceiptDetail.setDramount(receiptDetail.getDramount());
    newReceiptDetail.setPurpose(receiptDetail.getPurpose());
    existingReceiptDetails.add(newReceiptDetail);
  }
  final List<ReceiptDetail> reconstructedList=collectionsUtil.reconstructReceiptDetail(onlinePaymentReceiptHeader,existingReceiptDetails);
  ReceiptDetail debitAccountDetail=null;
  if (reconstructedList != null)   debitAccountDetail=collectionCommon.addDebitAccountHeadDetails(onlinePaymentReceiptHeader.getTotalAmount(),onlinePaymentReceiptHeader,BigDecimal.ZERO,onlinePaymentReceiptHeader.getTotalAmount(),CollectionConstants.INSTRUMENTTYPE_ONLINE);
  receiptHeaderService.reconcileOnlineSuccessPayment(onlinePaymentReceiptHeader,paymentResponse.getTxnDate(),paymentResponse.getTxnReferenceNo(),paymentResponse.getTxnAmount(),paymentResponse.getAuthStatus(),reconstructedList,debitAccountDetail);
  LOGGER.debug("Persisted receipt after receiving success message from the payment gateway");
}

@ Transactional public void processSuccessMsg ( final ReceiptHeader onlinePaymentReceiptHeader , final PaymentResponse paymentResponse ) { final List < ReceiptDetail > existingReceiptDetails = new ArrayList < ReceiptDetail > ( 0 ) ; for ( final ReceiptDetail receiptDetail : onlinePaymentReceiptHeader . getReceiptDetails ( ) ) if ( ! FinancialsUtil . isRevenueAccountHead ( receiptDetail . getAccounthead ( ) , chartOfAccountsHibernateDAO . getBankChartofAccountCodeList ( ) , persistenceService ) ) { final ReceiptDetail newReceiptDetail = new ReceiptDetail ( ) ; if ( receiptDetail . getOrdernumber ( ) != null ) newReceiptDetail . setOrdernumber ( receiptDetail . getOrdernumber ( ) ) ; if ( receiptDetail . getDescription ( ) != null ) newReceiptDetail . setDescription ( receiptDetail . getDescription ( ) ) ; if ( receiptDetail . getIsActualDemand ( ) != null ) newReceiptDetail . setIsActualDemand ( receiptDetail . getIsActualDemand ( ) ) ; if ( receiptDetail . getFunction ( ) != null ) newReceiptDetail . setFunction ( receiptDetail . getFunction ( ) ) ; if ( receiptDetail . getCramountToBePaid ( ) != null ) newReceiptDetail . setCramountToBePaid ( receiptDetail . getCramountToBePaid ( ) ) ; newReceiptDetail . setCramount ( receiptDetail . getCramount ( ) ) ; newReceiptDetail . setAccounthead ( receiptDetail . getAccounthead ( ) ) ; newReceiptDetail . setDramount ( receiptDetail . getDramount ( ) ) ; newReceiptDetail . setPurpose ( receiptDetail . getPurpose ( ) ) ; existingReceiptDetails . add ( newReceiptDetail ) ; } final List < ReceiptDetail > reconstructedList = collectionsUtil . reconstructReceiptDetail ( onlinePaymentReceiptHeader , existingReceiptDetails ) ; ReceiptDetail debitAccountDetail = null ; if ( reconstructedList != null ) debitAccountDetail = collectionCommon . addDebitAccountHeadDetails ( onlinePaymentReceiptHeader . getTotalAmount ( ) , onlinePaymentReceiptHeader , BigDecimal . ZERO , onlinePaymentReceiptHeader . getTotalAmount ( ) , CollectionConstants . INSTRUMENTTYPE_ONLINE ) ; receiptHeaderService . reconcileOnlineSuccessPayment ( onlinePaymentReceiptHeader , paymentResponse . getTxnDate ( ) , paymentResponse . getTxnReferenceNo ( ) , paymentResponse . getTxnAmount ( ) , paymentResponse . getAuthStatus ( ) , reconstructedList , debitAccountDetail ) ; LOGGER . debug ( "Persisted receipt after receiving success message from the payment gateway" ) ; }
this method processes the success message arriving from the payment gateway . the receipt status is changed from pending to approved and the online transaction status is changed from pending to succcess . the authorization status for success ( 0300 ) for the online transaction is also persisted . an instrument of type ' online ' is created with the transaction details and are persisted along with the receipt details . voucher for the receipt is created and the financial system is updated . the billing system is updated about the receipt creation . in case update to financial systems / billing system fails , the receipt creation is rolled back and the receipt / payment status continues to be in pending state ( and will be reconciled manually ) .
