Skip to content

Commit

Permalink
Merge pull request #19 from btcpayserver/billing-profile-check
Browse files Browse the repository at this point in the history
Honor new setting of billing information enabled + minor fix.
  • Loading branch information
ndeet committed Sep 2, 2019
2 parents 8c0f61c + af23aa5 commit 942f241
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Plugin/Commerce/PaymentGateway/BtcPay.php
Expand Up @@ -497,13 +497,14 @@ public function createInvoice(OrderInterface $order = NULL, $options = []) {
$item->setPrice($order->getTotalPrice()->getNumber());
$invoice->setItem($item);

// Only add customer data if enabled.
if ($this->configuration['privacy_email'] !== '1' || $this->configuration['privacy_email'] !== '1') {
// Add buyer data.
// Only add customer data if allowed by privacy settings.
if ($this->configuration['privacy_email'] !== '1' || $this->configuration['privacy_address'] !== '1') {
// Prepare BTCPay buyer object.
$buyer = new Buyer();

// Only set customer address if not disabled.
if ($this->configuration['privacy_address'] !== '1') {
// Only set customer data if billing profile is enaled and also honor
// address privacy setting.
if ($order->getBillingProfile() && $this->configuration['privacy_address'] !== '1') {
/** @var \Drupal\address\Plugin\Field\FieldType\AddressItem $billing_address */
$billing_address = $order->getBillingProfile()->get('address')->first();
$buyer->setFirstName($billing_address->getGivenName())
Expand Down

0 comments on commit 942f241

Please sign in to comment.