Subversion Repositories SmartDukaan

Rev

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

Rev 17452 Rev 18199
Line 14... Line 14...
14
import urllib2
14
import urllib2
15
import json
15
import json
16
import time
16
import time
17
import traceback
17
import traceback
18
import logging
18
import logging
-
 
19
from dtr.utils.utils import num_encode
19
 
20
 
20
PUSH_NOTIFICATIONS_DETAILS_URL="http://localhost:3001/getPushNotificationDetailsByType/?type=%s&notification_campaign_id=%d&status=%s"
21
PUSH_NOTIFICATIONS_DETAILS_URL="http://localhost:3001/getPushNotificationDetailsByType/?type=%s&notification_campaign_id=%d&status=%s"
21
PROMOTIONAL_SMS_SEND_URL = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS?"
22
PROMOTIONAL_SMS_SEND_URL = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS?"
22
#ID is: PRO02135496 Mobile Number is: 918512809859 PRO02135496#SMS Sent successfully to : 918512809859
23
#ID is: PRO02135496 Mobile Number is: 918512809859 PRO02135496#SMS Sent successfully to : 918512809859
23
#http://103.15.179.45:8085/MessagingGateway/http/querymsg?user=srlsaholicP&password=srp8oct&apimsgid=PRO02257518
24
#http://103.15.179.45:8085/MessagingGateway/http/querymsg?user=srlsaholicP&password=srp8oct&apimsgid=PRO02257518
Line 63... Line 64...
63
        
64
        
64
        sentSmsUsers = []
65
        sentSmsUsers = []
65
        smsResponseIdMap = {}
66
        smsResponseIdMap = {}
66
        payloadList = []
67
        payloadList = []
67
        
68
        
68
        smstext = str(notificationCampaign.messagetext) + ' http://bit.ly/1LBesWK'
69
        #smstext = str(notificationCampaign.messagetext) + ' http://bit.ly/1LBesWK'
69
        for user in allUsers:
70
        for user in allUsers:
70
            if user.mobile_number is not None and len(user.mobile_number)==10 and user.mobile_number not in sentSmsUsers:
71
            if user.mobile_number is not None and len(user.mobile_number)==10 and user.mobile_number not in sentSmsUsers:
-
 
72
                smsUrl='http://pm1.in/a/' + num_encode(notificationCampaign.id) + '/' + num_encode(user.id)
-
 
73
                smstext = str(notificationCampaign.messagetext) + ' ' + smsUrl
71
                #url_params = { 'Mobile' : '91'+user.mobile_number,  'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : notificationCampaign.messagetext }
74
                #url_params = { 'Mobile' : '91'+user.mobile_number,  'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : notificationCampaign.messagetext }
72
                url_params = { 'Mobile' : '91'+user.mobile_number,  'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : smstext }
75
                url_params = { 'Mobile' : '91'+user.mobile_number,  'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : smstext }
73
                encoded_url_params = urllib.urlencode(url_params)
76
                encoded_url_params = urllib.urlencode(url_params)
74
                logging.debug('User Id:- '+str(user.id)+' Notification_Campaign_Id:- '+ str(notificationCampaign.id)+' Url Params:- '+str(encoded_url_params))
77
                logging.debug('User Id:- '+str(user.id)+' Notification_Campaign_Id:- '+ str(notificationCampaign.id)+' Url Params:- '+str(encoded_url_params))
75
                url = PROMOTIONAL_SMS_SEND_URL + encoded_url_params
78
                url = PROMOTIONAL_SMS_SEND_URL + encoded_url_params