|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Payone\Business\Payment\MethodMapper; |
|
9
|
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\OrderTransfer; |
|
|
|
|
|
|
11
|
|
|
use Orm\Zed\Payone\Persistence\SpyPaymentPayone; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Shared\Payone\PayoneApiConstants; |
|
13
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer; |
|
14
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\PrepaymentContainer; |
|
15
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PersonalContainer; |
|
16
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer; |
|
17
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainer; |
|
18
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface; |
|
19
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainer; |
|
20
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface; |
|
21
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainer; |
|
22
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface; |
|
23
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainer; |
|
24
|
|
|
use SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface; |
|
25
|
|
|
|
|
26
|
|
|
class Prepayment extends AbstractMapper |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* @return string |
|
30
|
|
|
*/ |
|
31
|
|
|
public function getName(): string |
|
32
|
|
|
{ |
|
33
|
|
|
return PayoneApiConstants::PAYMENT_METHOD_PREPAYMENT; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
38
|
|
|
* @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer |
|
39
|
|
|
* |
|
40
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\AuthorizationContainer |
|
41
|
|
|
*/ |
|
42
|
|
|
public function mapPaymentToAuthorization(SpyPaymentPayone $paymentEntity, OrderTransfer $orderTransfer): AbstractAuthorizationContainer |
|
43
|
|
|
{ |
|
44
|
|
|
$authorizationContainer = new AuthorizationContainer(); |
|
45
|
|
|
$authorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $authorizationContainer); |
|
46
|
|
|
|
|
47
|
|
|
return $authorizationContainer; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
52
|
|
|
* |
|
53
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\CaptureContainerInterface |
|
54
|
|
|
*/ |
|
55
|
|
|
public function mapPaymentToCapture(SpyPaymentPayone $paymentEntity): CaptureContainerInterface |
|
56
|
|
|
{ |
|
57
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
58
|
|
|
|
|
59
|
|
|
$captureContainer = new CaptureContainer(); |
|
60
|
|
|
$captureContainer->setAmount($paymentDetailEntity->getAmount()); |
|
61
|
|
|
$captureContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
62
|
|
|
$captureContainer->setTxid($paymentEntity->getTransactionId()); |
|
63
|
|
|
$captureContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
64
|
|
|
|
|
65
|
|
|
return $captureContainer; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
70
|
|
|
* |
|
71
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\PreAuthorizationContainerInterface |
|
72
|
|
|
*/ |
|
73
|
|
|
public function mapPaymentToPreAuthorization(SpyPaymentPayone $paymentEntity): PreAuthorizationContainerInterface |
|
74
|
|
|
{ |
|
75
|
|
|
$preAuthorizationContainer = new PreAuthorizationContainer(); |
|
76
|
|
|
$preAuthorizationContainer = $this->mapPaymentToAbstractAuthorization($paymentEntity, $preAuthorizationContainer); |
|
77
|
|
|
|
|
78
|
|
|
return $preAuthorizationContainer; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
83
|
|
|
* @param \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer $authorizationContainer |
|
84
|
|
|
* |
|
85
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\AbstractAuthorizationContainer |
|
86
|
|
|
*/ |
|
87
|
|
|
protected function mapPaymentToAbstractAuthorization(SpyPaymentPayone $paymentEntity, AbstractAuthorizationContainer $authorizationContainer) |
|
88
|
|
|
{ |
|
89
|
|
|
$paymentDetailEntity = $paymentEntity->getSpyPaymentPayoneDetail(); |
|
90
|
|
|
|
|
91
|
|
|
$authorizationContainer->setAid($this->getStandardParameter()->getAid()); |
|
92
|
|
|
$authorizationContainer->setClearingType(PayoneApiConstants::CLEARING_TYPE_PREPAYMENT); |
|
93
|
|
|
$authorizationContainer->setReference($paymentEntity->getReference()); |
|
94
|
|
|
$authorizationContainer->setAmount($paymentDetailEntity->getAmount()); |
|
95
|
|
|
$authorizationContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
96
|
|
|
$authorizationContainer->setPaymentMethod($this->createPaymentMethodContainerFromPayment()); |
|
97
|
|
|
|
|
98
|
|
|
$personalContainer = new PersonalContainer(); |
|
99
|
|
|
$this->mapBillingAddressToPersonalContainer($personalContainer, $paymentEntity); |
|
100
|
|
|
|
|
101
|
|
|
$authorizationContainer->setPersonalData($personalContainer); |
|
102
|
|
|
|
|
103
|
|
|
return $authorizationContainer; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
108
|
|
|
* |
|
109
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\DebitContainerInterface |
|
110
|
|
|
*/ |
|
111
|
|
|
public function mapPaymentToDebit(SpyPaymentPayone $paymentEntity): DebitContainerInterface |
|
112
|
|
|
{ |
|
113
|
|
|
$debitContainer = new DebitContainer(); |
|
114
|
|
|
|
|
115
|
|
|
$debitContainer->setTxid($paymentEntity->getTransactionId()); |
|
116
|
|
|
$debitContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
117
|
|
|
$debitContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
118
|
|
|
$debitContainer->setAmount($paymentEntity->getSpyPaymentPayoneDetail()->getAmount()); |
|
119
|
|
|
|
|
120
|
|
|
return $debitContainer; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param \Orm\Zed\Payone\Persistence\SpyPaymentPayone $paymentEntity |
|
125
|
|
|
* |
|
126
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\RefundContainerInterface |
|
127
|
|
|
*/ |
|
128
|
|
|
public function mapPaymentToRefund(SpyPaymentPayone $paymentEntity): RefundContainerInterface |
|
129
|
|
|
{ |
|
130
|
|
|
$refundContainer = new RefundContainer(); |
|
131
|
|
|
|
|
132
|
|
|
$refundContainer->setTxid($paymentEntity->getTransactionId()); |
|
133
|
|
|
$refundContainer->setSequenceNumber($this->getNextSequenceNumber($paymentEntity->getTransactionId())); |
|
134
|
|
|
$refundContainer->setCurrency($this->getStandardParameter()->getCurrency()); |
|
135
|
|
|
|
|
136
|
|
|
$refundContainer->setBankcountry($paymentEntity->getSpyPaymentPayoneDetail()->getBankCountry()); |
|
137
|
|
|
$refundContainer->setBankaccount($paymentEntity->getSpyPaymentPayoneDetail()->getBankAccount()); |
|
138
|
|
|
$refundContainer->setBankcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankCode()); |
|
139
|
|
|
$refundContainer->setBankbranchcode($paymentEntity->getSpyPaymentPayoneDetail()->getBankBranchCode()); |
|
140
|
|
|
$refundContainer->setBankcheckdigit($paymentEntity->getSpyPaymentPayoneDetail()->getBankCheckDigit()); |
|
141
|
|
|
$refundContainer->setIban($paymentEntity->getSpyPaymentPayoneDetail()->getIban()); |
|
142
|
|
|
$refundContainer->setBic($paymentEntity->getSpyPaymentPayoneDetail()->getBic()); |
|
143
|
|
|
|
|
144
|
|
|
return $refundContainer; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @return \SprykerEco\Zed\Payone\Business\Api\Request\Container\Authorization\PaymentMethod\PrepaymentContainer |
|
149
|
|
|
*/ |
|
150
|
|
|
protected function createPaymentMethodContainerFromPayment() |
|
151
|
|
|
{ |
|
152
|
|
|
$paymentMethodContainer = new PrepaymentContainer(); |
|
153
|
|
|
|
|
154
|
|
|
return $paymentMethodContainer; |
|
155
|
|
|
} |
|
156
|
|
|
} |
|
157
|
|
|
|
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