Subversion Repositories SmartDukaan

Rev

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

Rev 8020 Rev 8021
Line 22... Line 22...
22
     * 
22
     * 
23
     */
23
     */
24
    private static final long serialVersionUID = 1L;
24
    private static final long serialVersionUID = 1L;
25
    private List<Order> orders = new ArrayList<Order>();
25
    private List<Order> orders = new ArrayList<Order>();
26
    
26
    
27
    public long persistTransaction(com.amazonservices.mws.orders.model.Order amazonitem, List<com.amazonservices.mws.orders.model.OrderItem> amazonItems) {
27
    public long persistTransaction(long userId, long cartId, String userEmail, com.amazonservices.mws.orders.model.Order amazonitem, List<com.amazonservices.mws.orders.model.OrderItem> amazonItems) {
28
 
28
 
29
    	/**
29
    	/**
30
    	 * 0.Create user
30
    	 * 0.Create user
31
    	 * 1.Make a transaction object comprised of Order which in turn contains lineitem.
31
    	 * 1.Make a transaction object comprised of Order which in turn contains lineitem.
32
    	 * 2.Call create_transaction
32
    	 * 2.Call create_transaction
33
    	 * 3.retrieve that order
33
    	 * 3.retrieve that order
34
    	 */
34
    	 */
35
 
35
 
36
    	Transaction txnObj = new Transaction();
36
    	Transaction txnObj = new Transaction();
37
 
37
 
38
    	String userEmail = amazonitem.getBuyerEmail();
-
 
39
    	
38
    	
40
    	User user = new User();
-
 
41
    	user.setCommunicationEmail(userEmail);
-
 
42
    	user.setEmail(userEmail);
-
 
43
    	user.setName(amazonitem.getBuyerName());
-
 
44
    	user.setMobileNumber(amazonitem.getShippingAddress().getPhone());
-
 
45
    	user.setPassword("amazon");
-
 
46
    	
-
 
47
    	try {
-
 
48
    		UserClient ucl = new UserClient();
-
 
49
    		user = ucl.getClient().createUser(user);
-
 
50
    	} catch(Exception e) {
-
 
51
    		//////////////log.error("Unable to get default source", e);
-
 
52
    	}
-
 
53
    	
-
 
54
    	long userId = user.getUserId();
-
 
55
    	txnObj.setShoppingCartid(user.getActiveCartId());
39
    	txnObj.setShoppingCartid(cartId);
56
    	txnObj.setCustomer_id(userId);
40
    	txnObj.setCustomer_id(userId);
57
    	txnObj.setCreatedOn(Calendar.getInstance().getTimeInMillis());
41
    	txnObj.setCreatedOn(Calendar.getInstance().getTimeInMillis());
58
    	txnObj.setTransactionStatus(TransactionStatus.INIT);
42
    	txnObj.setTransactionStatus(TransactionStatus.INIT);
59
    	txnObj.setStatusDescription("New Amazon Order");
43
    	txnObj.setStatusDescription("New Amazon Order");
60
    	txnObj.setCoupon_code("");
44
    	txnObj.setCoupon_code("");