예제 #1
0
def get_orders_booked_before_ten_days():
    ezone_client = get_ezoneonline()
    current_time = datetime.now()
    
    orders = Order.objects.filter(client = ezone_client,
        state = 'pending_order',
        modified_on__lte = (current_time + timedelta(days=-10)),
        modified_on__gte = datetime(2011,11,16,0,0,0),
        )

    return orders
예제 #2
0
# also add the parent folder
PARENT_FOLDER = ROOT_FOLDER[:ROOT_FOLDER.rindex('/')+1]
if PARENT_FOLDER not in sys.path:
    sys.path.insert(1, PARENT_FOLDER)

from orders.models import Order, OrderItem
from catalog.models import Inventory
from utils.utils import get_ezoneonline
from datetime import Datetime, timedelta

if __name__ == '__main__':
    #1) Get the list of all orders in last 10 minutes where-
    #   a) order.state = 'pending_order'
    #   b) payment_mode in instant payment mode
    #   c) payment_attempt.status is 'rejected'
    ezone_client = get_ezoneonline()
    current_time = datetime.now()

    orders = Order.objects.filter(client=ezone_client,
        state = 'pending_order',
        payment_mode__in = ['netbanking','credit-card','credit-card-emi-web','debit-card','payback'] ,
        modified_on__gte = (current_time + timedelta(minutes=-60)),
        modified_on__lte = (current_time + timedelta(minutes=-10)),
        )
    
    for order in orders:
        is_all_payment_attempts_rejected = True
        payment_attempts = order.paymentattempt_set.all()
        
        if payment_attempts:
            for pa in order.paymentattempt_set.all():
예제 #3
0
# also add the parent folder
PARENT_FOLDER = ROOT_FOLDER[: ROOT_FOLDER.rindex("/") + 1]
if PARENT_FOLDER not in sys.path:
    sys.path.insert(1, PARENT_FOLDER)

from orders.models import Order, OrderItem
from catalog.models import Inventory
from utils.utils import get_ezoneonline
from datetime import Datetime, timedelta

if __name__ == "__main__":
    # 1) Get the list of all orders in last 10 minutes where-
    #   a) order.state = 'pending_order'
    #   b) payment_mode in instant payment mode
    #   c) payment_attempt.status is 'rejected'
    ezone_client = get_ezoneonline()
    current_time = datetime.now()

    orders = Order.objects.filter(
        client=ezone_client,
        state="pending_order",
        payment_mode__in=["netbanking", "credit-card", "credit-card-emi-web", "debit-card", "payback"],
        modified_on__gte=(current_time + timedelta(minutes=-60)),
        modified_on__lte=(current_time + timedelta(minutes=-10)),
    )

    for order in orders:
        is_all_payment_attempts_rejected = True
        payment_attempts = order.paymentattempt_set.all()

        if payment_attempts: