diff --git a/README.md b/README.md index c8122f6..aef2c98 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,6 @@ use NjoguAmos\Pesapal\Models\PesapalIpn; $ips = PesapalIpn::all(); ``` - ```php [ [ @@ -186,6 +185,63 @@ $ips = PesapalIpn::all(); ] ``` +### Submit Order Request Endpoint + +To submit an order request, you can use the `createOrder` method in the `Pesapal` class. You will need to construct a DTO for `PesapalOrderData` and `PesapalAddressData` as shown below. + +> **info** You must provide a registered `PesapalIpn`. + + +```php +use NjoguAmos\Pesapal\Enums\ISOCountryCode; +$ipnId = PesapalIpn::latest()->first()->ipn_id; + + $orderData = new PesapalOrderData( + id: fake()->uuid(), + currency: ISOCurrencyCode::KES, + amount: fake()->randomFloat(nbMaxDecimals: 2, min: 50, max: 500), + description: 'Test order', + callbackUrl: fake()->url(), + notificationId: $ipnId, + cancellationUrl: fake()->url(), + redirectMode: RedirectMode::PARENT_WINDOW, +); + +// All fields are optional except either phoneNumber or emailAddress +$billingAddress = new PesapalAddressData( + phoneNumber: '0700325008', + emailAddress: 'test@xample.com', + countryCode: ISOCountryCode::KE + firstName: 'Amos', + middleName: 'Njogu' +// lastName: '' + line2: "Gil House, Nairobi, Tom Mboya Street", +// city: "", +// state: "", +// postalCode: "", +// zipCode: "", +); + +$order = Pesapal::createOrder( + orderData: $orderData, + billingAddress: $billingAddress, +); +``` + +If the response was successful, your response should be as follows. + +```php +[ + "order_tracking_id" => "b945e4af-80a5-4ec1-8706-e03f8332fb04", + "merchant_reference" => "TEST1515111119", + "redirect_url" => "https://cybqa.pesapal.com/pesapaliframe/PesapalIframe3/Index/?OrderTrackingId=b945e4af-80a5-4ec1-8706-e03f8332fb04", + "error" => null, + "status" => "200" +] +``` + +You can now re-direct the user to the `redirect_url` to complete the payment. + ## Testing > **Info** Where possible, the tests uses real [sandbox credentials](https://developer.pesapal.com/api3-demo-keys.txt), and as such the request is not mocked. This ensures the stability of the package. Where it is impossible to use real credentials, the request is mocked. Therefore you must be connected to the internet to run the some of the tests. diff --git a/composer.json b/composer.json index 1ca9cc5..b11c1e6 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "php": "^8.1 | ^8.2 | ^8.3", "illuminate/contracts": "^10.0", "saloonphp/saloon": "^3.7.0", + "spatie/laravel-data": "^4.4", "spatie/laravel-package-tools": "^1.16.3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 98fb9ca..bd4484d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,866 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ce6ac371b076ee43a6bc852f36110da6", + "content-hash": "287c17769ddf08398871ba1da88fa48c", "packages": [ + { + "name": "amphp/amp", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "aaf0ec1d5a2c20b523258995a10e80c1fb765871" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/aaf0ec1d5a2c20b523258995a10e80c1fb765871", + "reference": "aaf0ec1d5a2c20b523258995a10e80c1fb765871", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "^4.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/Future/functions.php", + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "https://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "support": { + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2022-12-18T16:52:44+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "daa00f2efdbd71565bf64ffefa89e37542addf93" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/daa00f2efdbd71565bf64ffefa89e37542addf93", + "reference": "daa00f2efdbd71565bf64ffefa89e37542addf93", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/parser": "^1.1", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2.3" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.22.1" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\ByteStream\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "https://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "support": { + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v2.1.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-02-17T04:49:38+00:00" + }, + { + "name": "amphp/cache", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/cache.git", + "reference": "218bb3888d380eb9dd926cd06f803573c84391d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/cache/zipball/218bb3888d380eb9dd926cd06f803573c84391d3", + "reference": "218bb3888d380eb9dd926cd06f803573c84391d3", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Cache\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + } + ], + "description": "A fiber-aware cache API based on Amp and Revolt.", + "homepage": "https://amphp.org/cache", + "support": { + "issues": "https://github.com/amphp/cache/issues", + "source": "https://github.com/amphp/cache/tree/v2.0.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2023-01-09T21:04:12+00:00" + }, + { + "name": "amphp/dns", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/dns.git", + "reference": "3e3f413fbbaacd9632b1612941b363fa26a72e52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/dns/zipball/3e3f413fbbaacd9632b1612941b363fa26a72e52", + "reference": "3e3f413fbbaacd9632b1612941b363fa26a72e52", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/windows-registry": "^1.0.1", + "daverandom/libdns": "^2.0.2", + "ext-filter": "*", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Dns\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Wright", + "email": "addr@daverandom.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + } + ], + "description": "Async DNS resolution for Amp.", + "homepage": "https://github.com/amphp/dns", + "keywords": [ + "amp", + "amphp", + "async", + "client", + "dns", + "resolve" + ], + "support": { + "issues": "https://github.com/amphp/dns/issues", + "source": "https://github.com/amphp/dns/tree/v2.1.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-01-30T23:25:30+00:00" + }, + { + "name": "amphp/parallel", + "version": "v2.2.7", + "source": { + "type": "git", + "url": "https://github.com/amphp/parallel.git", + "reference": "ffda869c33c30627b6eb5c25f096882d885681dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/parallel/zipball/ffda869c33c30627b6eb5c25f096882d885681dc", + "reference": "ffda869c33c30627b6eb5c25f096882d885681dc", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/parser": "^1", + "amphp/pipeline": "^1", + "amphp/process": "^2", + "amphp/serialization": "^1", + "amphp/socket": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" + }, + "type": "library", + "autoload": { + "files": [ + "src/Context/functions.php", + "src/Context/Internal/functions.php", + "src/Ipc/functions.php", + "src/Worker/functions.php" + ], + "psr-4": { + "Amp\\Parallel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Parallel processing component for Amp.", + "homepage": "https://github.com/amphp/parallel", + "keywords": [ + "async", + "asynchronous", + "concurrent", + "multi-processing", + "multi-threading" + ], + "support": { + "issues": "https://github.com/amphp/parallel/issues", + "source": "https://github.com/amphp/parallel/tree/v2.2.7" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-16T16:15:46+00:00" + }, + { + "name": "amphp/parser", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/parser.git", + "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/parser/zipball/ff1de4144726c5dad5fab97f66692ebe8de3e151", + "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Parser\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A generator parser to make streaming parsers simple.", + "homepage": "https://github.com/amphp/parser", + "keywords": [ + "async", + "non-blocking", + "parser", + "stream" + ], + "support": { + "issues": "https://github.com/amphp/parser/issues", + "source": "https://github.com/amphp/parser/tree/v1.1.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2022-12-30T18:08:47+00:00" + }, + { + "name": "amphp/pipeline", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/pipeline.git", + "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/pipeline/zipball/f1c2ce35d27ae86ead018adb803eccca7421dd9b", + "reference": "f1c2ce35d27ae86ead018adb803eccca7421dd9b", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.18" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\Pipeline\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Asynchronous iterators and operators.", + "homepage": "https://amphp.org/pipeline", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "iterator", + "non-blocking" + ], + "support": { + "issues": "https://github.com/amphp/pipeline/issues", + "source": "https://github.com/amphp/pipeline/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-10T14:48:16+00:00" + }, + { + "name": "amphp/process", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/process.git", + "reference": "a79dc87100be857db2c4bbfd5369585a6d1e658c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/process/zipball/a79dc87100be857db2c4bbfd5369585a6d1e658c", + "reference": "a79dc87100be857db2c4bbfd5369585a6d1e658c", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Process\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A fiber-aware process manager based on Amp and Revolt.", + "homepage": "https://amphp.org/process", + "support": { + "issues": "https://github.com/amphp/process/issues", + "source": "https://github.com/amphp/process/tree/v2.0.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-02-13T20:38:21+00:00" + }, + { + "name": "amphp/serialization", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/serialization.git", + "reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/serialization/zipball/693e77b2fb0b266c3c7d622317f881de44ae94a1", + "reference": "693e77b2fb0b266c3c7d622317f881de44ae94a1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "phpunit/phpunit": "^9 || ^8 || ^7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Serialization\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Serialization tools for IPC and data storage in PHP.", + "homepage": "https://github.com/amphp/serialization", + "keywords": [ + "async", + "asynchronous", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/amphp/serialization/issues", + "source": "https://github.com/amphp/serialization/tree/master" + }, + "time": "2020-03-25T21:39:07+00:00" + }, + { + "name": "amphp/socket", + "version": "v2.2.4", + "source": { + "type": "git", + "url": "https://github.com/amphp/socket.git", + "reference": "4223324c627cc26d44800630411e64856d3344bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/socket/zipball/4223324c627cc26d44800630411e64856d3344bc", + "reference": "4223324c627cc26d44800630411e64856d3344bc", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/dns": "^2", + "ext-openssl": "*", + "kelunik/certificate": "^1.1", + "league/uri": "^6.5 | ^7", + "league/uri-interfaces": "^2.3 | ^7", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "amphp/process": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/Internal/functions.php", + "src/SocketAddress/functions.php" + ], + "psr-4": { + "Amp\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Non-blocking socket connection / server implementations based on Amp and Revolt.", + "homepage": "https://github.com/amphp/socket", + "keywords": [ + "amp", + "async", + "encryption", + "non-blocking", + "sockets", + "tcp", + "tls" + ], + "support": { + "issues": "https://github.com/amphp/socket/issues", + "source": "https://github.com/amphp/socket/tree/v2.2.4" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-02-28T15:56:06+00:00" + }, + { + "name": "amphp/sync", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/sync.git", + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/sync/zipball/375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "reference": "375ef5b54a0d12c38e12728dde05a55e30f2fbec", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Sync\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Non-blocking synchronization primitives for PHP based on Amp and Revolt.", + "homepage": "https://github.com/amphp/sync", + "keywords": [ + "async", + "asynchronous", + "mutex", + "semaphore", + "synchronization" + ], + "support": { + "issues": "https://github.com/amphp/sync/issues", + "source": "https://github.com/amphp/sync/tree/v2.2.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-12T01:00:01+00:00" + }, + { + "name": "amphp/windows-registry", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/windows-registry.git", + "reference": "0d569e8f256cca974e3842b6e78b4e434bf98306" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/windows-registry/zipball/0d569e8f256cca974e3842b6e78b4e434bf98306", + "reference": "0d569e8f256cca974e3842b6e78b4e434bf98306", + "shasum": "" + }, + "require": { + "amphp/byte-stream": "^2", + "amphp/process": "^2", + "php": ">=8.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "psalm/phar": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Amp\\WindowsRegistry\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Windows Registry Reader.", + "support": { + "issues": "https://github.com/amphp/windows-registry/issues", + "source": "https://github.com/amphp/windows-registry/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-01-30T23:01:51+00:00" + }, { "name": "brick/math", "version": "0.11.0", @@ -130,6 +988,50 @@ ], "time": "2023-12-11T17:09:12+00:00" }, + { + "name": "daverandom/libdns", + "version": "v2.0.3", + "source": { + "type": "git", + "url": "https://github.com/DaveRandom/LibDNS.git", + "reference": "42c2d700d1178c9f9e78664793463f7f1aea248c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/42c2d700d1178c9f9e78664793463f7f1aea248c", + "reference": "42c2d700d1178c9f9e78664793463f7f1aea248c", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=7.0" + }, + "suggest": { + "ext-intl": "Required for IDN support" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "LibDNS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DNS protocol implementation written in pure PHP", + "keywords": [ + "dns" + ], + "support": { + "issues": "https://github.com/DaveRandom/LibDNS/issues", + "source": "https://github.com/DaveRandom/LibDNS/tree/v2.0.3" + }, + "time": "2022-09-20T18:15:38+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.2", @@ -205,6 +1107,53 @@ }, "time": "2022-10-27T11:44:00+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.10", @@ -1045,6 +1994,64 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "kelunik/certificate", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/kelunik/certificate.git", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kelunik/certificate/zipball/7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=7.0" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^6 | 7 | ^8 | ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kelunik\\Certificate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Access certificate details and transform between different formats.", + "keywords": [ + "DER", + "certificate", + "certificates", + "openssl", + "pem", + "x509" + ], + "support": { + "issues": "https://github.com/kelunik/certificate/issues", + "source": "https://github.com/kelunik/certificate/tree/v1.1.3" + }, + "time": "2023-02-03T21:26:53+00:00" + }, { "name": "laravel/framework", "version": "v10.48.3", @@ -1760,7 +2767,181 @@ "type": "tidelift" } ], - "time": "2024-01-28T23:22:08+00:00" + "time": "2024-01-28T23:22:08+00:00" + }, + { + "name": "league/uri", + "version": "7.4.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bf414ba956d902f5d98bf9385fcf63954f09dce5", + "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.3", + "php": "^8.1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.4.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2023-12-01T06:24:25+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "7.4.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/bd8c487ec236930f7bbc42b8d374fa882fbba0f3", + "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2023-11-24T15:40:42+00:00" }, { "name": "monolog/monolog", @@ -2204,6 +3385,117 @@ ], "time": "2023-02-08T01:06:31+00:00" }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "153ae662783729388a584b4361f2545e4d841e3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" + }, + "time": "2024-02-23T11:10:43+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.2", @@ -2279,6 +3571,53 @@ ], "time": "2023-11-12T21:59:55+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.26.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" + }, + "time": "2024-02-23T16:05:55+00:00" + }, { "name": "psr/clock", "version": "1.0.0", @@ -2916,6 +4255,78 @@ ], "time": "2023-11-08T05:53:05+00:00" }, + { + "name": "revolt/event-loop", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/revoltphp/event-loop.git", + "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/25de49af7223ba039f64da4ae9a28ec2d10d0254", + "reference": "25de49af7223ba039f64da4ae9a28ec2d10d0254", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.15" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Revolt\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Rock-solid event loop for concurrent PHP applications.", + "keywords": [ + "async", + "asynchronous", + "concurrency", + "event", + "event-loop", + "non-blocking", + "scheduler" + ], + "support": { + "issues": "https://github.com/revoltphp/event-loop/issues", + "source": "https://github.com/revoltphp/event-loop/tree/v1.0.6" + }, + "time": "2023-11-30T05:34:44+00:00" + }, { "name": "saloonphp/saloon", "version": "v3.7.0", @@ -2993,7 +4404,91 @@ "type": "github" } ], - "time": "2024-02-27T19:57:41+00:00" + "time": "2024-02-27T19:57:41+00:00" + }, + { + "name": "spatie/laravel-data", + "version": "4.4.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-data.git", + "reference": "65865fc61205aa3c55a9a89d16225c9da3f6b9da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-data/zipball/65865fc61205aa3c55a9a89d16225c9da3f6b9da", + "reference": "65865fc61205aa3c55a9a89d16225c9da3f6b9da", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^10.0|^11.0", + "php": "^8.1", + "phpdocumentor/type-resolver": "^1.5", + "spatie/laravel-package-tools": "^1.9.0", + "spatie/php-structure-discoverer": "^2.0" + }, + "require-dev": { + "fakerphp/faker": "^1.14", + "friendsofphp/php-cs-fixer": "^3.0", + "inertiajs/inertia-laravel": "dev-master#4508fd1", + "livewire/livewire": "^3.0", + "mockery/mockery": "^1.6", + "nesbot/carbon": "^2.63", + "nunomaduro/larastan": "^2.0", + "orchestra/testbench": "^8.0|^9.0", + "pestphp/pest": "^2.31", + "pestphp/pest-plugin-laravel": "^2.0", + "pestphp/pest-plugin-livewire": "^2.1", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpunit/phpunit": "^10.0", + "spatie/invade": "^1.0", + "spatie/laravel-typescript-transformer": "^2.3", + "spatie/pest-plugin-snapshots": "^2.1", + "spatie/test-time": "^1.2" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\LaravelData\\LaravelDataServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\LaravelData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ruben Van Assche", + "email": "ruben@spatie.be", + "role": "Developer" + } + ], + "description": "Create unified resources and data transfer objects", + "homepage": "https://github.com/spatie/laravel-data", + "keywords": [ + "laravel", + "laravel-data", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-data/issues", + "source": "https://github.com/spatie/laravel-data/tree/4.4.0" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2024-03-13T11:09:02+00:00" }, { "name": "spatie/laravel-package-tools", @@ -3055,6 +4550,86 @@ ], "time": "2024-03-07T07:35:57+00:00" }, + { + "name": "spatie/php-structure-discoverer", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/php-structure-discoverer.git", + "reference": "24f5221641560ec0f7dce23dd814e7d555b0098b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/php-structure-discoverer/zipball/24f5221641560ec0f7dce23dd814e7d555b0098b", + "reference": "24f5221641560ec0f7dce23dd814e7d555b0098b", + "shasum": "" + }, + "require": { + "amphp/amp": "^v3.0", + "amphp/parallel": "^2.2", + "illuminate/collections": "^10.0|^11.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.4.3", + "symfony/finder": "^6.0|^7.0" + }, + "require-dev": { + "illuminate/console": "^10.0|^11.0", + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.0|^8.0", + "nunomaduro/larastan": "^2.0.1", + "orchestra/testbench": "^7.0|^8.0|^9.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5|^10.0", + "spatie/laravel-ray": "^1.26" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\StructureDiscoverer\\StructureDiscovererServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\StructureDiscoverer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ruben Van Assche", + "email": "ruben@spatie.be", + "role": "Developer" + } + ], + "description": "Automatically discover structures within your PHP application", + "homepage": "https://github.com/spatie/php-structure-discoverer", + "keywords": [ + "discover", + "laravel", + "php", + "php-structure-discoverer" + ], + "support": { + "issues": "https://github.com/spatie/php-structure-discoverer/issues", + "source": "https://github.com/spatie/php-structure-discoverer/tree/2.1.1" + }, + "funding": [ + { + "url": "https://github.com/LaravelAutoDiscoverer", + "type": "github" + } + ], + "time": "2024-03-13T16:08:30+00:00" + }, { "name": "symfony/console", "version": "v6.4.4", @@ -5731,53 +7306,6 @@ ], "time": "2023-08-31T09:50:34+00:00" }, - { - "name": "doctrine/deprecations", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.3" - }, - "time": "2024-01-30T19:34:25+00:00" - }, { "name": "fakerphp/faker", "version": "v1.23.1", @@ -7418,59 +8946,6 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, { "name": "phpdocumentor/reflection-docblock", "version": "5.3.0", @@ -7528,64 +9003,6 @@ }, "time": "2021-10-19T17:43:47+00:00" }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.8.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "153ae662783729388a584b4361f2545e4d841e3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", - "reference": "153ae662783729388a584b4361f2545e4d841e3c", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", - "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" - }, - "require-dev": { - "ext-tokenizer": "*", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" - }, - "time": "2024-02-23T11:10:43+00:00" - }, { "name": "phpmyadmin/sql-parser", "version": "5.9.0", @@ -7718,53 +9135,6 @@ }, "time": "2023-05-24T08:59:17+00:00" }, - { - "name": "phpstan/phpdoc-parser", - "version": "1.26.0", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "symfony/process": "^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "support": { - "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" - }, - "time": "2024-02-23T16:05:55+00:00" - }, { "name": "phpstan/phpstan", "version": "1.10.62", diff --git a/src/DTOs/PesapalAddressData.php b/src/DTOs/PesapalAddressData.php new file mode 100644 index 0000000..33877e5 --- /dev/null +++ b/src/DTOs/PesapalAddressData.php @@ -0,0 +1,46 @@ + ['string', 'required_without:emailAddress'], + 'emailAddress' => ['email', 'required_without:phoneNumber'], + 'countryCode' => [Rule::enum(type: ISOCountryCode::class) ], + 'amount' => ['string'], + 'firstName' => ['string'], + 'middleName' => ['string'], + 'lastName' => ['string'], + 'line1' => ['string'], + 'line2' => ['string'], + 'city' => ['string'], + 'state' => ['string'], + 'postalCode' => ['string'], + 'zipCode' => ['string'], + ]; + } +} diff --git a/src/DTOs/PesapalOrderData.php b/src/DTOs/PesapalOrderData.php new file mode 100644 index 0000000..0890aa1 --- /dev/null +++ b/src/DTOs/PesapalOrderData.php @@ -0,0 +1,40 @@ + ['required', 'max:50'], + 'currency' => ['required', Rule::enum(type: ISOCurrencyCode::class) ], + 'amount' => ['required', 'decimal:0,2' ], + 'description' => ['required', 'max:100' ], + 'callbackUrl' => ['required', 'string' ], + 'notificationId' => ['required', 'string', "exists:pesapal_ipns,ipn_id" ], + 'branch' => ['string'], + 'cancellationUrl' => ['string'], + 'redirectMode' => [ Rule::enum(type: RedirectMode::class) ], + ]; + } +} diff --git a/src/Enums/ISOCountryCode.php b/src/Enums/ISOCountryCode.php new file mode 100644 index 0000000..31bfc9a --- /dev/null +++ b/src/Enums/ISOCountryCode.php @@ -0,0 +1,256 @@ +send($request); + + if ($response->ok()) { + return $response->array(); + } + + return null; + } } diff --git a/src/Requests/CreatePesapalOrder.php b/src/Requests/CreatePesapalOrder.php new file mode 100644 index 0000000..d06afdc --- /dev/null +++ b/src/Requests/CreatePesapalOrder.php @@ -0,0 +1,57 @@ + $this->orderData->id, + 'currency' => $this->orderData->currency->name, + 'amount' => $this->orderData->amount, + 'description' => $this->orderData->description, + 'callback_url' => $this->orderData->callbackUrl, + 'notification_id' => $this->orderData->notificationId, + 'branch' => $this->orderData->branch, + 'cancellation_url' => $this->orderData->cancellationUrl, + 'redirect_mode' => $this->orderData->redirectMode->name, + 'billing_address' => [ + 'phone_number' => $this->billingAddress->phoneNumber, + 'email_address' => $this->billingAddress->emailAddress, + 'country_code' => $this->billingAddress->countryCode?->name, + 'first_name' => $this->billingAddress->firstName, + 'middle_name' => $this->billingAddress->middleName, + 'last_name' => $this->billingAddress->lastName, + 'line_1' => $this->billingAddress->line1, + 'line_2' => $this->billingAddress->line2, + 'city' => $this->billingAddress->city, + 'state' => $this->billingAddress->state, + 'postal_code' => $this->billingAddress->postalCode, + 'zip_code' => $this->billingAddress->zipCode, + ] + ]; + } +} diff --git a/tests/Fixtures/CreatePesapalIpn.json b/tests/Fixtures/CreatePesapalIpn.json index 977e013..b50e928 100644 --- a/tests/Fixtures/CreatePesapalIpn.json +++ b/tests/Fixtures/CreatePesapalIpn.json @@ -1,9 +1,9 @@ { "statusCode": 200, "headers": { - "Date": "Mon, 18 Mar 2024 07:23:21 GMT", + "Date": "Mon, 18 Mar 2024 12:16:50 GMT", "Content-Type": "application\/json; charset=utf-8", - "Content-Length": "349", + "Content-Length": "341", "Connection": "keep-alive", "Cache-Control": "no-cache", "Pragma": "no-cache", @@ -11,9 +11,9 @@ "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "CF-Cache-Status": "DYNAMIC", - "Set-Cookie": "__cf_bm=TGl7fKsZWrlcSpSdAkNNFYfdkns8Jlrb6D.Jbfryb4Q-1710746601-1.0.1.1-CJX4cWrhy_pPn_jbXUylfd2x5YnjeCK6_yvtfUcsfUgVqEhnxXeu0IKPD_JkfBjtiYM2.OaQj9dJh1omCTNjyA; path=\/; expires=Mon, 18-Mar-24 07:53:21 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", + "Set-Cookie": "__cf_bm=nWDIfXO3PiBhHjEzo4ZsRZcLhiI3zDvW_n6TfrKgmiI-1710764210-1.0.1.1-i1Cy6yenEWMWOpRe.cQpj7p5bAAr7lr7bRAlOVhtAd4JA_Ib4KAxGap.V0hQ_MJO_ZFDd6l6FNx0dnJ1O8ExHg; path=\/; expires=Mon, 18-Mar-24 12:46:50 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", "Server": "cloudflare", - "CF-RAY": "86637a13692ab199-NBO" + "CF-RAY": "866527f47c45b195-NBO" }, - "data": "{\"id\":4254,\"url\":\"http:\/\/kihn.biz\/repellat-voluptatem-officiis-reiciendis-facere-blanditiis-quia-accusantium.html\",\"created_date\":\"2024-03-18T07:23:21.6391704Z\",\"ipn_id\":\"0fb0514f-da8c-43e4-b841-dd759364c16b\",\"notification_type\":0,\"ipn_notification_type_description\":\"GET\",\"ipn_status\":1,\"ipn_status_decription\":\"Active\",\"error\":null,\"status\":\"200\"}" + "data": "{\"id\":4261,\"url\":\"https:\/\/ondricka.net\/quis-rerum-possimus-laudantium-laborum-beatae-rerum-quibusdam.html\",\"created_date\":\"2024-03-18T12:16:50.1180432Z\",\"ipn_id\":\"3a04942a-7094-4108-b782-dd759ab29da3\",\"notification_type\":0,\"ipn_notification_type_description\":\"GET\",\"ipn_status\":1,\"ipn_status_decription\":\"Active\",\"error\":null,\"status\":\"200\"}" } \ No newline at end of file diff --git a/tests/Fixtures/CreatePesapalOrder.json b/tests/Fixtures/CreatePesapalOrder.json new file mode 100644 index 0000000..e35a5b0 --- /dev/null +++ b/tests/Fixtures/CreatePesapalOrder.json @@ -0,0 +1,19 @@ +{ + "statusCode": 200, + "headers": { + "Date": "Mon, 18 Mar 2024 12:16:50 GMT", + "Content-Type": "application\/json; charset=utf-8", + "Content-Length": "279", + "Connection": "keep-alive", + "Cache-Control": "no-cache", + "Pragma": "no-cache", + "Expires": "-1", + "X-AspNet-Version": "4.0.30319", + "X-Powered-By": "ASP.NET", + "CF-Cache-Status": "DYNAMIC", + "Set-Cookie": "__cf_bm=FP630LgFf6g4V8G91p33c2ad4YIkImWHByFRDJVEf4o-1710764210-1.0.1.1-ZZgDN_LMJqWoQf_tVPdJGUpDcH.xgVGW4u8fR13sMQZoXetE7FeapyEayJ3xZzLbgYUTjt0TM3JKmzdEtnOdWA; path=\/; expires=Mon, 18-Mar-24 12:46:50 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", + "Server": "cloudflare", + "CF-RAY": "866527fb4ccb1b5a-NBO" + }, + "data": "{\"order_tracking_id\":\"75f8a83a-807f-473b-8058-dd75644c56c2\",\"merchant_reference\":\"cde009d7-d663-320e-9dac-4022c86bc23f\",\"redirect_url\":\"https:\/\/cybqa.pesapal.com\/pesapaliframe\/PesapalIframe3\/Index?OrderTrackingId=75f8a83a-807f-473b-8058-dd75644c56c2\",\"error\":null,\"status\":\"200\"}" +} \ No newline at end of file diff --git a/tests/Fixtures/CreatePesapalToken.json b/tests/Fixtures/CreatePesapalToken.json index 0e6b94e..58f19a0 100644 --- a/tests/Fixtures/CreatePesapalToken.json +++ b/tests/Fixtures/CreatePesapalToken.json @@ -1,7 +1,7 @@ { "statusCode": 200, "headers": { - "Date": "Mon, 18 Mar 2024 07:23:21 GMT", + "Date": "Mon, 18 Mar 2024 12:16:49 GMT", "Content-Type": "application\/json; charset=utf-8", "Content-Length": "564", "Connection": "keep-alive", @@ -11,9 +11,9 @@ "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "CF-Cache-Status": "DYNAMIC", - "Set-Cookie": "__cf_bm=JjT4WUkvuEe_I.db7.GYNJ4Zk9Xxu9SUQ9rihKy0l4M-1710746601-1.0.1.1-.E9pYm_AbCJa3dAetg0CYha5v9kzpGSqYICO.Nf612g5PNab0YEhEzLHNvpLghpbhnA9vaSvVPjHB7IfDUXDGw; path=\/; expires=Mon, 18-Mar-24 07:53:21 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", + "Set-Cookie": "__cf_bm=c_98zr6JY_LyIP0W3hTVIuerCav3WwXv2Jy.iTJzJpw-1710764209-1.0.1.1-2m6.YmdFC7q8.ttg40LamfAhw5USgNRpEwrsgK6J1HsbxMTac0AqAST7PEJf3XevOZVolJPDolKq85X.EZqsXw; path=\/; expires=Mon, 18-Mar-24 12:46:49 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", "Server": "cloudflare", - "CF-RAY": "86637a103aa3b196-NBO" + "CF-RAY": "866527f15b48b199-NBO" }, - "data": "{\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3VzZXJkYXRhIjoiZWQ2MTkwMGYtZGNiMy00NjM2LWIxNGUtY2U1MGQwYzk2M2I1IiwidWlkIjoicWtpbzFCR0dZQVhUdTJKT2ZtN1hTWE5ydW9ac3JxRVciLCJuYmYiOjE3MTA3NDY2MDEsImV4cCI6MTcxMDc1MDIwMSwiaWF0IjoxNzEwNzQ2NjAxLCJpc3MiOiJodHRwOi8vY3licWEucGVzYXBhbC5jb20vIiwiYXVkIjoiaHR0cDovL2N5YnFhLnBlc2FwYWwuY29tLyJ9.Ygrl0JshPpelP_sIK_fRy41ctNKNWtvV0ZuCsPMxvqI\",\"expiryDate\":\"2024-03-18T08:23:21.1688946Z\",\"error\":null,\"status\":\"200\",\"message\":\"Request processed successfully\"}" + "data": "{\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3VzZXJkYXRhIjoiZWQ2MTkwMGYtZGNiMy00NjM2LWIxNGUtY2U1MGQwYzk2M2I1IiwidWlkIjoicWtpbzFCR0dZQVhUdTJKT2ZtN1hTWE5ydW9ac3JxRVciLCJuYmYiOjE3MTA3NjQyMDksImV4cCI6MTcxMDc2NzgwOSwiaWF0IjoxNzEwNzY0MjA5LCJpc3MiOiJodHRwOi8vY3licWEucGVzYXBhbC5jb20vIiwiYXVkIjoiaHR0cDovL2N5YnFhLnBlc2FwYWwuY29tLyJ9.Rj_LNjIAXdOenwjIYsznUSmMEMpdFwflfsjfZVfbSWA\",\"expiryDate\":\"2024-03-18T13:16:49.0140624Z\",\"error\":null,\"status\":\"200\",\"message\":\"Request processed successfully\"}" } \ No newline at end of file diff --git a/tests/Fixtures/GetPesapalIpns.json b/tests/Fixtures/GetPesapalIpns.json index 761c3eb..9a46e99 100644 --- a/tests/Fixtures/GetPesapalIpns.json +++ b/tests/Fixtures/GetPesapalIpns.json @@ -1,7 +1,7 @@ { "statusCode": 200, "headers": { - "Date": "Mon, 18 Mar 2024 07:23:22 GMT", + "Date": "Mon, 18 Mar 2024 12:17:10 GMT", "Content-Type": "application\/json; charset=utf-8", "Content-Length": "2", "Connection": "keep-alive", @@ -11,9 +11,9 @@ "X-AspNet-Version": "4.0.30319", "X-Powered-By": "ASP.NET", "CF-Cache-Status": "DYNAMIC", - "Set-Cookie": "__cf_bm=ZQbkCCHgyCncNSiUyxpscONmuptjuJ3DVe2Dd6wBPXs-1710746602-1.0.1.1-u2nKN5GlFMJQg6dJxSr4WDA9K0gF7_Th28T3n7IIln..gltmiBkiHdg8tAwitfc5oMG74SFYfQFEpEg9sDcO5w; path=\/; expires=Mon, 18-Mar-24 07:53:22 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", + "Set-Cookie": "__cf_bm=_G4m6Xo_zo2jrnfJ9g80HE6eJNbAkCj9FlbCDRhqlvw-1710764230-1.0.1.1-673MLR4Nj18tdltrUhS1nY.0f7eBVaMA8jaH5ge07qVVGepAUsDGQcPP.0sAhXigVOwSqBeMPTPjW4pcFNJOWw; path=\/; expires=Mon, 18-Mar-24 12:47:10 GMT; domain=.pesapal.com; HttpOnly; Secure; SameSite=None", "Server": "cloudflare", - "CF-RAY": "86637a16587e1b5f-NBO" + "CF-RAY": "866528786c66b19c-NBO" }, "data": "[]" } \ No newline at end of file diff --git a/tests/PesapalTest.php b/tests/PesapalTest.php index 44fad19..2b79484 100644 --- a/tests/PesapalTest.php +++ b/tests/PesapalTest.php @@ -1,6 +1,10 @@ toBeEmpty(); }); + +it(description: 'can create an order', closure: function () { + Pesapal::createToken(); + + Pesapal::createIpn( + url: fake()->url, + ipnType: IpnType::GET, + ); + + $orderData = new PesapalOrderData( + id: fake()->uuid(), + currency: ISOCurrencyCode::KES, + amount: fake()->randomFloat(nbMaxDecimals: 2, min: 50, max: 500), + description: 'Test order', + callbackUrl: fake()->url(), + notificationId: PesapalIpn::latest()->first()->ipn_id, + cancellationUrl: fake()->url(), + redirectMode: RedirectMode::PARENT_WINDOW, + ); + + $billingAddress = new PesapalAddressData(phoneNumber: '0700325008'); + + $order = Pesapal::createOrder( + orderData: $orderData, + billingAddress: $billingAddress, + ); + + expect(value: $order['order_tracking_id'])->not->toBeEmpty() + ->and(value: $order['merchant_reference'])->not->toBeEmpty() + ->and(value: $order['redirect_url'])->not->toBeEmpty() + ->and(value: $order['error'])->toBeNull() + ->and(value: $order['status'])->toBe(expected: '200'); +}); diff --git a/tests/Pest.php b/tests/Pest.php index d1520e3..8ee395c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,6 +1,7 @@ MockResponse::fixture(name: 'CreatePesapalToken'), CreatePesapalIpn::class => MockResponse::fixture(name: 'CreatePesapalIpn'), GetPesapalIpns::class => MockResponse::fixture(name: 'GetPesapalIpns'), + CreatePesapalOrder::class => MockResponse::fixture(name: 'CreatePesapalOrder'), ]); diff --git a/tests/Unit/DTOs/PesapalOrderDataTest.php b/tests/Unit/DTOs/PesapalOrderDataTest.php new file mode 100644 index 0000000..92570ba --- /dev/null +++ b/tests/Unit/DTOs/PesapalOrderDataTest.php @@ -0,0 +1,23 @@ +throws(ValidationException::class, 'The id field is required.'); + +it('requires currency', function () { + PesapalOrderData::validate([ + 'id' => fake()->uuid() + ]); +})->throws(ValidationException::class, 'The currency field is required.'); + +it('requires a valid currency', function () { + PesapalOrderData::validate([ + 'id' => fake()->uuid(), + 'currency' => 'UNKNOWN' + ]); +})->throws(ValidationException::class, 'The selected currency is invalid.'); + +todo('complete all validation tests');