Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
* [Queries](components/money/queries.md)
* [Pager](components/pager/README.md)
* [Adapters](components/pager/adapters.md)
* [Pay](components/pay.md)
* [Registry](components/registry.md)
* [State Machine](components/state-machine.md)
* [Version](components/version.md)
Expand All @@ -65,6 +66,7 @@
* [Filesystem](contracts/filesystem.md)
* [Mailer](contracts/mailer.md)
* [Pager](contracts/pager.md)
* [Pay](contracts/pay.md)
* [Registry](contracts/registry.md)
* [State Machine](contracts/state-machine.md)

Expand Down
11 changes: 11 additions & 0 deletions docs/components/pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Pay
---

Pay is a multi-gateway payment processing library.

## Installation

```shell
composer require sonsofphp/pay
```
9 changes: 9 additions & 0 deletions docs/contracts/pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Pay Contract
---

## Installation

```shell
composer require sonsofphp/pay-contract
```
2 changes: 2 additions & 0 deletions src/SonsOfPHP/Contract/Pay/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gitattributes export-ignore
/.gitignore export-ignore
2 changes: 2 additions & 0 deletions src/SonsOfPHP/Contract/Pay/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
composer.lock
vendor/
12 changes: 12 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Command/CommandInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Command;

/**
* Commands tell a gateway to do something.
*
* @author Joshua Estes <[email protected]>
*/
interface CommandInterface {}
10 changes: 10 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Exception/PayExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Exception;

/**
* @author Joshua Estes <[email protected]>
*/
interface PayExceptionInterface {}
10 changes: 10 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Factory/FactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Factory;

/**
* @author Joshua Estes <[email protected]>
*/
interface FactoryInterface {}
15 changes: 15 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Gateway/GatewayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Gateway;

/**
* @author Joshua Estes <[email protected]>
*/
interface GatewayInterface
{
public function command(CommandInterface $command): void;

public function query(QueryInterface $command): mixed;
}
19 changes: 19 additions & 0 deletions src/SonsOfPHP/Contract/Pay/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2022 to Present Joshua Estes

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Marshaller/MarshallerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Marshaller;

/**
* @author Joshua Estes <[email protected]>
*/
interface MarshallerInterface
{
public function marshall(mixed $value): string;

public function unmarshall(string $value): mixed;
}
12 changes: 12 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Model/AddressInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* This is generally the billing address but could be any type of address.
*
* @author Joshua Estes <[email protected]>
*/
interface AddressInterface {}
21 changes: 21 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Model/BankAccountInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* Represents a bank account
*
* @author Joshua Estes <[email protected]>
*/
interface BankAccountInterface
{
public function getAccountNumber(): string;

public function setAccountNumber(string $accountNumber): void;

public function getRoutingNumber(): string;

public function setRoutingNumber(string $routingNumber): void;
}
12 changes: 12 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Model/CreditCardInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* Represents a credit card
*
* @author Joshua Estes <[email protected]>
*/
interface CreditCardInterface {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* @author Joshua Estes <[email protected]>
*/
interface GatwwayConfigurationInterface
{
public function getConfig(): array;

public function setConfig(array $config): void;
}
12 changes: 12 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Model/IdentifierInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* Used as a unique identifier
*
* @author Joshua Estes <[email protected]>
*/
interface IdentifierInterface {}
13 changes: 13 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Model/TokenInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Model;

/**
* A token is used for various things. It could be used as a payment token or
* authorization token
*
* @author Joshua Estes <[email protected]>
*/
interface TokenInterface {}
19 changes: 19 additions & 0 deletions src/SonsOfPHP/Contract/Pay/PayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay;

/**
* @author Joshua Estes <[email protected]>
*/
interface PayInterface
{
public function authorize($command): void;

public function capture($command): void;

public function void($command): void;

public function refund($command): void;
}
12 changes: 12 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Query/QueryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Query;

/**
* Queries return information from a gateway
*
* @author Joshua Estes <[email protected]>
*/
interface QueryInterface {}
18 changes: 18 additions & 0 deletions src/SonsOfPHP/Contract/Pay/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Sons of PHP - Pay Contract
==========================

Multi-Gateway Payment Processor

## Learn More

* [Documentation][docs]
* [Contributing][contributing]
* [Report Issues][issues] and [Submit Pull Requests][pull-requests] in the [Mother Repository][mother-repo]
* Get Help & Support using [Discussions][discussions]

[discussions]: https://github.com/orgs/SonsOfPHP/discussions
[mother-repo]: https://github.com/SonsOfPHP/sonsofphp
[contributing]: https://docs.sonsofphp.com/contributing/
[docs]: https://docs.sonsofphp.com/contracts/pay/
[issues]: https://github.com/SonsOfPHP/sonsofphp/issues?q=is%3Aopen+is%3Aissue+label%3APay
[pull-requests]: https://github.com/SonsOfPHP/sonsofphp/pulls?q=is%3Aopen+is%3Apr+label%3APay
10 changes: 10 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Registry/RegistryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Registry;

/**
* @author Joshua Estes <[email protected]>
*/
interface RegistryInterface {}
33 changes: 33 additions & 0 deletions src/SonsOfPHP/Contract/Pay/Storage/StorageInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace SonsOfPHP\Contract\Pay\Storage;

/**
* Storage is where all the models are stored. This could be the filesystem or
* database.
*
* @template T of object
*
* @author Joshua Estes <[email protected]>
*/
interface StorageInterface
{
/**
* @param T $model
*/
public function save(object $model): void;

/**
* @param T $model
*/
public function remove(object $model): void;

/**
* @param IndentifierInterface|string|int $id
*
* @return T
*/
public function find($id): ?object;
}
53 changes: 53 additions & 0 deletions src/SonsOfPHP/Contract/Pay/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "sonsofphp/pay-contract",
"type": "library",
"description": "",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards",
"payment-gateway"
],
"homepage": "https://github.com/SonsOfPHP/pay-contract",
"license": "MIT",
"authors": [
{
"name": "Joshua Estes",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/SonsOfPHP/sonsofphp/issues",
"forum": "https://github.com/orgs/SonsOfPHP/discussions",
"docs": "https://docs.sonsofphp.com"
},
"autoload": {
"psr-4": {
"SonsOfPHP\\Contract\\Pay\\": ""
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.2"
},
"extra": {
"sort-packages": true,
"branch-alias": {
"dev-main": "0.3.x-dev"
}
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/JoshuaEstes"
},
{
"type": "tidelift",
"url": "https://tidelift.com/subscription/pkg/packagist-sonsofphp-sonsofphp"
}
]
}
Loading