Skip to content

Commit

Permalink
various changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Dec 8, 2023
1 parent 19f8198 commit 277261e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
9 changes: 6 additions & 3 deletions docs/contracts/gateway/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ Out of Scope
```php
<?php

$processor = new StripeProcessor(key: '...', secret: '...');
$processor = new PaymentProcessor(key: '...', secret: '...');
$gateway = new Gateway($processor);

$transaction = $gateway->authorize(...);
$transaction = $gateway->capture(...);
$card = new CreditCard();
$card->setNumber(...)->setCvv(...);

$transaction = $gateway->authorize(['card' => $card]);
$transaction = $gateway->capture(['card' => $card]);

// Token Based processors
$transaction = $gateway->purchase($token);
Expand Down
4 changes: 2 additions & 2 deletions src/SonsOfPHP/Contract/Gateway/AuthorizableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
interface AuthorizableInterface
{
public function authorize($options): void;
public function authorize(array $options): void;

public function authorizeComplete($options): void;
public function authorizeComplete(array $options): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
* Processor Examples
* - Stripe
* - Authorize.net
* - Dummy or Mock
* - Round Robin
* - Capped
*
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface ProcessorInterface
interface PaymentProcessorInterface
{
/**
* MUST return the friendly name such as "Stripe"
*
* This MAY BE used as a display on the frontend
*/
public function getName(): string;
}
3 changes: 2 additions & 1 deletion src/SonsOfPHP/Contract/Gateway/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Sons of PHP - Gateway Contract
==============================


The Gateway Contract is an abstract way to interact with payment gateways or
processors. An example of this would be Stripe.

## Learn More

Expand Down
6 changes: 4 additions & 2 deletions src/SonsOfPHP/Contract/Gateway/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonsofphp/gateway-contract",
"type": "library",
"description": "",
"description": "Abstract Gateway Contract to allow payment processing",
"keywords": [
"abstractions",
"contracts",
Expand Down Expand Up @@ -32,7 +32,9 @@
"prefer-stable": true,
"require": {
"php": ">=8.1",
"psr/http-client": "^1.0"
"psr/http-client": "^1.0",
"psr/event-dispatcher": "^1.0",
"sonsofphp/money-contract": "^0.3.0@dev"
},
"extra": {
"sort-packages": true,
Expand Down

0 comments on commit 277261e

Please sign in to comment.