Skip to content

Instantly share code, notes, and snippets.

@XOlegator
Created July 16, 2017 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XOlegator/5dfb60d46a4d487597d313f56cbd2697 to your computer and use it in GitHub Desktop.
Save XOlegator/5dfb60d46a4d487597d313f56cbd2697 to your computer and use it in GitHub Desktop.
<?php
// Подключим зависимые библиотеки (API RetailCRM)
require_once __DIR__ . '/vendor/autoload.php';
$site = 'https://site';
$apiKey = 'key';
$siteCode = 'TestCompany';
$arBy = ['id', 'externalId'];
$arTestPaymentData = [
'externalId' => '38',
'amount' => 19800.00,
'status' => 'paid',
'id' => '95'
];
$clientRetailCRM = new \RetailCrm\ApiClient(
$site,
$apiKey,
\RetailCrm\ApiClient::V5,
$siteCode
);
foreach ($arBy as $by) {
try {
$response = $clientRetailCRM->request->ordersPaymentEdit($arTestPaymentData, $by, $siteCode);
echo '<pre>'; print_r($response); echo '</pre>';
} catch (\RetailCrm\Exception\CurlException $e) {
echo 'RetailCRM_Api ordersPaymentEdit() ' . $e->getMessage();
}
}
@XOlegator
Copy link
Author

Вывод скрипта:

RetailCrm\Response\ApiResponse Object
(
    [statusCode:protected] => 403
    [response:protected] => Array
        (
            [success] => 
            [errorMsg] => Forbidden
        )

)
RetailCrm\Response\ApiResponse Object
(
    [statusCode:protected] => 403
    [response:protected] => Array
        (
            [success] => 
            [errorMsg] => Forbidden
        )

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment