Closed haszzam closed 9 months ago
Hi @driesvints,
I know i'm bothering you a lot lately, But I tried to send a pull request with the fix for this issue but it failed the tests with the following message "Paddle API key not set."
I don't know where should I set the key and if I even should set a Paddle API key publicly.
If you can check it out and let me know what I have done wrong to fail the tests I would really appretiate it so that I can send a pull request directly if I found any other issues.
https://github.com/laravel/cashier-paddle/pull/223#issue-2044669672
Thanks!
@haszzam heya! Sorry for the late reply here. Don't worry about it. I appreciate you notifying us! I've sent in a PR here: https://github.com/laravel/cashier-paddle/pull/226
Hi @driesvints, Thank you!
BTW I checked the PR and it's only including the fix for the issue (1).
It does not fix the second issue with the decrementQuantity()
.
Oh you're correct. Added that as well 👍
Thanks @driesvints I really appreciate your help!
Cashier Paddle Version
2.x
Laravel Version
10.10
PHP Version
8.1
Database Driver & Version
No response
Description
Issue (1)
The
incrementQuantity()
method was failing and throwing the error below.In the
updateQuantity()
runningpluck(['quantity', 'price_id'])
on the result fromget(['quantity', 'price_id'])
was returning null in the following line$items = $this->items()->get(['quantity', 'price_id'])->pluck(['quantity', 'price_id'])->toArray();
I'm also not sure you could pass and array to
pluck
, I think this was added by mistake.Solution (1)
Removed
pluck(['quantity', 'price_id'])
Steps To Reproduce (1)
Try running
$user->subscription()->incrementQuantity(1, 'price_id');
.Issue (2)
The
decrementQuantity()
method was failing and throwing the error below.The problem is that the
decrementQuantity()
is not passing the$item
or the$price_id
to theupdateQuantity()
method as you can see belowSolution (2)
Pass the
$item
instance to theupdateQuantity()
method.return $this->updateQuantity(max(1, $item->quantity - $count));
Steps To Reproduce (2)
Try running
$user->subscription()->decrementQuantity(1, 'price_id');
.