From bee49511b4022c6d40e4702347e36c2bf062d4f2 Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Fri, 21 Oct 2016 14:54:18 -0600 Subject: [PATCH] Adds masked lookup test --- tests/VaultTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/VaultTest.php b/tests/VaultTest.php index 6519670..2486060 100644 --- a/tests/VaultTest.php +++ b/tests/VaultTest.php @@ -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)); + } } \ No newline at end of file