Skip to content

Commit 2481a8d

Browse files
committed
PT-13155 - Fix cs
1 parent 4fc8087 commit 2481a8d

28 files changed

+18506
-18474
lines changed

Components/TransactionReport/TransactionReport.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function reportOrder($orderId)
4747

4848
/**
4949
* @param string $shopwareVersion
50+
* @param string $instanceId
5051
*
5152
* @return void
5253
*/

Setup/Assets/tables.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ CREATE TABLE IF NOT EXISTS `swag_payment_paypal_unified_transaction_report`
153153

154154
CREATE TABLE IF NOT EXISTS `swag_payment_paypal_unified_instance`
155155
(
156-
`instance_id` VARCHAR(255) NOT NULL
156+
`instance_id` VARCHAR(36) NOT NULL
157157
) ENGINE = InnoDB
158158
DEFAULT CHARSET = utf8
159159
COLLATE = utf8_unicode_ci;

Setup/Installer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace SwagPaymentPayPalUnified\Setup;
1010

1111
use Doctrine\DBAL\Connection;
12+
use Exception;
1213
use Shopware\Bundle\AttributeBundle\Service\CrudService;
1314
use Shopware\Bundle\AttributeBundle\Service\CrudServiceInterface;
1415
use Shopware\Bundle\AttributeBundle\Service\TypeMapping;
@@ -87,9 +88,9 @@ public function __construct(
8788
}
8889

8990
/**
90-
* @return bool
9191
* @throws InstallationException
9292
*
93+
* @return bool
9394
*/
9495
public function install()
9596
{
@@ -111,8 +112,8 @@ public function install()
111112
try {
112113
// call the instance id service to create the instance id
113114
(new InstanceIdService($this->connection))->getInstanceId();
114-
} catch (\Exception $e) {
115-
throw new InstallationException($e->getMessage());
115+
} catch (Exception $exception) {
116+
// no need to handle this exception
116117
}
117118

118119
return true;

Setup/InstanceIdService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace SwagPaymentPayPalUnified\Setup;
1010

1111
use Doctrine\DBAL\Connection;
12+
use RuntimeException;
1213
use SwagPaymentPayPalUnified\Components\Uuid;
1314

1415
final class InstanceIdService
@@ -69,7 +70,7 @@ private function create()
6970
->execute();
7071

7172
if ($instanceId !== $this->get()) {
72-
throw new \RuntimeException('Could not create instance id');
73+
throw new RuntimeException('Could not create instance id');
7374
}
7475

7576
return $instanceId;

Setup/Versions/UpdateTo618.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
namespace SwagPaymentPayPalUnified\Setup\Versions;
1010

1111
use Doctrine\DBAL\Connection;
12+
use Exception;
1213
use SwagPaymentPayPalUnified\Setup\InstanceIdService;
1314

1415
class UpdateTo618
1516
{
17+
/**
18+
* @var Connection
19+
*/
20+
private $connection;
21+
1622
public function __construct(Connection $connection)
1723
{
1824
$this->connection = $connection;
@@ -25,7 +31,11 @@ public function update()
2531
{
2632
$this->createInstanceTable();
2733

28-
(new InstanceIdService($this->connection))->getInstanceId();
34+
try {
35+
(new InstanceIdService($this->connection))->getInstanceId();
36+
} catch (Exception $e) {
37+
// no need to handle this exception
38+
}
2939
}
3040

3141
/**
@@ -37,7 +47,7 @@ private function createInstanceTable()
3747
'
3848
CREATE TABLE IF NOT EXISTS `swag_payment_paypal_unified_instance`
3949
(
40-
`instance_id` VARCHAR(255) NOT NULL
50+
`instance_id` VARCHAR(36) NOT NULL
4151
) ENGINE = InnoDB
4252
DEFAULT CHARSET = utf8
4353
COLLATE = utf8_unicode_ci;'

Subscriber/TransactionReportSubscriber.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Doctrine\DBAL\Connection;
1212
use Enlight\Event\SubscriberInterface;
13+
use Exception;
1314
use GuzzleHttp\Client;
1415
use Shopware;
1516
use SwagPaymentPayPalUnified\Components\TransactionReport\TransactionReport;
@@ -53,9 +54,15 @@ public function onTransactionReport()
5354
$shopwareVersion = $this->container->getParameter('shopware.release.version');
5455
}
5556

57+
try {
58+
$instanceId = (new InstanceIdService($this->connection))->getInstanceId();
59+
} catch (Exception $exception) {
60+
$instanceId = '';
61+
}
62+
5663
(new TransactionReport($this->connection))->report(
5764
$shopwareVersion,
58-
(new InstanceIdService($this->connection))->getInstanceId(),
65+
$instanceId,
5966
new Client(['base_uri' => TransactionReport::POST_URL])
6067
);
6168
}

SwagPaymentPayPalUnified.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public function update(UpdateContext $context)
102102
$this->getPaymentMethodProvider(),
103103
new PaymentModelFactory($context->getPlugin()),
104104
$this->getTranslation(),
105-
new TranslationTransformer($this->container->get('models')),
106-
$this->getPath()
105+
new TranslationTransformer($this->container->get('models'))
107106
);
108107
$updater->update($context->getCurrentVersion());
109108

0 commit comments

Comments
 (0)