Subversion Repositories SmartDukaan

Rev

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

Rev 30745 Rev 30889
Line 16... Line 16...
16
import com.spice.profitmandi.common.util.Utils;
16
import com.spice.profitmandi.common.util.Utils;
17
import com.spice.profitmandi.dao.entity.catalog.Item;
17
import com.spice.profitmandi.dao.entity.catalog.Item;
18
import com.spice.profitmandi.dao.entity.catalog.Offer;
18
import com.spice.profitmandi.dao.entity.catalog.Offer;
19
import com.spice.profitmandi.dao.entity.catalog.Scheme;
19
import com.spice.profitmandi.dao.entity.catalog.Scheme;
20
import com.spice.profitmandi.dao.entity.catalog.TagListing;
20
import com.spice.profitmandi.dao.entity.catalog.TagListing;
21
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
-
 
22
import com.spice.profitmandi.dao.entity.dtr.CreditStatus;
-
 
23
import com.spice.profitmandi.dao.entity.dtr.Document;
21
import com.spice.profitmandi.dao.entity.dtr.*;
24
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
-
 
25
import com.spice.profitmandi.dao.entity.fofo.*;
22
import com.spice.profitmandi.dao.entity.fofo.*;
26
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
23
import com.spice.profitmandi.dao.entity.inventory.SaholicInventorySnapshot;
27
import com.spice.profitmandi.dao.entity.inventory.SaholicReservationSnapshot;
24
import com.spice.profitmandi.dao.entity.inventory.SaholicReservationSnapshot;
28
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
25
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
29
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
26
import com.spice.profitmandi.dao.entity.inventory.Warehouse;
Line 1827... Line 1824...
1827
 
1824
 
1828
			}
1825
			}
1829
		}
1826
		}
1830
	}
1827
	}
1831
 
1828
 
-
 
1829
	@Autowired
-
 
1830
	InsurancePolicyRepository insurancePolicyRepository;
-
 
1831
 
-
 
1832
	public void addMissingWalletDebitsForInsurance() throws Exception {
-
 
1833
		List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(5, Optional.of(null));
-
 
1834
		for (InsurancePolicy insurancePolicy : insurancePolicies) {
-
 
1835
			FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(insurancePolicy.getInvoiceNumber());
-
 
1836
			List<UserWalletHistory> userWalletHistories = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(insurancePolicy.getId(), WalletReferenceType.DAMAGE_PROTECTION);
-
 
1837
			if (userWalletHistories.size() == 0) {
-
 
1838
 
-
 
1839
			}
-
 
1840
			String walletDescription = String.format("Policy purchased against Sale Invoice#%s",
-
 
1841
					insurancePolicy.getInvoiceNumber());
-
 
1842
			// Try consuming wallet before insurance
-
 
1843
			walletService.consumeAmountFromWallet(insurancePolicy.getRetailerId(), insurancePolicy.getId(),
-
 
1844
					WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getPurchaseAmount(),
-
 
1845
					LocalDateTime.now(), true);
-
 
1846
		}
-
 
1847
	}
-
 
1848
 
1832
 
1849
 
1833
}
1850
}
1834
 
1851
 
1835
//7015845171
1852
//7015845171
1836
1853