-
Notifications
You must be signed in to change notification settings - Fork 0
/
C2A.php
56 lines (46 loc) · 1.43 KB
/
C2A.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Wearesho\Bobra\Platon\Payment;
use Wearesho\Bobra\Payments\PayerDetailsInterface;
use Wearesho\Bobra\Payments\UrlPairInterface;
use Wearesho\Bobra\Platon;
class C2A extends Platon\Payment
{
public const TYPE = 'C2A,CC';
public const TYPE_CARD_TOKEN = 'C2AT,CCT';
protected string $amount;
protected string $description;
protected string $currency;
public function __construct(
int $id,
string $lang,
UrlPairInterface $urlPair,
PayerDetailsInterface $payerDetails,
string $sign,
string $key,
string $formUrl,
string $amount,
string $description,
string $currency,
array $ext = [],
string $formId = null,
string $cardToken = null
) {
parent::__construct($id, $lang, $urlPair, $payerDetails, $sign, $key, $formUrl, $ext, $formId, $cardToken);
$this->amount = $amount;
$this->description = $description;
$this->currency = $currency;
}
public function jsonSerialize(): array
{
$json = parent::jsonSerialize();
$json['data'] = array_merge($json['data'] ?? [], [
'amount' => $this->amount,
'description' => $this->description,
'currency' => $this->currency,
]);
if (!is_null($this->cardToken)) {
$json['data']['payment'] = static::TYPE_CARD_TOKEN;
}
return $json;
}
}