Пример #1
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;
 }
Пример #2
0
 public void deletePurchase(ResourceMaster resourceMaster) {
   Purchase purchase = purchaseDao.getPurchaseByNumber(resourceMaster.getServiceCode());
   purchaseDao.deletePurchase(purchase);
 }