Skip to content
Juan Manuel García edited this page Jan 3, 2014 · 6 revisions

Shop

The shop model saves all the data that belongs to a shopify shop API object.

This model is created whenever a customer shop installs the shopify app. If it already exists the attributes are automatically updated. The update occurs also when a customer clicks on app preferences.

class Shop(BaseEntity):

    shop_id = models.CharField(max_length=255, null=False, blank=False, unique=True)
    token = models.CharField(max_length=255, null=True, blank=True)

    address1 = models.CharField(max_length=255, null=True, blank=True)
    city = models.CharField(max_length=255, null=True, blank=True)
    country = models.CharField(max_length=255, null=True, blank=True)
    country_code = models.CharField(max_length=255, null=True, blank=True)
    country_name = models.CharField(max_length=255, null=True, blank=True)
    customer_email = models.CharField(max_length=255, null=True, blank=True)
    currency = models.CharField(max_length=255, null=True, blank=True)
    domain = models.CharField(max_length=255, null=True, blank=True)
    email = models.CharField(max_length=255, null=True, blank=True)
    google_apps_domain = models.CharField(max_length=255, null=True, blank=True)
    google_apps_login_enabled = models.CharField(max_length=255, null=True, blank=True)
    latitude = models.CharField(max_length=255, null=True, blank=True)
    longitude = models.CharField(max_length=255, null=True, blank=True)
    money_format = models.CharField(max_length=255, null=True, blank=True)
    money_with_currency_format = models.CharField(max_length=255, null=True, blank=True)
    myshopify_domain = models.CharField(max_length=255, null=True, blank=True)
    name = models.CharField(max_length=255, null=True, blank=True)
    plan_name = models.CharField(max_length=255, null=True, blank=True)
    display_plan_name = models.CharField(max_length=255, null=True, blank=True)
    phone = models.CharField(max_length=255, null=True, blank=True)
    province = models.CharField(max_length=255, null=True, blank=True)
    province_code = models.CharField(max_length=255, null=True, blank=True)
    public = models.CharField(max_length=255, null=True, blank=True)
    shop_owner = models.CharField(max_length=255, null=True, blank=True)
    source = models.CharField(max_length=255, null=True, blank=True)
    tax_shipping = models.CharField(max_length=255, null=True, blank=True)
    taxes_included = models.CharField(max_length=255, null=True, blank=True)
    county_taxes = models.CharField(max_length=255, null=True, blank=True)
    timezone = models.CharField(max_length=255, null=True, blank=True)
    zip = models.CharField(max_length=255, null=True, blank=True)

PlanConfig

The PlanConfig model saves the data about the billing plan the customer shop is going to have. This PlanConfig model is configurable through the Config model.

class PlanConfig(BaseEntity):

    BILLING_TYPE = (
        ('O', 'One Time'),
        ('I', 'Interval'),
    )

    name = models.CharField(max_length=255, null=True, blank=True)
    active = models.BooleanField(default=True)

    billing_amount = models.DecimalField(max_digits=15, decimal_places=4)
    billing_type = models.CharField(max_length=2, null=True, blank=True, choices=BILLING_TYPE)

    trial_period_days = models.PositiveIntegerField(null=True, blank=True)

Plan

The plan model inherits from PlanConfig and it's intended to save a history for the plans a customer shop had. The last Plan in the plans history is the current Plan.

class Plan(PlanConfig):

    shop = models.ForeignKey("Shop")
    charge_id = models.CharField(max_length=255, null=False, blank=False)

    installed_at = models.DateTimeField(null=True, blank=True)
    uninstalled_at = models.DateTimeField(null=True, blank=True)

Config

The config model it's a global unique object and it saves a general configuration about the app. The attributes are:

  • enable_billing: Enables if the app bills the customer or not.
  • plan_config: If enable_billing is true this is the plan that is going to be associated to the customer store.
class Config(BaseEntity):

    enable_billing = models.BooleanField(default=False)
        
    plan_config = models.OneToOneField("PlanConfig", null=True, blank=True)

Clone this wiki locally