From 8d8f3cf841d6929a4c90c9785628ff243064857e Mon Sep 17 00:00:00 2001 From: Acho Arnold Date: Sun, 20 Aug 2023 12:03:23 +0300 Subject: [PATCH] Hard code the subscriptions block --- subscriptions.go | 1 - subscriptions_service.go | 6 +----- subscriptions_service_test.go | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/subscriptions.go b/subscriptions.go index 3ef5671..ceaf6dd 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -41,7 +41,6 @@ type SubscriptionPause struct { // SubscriptionUpdateParams are parameters for updating a subscription type SubscriptionUpdateParams struct { - Type string `json:"type"` ID string `json:"id"` Attributes SubscriptionUpdateParamsAttributes `json:"attributes"` } diff --git a/subscriptions_service.go b/subscriptions_service.go index fd5236e..92451d5 100644 --- a/subscriptions_service.go +++ b/subscriptions_service.go @@ -13,14 +13,10 @@ type SubscriptionsService service // // https://docs.lemonsqueezy.com/api/subscriptions#update-a-subscription func (service *SubscriptionsService) Update(ctx context.Context, params *SubscriptionUpdateParams) (*ApiResponseSubscription, *Response, error) { - typeParam := "subscriptions" - if len(params.Type) > 0 { - typeParam = params.Type - } payload := map[string]any{ "data": map[string]any{ "id": params.ID, - "type": typeParam, + "type": "subscriptions", "attributes": params.Attributes, }, } diff --git a/subscriptions_service_test.go b/subscriptions_service_test.go index 2617125..543f362 100644 --- a/subscriptions_service_test.go +++ b/subscriptions_service_test.go @@ -252,8 +252,7 @@ func TestSubscriptionsService_Update(t *testing.T) { // Act subscription, response, err := client.Subscriptions.Update(context.Background(), &SubscriptionUpdateParams{ - Type: "subscriptions", - ID: "1", + ID: "1", Attributes: SubscriptionUpdateParamsAttributes{ ProductID: 9, VariantID: 11,