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; |
9
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\Communication\AbstractCommunicationFactory; |
11
|
|
|
use SprykerEco\Zed\Braintree\Communication\Table\BraintreeTableInterface; |
12
|
|
|
use SprykerEco\Zed\Braintree\Communication\Table\Payments; |
13
|
|
|
use SprykerEco\Zed\Braintree\Communication\Table\RequestLog; |
14
|
|
|
use SprykerEco\Zed\Braintree\Communication\Table\StatusLog; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @method \SprykerEco\Zed\Braintree\Persistence\BraintreeQueryContainerInterface getQueryContainer() |
18
|
|
|
* @method \SprykerEco\Zed\Braintree\BraintreeConfig getConfig() |
19
|
|
|
* @method \SprykerEco\Zed\Braintree\Business\BraintreeFacadeInterface getFacade() |
20
|
|
|
* @method \SprykerEco\Zed\Braintree\Persistence\BraintreeEntityManagerInterface getEntityManager() |
21
|
|
|
* @method \SprykerEco\Zed\Braintree\Persistence\BraintreeRepositoryInterface getRepository() |
22
|
|
|
*/ |
23
|
|
|
class BraintreeCommunicationFactory extends AbstractCommunicationFactory |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @return \SprykerEco\Zed\Braintree\Communication\Table\BraintreeTableInterface |
27
|
|
|
*/ |
28
|
|
|
public function createPaymentsTable(): BraintreeTableInterface |
29
|
|
|
{ |
30
|
|
|
$paymentBraintreeQuery = $this->getQueryContainer()->queryPayments(); |
31
|
|
|
|
32
|
|
|
return new Payments($paymentBraintreeQuery); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param int $idPayment |
37
|
|
|
* |
38
|
|
|
* @return \SprykerEco\Zed\Braintree\Communication\Table\BraintreeTableInterface |
39
|
|
|
*/ |
40
|
|
|
public function createRequestLogTable(int $idPayment): BraintreeTableInterface |
41
|
|
|
{ |
42
|
|
|
$requestLogQuery = $this->getQueryContainer()->queryTransactionRequestLogByPaymentId($idPayment); |
43
|
|
|
|
44
|
|
|
return new RequestLog($requestLogQuery, $idPayment); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param int $idPayment |
49
|
|
|
* |
50
|
|
|
* @return \SprykerEco\Zed\Braintree\Communication\Table\BraintreeTableInterface |
51
|
|
|
*/ |
52
|
|
|
public function createStatusLogTable(int $idPayment): BraintreeTableInterface |
53
|
|
|
{ |
54
|
|
|
$statusLogQuery = $this->getQueryContainer()->queryTransactionStatusLogByPaymentId($idPayment); |
55
|
|
|
|
56
|
|
|
return new StatusLog($statusLogQuery, $idPayment); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|