Каков правильный подход к обработке параметров сообщения в URL-адресе шлюза в Drupal 9?
Делаю оффсайтный платежный модуль на drupal 9(commerce2.x). Я пытаюсь отправить запрос через параметры сообщения на URL-адрес шлюза. Я записал параметры в файл формы, но похоже, что запрос не работает, и единственным результатом, который я получаю, является ссылка, которую я передал в $redirect_url. Заказ тоже не обрабатывается. У меня также есть эта путаница, передавать ли эти параметры в файл контроллера или файл формы? Нужен ли мне файл контроллера для простого внешнего модуля? Я поделился кодом Pluginform.php для лучшего понимания. Я буду чувствовать себя благословленным, если кто-то направит меня в правильном направлении. Заранее большое спасибо!!!! а также я прошу своих коллег не сообщать об этом вопросе и не ставить отрицательный балл, потому что это важный вопрос для меня, и я очень нуждаюсь в помощи.
<?php
namespace Drupal\commerce_payu\PluginForm\PayURedirect;
use Drupal\commerce_payment\PluginForm\PaymentOffsiteForm as BasePaymentOffsiteForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Serialization\Json;
/**
* Provides the Off-site payment form.
*/
class PaymentPayUForm extends BasePaymentOffsiteForm {
private $paymentGatewayPlugin;
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$payment = $this->entity;
$payment_gateway_plugin = $payment->getPaymentGateway()->getPlugin();
$order = $payment->getOrder();
$redirect_url = 'https://lateralpayments.com/hps/hps_Payment.aspx';
$total_price = $order->getTotalPrice();
$billing_profile = $order->getBillingProfile();
$address = $order->getBillingProfile()->address->first();
$data = [
'Merchant_User_Id' => $payment_gateway_plugin->getConfiguration()['Merchant_User_Id'],
'merchantpwd' => $this->$merchantpwd,
'Purchase_summary' => $this->$Purchase_summary,
'currencydesc' => $total_price->getCurrencyCode(),
'merchant_ref_number' => $merchant_ref_number,
'customer_ipaddress' => $customer_ipaddress,
'amount' => $total_price ? $total_price->getNumber() : 0,
'customer_firstname' => $address->getGivenName(),
'customer_lastname' => $address->getFamilyName(),
'customer_phone' => $billing_profile->get('field_phone')->value,
'customer_email' => $order->getEmail(),
'bill_firstname' => $address->getGivenName(),
'bill_lastname' => $address->getFamilyName(),
'bill_address1' => $address->getAddressLine1(),
'bill_address2' => $address->getAddressLine2(),
'bill_city' => $address->getLocality(),
'bill_state' => $address->getAdministrativeArea(),
'bill_country' => $address->getCountryCode(),
'bill_zip' => $address->getPostalCode(),
'ship_to_address1' => $address->getAddressLine1(),
'ship_to_address2' => $address->getAddressLine2(),
'ship_to_city' => $address->getLocality(),
'ship_to_country' => $address->getCountryCode(),
'ship_to_phone' => $billing_profile->get('field_phone')->value,
'ship_to_state' => $address->getAdministrativeArea(),
'ship_to_zip' => $address->getPostalCode(),
'transactionkey' => $str,
'processurl' => $form['#process_url'],
'notifyurl' => $form['#notify_url'],
'cancelurl' => $form['#cancel_url'],
];
// Hash Sequence.
$secret_key = $payment_gateway_plugin->getConfiguration()['salt'];
$json_data = base64_encode(Json::encode($data));
$json_data1 = base64_encode(Json::encode($data));
$json_data2 = base64_encode(Json::encode($data));
$data['currencydesc'] = $json_data;
$data['amount'] = $json_data1;
$data['merchant_ref_number'] = $json_data2;
$data['transactionkey'] = base64_encode(sha1($json_data . $json_data1 . $json_data2 . $secret_key, 1));
return $this->buildRedirectForm($form, $form_state, $redirect_url, $data, 'post');
}
}