Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
vendor

# IntelliJ project files
.idea
*.iml
out
gen
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.3] - 2023-09-28
### Исправлено
- Поддержка домена getcourse.io

## [0.0.2] - 2023-09-28
### Добавлено
- Поддержка домена getcourse.io

## [0.0.1] - 2023-05-17
### Добавлено
- Метод `setDealCurrency`, который позволяет указывать валюту заказа отличную от Российского Рубля
### Исправлено
- Название переменной в PHPDoc метода `setDateFinished`
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Системные требования:

* PHP 5.4+
* PHP 8.0+
* PHP cURL extension с поддержкой SSL (обычно включена).
* PHP JSON extension

Expand All @@ -14,17 +14,21 @@
Если вы используете [Composer](http://getcomposer.org/), то добавьте в свой "composer.json":

```
"repositories": [
{
"type": "git",
"url": "https://github.com/getcourse-ru/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```

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "getcourse-ru/GetCourse-PHP-SDK",
"name": "xdemonme/getcourse-php-sdk",
"version": "0.0.3",
"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": [
{
Expand All @@ -12,7 +13,7 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=8.0",
"ext-curl": "*",
"ext-json": "*"
},
Expand Down
44 changes: 28 additions & 16 deletions lib/GetCourse/Deal.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function setDealNumber($deal_number) {
$this->deal['deal_number'] = $deal_number;
return $this;
}

/**
* Статус заказа
* @param $deal_status
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
7 changes: 6 additions & 1 deletion lib/GetCourse/core/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/';
}

/**
Expand Down