1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Braintree\Communication\Table; |
9
|
|
|
|
10
|
|
|
use Orm\Zed\Braintree\Persistence\Map\SpyPaymentBraintreeTableMap; |
|
|
|
|
11
|
|
|
use Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeQuery; |
|
|
|
|
12
|
|
|
use Spryker\Service\UtilText\Model\Url\Url; |
13
|
|
|
use Spryker\Zed\Gui\Communication\Table\AbstractTable; |
14
|
|
|
use Spryker\Zed\Gui\Communication\Table\TableConfiguration; |
15
|
|
|
|
16
|
|
|
class Payments extends AbstractTable implements BraintreeTableInterface |
17
|
|
|
{ |
18
|
|
|
public const FIELD_VIEW = 'FIELD_VIEW'; |
19
|
|
|
public const URL_BRAINTREE_DETAILS = '/braintree/details'; |
20
|
|
|
public const PARAM_ID_PAYMENT = 'id-payment'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeQuery |
24
|
|
|
*/ |
25
|
|
|
protected $paymentBraintreeQuery; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeQuery $paymentBraintreeQuery |
29
|
|
|
*/ |
30
|
|
|
public function __construct(SpyPaymentBraintreeQuery $paymentBraintreeQuery) |
31
|
|
|
{ |
32
|
|
|
$this->paymentBraintreeQuery = $paymentBraintreeQuery; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config |
37
|
|
|
* |
38
|
|
|
* @return \Spryker\Zed\Gui\Communication\Table\TableConfiguration |
39
|
|
|
*/ |
40
|
|
|
protected function configure(TableConfiguration $config) |
41
|
|
|
{ |
42
|
|
|
$config->setHeader([ |
43
|
|
|
SpyPaymentBraintreeTableMap::COL_ID_PAYMENT_BRAINTREE => 'Payment ID', |
44
|
|
|
SpyPaymentBraintreeTableMap::COL_FK_SALES_ORDER => 'Order ID', |
45
|
|
|
SpyPaymentBraintreeTableMap::COL_EMAIL => 'Email', |
46
|
|
|
SpyPaymentBraintreeTableMap::COL_CREATED_AT => 'Created', |
47
|
|
|
static::FIELD_VIEW => 'View', |
48
|
|
|
]); |
49
|
|
|
|
50
|
|
|
$config->addRawColumn(static::FIELD_VIEW); |
51
|
|
|
|
52
|
|
|
$config->setSortable([ |
53
|
|
|
SpyPaymentBraintreeTableMap::COL_CREATED_AT, |
54
|
|
|
]); |
55
|
|
|
|
56
|
|
|
return $config; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config |
61
|
|
|
* |
62
|
|
|
* @return array |
63
|
|
|
*/ |
64
|
|
|
protected function prepareData(TableConfiguration $config) |
65
|
|
|
{ |
66
|
|
|
$paymentItems = $this->runQuery($this->paymentBraintreeQuery, $config); |
67
|
|
|
$results = []; |
68
|
|
|
foreach ($paymentItems as $paymentItem) { |
69
|
|
|
$results[] = [ |
70
|
|
|
SpyPaymentBraintreeTableMap::COL_ID_PAYMENT_BRAINTREE => $paymentItem[SpyPaymentBraintreeTableMap::COL_ID_PAYMENT_BRAINTREE], |
71
|
|
|
SpyPaymentBraintreeTableMap::COL_FK_SALES_ORDER => $paymentItem[SpyPaymentBraintreeTableMap::COL_FK_SALES_ORDER], |
72
|
|
|
SpyPaymentBraintreeTableMap::COL_EMAIL => $paymentItem[SpyPaymentBraintreeTableMap::COL_EMAIL], |
73
|
|
|
SpyPaymentBraintreeTableMap::COL_CREATED_AT => $paymentItem[SpyPaymentBraintreeTableMap::COL_CREATED_AT], |
74
|
|
|
static::FIELD_VIEW => implode(' ', $this->buildOptionsUrls($paymentItem)), |
75
|
|
|
]; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
return $results; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param array $paymentItem |
83
|
|
|
* |
84
|
|
|
* @return array |
85
|
|
|
*/ |
86
|
|
|
protected function buildOptionsUrls(array $paymentItem) |
87
|
|
|
{ |
88
|
|
|
$urls = []; |
89
|
|
|
|
90
|
|
|
$urls[] = $this->generateViewButton( |
91
|
|
|
Url::generate(static::URL_BRAINTREE_DETAILS, [ |
92
|
|
|
static::PARAM_ID_PAYMENT => $paymentItem[SpyPaymentBraintreeTableMap::COL_ID_PAYMENT_BRAINTREE], |
93
|
|
|
]), |
94
|
|
|
'View' |
95
|
|
|
); |
96
|
|
|
|
97
|
|
|
return $urls; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths