UDS integration for Laravel. This package is the bridge between UDS and Laravel.
You can install the package via composer:
composer require altynbek07/laravel-uds
You should set these environment variables in your .env
file:
UDS_ID=YourCompanyId
UDS_KEY=YourApiKey
You can publish the config file with:
php artisan vendor:publish --provider="Altynbek07\Uds\UdsServiceProvider" --tag="config"
This is the contents of the published config file:
<?php
return [
/**
* Your company ID from UDS
*/
'id' => env('UDS_ID'),
/**
* Your API Key from UDS
*/
'key' => env('UDS_KEY'),
/**
* This is the API URI path where Uds will be accessible from. Feel free
* to change this path to anything you like.
*/
'path' => env('UDS_PATH', 'api/uds'),
/**
* These middleware will be assigned to every Uds route, giving you
* the chance to add your own middleware to this list or change any of
* the existing middleware. Or, you can simply stick with this list.
*/
'middleware' => [
'api',
// 'auth:api'
],
];
You can use the methods from \Altynbek07\Uds\Facades\Uds
anywhere you want, or you can send a request to the API routes from anywhere you want (for example, from the front via axios).
Docs: https://docs.uds.app/#tag/Settings
<?php
namespace Altynbek07\Uds\Facades\Uds;
$settings = Uds::settings();
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations/post
<?php
namespace Altynbek07\Uds\Facades\Uds;
$data = [
'code' => '3485bf3c-5f9b-42a7-9f25-f102fe464256',
'receipt' => [
'total' => 900,
'cash' => 600,
'points' => 300
]
];
$transaction = Uds::createTransaction($data);
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations~1{id}~1refund/post
<?php
namespace Altynbek07\Uds\Facades\Uds;
$id = 113327216;
$transaction = Uds::refundTransaction($id);
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations~1calc/post
<?php
namespace Altynbek07\Uds\Facades\Uds;
$data = [
'code' => '123456',
'receipt' => [
'total' => 900,
'points' => 0
]
];
$transaction = Uds::getTransactionInformation($data);
Docs: https://docs.uds.app/#tag/Customers/paths/~1customers~1find/get
<?php
namespace Altynbek07\Uds\Facades\Uds;
$data = [
'code' => '123456',
'exchangeCode' => true
'total' => 900
];
$customer = Uds::customersFind($data);
Docs: https://docs.uds.app/#tag/Customers/paths/~1customers~1{id}/get
<?php
namespace Altynbek07\Uds\Facades\Uds;
$id = 9099536206450;
$customer = Uds::customers($id);
Docs: https://docs.uds.app/#tag/Settings
# GET
/api/uds/settings
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations/post
# POST
/api/uds/operations
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations~1{id}~1refund/post
# POST
/api/uds/operations/{id}/refund
Docs: https://docs.uds.app/#tag/Operations/paths/~1operations~1calc/post
# POST
/api/uds/operations/calc
Docs: https://docs.uds.app/#tag/Customers/paths/~1customers~1find/get
# GET
/api/uds/customers/find?code=123456&exchangeCode=true
Docs: https://docs.uds.app/#tag/Customers/paths/~1customers~1{id}/get
# GET
/api/uds/customers/{id}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.