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

Commit

Permalink
Removes external validator and poorly thought through internal valida…
Browse files Browse the repository at this point in the history
…tion classes
  • Loading branch information
Craig Paul committed Oct 19, 2016
1 parent 59706d0 commit f683f6f
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 181 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
],
"require": {
"php": ">=7.0",
"guzzlehttp/guzzle": "~6.0",
"respect/validation": "^1.1.9"
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {
"phpunit/phpunit": "~5.0",
Expand Down
35 changes: 0 additions & 35 deletions src/Exceptions/ValidationException.php

This file was deleted.

21 changes: 0 additions & 21 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace CraigPaul\Moneris;

use CraigPaul\Moneris\Validators\Purchase;
use CraigPaul\Moneris\Validators\Validatable;

/**
* CraigPaul\Moneris\Gateway
*
Expand Down Expand Up @@ -69,8 +66,6 @@ public function __construct(string $id, string $token, string $environment)
*/
public function purchase(array $params = [])
{
$this->validate(Purchase::class, $params);

array_merge($params, [
'type' => 'purchase',
'crypt_type' => Crypt::SSL_ENABLED_MERCHANT,
Expand Down Expand Up @@ -108,20 +103,4 @@ protected function transaction(array $params = null)

return $this->transaction;
}

/**
* Validate the supplied parameters against a provided class.
*
* @param string $class
* @param array $params
*
* @return void
*/
protected function validate(string $class, array $params = [])
{
/** @var Validatable $class */
$class = new $class;

$class->validate($params);
}
}
34 changes: 0 additions & 34 deletions src/Validators/Purchase.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Validators/Validatable.php

This file was deleted.

66 changes: 0 additions & 66 deletions src/Validators/Validator.php

This file was deleted.

8 changes: 0 additions & 8 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ public function it_can_access_properties_of_the_class()
$this->assertEquals($this->environment, $this->gateway->environment);
}

/** @test */
public function it_can_validate_that_it_has_received_improper_parameters_to_make_a_purchase()
{
$this->expectException(ValidationException::class);

$this->gateway->purchase([]);
}

/** @test */
public function it_can_make_a_purchase_and_receive_a_response()
{
Expand Down

0 comments on commit f683f6f

Please sign in to comment.