Skip to content

Commit

Permalink
Minimal support for ACH tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Jul 7, 2017
1 parent a7f3277 commit 29b53c0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Billable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use InvalidArgumentException;
use Stripe\Token as StripeToken;
use Illuminate\Support\Collection;
use Stripe\BankAccount as StripeBankAccount;
use Stripe\Card as StripeCard;
use Stripe\Charge as StripeCharge;
use Stripe\Refund as StripeRefund;
use Stripe\Invoice as StripeInvoice;
Expand Down Expand Up @@ -376,7 +378,7 @@ public function updateCard($token)
// If the given token already has the card as their default source, we can just
// bail out of the method now. We don't need to keep adding the same card to
// a model's account every time we go through this particular method call.
if ($token->card->id === $customer->default_source) {
if ($token[$token->type]->id === $customer->default_source) {
return;
}

Expand Down Expand Up @@ -431,14 +433,17 @@ public function updateCardFromStripe()
/**
* Fills the model's properties with the source from Stripe.
*
* @param \Stripe\Card|null $card
* @param \Stripe\Card|\Stripe\BankAccount|null $card
* @return $this
*/
protected function fillCardDetails($card)
{
if ($card) {
if ($card instanceof StripeCard) {
$this->card_brand = $card->brand;
$this->card_last_four = $card->last4;
} else if ($card instanceof StripeBankAccount) {
$this->card_brand = 'Bank Account';
$this->card_last_four = $card->last4;
}

return $this;
Expand Down

0 comments on commit 29b53c0

Please sign in to comment.