| Line 7... |
Line 7... |
| 7 |
import com.spice.profitmandi.common.model.TransactionApprovalModel;
|
7 |
import com.spice.profitmandi.common.model.TransactionApprovalModel;
|
| 8 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
8 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 9 |
import com.spice.profitmandi.dao.cart.CartService;
|
9 |
import com.spice.profitmandi.dao.cart.CartService;
|
| 10 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
10 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 11 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
11 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 12 |
import com.spice.profitmandi.dao.entity.transaction.LineItem;
|
- |
|
| 13 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
12 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 14 |
import com.spice.profitmandi.dao.entity.transaction.Transaction;
|
- |
|
| 15 |
import com.spice.profitmandi.dao.entity.transaction.TransactionApproval;
|
- |
|
| 16 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionApprovalStatus;
|
13 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionApprovalStatus;
|
| 17 |
import com.spice.profitmandi.dao.model.CartItem;
|
14 |
import com.spice.profitmandi.dao.model.CartItem;
|
| 18 |
import com.spice.profitmandi.dao.model.UserCart;
|
15 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 19 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
16 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
17 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| Line 158... |
Line 155... |
| 158 |
}
|
155 |
}
|
| 159 |
UserCart userCart = cartService.setCartItems(fofoId, cartItems);
|
156 |
UserCart userCart = cartService.setCartItems(fofoId, cartItems);
|
| 160 |
// createtransactionInternally set the value in transaction table
|
157 |
// createtransactionInternally set the value in transaction table
|
| 161 |
|
158 |
|
| 162 |
double creditAmountRequired = totalPayableAmount - walletAmount;
|
159 |
double creditAmountRequired = totalPayableAmount - walletAmount;
|
| - |
|
160 |
int loanId = 0;
|
| 163 |
if (creditAmountRequired > ProfitMandiConstants.MAX_NEGATIVE_WALLET_VALUE) {
|
161 |
if (creditAmountRequired > ProfitMandiConstants.MAX_NEGATIVE_WALLET_VALUE) {
|
| 164 |
sdCreditService.createLoan(userCart.getUserId(), creditAmountRequired, 365, "Credit limit assigned via SD Credit");
|
162 |
Loan loan = sdCreditService.createLoan(userCart.getUserId(), creditAmountRequired, 365, "Credit limit assigned via SD Credit");
|
| - |
|
163 |
loanId = loan.getId();
|
| 165 |
}
|
164 |
}
|
| 166 |
//return this.createLoan(userCart.getUserId(), creditAmountRequired);
|
165 |
//return this.createLoan(userCart.getUserId(), creditAmountRequired);
|
| 167 |
int transactionId = transactionService.createTransactionInternally(userCart, totalPayableAmount, 0);
|
166 |
int transactionId = transactionService.createTransactionInternally(userCart, totalPayableAmount, 0);
|
| 168 |
//Set here created by
|
167 |
//Set here created by
|
| 169 |
Transaction transaction = transactionRepository.selectById(transactionId);
|
168 |
Transaction transaction = transactionRepository.selectById(transactionId);
|
| 170 |
transaction.setCreatedBy(creatorId);
|
169 |
transaction.setCreatedBy(creatorId);
|
| 171 |
LOGGER.info("transaction created by {}", transaction.getCreatedBy());
|
170 |
LOGGER.info("transaction created by {}", transaction.getCreatedBy());
|
| 172 |
commonPaymentService.payThroughWallet(transactionId);
|
171 |
commonPaymentService.payThroughWallet(transactionId);
|
| 173 |
if (approvalNotRequired) {
|
172 |
if (approvalNotRequired) {
|
| 174 |
transactionService.processTransaction(transactionId);
|
173 |
transactionService.processTransaction(transactionId,loanId);
|
| 175 |
} else {
|
174 |
} else {
|
| 176 |
this.createApproval(transactionId);
|
175 |
this.createApproval(transactionId);
|
| 177 |
}
|
176 |
}
|
| 178 |
|
177 |
|
| 179 |
}
|
178 |
}
|