From 331ac0b3ceb6b8ef3074a04dce2e394f443f679c Mon Sep 17 00:00:00 2001 From: Leonid Razumov Date: Tue, 8 Oct 2019 11:57:42 +0300 Subject: [PATCH] Fix empty email in receipt To fix https://github.com/yandex-money/yandex-money-cms-v2-drupal8/issues/2 --- src/PluginForm/YandexCheckout/PaymentOffsiteForm.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PluginForm/YandexCheckout/PaymentOffsiteForm.php b/src/PluginForm/YandexCheckout/PaymentOffsiteForm.php index 2efe31a..911bcd3 100644 --- a/src/PluginForm/YandexCheckout/PaymentOffsiteForm.php +++ b/src/PluginForm/YandexCheckout/PaymentOffsiteForm.php @@ -16,6 +16,8 @@ use YandexCheckout\Client; use YandexCheckout\Model\ConfirmationType; use YandexCheckout\Request\Payments\CreatePaymentRequest; +use Drupal\commerce_order\Entity\OrderInterface; +use YandexCheckout\Model\Payment; class PaymentOffsiteForm extends BasePaymentOffsiteForm { @@ -56,9 +58,8 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta )); if ($config['receipt_enabled'] == 1) { - /** @var UserInterface $profile */ - $profile = $order->getCustomer(); - $builder->setReceiptEmail($profile->getEmail()); + $profileEmail = $order->getBillingProfile()->field_customer_email->value + $builder->setReceiptEmail($profileEmail); $items = $order->getItems(); /** @var OrderItem $item */ foreach ($items as $item) {