mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2024-11-01 00:53:10 +01:00
Implemented Payment Methods
This commit is contained in:
parent
782c0e511e
commit
e05884340b
12
src/entity/payment/AbstractPayment.php
Normal file
12
src/entity/payment/AbstractPayment.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace entity\payment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
abstract class AbstractPayment implements PaymentInterface
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace entity\payment;
|
namespace entity\payment;
|
||||||
|
|
||||||
use entity\order\OrderInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
@ -10,6 +8,10 @@ use entity\order\OrderInterface;
|
|||||||
*/
|
*/
|
||||||
interface PaymentInterface
|
interface PaymentInterface
|
||||||
{
|
{
|
||||||
public function pay(OrderInterface $order):void;
|
/**
|
||||||
|
* Returns the name of the payment Method
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getName():string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
src/entity/payment/method1/Method1.php
Normal file
18
src/entity/payment/method1/Method1.php
Normal 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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
15
src/entity/payment/method1/Method1Test.php
Normal file
15
src/entity/payment/method1/Method1Test.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace entity\payment\method1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Method1Test
|
||||||
|
{
|
||||||
|
public function testName():void{
|
||||||
|
$this->assertEquals(Method1::getName(), 'method1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
18
src/entity/payment/method2/Method2.php
Normal file
18
src/entity/payment/method2/Method2.php
Normal 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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
17
src/entity/payment/method2/Method2Test.php
Normal file
17
src/entity/payment/method2/Method2Test.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user