Skip to content

Commit

Permalink
client.go: Fix issue with how platform is set on call() (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaraldNordgren authored Apr 24, 2024
1 parent a7fad02 commit f134572
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions purchases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,26 @@ func TestCreatePurchaseWithOpts(t *testing.T) {
cl.expectXPlatform(t, "ios")
cl.expectBody(t, `{"app_user_id":"123","fetch_token":"testreceipt","product_id":"product_sku","is_restore":true}`)
}

func TestCreatePurchaseWithStripe(t *testing.T) {
cl := newMockClient(t, 200, nil, nil)
rc := New("apikey")
rc.http = cl

opt := &CreatePurchaseOptions{
Platform: string(StripeStore),

ProductID: "product_sku",
IsRestore: true,
}

_, err := rc.CreatePurchase("123", "testreceipt", opt)
if err != nil {
t.Errorf("error: %v", err)
}

cl.expectMethod(t, "POST")
cl.expectPath(t, "/v1/receipts")
cl.expectXPlatform(t, "stripe")
cl.expectBody(t, `{"app_user_id":"123","fetch_token":"testreceipt","product_id":"product_sku","is_restore":true}`)
}

0 comments on commit f134572

Please sign in to comment.