2020-08-12 00:17:32 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Payment Ninja (https://paymentninja.com).
|
2020-08-12 00:17:32 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/paymentninja/paymentninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Payment Ninja LLC (https://paymentninja.com)
|
2020-08-12 00:17:32 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Services\Payment;
|
|
|
|
|
|
|
|
use App\Models\Payment;
|
|
|
|
use App\Services\AbstractService;
|
|
|
|
use App\Utils\Traits\GeneratesCounter;
|
|
|
|
|
|
|
|
class ApplyNumber extends AbstractService
|
|
|
|
{
|
|
|
|
use GeneratesCounter;
|
|
|
|
|
|
|
|
private $payment;
|
|
|
|
|
|
|
|
public function __construct(Payment $payment)
|
|
|
|
{
|
|
|
|
$this->client = $payment->client;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-08-12 00:17:32 +02:00
|
|
|
$this->payment = $payment;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
if ($this->payment->number != '') {
|
|
|
|
return $this->payment;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->payment->number = $this->getNextPaymentNumber($this->client);
|
|
|
|
|
|
|
|
return $this->payment;
|
|
|
|
}
|
|
|
|
}
|