Skip to content

Commit

Permalink
Merge pull request #393 from stripe/ob-update-card-source
Browse files Browse the repository at this point in the history
Fix card source expiry date update
  • Loading branch information
ob-stripe authored Nov 28, 2017
2 parents deafdc5 + 31797c2 commit 6da07ab
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/StripeObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function init()
'address',
'address_kana',
'address_kanji',
'card',
'dob',
'inventory',
'legal_entity',
Expand Down
38 changes: 38 additions & 0 deletions tests/SourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,44 @@ public function testSaveOwner()
$this->assertSame($source->owner['address']['country'], "Test Country");
}


public function testSaveCardExpiryDate()
{
$response = array(
'id' => 'src_foo',
'object' => 'source',
'card' => array(
'exp_month' => 8,
'exp_year' => 2019,
),
);
$source = Source::constructFrom(
$response,
new Util\RequestOptions()
);

$response['card']['exp_month'] = 12;
$response['card']['exp_year'] = 2022;
$this->mockRequest(
'POST',
'/v1/sources/src_foo',
array(
'card' => array(
'exp_month' => 12,
'exp_year' => 2022,
)
),
$response
);

$source->card->exp_month = 12;
$source->card->exp_year = 2022;
$source->save();

$this->assertSame(12, $source->card->exp_month);
$this->assertSame(2022, $source->card->exp_year);
}

public function testDetachAttached()
{
$response = array(
Expand Down

0 comments on commit 6da07ab

Please sign in to comment.