|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Yansongda\Pay\Config; |
|
6
|
|
|
|
|
7
|
|
|
class DouyinConfig implements ConfigInterface |
|
8
|
|
|
{ |
|
9
|
|
|
public function __construct( |
|
10
|
|
|
public string $mini_app_id, |
|
11
|
|
|
public string $mch_secret_token, |
|
12
|
|
|
public string $mch_secret_salt, |
|
13
|
|
|
public string $mch_id = '', |
|
14
|
|
|
public string $thirdparty_id = '', |
|
15
|
|
|
public string $notify_url = '', |
|
16
|
|
|
) { |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function toArray(): array |
|
20
|
|
|
{ |
|
21
|
|
|
return [ |
|
22
|
|
|
'mch_id' => $this->mch_id, |
|
23
|
|
|
'mch_secret_token' => $this->mch_secret_token, |
|
24
|
|
|
'mch_secret_salt' => $this->mch_secret_salt, |
|
25
|
|
|
'mini_app_id' => $this->mini_app_id, |
|
26
|
|
|
'thirdparty_id' => $this->thirdparty_id, |
|
27
|
|
|
'notify_url' => $this->notify_url, |
|
28
|
|
|
]; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public static function fromArray(array $config): self |
|
32
|
|
|
{ |
|
33
|
|
|
return new self( |
|
34
|
|
|
mini_app_id: $config['mini_app_id'] ?? '', |
|
35
|
|
|
mch_secret_token: $config['mch_secret_token'] ?? '', |
|
36
|
|
|
mch_secret_salt: $config['mch_secret_salt'] ?? '', |
|
37
|
|
|
mch_id: $config['mch_id'] ?? '', |
|
38
|
|
|
thirdparty_id: $config['thirdparty_id'] ?? '', |
|
39
|
|
|
notify_url: $config['notify_url'] ?? '', |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|