mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 12:04:35 -04:00
Fixes for payment number creation for online payments
This commit is contained in:
parent
3850c6b516
commit
05ce11138e
@ -268,7 +268,7 @@ class BasePaymentDriver
|
|||||||
$payment->currency_id = $this->client->getSetting('currency_id');
|
$payment->currency_id = $this->client->getSetting('currency_id');
|
||||||
$payment->date = Carbon::now();
|
$payment->date = Carbon::now();
|
||||||
|
|
||||||
return $payment;
|
return $payment->service()->applyNumber()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,9 +393,8 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$payment->date = Carbon::now();
|
$payment->date = Carbon::now();
|
||||||
$payment->transaction_reference = $data['transaction_reference'];
|
$payment->transaction_reference = $data['transaction_reference'];
|
||||||
$payment->amount = $amount;
|
$payment->amount = $amount;
|
||||||
$payment->client->getNextPaymentNumber($this->client);
|
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
return $payment;
|
return $payment->service()->applyNumber()->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class HtmlEngine
|
|||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_invoice').'</a>', 'label' => ctrans('texts.view_invoice')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_invoice')];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class HtmlEngine
|
|||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_quote')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->entity_string == 'credit') {
|
if ($this->entity_string == 'credit') {
|
||||||
@ -142,7 +142,7 @@ class HtmlEngine
|
|||||||
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
$data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')];
|
||||||
$data['$terms'] = &$data['$entity.terms'];
|
$data['$terms'] = &$data['$entity.terms'];
|
||||||
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
// $data['$view_link'] = ['value' => '<a href="' .$this->invitation->getLink() .'">'. ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
|
||||||
$data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
$data['$view_link'] = ['value' => $this->invitation->getLink(), 'label' => ctrans('texts.view_credit')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['$entity_number'] = &$data['$number'];
|
$data['$entity_number'] = &$data['$number'];
|
||||||
|
10
database/factories/QuoteInvitationFactory.php
Normal file
10
database/factories/QuoteInvitationFactory.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
$factory->define(App\Models\QuoteInvitation::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'key' => Str::random(40),
|
||||||
|
];
|
||||||
|
});
|
@ -154,7 +154,7 @@ trait MockAccountData
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$contact = factory(\App\Models\ClientContact::class, 1)->create([
|
$contact = factory(\App\Models\ClientContact::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
@ -162,12 +162,13 @@ trait MockAccountData
|
|||||||
'send_email' => true,
|
'send_email' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$contact2 = factory(\App\Models\ClientContact::class, 1)->create([
|
$contact2 = factory(\App\Models\ClientContact::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
'client_id' => $this->client->id,
|
'client_id' => $this->client->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'send_email' => true
|
'send_email' => true
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
// $rels = collect($contact, $contact2);
|
// $rels = collect($contact, $contact2);
|
||||||
// $this->client->setRelation('contacts', $rels);
|
// $this->client->setRelation('contacts', $rels);
|
||||||
@ -211,7 +212,24 @@ trait MockAccountData
|
|||||||
|
|
||||||
$this->invoice->save();
|
$this->invoice->save();
|
||||||
|
|
||||||
$this->invoice->service()->createInvitations()->markSent();
|
//$this->invoice->service()->createInvitations()->markSent();
|
||||||
|
//$this->invoice->service()->createInvitations();
|
||||||
|
|
||||||
|
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact->id,
|
||||||
|
'invoice_id' => $this->invoice->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
factory(\App\Models\InvoiceInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact2->id,
|
||||||
|
'invoice_id' => $this->invoice->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->invoice->service()->markSent();
|
||||||
|
|
||||||
$this->quote = factory(\App\Models\Quote::class)->create([
|
$this->quote = factory(\App\Models\Quote::class)->create([
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
@ -229,8 +247,24 @@ trait MockAccountData
|
|||||||
|
|
||||||
$this->quote = $this->quote_calc->getQuote();
|
$this->quote = $this->quote_calc->getQuote();
|
||||||
|
|
||||||
|
$this->quote->status_id = Quote::STATUS_SENT;
|
||||||
$this->quote->number = $this->getNextQuoteNumber($this->client);
|
$this->quote->number = $this->getNextQuoteNumber($this->client);
|
||||||
$this->quote->service()->createInvitations()->markSent();
|
|
||||||
|
//$this->quote->service()->createInvitations()->markSent();
|
||||||
|
|
||||||
|
factory(\App\Models\QuoteInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact->id,
|
||||||
|
'quote_id' => $this->quote->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
factory(\App\Models\QuoteInvitation::class)->create([
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'client_contact_id' => $contact2->id,
|
||||||
|
'quote_id' => $this->quote->id,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->quote->setRelation('client', $this->client);
|
$this->quote->setRelation('client', $this->client);
|
||||||
$this->quote->setRelation('company', $this->company);
|
$this->quote->setRelation('company', $this->company);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user