diff --git a/CHANGELOG.md b/CHANGELOG.md index 546da59..8e300ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index f1138c4..1cebeac 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -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": { @@ -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": { @@ -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" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index cac4c1e..5f95770 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => 'c03f217e1f4f17e2f000333a18d11230241edcca', + 'reference' => 'f69daf26e5d1aa9bf318be511dab181c6e650aff', 'name' => '__root__', 'dev' => true, ), @@ -16,7 +16,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => 'c03f217e1f4f17e2f000333a18d11230241edcca', + 'reference' => 'f69daf26e5d1aa9bf318be511dab181c6e650aff', 'dev_requirement' => false, ), 'psr/log' => array( @@ -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, ), ), diff --git a/vendor/yoomoney/yookassa-sdk-php/CHANGELOG.md b/vendor/yoomoney/yookassa-sdk-php/CHANGELOG.md index aba4c70..109cb19 100644 --- a/vendor/yoomoney/yookassa-sdk-php/CHANGELOG.md +++ b/vendor/yoomoney/yookassa-sdk-php/CHANGELOG.md @@ -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 diff --git a/vendor/yoomoney/yookassa-sdk-php/composer.json b/vendor/yoomoney/yookassa-sdk-php/composer.json index c5a9078..cb4de3e 100644 --- a/vendor/yoomoney/yookassa-sdk-php/composer.json +++ b/vendor/yoomoney/yookassa-sdk-php/composer.json @@ -11,7 +11,7 @@ "email": "cms@yoomoney.ru" } ], - "version": "2.2.6", + "version": "2.2.8", "require": { "php": ">=5.3.0", "ext-curl": "*", @@ -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/" diff --git a/vendor/yoomoney/yookassa-sdk-php/lib/Client.php b/vendor/yoomoney/yookassa-sdk-php/lib/Client.php index 598ac1b..b55209c 100644 --- a/vendor/yoomoney/yookassa-sdk-php/lib/Client.php +++ b/vendor/yoomoney/yookassa-sdk-php/lib/Client.php @@ -112,7 +112,7 @@ class Client extends BaseClient /** * Текущая версия библиотеки */ - const SDK_VERSION = '2.2.6'; + const SDK_VERSION = '2.2.8'; /** * Получить список платежей магазина diff --git a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/AbstractReceiptResponse.php b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/AbstractReceiptResponse.php index ffbbec3..fc6befe 100644 --- a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/AbstractReceiptResponse.php +++ b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/AbstractReceiptResponse.php @@ -613,4 +613,4 @@ public function notEmpty() * @return void */ abstract public function setSpecificProperties($receiptData); -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequest.php b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequest.php index c219146..db347fa 100644 --- a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequest.php +++ b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequest.php @@ -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; @@ -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; + } + /** * Проверяет наличие данных о плательщике * @@ -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 @@ -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; @@ -450,4 +486,4 @@ public function validate() return true; } -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestBuilder.php b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestBuilder.php index 440578d..fb2d495 100644 --- a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestBuilder.php +++ b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestBuilder.php @@ -35,6 +35,7 @@ use YooKassa\Model\ReceiptCustomer; use YooKassa\Model\ReceiptCustomerInterface; use YooKassa\Model\ReceiptItemInterface; +use YooKassa\Model\ReceiptType; use YooKassa\Model\SettlementInterface; /** @@ -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; } @@ -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); } -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestSerializer.php b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestSerializer.php index e0dd7ab..81c68dc 100644 --- a/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestSerializer.php +++ b/vendor/yoomoney/yookassa-sdk-php/lib/Request/Receipts/CreatePostReceiptRequestSerializer.php @@ -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; } -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/phpdoc.xml b/vendor/yoomoney/yookassa-sdk-php/phpdoc.xml index d109a12..b4e8a6c 100644 --- a/vendor/yoomoney/yookassa-sdk-php/phpdoc.xml +++ b/vendor/yoomoney/yookassa-sdk-php/phpdoc.xml @@ -9,7 +9,7 @@ .phpdoc - + latest diff --git a/vendor/yoomoney/yookassa-sdk-php/tests/Client/ClientTest.php b/vendor/yoomoney/yookassa-sdk-php/tests/Client/ClientTest.php index bd7e95f..34888f7 100644 --- a/vendor/yoomoney/yookassa-sdk-php/tests/Client/ClientTest.php +++ b/vendor/yoomoney/yookassa-sdk-php/tests/Client/ClientTest.php @@ -1004,7 +1004,7 @@ public function testAnotherExceptions() ->setApiClient($curlClientStub) ->setAuth('shopId', 'shopPassword') ->getPaymentInfo(Random::str(36)); - + } public function testConfig() @@ -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') @@ -1782,4 +1782,4 @@ public function encode($data) $refl->setAccessible(true); return $refl->invoke($this, $data); } -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/AbstractReceiptResponseTest.php b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/AbstractReceiptResponseTest.php index 8f37f14..acf36d3 100644 --- a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/AbstractReceiptResponseTest.php +++ b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/AbstractReceiptResponseTest.php @@ -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 @@ -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 @@ -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()) @@ -278,7 +278,7 @@ public function invalidFromArray() array( array( 'id' => Random::str(39), - 'type' => Random::value(ReceiptType::getValidValues()), + 'type' => Random::value(ReceiptType::getEnabledValues()), 'status' => null, 'items' => false ) @@ -286,7 +286,7 @@ public function invalidFromArray() array( array( 'id' => Random::str(39), - 'type' => Random::value(ReceiptType::getValidValues()), + 'type' => Random::value(ReceiptType::getEnabledValues()), 'status' => null, 'items' => 1 ) diff --git a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestBuilderTest.php b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestBuilderTest.php index 33638d5..40288ac 100644 --- a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestBuilderTest.php +++ b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestBuilderTest.php @@ -106,6 +106,32 @@ public function testSetType($options) } } + /** + * @dataProvider validDataProvider + * + * @param $options + */ + public function testSetObjectId($options) + { + $builder = new CreatePostReceiptRequestBuilder(); + + $instance = $builder->build($options); + + if (empty($options['payment_id']) && empty($options['refund_id'])) { + self::assertNull($instance->getObjectId()); + } else { + self::assertNotNull($instance->getObjectId()); + if (!empty($options['payment_id'])) { + self::assertEquals($options['payment_id'], $instance->getObjectId()); + self::assertEquals(ReceiptType::PAYMENT, $instance->getObjectType()); + } + if (!empty($options['refund_id'])) { + self::assertEquals($options['refund_id'], $instance->getObjectId()); + self::assertEquals(ReceiptType::REFUND, $instance->getObjectType()); + } + } + } + /** * @dataProvider invalidVatIdDataProvider * @expectedException \InvalidArgumentException @@ -259,7 +285,7 @@ public function setAmountDataProvider() public function validDataProvider() { - $type = Random::value(ReceiptType::getValidValues()); + $type = Random::value(ReceiptType::getEnabledValues()); $result = array( array( array( @@ -282,7 +308,7 @@ public function validDataProvider() ) ), 'tax_system_code' => Random::int(1, 6), - 'type' => $type, + 'type' => 'payment', 'send' => true, 'settlements' => array( array( @@ -298,7 +324,7 @@ public function validDataProvider() ), ); for ($i = 0; $i < 10; $i++) { - $type = Random::value(ReceiptType::getValidValues()); + $type = Random::value(ReceiptType::getEnabledValues()); $request = array( 'customer' => array( 'full_name' => Random::str(128), @@ -386,4 +412,4 @@ public function invalidBooleanDataProvider() array('test'), ); } -} \ No newline at end of file +} diff --git a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestTest.php b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestTest.php index 8a06c7c..e9ac839 100644 --- a/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestTest.php +++ b/vendor/yoomoney/yookassa-sdk-php/tests/Request/Receipts/CreatePostReceiptRequestTest.php @@ -525,7 +525,7 @@ public function fromArrayDataProvider() */ public function validDataProvider() { - $type = Random::value(ReceiptType::getValidValues()); + $type = Random::value(ReceiptType::getEnabledValues()); $result = array( array( @@ -570,7 +570,7 @@ public function validDataProvider() ), ); for ($i = 0; $i < 10; $i++) { - $type = Random::value(ReceiptType::getValidValues()); + $type = Random::value(ReceiptType::getEnabledValues()); $request = array( 'customer' => array( 'full_name' => Random::str(128), @@ -673,4 +673,4 @@ public function invalidSetOnBehalfOfDataProvider() array(new \stdClass()), ); } -} \ No newline at end of file +} diff --git a/yoo_commerce/yoo_commerce_api.info b/yoo_commerce/yoo_commerce_api.info index fd81274..06d2a8b 100644 --- a/yoo_commerce/yoo_commerce_api.info +++ b/yoo_commerce/yoo_commerce_api.info @@ -2,7 +2,7 @@ name = YooMoney Commerce Api description = "YooMoney module for Drupal Commerce." package = YooMoney core = 7.x -version = 2.1.2 +version = 2.1.3 configure = admin/config/system/yoomoney_api dependencies[] = yoomoney_api dependencies[] = commerce diff --git a/yoo_ubercart/yoo_ubercart_api.info b/yoo_ubercart/yoo_ubercart_api.info index de4b57a..ad5fc03 100644 --- a/yoo_ubercart/yoo_ubercart_api.info +++ b/yoo_ubercart/yoo_ubercart_api.info @@ -2,6 +2,6 @@ name = YooMoney Ubercart Api description = "YooMoney module for Ubercart." package = YooMoney core = 7.x -version = 2.1.2 +version = 2.1.3 dependencies[] = yoomoney_api dependencies[] = uc_payment diff --git a/yoomoney-cms-drupal7.zip b/yoomoney-cms-drupal7.zip index 278f931..054eec6 100644 Binary files a/yoomoney-cms-drupal7.zip and b/yoomoney-cms-drupal7.zip differ diff --git a/yoomoney_api.info b/yoomoney_api.info index ad92eab..9e044b4 100644 --- a/yoomoney_api.info +++ b/yoomoney_api.info @@ -2,5 +2,5 @@ name = YooMoney Core description = YooMoney core module. package = YooMoney core = 7.x -version = 2.1.2 +version = 2.1.3 configure = admin/config/system/yoomoney_api diff --git a/yoomoney_api.module b/yoomoney_api.module index 9d39f69..b6ee8d2 100644 --- a/yoomoney_api.module +++ b/yoomoney_api.module @@ -17,7 +17,7 @@ define('YOOMONEY_API_CHECK_RESULT_CODE_ERROR_MD5', 1); define('YOOMONEY_API_CHECK_RESULT_CODE_ERROR_CUSTOM', 100); define('YOOMONEY_API_CHECK_RESULT_CODE_ERROR_REQUEST', 200); define('YOOMONEY_API_DEFAULT_TAX_RATE_ID', 1); -define('YOOMONEY_MODULE_VERSION', '2.1.2'); +define('YOOMONEY_MODULE_VERSION', '2.1.3'); define('YOOMONEY_API_DEFAULT_PAYMENT_METHOD', \YooKassa\Model\PaymentMethodType::BANK_CARD); define('YOOMONEY_API_QUICK_API_PAY_VERSION', 2); define('YOOMONEY_API_INSTALLMENTS_MIN_AMOUNT', 3000); @@ -174,6 +174,7 @@ function yoomoney_api_ubercart_return_page() YooMoneyLogger::info('Return url init ubercart'); $failUrl = 'yoomoney_api/fail'; $successUrl = 'yoomoney_api/success'; + $backToCart = 'cart/checkout'; $params = drupal_get_query_parameters(); if (!isset($params['orderId'])) { @@ -207,7 +208,8 @@ function yoomoney_api_ubercart_return_page() } $transaction->status = $payment->getStatus(); yoomoney_api_transaction_save($transaction); - $url = $payment->getPaid() ? $successUrl : $failUrl; + $url = $payment->getPaid() ? $successUrl : $backToCart; + uc_cart_complete_sale($order, true); drupal_goto($url); } catch (Exception $e) { YooMoneyLogger::info('Payment failed. Redirect: '.url($failUrl, array('absolute' => true))); diff --git a/yoomoney_api.ru.po b/yoomoney_api.ru.po index dab0832..0e50d14 100644 --- a/yoomoney_api.ru.po +++ b/yoomoney_api.ru.po @@ -545,4 +545,4 @@ msgid "Tinkoff online banking" msgstr "Интернет-банк Тинькофф" msgid "Second receipt sent. Amount %s rubles" -msgstr "Отправлен второй чек. Сумма %s рублей." +msgstr "Отправлен второй чек. Сумма %s рублей." \ No newline at end of file