Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Adds masked lookup test
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent 80025a8 commit bee4951
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/VaultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,24 @@ public function it_can_tokenize_a_previous_transaction_to_add_the_transactions_c
$this->assertTrue($response->successful);
$this->assertNotNull($receipt->DataKey);
}

/** @test */
public function it_can_peek_into_the_vault_and_retrieve_a_masked_credit_card_from_the_moneris_vault_with_a_valid_data_key()
{
$card = CreditCard::create($this->visa, '2012');

$response = $this->vault->add($card);
$key = $response->receipt()->DataKey;

$response = $this->vault->peek($key);
$receipt = $response->receipt();
$beginning = substr($this->visa, 0, 4);
$end = substr($this->visa, -4, 4);

$this->assertTrue($response->successful);
$this->assertNotNull($receipt->DataKey);
$this->assertEquals('2012', $receipt->ResolveData->expdate);
$this->assertEquals($beginning, substr($receipt->ResolveData->masked_pan, 0, 4));
$this->assertEquals($end, substr($receipt->ResolveData->masked_pan, -4, 4));
}
}

0 comments on commit bee4951

Please sign in to comment.