Skip to content

Commit

Permalink
Change price to any
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Mar 4, 2024
1 parent d218e9a commit 8da1ed4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions order.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type OrderAttributes struct {
TaxUsd int `json:"tax_usd"`
TotalUsd int `json:"total_usd"`
TaxName string `json:"tax_name"`
TaxRate string `json:"tax_rate"`
TaxRate any `json:"tax_rate"`
Status string `json:"status"`
StatusFormatted string `json:"status_formatted"`
Refunded bool `json:"refunded"`
Expand Down Expand Up @@ -49,8 +49,8 @@ type OrderAttributes struct {
UpdatedAt time.Time `json:"updated_at"`
}

// ApiResponseRelationshipsOrder relationships of an order
type ApiResponseRelationshipsOrder struct {
// APIResponseRelationshipsOrder relationships of an order
type APIResponseRelationshipsOrder struct {
Store ApiResponseLinks `json:"store"`
Customer ApiResponseLinks `json:"customer"`
OrderItems ApiResponseLinks `json:"order-items"`
Expand All @@ -59,8 +59,8 @@ type ApiResponseRelationshipsOrder struct {
DiscountRedemptions ApiResponseLinks `json:"discount-redemptions"`
}

// OrderApiResponse is the api response for one order
type OrderApiResponse = ApiResponse[OrderAttributes, ApiResponseRelationshipsOrder]
// OrderAPIResponse is the api response for one order
type OrderAPIResponse = ApiResponse[OrderAttributes, APIResponseRelationshipsOrder]

// OrdersApiResponse is the api response for a list of orders.
type OrdersApiResponse = ApiResponseList[OrderAttributes, ApiResponseRelationshipsOrder]
// OrdersAPIResponse is the api response for a list of orders.
type OrdersAPIResponse = ApiResponseList[OrderAttributes, APIResponseRelationshipsOrder]
8 changes: 4 additions & 4 deletions orders_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ type OrdersService service
// Get returns the order with the given ID.
//
// https://docs.lemonsqueezy.com/api/orders#retrieve-an-order
func (service *OrdersService) Get(ctx context.Context, orderID string) (*OrderApiResponse, *Response, error) {
func (service *OrdersService) Get(ctx context.Context, orderID string) (*OrderAPIResponse, *Response, error) {
response, err := service.client.do(ctx, http.MethodGet, "/v1/orders/"+orderID)
if err != nil {
return nil, response, err
}

order := new(OrderApiResponse)
order := new(OrderAPIResponse)
if err = json.Unmarshal(*response.Body, order); err != nil {
return nil, response, err
}
Expand All @@ -29,13 +29,13 @@ func (service *OrdersService) Get(ctx context.Context, orderID string) (*OrderAp
// List returns a paginated list of orders.
//
// https://docs.lemonsqueezy.com/api/orders#list-all-orders
func (service *OrdersService) List(ctx context.Context) (*OrdersApiResponse, *Response, error) {
func (service *OrdersService) List(ctx context.Context) (*OrdersAPIResponse, *Response, error) {
response, err := service.client.do(ctx, http.MethodGet, "/v1/orders")
if err != nil {
return nil, response, err
}

orders := new(OrdersApiResponse)
orders := new(OrdersAPIResponse)
if err = json.Unmarshal(*response.Body, orders); err != nil {
return nil, response, err
}
Expand Down
2 changes: 1 addition & 1 deletion variant.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type VariantAttributes struct {
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
Price int `json:"price"`
Price any `json:"price"`
IsSubscription bool `json:"is_subscription"`
Interval *string `json:"interval"`
IntervalCount *int `json:"interval_count"`
Expand Down
2 changes: 1 addition & 1 deletion webhook_request.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package lemonsqueezy

// WebhookRequestOrder is the payload for order related events e.g. order_created, order_refunded
type WebhookRequestOrder WebhookRequest[OrderAttributes, ApiResponseRelationshipsOrder]
type WebhookRequestOrder WebhookRequest[OrderAttributes, APIResponseRelationshipsOrder]

// WebhookRequestSubscription is the payload for subscription related events e.g. subscription_created, subscription_updated
type WebhookRequestSubscription WebhookRequest[Subscription, ApiResponseRelationshipsSubscription]
Expand Down

0 comments on commit 8da1ed4

Please sign in to comment.