Example #1
0
 public PurchaseHistory updatePurchasehistory(Purchase purchase) {
   PurchaseHistory purchasehistory = new PurchaseHistory();
   try {
     purchasehistory.setEndDate(ImiDataFormatUtils.getmaxDateString());
     purchasehistory.setMonthlyRentalRate(purchase.getMonthlyRentalRate());
     purchasehistory.setNumber(purchase.getNumber());
     purchasehistory.setNumberType(purchase.getNumberType());
     purchasehistory.setNumberProviderCountry(purchase.getNumberProviderCountry());
     purchasehistory.setResourceManagerId(purchase.getResouceManagerId());
     purchasehistory.setRestrictions(purchase.getRestrictions());
     purchasehistory.setSetUpRate(purchase.getSetUpRate());
     purchasehistory.setSmsPrice(purchase.getSmsRate());
     purchasehistory.setStartDate(purchase.getEffectiveDate());
     purchasehistory.setVoicePrice(purchase.getVoicePrice());
     purchaseHistoryDao.createNewPurchaseHistory(purchasehistory);
   } catch (Exception e) {
     LOG.error(ImiDataFormatUtils.getStackTrace(e));
   }
   return purchasehistory;
 }
Example #2
0
 public Purchase updatePurchase(
     PurchaseResponse purchaseResponse,
     String numberType,
     String restrictions,
     ResourceMaster resourceMaster) {
   Purchase purchase = new Purchase();
   try {
     purchase.setMonthlyRentalRate(resourceMaster.getMonthlyRentalPrice());
     Provider provider = providerService.getProviderById(resourceMaster.getProviderId());
     Country country = countryDao.getCountryByIso(resourceMaster.getCountryIso());
     Providercountry providercountry =
         countryDao.getProviderCountryByCountryAndProvider(country, provider);
     purchase.setNumberType(numberType);
     purchase.setNumber(resourceMaster.getServiceCode());
     purchase.setResouceManagerId(resourceMaster.getResourceId());
     purchase.setEffectiveDate(ImiDataFormatUtils.getCurrentTimeStamp());
     purchase.setRestrictions(restrictions);
     purchase.setSetUpRate(purchaseResponse.getSetUpRate());
     purchase.setSmsRate(resourceMaster.getSmsInboundPrice());
     purchase.setVoicePrice(resourceMaster.getVoiceInboundPrice());
     purchase.setNumberProviderCountry(providercountry);
     purchaseDao.createNewPurchase(purchase);
   } catch (Exception e) {
     LOG.error(ImiDataFormatUtils.getStackTrace(e));
   }
   return purchase;
 }