Skip to content

Commit

Permalink
order, customer missing fields
Browse files Browse the repository at this point in the history
  • Loading branch information
khanakia committed Sep 19, 2024
1 parent 874efaf commit cda5a08
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
49 changes: 27 additions & 22 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,33 @@ type CustomerServiceOp struct {

// Customer represents a Shopify customer
type Customer struct {
Id uint64 `json:"id,omitempty"`
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
State string `json:"state,omitempty"`
Note string `json:"note,omitempty"`
VerifiedEmail bool `json:"verified_email,omitempty"`
MultipassIdentifier string `json:"multipass_identifier,omitempty"`
OrdersCount int `json:"orders_count,omitempty"`
TaxExempt bool `json:"tax_exempt,omitempty"`
TotalSpent *decimal.Decimal `json:"total_spent,omitempty"`
Phone string `json:"phone,omitempty"`
Tags string `json:"tags,omitempty"`
LastOrderId uint64 `json:"last_order_id,omitempty"`
LastOrderName string `json:"last_order_name,omitempty"`
EmailMarketingConsent *EmailMarketingConsent `json:"email_marketing_consent"`
SMSMarketingConsent *SMSMarketingConsent `json:"sms_marketing_consent"`
DefaultAddress *CustomerAddress `json:"default_address,omitempty"`
Addresses []*CustomerAddress `json:"addresses,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Metafields []Metafield `json:"metafields,omitempty"`
Id uint64 `json:"id,omitempty"`
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
State string `json:"state,omitempty"`
Note string `json:"note,omitempty"`
VerifiedEmail bool `json:"verified_email,omitempty"`
MultipassIdentifier string `json:"multipass_identifier,omitempty"`
OrdersCount int `json:"orders_count,omitempty"`
TaxExempt bool `json:"tax_exempt,omitempty"`
TotalSpent *decimal.Decimal `json:"total_spent,omitempty"`
Phone string `json:"phone,omitempty"`
Currency string `json:"currency,omitempty"`
AcceptsMarketing bool `json:"accepts_marketing,omitempty"`
AcceptsMarketingUpdatedAt *time.Time `json:"accepts_marketing_updated_at,omitempty"`
MarketingOptInLevel bool `json:"marketing_opt_in_level,omitempty"`
AdminGraphqlApiId string `json:"admin_graphql_api_id,omitempty"`
Tags string `json:"tags,omitempty"`
LastOrderId uint64 `json:"last_order_id,omitempty"`
LastOrderName string `json:"last_order_name,omitempty"`
EmailMarketingConsent *EmailMarketingConsent `json:"email_marketing_consent"`
SMSMarketingConsent *SMSMarketingConsent `json:"sms_marketing_consent"`
DefaultAddress *CustomerAddress `json:"default_address,omitempty"`
Addresses []*CustomerAddress `json:"addresses,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Metafields []Metafield `json:"metafields,omitempty"`
}

// Represents the result from the customers/X.json endpoint
Expand Down
2 changes: 1 addition & 1 deletion fixtures/order.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"order":{"id":123456,"email":"jon@doe.ca","closed_at":null,"created_at":"2016-05-17T04:14:36-00:00","updated_at":"2016-05-17T04:14:36-04:00","number":234,"note":null,"token":null,"gateway":null,"test":true,"total_price":"10.00","current_total_price":"9.50","subtotal_price":"0.00","total_weight":0,"total_tax":null,"taxes_included":false,"currency":"USD","financial_status":"voided","confirmed":false,"total_discounts":"5.00","total_line_items_price":"5.00","cart_token":null,"buyer_accepts_marketing":true,"name":"#9999","referring_site":null,"landing_site":null,"cancelled_at":"2016-05-17T04:14:36-04:00","cancel_reason":"customer","total_price_usd":null,"checkout_token":null,"reference":null,"user_id":null,"location_id":null,"source_identifier":null,"source_url":null,"processed_at":null,"device_id":null,"browser_ip":null,"landing_site_ref":null,"order_number":1234,"discount_codes":[],"note_attributes":[],"payment_gateway_names":["visa","bogus"],"processing_method":"","checkout_id":null,"source_name":"web","fulfillment_status":"pending","tax_lines":[],"tags":"","contact_email":"jon@doe.ca","order_status_url":null,"line_items":[{"id":254721536,"variant_id":null,"title":"Soda","quantity":1,"price":"0.00","grams":0,"sku":"","variant_title":null,"vendor":null,"fulfillment_service":"manual","product_id":111475476,"requires_shipping":true,"taxable":true,"gift_card":false,"pre_tax_price":"9.00","name":"Soda","variant_inventory_management":null,"properties":[],"product_exists":true,"fulfillable_quantity":1,"total_discount":"0.00","fulfillment_status":null,"tax_lines":[]},{"id":5,"variant_id":null,"title":"Another Beer For Good Times","quantity":1,"price":"5.00","grams":500,"sku":"","variant_title":null,"vendor":null,"fulfillment_service":"manual","product_id":5410685889,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"Another Beer For Good Times","variant_inventory_management":null,"properties":[],"product_exists":true,"fulfillable_quantity":1,"total_discount":"5.00","fulfillment_status":null,"tax_lines":[]}],"shipping_lines":[{"id":null,"title":"Generic Shipping","price":"10.00","code":null,"source":"shopify","phone":null,"carrier_identifier":null,"tax_lines":[]}],"billing_address":{"first_name":"Bob","address1":"123 Billing Street","phone":"555-555-BILL","city":"Billtown","zip":"K2P0B0","province":"Kentucky","country":"United States","last_name":"Biller","address2":null,"company":"My Company","latitude":null,"longitude":null,"name":"Bob Biller","country_code":"US","province_code":"KY"},"shipping_address":{"first_name":"Steve","address1":"123 Shipping Street","phone":"555-555-SHIP","city":"Shippington","zip":"K2P0S0","province":"Kentucky","country":"United States","last_name":"Shipper","address2":null,"company":"Shipping Company","latitude":null,"longitude":null,"name":"Steve Shipper","country_code":"US","province_code":"KY"},"fulfillments":[],"refunds":[],"customer":{"id":null,"email":"john@test.com","accepts_marketing":false,"created_at":null,"updated_at":null,"first_name":"John","last_name":"Smith","orders_count":0,"state":"disabled","total_spent":"0.00","last_order_id":null,"note":null,"verified_email":true,"multipass_identifier":null,"tax_exempt":false,"tags":"","last_order_name":null,"default_address":{"id":null,"first_name":null,"last_name":null,"company":null,"address1":"123 Elm St.","address2":null,"city":"Ottawa","province":"Ontario","country":"Canada","zip":"K2H7A8","phone":"123-123-1234","name":"","province_code":"ON","country_code":"CA","country_name":"Canada","default":true}}}}
{"order":{"id":123456,"email":"jon@doe.ca","closed_at":null,"created_at":"2016-05-17T04:14:36-00:00","updated_at":"2016-05-17T04:14:36-04:00","number":234,"note":null,"token":null,"gateway":null,"test":true,"total_price":"10.00","current_total_price":"9.50","subtotal_price":"0.00","total_weight":0,"total_tip_received": "0.00", "total_tax":null,"taxes_included":false,"currency":"USD","financial_status":"voided","confirmed":false,"total_discounts":"5.00","total_line_items_price":"5.00","cart_token":null,"buyer_accepts_marketing":true,"name":"#9999","referring_site":null,"landing_site":null,"cancelled_at":"2016-05-17T04:14:36-04:00","cancel_reason":"customer","total_price_usd":null,"checkout_token":null,"reference":null,"user_id":null,"location_id":null,"source_identifier":null,"source_url":null,"processed_at":null,"device_id":null,"browser_ip":null,"landing_site_ref":null,"order_number":1234,"discount_codes":[],"note_attributes":[],"payment_gateway_names":["visa","bogus"],"processing_method":"","checkout_id":null,"source_name":"web","fulfillment_status":"pending","tax_lines":[],"tags":"","contact_email":"jon@doe.ca","order_status_url":null,"line_items":[{"id":254721536,"variant_id":null,"title":"Soda","quantity":1,"price":"0.00","grams":0,"sku":"","variant_title":null,"vendor":null,"fulfillment_service":"manual","product_id":111475476,"requires_shipping":true,"taxable":true,"gift_card":false,"pre_tax_price":"9.00","name":"Soda","variant_inventory_management":null,"properties":[],"product_exists":true,"fulfillable_quantity":1,"total_discount":"0.00","fulfillment_status":null,"tax_lines":[]},{"id":5,"variant_id":null,"title":"Another Beer For Good Times","quantity":1,"price":"5.00","grams":500,"sku":"","variant_title":null,"vendor":null,"fulfillment_service":"manual","product_id":5410685889,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"Another Beer For Good Times","variant_inventory_management":null,"properties":[],"product_exists":true,"fulfillable_quantity":1,"total_discount":"5.00","fulfillment_status":null,"tax_lines":[]}],"shipping_lines":[{"id":null,"title":"Generic Shipping","price":"10.00","code":null,"source":"shopify","phone":null,"carrier_identifier":null,"tax_lines":[]}],"billing_address":{"first_name":"Bob","address1":"123 Billing Street","phone":"555-555-BILL","city":"Billtown","zip":"K2P0B0","province":"Kentucky","country":"United States","last_name":"Biller","address2":null,"company":"My Company","latitude":null,"longitude":null,"name":"Bob Biller","country_code":"US","province_code":"KY"},"shipping_address":{"first_name":"Steve","address1":"123 Shipping Street","phone":"555-555-SHIP","city":"Shippington","zip":"K2P0S0","province":"Kentucky","country":"United States","last_name":"Shipper","address2":null,"company":"Shipping Company","latitude":null,"longitude":null,"name":"Steve Shipper","country_code":"US","province_code":"KY"},"fulfillments":[],"refunds":[],"customer":{"id":null,"email":"john@test.com","accepts_marketing":false,"created_at":null,"updated_at":null,"first_name":"John","last_name":"Smith","orders_count":0,"state":"disabled","total_spent":"0.00","last_order_id":null,"note":null,"verified_email":true,"multipass_identifier":null,"tax_exempt":false,"tags":"","last_order_name":null,"default_address":{"id":null,"first_name":null,"last_name":null,"company":null,"address1":"123 Elm St.","address2":null,"city":"Ottawa","province":"Ontario","country":"Canada","zip":"K2H7A8","phone":"123-123-1234","name":"","province_code":"ON","country_code":"CA","country_name":"Canada","default":true}}}}
1 change: 1 addition & 0 deletions order.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ type Order struct {
CurrentTotalTaxSet *AmountSet `json:"current_total_tax_set,omitempty"`
TaxLines []TaxLine `json:"tax_lines,omitempty"`
TotalWeight int `json:"total_weight,omitempty"`
TotalTipReceived string `json:"total_tip_received,omitempty"`
FinancialStatus OrderFinancialStatus `json:"financial_status,omitempty"`
Fulfillments []Fulfillment `json:"fulfillments,omitempty"`
FulfillmentStatus OrderFulfillmentStatus `json:"fulfillment_status,omitempty"`
Expand Down

0 comments on commit cda5a08

Please sign in to comment.