Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e039b583e2 | ||
|
|
26571a41fa | ||
|
|
559a100e90 | ||
|
|
6ff851823e | ||
|
|
db6e320b7f | ||
|
|
563e6baeda | ||
|
|
e1f7e99027 | ||
|
|
36ca8d6f83 | ||
|
|
d182b35d56 |
5
go.mod
5
go.mod
@@ -1,8 +1,9 @@
|
|||||||
module github.com/debyltech/go-snipcart
|
module github.com/debyltech/go-snipcart
|
||||||
|
|
||||||
go 1.20
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/debyltech/go-helpers v1.0.5
|
github.com/debyltech/go-helpers v1.1.0
|
||||||
|
github.com/debyltech/go-shippr v0.1.0
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
helper "github.com/debyltech/go-helpers"
|
helper "github.com/debyltech/go-helpers/json"
|
||||||
"github.com/skip2/go-qrcode"
|
"github.com/skip2/go-qrcode"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -50,22 +50,25 @@ type SnipcartOrder struct {
|
|||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Invoice string `json:"invoiceNumber"`
|
Invoice string `json:"invoiceNumber"`
|
||||||
Subtotal float64 `json:"subtotal,omitempty"`
|
Subtotal float64 `json:"subtotal,omitempty"`
|
||||||
|
Currency string `json:"currency,omitempty"`
|
||||||
Total float64 `json:"grandTotal,omitempty"`
|
Total float64 `json:"grandTotal,omitempty"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
TotalWeight float64 `json:"totalWeight"`
|
TotalWeight float64 `json:"totalWeight"`
|
||||||
Email string `json:"email"`
|
|
||||||
Name string `json:"shippingAddressName"`
|
Name string `json:"shippingAddressName"`
|
||||||
|
Company string `json:"shippingAddressCompanyName"`
|
||||||
Address1 string `json:"shippingAddressAddress1"`
|
Address1 string `json:"shippingAddressAddress1"`
|
||||||
Address2 string `json:"shippingAddressAddress2"`
|
Address2 string `json:"shippingAddressAddress2"`
|
||||||
City string `json:"shippingAddressCity"`
|
City string `json:"shippingAddressCity"`
|
||||||
Province string `json:"shippingAddressProvince"`
|
Province string `json:"shippingAddressProvince"`
|
||||||
Country string `json:"shippingAddressCountry"`
|
Country string `json:"shippingAddressCountry"`
|
||||||
PostalCode string `json:"shippingAddressPostalCode"`
|
PostalCode string `json:"shippingAddressPostalCode"`
|
||||||
Phone string `json:"shippingAddressPhone"`
|
Phone string `json:"shippingAddressPhone,omitempty"`
|
||||||
|
Email string `json:"email,omitempty"`
|
||||||
TrackingNumber string `json:"trackingNumber"`
|
TrackingNumber string `json:"trackingNumber"`
|
||||||
TrackingUrl string `json:"trackingUrl"`
|
TrackingUrl string `json:"trackingUrl"`
|
||||||
ShippingCost float64 `json:"shippingFees"`
|
ShippingCost float64 `json:"shippingFees"`
|
||||||
Items []SnipcartItem `json:"items"`
|
Items []SnipcartItem `json:"items"`
|
||||||
|
Metadata any `json:"metadata"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SnipcartOrderUpdate struct {
|
type SnipcartOrderUpdate struct {
|
||||||
|
|||||||
30
snipcart/webhook.go
Normal file
30
snipcart/webhook.go
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package snipcart
|
||||||
|
|
||||||
|
type SnipcartShippingAddress struct {
|
||||||
|
FullName string `json:"fullName"`
|
||||||
|
FirstName string `json:"firstName"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Company string `json:"company"`
|
||||||
|
Address1 string `json:"address1"`
|
||||||
|
Address2 string `json:"address2"`
|
||||||
|
FullAddress string `json:"fullAddress"`
|
||||||
|
City string `json:"city"`
|
||||||
|
Country string `json:"country"`
|
||||||
|
PostalCode string `json:"postalCode"`
|
||||||
|
Province string `json:"province"`
|
||||||
|
Phone string `json:"phone"`
|
||||||
|
VatNumber string `json:"vatNumber,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SnipcartOrderEventContent struct {
|
||||||
|
Token string `json:"token"`
|
||||||
|
Invoice string `json:"invoiceNumber"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
PaymentStatus string `json:"paymentStatus"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Currency string `json:"currency"`
|
||||||
|
TotalWeight float64 `json:"totalWeight"`
|
||||||
|
Items []SnipcartItem `json:"items"`
|
||||||
|
ShippingAddress SnipcartShippingAddress `json:"shippingAddress"`
|
||||||
|
Metadata string `json:"metadata"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user