Subversion Repositories SmartDukaan

Rev

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

Rev 20649 Rev 20650
Line 1... Line 1...
1
package com.aramex.impl;
1
package com.aramex.impl;
2
 
2
 
3
import in.shop2020.model.v1.order.Order;
3
import in.shop2020.model.v1.order.Order;
-
 
4
import in.shop2020.model.v1.order.TransactionService.Client;
4
 
5
 
5
import java.util.Calendar;
6
import java.util.Calendar;
6
import java.util.List;
7
import java.util.List;
7
 
8
 
8
import com.aramex.stub.Address;
9
import com.aramex.stub.Address;
Line 43... Line 44...
43
		ShipmentDetails details = new ShipmentDetails();
44
		ShipmentDetails details = new ShipmentDetails();
44
		details.setProductGroup("DOM");
45
		details.setProductGroup("DOM");
45
		details.setProductType("CDA");
46
		details.setProductType("CDA");
46
		details.setPaymentType("P");
47
		details.setPaymentType("P");
47
		details.setChargeableWeight(new Weight("KG", shipmentInfo.getTotalWeightInKg()));
48
		details.setChargeableWeight(new Weight("KG", shipmentInfo.getTotalWeightInKg()));
-
 
49
		details.setActualWeight(new Weight("KG", shipmentInfo.getTotalWeightInKg()));
48
		details.setDescriptionOfGoods("Electronics");
50
		details.setDescriptionOfGoods("Electronics");
49
		details.setGoodsOriginCountry("IN");
51
		details.setGoodsOriginCountry("IN");
50
		if(shipmentInfo.getOrder().isLogisticsCod()){
52
		if(shipmentInfo.getOrder().isLogisticsCod()){
51
			details.setServices("CODS");
53
			details.setServices("CODS");
52
			details.setCashOnDeliveryAmount(new Money("INR", shipmentInfo.getTotalAmount() + shipmentInfo.getTotalShippingAmount()));
54
			details.setCashOnDeliveryAmount(new Money("INR", shipmentInfo.getTotalAmount() + shipmentInfo.getTotalShippingAmount()));
Line 74... Line 76...
74
		consigneeAddress.setLine1(order.getCustomer_address1());
76
		consigneeAddress.setLine1(order.getCustomer_address1());
75
		consigneeAddress.setLine2(order.getCustomer_address2());
77
		consigneeAddress.setLine2(order.getCustomer_address2());
76
		consigneeAddress.setPostCode(order.getCustomer_pincode());
78
		consigneeAddress.setPostCode(order.getCustomer_pincode());
77
		consigneeAddress.setStateOrProvinceCode(order.getCustomer_state());
79
		consigneeAddress.setStateOrProvinceCode(order.getCustomer_state());
78
		consigneeAddress.setCity(order.getCustomer_city());
80
		consigneeAddress.setCity(order.getCustomer_city());
79
		
81
 
80
		Contact contact = new Contact();
82
		Contact contact = new Contact();
-
 
83
		contact.setPhoneNumber1(order.getCustomer_mobilenumber());
81
		contact.setCellPhone(order.getCustomer_mobilenumber());
84
		contact.setCellPhone(order.getCustomer_mobilenumber());
82
		contact.setPersonName(order.getCustomer_name());
85
		contact.setPersonName(order.getCustomer_name());
83
		contact.setEmailAddress(order.getCustomer_email());
86
		contact.setEmailAddress(order.getCustomer_email());
-
 
87
		contact.setCompanyName(order.getCustomer_name());
84
		
88
		
85
		consignee.setPartyAddress(consigneeAddress);
89
		consignee.setPartyAddress(consigneeAddress);
86
		consignee.setContact(contact);
90
		consignee.setContact(contact);
87
		
91
		
88
		return consignee;
92
		return consignee;
Line 106... Line 110...
106
		parameters.setClientInfo(getTestClientInfo());
110
		parameters.setClientInfo(getTestClientInfo());
107
		parameters.setShipments(shipments);
111
		parameters.setShipments(shipments);
108
		
112
		
109
		
113
		
110
		ShipmentCreationResponse scr = service.createShipments(parameters);
114
		ShipmentCreationResponse scr = service.createShipments(parameters);
-
 
115
		if(scr.getHasErrors()){
111
		if(scr.getHasErrors() && (scr.getNotifications() == null ||scr.getShipments().getProcessedShipment(0)==null)) {
116
			if(scr.getNotifications() != null && scr.getNotifications().getNotification() != null){
112
			System.out.println("Some error " +  scr.getNotifications().getNotification());
117
				System.out.println("Some error " +  scr.getNotifications().getNotification(0).getMessage());
-
 
118
			}
-
 
119
			ProcessedShipment s = scr.getShipments().getProcessedShipment(0); 
-
 
120
			if (s!=null && s.getNotifications() != null && s.getNotifications().getNotification() != null) {
-
 
121
				System.out.println("Some error in shipment" +  s.getNotifications().getNotification(0).getMessage());
-
 
122
			}
113
			throw new Exception();
123
			throw new Exception();
114
		}
124
		}
115
		ProcessedShipment ps = scr.getShipments().getProcessedShipment(0);
125
		ProcessedShipment ps = scr.getShipments().getProcessedShipment(0);
116
		return ps.getID();
126
		return ps.getID();
117
	}
127
	}
Line 144... Line 154...
144
		shipperAddress.setCountryCode("IN");
154
		shipperAddress.setCountryCode("IN");
145
		shipperAddress.setPostCode("110001");
155
		shipperAddress.setPostCode("110001");
146
		shipper.setPartyAddress(shipperAddress);
156
		shipper.setPartyAddress(shipperAddress);
147
		return shipper;
157
		return shipper;
148
	}
158
	}
149
 
159
	
150
}
160
}