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

Commit

Permalink
Adds tokenization test
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent 97b5fc1 commit 4378b33
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
@@ -1,5 +1,6 @@
<?php

use CraigPaul\Moneris\Moneris;
use CraigPaul\Moneris\Vault;
use CraigPaul\Moneris\CreditCard;

Expand Down Expand Up @@ -92,4 +93,23 @@ public function it_can_delete_a_credit_card_from_the_moneris_vault_and_returns_a
$this->assertNotNull($receipt->DataKey);
$this->assertEquals($key, $receipt->DataKey);
}

/** @test */
public function it_can_tokenize_a_previous_transaction_to_add_the_transactions_credit_card_in_the_moneris_vault_and_returns_a_data_key_for_storage()
{
$gateway = Moneris::create($this->id, $this->token, ['environment' => Moneris::ENV_TESTING]);

$response = $gateway->purchase([
'order_id' => uniqid('1234-56789', true),
'amount' => '1.00',
'credit_card' => $this->visa,
'expdate' => '2012',
]);

$response = $this->vault->tokenize($response->transaction);
$receipt = $response->receipt();

$this->assertTrue($response->successful);
$this->assertNotNull($receipt->DataKey);
}
}

0 comments on commit 4378b33

Please sign in to comment.