@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) public PaymentLog createRefundEntryForPaymentLogAndCommit( PaymentLog paymentLog, RefundReason reason) throws RefundEntryAlreadyExistsException { paymentLog = createRefundEntryForAmount(paymentLog, reason, paymentLog.getCryptocurrencyAmount(), paymentLog.getUsdAmount()); return paymentLogService.updateProcessedDateAndSave(paymentLog); }
/** * 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; } }
return paymentLogService.updateProcessedDateAndSave(paymentLog);
@Transactional(propagation = Propagation.REQUIRED) public PaymentLog sendTransactionReceivedMessageAndSavePaymentLog(PaymentLog paymentLog, BigDecimal amountInMainUnit, String transactionUrl) { messageService.send(new TransactionReceivedEmailMessage( MessageDTOHelper.build(paymentLog.getInvestor()), amountInMainUnit, paymentLog.getCurrency(), transactionUrl)); paymentLog.setTransactionReceivedMessageSent(true); return paymentLogService.updateProcessedDateAndSave(paymentLog); }
return paymentLogService.updateProcessedDateAndSave(paymentLog);
@Transactional(propagation = Propagation.REQUIRED) public PaymentLog sendAllocationMessageAndSavePaymentLog(PaymentLog paymentLog, BigDecimal amountInMainUnit, String transactionUrl) { messageService.send(new TokensAllocatedEmailMessage( MessageDTOHelper.build(paymentLog.getInvestor()), amountInMainUnit, paymentLog.getCurrency(), transactionUrl, convertTomicsToTokens(paymentLog.getAllocatedTomics()))); paymentLog.setAllocationMessageSent(true); return paymentLogService.updateProcessedDateAndSave(paymentLog); }
return paymentLogService.updateProcessedDateAndSave(paymentLog); } else { throw new NoTierAtDateException();