Skip to content

Fix empty email in receipt #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/PluginForm/YandexCheckout/PaymentOffsiteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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) {
Expand Down