Implemented Payment Methods

This commit is contained in:
Kevin Frantz 2018-07-14 13:35:26 +02:00
parent 782c0e511e
commit e05884340b
6 changed files with 85 additions and 3 deletions

View File

@ -0,0 +1,12 @@
<?php
namespace entity\payment;
/**
*
* @author kevinfrantz
*
*/
abstract class AbstractPayment implements PaymentInterface
{
}

View File

@ -1,8 +1,6 @@
<?php
namespace entity\payment;
use entity\order\OrderInterface;
/**
*
* @author kevinfrantz
@ -10,6 +8,10 @@ use entity\order\OrderInterface;
*/
interface PaymentInterface
{
public function pay(OrderInterface $order):void;
/**
* Returns the name of the payment Method
* @return string
*/
public static function getName():string;
}

View File

@ -0,0 +1,18 @@
<?php
namespace entity\payment\method1;
use entity\payment\AbstractPayment;
/**
*
* @author kevinfrantz
*
*/
final class Method1 extends AbstractPayment
{
public static function getName(): string
{
return 'method1';
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace entity\payment\method1;
/**
*
* @author kevinfrantz
*
*/
class Method1Test
{
public function testName():void{
$this->assertEquals(Method1::getName(), 'method1');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace entity\payment\method2;
use entity\payment\AbstractPayment;
/**
*
* @author kevinfrantz
*
*/
final class Method2 extends AbstractPayment
{
public static function getName(): string
{
return 'method2';
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace entity\payment\method2;
use PHPUnit\Framework\TestCase;
/**
*
* @author kevinfrantz
*
*/
class Method2Test extends TestCase
{
public function testName():void{
$this->assertEquals(Method2::getName(), 'method2');
}
}