1 | <?php |
||
2 | |||
3 | namespace ByTIC\Omnipay\Twispay\Message\Traits; |
||
4 | |||
5 | use ByTIC\Omnipay\Common\Message\Traits\GatewayNotificationResponseTrait; |
||
6 | |||
7 | /** |
||
8 | * Trait CompletePurchaseResponseTrait |
||
9 | * @package ByTIC\Omnipay\Twispay\Message\Traits |
||
10 | */ |
||
11 | trait CompletePurchaseResponseTrait |
||
12 | { |
||
13 | use GatewayNotificationResponseTrait; |
||
14 | |||
15 | /** |
||
16 | * @inheritdoc |
||
17 | */ |
||
18 | View Code Duplication | public function isSuccessful() |
|
0 ignored issues
–
show
|
|||
19 | { |
||
20 | if ($this->hasNotificationDataItem('status') |
||
21 | && $this->getNotificationDataItem('status') == 'complete-ok' |
||
22 | ) { |
||
23 | return true; |
||
24 | } |
||
25 | if ($this->hasNotificationDataItem('transactionStatus') |
||
26 | && $this->getNotificationDataItem('transactionStatus') == 'complete-ok' |
||
27 | ) { |
||
28 | return true; |
||
29 | } |
||
30 | return parent::isSuccessful(); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | View Code Duplication | public function isPending() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
37 | { |
||
38 | if ($this->hasNotificationDataItem('status') && $this->getNotificationDataItem('status') == 'in-progress') { |
||
39 | return true; |
||
40 | } |
||
41 | if ($this->hasNotificationDataItem('transactionStatus') |
||
42 | && $this->getNotificationDataItem('transactionStatus') == 'in-progress' |
||
43 | ) { |
||
44 | return true; |
||
45 | } |
||
46 | return parent::isPending(); |
||
47 | } |
||
48 | } |
||
49 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.