Subversion Repositories SmartDukaan

Rev

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

Rev 716 Rev 738
Line 6... Line 6...
6
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem,\
6
from shop2020.model.v1.order.impl.DataService import Transaction, LineItem,\
7
    Alerts, Order
7
    Alerts, Order
8
from shop2020.thriftpy.model.v1.order.ttypes import Transaction as T_Transaction,\
8
from shop2020.thriftpy.model.v1.order.ttypes import Transaction as T_Transaction,\
9
    TransactionServiceException, TransactionStatus, OrderStatus
9
    TransactionServiceException, TransactionStatus, OrderStatus
10
import datetime
10
import datetime
11
from shop2020.utils.OrderStatus import status_transaction_init, get_c_status
-
 
12
from elixir import *
11
from elixir import *
13
from shop2020.utils.Utils import to_py_date
12
from shop2020.utils.Utils import to_py_date
14
from sqlalchemy.sql.expression import and_
13
from sqlalchemy.sql.expression import and_
15
from shop2020.model.v1 import order
14
from shop2020.model.v1 import order
16
 
15
 
17
def get_new_transaction():
16
def get_new_transaction():
18
    transaction = Transaction()
17
    transaction = Transaction()
19
    transaction.createdOn = datetime.datetime.now()
18
    transaction.createdOn = datetime.datetime.now()
20
    transaction.status = status_transaction_init 
19
    transaction.status = TransactionStatus.INIT
21
    transaction.status_message = "New transaction"
20
    transaction.status_message = "New transaction"
22
    return transaction
21
    return transaction
23
 
22
 
24
def create_order(t_order):
23
def create_order(t_order):
25
    order = Order()
24
    order = Order()
Line 34... Line 33...
34
    if t_order.customer_id:    
33
    if t_order.customer_id:    
35
        order.customer_id = t_order.customer_id
34
        order.customer_id = t_order.customer_id
36
        order.customer_name = t_order.customer_name
35
        order.customer_name = t_order.customer_name
37
        order.customer_mobilenumber = t_order.customer_mobilenumber
36
        order.customer_mobilenumber = t_order.customer_mobilenumber
38
        order.customer_pincode = t_order.customer_pincode
37
        order.customer_pincode = t_order.customer_pincode
-
 
38
        order.customer_address1 = t_order.customer_address1
39
        order.customer_address = t_order.customer_address
39
        order.customer_address2 = t_order.customer_address2
40
        order.customer_email = t_order.customer_email
40
        order.customer_email = t_order.customer_email
41
    #new status and status description to be added    
41
    #new status and status description to be added    
42
    order.status = t_order.status  
42
    order.status = t_order.status  
43
    order.statusDescription = t_order.statusDescription
43
    order.statusDescription = t_order.statusDescription
44
    order.total_amount = t_order.total_amount
44
    order.total_amount = t_order.total_amount