Fixes for WePay

This commit is contained in:
David Bomba 2022-11-02 13:48:32 +11:00
parent befc9170fb
commit 8846f7537c
4 changed files with 8 additions and 5 deletions

View File

@ -31,7 +31,7 @@ class ExpenseTransformer extends BaseTransformer
return [ return [
'company_id' => $this->company->id, 'company_id' => $this->company->id,
'amount' => $this->getFloat($data, 'expense.amount'), 'amount' => abs($this->getFloat($data, 'expense.amount')),
'currency_id' => $this->getCurrencyByCode( 'currency_id' => $this->getCurrencyByCode(
$data, $data,
'expense.currency_id' 'expense.currency_id'

View File

@ -133,7 +133,10 @@ class NinjaMailerJob implements ShouldQueue
$this->nmo = null; $this->nmo = null;
$this->company = null; $this->company = null;
app('queue.worker')->shouldQuit = 1;
$mem_usage = memory_get_usage();
nlog('The script is now using: ' . round($mem_usage / 1024) . 'KBof memory.');
} catch (\Exception | \RuntimeException | \Google\Service\Exception $e) { } catch (\Exception | \RuntimeException | \Google\Service\Exception $e) {

View File

@ -41,7 +41,7 @@ class ACH
public function authorizeView($data) public function authorizeView($data)
{ {
$data['gateway'] = $this->wepay_payment_driver; $data['gateway'] = $this->wepay_payment_driver;
$data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2; $data['country_code'] = $this->wepay_payment_driver?->client?->country ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
return render('gateways.wepay.authorize.bank_transfer', $data); return render('gateways.wepay.authorize.bank_transfer', $data);
} }

View File

@ -37,7 +37,7 @@ class CreditCard
public function authorizeView($data) public function authorizeView($data)
{ {
$data['gateway'] = $this->wepay_payment_driver; $data['gateway'] = $this->wepay_payment_driver;
$data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2; $data['country_code'] = $this->wepay_payment_driver?->client?->country ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
return render('gateways.wepay.authorize.authorize', $data); return render('gateways.wepay.authorize.authorize', $data);
} }
@ -102,7 +102,7 @@ class CreditCard
{ {
$data['gateway'] = $this->wepay_payment_driver; $data['gateway'] = $this->wepay_payment_driver;
$data['description'] = ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number'); $data['description'] = ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number');
$data['country_code'] = $this->wepay_payment_driver->client ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2; $data['country_code'] = $this->wepay_payment_driver?->client?->country ? $this->wepay_payment_driver->client->country->iso_3166_2 : $this->wepay_payment_driver->company_gateway->company()->iso_3166_2;
return render('gateways.wepay.credit_card.pay', $data); return render('gateways.wepay.credit_card.pay', $data);
} }