Skip to content

Commit

Permalink
Merge pull request #59 from yoomoney/release/v2.1.3
Browse files Browse the repository at this point in the history
* Добавлен метод регистрации анонимного пользователя после покупки.
* Обновлен SDK до версии 2.2.8
  • Loading branch information
SaShaSpi authored Mar 24, 2022
2 parents 42d363d + 839b5f5 commit f595fa5
Show file tree
Hide file tree
Showing 21 changed files with 155 additions and 43 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v2.1.3 от 24.03.2022
* Добавлен метод регистрации анонимного пользователя после покупки
* Обновлен SDK до версии 2.2.8

### v2.1.2 от 14.02.2022
* Отключен способ оплаты Webmoney
* Обновлен SDK до версии 2.2.6
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@
},
{
"name": "yoomoney/yookassa-sdk-php",
"version": "2.2.6",
"version_normalized": "2.2.6.0",
"version": "2.2.8",
"version_normalized": "2.2.8.0",
"source": {
"type": "git",
"url": "https://github.com/yoomoney/yookassa-sdk-php.git",
"reference": "0bbd87d76310b3239b6e6de6534c9fab9e7db847"
"reference": "75f31abcf1f4b35d63579e880157719de6da5f49"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yoomoney/yookassa-sdk-php/zipball/0bbd87d76310b3239b6e6de6534c9fab9e7db847",
"reference": "0bbd87d76310b3239b6e6de6534c9fab9e7db847",
"url": "https://api.github.com/repos/yoomoney/yookassa-sdk-php/zipball/75f31abcf1f4b35d63579e880157719de6da5f49",
"reference": "75f31abcf1f4b35d63579e880157719de6da5f49",
"shasum": ""
},
"require": {
Expand All @@ -80,7 +80,7 @@
"mockery/mockery": "^0.9.9",
"phpunit/phpunit": "^4.8.35 || ^5.7"
},
"time": "2022-01-21T13:31:53+00:00",
"time": "2022-03-11T13:07:44+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -109,7 +109,7 @@
],
"support": {
"issues": "https://github.com/yoomoney/yookassa-sdk-php/issues",
"source": "https://github.com/yoomoney/yookassa-sdk-php/tree/2.2.6"
"source": "https://github.com/yoomoney/yookassa-sdk-php/tree/2.2.8"
},
"install-path": "../yoomoney/yookassa-sdk-php"
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'c03f217e1f4f17e2f000333a18d11230241edcca',
'reference' => 'f69daf26e5d1aa9bf318be511dab181c6e650aff',
'name' => '__root__',
'dev' => true,
),
Expand All @@ -16,7 +16,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => 'c03f217e1f4f17e2f000333a18d11230241edcca',
'reference' => 'f69daf26e5d1aa9bf318be511dab181c6e650aff',
'dev_requirement' => false,
),
'psr/log' => array(
Expand All @@ -29,12 +29,12 @@
'dev_requirement' => false,
),
'yoomoney/yookassa-sdk-php' => array(
'pretty_version' => '2.2.6',
'version' => '2.2.6.0',
'pretty_version' => '2.2.8',
'version' => '2.2.8.0',
'type' => 'library',
'install_path' => __DIR__ . '/../yoomoney/yookassa-sdk-php',
'aliases' => array(),
'reference' => '0bbd87d76310b3239b6e6de6534c9fab9e7db847',
'reference' => '75f31abcf1f4b35d63579e880157719de6da5f49',
'dev_requirement' => false,
),
),
Expand Down
6 changes: 6 additions & 0 deletions vendor/yoomoney/yookassa-sdk-php/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v2.2.8 от 11.03.2022
* Исправлена ошибка в сериализации объекта Receipt

### v2.2.7 от 02.03.2022
* Исправлена ошибка в сериализации объекта Receipt

### v2.2.6 от 21.01.2022
* Откат поддержки psr/log версий 2 и 3

Expand Down
21 changes: 20 additions & 1 deletion vendor/yoomoney/yookassa-sdk-php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"email": "[email protected]"
}
],
"version": "2.2.6",
"version": "2.2.8",
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
Expand All @@ -24,6 +24,25 @@
"phpunit/phpunit": "^4.8.35 || ^5.7",
"mockery/mockery": "^0.9.9"
},
"scripts": {
"test": [
"@phpunit",
"@phpcbf",
"@phpcs",
"@phpmd"
],
"ci": [
"@phplint",
"@phpunit",
"@phpcs",
"@phpmd"
],
"phplint": "vendor/bin/parallel-lint --exclude vendor/ --exclude .idea/ -e php,module,inc,install,profile,theme .",
"phpunit": "vendor/bin/phpunit --configuration=phpunit.xml.dist",
"phpcs": "vendor/bin/phpcs --ignore=vendor/,.idea/ --standard=phpcs.xml --extensions=php,module,inc,install,profile,theme,css,info,txt,md,yml --report=full .",
"phpcbf": "vendor/bin/phpcbf --ignore=vendor/,.idea/ --standard=phpcs.xml --extensions=php,module,inc,install,profile,theme,css,info,txt,md,yml .",
"phpmd": "vendor/bin/phpmd --exclude vendor/,.idea/ --suffixes php,module,inc,install,profile,theme . text phpmd.xml"
},
"autoload": {
"psr-4": {
"YooKassa\\": "lib/"
Expand Down
2 changes: 1 addition & 1 deletion vendor/yoomoney/yookassa-sdk-php/lib/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Client extends BaseClient
/**
* Текущая версия библиотеки
*/
const SDK_VERSION = '2.2.6';
const SDK_VERSION = '2.2.8';

/**
* Получить список платежей магазина
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,4 +613,4 @@ public function notEmpty()
* @return void
*/
abstract public function setSpecificProperties($receiptData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class CreatePostReceiptRequest extends AbstractRequest implements CreatePostRece
/** @var string Идентификатор объекта оплаты */
private $_object_id;

/** @var string Тип объекта: приход "payment" или возврат "refund". */
private $_object_type;

/** @var string Идентификатор магазина в ЮKassa */
private $_onBehalfOf;

Expand Down Expand Up @@ -102,6 +105,26 @@ public function setObjectId($value)
$this->_object_id = $value;
}

/**
* Возвращает тип объекта чека
*
* @return string Тип объекта чека
*/
public function getObjectType()
{
return $this->_object_type;
}

/**
* Устанавливает тип объекта чека
*
* @param string $value Тип объекта чека
*/
public function setObjectType($value)
{
$this->_object_type = $value;
}

/**
* Проверяет наличие данных о плательщике
*
Expand Down Expand Up @@ -262,6 +285,9 @@ public function setType($value)
throw new InvalidPropertyValueException('Invalid receipt type value', 0, 'Receipt.type', $value);
}
$this->_type = (string)$value;
if (!$this->_object_type) {
$this->_object_type = $this->_type;
}
} else {
throw new InvalidPropertyValueTypeException(
'Invalid receipt type value type', 0, 'Receipt.type', $value
Expand Down Expand Up @@ -432,6 +458,16 @@ public function validate()
return false;
}

if (empty($this->_object_type)) {
$this->setValidationError('Receipt object_type not specified');
return false;
}

if (empty($this->_object_id)) {
$this->setValidationError('Receipt object_id not specified');
return false;
}

if (empty($this->_send)) { // todo: пока может быть только true
$this->setValidationError('Receipt send not specified');
return false;
Expand All @@ -450,4 +486,4 @@ public function validate()
return true;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use YooKassa\Model\ReceiptCustomer;
use YooKassa\Model\ReceiptCustomerInterface;
use YooKassa\Model\ReceiptItemInterface;
use YooKassa\Model\ReceiptType;
use YooKassa\Model\SettlementInterface;

/**
Expand Down Expand Up @@ -223,11 +224,27 @@ public function setSettlements($value)
* Устанавливает Id объекта чека
*
* @param string $value Id объекта чека
* @param string|null $type Тип объекта чека
* @return CreatePostReceiptRequestBuilder
*/
public function setObjectId($value)
public function setObjectId($value, $type=null)
{
$this->currentObject->setObjectId($value);
if (!empty($type)) {
$this->currentObject->setObjectType($type);
}
return $this;
}

/**
* Устанавливает тип объекта чека
*
* @param string $value Тип объекта чека
* @return CreatePostReceiptRequestBuilder
*/
public function setObjectType($value)
{
$this->currentObject->setObjectType($value);
return $this;
}

Expand All @@ -246,12 +263,14 @@ public function build(array $options = null)

if (!empty($options['payment_id'])) {
$this->setObjectId($options['payment_id']);
$this->setObjectType(ReceiptType::PAYMENT);
} elseif (!empty($options['refund_id'])) {
$this->setObjectId($options['refund_id']);
$this->setObjectType(ReceiptType::REFUND);
}
}

return parent::build($options);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ private function serializeObjectId(CreatePostReceiptRequestInterface $request)
{
$result = array();

if ($request->getType() === ReceiptType::PAYMENT) {
if ($request->getObjectType() === ReceiptType::PAYMENT) {
$result['payment_id'] = $request->getObjectId();
} elseif ($request->getType() === ReceiptType::REFUND) {
} elseif ($request->getObjectType() === ReceiptType::REFUND) {
$result['refund_id'] = $request->getObjectId();
}

return $result;
}
}
}
2 changes: 1 addition & 1 deletion vendor/yoomoney/yookassa-sdk-php/phpdoc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<paths>
<output>.phpdoc</output>
</paths>
<version number="2.2.6">
<version number="2.2.8">
<folder>latest</folder>
<api>
<source dsn=".">
Expand Down
6 changes: 3 additions & 3 deletions vendor/yoomoney/yookassa-sdk-php/tests/Client/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ public function testAnotherExceptions()
->setApiClient($curlClientStub)
->setAuth('shopId', 'shopPassword')
->getPaymentInfo(Random::str(36));

}

public function testConfig()
Expand Down Expand Up @@ -1316,7 +1316,7 @@ private function createReceiptViaObject()
return CreatePostReceiptRequest::builder()
->setCustomer($customer)
->setType(ReceiptType::PAYMENT)
->setObjectId('1da5c87d-0984-50e8-a7f3-8de646dd9ec9')
->setObjectId('1da5c87d-0984-50e8-a7f3-8de646dd9ec9', ReceiptType::PAYMENT)
->setSend(true)
->setSettlements(array($settlement))
->setOnBehalfOf('545665')
Expand Down Expand Up @@ -1782,4 +1782,4 @@ public function encode($data)
$refl->setAccessible(true);
return $refl->invoke($this, $data);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function invalidItemsSettlementsDataProvider()
array(
array(
'id' => Random::str(39),
'type' => Random::value(ReceiptType::getValidValues()),
'type' => Random::value(ReceiptType::getEnabledValues()),
'status' => null,
'items' => null,
'settlements' => null
Expand All @@ -252,7 +252,7 @@ public function invalidItemsSettlementsDataProvider()
array(
array(
'id' => Random::str(39),
'type' => Random::value(ReceiptType::getValidValues()),
'type' => Random::value(ReceiptType::getEnabledValues()),
'status' => null,
'items' => 1,
'settlements' => 1
Expand All @@ -261,7 +261,7 @@ public function invalidItemsSettlementsDataProvider()
array(
array(
'id' => Random::str(39),
'type' => Random::value(ReceiptType::getValidValues()),
'type' => Random::value(ReceiptType::getEnabledValues()),
'status' => null,
'items' => array(new Airline()),
'settlements' => array(new Airline())
Expand All @@ -278,15 +278,15 @@ public function invalidFromArray()
array(
array(
'id' => Random::str(39),
'type' => Random::value(ReceiptType::getValidValues()),
'type' => Random::value(ReceiptType::getEnabledValues()),
'status' => null,
'items' => false
)
),
array(
array(
'id' => Random::str(39),
'type' => Random::value(ReceiptType::getValidValues()),
'type' => Random::value(ReceiptType::getEnabledValues()),
'status' => null,
'items' => 1
)
Expand Down
Loading

0 comments on commit f595fa5

Please sign in to comment.