Skip to content

Commit

Permalink
Release 4.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
vttn committed Oct 12, 2021
1 parent 3763772 commit 447bfe6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tail -f var/log/wallee_payment*.log

## Documentation

[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.11/docs/en/documentation.html)
[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.12/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"wallee/sdk": "3.0.1"
},
"type": "shopware-platform-plugin",
"version": "4.0.11"
"version": "4.0.12"
}
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.11/">
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.12/">
Source
</a>
</li>
Expand Down
4 changes: 3 additions & 1 deletion src/Core/Settings/Struct/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Shopware\Core\Framework\Struct\Struct;
use Wallee\Sdk\ApiClient;
use WalleePayment\Core\Util\Analytics\Analytics;

/**
* Class Settings
Expand Down Expand Up @@ -185,6 +186,7 @@ public function getApiClient(): ApiClient
$this->apiClient = new ApiClient($this->getUserId(), $this->getApplicationKey());
$apiClientBasePath = getenv('WALLEE_API_BASE_PATH') ? getenv('WALLEE_API_BASE_PATH') : $this->apiClient->getBasePath();
$this->apiClient->setBasePath($apiClientBasePath);
Analytics::addHeaders($this->apiClient);
}
return $this->apiClient;
}
Expand Down Expand Up @@ -220,4 +222,4 @@ public function setApplicationKey(string $applicationKey): void
{
$this->applicationKey = $applicationKey;
}
}
}
43 changes: 43 additions & 0 deletions src/Core/Util/Analytics/Analytics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php declare(strict_types=1);

namespace WalleePayment\Core\Util\Analytics;

use Wallee\Sdk\ApiClient;

/**
* Class Analytics
*
* @package WalleePayment\Core\Util\Analytics
*/
class Analytics {

public const SHOP_SYSTEM = 'x-wallee-shop-system';
public const SHOP_SYSTEM_VERSION = 'x-wallee-shop-system-version';
public const SHOP_SYSTEM_AND_VERSION = 'x-wallee-shop-system-and-version';
public const PLUGIN_FEATURE = 'x-wallee-shop-plugin-feature';

/**
* @return array
*/
public static function getDefaultData()
{
return [
self::SHOP_SYSTEM => 'shopware',
self::SHOP_SYSTEM_VERSION => '6',
self::SHOP_SYSTEM_AND_VERSION => 'shopware-6',
];
}

/**
* @param \Wallee\Sdk\ApiClient $apiClient
*/
public static function addHeaders(ApiClient &$apiClient)
{
$data = self::getDefaultData();
foreach ($data as $key => $value) {
$apiClient->addDefaultHeader($key, $value);
}
}
}


10 changes: 8 additions & 2 deletions src/Core/Util/Payload/TransactionPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,16 @@ public function get(): TransactionCreate
$billingAddress = $this->getAddressPayload($customer, $customer->getActiveBillingAddress());
$shippingAddress = $this->getAddressPayload($customer, $customer->getActiveShippingAddress());


$customerId = null;
if($customer->getGuest() === false){
$customerId = $customer->getCustomerNumber();
}

$transactionData = [
'currency' => $this->salesChannelContext->getCurrency()->getIsoCode(),
'customer_email_address' => $billingAddress->getEmailAddress(),
'customer_id' => $customer->getCustomerNumber() ?? null,
'customer_id' => $customerId,
'language' => $this->localeCodeProvider->getLocaleCodeFromContext($this->salesChannelContext->getContext()) ?? null,
'merchant_reference' => $this->fixLength($this->transaction->getOrder()->getOrderNumber(), 100),
'meta_data' => [
Expand Down Expand Up @@ -553,4 +559,4 @@ protected function getFailUrl(string $orderId): string
UrlGeneratorInterface::ABSOLUTE_URL
);
}
}
}

0 comments on commit 447bfe6

Please sign in to comment.