Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Subscription.php #148

Merged
merged 1 commit into from
Nov 25, 2021
Merged

Update Subscription.php #148

merged 1 commit into from
Nov 25, 2021

Conversation

BKirev
Copy link
Contributor

@BKirev BKirev commented Nov 24, 2021

Allow paymentMethod() to be empty string. Subscriptions with "state": "deleted" don't have payment_information and payment_method respectively.

Solves #147

Allow paymentMethod() to be empty string
@@ -704,7 +704,7 @@ public function paddleEmail()
*/
public function paymentMethod()
{
return (string) $this->paddleInfo()['payment_information']['payment_method'];
return (string) ($this->paddleInfo()['payment_information']['payment_method'] ?? '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to return null here, and update the phpdoc. Seems odd to pretend we have a payment method when we don't?

@taylorotwell
Copy link
Member

taylorotwell commented Nov 24, 2021

I agree it seems weird to return an empty string? @driesvints

@taylorotwell taylorotwell marked this pull request as draft November 24, 2021 14:34
@driesvints
Copy link
Member

Switching to null now could be a breaking change that people expect. We use the same paradigm for card brand and last four in the methods below. It just represents a string representation of the value. The current PR seems fine to me.

@GrahamCampbell
Copy link
Member

I don't agree it's breaking, because it never worked, so nobody could be relying on that behaviour. ;)

@driesvints
Copy link
Member

I think we should be consistent with the other methods. If we want to do this we can change all of them in a future release.

@GrahamCampbell
Copy link
Member

Ok, let's do that.

@driesvints driesvints marked this pull request as ready for review November 25, 2021 11:53
@taylorotwell taylorotwell merged commit d867104 into laravel:1.x Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants