1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace PhpLightning\Invoice\Application; |
6
|
|
|
|
7
|
|
|
use PhpLightning\Invoice\Domain\CallbackUrl\CallbackUrlInterface; |
8
|
|
|
use PhpLightning\Invoice\Domain\CallbackUrl\LnAddressGeneratorInterface; |
9
|
|
|
use PhpLightning\Shared\Value\SendableRange; |
|
|
|
|
10
|
|
|
|
11
|
|
|
final class CallbackUrl implements CallbackUrlInterface |
12
|
|
|
{ |
13
|
|
|
private const TAG_PAY_REQUEST = 'payRequest'; |
14
|
|
|
|
15
|
|
|
public function __construct( |
16
|
|
|
private SendableRange $sendableRange, |
17
|
|
|
private LnAddressGeneratorInterface $lnAddressGenerator, |
18
|
|
|
private string $callback, |
19
|
|
|
) { |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function getCallbackUrl(string $username): array |
23
|
|
|
{ |
24
|
|
|
$lnAddress = $this->lnAddressGenerator->generate($username); |
25
|
|
|
// Modify the description if you want to custom it |
26
|
|
|
// This will be the description on the wallet that pays your ln address |
27
|
|
|
// TODO: Make this customizable from some external configuration file |
28
|
|
|
$description = 'Pay to ' . $lnAddress; |
29
|
|
|
|
30
|
|
|
// TODO: images not implemented yet; `',["image/jpeg;base64","' . base64_encode($response) . '"]';` |
31
|
|
|
$imageMetadata = ''; |
32
|
|
|
$metadata = '[["text/plain","' . $description . '"],["text/identifier","' . $lnAddress . '"]' . $imageMetadata . ']'; |
33
|
|
|
|
34
|
|
|
// payRequest json data, spec : https://github.com/lnurl/luds/blob/luds/06.md |
35
|
|
|
return [ |
36
|
|
|
'callback' => $this->callback, |
37
|
|
|
'maxSendable' => $this->sendableRange->max(), |
38
|
|
|
'minSendable' => $this->sendableRange->min(), |
39
|
|
|
'metadata' => $metadata, |
40
|
|
|
'tag' => self::TAG_PAY_REQUEST, |
41
|
|
|
'commentAllowed' => false, // TODO: Not implemented yet |
42
|
|
|
]; |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths