Skip to content

Commit

Permalink
Merge pull request #227 from getlago/feat-apply-taxes-current-usage
Browse files Browse the repository at this point in the history
feat: add apply taxes params to current usage
  • Loading branch information
brunomiguelpinto authored Feb 6, 2025
2 parents bdf2019 + 431799e commit e24cf9c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"fmt"
"time"

"strconv"
"github.com/google/uuid"
)

Expand Down Expand Up @@ -226,6 +226,7 @@ type CustomerCheckoutUrl struct {

type CustomerUsageInput struct {
ExternalSubscriptionID string `json:"external_subscription_id,omitempty"`
ApplyTaxes bool `json:"apply_taxes,omitempty"`
}

type CustomerPastUsageInput struct {
Expand Down Expand Up @@ -318,14 +319,9 @@ func (cr *CustomerRequest) Update(ctx context.Context, customerInput *CustomerIn
func (cr *CustomerRequest) CurrentUsage(ctx context.Context, externalCustomerID string, customerUsageInput *CustomerUsageInput) (*CustomerUsage, *Error) {
subPath := fmt.Sprintf("%s/%s/%s", "customers", externalCustomerID, "current_usage")

jsonQueryParams, err := json.Marshal(customerUsageInput)
if err != nil {
return nil, &Error{Err: err}
}

queryParams := make(map[string]string)
if err = json.Unmarshal(jsonQueryParams, &queryParams); err != nil {
return nil, &Error{Err: err}
queryParams := map[string]string{
"external_subscription_id": customerUsageInput.ExternalSubscriptionID,
"apply_taxes": strconv.FormatBool(customerUsageInput.ApplyTaxes),
}

clientRequest := &ClientRequest{
Expand Down

0 comments on commit e24cf9c

Please sign in to comment.