/** * Fetches the payment log corresponding to the given transaction id if it is in status * {@link TransactionStatus#PENDING}. If successful it also updates the payment log status to * {@link TransactionStatus#BUILDING} before returning it. * @param transactionId The transaction id for which the corresponding payment log should be * retrieved. * @return the payment log for given transaction id if it is in status * {@link TransactionStatus#PENDING}. Null otherwise. * @throws PaymentLogNotFoundException if no payment log exists for the given transaction id. */ @Transactional(propagation = Propagation.REQUIRED) public PaymentLog getPendingPaymentLogForProcessing(String transactionId) throws PaymentLogNotFoundException { try { PaymentLog paymentLog = paymentLogService.getPaymentLog(transactionId); if (paymentLog.getTransactionStatus() != TransactionStatus.PENDING) { return null; } else { paymentLog.setTransactionStatus(TransactionStatus.BUILDING); return paymentLogService.updateProcessedDateAndSave(paymentLog); } } catch (OptimisticLockingFailureException e) { // If payment log was just now updated by another monitor instance // the payment log does not need to be reprocessed. return null; } }
PaymentLog paymentLog = paymentLogService.getPaymentLog(transactionId); boolean confirmationMailSent = paymentLog.isTransactionReceivedMessageSent(); boolean notPending = paymentLog.getTransactionStatus() != TransactionStatus.PENDING;
protected void confirmTransaction(TransactionAdapter tx) { try { LOG.info("Setting status of transaction {} to confirmed.", tx.getTransactionId()); PaymentLog paymentLog = paymentLogService.getPaymentLog(tx.getTransactionId()); paymentLog.setTransactionStatus(TransactionStatus.CONFIRMED); paymentLogService.saveAndCommit(paymentLog); } catch (MissingTransactionInformationException e) { LOG.error("Couldn't set payment log status to confirmed because the transaction id " + "could not be retrieved from the {} transaction.", tx.getCurrencyType(), e); } catch (PaymentLogNotFoundException e) { try { LOG.error("No payment log existed for {} transaction {} when trying to set the " + "transaction status to CONFIRMED", tx.getCurrencyType(), tx.getTransactionId(), e); } catch (MissingTransactionInformationException ignore) { } } }
PaymentLog paymentLog = paymentLogService.getPaymentLog(transactionId); boolean pending = paymentLog.getTransactionStatus() == TransactionStatus.PENDING; boolean allocationMailSent = paymentLog.isAllocationMessageSent();