예제 #1
0
 def install_script_tags(self, script_tags=None):
     """ Install our script tags onto the Shopify store """
     if script_tags == None:
         script_tags = []
     
     ShopifyAPI.install_script_tags( self.url, 
                                     self.token,
                                     script_tags )
예제 #2
0
    def get( self ):
        store = ShopifyStore.get_by_uuid( self.request.get('s_u') )
        
        just_paid = self.request.get('thx') != ""
        if just_paid:
            ShopifyAPI.activate_charge( store.url, store.token, store.onetime_charge_id )

        template_values = { 'store'  : store,
                            'paid'   : store.onetime_charge_id != None,
                            'thanks' : just_paid }

        self.response.out.write(self.render_page('support.html', template_values)) 
예제 #3
0
    def install_assets(self):
        # Define our asset 
        scripts = buttons = appsy_scripts = ""
        
        if self.pinterest_enabled:
            scripts += pinterest_script 
            buttons += '\n%s' % pinterest_button
            appsy_scripts += appsy_pinterest_script
        
        if self.fancy_enabled:
            scripts += fancy_script 
            buttons += '\n%s' % fancy_button
            appsy_scripts += appsy_fancy_script
        
        if self.facebook_enabled:
            scripts += facebook_script 
            buttons += '\n%s' % facebook_button
            appsy_scripts += appsy_facebook_script
        
        if self.tumblr_enabled:
            scripts += tumblr_script 
            buttons += '\n%s' %  tumblr_button
            appsy_scripts += appsy_tumblr_script
        
        if self.gplus_enabled:
            scripts += gplus_script 
            buttons += '\n%s' % gplus_button
            appsy_scripts += appsy_gplus_script
        
        if self.twitter_enabled:
            scripts += twitter_script 
            buttons += '\n%s' % twitter_button
            appsy_scripts += appsy_twitter_script
        
        div = "<div id='AppsyDaisy' style='float: left;'>%s\n</div>\n\n" % buttons

        assets = [{
            'asset': {
                'value': "%s %s %s" % (div, scripts, appsy_scripts),
                'key': 'snippets/social_plus.liquid'
            }
        }]

        ShopifyAPI.install_assets( self.url, 
                                   self.token,
                                   assets )
예제 #4
0
    def fetch_store_info(self):
        data = ShopifyAPI.fetch_store_info( self.url, self.token )
        
        domain = get_shopify_url( data['domain'] ) 
        if domain == '':
            domain = url_

        self.email     = data['email']
        self.name      = data['name']
        self.domain    = domain
        self.full_name = data['shop_owner']
    
        self.put()
예제 #5
0
    def install_webhooks(self, webhooks=None):
        """ Install the webhooks into the Shopify store """
        # pass extra webhooks as a list
        if webhooks == None:
            webhooks = []

        # Install the "App Uninstall" webhook
        data = {
            "webhook": {
                "address": "%s/store/uninstall?s_u=%s" % (
                    URL,
                    self.uuid
                ),
                "format": "json",
                "topic": "app/uninstalled"
            }
        }
        webhooks.append(data)

        ShopifyAPI.install_webhooks( self.url, 
                                     self.token,
                                     webhooks )
예제 #6
0
 def get(self):
     # Request varZ from Shopify
     charge_id = self.request.get( 'charge_id' )
     store     = ShopifyStore.get_by_uuid( self.request.get('s_u') )
     
     if ShopifyAPI.verify_charge( store.url, 
                                  store.token, 
                                  charge_id ):
         store.onetime_charge_id = charge_id
         store.put()
         
         self.redirect("%s?s_u=%s&thx=true" % (url('StoreSupport'), store.uuid) )
     
     else:
         self.redirect( "%s?s_u=%s&onetime=true" % (url('StoreOneTimeCancelled'), store.uuid) )
예제 #7
0
    def post( self ):

        store = ShopifyStore.get_by_url( self.request.get('url') )
        settings = {
            "recurring_application_charge": {
                "price": store.get_cost(),
                "name": "Social ++ Shopify App",
                "return_url": "%s/store/billing_callback?s_u=%s" % (URL, store.uuid)
              }
        }  

        redirect_url = ShopifyAPI.recurring_billing( store.url, 
                                                     store.token,
                                                     settings )
        self.response.out.write( redirect_url )
예제 #8
0
    def post( self ):

        store = ShopifyStore.get_by_uuid( self.request.get('s_u') )

        settings = {
            "application_charge": {
                "price": 5.00,
                "name": "Customization & Support",
                "return_url": "%s/store/onetime_callback?s_u=%s" % (URL, store.uuid)
              }
        }  

        redirect_url = ShopifyAPI.onetime_charge( store.url, 
                                                  store.token,
                                                  settings )
        self.response.out.write( redirect_url )
예제 #9
0
 def get(self):
     # Request varZ from Shopify
     charge_id = self.request.get( 'charge_id' )
     store     = ShopifyStore.get_by_uuid( self.request.get('s_u') )
     
     if ShopifyAPI.verify_recurring_charge( store.url, 
                                            store.token, 
                                            charge_id ):
         if store.charge_id is None:
             store.do_install()
         
         store.charge_id = charge_id
         store.put()
         
         self.redirect("%s?s_u=%s" % (url('StoreWelcome'), store.uuid) )
     
     else:
         self.redirect( "%s?s_u=%s" % (url('StoreRecurringCancelled'), store.uuid) )
예제 #10
0
 def activate_recurring_billing(self):
     ShopifyAPI.activate_recurring_charge( self.url, 
                                           self.token,
                                           self.charge_id )