| 1 |
<?php |
| 2 |
|
| 3 |
namespace MailerLite\Includes\Shared\Api; |
| 4 |
|
| 5 |
class PlatformAPI |
| 6 |
{ |
| 7 |
|
| 8 |
private $api; |
| 9 |
private $api_key; |
| 10 |
|
| 11 |
/** |
| 12 |
* MailerLiteAPI constructor |
| 13 |
* |
| 14 |
* @access public |
| 15 |
* @return void |
| 16 |
* @since 1.6.0 |
| 17 |
*/ |
| 18 |
public function __construct($api_key) |
| 19 |
{ |
| 20 |
|
| 21 |
$this->api_key = $api_key; |
| 22 |
|
| 23 |
if ($api_key !== '') { |
| 24 |
|
| 25 |
switch ($this->getApiType()) { |
| 26 |
case ApiType::CLASSIC: |
| 27 |
$this->api = new MailerLiteClassicAPI($api_key); |
| 28 |
break; |
| 29 |
case ApiType::CURRENT: |
| 30 |
$this->api = new MailerLiteAPI($api_key); |
| 31 |
break; |
| 32 |
default: |
| 33 |
$this->api_key = ''; |
| 34 |
break; |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* get API Key Type |
| 41 |
* |
| 42 |
* @access public |
| 43 |
* @return int |
| 44 |
* @since 1.6.0 |
| 45 |
*/ |
| 46 |
public function getApiType() |
| 47 |
{ |
| 48 |
|
| 49 |
if ($this->api_key == '') { |
| 50 |
|
| 51 |
return ApiType::INVALID; |
| 52 |
} |
| 53 |
|
| 54 |
if ($this->isValidClassicKey()) { |
| 55 |
|
| 56 |
return ApiType::CLASSIC; |
| 57 |
} else { |
| 58 |
|
| 59 |
return ApiType::CURRENT; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Validate API Key |
| 65 |
* |
| 66 |
* @access public |
| 67 |
* @return mixed |
| 68 |
* @since 1.6.0 |
| 69 |
*/ |
| 70 |
public function validateKey() |
| 71 |
{ |
| 72 |
|
| 73 |
return $this->api->validateKey(); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Update subscriber |
| 78 |
* |
| 79 |
* @access public |
| 80 |
* @return mixed |
| 81 |
* @since 1.6.0 |
| 82 |
*/ |
| 83 |
public function updateSubscriber($subscriber_email, $subscriber_data) |
| 84 |
{ |
| 85 |
|
| 86 |
return $this->api->updateSubscriber($subscriber_email, $subscriber_data); |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Update subscriber status |
| 91 |
* |
| 92 |
* @access public |
| 93 |
* @return mixed |
| 94 |
* @since 1.7.4 |
| 95 |
*/ |
| 96 |
public function updateSubscriberStatus($email, $status) |
| 97 |
{ |
| 98 |
|
| 99 |
return $this->api->updateSubscriberStatus($email, $status); |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* Search for a subscriber |
| 104 |
* |
| 105 |
* @access public |
| 106 |
* @return mixed |
| 107 |
* @since 1.6.0 |
| 108 |
*/ |
| 109 |
public function searchSubscriber($query) |
| 110 |
{ |
| 111 |
|
| 112 |
return $this->api->searchSubscriber($query); |
| 113 |
} |
| 114 |
|
| 115 |
/** |
| 116 |
* Get groups |
| 117 |
* |
| 118 |
* @access public |
| 119 |
* @return mixed |
| 120 |
* @since 1.6.0 |
| 121 |
*/ |
| 122 |
public function getGroups($params = []) |
| 123 |
{ |
| 124 |
|
| 125 |
return $this->api->getGroups($params); |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Check if more groups need to be loaded |
| 130 |
* |
| 131 |
* @access public |
| 132 |
* @return mixed |
| 133 |
* @since 1.6.0 |
| 134 |
*/ |
| 135 |
public function checkMoreGroups($limit = 100, $offset = 2) |
| 136 |
{ |
| 137 |
|
| 138 |
return $this->api->checkMoreGroups($limit, $offset); |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* Check if more groups need to be loaded |
| 143 |
* |
| 144 |
* @access public |
| 145 |
* @return mixed |
| 146 |
* @since 1.6.0 |
| 147 |
*/ |
| 148 |
public function getMoreGroups($limit = 100, $offset = 1) |
| 149 |
{ |
| 150 |
|
| 151 |
return $this->api->getMoreGroups($limit, $offset); |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Get Double opt-in setting |
| 156 |
* |
| 157 |
* @access public |
| 158 |
* @return mixed |
| 159 |
* @since 1.6.0 |
| 160 |
*/ |
| 161 |
public function getDoubleOptin() |
| 162 |
{ |
| 163 |
|
| 164 |
return $this->api->getDoubleOptin(); |
| 165 |
} |
| 166 |
|
| 167 |
/** |
| 168 |
* Enable/Disable Double opt-in setting |
| 169 |
* |
| 170 |
* @access public |
| 171 |
* @return mixed |
| 172 |
* @since 1.6.0 |
| 173 |
*/ |
| 174 |
public function setDoubleOptin($enable) |
| 175 |
{ |
| 176 |
return $this->api->setDoubleOptin($enable); |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Get Fields |
| 181 |
* |
| 182 |
* @access public |
| 183 |
* @return mixed |
| 184 |
* @since 1.6.0 |
| 185 |
*/ |
| 186 |
public function getFields($params = []) |
| 187 |
{ |
| 188 |
|
| 189 |
return $this->api->getFields($params); |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Create Custom Field |
| 194 |
* |
| 195 |
* @access public |
| 196 |
* @return mixed |
| 197 |
* @since 1.6.0 |
| 198 |
*/ |
| 199 |
public function createField($title, $type) |
| 200 |
{ |
| 201 |
|
| 202 |
return $this->api->createField($title, $type); |
| 203 |
} |
| 204 |
|
| 205 |
/** |
| 206 |
* Update Custom Field |
| 207 |
* |
| 208 |
* @access public |
| 209 |
* @return mixed |
| 210 |
* @since 1.7.11 |
| 211 |
*/ |
| 212 |
public function updateField($id, $name) |
| 213 |
{ |
| 214 |
|
| 215 |
return $this->api->updateField($id, $name); |
| 216 |
} |
| 217 |
|
| 218 |
/** |
| 219 |
* Sync WooCommerce Customer |
| 220 |
* |
| 221 |
* @access public |
| 222 |
* @return mixed |
| 223 |
* @since 1.6.0 |
| 224 |
*/ |
| 225 |
public function syncCustomerWooCommerce($customer_id, $email, $fields, $shopUrl) |
| 226 |
{ |
| 227 |
|
| 228 |
return $this->api->syncCustomerWooCommerce($customer_id, $email, $fields, $shopUrl); |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* Set WooCommerce Consumer Data |
| 233 |
* |
| 234 |
* @access public |
| 235 |
* @return mixed |
| 236 |
* @since 1.6.0 |
| 237 |
*/ |
| 238 |
public function setConsumerData( |
| 239 |
$consumerKey, |
| 240 |
$consumerSecret, |
| 241 |
$store, |
| 242 |
$currency, |
| 243 |
$group_id, |
| 244 |
$resubscribe, |
| 245 |
$ignoreList, |
| 246 |
$create_segments, |
| 247 |
$shop_name, |
| 248 |
$shop_id, |
| 249 |
$popups_enabled |
| 250 |
) { |
| 251 |
|
| 252 |
return $this->api->setConsumerData($consumerKey, $consumerSecret, $store, $currency, $group_id, $resubscribe, |
| 253 |
$ignoreList, $create_segments, $shop_name, $shop_id, $popups_enabled); |
| 254 |
} |
| 255 |
|
| 256 |
/** |
| 257 |
* Send WooCommerce Subscriber Data |
| 258 |
* |
| 259 |
* @access public |
| 260 |
* @return mixed |
| 261 |
* @since 1.6.0 |
| 262 |
*/ |
| 263 |
public function sendSubscriberData($shop_id, $data) |
| 264 |
{ |
| 265 |
|
| 266 |
return $this->api->sendSubscriberData($shop_id, $data); |
| 267 |
} |
| 268 |
|
| 269 |
/** |
| 270 |
* Save WooCommerce Order |
| 271 |
* |
| 272 |
* @access public |
| 273 |
* @return mixed |
| 274 |
* @since 1.6.0 |
| 275 |
*/ |
| 276 |
public function saveOrder($shop, $orderData) |
| 277 |
{ |
| 278 |
|
| 279 |
return $this->api->saveOrder($shop, $orderData); |
| 280 |
} |
| 281 |
|
| 282 |
/** |
| 283 |
* Send WooCommerce Order Processing |
| 284 |
* |
| 285 |
* @access public |
| 286 |
* |
| 287 |
* @param $shop_id |
| 288 |
* @param $data |
| 289 |
* |
| 290 |
* @return mixed |
| 291 |
* @since 1.6.0 |
| 292 |
*/ |
| 293 |
public function sendOrderProcessing($shop_id, $data) |
| 294 |
{ |
| 295 |
|
| 296 |
return $this->api->sendOrderProcessing($shop_id, $data); |
| 297 |
} |
| 298 |
|
| 299 |
/** |
| 300 |
* Send WooCommerce Cart |
| 301 |
* |
| 302 |
* @access public |
| 303 |
* @return mixed |
| 304 |
* @since 1.6.0 |
| 305 |
*/ |
| 306 |
public function sendCart($shop, $cartData) |
| 307 |
{ |
| 308 |
|
| 309 |
return $this->api->sendCart($shop, $cartData); |
| 310 |
} |
| 311 |
|
| 312 |
/** |
| 313 |
* Toggle WooCommerce Shop |
| 314 |
* |
| 315 |
* @access public |
| 316 |
* |
| 317 |
* @param $shop |
| 318 |
* @param $activeState |
| 319 |
* @param $shop_id |
| 320 |
* @param $shop_name |
| 321 |
* |
| 322 |
* @return mixed |
| 323 |
* @since 1.6.0 |
| 324 |
*/ |
| 325 |
public function toggleShop($shop, $activeState, $shop_id, $shop_name) |
| 326 |
{ |
| 327 |
|
| 328 |
return $this->api->toggleShop($shop, $activeState, $shop_id, $shop_name); |
| 329 |
} |
| 330 |
|
| 331 |
/** |
| 332 |
* Get WooCommerce Shop Settings |
| 333 |
* |
| 334 |
* @access public |
| 335 |
* @return mixed |
| 336 |
* @since 1.6.0 |
| 337 |
*/ |
| 338 |
public function getShopSettings($shopUrl) |
| 339 |
{ |
| 340 |
|
| 341 |
return $this->api->getShopSettings($shopUrl); |
| 342 |
} |
| 343 |
|
| 344 |
/** |
| 345 |
* Validate WooCommerce Account |
| 346 |
* |
| 347 |
* @access public |
| 348 |
* @return mixed |
| 349 |
* @since 1.6.0 |
| 350 |
*/ |
| 351 |
public function validateAccount() |
| 352 |
{ |
| 353 |
|
| 354 |
return $this->api->validateAccount(); |
| 355 |
} |
| 356 |
|
| 357 |
/** |
| 358 |
* Get list of shops |
| 359 |
* |
| 360 |
* @access public |
| 361 |
* @return mixed |
| 362 |
* @since 1.6.0 |
| 363 |
*/ |
| 364 |
public function getShops() |
| 365 |
{ |
| 366 |
return $this->api->getShops(); |
| 367 |
} |
| 368 |
|
| 369 |
/** |
| 370 |
* Get a shop |
| 371 |
* |
| 372 |
* @access public |
| 373 |
* @return mixed |
| 374 |
* @since 1.6.0 |
| 375 |
*/ |
| 376 |
public function getShop($shop_id) |
| 377 |
{ |
| 378 |
|
| 379 |
return $this->api->getShop($shop_id); |
| 380 |
} |
| 381 |
|
| 382 |
/** |
| 383 |
* Create shop |
| 384 |
* |
| 385 |
* @access public |
| 386 |
* |
| 387 |
* @param $name |
| 388 |
* @param $url |
| 389 |
* @param $currency |
| 390 |
* @param $group_id |
| 391 |
* @param $enable_popups |
| 392 |
* @param $access_data |
| 393 |
* @param $enable_resubscribe |
| 394 |
* |
| 395 |
* @return mixed |
| 396 |
* @since 1.6.0 |
| 397 |
*/ |
| 398 |
public function createShop($name, $url, $currency, $group_id, $enable_popups, $access_data, $enable_resubscribe) |
| 399 |
{ |
| 400 |
return $this->api->createShop($name, $url, $currency, $group_id, $enable_popups, $access_data, $enable_resubscribe); |
| 401 |
} |
| 402 |
|
| 403 |
/** |
| 404 |
* Delete shop |
| 405 |
* |
| 406 |
* @access public |
| 407 |
* |
| 408 |
* @param $shop |
| 409 |
* |
| 410 |
* @return mixed |
| 411 |
* @since 1.6.0 |
| 412 |
*/ |
| 413 |
public function deleteShop($shop) |
| 414 |
{ |
| 415 |
return $this->api->deleteShop($shop); |
| 416 |
} |
| 417 |
|
| 418 |
/** |
| 419 |
* Fetch order |
| 420 |
* |
| 421 |
* @access public |
| 422 |
* |
| 423 |
* @param $shop_id |
| 424 |
* @param $order_id |
| 425 |
* |
| 426 |
* @return mixed |
| 427 |
* @since 1.6.0 |
| 428 |
*/ |
| 429 |
public function fetchOrder($shop_id, $order_id) |
| 430 |
{ |
| 431 |
|
| 432 |
return $this->api->fetchOrder($shop_id, $order_id); |
| 433 |
} |
| 434 |
|
| 435 |
/** |
| 436 |
* Import orders |
| 437 |
* |
| 438 |
* @access public |
| 439 |
* |
| 440 |
* @param $shop_id |
| 441 |
* @param $orders |
| 442 |
* |
| 443 |
* @return array |
| 444 |
* @since 1.6.0 |
| 445 |
*/ |
| 446 |
public function importOrders($shop_id, $orders) |
| 447 |
{ |
| 448 |
|
| 449 |
return $this->api->importOrders($shop_id, $orders); |
| 450 |
} |
| 451 |
|
| 452 |
/** |
| 453 |
* Import customers |
| 454 |
* |
| 455 |
* @access public |
| 456 |
* |
| 457 |
* @param $shop_id |
| 458 |
* @param $customers |
| 459 |
* |
| 460 |
* @return array |
| 461 |
* @since 1.8.5 |
| 462 |
*/ |
| 463 |
public function importCustomers($shop_id, $customers) |
| 464 |
{ |
| 465 |
|
| 466 |
return $this->api->importCustomers($shop_id, $customers); |
| 467 |
} |
| 468 |
|
| 469 |
/** |
| 470 |
* Sync order |
| 471 |
* |
| 472 |
* @access public |
| 473 |
* |
| 474 |
* @param $shop_id |
| 475 |
* @param $order_id |
| 476 |
* @param $customer |
| 477 |
* @param $cart |
| 478 |
* @param $status |
| 479 |
* @param $total_price |
| 480 |
* @param $created_at |
| 481 |
* |
| 482 |
* @return mixed |
| 483 |
* @since 1.6.0 |
| 484 |
*/ |
| 485 |
public function syncOrder($shop_id, $order_id, $customer, $cart, $status, $total_price, $created_at) |
| 486 |
{ |
| 487 |
|
| 488 |
return $this->api->syncOrder($shop_id, $order_id, $customer, $cart, $status, $total_price, $created_at); |
| 489 |
} |
| 490 |
|
| 491 |
/** |
| 492 |
* Delete order |
| 493 |
* |
| 494 |
* @access public |
| 495 |
* |
| 496 |
* @param $shop_id |
| 497 |
* @param $order_id |
| 498 |
* |
| 499 |
* @return mixed |
| 500 |
* @since 1.6.0 |
| 501 |
*/ |
| 502 |
public function deleteOrder($shop_id, $order_id) |
| 503 |
{ |
| 504 |
|
| 505 |
return $this->api->deleteOrder($shop_id, $order_id); |
| 506 |
} |
| 507 |
|
| 508 |
/** |
| 509 |
* Update order |
| 510 |
* |
| 511 |
* @access public |
| 512 |
* |
| 513 |
* @param $shop_id |
| 514 |
* @param $order_id |
| 515 |
* @param $status |
| 516 |
* @param $total_price |
| 517 |
* |
| 518 |
* @return mixed |
| 519 |
* @since 1.6.0 |
| 520 |
*/ |
| 521 |
public function updateOrder($shop_id, $order_id, $status, $total_price) |
| 522 |
{ |
| 523 |
|
| 524 |
return $this->api->updateOrder($shop_id, $order_id, $status, $total_price); |
| 525 |
} |
| 526 |
|
| 527 |
/** |
| 528 |
* Sync product |
| 529 |
* |
| 530 |
* @access public |
| 531 |
* |
| 532 |
* @param $shop_id |
| 533 |
* @param $product_id |
| 534 |
* @param $name |
| 535 |
* @param $price |
| 536 |
* @param $exclude_automation |
| 537 |
* @param $url |
| 538 |
* @param $image |
| 539 |
* @param $categories |
| 540 |
* |
| 541 |
* @return mixed |
| 542 |
* @since 1.6.0 |
| 543 |
*/ |
| 544 |
public function syncProduct($shop_id, $product_id, $name, $price, $exclude_automation, $url, $image, $categories) |
| 545 |
{ |
| 546 |
|
| 547 |
return $this->api->syncProduct($shop_id, $product_id, $name, $price, $exclude_automation, $url, $image, |
| 548 |
$categories); |
| 549 |
} |
| 550 |
|
| 551 |
/** |
| 552 |
* Replace product categories |
| 553 |
* |
| 554 |
* @access public |
| 555 |
* |
| 556 |
* @param $shop_id |
| 557 |
* @param $product_id |
| 558 |
* @param $categories |
| 559 |
* |
| 560 |
* @return mixed |
| 561 |
* @since 1.6.0 |
| 562 |
*/ |
| 563 |
public function replaceProductCategories($shop_id, $product_id, $categories) |
| 564 |
{ |
| 565 |
|
| 566 |
return $this->api->replaceProductCategories($shop_id, $product_id, $categories); |
| 567 |
} |
| 568 |
|
| 569 |
/** |
| 570 |
* Import products |
| 571 |
* |
| 572 |
* @access public |
| 573 |
* |
| 574 |
* @param $shop_id |
| 575 |
* @param $products |
| 576 |
* |
| 577 |
* @return array |
| 578 |
* @since 1.6.0 |
| 579 |
*/ |
| 580 |
public function importProducts($shop_id, $products) |
| 581 |
{ |
| 582 |
|
| 583 |
return $this->api->importProducts($shop_id, $products); |
| 584 |
} |
| 585 |
|
| 586 |
/** |
| 587 |
* Delete product |
| 588 |
* |
| 589 |
* @access public |
| 590 |
* |
| 591 |
* @param $shop_id |
| 592 |
* @param $product_id |
| 593 |
* |
| 594 |
* @return mixed |
| 595 |
* @since 1.6.0 |
| 596 |
*/ |
| 597 |
public function deleteProduct($shop_id, $product_id) |
| 598 |
{ |
| 599 |
|
| 600 |
return $this->api->deleteProduct($shop_id, $product_id); |
| 601 |
} |
| 602 |
|
| 603 |
/** |
| 604 |
* Create product category |
| 605 |
* |
| 606 |
* @access public |
| 607 |
* |
| 608 |
* @param $shop_id |
| 609 |
* @param $category_id |
| 610 |
* @param $name |
| 611 |
* |
| 612 |
* @return mixed |
| 613 |
* @since 1.6.0 |
| 614 |
*/ |
| 615 |
public function syncCategory($shop_id, $category_id, $name) |
| 616 |
{ |
| 617 |
|
| 618 |
return $this->api->syncCategory($shop_id, $category_id, $name); |
| 619 |
} |
| 620 |
|
| 621 |
/** |
| 622 |
* Import categories |
| 623 |
* |
| 624 |
* @access public |
| 625 |
* |
| 626 |
* @param $shop_id |
| 627 |
* @param $categories |
| 628 |
* |
| 629 |
* @return array |
| 630 |
* @since 1.6.0 |
| 631 |
*/ |
| 632 |
public function importCategories($shop_id, $categories) |
| 633 |
{ |
| 634 |
|
| 635 |
return $this->api->importCategories($shop_id, $categories); |
| 636 |
} |
| 637 |
|
| 638 |
/** |
| 639 |
* Delete product category |
| 640 |
* |
| 641 |
* @access public |
| 642 |
* |
| 643 |
* @param $shop_id |
| 644 |
* @param $category_id |
| 645 |
* |
| 646 |
* @return mixed |
| 647 |
* @since 1.6.0 |
| 648 |
*/ |
| 649 |
public function deleteCategory($shop_id, $category_id) |
| 650 |
{ |
| 651 |
|
| 652 |
return $this->api->deleteCategory($shop_id, $category_id); |
| 653 |
} |
| 654 |
|
| 655 |
/** |
| 656 |
* Sync customer |
| 657 |
* |
| 658 |
* @access public |
| 659 |
* |
| 660 |
* @param $shop_id |
| 661 |
* @param $customer_id |
| 662 |
* @param $email |
| 663 |
* @param $fields |
| 664 |
* |
| 665 |
* @return mixed |
| 666 |
* @since 1.6.0 |
| 667 |
*/ |
| 668 |
public function syncCustomer($shop_id, $customer_id, $email, $fields) |
| 669 |
{ |
| 670 |
|
| 671 |
return $this->api->syncCustomer($shop_id, $customer_id, $email, $fields); |
| 672 |
} |
| 673 |
|
| 674 |
/** |
| 675 |
* Update customer |
| 676 |
* |
| 677 |
* @access public |
| 678 |
* |
| 679 |
* @param $shop_id |
| 680 |
* @param $customer_id |
| 681 |
* @param $email |
| 682 |
* @param $accepts_marketing |
| 683 |
* @param $create_subscriber |
| 684 |
* |
| 685 |
* @return mixed |
| 686 |
* @since 1.6.0 |
| 687 |
*/ |
| 688 |
public function updateCustomer($shop_id, $customer_id, $email, $accepts_marketing, $create_subscriber) |
| 689 |
{ |
| 690 |
|
| 691 |
return $this->api->updateCustomer($shop_id, $customer_id, $email, $accepts_marketing, $create_subscriber); |
| 692 |
} |
| 693 |
|
| 694 |
/** |
| 695 |
* Delete customer |
| 696 |
* |
| 697 |
* @access public |
| 698 |
* |
| 699 |
* @param $shop_id |
| 700 |
* @param $customer_id |
| 701 |
* |
| 702 |
* @return bool |
| 703 |
* @since 1.6.0 |
| 704 |
*/ |
| 705 |
public function deleteCustomer($shop_id, $customer_id) |
| 706 |
{ |
| 707 |
return $this->api->deleteCustomer($shop_id, $customer_id); |
| 708 |
} |
| 709 |
|
| 710 |
/** |
| 711 |
* Fetch order |
| 712 |
* |
| 713 |
* @access public |
| 714 |
* |
| 715 |
* @param $shop_id |
| 716 |
* @param $customer_id |
| 717 |
* |
| 718 |
* @return mixed |
| 719 |
* @since 1.6.0 |
| 720 |
*/ |
| 721 |
public function fetchCustomer($shop_id, $customer_id) |
| 722 |
{ |
| 723 |
|
| 724 |
return $this->api->fetchCustomer($shop_id, $customer_id); |
| 725 |
} |
| 726 |
|
| 727 |
/** |
| 728 |
* Update cart |
| 729 |
* |
| 730 |
* @access public |
| 731 |
* |
| 732 |
* @param $shop_id |
| 733 |
* @param $cart_id |
| 734 |
* @param $checkout_url |
| 735 |
* @param $cart_total |
| 736 |
* @param $order_id |
| 737 |
* |
| 738 |
* @return mixed |
| 739 |
* @since 1.6.0 |
| 740 |
*/ |
| 741 |
public function updateCart($shop_id, $cart_id, $checkout_url, $cart_total, $order_id) |
| 742 |
{ |
| 743 |
|
| 744 |
return $this->api->updateCart($shop_id, $cart_id, $checkout_url, $cart_total, $order_id); |
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
/** |
| 749 |
* Add cart item |
| 750 |
* |
| 751 |
* @access public |
| 752 |
* |
| 753 |
* @param $shop_id |
| 754 |
* @param $cart_id |
| 755 |
* @param $item |
| 756 |
* |
| 757 |
* @return mixed |
| 758 |
* @since 1.6.0 |
| 759 |
*/ |
| 760 |
public function addCartItem($shop_id, $cart_id, $item) |
| 761 |
{ |
| 762 |
|
| 763 |
return $this->api->addCartItem($shop_id, $cart_id, $item); |
| 764 |
} |
| 765 |
|
| 766 |
/** |
| 767 |
* Replace cart items |
| 768 |
* |
| 769 |
* @access public |
| 770 |
* |
| 771 |
* @param $shop_id |
| 772 |
* @param $cart_id |
| 773 |
* @param $items |
| 774 |
* |
| 775 |
* @return mixed |
| 776 |
* @since 1.6.0 |
| 777 |
*/ |
| 778 |
public function replaceCartItems($shop_id, $cart_id, $items) |
| 779 |
{ |
| 780 |
|
| 781 |
return $this->api->replaceCartItems($shop_id, $cart_id, $items); |
| 782 |
} |
| 783 |
|
| 784 |
/** |
| 785 |
* Get cart items |
| 786 |
* |
| 787 |
* @access public |
| 788 |
* |
| 789 |
* @param $shop_id |
| 790 |
* @param $cart_id |
| 791 |
* |
| 792 |
* @return mixed |
| 793 |
* @since 1.6.0 |
| 794 |
*/ |
| 795 |
public function getCartItems($shop_id, $cart_id) |
| 796 |
{ |
| 797 |
|
| 798 |
return $this->api->getCartItems($shop_id, $cart_id); |
| 799 |
} |
| 800 |
|
| 801 |
/** |
| 802 |
* Get Account Details |
| 803 |
* |
| 804 |
* @access public |
| 805 |
* |
| 806 |
* @return mixed |
| 807 |
* @since 1.6.0 |
| 808 |
*/ |
| 809 |
public function getAccountDetails() |
| 810 |
{ |
| 811 |
|
| 812 |
return $this->api->getAccountDetails(); |
| 813 |
} |
| 814 |
|
| 815 |
/** |
| 816 |
* Delete cart items |
| 817 |
* |
| 818 |
* @access public |
| 819 |
* |
| 820 |
* @param $shop_id |
| 821 |
* @param $cart_id |
| 822 |
* @param $item_id |
| 823 |
* |
| 824 |
* @return mixed |
| 825 |
* @since 1.6.0 |
| 826 |
*/ |
| 827 |
public function deleteCartItem($shop_id, $cart_id, $item_id) |
| 828 |
{ |
| 829 |
|
| 830 |
return $this->api->deleteCartItem($shop_id, $cart_id, $item_id); |
| 831 |
} |
| 832 |
|
| 833 |
public function batch($requests) |
| 834 |
{ |
| 835 |
return $this->api->batch($requests); |
| 836 |
} |
| 837 |
|
| 838 |
/** |
| 839 |
* Get raw response body |
| 840 |
* |
| 841 |
* @access public |
| 842 |
* @return string |
| 843 |
* @since 1.6.0 |
| 844 |
*/ |
| 845 |
public function getResponseBody() |
| 846 |
{ |
| 847 |
return $this->api->getResponseBody(); |
| 848 |
} |
| 849 |
|
| 850 |
/** |
| 851 |
* Get response code |
| 852 |
* |
| 853 |
* @access public |
| 854 |
* @return int |
| 855 |
* @since 1.6.0 |
| 856 |
*/ |
| 857 |
public function responseCode() |
| 858 |
{ |
| 859 |
return $this->api->responseCode(); |
| 860 |
} |
| 861 |
|
| 862 |
/** |
| 863 |
* Checks if token is a valid md5 string |
| 864 |
* |
| 865 |
* @access private |
| 866 |
* @return bool |
| 867 |
* @since 1.6.0 |
| 868 |
*/ |
| 869 |
private function isValidClassicKey() |
| 870 |
{ |
| 871 |
|
| 872 |
return (strlen($this->api_key) < 100); |
| 873 |
} |
| 874 |
|
| 875 |
public function createGroup($name) |
| 876 |
{ |
| 877 |
return $this->api->createGroup($name); |
| 878 |
} |
| 879 |
} |