diff --git a/app/Http/Controllers/ClientPortal/TempRouteController.php b/app/Http/Controllers/ClientPortal/TempRouteController.php index d29a2c432c19..3ae858a9e1a7 100644 --- a/app/Http/Controllers/ClientPortal/TempRouteController.php +++ b/app/Http/Controllers/ClientPortal/TempRouteController.php @@ -26,9 +26,8 @@ class TempRouteController extends Controller public function index(string $hash) { $data = []; - $data['html'] = Cache::get($hash); + $data['html'] = Cache::get($hash); return view('pdf.html', $data); - } } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index c45534fd427a..155d961a247c 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -199,9 +199,9 @@ class PreviewController extends BaseController ->design($design) ->build(); - if (config('ninja.phantomjs_pdf_generation')) { - return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true)); - } + if (config('ninja.phantomjs_pdf_generation')) { + return (new Phantom)->convertHtmlToPdf($maker->getCompiledHTML(true)); + } $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company()); diff --git a/app/Http/Livewire/Profile/Settings/NameWebsiteLogo.php b/app/Http/Livewire/Profile/Settings/NameWebsiteLogo.php index ea363872a9f0..ca8282b9e67f 100644 --- a/app/Http/Livewire/Profile/Settings/NameWebsiteLogo.php +++ b/app/Http/Livewire/Profile/Settings/NameWebsiteLogo.php @@ -10,12 +10,14 @@ class NameWebsiteLogo extends Component public $name; public $website; + public $phone; public $saved; public $rules = [ 'name' => ['required', 'min:3'], 'website' => ['required', 'url'], + 'phone' => ['required', 'string', 'max:255'], ]; public function mount() @@ -24,6 +26,7 @@ class NameWebsiteLogo extends Component 'profile' => auth()->user('contact')->client, 'name' => auth()->user('contact')->client->present()->name, 'website' => auth()->user('contact')->client->present()->website, + 'phone' => auth()->user('contact')->client->present()->phone, 'saved' => ctrans('texts.save'), ]); } @@ -37,9 +40,11 @@ class NameWebsiteLogo extends Component { $data = $this->validate($this->rules); - $this->profile - ->fill($data) - ->save(); + $this->profile->name = $data['name']; + $this->profile->website = $data['website']; + $this->profile->phone = $data['phone']; + + $this->profile->save(); $this->saved = ctrans('texts.saved_at', ['time' => now()->toTimeString()]); } diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index 1bd1a7373869..bb569ac62719 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -11,7 +11,6 @@ namespace App\Models; -use App\Models\TaxRate; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; @@ -58,7 +57,7 @@ class CompanyUser extends Pivot public function tax_rates() { - return $this->hasMany(TaxRate::class,'company_id', 'company_id'); + return $this->hasMany(TaxRate::class, 'company_id', 'company_id'); } public function account() diff --git a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php index 1dda822d2182..ae3e12cf6c12 100644 --- a/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php +++ b/app/PaymentDrivers/Authorize/AuthorizeCreditCard.php @@ -166,7 +166,8 @@ class AuthorizeCreditCard $payment_record = []; $payment_record['amount'] = $amount; - $payment_record['payment_type'] = PaymentType::CREDIT_CARD_OTHER;; + $payment_record['payment_type'] = PaymentType::CREDIT_CARD_OTHER; + ; $payment_record['transaction_reference'] = $response->getTransactionResponse()->getTransId(); $payment = $this->authorize->createPayment($payment_record); diff --git a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php index 8b1ab194a530..189d51d35de6 100644 --- a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php +++ b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php @@ -13,11 +13,8 @@ namespace App\PaymentDrivers\Authorize; use App\Exceptions\GenericPaymentDriverFailure; -use App\Models\ClientGatewayToken; use App\Models\GatewayType; use App\PaymentDrivers\AuthorizePaymentDriver; -use App\PaymentDrivers\Authorize\AuthorizeCreateCustomer; -use App\PaymentDrivers\Authorize\AuthorizeCreditCard; use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest; use net\authorize\api\contract\v1\CustomerAddressType; use net\authorize\api\contract\v1\CustomerPaymentProfileType; @@ -46,19 +43,16 @@ class AuthorizePaymentMethod public function authorizeView() { - if($this->authorize->payment_method instanceof AuthorizeCreditCard){ - + if ($this->authorize->payment_method instanceof AuthorizeCreditCard) { $this->payment_method_id = GatewayType::CREDIT_CARD; return $this->authorizeCreditCard(); - } // case GatewayType::BANK_TRANSFER: // return $this->authorizeBankTransfer(); // break; - } public function authorizeResponseView($request) @@ -116,7 +110,6 @@ class AuthorizePaymentMethod public function createClientGatewayToken($payment_profile, $gateway_customer_reference) { - $data = []; $additonal = []; diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 12c32023e486..6730c1ea947d 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -31,8 +31,8 @@ use App\Utils\Traits\MakesHash; use App\Utils\Traits\SystemLogTrait; use Checkout\Library\Exceptions\CheckoutHttpException; use Exception; -use Illuminate\Support\Carbon; use Illuminate\Http\Request; +use Illuminate\Support\Carbon; /** * Class BaseDriver. @@ -83,35 +83,43 @@ class BaseDriver extends AbstractPaymentDriver * Authorize a payment method. * * Returns a reusable token for storage for future payments - * + * * @param array $data * @return mixed Return a view for collecting payment method information */ - public function authorizeView(array $data) {} + public function authorizeView(array $data) + { + } /** * The payment authorization response - * - * @param Request $request + * + * @param Request $request * @return mixed Return a response for collecting payment method information */ - public function authorizeResponse(Request $request) {} + public function authorizeResponse(Request $request) + { + } /** * Process a payment - * - * @param array $data + * + * @param array $data * @return mixed Return a view for the payment */ - public function processPaymentView(array $data) {} + public function processPaymentView(array $data) + { + } /** * Process payment response - * + * * @param Request $request * @return mixed Return a response for the payment */ - public function processPaymentResponse(Request $request) {} + public function processPaymentResponse(Request $request) + { + } /** * Executes a refund attempt for a given amount with a transaction_reference. @@ -121,7 +129,9 @@ class BaseDriver extends AbstractPaymentDriver * @param bool $return_client_response Whether the method needs to return a response (otherwise we assume an unattended payment) * @return mixed */ - public function refund(Payment $payment, $amount, $return_client_response = false) {} + public function refund(Payment $payment, $amount, $return_client_response = false) + { + } /** * Process an unattended payment. @@ -130,14 +140,18 @@ class BaseDriver extends AbstractPaymentDriver * @param PaymentHash $payment_hash The Payment hash containing the payment meta data * @return void The payment response */ - public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash){} + public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) + { + } /** * Set the inbound request payment method type for access. * * @param int $payment_method_id The Payment Method ID */ - public function setPaymentMethod($payment_method_id){} + public function setPaymentMethod($payment_method_id) + { + } /************************** Helper methods *************************************/ @@ -334,9 +348,9 @@ class BaseDriver extends AbstractPaymentDriver /** * Wrapper method for checking if resource is good. - * - * @param mixed $resource - * @return bool + * + * @param mixed $resource + * @return bool */ public function checkRequiredResource($resource): bool { @@ -436,7 +450,7 @@ class BaseDriver extends AbstractPaymentDriver if (Str::startsWith($field, 'billing')) { unset($this->required_fields[$position]); } - } + } if ($this->checkRequiredResource(auth()->user('contact')->client->postal_code)) { $this->required_fields[] = 'postal_code'; diff --git a/app/PaymentDrivers/DriverTemplate.php b/app/PaymentDrivers/DriverTemplate.php index 4e98461d1d18..be38421ed55f 100644 --- a/app/PaymentDrivers/DriverTemplate.php +++ b/app/PaymentDrivers/DriverTemplate.php @@ -55,19 +55,18 @@ class YourGatewayPaymentDriver extends BaseDriver return $this->payment_method->paymentView($data); //this is your custom implementation from here } - public function processPaymentResponse($request) + public function processPaymentResponse($request) { return $this->payment_method->paymentResponse($request); //this is your custom implementation from here } public function refund(Payment $payment, $amount, $return_client_response = false) { - return $this->payment_method->yourRefundImplementationHere(); //this is your custom implementation from here + return $this->payment_method->yourRefundImplementationHere(); //this is your custom implementation from here } public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) { return $this->payment_method->yourTokenBillingImplmentation(); //this is your custom implementation from here } - } diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index c05b7d2f7abf..b4fcf438f93d 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -26,6 +26,7 @@ use App\Utils\Traits\MakesHash; use Exception; use Omnipay\Common\Item; use stdClass; + class PayPalExpressPaymentDriver extends BasePaymentDriver { use MakesHash; @@ -56,7 +57,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver const SYSTEM_LOG_TYPE = SystemLog::TYPE_PAYPAL; -public function checkRequirements() + public function checkRequirements() { if ($this->company_gateway->require_billing_address) { if ($this->checkRequiredResource(auth()->user('contact')->client->address1)) { @@ -145,7 +146,7 @@ public function checkRequirements() if (Str::startsWith($field, 'billing')) { unset($this->required_fields[$position]); } - } + } if ($this->checkRequiredResource(auth()->user('contact')->client->postal_code)) { $this->required_fields[] = 'postal_code'; @@ -157,9 +158,9 @@ public function checkRequirements() /** * Wrapper method for checking if resource is good. - * - * @param mixed $resource - * @return bool + * + * @param mixed $resource + * @return bool */ public function checkRequiredResource($resource): bool { diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index 6691142a042c..e6bbfca1fc07 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -22,10 +22,10 @@ use App\Utils\CurlUtils; use App\Utils\HtmlEngine; use App\Utils\Traits\MakesHash; use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; -use Illuminate\Support\Facades\Response; -use Illuminate\Support\Facades\Cache; class Phantom { @@ -90,7 +90,7 @@ class Phantom Cache::put($hash, $html, 300); $url = route('tmp_pdf', ['hash' => $hash]); -info($url); + info($url); $key = config('ninja.phantomjs_key'); $phantom_url = "https://phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$url}%22,renderType:%22pdf%22%7D"; $pdf = CurlUtils::get($phantom_url); diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 3abb9182d4b9..03a9904c8186 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -79,14 +79,15 @@ class SystemHealth 'npm_status' => self::checkNpm(), 'node_status' => self::checkNode(), 'cache_enabled' => self::checkConfigCache(), - 'phantom_enabled' => (bool) config('ninja.phantomjs_pdf_generation'), + 'phantom_enabled' => (bool) config('ninja.phantomjs_pdf_generation'), ]; } public static function checkConfigCache() { - if(env('APP_URL')) + if (env('APP_URL')) { return false; + } return true; } diff --git a/resources/views/portal/ninja2020/profile/settings/name-website-logo.blade.php b/resources/views/portal/ninja2020/profile/settings/name-website-logo.blade.php index 49fb34dfea3a..11ccba1c50a2 100644 --- a/resources/views/portal/ninja2020/profile/settings/name-website-logo.blade.php +++ b/resources/views/portal/ninja2020/profile/settings/name-website-logo.blade.php @@ -24,6 +24,15 @@ @enderror +
+ + + @error('phone') +
+ {{ $message }} +
+ @enderror +