Subversion Repositories SmartDukaan

Rev

Rev 34562 | Rev 34822 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34562 Rev 34654
Line 50... Line 50...
50
import com.spice.profitmandi.service.inventory.*;
50
import com.spice.profitmandi.service.inventory.*;
51
import com.spice.profitmandi.service.order.OrderService;
51
import com.spice.profitmandi.service.order.OrderService;
52
import com.spice.profitmandi.service.scheme.SchemeService;
52
import com.spice.profitmandi.service.scheme.SchemeService;
53
import com.spice.profitmandi.service.user.RetailerService;
53
import com.spice.profitmandi.service.user.RetailerService;
54
import com.spice.profitmandi.dao.service.OtpProcessor;
54
import com.spice.profitmandi.dao.service.OtpProcessor;
-
 
55
import com.spice.profitmandi.service.wallet.WalletService;
55
import com.spice.profitmandi.web.res.DealBrands;
56
import com.spice.profitmandi.web.res.DealBrands;
56
import com.spice.profitmandi.web.res.DealObjectResponse;
57
import com.spice.profitmandi.web.res.DealObjectResponse;
57
import com.spice.profitmandi.web.res.DealsResponse;
58
import com.spice.profitmandi.web.res.DealsResponse;
58
import com.spice.profitmandi.web.res.ValidateCartResponse;
59
import com.spice.profitmandi.web.res.ValidateCartResponse;
59
import com.spice.profitmandi.web.services.PartnerIndexService;
60
import com.spice.profitmandi.web.services.PartnerIndexService;
-
 
61
import in.shop2020.model.v1.order.WalletReferenceType;
60
import io.swagger.annotations.ApiImplicitParam;
62
import io.swagger.annotations.ApiImplicitParam;
61
import io.swagger.annotations.ApiImplicitParams;
63
import io.swagger.annotations.ApiImplicitParams;
62
import io.swagger.annotations.ApiOperation;
64
import io.swagger.annotations.ApiOperation;
63
import org.apache.commons.lang3.StringUtils;
65
import org.apache.commons.lang3.StringUtils;
64
import org.apache.http.conn.HttpHostConnectException;
66
import org.apache.http.conn.HttpHostConnectException;
Line 229... Line 231...
229
    BidRepository bidRepository;
231
    BidRepository bidRepository;
230
 
232
 
231
    @Autowired
233
    @Autowired
232
    BidService bidService;
234
    BidService bidService;
233
 
235
 
-
 
236
    @Autowired
-
 
237
    WalletService walletService;
-
 
238
 
234
    List<String> filterableParams = Arrays.asList("brand");
239
    List<String> filterableParams = Arrays.asList("brand");
235
 
240
 
236
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
241
    @RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
237
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
242
    @ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
238
    @ApiOperation(value = "Get unit deal object")
243
    @ApiOperation(value = "Get unit deal object")
Line 1353... Line 1358...
1353
        bid.setQuantity(biddingModel.getBidQty());
1358
        bid.setQuantity(biddingModel.getBidQty());
1354
        bid.setStatus(ProfitMandiConstants.BID_ENUM.PENDING);
1359
        bid.setStatus(ProfitMandiConstants.BID_ENUM.PENDING);
1355
        bid.setCreatedAt(LocalDateTime.now());
1360
        bid.setCreatedAt(LocalDateTime.now());
1356
        if (biddingModel.getId() == null) {
1361
        if (biddingModel.getId() == null) {
1357
            bidRepository.persist(bid);
1362
            bidRepository.persist(bid);
-
 
1363
            //debit 500 from wallet
-
 
1364
            String reason = "Advance security for "+bid.getItemName()+" bid";
-
 
1365
            String message = "Dear Partner - We have Debited Rs "+ProfitMandiConstants.BID_CHARGES+" as Booking amount against your Bidding of Model No. "+bid.getItemName()+". We will refund this amount if the Bid gets approved.";
-
 
1366
            walletService.consumeAmountFromWallet(bid.getFofoId(),
-
 
1367
                    bid.getId(),
-
 
1368
                    WalletReferenceType.ADVANCE_SECURITY,
-
 
1369
                    reason, ProfitMandiConstants.BID_CHARGES,
-
 
1370
                    bid.getCreatedAt(),true);
-
 
1371
            bidService.sendPushNotification(message,"Bidding Update!",Arrays.asList(bid.getFofoId()));
1358
        }
1372
        }
1359
        if (biddings.size() > 1) {
1373
        if (biddings.size() > 1) {
1360
            for (Bid bidding : biddings) {
1374
            for (Bid bidding : biddings) {
1361
                if (!(bid.getFofoId().equals(bidding.getFofoId()))) bidService.notifyPartner(bidding.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.UPDATE);
1375
                if (!(bid.getFofoId().equals(bidding.getFofoId()))) bidService.notifyPartner(bidding.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.UPDATE);
1362
            }
1376
            }
1363
        }
1377
        }
1364
        bidService.notifyPartner(bid.getFofoId(), bid, bid.getStatus());
-
 
1365
        return responseSender.ok("Bid placed successfully!");
1378
        return responseSender.ok("Bid placed successfully!");
1366
    }
1379
    }
1367
 
1380
 
1368
 
1381
 
1369
}
1382
}
1370
1383