|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author @jayS-de <[email protected]> |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\Payment; |
|
7
|
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\JsonObject; |
|
9
|
|
|
use Commercetools\Core\Model\Common\DateTimeDecorator; |
|
10
|
|
|
use Commercetools\Core\Model\Common\Money; |
|
11
|
|
|
use Commercetools\Core\Model\State\StateReference; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @package Commercetools\Core\Model\Payment |
|
15
|
|
|
* @link https://dev.commercetools.com/http-api-projects-payments.html#transaction |
|
16
|
|
|
* @method DateTimeDecorator getTimestamp() |
|
17
|
|
|
* @method Transaction setTimestamp(\DateTime $timestamp = null) |
|
18
|
|
|
* @method string getType() |
|
19
|
|
|
* @method Transaction setType(string $type = null) |
|
20
|
|
|
* @method Money getAmount() |
|
21
|
|
|
* @method Transaction setAmount(Money $amount = null) |
|
22
|
|
|
* @method string getInteractionId() |
|
23
|
|
|
* @method Transaction setInteractionId(string $interactionId = null) |
|
24
|
|
|
* @method string getId() |
|
25
|
|
|
* @method Transaction setId(string $id = null) |
|
26
|
|
|
* @method string getState() |
|
27
|
|
|
* @method Transaction setState(string $state = null) |
|
28
|
|
|
*/ |
|
29
|
|
|
class Transaction extends JsonObject |
|
30
|
|
|
{ |
|
31
|
|
|
const AUTHORIZATION = 'Authorization'; |
|
32
|
|
|
const CANCEL_AUTHORIZATION = 'CancelAuthorization'; |
|
33
|
|
|
const CHARGE = 'Charge'; |
|
34
|
|
|
const REFUND = 'Refund'; |
|
35
|
|
|
const CHARGE_BACK = 'Chargeback'; |
|
36
|
|
|
|
|
37
|
1 |
View Code Duplication |
public function fieldDefinitions() |
|
|
|
|
|
|
38
|
|
|
{ |
|
39
|
|
|
return [ |
|
40
|
1 |
|
'id' => [static::TYPE => 'string'], |
|
41
|
1 |
|
'state' => [static::TYPE => 'string'], |
|
42
|
|
|
'timestamp' => [ |
|
43
|
1 |
|
static::TYPE => '\DateTime', |
|
44
|
1 |
|
static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator' |
|
45
|
|
|
], |
|
46
|
1 |
|
'type' => [static::TYPE => 'string'], |
|
47
|
1 |
|
'amount' => [static::TYPE => '\Commercetools\Core\Model\Common\Money'], |
|
48
|
1 |
|
'interactionId' => [static::TYPE => 'string'], |
|
49
|
|
|
]; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
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.