def PostContext(self): tResponse = {} tResponse['tResponseText'] = "" tPaypal = VipCancelPaypalAjax() tResultDictionary = {} tPaypalPayload = {} tPayload = {} pSubscriptionKey = str(self.request.get('key')) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse['tResponseText'] = "Not Found" return tResponse #logging.debug("Subscription found with owner: " + tSubscription.subscriptionOwner) if (tSubscription): tPaypalPayload['METHOD'] = "ManageRecurringPaymentsProfileStatus" tPaypalPayload['PROFILEID'] = str(tSubscription.subscriptionId) tPaypalPayload['ACTION'] = 'Cancel' tPayloadEncoded = tPaypal.GeneratePayload(tPaypalPayload) request_cookies = mechanize.CookieJar() request_opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(request_cookies)) request_opener.addheaders = [('Content-Type', 'application/x-www-form-urlencoded')] mechanize.install_opener(request_opener) tResponse = mechanize.urlopen(url = tUrl, timeout = 25.0, data = tPayloadEncoded) tResult = str(urllib.unquote(tResponse.read())) #logging.debug("Mechanize Package") #logging.debug("Url: " + tUrl) #logging.debug("Data: " + str(tPaypalPayload)) #logging.debug("Response: " + tResult) tResultSplit = tResult.split('&') for tPair in tResultSplit: tSplitPair = tPair.split("=") tResultDictionary[tSplitPair[0]] = tSplitPair[1] tResponse['tResponseText'] = "Cancelled" tSubscription.subscriptionIsActive = False tSubscription.subscriptionEnd = datetime.datetime.now() tSubscription.subscriptionNeedsUpgrade = False tSubscription.subscriptionNeedsCancel = False tSubscription.put() tSubscriber = VipSubscriber() tSubscriber.subscriberActiveSubscription = "" tSubscriber.subscriberHasActiveSubscription = False tSubscriber.put() return tResponse
def GetContext(self): tContext = {} tVipList = [] tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and len(tVipKey) > 0): tVip = VipSub.get(tVipKey) tContext['tSub'] = tVip return tContext
def GetContext(self): tContext = {} tVipList = [] tVipKey = urllib.unquote(self.request.get('key')) if (tVipKey != None and len(tVipKey) > 0): tVip = VipSub.get(tVipKey) tContext['tSub'] = tVip return tContext
def PostContext(self): tResponse = {} tResponse['tResponseText'] = "" pSubscriptionKey = str(self.request.get('key')) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse['tResponseText'] = "Not Found" return tResponse #logging.debug("Subscription found with owner: " + tSubscription.subscriptionOwner) tier = "" if (tSubscription): #logging.debug("Manual State: " + tSubscription.subscriptionManualState) #logging.debug("Needs Upgrade: " + str(tSubscription.subscriptionNeedsUpgrade)) if (tSubscription.subscriptionManualState == "Tier0"): tSubscription.subscriptionManualState = "Tier1" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 1" tSubscription.put() elif (tSubscription.subscriptionManualState == "Tier1"): tSubscription.subscriptionManualState = "Tier2" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 2" tSubscription.put() elif (tSubscription.subscriptionManualState == "Tier2"): tSubscription.subscriptionManualState = "Tier3" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 3" tSubscription.put() elif (tSubscription.subscriptionManualState == "Tier3"): tSubscription.subscriptionManualState = "Tier4" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 4" tSubscription.put() elif (tSubscription.subscriptionManualState == "Tier4"): tSubscription.subscriptionManualState = "Tier4" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 4" tSubscription.put() elif (tSubscription.subscriptionManualState == tSubscription.subscriptionAutoState): if (tSubscription.subscriptionNeedsUpgrade == True): tSubscription.subscriptionNeedsUpgrade = False tSubscription.put() #logging.debug("Manual State: " + tSubscription.subscriptionManualState) #logging.debug("Needs Upgrade: " + str(tSubscription.subscriptionNeedsUpgrade)) #logging.debug("Subscription Saved at Tier " + tier) tResponse['tResponseText'] = "=> " + tier return tResponse
def PostContext(self): tResponse = {} tResponse["tResponseText"] = "" pSubscriptionKey = str(self.request.get("key")) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse["tResponseText"] = "Not Found" return tResponse # logging.debug("Subscription found with owner: " + tSubscription.subscriptionOwner) tier = "" if tSubscription: # logging.debug("Manual State: " + tSubscription.subscriptionManualState) # logging.debug("Needs Upgrade: " + str(tSubscription.subscriptionNeedsUpgrade)) if tSubscription.subscriptionManualState == "Tier0": tSubscription.subscriptionManualState = "Tier1" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 1" tSubscription.put() elif tSubscription.subscriptionManualState == "Tier1": tSubscription.subscriptionManualState = "Tier2" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 2" tSubscription.put() elif tSubscription.subscriptionManualState == "Tier2": tSubscription.subscriptionManualState = "Tier3" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 3" tSubscription.put() elif tSubscription.subscriptionManualState == "Tier3": tSubscription.subscriptionManualState = "Tier4" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 4" tSubscription.put() elif tSubscription.subscriptionManualState == "Tier4": tSubscription.subscriptionManualState = "Tier4" tSubscription.subscriptionNeedsUpgrade = False tier = "Tier 4" tSubscription.put() elif tSubscription.subscriptionManualState == tSubscription.subscriptionAutoState: if tSubscription.subscriptionNeedsUpgrade == True: tSubscription.subscriptionNeedsUpgrade = False tSubscription.put() # logging.debug("Manual State: " + tSubscription.subscriptionManualState) # logging.debug("Needs Upgrade: " + str(tSubscription.subscriptionNeedsUpgrade)) # logging.debug("Subscription Saved at Tier " + tier) tResponse["tResponseText"] = "=> " + tier return tResponse
def PostContext(self): tResponse = {} tResponse['tResponseText'] = "" tPaypal = VipCancelPaypalAjax() tResultDictionary = {} tPaypalPayload = {} tPayload = {} pSubscriptionKey = str(self.request.get('key')) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse['tResponseText'] = "Not Found" return tResponse
def PostContext(self): tResponse = {} tResponse["tResponseText"] = "" tPaypal = VipCancelPaypalAjax() tResultDictionary = {} tPaypalPayload = {} tPayload = {} pSubscriptionKey = str(self.request.get("key")) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse["tResponseText"] = "Not Found" return tResponse
def post(self): tResponse = {} tResponse['tResponseText'] = "" pSubscriptionKey = str(self.request.get('key')) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse['tResponseText'] = "Not Found" return tResponse #logging.debug("Subscription found with owner: " + tSubscription.subscriptionOwner) tier = "" if (tSubscription): tSubscription.subscriptionNeedsUpgrade = False tSubscription.subscriptionNeedsCancel = False tSubscription.put() #logging.debug("Subscription Cancelled") tResponse['tResponseText'] = "Cancelled" return tResponse
def PostContext(self): tResponse = {} tResponse['tResponseText'] = "" tPaypal = VipCancelPaypalAjax() tResultDictionary = {} tPaypalPayload = {} tPayload = {} pSubscriptionKey = str(self.request.get('key')) tSubscription = VipSubscription() try: tSubscription = VipSubscription.get(pSubscriptionKey) except: tResponse['tResponseText'] = "Not Found" return tResponse #logging.debug("Subscription found with owner: " + tSubscription.subscriptionOwner) if (tSubscription): tPaypalPayload['METHOD'] = "ManageRecurringPaymentsProfileStatus" tPaypalPayload['PROFILEID'] = str(tSubscription.subscriptionId) tPaypalPayload['ACTION'] = 'Cancel' tPayloadEncoded = tPaypal.GeneratePayload(tPaypalPayload) request_cookies = mechanize.CookieJar() request_opener = mechanize.build_opener( mechanize.HTTPCookieProcessor(request_cookies)) request_opener.addheaders = [('Content-Type', 'application/x-www-form-urlencoded')] mechanize.install_opener(request_opener) tResponse = mechanize.urlopen(url=tUrl, timeout=25.0, data=tPayloadEncoded) tResult = str(urllib.unquote(tResponse.read())) #logging.debug("Mechanize Package") #logging.debug("Url: " + tUrl) #logging.debug("Data: " + str(tPaypalPayload)) #logging.debug("Response: " + tResult) tResultSplit = tResult.split('&') for tPair in tResultSplit: tSplitPair = tPair.split("=") tResultDictionary[tSplitPair[0]] = tSplitPair[1] tResponse['tResponseText'] = "Cancelled" tSubscription.subscriptionIsActive = False tSubscription.subscriptionEnd = datetime.datetime.now() tSubscription.subscriptionNeedsUpgrade = False tSubscription.subscriptionNeedsCancel = False tSubscription.put() tSubscriber = VipSubscriber() tSubscriber.subscriberActiveSubscription = "" tSubscriber.subscriberHasActiveSubscription = False tSubscriber.put() return tResponse