Skip to content

Commit

Permalink
Merge pull request #21 from yoomoney/release/v2.2.2
Browse files Browse the repository at this point in the history
* Исправлены ошибки при добавлении платежного шлюза
  • Loading branch information
SaShaSpi authored Dec 21, 2021
2 parents 12e24fb + 905ef50 commit de9a4fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v2.2.2 от 21.12.2021
* Исправлены ошибки при добавлении платежного шлюза

### v2.2.1 от 15.12.2021
* Обновление статуса платежа сразу после оплаты
* Обновлен SDK до версии 2.2.4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

**Требования к CMS**
* версия 8.x;
* PHP 5.3 или выше;
* PHP 7.0 или выше;
* расширение libCurl.

### О ЮKassa
Expand Down
23 changes: 13 additions & 10 deletions src/Plugin/Commerce/PaymentGateway/YooKassa.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*/
class YooKassa extends OffsitePaymentGatewayBase
{
const YOOMONEY_MODULE_VERSION = '2.2.1';
const YOOMONEY_MODULE_VERSION = '2.2.2';

/**
* @property Client apiClient
Expand Down Expand Up @@ -240,12 +240,15 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
}
}
}
$this->entityId = $form_state->getValue('id');
if ($this->entityId) {
$gateway_id = $form_state->getValue('id', null);
$gateway = $gateway_id ?
$this->entityTypeManager->getStorage('commerce_payment_gateway')->load($gateway_id)
: NULL;
if ($gateway) {
$form['notification_url'] = [
'#type' => 'textfield',
'#title' => t('Url для нотификаций'),
'#default_value' => $this->getNotifyUrl()->toString(),
'#default_value' => $gateway->getPlugin()->getNotifyUrl()->toString(),
'#attributes' => ['readonly' => 'readonly'],
];
}
Expand Down Expand Up @@ -278,13 +281,13 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s
{
parent::submitConfigurationForm($form, $form_state);
if (!$form_state->getErrors()) {
$values = $form_state->getValue($form['#parents']);
$this->configuration['shop_id'] = $values['shop_id'];
$this->configuration['secret_key'] = $values['secret_key'];
$values = $form_state->getValue($form['#parents']);
$this->configuration['shop_id'] = $values['shop_id'];
$this->configuration['secret_key'] = $values['secret_key'];
$this->configuration['description_template'] = $values['description_template'];
$this->configuration['receipt_enabled'] = $values['receipt_enabled'];
$this->configuration['default_tax'] = isset($values['default_tax']) ? $values['default_tax'] : '';
$this->configuration['yookassa_tax'] = isset($values['yookassa_tax']) ? $values['yookassa_tax'] : '';
$this->configuration['receipt_enabled'] = $values['receipt_enabled'];
$this->configuration['default_tax'] = $values['default_tax'] ?? [];
$this->configuration['yookassa_tax'] = $values['yookassa_tax'] ?? [];
}
}

Expand Down

0 comments on commit de9a4fe

Please sign in to comment.