2017-04-04 16:51:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Intents\WebApp;
|
|
|
|
|
|
|
|
use App\Ninja\Intents\BaseIntent;
|
|
|
|
|
|
|
|
class CreatePaymentIntent extends BaseIntent
|
|
|
|
{
|
|
|
|
public function process()
|
|
|
|
{
|
2017-04-04 20:08:35 +02:00
|
|
|
$clientPublicId = 0;
|
|
|
|
$invoicePublicId = 0;
|
|
|
|
|
|
|
|
if ($invoice = $this->requestInvoice()) {
|
|
|
|
$invoicePublicId = $invoice->public_id;
|
|
|
|
} elseif ($client = $this->requestClient()) {
|
|
|
|
$clientPublicId = $client->public_id;
|
|
|
|
}
|
2017-04-04 16:51:01 +02:00
|
|
|
|
|
|
|
//$invoiceItems = $this->requestInvoiceItems();
|
|
|
|
|
2017-04-04 20:08:35 +02:00
|
|
|
$url = sprintf('/payments/create/%s/%s', $clientPublicId, $invoicePublicId);
|
2017-04-04 16:51:01 +02:00
|
|
|
//$url .= $this->requestFieldsAsString(Invoice::$requestFields);
|
|
|
|
|
|
|
|
return redirect($url);
|
|
|
|
}
|
|
|
|
}
|