Skip to content

Commit 18a6ba1

Browse files
author
Vladimir Gelunov
committed
PE-868: WIP
1 parent 27d6b41 commit 18a6ba1

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/callback/Callback.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public function __construct($data, SignatureHandler $signatureHandler)
4141
);
4242
}
4343

44+
$this->setData($data);
45+
}
46+
47+
public function setData($data): DataContainer
48+
{
49+
parent::setData($data);
50+
4451
$payment = $this->getValue(self::PAYMENT_FIELD);
4552
if (!empty($payment)) {
4653
$this->payment = new Payment($payment);
@@ -50,6 +57,8 @@ public function __construct($data, SignatureHandler $signatureHandler)
5057
if (!empty($operation)) {
5158
$this->operation = new Operation($operation);
5259
}
60+
61+
return $this;
5362
}
5463

5564
public function getPayment(): ?Payment

src/callback/Payment.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ class Payment extends DataContainer
99
{
1010
public const DESCRIPTION = 'description';
1111
public const METHOD = 'method';
12+
public const AMOUNT = 'amount';
1213
public const STATUS = 'status';
1314
public const ID = 'id';
1415

1516
public function getStatus(): ?string
1617
{
17-
return $this->getData()[self::STATUS] ?? null;
18+
return $this->getValue(self::STATUS);
1819
}
1920

2021
public function isSuccess(): bool
@@ -26,4 +27,20 @@ public function getId(): ?string
2627
{
2728
return $this->getValue(self::ID);
2829
}
30+
31+
public function getDescription(): ?string
32+
{
33+
return $this->getValue(self::DESCRIPTION);
34+
}
35+
36+
public function getMethod(): ?string
37+
{
38+
return $this->getValue(self::METHOD);
39+
}
40+
41+
public function getAmount(): ?int
42+
{
43+
$amount = $this->getValue(self::AMOUNT);
44+
return $amount != null ? intval($amount) : null;
45+
}
2946
}

0 commit comments

Comments
 (0)