def get(self): Guser = users.get_current_user() if Guser: vstrapply_boost = self.request.get('vstrapply_boost') vstrCampaignID = self.request.get('vstrCampaignID') findRequest = Campaigns.query( Campaigns.strCampaignID == vstrCampaignID) thisCampaignList = findRequest.fetch() if len(thisCampaignList) > 0: thisCampaign = thisCampaignList[0] else: thisCampaign = Campaigns() if (thisCampaign.strBoost + int(vstrapply_boost)) <= 10: findRequest = Profile.query( Profile.strReference == thisCampaign.strReference) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() if thisProfile.strWallet > int(vstrapply_boost): thisCampaign.setBoostLevel(strinput=vstrapply_boost) thisProfile.strWallet = thisProfile.strWallet - int( vstrapply_boost) thisProfile.put() self.response.write("Boost Level Successfully Adjusted") else: self.response.write( "Boost Level not Adjusted insufficient funds") elif thisCampaign.strBoost < 10: vstrapply_boost = 10 - thisCampaign.strBoost findRequest = Profile.query( Profile.strReference == thisCampaign.strReference) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() if thisProfile.strWallet > vstrapply_boost: vstrapply_boost = str(vstrapply_boost) thisCampaign.setBoostLevel(strinput=vstrapply_boost) thisProfile.strWallet = thisProfile.strWallet - int( vstrapply_boost) thisProfile.put() self.response.write("Boost Level Successfully Adjusted") else: self.response.write( "Boost Level not Adjusted insufficient funds") else: self.response.write("Campaign fully boosted") thisCampaign.put()
def get(self): Guser = users.get_current_user() if Guser: findRequest = MyAffiliates.query(MyAffiliates.strReference == Guser.user_id()) thisMyAffiliatesList = findRequest.fetch() if len(thisMyAffiliatesList) > 0: thisMyAffiliates = thisMyAffiliatesList[0] else: thisMyAffiliates = MyAffiliates() thisMyAffiliates.writeReference(strinput=Guser.user_id()) thisMyAffiliates.put() if thisMyAffiliates.strAvailable >= 50: findRequest = Profile.query(Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) thisProfile.put() try: thisProfile.strWallet = thisProfile.strWallet + thisMyAffiliates.strAvailable thisMyAffiliates.strAvailable = 0 thisProfile.strTotalFundsReceived = thisProfile.strTotalFundsReceived + thisMyAffiliates.strAvailable thisMyAffiliates.put() thisProfile.put() self.response.write("Succesfully Transferred all Affiliate Income into your Wallet") except: self.response.write("Error Transferring your Affiliate funds into your Wallet") else: self.response.write("Error Transferring your Affiliate funds into your Wallet insufficient credit")
def get(self): Guser = users.get_current_user() if Guser: findRequest = Promotions.query(Promotions.strReference == Guser.user_id()) thisPromotionsList = findRequest.fetch() if len(thisPromotionsList) > 0: thisPromotions = thisPromotionsList[0] else: thisPromotions = Promotions() thisPromotions.writeReference(strinput=Guser.user_id()) thisPromotions.put() findRequest = Profile.query(Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) thisProfile.put() if thisProfile.strWallet > thisPromotions.strSocialMediaPromo: thisProfile.strWallet = thisProfile.strWallet - thisPromotions.strSocialMediaPromo thisProfile.put() thisPromotions.strEnableSocialMediaPromo = True thisPromotions.strTotalPromos = thisPromotions.strTotalPromos + thisPromotions.strSocialMediaPromo thisPromotions.put() self.response.write("Social Media Promos Enabled") else: self.response.write("Failure enabling Social Media Promos - Insufficient Funds")
def get(self): Guser = users.get_current_user() if Guser: findRequest = Promotions.query(Promotions.strReference == Guser.user_id()) thisPromotionsList = findRequest.fetch() if len(thisPromotionsList) > 0: thisPromotions = thisPromotionsList[0] else: thisPromotions = Promotions() thisPromotions.writeReference(strinput=Guser.user_id()) thisPromotions.put() findRequest = Profile.query(Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) thisProfile.put() if thisProfile.strWallet > thisPromotions.strAutoDownLine: thisProfile.strWallet = thisProfile.strWallet - thisPromotions.strAutoDownLine thisProfile.put() thisPromotions.strEnableAutoDownLine = True thisPromotions.strTotalPromos = thisPromotions.strTotalPromos + thisPromotions.strAutoDownLine thisPromotions.put() self.response.write("Auto Down-Line Enabled") else: self.response.write("Failed to enable Auto Down-Line - Insufficient Funds")
def get(self): Guser = users.get_current_user() if Guser: findRequests = Promotions.query(Promotions.strReference == Guser.user_id()) thisPromotionsList = findRequests.fetch() if len(thisPromotionsList) > 0: thisPromotions = thisPromotionsList[0] else: thisPromotions = Promotions() thisPromotions.writeReference(strinput=Guser.user_id()) thisPromotions.put() findRequests = Profile.query(Profile.strReference == Guser.user_id()) thisProfileList = findRequests.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) thisProfile.put() if thisProfile.strWallet > thisPromotions.strPriorityListing: thisProfile.strWallet = thisProfile.strWallet - thisPromotions.strPriorityListing thisProfile.put() thisPromotions.strEnablePriorityListing = True thisPromotions.strTotalPromos = thisPromotions.strTotalPromos + thisPromotions.strPriorityListing thisPromotions.put() self.response.write("Priority Listing Enabled") else: self.response.write("Failed to enable Priority Listing- Insufficient funds")
def get(self): Guser = users.get_current_user() if Guser: vstrSendFunding = self.request.get('vstrSendFunding') vstrCampaignID = self.request.get('vstrCampaignID') findRequest = Campaigns.query( Campaigns.strCampaignID == vstrCampaignID) thisCampaignList = findRequest.fetch() self.response.write("Send fund running...") if len(thisCampaignList) > 0: thisCampaign = thisCampaignList[0] else: thisCampaign = Campaigns() findRequest = Profile.query( Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() if thisProfile.strWallet > int(vstrSendFunding): thisProfile.strWallet = thisProfile.strWallet - int( vstrSendFunding) thisProfile.strTotalFundsSent = thisProfile.strTotalFundsSent + int( vstrSendFunding) thisProfile.put() thisCampaign.AddToReceivedFunds(strinput=vstrSendFunding) thisCampaign.put() try: findRequest = Profile.query( Profile.strReference == thisCampaign.strReference) thisReceiveProfileList = findRequest.fetch() if len(thisReceiveProfileList) > 0: thisReceiveProfile = thisReceiveProfileList[0] else: thisReceiveProfile = Profile() thisReceiveProfile.strTotalFundsReceived = thisReceiveProfile.strTotalFundsReceived + int( vstrSendFunding) thisReceiveProfile.put() self.response.write("Succesfully Funded Campaign") except: self.response.write("Error Funding Project") else: self.response.write( "Error Funding Campaign Insufficient Funds")
def post(self): Guser = users.get_current_user() if Guser: findRequest = Profile.query( Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) vstrPayPalEmail = self.request.get('vstrPayPalEmail') infoUpdated = False if not (vstrPayPalEmail == None): thisProfile.writePayPalEmail(strinput=vstrPayPalEmail) thisProfile.put() infoUpdated = True vstrAccountHolder = self.request.get('vstrAccountHolder') vstrBankName = self.request.get('vstrBankName') vstrBranchCode = self.request.get('vstrBranchCode') vstrAccountNumber = self.request.get('vstrAccountNumber') vstrAccountType = self.request.get('vstrAccountType') if ((not (vstrAccountHolder == None)) and (not (vstrAccountNumber == None))): findRequest = BankAccount.query( BankAccount.strReference == Guser.user_id()) thisBankAccountList = findRequest.fetch() if len(thisBankAccountList) > 0: thisBankAccount = thisBankAccountList[0] else: thisBankAccount = BankAccount() thisBankAccount.writeReference(strinput=Guser.user_id()) thisBankAccount.writeAccountHolder(strinput=vstrAccountHolder) thisBankAccount.writeBankName(strinput=vstrBankName) thisBankAccount.writeBranchCode(strinput=vstrBranchCode) thisBankAccount.writeAccountType(strinput=vstrAccountType) thisBankAccount.put() infoUpdated = True if infoUpdated: self.response.write( "Account Linking Information is successfully updated") else: self.response.write( "Account Linking Information not updated we will not be able to process your withdrawals successfully" )
def get(self): Guser = users.get_current_user() if Guser: vstrWithDrawalAmount = self.request.get('vstrWithDrawalAmount') vstrWithdrawalMethod = self.request.get('vstrWithdrawalMethod') vstrWithDrawalAmount = int(vstrWithDrawalAmount) findRequest = Profile.query( Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) if (thisProfile.strWallet > vstrWithDrawalAmount) and (vstrWithDrawalAmount > 100): thisProfile.strWallet = thisProfile.strWallet - vstrWithDrawalAmount thisProfile.strWithdraw = thisProfile.strWithdraw + vstrWithDrawalAmount Today = datetime.datetime.now() Today = Today.date() thisMonth = Today.month thisYear = Today.year if thisMonth < 12: thisMonth = thisMonth + 1 else: thisMonth = 1 thisYear = thisYear + 1 thisDay = Today.day Today = datetime.date(year=thisYear, month=thisMonth, day=thisDay) thisProfile.strScheduleWithdrawal = Today thisProfile.strWithDrawMethod = vstrWithdrawalMethod thisProfile.put() self.response.write("Withdrawal Successfully scheduled") else: self.response.write( "Cannot Schedule a withdrawal either because your withdrawal is less than $ 100.00 or your Balance is less than $ 100.00" )
def post(self): Guser = users.get_current_user() if Guser: vstrCampaignID = self.request.get('vstrCampaignID') findRequest = Campaigns.query( Campaigns.strCampaignID == vstrCampaignID) thisCampaignList = findRequest.fetch() if len(thisCampaignList) > 0: thisCampaign = thisCampaignList[0] else: thisCampaign = Campaigns() if not (thisCampaign.strPromoted): findRequest = Constant.query( Constant.strReference == Guser.user_id()) thisConstantList = findRequest.fetch() if len(thisConstantList) > 0: thisConstant = thisConstantList[0] else: thisConstant = Constant() thisConstant.writeReference(strinput=Guser.user_id()) thisConstant.put() findRequest = Profile.query( Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() thisProfile.writeReference(strinput=Guser.user_id()) if (thisProfile.strWallet > thisConstant.strPromotionCost): thisProfile.strWallet = thisProfile.strWallet - thisConstant.strPromotionCost thisCampaign.strPromoted = True thisProfile.put() thisCampaign.put() self.response.write("Campaign Successfully Promoted") else: self.response.write( "Campaign cannot be promoted insufficient funds") else: self.response.write("Campaign Already Promoted")
def get(self): Guser = users.get_current_user() if Guser: vstrFirstName = self.request.get('vstrFirstName') vstrSurname = self.request.get('vstrSurname') vstrCellNumber = self.request.get('vstrCellNumber') vstrEmail = self.request.get('vstrEmail') findRequest = Profile.query( Profile.strReference == Guser.user_id()) thisProfileList = findRequest.fetch() if len(thisProfileList) > 0: thisProfile = thisProfileList[0] else: thisProfile = Profile() try: thisProfile.writeReference(strinput=Guser.user_id()) thisProfile.writeFullNames(strinput=vstrFirstName) thisProfile.writeSurname(strinput=vstrSurname) thisProfile.writeCell(strinput=vstrCellNumber) thisProfile.writeEmail(strinput=vstrEmail) thisProfile.CreateConfirmCode() if thisProfile.sendActivationCode() == True: thisProfile.put() self.response.write( "A Comfirmation Email has been sent please follow the instructions on the email to fully activate your account" ) else: self.response.write( "Send Mail Function causing a general Error please check your email address" ) except: self.response.write( "There was an error sending a confirmation email please try again" )
def update_database(data): print('updating db') # start upload text if int(data['rows_saved']) > 0: if 'saved' in data: saved = data['saved'] if 'addresses' in saved: for addresses in saved['addresses']: address = Address() where = {'id': addresses['id']} data = {'address_id': addresses['address_id']} address.put(where=where, data=data) if 'colors' in saved: for colors in saved['colors']: color = Colored() where = {'id': colors['id']} data = {'color_id': colors['color_id']} color.put(where=where, data=data) if 'cards' in saved: for cards in saved['cards']: card = Card() where = {'id': cards['id']} data = {'card_id': cards['card_id']} card.put(where=where, data=data) if 'credits' in saved: for credit in saved['credits']: credits = Credit() where = {'id': credit['id']} data = {'credit_id': credit['credit_id']} credits.put(where=where, data=data) if 'companies' in saved: for companies in saved['companies']: company = Company() where = {'id': companies['id']} data = {'company_id': companies['company_id']} company.put(where=where, data=data) if 'custids' in saved: for custids in saved['custids']: custid = Custid() where = {'id': custids['id']} data = {'cust_id': custids['cust_id']} custid.put(where=where, data=data) if 'deliveries' in saved: for deliveries in saved['deliveries']: delivery = Delivery() where = {'id': deliveries['id']} data = {'delivery_id': deliveries['delivery_id']} delivery.put(where=where, data=data) if 'discounts' in saved: for discounts in saved['discounts']: discount = Discount() where = {'id': discounts['id']} data = {'discount_id': discounts['discount_id']} discount.put(where=where, data=data) if 'inventories' in saved: for inventories in saved['inventories']: inventory = Inventory() where = {'id': inventories['id']} data = {'inventory_id': inventories['inventory_id']} inventory.put(where=where, data=data) if 'inventory_items' in saved: for inventory_items in saved['inventory_items']: inventory_item = InventoryItem() where = {'id': inventory_items['id']} data = {'item_id': inventory_items['item_id']} inventory_item.put(where=where, data=data) if 'invoices' in saved: for invoices in saved['invoices']: invoice = Invoice() where = {'id': invoices['id']} data = {'invoice_id': invoices['invoice_id']} invoice.put(where=where, data=data) if 'invoice_items' in saved: for invoice_items in saved['invoice_items']: invoice_item = InvoiceItem() where = {'id': invoice_items['id']} data = {'invoice_items_id': invoice_items['invoice_items_id']} invoice_item.put(where=where, data=data) if 'memos' in saved: for memos in saved['memos']: memo = Memo() where = {'id': memos['id']} data = {'memo_id': memos['memo_id']} memo.put(where=where, data=data) if 'printers' in saved: for printers in saved['printers']: printer = Printer() where = {'id': printers['id']} data = {'printer_id': printers['printer_id']} printer.put(where=where, data=data) if 'profiles' in saved: for profiles in saved['profiles']: profile = Profile() where = {'id': profiles['id']} data = {'p_id': profiles['p_id']} profile.put(where=where, data=data) if 'reward_transactions' in saved: for reward_transactions in saved['reward_transactions']: reward_transaction = RewardTransaction() where = {'id': reward_transactions['id']} data = {'reward_id': reward_transactions['reward_id']} reward_transaction.put(where=where, data=data) if 'rewards' in saved: for rewards in saved['rewards']: reward = Reward() where = {'id': rewards['id']} data = {'reward_id': rewards['reward_id']} reward.put(where=where, data=data) if 'schedules' in saved: for schedules in saved['schedules']: schedule = Schedule() where = {'id': schedules['id']} data = {'schedule_id': schedules['schedule_id']} schedule.put(where=where, data=data) if 'taxes' in saved: for taxes in saved['taxes']: tax = Tax() where = {'id': taxes['id']} data = {'tax_id': taxes['tax_id']} tax.put(where=where, data=data) if 'transactions' in saved: for transactions in saved['transactions']: transaction = Transaction() where = {'id': transactions['id']} data = {'trans_id': transactions['trans_id']} transaction.put(where=where, data=data) if 'users' in saved: for users in saved['users']: user = User() where = {'id': users['id']} data = {'user_id': users['user_id']} user.put(where=where, data=data) if 'zipcodes' in saved: for zipcodes in saved['zipcodes']: zipcode = Zipcode() where = {'id': zipcodes['id']} data = {'zipcode_id': zipcodes['zipcode_id']} zipcode.put(where=where, data=data)