File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/php/Objects/Subscription Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -37,3 +37,4 @@ f5037b59ad70b9cec45fda109e63af97ba610cf0
37371b1e37e7f6d565e758ec33a47f33bcb38c67f2a7
38385e45268b58773ec58cfc871ff3298590897132a1
3939426268d51a96299fea45ba3059e8f9c2a04e777d
40+ 9b456f26dc1b90e64097086295c9f17da98b40ab
Original file line number Diff line number Diff line change @@ -172,6 +172,16 @@ private static function extractItems(Subscription $stripeSubscription): ?Collect
172172 $ subscriptionItem = $ subscriptionItem ->withMetadata ($ item ->metadata ->toArray ());
173173 }
174174
175+ $ currentPeriodStart = self ::timestampToCarbon ($ item ->current_period_start ?? null );
176+ if (!is_null ($ currentPeriodStart )) {
177+ $ subscriptionItem = $ subscriptionItem ->withCurrentPeriodStart ($ currentPeriodStart );
178+ }
179+
180+ $ currentPeriodEnd = self ::timestampToCarbon ($ item ->current_period_end ?? null );
181+ if (!is_null ($ currentPeriodEnd )) {
182+ $ subscriptionItem = $ subscriptionItem ->withCurrentPeriodEnd ($ currentPeriodEnd );
183+ }
184+
175185 $ items [] = $ subscriptionItem ;
176186 }
177187
@@ -281,7 +291,7 @@ public function toArray(): array
281291 {
282292 $ items = null ;
283293 if ($ this ->items instanceof Collection) {
284- $ items = $ this ->items ->map (fn (StripeSubscriptionItem $ item ): array => $ item ->toArray ())->all ();
294+ $ items = $ this ->items ->map (fn (StripeSubscriptionItem $ item ): array => $ item ->toArray ())->all ();
285295 }
286296
287297 $ array = [
You can’t perform that action at this time.
0 commit comments