def toggleCardLockStatus(self, cardId, consumerId): millis = SSUtil.getMillis() cacheService = CacheService() statusFlag = 0 try: consumer = Consumer.objects.get(id=consumerId) consumerCard = ConsumerCard.objects.get(id=cardId) if SSUtil.isIdinList(consumer.blockedCards, cardId): consumer.blockedCards = SSUtil.removeIdFromList( consumer.blockedCards, cardId) statusFlag = 1 consumerCard.status = 1 else: consumer.blockedCards = SSUtil.addIdToList( consumer.blockedCards, cardId) statusFlag = 0 consumerCard.status = 0 consumer.updated = millis consumerCard.updated = millis consumer.save() cacheService.setConsumer(consumer.id) consumerCard.save() cacheService.setCard(consumerCard.id) return statusFlag except: raise Exception(SSException.PROCESSING_FAILED)
def lockTxTypeStatus(self, cardId, txType): millis = SSUtil.getMillis() statusFlag = 0 cacheService = CacheService() try: consumerCard = ConsumerCard.objects.get(id=cardId) if not SSUtil.isIdinList(consumerCard.blockedTxTypes,txType): consumerCard.blockedTxTypes = SSUtil.addIdToList(consumerCard.blockedTxTypes,txType) statusFlag = 0 consumerCard.updated = millis consumerCard.save() cacheService.setCard(cardId) return statusFlag except: raise Exception(SSException.PROCESSING_FAILED)
def lockMerchantStatus(self, merchantId, consumerId): millis = SSUtil.getMillis() statusFlag = 0 cacheService = CacheService() try: consumer = Consumer.objects.get(id=consumerId) if not SSUtil.isIdinList(consumer.blockedMerchants, merchantId): consumer.blockedMerchants = SSUtil.addIdToList( consumer.blockedMerchants, merchantId) statusFlag = 0 consumer.updated = millis consumer.save() cacheService.setConsumer(consumer.id) merchServ = MerchantService() merchServ.toggleStatus(merchantId, consumerId, statusFlag) return statusFlag except: raise Exception(SSException.PROCESSING_FAILED)