mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
php-cs-fixer
This commit is contained in:
parent
2618a1d3b8
commit
0aff363f5d
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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 = [];
|
||||
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user