diff --git a/app/Models/AccountGateway.php b/app/Models/AccountGateway.php index ceafdbc01c..f102d4e16f 100644 --- a/app/Models/AccountGateway.php +++ b/app/Models/AccountGateway.php @@ -2,6 +2,8 @@ namespace App\Models; +use Utils; +use HTMLUtils; use Crypt; use Illuminate\Database\Eloquent\SoftDeletes; use Laracasts\Presenter\PresentableTrait; @@ -291,4 +293,22 @@ class AccountGateway extends EntityModel return $this->getConfigField('testMode'); } } + + public function getCustomHtml($invitation) + { + $text = $this->getConfigField('text'); + + if ($text == strip_tags($text)) { + $text = nl2br($text); + } + + if (Utils::isNinja()) { + $text = HTMLUtils::sanitizeHTML($text); + } + + $templateService = app('App\Services\TemplateService'); + $text = $templateService->processVariables($text, ['invitation' => $invitation]); + + return $text; + } } diff --git a/app/Ninja/PaymentDrivers/Custom1PaymentDriver.php b/app/Ninja/PaymentDrivers/Custom1PaymentDriver.php new file mode 100644 index 0000000000..3520e88823 --- /dev/null +++ b/app/Ninja/PaymentDrivers/Custom1PaymentDriver.php @@ -0,0 +1,13 @@ +account; + + /** @var \App\Models\Client $client */ + $client = ! empty($data['client']) ? $data['client'] : $invitation->invoice->client; + + $amount = ! empty($data['amount']) ? $data['amount'] : $invitation->invoice->getRequestedAmount(); + // check if it's a proposal if ($invitation->proposal) { $invoice = $invitation->proposal->invoice; @@ -59,7 +61,7 @@ class TemplateService '$invoiceDate' => $account->formatDate($invoice->invoice_date), '$contact' => $contact->getDisplayName(), '$firstName' => $contact->first_name, - '$amount' => $account->formatMoney($data['amount'], $client), + '$amount' => $account->formatMoney($amount, $client), '$total' => $invoice->present()->amount, '$balance' => $invoice->present()->balance, '$invoice' => $invoice->invoice_number, diff --git a/resources/views/invited/custom_gateway.blade.php b/resources/views/invited/custom_gateway.blade.php new file mode 100644 index 0000000000..7ec6e3f0ef --- /dev/null +++ b/resources/views/invited/custom_gateway.blade.php @@ -0,0 +1,16 @@ +