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

Fixes for WePay

This commit is contained in:
David Bomba 2022-10-05 11:21:55 +11:00
parent df0e9e0a73
commit f072b921c7
5 changed files with 29 additions and 14 deletions

View File

@ -40,7 +40,10 @@ class WePayController extends BaseController
$company = Company::where('company_key', $hash['company_key'])->firstOrFail();
$data['user_id'] = $user->id;
$data['company'] = $company;
$data['user_company'] = $company;
// $data['company_key'] = $company->company_key;
// $data['db'] = $company->db;
$wepay_driver = new WePayPaymentDriver(new CompanyGateway, null, null);

View File

@ -37,7 +37,7 @@ class AdjustProductInventory implements ShouldQueue
public array $old_invoice;
public function __construct(Company $company, Invoice $invoice, ?array $old_invoice = [])
public function __construct(Company $company, Invoice $invoice, $old_invoice = [])
{
$this->company = $company;
$this->invoice = $invoice;

View File

@ -27,7 +27,7 @@ class Setup
{
/*
'user_id',
'company',
'user_company',
*/
return render('gateways.wepay.signup.index', $data);

View File

@ -33,17 +33,29 @@ class DeletePayment
public function run()
{
\DB::connection(config('database.default'))->transaction(function () {
if ($this->payment->is_deleted) {
return $this->payment;
}
return $this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
$this->payment = Payment::withTrashed()->where('id', $this->payment->id)->lockForUpdate()->first();
$this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment
->updateCreditables() //return the credits first
->adjustInvoices()
->updateClient()
->deletePaymentables()
->cleanupPayment()
->save();
}, 2);
return $this->payment;
}
private function cleanupPayment()

View File

@ -7,7 +7,7 @@
<img src="{{ asset('images/wepay.svg') }}" alt="We Pay">
</div>
@livewire('wepay-signup', ['user_id' => $user_id, 'company' => $company])
@livewire('wepay-signup', ['user_id' => $user_id, 'company' => $user_company])
</div>
@endsection