From 22b49f1a57275ee779e8801beec84ff27814397f Mon Sep 17 00:00:00 2001 From: xDemon Date: Fri, 28 Oct 2022 19:17:57 +0700 Subject: [PATCH 1/9] Add method setDealCurrency Update PHPDoc comments --- lib/GetCourse/Deal.php | 44 +++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/lib/GetCourse/Deal.php b/lib/GetCourse/Deal.php index 4ec181c..7d0ee6b 100644 --- a/lib/GetCourse/Deal.php +++ b/lib/GetCourse/Deal.php @@ -27,7 +27,7 @@ public function setDealNumber($deal_number) { $this->deal['deal_number'] = $deal_number; return $this; } - + /** * Статус заказа * @param $deal_status @@ -68,11 +68,11 @@ public function setDateCreated($date_created_at) { return $this; } - /** - * Дата оплаты/завершения заказа - * @param $date_created_at - * @return $this - */ + /** + * Дата оплаты/завершения заказа + * @param $date_finished_at + * @return $this + */ public function setDateFinished($date_finished_at) { $this->deal['deal_finished_at'] = $date_finished_at; return $this; @@ -88,11 +88,22 @@ public function setDealCost($deal_cost) { return $this; } - /** - * Наименование предложения - * @param $deal_cost - * @return $this - */ + /** + * Сумма заказа + * @param $deal_currency + * @return $this + */ + public function setDealCurrency($deal_currency) + { + $this->deal['deal_currency'] = $deal_currency; + return $this; + } + + /** + * Наименование предложения + * @param $product_title + * @return $this + */ public function setProductTitle($product_title) { $this->deal['product_title'] = $product_title; return $this; @@ -179,11 +190,12 @@ public function setDealPartnerEmail($partnerEmail) { return $this; } - /** - * Вызов api - * @param $action - * @return mixed - */ + /** + * Вызов api + * @param $action + * @return mixed + * @throws \Exception + */ public function apiCall( $action ) { return $this->executeCall(self::getUrl().'deals', $action); } From f2376b98bbb8361e65212102e69b8d7e6170c04f Mon Sep 17 00:00:00 2001 From: xDemon Date: Fri, 28 Oct 2022 19:17:57 +0700 Subject: [PATCH 2/9] Add method setDealCurrency Update PHPDoc comments --- lib/GetCourse/Deal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/GetCourse/Deal.php b/lib/GetCourse/Deal.php index 7d0ee6b..e041619 100644 --- a/lib/GetCourse/Deal.php +++ b/lib/GetCourse/Deal.php @@ -89,7 +89,7 @@ public function setDealCost($deal_cost) { } /** - * Сумма заказа + * Валюта заказа * @param $deal_currency * @return $this */ From 1ef2b085ae3a1bd342479f18d6c5fe26f84e294a Mon Sep 17 00:00:00 2001 From: Dmitriy Taranov <46478206+xDemonME@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:58:22 +0700 Subject: [PATCH 3/9] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index da79a16..9f9af0b 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,11 @@ "repositories": [ { "type": "git", - "url": "https://github.com/getcourse-ru/GetCourse-PHP-SDK" + "url": "https://github.com/xDemonME/GetCourse-PHP-SDK" } ], "require": { - "getcourse-ru/GetCourse-PHP-SDK": "dev-master" + "getcourse-ru/getcourse-php-sdk": "dev-master" } ``` From 231f1f9c1b310262329b9d749a01ba61e54a81fa Mon Sep 17 00:00:00 2001 From: Dmitriy Taranov <46478206+xDemonME@users.noreply.github.com> Date: Wed, 17 May 2023 14:43:42 +0700 Subject: [PATCH 4/9] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eb51024..640a1d1 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "getcourse-ru/GetCourse-PHP-SDK", + "name": "xdemonme/get-course-php-sdk", "description": "GetCourse's PHP SDK for APIs", "keywords": ["getcourse", "api", "sdk"], "type": "library", From d1d3e30042cd936bc0377d4cb02563e1dcfbcbc1 Mon Sep 17 00:00:00 2001 From: Dmitriy Taranov <46478206+xDemonME@users.noreply.github.com> Date: Wed, 17 May 2023 14:44:53 +0700 Subject: [PATCH 5/9] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 640a1d1..860c977 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "xdemonme/get-course-php-sdk", + "name": "xdemonme/getcourse-php-sdk", "description": "GetCourse's PHP SDK for APIs", "keywords": ["getcourse", "api", "sdk"], "type": "library", From 28251105efbc4742eca344b24e967c4caeb6d1a3 Mon Sep 17 00:00:00 2001 From: Dmitriy Taranov <46478206+xDemonME@users.noreply.github.com> Date: Wed, 17 May 2023 14:48:04 +0700 Subject: [PATCH 6/9] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 860c977..93dc905 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "GetCourse's PHP SDK for APIs", "keywords": ["getcourse", "api", "sdk"], "type": "library", - "license": "Apache2", + "license": "Apache-2.0", "homepage": "https://github.com/getcourse-ru/GetCourse-PHP-SDK", "authors": [ { From 8418e84d09726fcccc31a892e8c4ae17f35c3377 Mon Sep 17 00:00:00 2001 From: xdemonme Date: Thu, 28 Sep 2023 13:33:46 +0700 Subject: [PATCH 7/9] =?UTF-8?q?V.=200.0.2:=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5?= =?UTF-8?q?=D1=80=D0=B6=D0=BA=D0=B0=20=D0=B4=D0=BE=D0=BC=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20getcourse.io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 7 +++++++ CHANGELOG.md | 17 +++++++++++++++++ README.md | 20 ++++++++++++-------- composer.json | 3 ++- lib/GetCourse/core/Model.php | 7 ++++++- 5 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100644 CHANGELOG.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d830c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +vendor + +# IntelliJ project files +.idea +*.iml +out +gen \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d6af192 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +Все заметные изменения в этом проекте будут задокументированы в этом файле. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [0.0.2] - 2023-09-28 +### Добавлено +- Поддержка домена getcourse.io + +## [0.0.1] - 2023-05-17 +### Добавлено +- Метод `setDealCurrency`, который позволяет указывать валюту заказа отличную от Российского Рубля +### Исправлено +- Название переменной в PHPDoc метода `setDateFinished` \ No newline at end of file diff --git a/README.md b/README.md index 9f9af0b..f0e0461 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Системные требования: - * PHP 5.4+ + * PHP 8.0+ * PHP cURL extension с поддержкой SSL (обычно включена). * PHP JSON extension @@ -14,17 +14,21 @@ Если вы используете [Composer](http://getcomposer.org/), то добавьте в свой "composer.json": ``` - "repositories": [ - { - "type": "git", - "url": "https://github.com/xDemonME/GetCourse-PHP-SDK" - } - ], "require": { - "getcourse-ru/getcourse-php-sdk": "dev-master" + "xdemonme/getcourse-php-sdk": "^0.0.2" } ``` +и запустите `composer update` для установки + +**или** + +запустите эту команду в командной строке вашего проекта: + +```shell +composer require xdemonme/getcourse-php-sdk +``` + ## Пример использования Находится в директории ```sample``` diff --git a/composer.json b/composer.json index 93dc905..b9adbea 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "xdemonme/getcourse-php-sdk", + "version": "0.0.2", "description": "GetCourse's PHP SDK for APIs", "keywords": ["getcourse", "api", "sdk"], "type": "library", @@ -12,7 +13,7 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=8.0", "ext-curl": "*", "ext-json": "*" }, diff --git a/lib/GetCourse/core/Model.php b/lib/GetCourse/core/Model.php index 14c04b3..38e60b6 100644 --- a/lib/GetCourse/core/Model.php +++ b/lib/GetCourse/core/Model.php @@ -37,7 +37,12 @@ public static function getUrl() { if(!self::$accountName) { throw new \Exception("Account name not supplied"); } - return 'https://' . self::$accountName . '.getcourse.ru/pl/api/'; + $account = self::$accountName; + + if (str_contains(self::$accountName, 'getcourse.io') || str_contains(self::$accountName, 'getcourse.ru')) { + $account .= '.getcourse.ru'; + } + return 'https://' . $account . '/pl/api/'; } /** From b2b04c9aae237a47ffe61789e9aacd0bbe49ad94 Mon Sep 17 00:00:00 2001 From: xdemonme Date: Thu, 28 Sep 2023 13:50:27 +0700 Subject: [PATCH 8/9] =?UTF-8?q?V.=200.0.3:=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4?= =?UTF-8?q?=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20=D0=B4=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20getcourse.io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ lib/GetCourse/core/Model.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6af192..1f56388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.0.3] - 2023-09-28 +### Исправлено +- Поддержка домена getcourse.io ## [0.0.2] - 2023-09-28 ### Добавлено diff --git a/lib/GetCourse/core/Model.php b/lib/GetCourse/core/Model.php index 38e60b6..c277da5 100644 --- a/lib/GetCourse/core/Model.php +++ b/lib/GetCourse/core/Model.php @@ -39,7 +39,7 @@ public static function getUrl() { } $account = self::$accountName; - if (str_contains(self::$accountName, 'getcourse.io') || str_contains(self::$accountName, 'getcourse.ru')) { + if (!str_contains(self::$accountName, 'getcourse.io') && !str_contains(self::$accountName, 'getcourse.ru')) { $account .= '.getcourse.ru'; } return 'https://' . $account . '/pl/api/'; From fb160c91a8e7ce7dc14bf6b75c84e2d0fa29087e Mon Sep 17 00:00:00 2001 From: xdemonme Date: Thu, 28 Sep 2023 13:50:27 +0700 Subject: [PATCH 9/9] =?UTF-8?q?V.=200.0.3:=20=D0=98=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4?= =?UTF-8?q?=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20=D0=B4=D0=BE=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20getcourse.io?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b9adbea..92da79f 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "xdemonme/getcourse-php-sdk", - "version": "0.0.2", + "version": "0.0.3", "description": "GetCourse's PHP SDK for APIs", "keywords": ["getcourse", "api", "sdk"], "type": "library",