Subversion Repositories SmartDukaan

Rev

Rev 22215 | Rev 23502 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
22215 ashik.ali 1
package com.spice.profitmandi.common.util;
2
 
3
import java.util.HashMap;
4
import java.util.Map;
5
 
6
import com.spice.profitmandi.common.enumuration.SchemeType;
7
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
22893 amit.gupta 8
import com.spice.profitmandi.common.model.GadgetCopsDocumentInsuranceModel;
22215 ashik.ali 9
import com.spice.profitmandi.common.model.GadgetCopsInsuranceModel;
10
import com.spice.profitmandi.common.web.client.RestClient;
11
 
12
public class InsuranceUtils {
13
 
14
	private static final String HOST_NAME = "manage.gadgetcops.com";
15
	private static final String URI = "snsydataexchange.asmx/RegisterPolicy";
16
 
17
	private static final String MOBILE_BRAND = "mobileBrand";
18
	private static final String MOBILE_MODEL = "mobileModel";
19
	private static final String MOBILE_IMEI = "mobileIMEI";
20
	private static final String CUS_FIRST_NAME = "cusLastName";
21
	private static final String CUS_LAST_NAME = "cusFirstName";
22
	private static final String CUS_CONTACT_NUMBER = "cusContactNumber";
23
	private static final String CUS_EMAIL = "cusEmail";
24
	private static final String CUS_DOB = "cusDOB";
25
	private static final String CUS_ADDRESS1 = "cusAddress1";
26
	private static final String CUS_ADDRESS2 = "cusAddress2";
27
	private static final String CUS_CITY = "cusCity";
28
	private static final String CUS_STATE = "cusState";
29
	private static final String CUS_ZIP = "cusZip";
30
	private static final String TRANSACTION_DATE = "transactionDate";
31
	private static final String TRANSACTION_INVOICE_VALUE = "transactionInvoiceValue";
32
	private static final String TRANSACTION_INVOICE_NUMBER = "transactionInvoiceNumber";
33
	private static final String TRANSACTION_POLICY_NUMBER = "transactionPolicyNumber";
34
 
35
	public static void submitToGadgetCops(GadgetCopsInsuranceModel gadgetCopsInsuranceModel) throws ProfitMandiBusinessException{
36
		//RestClient rc = new RestClient(SchemeType.HTTP, "www.google.com", 8080);
37
		RestClient restClient = new RestClient(SchemeType.HTTP, HOST_NAME, 80);
38
 
39
		Map<String, String> params = new HashMap<>(18);
40
		//params.put(OP, REGISTER_POLICY);
41
		params.put(MOBILE_BRAND, gadgetCopsInsuranceModel.getBrand());
42
		params.put(MOBILE_MODEL, gadgetCopsInsuranceModel.getModelName());
43
		params.put(MOBILE_IMEI, gadgetCopsInsuranceModel.getSerialNumber());
44
		params.put(CUS_FIRST_NAME, gadgetCopsInsuranceModel.getCustomerFirstName());
45
		params.put(CUS_LAST_NAME, gadgetCopsInsuranceModel.getCustomerLastName());
46
		params.put(CUS_CONTACT_NUMBER, gadgetCopsInsuranceModel.getCustomerMobileNumber());
47
		params.put(CUS_EMAIL, gadgetCopsInsuranceModel.getCustomerEmailId());
48
		params.put(CUS_DOB, StringUtils.toString(gadgetCopsInsuranceModel.getCustomerDateOfBirth()));
49
		params.put(CUS_ADDRESS1, gadgetCopsInsuranceModel.getCustomerAddress1());
50
		params.put(CUS_ADDRESS2, gadgetCopsInsuranceModel.getCustomerAddress2());
51
		params.put(CUS_CITY, gadgetCopsInsuranceModel.getCustomerCity());
52
		params.put(CUS_STATE, gadgetCopsInsuranceModel.getCustomerState());
53
		params.put(CUS_ZIP, gadgetCopsInsuranceModel.getCustomerPinCode());
54
		params.put(TRANSACTION_DATE, StringUtils.toString(gadgetCopsInsuranceModel.getInvoiceCreationDate()));
55
		params.put(TRANSACTION_INVOICE_VALUE, String.valueOf(gadgetCopsInsuranceModel.getPrice()));
56
		params.put(TRANSACTION_INVOICE_NUMBER, gadgetCopsInsuranceModel.getInvoiceNumber());
57
		params.put(TRANSACTION_POLICY_NUMBER, gadgetCopsInsuranceModel.getPolicyNumber());
58
 
59
		Map<String, String> headers = new HashMap<>(0);
60
		//headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
61
 
62
		restClient.post(URI, params, headers);
63
	}
22893 amit.gupta 64
 
65
	public static void submitToGadgetCops(GadgetCopsDocumentInsuranceModel gadgetCopsInsuranceModel) throws ProfitMandiBusinessException{
66
		//RestClient rc = new RestClient(SchemeType.HTTP, "www.google.com", 8080);
67
		RestClient restClient = new RestClient(SchemeType.HTTP, HOST_NAME, 80);
68
 
69
		Map<String, String> params = new HashMap<>(18);
70
		//params.put(OP, REGISTER_POLICY);
71
		params.put(MOBILE_BRAND, gadgetCopsInsuranceModel.getBrand());
72
		params.put(MOBILE_MODEL, gadgetCopsInsuranceModel.getModelName());
73
		params.put(MOBILE_IMEI, gadgetCopsInsuranceModel.getSerialNumber());
74
		params.put(CUS_FIRST_NAME, gadgetCopsInsuranceModel.getCustomerFirstName());
75
		params.put(CUS_LAST_NAME, gadgetCopsInsuranceModel.getCustomerLastName());
76
		params.put(CUS_CONTACT_NUMBER, gadgetCopsInsuranceModel.getCustomerMobileNumber());
77
		params.put(CUS_EMAIL, gadgetCopsInsuranceModel.getCustomerEmailId());
78
		params.put(CUS_DOB, StringUtils.toString(gadgetCopsInsuranceModel.getCustomerDateOfBirth()));
79
		params.put(CUS_ADDRESS1, gadgetCopsInsuranceModel.getCustomerAddress1());
80
		params.put(CUS_ADDRESS2, gadgetCopsInsuranceModel.getCustomerAddress2());
81
		params.put(CUS_CITY, gadgetCopsInsuranceModel.getCustomerCity());
82
		params.put(CUS_STATE, gadgetCopsInsuranceModel.getCustomerState());
83
		params.put(CUS_ZIP, gadgetCopsInsuranceModel.getCustomerPinCode());
84
		params.put(TRANSACTION_DATE, StringUtils.toString(gadgetCopsInsuranceModel.getInvoiceCreationDate()));
85
		params.put(TRANSACTION_INVOICE_VALUE, String.valueOf(gadgetCopsInsuranceModel.getPrice()));
86
		params.put(TRANSACTION_INVOICE_NUMBER, gadgetCopsInsuranceModel.getInvoiceNumber());
87
		params.put(TRANSACTION_POLICY_NUMBER, gadgetCopsInsuranceModel.getPolicyNumber());
88
 
89
		Map<String, String> headers = new HashMap<>(0);
90
		//headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
91
 
92
		restClient.post(URI, params, headers);
93
	}
22215 ashik.ali 94
}