Skip to content

Commit

Permalink
fix static calls
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Oct 15, 2018
1 parent ff4776f commit f56c119
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/integrators/DatabaseIntegrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function findByKey($key, $token)
return false;
}

if (self::validateProcess($model, $token)) {
$model = self::createPayModel($model);
if ($this->validateProcess($model, $token)) {
$model = $this->createPayModel($model);
$model->setAuthToken($token);
return $model;
}
Expand Down Expand Up @@ -89,14 +89,14 @@ public function closeModel(PayModel $model, $state)

/* internal methods */

private static function validateProcess(Process $process, $token)
private function validateProcess(Process $process, $token)
{
$process->auth_token = $token;

return $process->validateAuthToken();
}

private static function createPayModel(Process $process)
private function createPayModel(Process $process)
{
$model = new PayModel();
$model->orderId = $process->order_id;
Expand Down
8 changes: 5 additions & 3 deletions tests/src/PaymentProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public function testPaymentProcessObject()

$this->assertNotFalse($processId);

$model = DatabaseIntegrator::findByKey($object->getRandomKey(), $object->getAuthToken());
$int = $this->app->getModule('payment')->getIntegrator();
$model = $int->findByKey($object->getRandomKey(), $object->getAuthToken());
$this->assertInstanceOf('\luya\payment\base\PayModel', $model);

$token = $model->getAuthToken();
Expand All @@ -68,7 +69,7 @@ public function testPaymentProcessObject()

// find payment by token:

$object3 = DatabaseIntegrator::findByKey($randomKey, $token);
$object3 = $int->findByKey($randomKey, $token);

$this->assertInstanceOf('\luya\payment\base\PayModel', $object3);
$this->assertSame($processId, $object3->getId());
Expand Down Expand Up @@ -109,7 +110,8 @@ public function testUrlRules()
$token = $object->getAuthToken();
$key = $object->getRandomKey();

$model = DatabaseIntegrator::findByKey($key, $token);
$int = $this->app->getModule('payment')->getIntegrator();
$model = $int->findByKey($key, $token);

$this->assertContains('payment-create', $model->getTransactionGatewayCreateLink());
$this->assertContains('payment-abort', $model->getTransactionGatewayAbortLink());
Expand Down

0 comments on commit f56c119

Please sign in to comment.