Skip to content

Commit

Permalink
Add paymentMethod method
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Aug 7, 2020
1 parent e8fd6b3 commit 6f78dfe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,16 @@ public function paddleEmail()
return (string) $this->paddleInfo()['user_email'];
}

/**
* Get the payment method type from the subscription.
*
* @return string
*/
public function paymentMethod()
{
return (string) $this->paddleInfo()['payment_information']['payment_method'];
}

/**
* Get the card brand from the subscription.
*
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/SubscriptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public function test_subscriptions_can_retrieve_their_payment_info()
]);

$this->assertSame('[email protected]', $subscription->paddleEmail());
$this->assertSame('card', $subscription->paymentMethod());
$this->assertSame('master', $subscription->cardBrand());
$this->assertSame('4050', $subscription->cardLastFour());
}
Expand Down

0 comments on commit 6f78dfe

Please sign in to comment.