Subversion Repositories SmartDukaan

Rev

Rev 36372 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22550 ashik.ali 1
package com.spice.profitmandi.service.wallet;
2
 
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
34261 tejus.loha 4
import com.spice.profitmandi.common.model.CustomRetailer;
30740 amit.gupta 5
import com.spice.profitmandi.common.model.ProfitMandiConstants;
34261 tejus.loha 6
import com.spice.profitmandi.common.util.FileUtil;
23269 ashik.ali 7
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
25542 amit.gupta 8
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
34261 tejus.loha 9
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
32494 amit.gupta 10
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
22550 ashik.ali 11
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
12
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
34674 aman.kumar 13
import com.spice.profitmandi.dao.entity.user.User;
22550 ashik.ali 14
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
34261 tejus.loha 15
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
16
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
32494 amit.gupta 17
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
25542 amit.gupta 18
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
33845 tejus.loha 19
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
33172 tejus.loha 20
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
22550 ashik.ali 21
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
22
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
23
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
33845 tejus.loha 24
import com.spice.profitmandi.dao.repository.user.StoreTimelinetbRepository;
34674 aman.kumar 25
import com.spice.profitmandi.dao.repository.user.UserRepository;
30025 amit.gupta 26
import com.spice.profitmandi.service.NotificationService;
30740 amit.gupta 27
import com.spice.profitmandi.service.PartnerInvestmentService;
34261 tejus.loha 28
import com.spice.profitmandi.service.order.OrderService;
29
import com.spice.profitmandi.service.user.RetailerService;
33845 tejus.loha 30
import com.spice.profitmandi.service.user.StoreTimelineTatService;
22857 ashik.ali 31
import in.shop2020.model.v1.order.WalletReferenceType;
30025 amit.gupta 32
import org.apache.logging.log4j.LogManager;
33
import org.apache.logging.log4j.Logger;
34
import org.springframework.beans.factory.annotation.Autowired;
34261 tejus.loha 35
import org.springframework.http.ResponseEntity;
30025 amit.gupta 36
import org.springframework.stereotype.Component;
22857 ashik.ali 37
 
30025 amit.gupta 38
import java.time.LocalDateTime;
39
import java.util.*;
40
import java.util.stream.Collectors;
41
 
22550 ashik.ali 42
@Component
43
public class WalletServiceImpl implements WalletService {
44
 
32494 amit.gupta 45
    private static final Logger LOGGER = LogManager.getLogger(WalletServiceImpl.class);
25395 tejbeer 46
 
32494 amit.gupta 47
    @Autowired
48
    ManualPaymentRequestRepository manualPaymentRequestRepository;
34261 tejus.loha 49
    @Autowired
50
    AddWalletRequestRepository addWalletRequestRepository;
51
    @Autowired
52
    OrderService orderService;
53
    @Autowired
54
    RetailerService retailerService;
33194 amit.gupta 55
    ProfitMandiBusinessException pbse = new ProfitMandiBusinessException("Wallet", "Wallet", "Wallet is under maintainance, please try after some time");
56
    ProfitMandiBusinessException inactivepbse = new ProfitMandiBusinessException("Wallet", "Wallet", "Investment is incomplete, please add amount to wallet to complete the investment");
57
 
32494 amit.gupta 58
    @Autowired
59
    PartnerInvestmentService partnerInvestmentService;
60
    private boolean underMaintainance = false;
61
    @Autowired
62
    private UserAccountRepository userAccountRepository;
33172 tejus.loha 63
 
32494 amit.gupta 64
    @Autowired
65
    private UserWalletRepository userWalletRepository;
66
    @Autowired
67
    private FofoStoreRepository fofoStoreRepository;
68
    @Autowired
69
    private UserWalletHistoryRepository userWalletHistoryRepository;
70
    @Autowired
71
    private NotificationService notificationService;
24739 tejbeer 72
 
33172 tejus.loha 73
    @Autowired
74
    RetailerRepository retailerRepository;
33845 tejus.loha 75
    @Autowired
76
    PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
77
    @Autowired
78
    StoreTimelineTatService storeTimelineTatService;
79
    @Autowired
80
    StoreTimelinetbRepository storeTimelinetbRepository;
33172 tejus.loha 81
 
34674 aman.kumar 82
    @Autowired
83
    UserRepository userRepository;
84
 
32494 amit.gupta 85
    @Override
86
    public void addAmountToWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
87
                                  String description, float amount, LocalDateTime businessTime) throws ProfitMandiBusinessException {
88
        if (Math.round(amount) == 0)
89
            return;
36372 amit 90
        UserWallet userWallet = userWalletRepository.selectByRetailerIdForUpdate(retailerId);
35828 amit 91
        userWallet.setAmount(userWallet.getAmount() + Math.round(amount));
36513 amit 92
        this.createUserWalletHistory(Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime, userWallet.getAmount());
36305 amit 93
        if (WalletReferenceType.AUTOMATED_ADVANCE.equals(referenceType)
94
                || WalletReferenceType.ADVANCE_AMOUNT.equals(referenceType)
95
                || WalletReferenceType.PAYMENT_GATEWAY.equals(referenceType)
96
                || WalletReferenceType.ONLINE_ORDER_PAYMENT.equals(referenceType)
97
                || WalletReferenceType.PURCHASE.equals(referenceType)) {
98
            partnerInvestmentService.evictInvestmentCache(retailerId);
99
        }
32494 amit.gupta 100
    }
25609 amit.gupta 101
 
32494 amit.gupta 102
    @Override
103
    public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
104
                                        String description, float amount, LocalDateTime businessTime) throws ProfitMandiBusinessException {
105
        if (underMaintainance) {
106
            throw pbse;
107
        } else if (WalletReferenceType.RECHARGE.equals(referenceType) && !isActive(retailerId)) {
108
            throw inactivepbse;
109
        }
110
        if (amount == 0)
111
            return;
36372 amit 112
        UserWallet userWallet = userWalletRepository.selectByRetailerIdForUpdate(retailerId);
35828 amit 113
        int walletAmount = userWallet.getAmount();
33547 tejus.loha 114
        if (!WalletReferenceType.DAMAGE_PROTECTION.equals(referenceType) && amount > ProfitMandiConstants.MAX_NEGATIVE_WALLET_VALUE && Math.floor(amount) > walletAmount) {
34575 vikas.jang 115
            LOGGER.error("Wallet Balance is insufficient!, needed - {}, wallet has - {}, for retailer - {}", Math.floor(amount), walletAmount, retailerId);
34674 aman.kumar 116
            User user = userRepository.selectById(retailerId);
117
            throw new ProfitMandiBusinessException(user.getName(), walletAmount, "WLT_1000");
32494 amit.gupta 118
        }
119
        userWallet.setAmount(walletAmount - Math.round(amount));
36513 amit 120
        this.createUserWalletHistory(-Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime, userWallet.getAmount());
32494 amit.gupta 121
    }
24739 tejbeer 122
 
32494 amit.gupta 123
    @Override
124
    public void consumeAmountFromWallet(int retailerId, int referenceId, WalletReferenceType referenceType,
125
                                        String description, float amount, LocalDateTime businessTime, boolean forced) throws ProfitMandiBusinessException {
126
        if (underMaintainance) {
127
            throw pbse;
128
        } else if (WalletReferenceType.RECHARGE.equals(referenceType) && !isActive(retailerId)) {
129
            throw inactivepbse;
130
        }
131
        if (amount == 0)
132
            return;
36372 amit 133
        UserWallet userWallet = userWalletRepository.selectByRetailerIdForUpdate(retailerId);
35828 amit 134
        int walletAmount = userWallet.getAmount();
32494 amit.gupta 135
        if (!forced && amount > 2 && amount > walletAmount) {
136
            LOGGER.error("Wallet Balance is insufficient!");
137
            throw new ProfitMandiBusinessException("balance", walletAmount, "WLT_1000");
138
        }
139
        userWallet.setAmount(walletAmount - Math.round(amount));
36513 amit 140
        this.createUserWalletHistory(-Math.round(amount), userWallet.getId(), referenceId, referenceType, description, businessTime, userWallet.getAmount());
32494 amit.gupta 141
    }
24739 tejbeer 142
 
32494 amit.gupta 143
    @Override
144
    public void rollbackAmountFromWallet(int retailerId, float amountToRollback, int rollbackReference,
145
                                         WalletReferenceType walletReferenceType, String rollbackReason, LocalDateTime businessTime) throws ProfitMandiBusinessException {
25542 amit.gupta 146
 
32494 amit.gupta 147
        if (amountToRollback == 0)
148
            return;
36372 amit 149
        UserWallet userWallet = userWalletRepository.selectByRetailerIdForUpdate(retailerId);
35828 amit 150
        int walletAmount = userWallet.getAmount();
32494 amit.gupta 151
        List<UserWalletHistory> uwh = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(rollbackReference, walletReferenceType)
152
                .stream().filter(x -> x.getWalletId() == userWallet.getId()).collect(Collectors.toList());
153
        if (uwh.size() == 0) {
154
            LOGGER.info("Retailer with id {} dont have valid reference {} and reference type {}",
155
                    retailerId, rollbackReference, walletReferenceType);
156
            throw new ProfitMandiBusinessException("Retailer specific wallet entries doesn't exist", retailerId, "Nothing to rollback");
157
        }
158
        userWallet.setAmount(walletAmount - Math.round(amountToRollback));
159
        this.createUserWalletHistory(-Math.round(amountToRollback), userWallet.getId(), rollbackReference,
36513 amit 160
                walletReferenceType, rollbackReason, businessTime, userWallet.getAmount());
32494 amit.gupta 161
        userWalletRepository.persist(userWallet);
24739 tejbeer 162
 
32494 amit.gupta 163
    }
30025 amit.gupta 164
 
32494 amit.gupta 165
    private void createUserWalletHistory(float amount, int walletId, int referenceId, WalletReferenceType referenceType,
36513 amit 166
                                         String description, LocalDateTime businessTimestamp, long walletBalance) {
32494 amit.gupta 167
        if (amount == 0)
168
            return;
169
        UserWalletHistory userWalletHistory = new UserWalletHistory();
170
        userWalletHistory.setWalletId(walletId);
171
        userWalletHistory.setAmount(Math.round(amount));
172
        userWalletHistory.setReference(referenceId);
173
        userWalletHistory.setReferenceType(referenceType);
174
        userWalletHistory.setTimestamp(LocalDateTime.now());
175
        userWalletHistory.setDescription(description);
176
        userWalletHistory.setBusinessTimestamp(businessTimestamp);
36513 amit 177
        userWalletHistory.setRunningBalance(walletBalance);
32494 amit.gupta 178
        userWalletHistoryRepository.persist(userWalletHistory);
179
    }
24739 tejbeer 180
 
32494 amit.gupta 181
    @Override
182
    public UserWallet getUserWalletByUserId(int userId) throws ProfitMandiBusinessException {
183
        UserAccount userAccount = userAccountRepository.selectByUserIdType(userId, AccountType.saholic);
23509 amit.gupta 184
 
32494 amit.gupta 185
        if (underMaintainance) {
186
            throw pbse;
187
        }
188
        return userWalletRepository.selectByRetailerId(Integer.valueOf(userAccount.getAccountKey()));
189
    }
30889 amit.gupta 190
 
32494 amit.gupta 191
    @Override
192
    public List<UserWalletHistory> getUserWalletHistoryByUserId(int userId) throws ProfitMandiBusinessException {
193
        if (underMaintainance || !isActive(userId)) {
194
            throw pbse;
195
        }
196
        UserWallet userWallet = this.getUserWalletByUserId(userId);
197
        List<UserWalletHistory> userWalletHistories = userWalletHistoryRepository.selectByWalletId(userWallet.getId());
198
        return userWalletHistories;
199
    }
25395 tejbeer 200
 
32494 amit.gupta 201
    //Definition is now changed, active also means valid investment should be ok
202
    private boolean isActive(int userId) {
203
        boolean active = true;
204
        try {
205
            FofoStore fs = fofoStoreRepository.selectByRetailerId(userId);
206
            active = fs.isActive() && partnerInvestmentService.isInvestmentOk(userId, ProfitMandiConstants.MIN_INVESTMENT_PERCENTAGE, ProfitMandiConstants.CUTOFF_INVESTMENT);
207
        } catch (Exception e) {
24739 tejbeer 208
 
32494 amit.gupta 209
        }
210
        return active;
211
    }
24739 tejbeer 212
 
32494 amit.gupta 213
    @Override
214
    public List<UserWalletHistory> getUserWalletHistoryByRetailerId(int retailerId)
215
            throws ProfitMandiBusinessException {
216
        if (underMaintainance) {
217
            throw pbse;
218
        }
219
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
220
        return userWalletHistoryRepository.selectByWalletId(userWallet.getId());
221
    }
24739 tejbeer 222
 
32494 amit.gupta 223
    @Override
224
    public long getSizeByRetailerId(int retailerId, LocalDateTime startDateTime, LocalDateTime endDateTime)
225
            throws ProfitMandiBusinessException {
226
        if (underMaintainance) {
227
            throw pbse;
228
        }
229
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
230
        return userWalletHistoryRepository.selectCountByWalletId(userWallet.getId(), startDateTime, endDateTime);
231
    }
25542 amit.gupta 232
 
32494 amit.gupta 233
    @Override
234
    public List<UserWalletHistory> getPaginatedUserWalletHistoryByRetailerId(int retailerId,
235
                                                                             LocalDateTime startDateTime, LocalDateTime endDateTime, int offset, int limit)
236
            throws ProfitMandiBusinessException {
237
        if (underMaintainance) {
238
            throw pbse;
239
        }
240
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
241
        return userWalletHistoryRepository.selectPaginatedByWalletId(userWallet.getId(), startDateTime, endDateTime,
242
                offset, limit);
243
    }
22550 ashik.ali 244
 
32494 amit.gupta 245
    @Override
33247 ranu 246
    public Map<Integer, UserWallet> getRetailerIdUserWalletMap(Set<Integer> retailerIds) throws ProfitMandiBusinessException {
32494 amit.gupta 247
        List<UserWallet> userWallets = userWalletRepository.selectByRetailerIds(retailerIds);
248
        Map<Integer, UserWallet> retailerIdUserWalletMap = new HashMap<>();
249
        for (UserWallet userWallet : userWallets) {
250
            retailerIdUserWalletMap.put(userWallet.getUserId(), userWallet);
251
        }
252
        return retailerIdUserWalletMap;
253
    }
24739 tejbeer 254
 
32494 amit.gupta 255
    @Override
33247 ranu 256
    public Map<Integer, Integer> getWaleltRetailerMap(Set<Integer> walletIds) throws ProfitMandiBusinessException {
32494 amit.gupta 257
        List<UserWallet> userWallets = userWalletRepository.selectAllById(walletIds);
258
        Map<Integer, Integer> walletRetailerMap = new HashMap<>();
259
        for (UserWallet userWallet : userWallets) {
260
            walletRetailerMap.put(userWallet.getId(), userWallet.getUserId());
261
        }
262
        return walletRetailerMap;
263
    }
30740 amit.gupta 264
 
32494 amit.gupta 265
    @Override
266
    public boolean isExistWalletHistory(int retailerId, int referenceId, WalletReferenceType referenceType)
267
            throws ProfitMandiBusinessException {
268
        if (underMaintainance) {
269
            throw pbse;
270
        }
271
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
272
        return userWalletHistoryRepository.isExist(userWallet.getId(), referenceType, referenceId);
273
    }
25542 amit.gupta 274
 
32494 amit.gupta 275
    @Override
276
    public UserWallet getUserWallet(int retailerId) throws ProfitMandiBusinessException {
277
        if (underMaintainance) {
278
            throw pbse;
279
        }
280
        try {
281
            return userWalletRepository.selectByRetailerId(retailerId);
282
        } catch (Exception e) {
283
            UserWallet uw = new UserWallet();
284
            uw.setAmount(0);
285
            uw.setRefundableAmount(0);
286
            uw.setUserId(retailerId);
287
            userWalletRepository.persist(uw);
288
            return uw;
289
        }
290
    }
25542 amit.gupta 291
 
32494 amit.gupta 292
    @Override
293
    public float getOpeningTill(int fofoId, LocalDateTime date) throws ProfitMandiBusinessException {
294
        UserWallet wallet = userWalletRepository.selectByRetailerId(fofoId);
295
        return userWalletHistoryRepository.getSumTillDate(wallet.getId(), date);
296
    }
24739 tejbeer 297
 
32494 amit.gupta 298
    @Override
299
    public float getOpeningTillExcludingPurchase(int fofoId, LocalDateTime date) throws ProfitMandiBusinessException {
300
        UserWallet wallet = userWalletRepository.selectByRetailerId(fofoId);
301
        return userWalletHistoryRepository.getSumTillDate(wallet.getId(), date) - userWalletHistoryRepository.getSumTillDate(wallet.getId(), date, WalletReferenceType.PURCHASE);
302
    }
24739 tejbeer 303
 
32494 amit.gupta 304
    @Override
305
    public boolean refundToWallet(int retailerId, float amountToRefund, int transactionId,
306
                                  WalletReferenceType walletReferenceType, String description) throws ProfitMandiBusinessException {
24739 tejbeer 307
 
32494 amit.gupta 308
        List<UserWalletHistory> all_entries = userWalletHistoryRepository
309
                .selectAllByreferenceIdandreferenceType(transactionId, walletReferenceType);
30449 amit.gupta 310
 
32494 amit.gupta 311
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
35828 amit 312
        int walletAmount = userWallet.getAmount();
32494 amit.gupta 313
        LOGGER.info("userWallet" + userWallet);
314
        int max_eligible_credit_amount = 0;
24739 tejbeer 315
 
32494 amit.gupta 316
        LOGGER.info("all_entries {}", all_entries);
317
        for (UserWalletHistory history : all_entries) {
318
            max_eligible_credit_amount -= history.getAmount();
319
        }
320
        if (max_eligible_credit_amount < amountToRefund) {
321
            LOGGER.info("Cant be credited back to wallet as most of it has been already credited");
322
            return false;
323
        }
22550 ashik.ali 324
 
32494 amit.gupta 325
        userWallet.setAmount(walletAmount + Math.round(amountToRefund));
23509 amit.gupta 326
 
32494 amit.gupta 327
        LOGGER.info("userWallet" + userWallet);
30449 amit.gupta 328
 
32494 amit.gupta 329
        UserWalletHistory userWalletHistory = new UserWalletHistory();
330
        userWalletHistory.setAmount(Math.round(amountToRefund));
331
        userWalletHistory.setReference(transactionId);
332
        userWalletHistory.setReferenceType(walletReferenceType);
333
        userWalletHistory.setWalletId(userWallet.getId());
334
        userWalletHistory.setTimestamp(LocalDateTime.now());
335
        userWalletHistory.setDescription(description);
336
        userWalletHistory.setBusinessTimestamp(all_entries.get(0).getBusinessTimestamp());
36513 amit 337
        userWalletHistory.setRunningBalance(userWallet.getAmount());
30449 amit.gupta 338
 
32494 amit.gupta 339
        userWalletHistoryRepository.persist(userWalletHistory);
340
        return true;
24739 tejbeer 341
 
32494 amit.gupta 342
    }
26254 amit.gupta 343
 
32494 amit.gupta 344
    @Override
345
    public int getWalletAmount(int retailerId) throws ProfitMandiBusinessException {
346
        UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
347
        if (userWallet == null) {
33421 amit.gupta 348
            userWallet = new UserWallet();
349
            userWallet.setUserId(retailerId);
350
            userWalletRepository.persist(userWallet);
32494 amit.gupta 351
        }
35828 amit 352
        int sum = (int) userWalletHistoryRepository.selectSumByWallet(userWallet.getId());
353
        userWallet.setAmount(sum);
354
        return sum;
32494 amit.gupta 355
    }
24739 tejbeer 356
 
32494 amit.gupta 357
    @Override
358
    public List<UserWalletHistory> getAllByReference(int fofoId, int reference, WalletReferenceType walletReferenceType)
359
            throws ProfitMandiBusinessException {
360
        UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
361
        if (userWallet == null) {
362
            return new ArrayList<UserWalletHistory>();
363
        }
364
        return userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(userWallet.getId(), reference,
365
                walletReferenceType);
366
    }
30449 amit.gupta 367
 
32494 amit.gupta 368
    @Override
369
    public void resetWallet() throws ProfitMandiBusinessException {
370
        List<UserWallet> userWallets = userWalletRepository.selectAll();
371
        for (UserWallet userWallet : userWallets) {
372
            userWallet.setAmount(this.getWalletAmount(userWallet.getUserId()));
24739 tejbeer 373
 
32494 amit.gupta 374
        }
375
    }
25395 tejbeer 376
 
32494 amit.gupta 377
    @Override
378
    public int getManualReference(WalletReferenceType referenceType) {
379
        ManualPaymentType paymentType = manualPaymentRequestRepository.selectByReferenceType(referenceType);
24739 tejbeer 380
 
32494 amit.gupta 381
        if (paymentType == null) {
382
            paymentType = new ManualPaymentType();
383
            paymentType.setReferenceType(referenceType);
384
            manualPaymentRequestRepository.persist(paymentType);
385
        }
386
        paymentType.setCounter(paymentType.getCounter() + 1);
387
        return paymentType.getCounter();
24739 tejbeer 388
 
32494 amit.gupta 389
    }
34261 tejus.loha 390
 
391
    @Override
392
    public ResponseEntity<?> createAddWalletRequestReport(LocalDateTime startDate, LocalDateTime endDate, AddWalletRequestStatus status) throws Exception {
393
        List<List<?>> rows = new ArrayList<>();
394
        List<String> header = Arrays.asList(
395
                "Retailer Id",
396
                "Retailer Name",
397
                "Email",
398
                "City",
399
                "State",
400
                "Transaction Reference",
401
                "Bank Name",
402
                "Reference Date",
403
                "Amount",
404
                "status",
405
                "Created On",
406
                "Updated On"
407
        );
408
 
409
        List<AddWalletRequest> addWalletRequests = addWalletRequestRepository.selectAllRetailerIdByDateAndStatus(startDate, endDate, status);
410
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
411
        for (AddWalletRequest addWalletRequest : addWalletRequests) {
412
            CustomRetailer customRetailer = customRetailerMap.get(addWalletRequest.getRetailerId());
413
            rows.add(Arrays
414
                    .asList(
415
                            addWalletRequest.getRetailerId(),
416
                            customRetailer.getBusinessName(),
417
                            customRetailer.getEmail(),
418
                            customRetailer.getAddress().getCity(),
419
                            customRetailer.getAddress().getState(),
420
                            addWalletRequest.getTransaction_reference(),
421
                            addWalletRequest.getBank_name(),
422
                            addWalletRequest.getReference_date(),
423
                            addWalletRequest.getAmount(),
424
                            addWalletRequest.getStatus(),
425
                            addWalletRequest.getCreateTimestamp(),
426
                            addWalletRequest.getUpdateTimestamp()
427
                    )
428
            );
429
        }
430
        org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil.getCSVByteStream(header, rows);
431
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Add-wallet-request-"+status+"-Reort-" + startDate.toLocalDate() + "-To-" + endDate.toLocalDate());
432
        return responseEntity;
433
    }
32494 amit.gupta 434
}
24739 tejbeer 435