failsafe for incorrect proxy calling, fix for customersCorporateCreate
This commit is contained in:
parent
4060df418a
commit
d01a5ae0aa
2 changed files with 15 additions and 1 deletions
|
@ -471,6 +471,20 @@ class RCrmActions
|
|||
try {
|
||||
$result = call_user_func_array(array($api, $methodApi), $params);
|
||||
|
||||
if (!$result) {
|
||||
$err = new RuntimeException(
|
||||
$methodApi . ": Got null instead of valid result!"
|
||||
);
|
||||
Logger::getInstance()->write(sprintf(
|
||||
'%s%s%s',
|
||||
$err->getMessage(),
|
||||
PHP_EOL,
|
||||
$err->getTraceAsString()
|
||||
), 'apiErrors');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($result->getStatusCode() !== 200 && $result->getStatusCode() !== 201) {
|
||||
if ($methodApi == 'ordersGet'
|
||||
|| $methodApi == 'customersGet'
|
||||
|
|
|
@ -102,7 +102,7 @@ class RetailCrmCorporateClient
|
|||
Logger::getInstance()->write($customerCorporate, 'clientCorporate');
|
||||
|
||||
if ($send) {
|
||||
$result = RCrmActions::apiMethod($api, 'customersСorporateСreate', __METHOD__, $customerCorporate, $site);
|
||||
$result = RCrmActions::apiMethod($api, 'customersCorporateCreate', __METHOD__, $customerCorporate, $site);
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue