mirror of
https://github.com/retailcrm/opencart-module.git
synced 2025-01-23 03:01:41 +03:00
fix refs
This commit is contained in:
parent
75fbdef114
commit
556edc9e00
@ -91,13 +91,36 @@ class ModelRetailcrmReferences extends Model
|
|||||||
$this->retailcrm = new ApiHelper($settings);
|
$this->retailcrm = new ApiHelper($settings);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->retailcrm->api->deliveryTypesList();
|
$response = $this->retailcrm->api->deliveryTypesList();
|
||||||
|
if ($response->isSuccessful() && $response->getStatusCode() == 200) {
|
||||||
|
return $response->deliveryTypes;
|
||||||
|
} else {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::deliveryTypesList::Errors: [HTTP-status %s] %s",
|
||||||
|
$response->getStatusCode(),
|
||||||
|
$response->getErrorMsg()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($response['errors'])) {
|
||||||
|
foreach ($response['errors'] as $error) {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::deliveryTypesList::Errors: %s", $error
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
} catch (CurlException $e) {
|
} catch (CurlException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::deliveryTypesList::Curl:' . $e->getMessage());
|
$this->log->write('RestApi::deliveryTypesList::Curl:' . $e->getMessage());
|
||||||
} catch (InvalidJsonException $e) {
|
} catch (InvalidJsonException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::deliveryTypesList::JSON:' . $e->getMessage());
|
$this->log->write('RestApi::deliveryTypesList::JSON:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
@ -113,13 +136,36 @@ class ModelRetailcrmReferences extends Model
|
|||||||
$this->retailcrm = new ApiHelper($settings);
|
$this->retailcrm = new ApiHelper($settings);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->retailcrm->api->statusesList();
|
$response = $this->retailcrm->api->statusesList();
|
||||||
|
if ($response->isSuccessful() && $response->getStatusCode() == 200) {
|
||||||
|
return $response->statuses;
|
||||||
|
} else {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::statusesList::Errors: [HTTP-status %s] %s",
|
||||||
|
$response->getStatusCode(),
|
||||||
|
$response->getErrorMsg()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($response['errors'])) {
|
||||||
|
foreach ($response['errors'] as $error) {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::statusesList::Errors: %s", $error
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
} catch (CurlException $e) {
|
} catch (CurlException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::orderStatusesList::Curl:' . $e->getMessage());
|
$this->log->write('RestApi::orderStatusesList::Curl:' . $e->getMessage());
|
||||||
} catch (InvalidJsonException $e) {
|
} catch (InvalidJsonException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::orderStatusesList::JSON:' . $e->getMessage());
|
$this->log->write('RestApi::orderStatusesList::JSON:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
@ -135,13 +181,36 @@ class ModelRetailcrmReferences extends Model
|
|||||||
$this->retailcrm = new ApiHelper($settings);
|
$this->retailcrm = new ApiHelper($settings);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->retailcrm->api->paymentTypesList();
|
$response = $this->retailcrm->api->paymentTypesList();
|
||||||
|
if ($response->isSuccessful() && $response->getStatusCode() == 200) {
|
||||||
|
return $response->paymentTypes;
|
||||||
|
} else {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::paymentTypesList::Errors: [HTTP-status %s] %s",
|
||||||
|
$response->getStatusCode(),
|
||||||
|
$response->getErrorMsg()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($response['errors'])) {
|
||||||
|
foreach ($response['errors'] as $error) {
|
||||||
|
$this->log->write(
|
||||||
|
sprintf(
|
||||||
|
"RestApi::paymentTypesList::Errors: %s", $error
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
} catch (CurlException $e) {
|
} catch (CurlException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::paymentTypesList::Curl:' . $e->getMessage());
|
$this->log->write('RestApi::paymentTypesList::Curl:' . $e->getMessage());
|
||||||
} catch (InvalidJsonException $e) {
|
} catch (InvalidJsonException $e) {
|
||||||
$this->data['retailcrm_error'][] = $e->getMessage();
|
$this->data['retailcrm_error'][] = $e->getMessage();
|
||||||
$this->log->addError('RestApi::paymentTypesList::JSON:' . $e->getMessage());
|
$this->log->write('RestApi::paymentTypesList::JSON:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array();
|
return array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user