Skip to content

Instantly share code, notes, and snippets.

@davidchc
Created July 10, 2018 23:35
Show Gist options
  • Save davidchc/fdf693804217b7a1aa637da078ebbaf7 to your computer and use it in GitHub Desktop.
Save davidchc/fdf693804217b7a1aa637da078ebbaf7 to your computer and use it in GitHub Desktop.
Gateway de pagamento
<?php
namespace Payment;
interface Gateway
{
public function processPayment($order_id);
public function success($order_id);
public function callback();
}
<?php
class MethodPayment
{
private $gateways;
public function __construct()
{
$this->gateways = [];
}
public function addGateway(Gateway $gateway)
{
$this->gateways[] = $gateway;
}
}
<?php
namespace Payment;
class PagSeguro implements Gateway {
public function processPayment($order_id)
{
}
public function success($order_id)
{
}
public function callback()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment