From d452c0b9bf0ef1b78771fa7b28b89883bac14bae Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 13 May 2020 17:30:16 -0700 Subject: [PATCH] Fixing `LineItems` to be ` LineItemList` on Checkout `Session` --- checkout/session/client_test.go | 7 +++++-- checkout_session.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/checkout/session/client_test.go b/checkout/session/client_test.go index 5e62cb08a3..113cbc7d3e 100644 --- a/checkout/session/client_test.go +++ b/checkout/session/client_test.go @@ -15,7 +15,7 @@ func TestCheckoutSessionGet(t *testing.T) { } func TestCheckoutSessionNew(t *testing.T) { - session, err := New(&stripe.CheckoutSessionParams{ + params := &stripe.CheckoutSessionParams{ CancelURL: stripe.String("https://stripe.com/cancel"), ClientReferenceID: stripe.String("1234"), LineItems: []*stripe.CheckoutSessionLineItemParams{ @@ -61,9 +61,12 @@ func TestCheckoutSessionNew(t *testing.T) { }, }, SuccessURL: stripe.String("https://stripe.com/success"), - }) + } + params.AddExpand("line_items") + session, err := New(params) assert.Nil(t, err) assert.NotNil(t, session) + assert.Equal(t, session.LineItems.Data[0].Object, "item") } func TestCheckoutSessionList(t *testing.T) { diff --git a/checkout_session.go b/checkout_session.go index 01e3db0081..c53974dbed 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -203,7 +203,7 @@ type CheckoutSession struct { Deleted bool `json:"deleted"` DisplayItems []*CheckoutSessionDisplayItem `json:"display_items"` ID string `json:"id"` - LineItems []*LineItem `json:"line_items"` + LineItems *LineItemList `json:"line_items"` Livemode bool `json:"livemode"` Locale string `json:"locale"` Metadata map[string]string `json:"metadata"`