Ejemplo n.º 1
0
 def post(self):
     
     history_id = self.request.get('id')
     
     store_purchase_history = StorePurchaseHistory.get_by_id(int(history_id))
     if store_purchase_history is not None:
         if store_purchase_history.status == 'success':
             return
         
         user_prefs = store_purchase_history.user_prefs
         product_id = store_purchase_history.product_id
         
         send_to = user_prefs.google_account.email()
         
         logging.info('account: %s' % user_prefs.google_account.nickname)
         logging.info('product_id: %s' % product_id)
         
         success = False
         
         if product_id.find('io.atrac613.Bocchi.store.push150') != -1:
             logging.info('product type is push150')
             
             user_prefs.paid_quantity = user_prefs.paid_quantity + 150
             user_prefs.activate_flg = True
             user_prefs.put()
             
             success = True
         else:
             logging.error('unknown product type: %s' % product_id)
             
         if success == True:
             store_purchase_history.status = 'success'
             store_purchase_history.put()
             
         else:
             store_purchase_history.status = 'failed'
             store_purchase_history.put()
     else:
         logging.error('history_id not found.')