diff --git a/app/Http/Requests/Invoice/ActionInvoiceRequest.php b/app/Http/Requests/Invoice/ActionInvoiceRequest.php index 15d6d230081e..0196c1bdc012 100644 --- a/app/Http/Requests/Invoice/ActionInvoiceRequest.php +++ b/app/Http/Requests/Invoice/ActionInvoiceRequest.php @@ -30,7 +30,7 @@ class ActionInvoiceRequest extends Request private $invoice; public function authorize() : bool - { + { return auth()->user()->can('edit', $this->invoice); } diff --git a/app/PaymentDrivers/Authorize/AuthorizeCustomer.php b/app/PaymentDrivers/Authorize/AuthorizeCustomer.php index a81522489465..34c5eaf5c9c8 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCustomer.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCustomer.php @@ -115,15 +115,15 @@ class AuthorizeCustomer //if the profile ID already exists in ClientGatewayToken we continue else - add. if($client_gateway_token = ClientGatewayToken::where('company_id', $company->id)->where('gateway_customer_reference', $gateway_customer_reference)->first()){ - nlog("found client"); + // nlog("found client"); $client = $client_gateway_token->client; } elseif($client_contact = ClientContact::where('company_id', $company->id)->where('email', $profile['email'])->first()){ $client = $client_contact->client; - nlog("found client through contact"); + // nlog("found client through contact"); } else { - nlog("creating client"); + // nlog("creating client"); $first_payment_profile = $profile['payment_profiles'][0]; @@ -148,14 +148,25 @@ class AuthorizeCustomer $client_contact->save(); } - if($client){ + if($client && is_array($profile['payment_profiles'])){ $this->authorize->setClient($client); foreach($profile['payment_profiles'] as $payment_profile) { + $token_exists = ClientGatewayToken::where('company_id', $company->id) + ->where('token', $payment_profile->getCustomerPaymentProfileId()) + ->where('gateway_customer_reference', $gateway_customer_reference) + ->exists(); + if($token_exists) + continue; + +// $expiry = $payment_profile->getPayment()->getCreditCard()->getExpirationDate(); + $payment_meta = new \stdClass; + $payment_meta->exp_month = 'xx'; + $payment_meta->exp_year = 'xx'; $payment_meta->brand = (string) $payment_profile->getPayment()->getCreditCard()->getCardType(); $payment_meta->last4 = (string) $payment_profile->getPayment()->getCreditCard()->getCardNumber(); $payment_meta->type = GatewayType::CREDIT_CARD; @@ -171,10 +182,7 @@ class AuthorizeCustomer } } - //iterate through auth.net list - - //exclude any existing customers (ie. only import their missing payment profiles) - + } private function getCountryCode($country_code) diff --git a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php index 26a1b9d6aa48..3910fc487119 100644 --- a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php +++ b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php @@ -130,6 +130,7 @@ class AuthorizePaymentMethod public function buildPaymentMethod($payment_profile) { + $payment_meta = new stdClass; $payment_meta->exp_month = 'xx'; $payment_meta->exp_year = 'xx'; diff --git a/app/Providers/MailCssInlinerServiceProvider.php b/app/Providers/MailCssInlinerServiceProvider.php index ca9f3fb71cf8..a3e223a4a1e8 100644 --- a/app/Providers/MailCssInlinerServiceProvider.php +++ b/app/Providers/MailCssInlinerServiceProvider.php @@ -41,10 +41,5 @@ class MailCssInlinerServiceProvider extends ServiceProvider $this->app->singleton(CssInlinerPlugin::class, function ($app) { return new CssInlinerPlugin([]); }); - - // $this->app->afterResolving('mail.manager', function (MailManager $mailManager) { - // $mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class)); - // return $mailManager; - // }); } } diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 73be66a214a6..dba31cfb1c7e 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -491,7 +491,8 @@ class HtmlEngine //$data['$entity_footer'] = ['value' => $this->client->getSetting("{$this->entity_string}_footer"), 'label' => '']; $data['$entity_footer'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->footer), $this->client), 'label' => '']; - + $data['$footer'] = &$data['$entity_footer']; + $data['$page_size'] = ['value' => $this->settings->page_size, 'label' => '']; $data['$page_layout'] = ['value' => property_exists($this->settings, 'page_layout') ? $this->settings->page_layout : 'Portrait', 'label' => ''];