1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00

Merge pull request #4907 from beganovich/v5-1502-pull-invoicee-from-hash

(v5) Custom payment driver: Pull invoices from payment hash
This commit is contained in:
Benjamin Beganović 2021-02-15 11:46:15 +01:00 committed by GitHub
commit c4e85bc2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,11 +57,14 @@ class CustomPaymentDriver extends BaseDriver
*/
public function processPaymentView($data)
{
$invitation = Invoice::findOrFail(
$this->decodePrimaryKey($data['invoices']['0']['invoice_id'])
)->invitations->first();
$variables = [];
$variables = (new HtmlEngine($invitation))->generateLabelsAndValues();
if (count($this->payment_hash->invoices()) > 0) {
$invoice_id = $this->decodePrimaryKey($this->payment_hash->invoices()[0]->invoice_id);
$invoice = Invoice::findOrFail($invoice_id);
$variables = (new HtmlEngine($invoice->invitations->first()))->generateLabelsAndValues();
}
$data['title'] = $this->company_gateway->getConfigField('name');
$data['instructions'] = strtr($this->company_gateway->getConfigField('text'), $variables['values']);