Payment notifications for autobilling

This commit is contained in:
David Bomba 2021-01-27 21:56:50 +11:00
parent b4bf6cc760
commit 9b72acf506
6 changed files with 13 additions and 24 deletions

View File

@ -19,20 +19,6 @@ use Illuminate\Database\Eloquent\Builder;
*/
class DocumentFilters extends QueryFilters
{
public function type_id(int $type_id) :Builder
{
return $this->builder->where('type_id', $type_id);
}
public function category_id(int $category_id) :Builder
{
return $this->builder->where('category_id', $category_id);
}
public function event_id(int $event_id) :Builder
{
return $this->builder->where('event_id', $event_id);
}
public function client_id(int $client_id) :Builder
{

View File

@ -104,6 +104,7 @@ class BaseController extends Controller
'user.company_user',
'token',
'company.activities',
'company.documents',
//'company.users.company_user',
'company.tax_rates',
'company.groups',
@ -183,7 +184,10 @@ class BaseController extends Controller
protected function refreshResponse($query)
{
$this->manager->parseIncludes($this->first_load);
if (auth()->user()->getCompany()->is_large)
$this->manager->parseIncludes($this->mini_load);
else
$this->manager->parseIncludes($this->first_load);
$this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY;
@ -196,9 +200,9 @@ class BaseController extends Controller
$transformer = new $this->entity_transformer($this->serializer);
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) {
return response()->json(['message' => ctrans('texts.large_account_update_parameter'), 'errors' =>[]], 401);
}
// if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) {
// return response()->json(['message' => ctrans('texts.large_account_update_parameter'), 'errors' =>[]], 401);
// }
$updated_at = date('Y-m-d H:i:s', $updated_at);

View File

@ -80,6 +80,7 @@ class SendRecurring implements ShouldQueue
}
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) {
nlog("attempting to autobill {$invoice->number}");
$invoice->service()->autoBill()->save();
}

View File

@ -91,13 +91,13 @@ class CompanyPresenter extends EntityPresenter
}
}
public function getSpcQrCode($client_custom, $invoice_number, $balance)
public function getSpcQrCode($client_currency, $invoice_number, $balance)
{
$settings = $this->entity->settings;
return
"SPC\n0200\n1\nCH860021421411198240K\nK\n{$this->name}\n{$settings->address1}\n{$settings->postal_code} {$settings->city}\n\n\nCH\n\n\n\n\n\n\n\n{$balance}\n{$client_custom}\n\n\n\n\n\n\n\nNON\n\n{$invoice_number}\nEPD\n";
"SPC\n0200\n1\nCH860021421411198240K\nK\n{$this->name}\n{$settings->address1}\n{$settings->postal_code} {$settings->city}\n\n\nCH\n\n\n\n\n\n\n\n{$balance}\n{$client_currency}\n\n\n\n\n\n\n\nNON\n\n{$invoice_number}\nEPD\n";
}
}

View File

@ -175,10 +175,8 @@ class StripePaymentDriver extends BaseDriver
return $this->payment_method->paymentView($data);
}
public function processPaymentResponse($request) //We never have to worry about unsuccessful payments as failures are handled at the front end for this driver.
public function processPaymentResponse($request)
{
$this->setPaymentHash($request->payment_hash);
return $this->payment_method->paymentResponse($request);
}

View File

@ -276,7 +276,7 @@ class HtmlEngine
$data['$company.website'] = ['value' => $this->settings->website ?: ' ', 'label' => ctrans('texts.website')];
$data['$company.address'] = ['value' => $this->company->present()->address($this->settings) ?: ' ', 'label' => ctrans('texts.address')];
$data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->custom1, $this->entity->number, $this->entity->balance), 'label' => ''];
$data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->currency()->code, $this->entity->number, $this->entity->balance), 'label' => ''];
$logo = $this->company->present()->logo($this->settings);