Skip to content

๐Ÿ›๏ธ Unas Webhook Processor ๐Ÿ”„

License

Notifications You must be signed in to change notification settings

igzard/php-unas-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PHP Unas Webhook Processor

๐Ÿ›๏ธ Use this package to process incoming webhooks from Unas.

Tests passed Total Downloads Latest Version


Requires PHP 8.3+

Getting started

Get Hmac Secret from UNAS

1. First step you need to login to your unas webshop admin (https://unas.hu/belepes)
2. Navigate to Settings -> External connections -> API connection (https://shop.unas.hu/admin_config_connect_api.php)
3. Click to "Verify webhook" tab
4. Click to "HMAC key generation"
5. Copy+Paste your Hmac secret code

Installation

composer require igzard/php-unas-webhook

Usage

//Initialize Unas Webhook with your Unas shop HMAC secret and request header UNAS hmac
use Igzard\PhpUnasWebhook\UnasWebhook;

$webhook = new UnasWebhook([
    'hmac' => 'your-unas-shop-hmac-secret',
    'hmac_header' => 'Hmac secret from http header e.g: $_SERVER["HTTP_X_UNAS_HMAC"]'
]);

//Process incoming webhook request
$unasOrder = $webhook->process("{'message':'Unas request json'}");

//Get order data eg. order number
$orderNumber = $unasOrder->getOrderId()->getValue(); //return with unas webshop order number string

//or get customer data
$customer = $unasOrder->getCustomer(); //return with Customer data object

//etc.

//processing Unas Order with your domain logic...

Contributing

We are open to contributions. If you want to fix a bug, implement a new feature or just ask a question, please feel free to open an issue or create a pull request.

๐Ÿš€ Install dependencies with composer:

make composer-install

โœ… Run Code quality check:

make code-quality

๐Ÿ‘ท Run PHPUnit tests:

make phpunit

๐ŸŽจ Run cs-fix:

make cs-fix

๐Ÿ”ฅ Run phpstan:

make phpstan

โ™ป๏ธ Run rector:

make rector

PHP UNAS Webhook processor was created by Gergely Ignรกcz under the MIT license.

About

๐Ÿ›๏ธ Unas Webhook Processor ๐Ÿ”„

Resources

License

Stars

Watchers

Forks

Packages

No packages published