package com.gpc.manager; import com.gpc.service.IPC_Context; import com.gpc.tams.json.Store; import com.gpc.tams.repository.common.StoreProfile2; import com.gpc.tams.repository.common.StoreProfileDAO2; import com.gpc.tams.repository.ipc.IpcTransactionTracker; import com.gpc.tams.repository.salesactivities.InvoicingProfile2; import com.gpc.tams.repository.salesactivities.InvoicingProfileDAO2; import com.gpc.tams.util.ExecutionContext; import com.gpc.tams.util.PasClient; import org.codehaus.jackson.map.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service abstract public class PasManager { @Autowired protected ExecutionContext context; @Autowired protected IpcTransactionTracker txTracker; @Autowired protected PasClient client; @Autowired protected StoreProfileDAO2 storeProfileDAO; @Autowired protected InvoicingProfileDAO2 invoicingProfileDAO; static final ObjectMapper mapper = new ObjectMapper(); protected InvoicingProfile2 getInvoicingProfile(int location) { InvoicingProfile2 invProfile = invoicingProfileDAO.find(location); String baseurl = invProfile.getPasIpcUrl() != null ? invProfile.getPasIpcUrl() : PasClient.PAYMENT_URL; invProfile.setIpcBaseUrl(baseurl); return invProfile; } protected void setStore(Store store) { StoreProfile2 storeProfile = storeProfileDAO.find(); store.setType(storeProfile.getStoreType().getCodeString()); store.setGpcOwned(storeProfile.getGpcOwned()==1); store.setCity(storeProfile.getCity()); store.setPostalCode(storeProfile.getPostalCode()); } }