Skip to content

Commit

Permalink
Add Properties to Shop (#44)
Browse files Browse the repository at this point in the history
* Added all properties shopify passes to shop.json
  • Loading branch information
MitchHamm authored and rickywiens committed Mar 21, 2019
1 parent 1b05aff commit d4d43e9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 41 deletions.
89 changes: 48 additions & 41 deletions shop.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,54 @@ type ShopServiceOp struct {

// Shop represents a Shopify shop
type Shop struct {
ID int `json:"id"`
Name string `json:"name"`
ShopOwner string `json:"shop_owner"`
Email string `json:"email"`
CustomerEmail string `json:"customer_email"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Address1 string `json:"address1"`
Address2 string `json:"address2"`
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
Currency string `json:"currency"`
Domain string `json:"domain"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Phone string `json:"phone"`
Province string `json:"province"`
ProvinceCode string `json:"province_code"`
Zip string `json:"zip"`
MoneyFormat string `json:"money_format"`
MoneyWithCurrencyFormat string `json:"money_with_currency_format"`
WeightUnit string `json:"weight_unit"`
MyshopifyDomain string `json:"myshopify_domain"`
PlanName string `json:"plan_name"`
PlanDisplayName string `json:"plan_display_name"`
PasswordEnabled bool `json:"password_enabled"`
PrimaryLocale string `json:"primary_locale"`
PrimaryLocationId int `json:"primary_location_id"`
Timezone string `json:"timezone"`
IanaTimezone string `json:"iana_timezone"`
ForceSSL bool `json:"force_ssl"`
TaxShipping bool `json:"tax_shipping"`
TaxesIncluded bool `json:"taxes_included"`
HasStorefront bool `json:"has_storefront"`
HasDiscounts bool `json:"has_discounts"`
HasGiftcards bool `json:"has_gift_cards"`
SetupRequire bool `json:"setup_required"`
CountyTaxes bool `json:"county_taxes"`
CheckoutAPISupported bool `json:"checkout_api_supported"`
ID int `json:"id"`
Name string `json:"name"`
ShopOwner string `json:"shop_owner"`
Email string `json:"email"`
CustomerEmail string `json:"customer_email"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Address1 string `json:"address1"`
Address2 string `json:"address2"`
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
Currency string `json:"currency"`
Domain string `json:"domain"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Phone string `json:"phone"`
Province string `json:"province"`
ProvinceCode string `json:"province_code"`
Zip string `json:"zip"`
MoneyFormat string `json:"money_format"`
MoneyWithCurrencyFormat string `json:"money_with_currency_format"`
WeightUnit string `json:"weight_unit"`
MyshopifyDomain string `json:"myshopify_domain"`
PlanName string `json:"plan_name"`
PlanDisplayName string `json:"plan_display_name"`
PasswordEnabled bool `json:"password_enabled"`
PrimaryLocale string `json:"primary_locale"`
PrimaryLocationId int `json:"primary_location_id"`
Timezone string `json:"timezone"`
IanaTimezone string `json:"iana_timezone"`
ForceSSL bool `json:"force_ssl"`
TaxShipping bool `json:"tax_shipping"`
TaxesIncluded bool `json:"taxes_included"`
HasStorefront bool `json:"has_storefront"`
HasDiscounts bool `json:"has_discounts"`
HasGiftcards bool `json:"has_gift_cards"`
SetupRequire bool `json:"setup_required"`
CountyTaxes bool `json:"county_taxes"`
CheckoutAPISupported bool `json:"checkout_api_supported"`
Source string `json:"source"`
GoogleAppsDomain string `json:"google_apps_domain"`
GoogleAppsLoginEnabled bool `json:"google_apps_login_enabled"`
MoneyInEmailsFormat string `json:"money_in_emails_format"`
MoneyWithCurrencyInEmailsFormat string `json:"money_with_currency_in_emails_format"`
EligibleForPayments bool `json:"eligible_for_payments"`
RequiresExtraPaymentsAgreement bool `json:"requires_extra_payments_agreement"`
}

// Represents the result from the admin/shop.json endpoint
Expand Down
7 changes: 7 additions & 0 deletions shop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ func TestShopGet(t *testing.T) {
{"Name", "Apple Computers", shop.Name},
{"Email", "[email protected]", shop.Email},
{"HasStorefront", true, shop.HasStorefront},
{"Source", "", shop.Source},
{"GoogleAppsDomain", "", shop.GoogleAppsDomain},
{"GoogleAppsLoginEnabled", false, shop.GoogleAppsLoginEnabled},
{"MoneyInEmailsFormat", "${{amount}}", shop.MoneyInEmailsFormat},
{"MoneyWithCurrencyInEmailsFormat", "${{amount}} USD", shop.MoneyWithCurrencyInEmailsFormat},
{"EligibleForPayments", true, shop.EligibleForPayments},
{"RequiresExtraPaymentsAgreement", false, shop.RequiresExtraPaymentsAgreement},
}

for _, c := range cases {
Expand Down

0 comments on commit d4d43e9

Please sign in to comment.