PHP code example of jackmartin / ukrpochta
1. Go to this page and download the library: Download jackmartin/ukrpochta library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jackmartin / ukrpochta example snippets
use Ukrpochta\Pochta;
');
$result = $ukrpochta->editAddress(123130, array(
'postcode' => '02099',
'region' => 'Полтавська',
'district' => 'Полтавський',
'city' => 'Полтава',
'street' => 'Шевченка',
'houseNumber' => '25',
'apartmentNumber' => '20',
));
print_r($result);
//{"id":123130,"postcode":"02099","region":"Полтавська","district":"Полтавський",
//"city":"Полтава","street":"Шевченка",
//"houseNumber":"51","apartmentNumber":"20","description":null,"countryside":false,
//"detailedInfo":"Україна, 02099, Полтавська, Полтавський, Полтава, Шевченка, 51, 20","country":"UA"}
use Ukrpochta\Pochta;
');
$result = $ukrpochta->editAddress(123130, array(
'postcode' => '02050',
'region' => 'Полтавська',
'district' => 'Полтавський',
'city' => 'Полтава',
'street' => 'Шевченка',
'houseNumber' => '50',
'apartmentNumber' => '1',
));
print_r($result);
//{"id":123130,"postcode":"02099","region":"Полтавська","district":"Полтавський",
//"city":"Полтава","street":"Шевченка",
//"houseNumber":"51","apartmentNumber":"20","description":null,"countryside":false,
//"detailedInfo":"Україна, 02099, Полтавська, Полтавський, Полтава, Шевченка, 51, 20","country":"UA"}
use Ukrpochta\Pochta;
');
$result = $ukrpochta->getAddress(123130);
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->createClient('TOKEN COUNTERPARTY', array(
'name' => 'ФОП «Діскорд',
'uniqueRegistrationNumber' => '32855961',
'externalId' => '12345678',
'addressId' => 1245,
'phoneNumber' => '0954623442',
'counterpartyUuid' => 'COUNTERPARTY UUID',
'bankCode' => '612456',
'bankAccount' => '12345684'
));
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->editClient('UUID_CLIENT', 'TOKEN_COUNTERPARTY', array(
'lastName' => 'Петрик',
'firstName' => 'Иван',
'middleName' => 'Васильович',
'uniqueRegistrationNumber' => '73232855',
'addressId' => 1,
'phoneNumber' => '0954623442',
'counterpartyUuid' => 'UUID COUNTERPARTY',
'discount' => 24,
'bankCode' => 254,
));
print_r($result);
use Ukrpochta\Pochta;
EY');
$result = $ukrpochta->clientsList('TOKEN_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
EY');
$result = $ukrpochta->getClient('TOKEN_COUNTERPARTY', 'ID_CLIENT');
print_r($result);
use Ukrpochta\Pochta;
EY');
$result = $ukrpochta->getClient('TOKEN_COUNTERPARTY', '', 'externalId_CLIENT', false);
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->createGroup('TOKEN_COUNTERPARTY', array(
'name' => 'group1',
'counterpartyUuid' => 'UUID_COUNTERPARTY',
));
print_r($result);
use Ukrpochta\Pochta;
('API_KEY');
$result = $ukrpochta->editGroup('TOKEN_COUNTERPARTY', 'UUID_GROUP', array(
'name' => 'group2',
'counterpartyUuid' => 'UUID_COUNTERPARTY',
));
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->groupList('TOKEN_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->getGroup('UUID_GROUP', 'UUID_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->createParcel('ba5378df-985e-49c5-9cf3-d222fa60aa68', array(
'sender' => array(
'name' => 'ПРАТ Иван Движок',
'firstName' => '',
'middleName' => '',
'lastName' => '',
'uniqueRegistrationNumber' => '2541',
'counterpartyUuid' => '2304bbe5-015c-44f6-a5bf-3e750d753a17',
'addressId' => 123130,
'phoneNumber' => '0954623442',
'individual' => false,
'bankCode' => '123001',
'bankAccount' => '111000222000999',
),
'recipient' => array(
'name' => 'Иванов Иван Иванович',
'firstName' => 'Иван',
'middleName' => 'Иванович',
'lastName' => 'Иванови',
'uniqueRegistrationNumber' => '52415',
'counterpartyUuid' => '2304bbe5-015c-44f6-a5bf-3e750d753a17',
'addressId' => 123130,
'phoneNumber' => '0954623442',
'individual' => true,
'bankCode' => '123011',
'bankAccount' => '111000222000123',
),
'shipmentGroupUuid' => '54d3cb05-7ff4-4310-ab7c-ea77af42d998',
'deliveryType' => 'W2W',
'weight' => 150,
'length' => 20,
'width' => 0,
'height' => 0,
'postPay' => 15,
'description' => 'test comment comment',
'parcels' => array(
array(
'name' => 'parcel name',
'weight' => 1000,
'length' => 170,
'declaredPrice' => 20,
),
),
));
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->editParcel('ID_PARCEL', 'TOKEN_COUNTERPARTY', array(
'sender' => array(
'name' => 'ПРАТ Иван Движок',
'firstName' => '',
'middleName' => '',
'lastName' => '',
'uniqueRegistrationNumber' => '2541',
'counterpartyUuid' => '2304bbe5-015c-44f6-a5bf-3e750d753a17',
'addressId' => 123130,
'phoneNumber' => '0954623442',
'individual' => false,
'bankCode' => '123001',
'bankAccount' => '111000222000999',
),
'recipient' => array(
'name' => 'Иванов Иван Иванович',
'firstName' => 'Иван',
'middleName' => 'Иванович',
'lastName' => 'Иванови',
'uniqueRegistrationNumber' => '52415',
'counterpartyUuid' => '2304bbe5-015c-44f6-a5bf-3e750d753a17',
'addressId' => 123130,
'phoneNumber' => '0954623442',
'individual' => true,
'bankCode' => '123011',
'bankAccount' => '111000222000123',
),
'shipmentGroupUuid' => '54d3cb05-7ff4-4310-ab7c-ea77af42d998',
'deliveryType' => 'W2W',
'weight' => 1500,
'length' => 20,
'width' => 0,
'height' => 0,
'postPay' => 15,
'description' => 'change comment parcel',
'parcels' => array(
array(
'name' => 'parcel name change',
'weight' => 1000,
'length' => 170,
'declaredPrice' => 20,
),
),
));
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->parcelList('TOKEN_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->getParcel('ID_PARCEL', 'TOKEN_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
');
$result = $ukrpochta->getParcel('ID_SENDER', 'TOKEN_COUNTERPARTY');
print_r($result);
use Ukrpochta\Pochta;
EY');
$result = $ukrpochta->delParcelGroup('ID_PARCEL', 'ID_GROUP');
print_r($result);
use Ukrpochta\Pochta;
');
$ukrpochta->createForm('ID_PARCEL', 'TOKEN_COUNTERPARTY', __DIR__ . '/file.pdf');
use Ukrpochta\Pochta;
');
$ukrpochta->createForm('ID_GROUP', 'TOKEN_COUNTERPARTY', __DIR__ . '/file.pdf', false);
use Ukrpochta\Pochta;
');
$ukrpochta->createForm103('ID_GROUP', 'TOKEN_COUNTERPARTY', __DIR__ . '/file.pdf');