From b6347b50f2610d93ace1653b5db830a48be65459 Mon Sep 17 00:00:00 2001 From: Roman Gudev Date: Thu, 23 Mar 2023 22:19:44 +0700 Subject: [PATCH] Update to Drupal 10 --- .../commerce_payment_ik.info.yml | 2 +- .../src/Form/InterkassaAjaxForm.php | 2 +- .../PaymentGateway/OffsiteRedirect.php | 2 +- .../templates/payways-form.html.twig | 54 ++++++++++--------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/commerce_payment_ik.info.yml b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/commerce_payment_ik.info.yml index 6e1a297..8bea9d3 100644 --- a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/commerce_payment_ik.info.yml +++ b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/commerce_payment_ik.info.yml @@ -2,6 +2,6 @@ name: Commerce Payment Interkassa type: module description: 'Оплата с помощью Интеркассы' package: Commerce -core: 8.x +core_version_requirement: ^8 || ^9|| ^10 dependencies: - commerce:commerce_payment diff --git a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Form/InterkassaAjaxForm.php b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Form/InterkassaAjaxForm.php index 1f4562b..133da96 100644 --- a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Form/InterkassaAjaxForm.php +++ b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Form/InterkassaAjaxForm.php @@ -31,7 +31,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $options $form['payment_metod'] = array('#type' => 'hidden', '#value' => ''); foreach ($content as $name => $payway) { $form['content'][$name]['image'] = [ - '#url' => '/' . drupal_get_path('module', 'commerce_payment_ik') . '/images/' . $name . '.png', + '#url' => '/' . \Drupal::service('extension.list.module')->getPath('commerce_payment_ik') . '/images/' . $name . '.png', ]; foreach ($payway['currency'] as $currency => $currencyAlias) { $form['content'][$name]['currency'][$currencyAlias] = [ diff --git a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Plugin/Commerce/PaymentGateway/OffsiteRedirect.php b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Plugin/Commerce/PaymentGateway/OffsiteRedirect.php index 2211ef3..51f41dd 100644 --- a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Plugin/Commerce/PaymentGateway/OffsiteRedirect.php +++ b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/src/Plugin/Commerce/PaymentGateway/OffsiteRedirect.php @@ -157,7 +157,7 @@ public function onNotify(Request $request) { $payment = $payment_storage->create([ 'state' => 'completed', 'amount' => $order->getTotalPrice(), - 'payment_gateway' => $this->entityId, + 'payment_gateway' => $this->parentEntity->id(), 'order_id' => $order->id(), 'test' => $test, 'remote_id' => $post['ik_pm_no'], diff --git a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/templates/payways-form.html.twig b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/templates/payways-form.html.twig index 3146914..d0514d3 100644 --- a/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/templates/payways-form.html.twig +++ b/Drupal_8.3/Drupal 8.3 + Commerce 2/commerce_payment_interkassa/templates/payways-form.html.twig @@ -10,34 +10,38 @@ 3. Нажмите «Оплатить»
- {% for key,value in form.content if key|first != '#' %} -
-
-
-
- {{ key }} -
-
-
-
-
- {% for currency ,currencyAlias in value.currency if currency|first != '#' %} - {{ currencyAlias['#title'] }} - {% endfor %} + {% for key,value in form.content %} + {% if key|first != '#' %} +
+
+
+
+ {{ key }} +
+
+
+
+
+ {% for currency ,currencyAlias in value.currency %} + {% if currency|first != '#' %} + {{ currencyAlias['#title'] }} + {% endif %} + {% endfor %} +
+
+
+
+
-
- -
-
+ {% endif %} {% endfor %}