| Total Complexity | 7 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class LaravelBitpay |
||
| 12 | { |
||
| 13 | use LaravelBitpayTrait; |
||
| 14 | public $client; |
||
| 15 | public $config; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * LaravelBitpay constructor. |
||
| 19 | */ |
||
| 20 | public function __construct() |
||
| 21 | { |
||
| 22 | $this->authenticate(); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @return \BitPaySDK\Model\Invoice\Invoice |
||
| 27 | */ |
||
| 28 | public static function Invoice(): Invoice |
||
| 29 | { |
||
| 30 | return new Invoice(); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param \BitPaySDK\Model\Invoice\Invoice $invoice |
||
| 35 | * |
||
| 36 | * @return \BitPaySDK\Model\Invoice\Invoice |
||
| 37 | */ |
||
| 38 | public static function createInvoice(Invoice $invoice): Invoice |
||
| 39 | { |
||
| 40 | if ('' == $invoice->getNotificationURL()) { |
||
| 41 | $invoice->setNotificationURL(route('laravel-bitpay.webhook.capture')); |
||
|
|
|||
| 42 | } |
||
| 43 | |||
| 44 | return (new self())->client->createInvoice($invoice); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return \BitPaySDK\Model\Bill\Item |
||
| 49 | */ |
||
| 50 | public static function Item(): Item |
||
| 51 | { |
||
| 52 | return new Item(); |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return \BitPaySDK\Model\Invoice\Buyer |
||
| 57 | */ |
||
| 58 | public static function Buyer(): Buyer |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param null $code |
||
| 65 | * |
||
| 66 | * @return \Bitpay\Model\Currency |
||
| 67 | */ |
||
| 68 | public static function Currency($code = null): Currency |
||
| 71 | } |
||
| 72 | } |
||
| 73 |