Merge pull request #7219 from turbo124/v5-develop

Improve Stripe customer importation
This commit is contained in:
David Bomba 2022-02-20 07:01:15 +11:00 committed by GitHub
commit e47abe37dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 291 additions and 174 deletions

View File

@ -75,16 +75,19 @@ class BackupUpdate extends Command
private function handleOnDb()
{
set_time_limit(0);
Backup::chunk(100, function ($backups) {
foreach ($backups as $backup) {
if($backup->activity->client()->exists()){
Backup::whereHas('activity')->whereNotNull('html_backup')->cursor()->each(function($backup){
$client = $backup->activity->client;
$backup->storeRemotely($backup->html_backup, $client);
if($backup->activity->client()->exists()){
$client = $backup->activity->client;
$backup->storeRemotely($backup->html_backup, $client);
}
}
});
}

View File

@ -115,6 +115,8 @@ class CheckData extends Command
$this->checkEntityInvitations();
$this->checkCompanyData();
if(Ninja::isHosted())
$this->checkAccountStatuses();
if (! $this->option('client_id')) {
$this->checkOAuth();
@ -244,38 +246,6 @@ class CheckData extends Command
}
}
// // check for more than one primary contact
// $clients = DB::table('clients')
// ->leftJoin('client_contacts', function ($join) {
// $join->on('client_contacts.client_id', '=', 'clients.id')
// ->where('client_contacts.is_primary', '=', true)
// ->whereNull('client_contacts.deleted_at');
// })
// ->groupBy('clients.id')
// ->havingRaw('count(client_contacts.id) != 1');
// if ($this->option('client_id')) {
// $clients->where('clients.id', '=', $this->option('client_id'));
// }
// $clients = $clients->get(['clients.id', 'clients.user_id', 'clients.company_id']);
// // $this->logMessage($clients->count().' clients without a single primary contact');
// // if ($this->option('fix') == 'true') {
// // foreach ($clients as $client) {
// // $this->logMessage("Fixing missing primary contacts #{$client->id}");
// // $new_contact = ClientContactFactory::create($client->company_id, $client->user_id);
// // $new_contact->client_id = $client->id;
// // $new_contact->contact_key = Str::random(40);
// // $new_contact->is_primary = true;
// // $new_contact->save();
// // }
// // }
// if ($clients->count() > 0) {
// $this->isValid = false;
// }
}
private function checkFailedJobs()
@ -447,6 +417,7 @@ class CheckData extends Command
payments.id = paymentables.payment_id
WHERE paymentable_type = 'App\\Models\\Credit'
AND paymentables.deleted_at is NULL
AND payments.is_deleted = 0
AND payments.client_id = ?;
"), [$client->id] );
@ -948,6 +919,30 @@ ORDER BY clients.id;
return $type.'s';
}
public function checkAccountStatuses()
{
Account::where('plan_expires', '<=', now()->subDays(2))->cursor()->each(function ($account){
$client = Client::on('db-ninja-01')->where('company_id', config('ninja.ninja_default_company_id'))->where('custom_value2', $account->key)->first();
if($client){
$payment = Payment::on('db-ninja-01')
->where('company_id', config('ninja.ninja_default_company_id'))
->where('client_id', $client->id)
->where('date', '>=', now()->subDays(2))
->exists();
if($payment)
$this->logMessage("I found a payment for {$account->key}");
}
});
}
}

View File

@ -22,8 +22,6 @@ use App\Utils\Traits\MakesHash;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
class DocumentController extends Controller
{
@ -71,25 +69,34 @@ class DocumentController extends Controller
public function downloadMultiple(DownloadMultipleDocumentsRequest $request)
{
$documents = Document::whereIn('id', $this->transformKeys($request->file_hash))
->where('company_id', auth()->guard('contact')->user()->company->id)
->where('company_id', auth()->guard('contact')->user()->company_id)
->get();
$documents->map(function ($document) {
if (auth()->guard('contact')->user()->client->id != $document->documentable->id) {
abort(401, 'Permission denied');
$zipFile = new \PhpZip\ZipFile();
try{
foreach ($documents as $document) {
$zipFile->addFile(TempFile::path($document->filePath()), $document->name);
}
});
$options = new Archive();
$filename = now() . '-documents.zip';
$filepath = sys_get_temp_dir() . '/' . $filename;
$options->setSendHttpHeaders(true);
$zipFile->saveAsFile($filepath) // save the archive to a file
->close(); // close archive
return response()->download($filepath, $filename)->deleteFileAfterSend(true);
$zip = new ZipStream(now() . '-documents.zip', $options);
foreach ($documents as $document) {
$zip->addFileFromPath(basename($document->diskPath()), TempFile::path($document->filePath()));
}
catch(\PhpZip\Exception\ZipException $e){
// handle exception
}
finally{
$zipFile->close();
}
$zip->finish();
}
}

View File

@ -28,8 +28,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use Illuminate\Http\Request;
class InvoiceController extends Controller
@ -198,9 +196,6 @@ class InvoiceController extends Controller
* @param array $ids
*
* @return void
* @throws \ZipStream\Exception\FileNotFoundException
* @throws \ZipStream\Exception\FileNotReadableException
* @throws \ZipStream\Exception\OverflowException
*/
private function downloadInvoicePDF(array $ids)
{
@ -228,21 +223,38 @@ class InvoiceController extends Controller
}, basename($file), ['Content-Type' => 'application/pdf']);
}
// enable output of HTTP headers
$options = new Archive();
$options->setSendHttpHeaders(true);
return $this->buildZip($invoices);
// create a new zipstream object
$zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options);
}
foreach ($invoices as $invoice) {
#add it to the zip
$zip->addFile(basename($invoice->pdf_file_path()), file_get_contents($invoice->pdf_file_path(null, 'url', true)));
private function buildZip($invoices)
{
// create new archive
$zipFile = new \PhpZip\ZipFile();
try{
foreach ($invoices as $invoice) {
#add it to the zip
$zipFile->addFromString(basename($invoice->pdf_file_path()), file_get_contents($invoice->pdf_file_path(null, 'url', true)));
}
$filename = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip';
$filepath = sys_get_temp_dir() . '/' . $filename;
$zipFile->saveAsFile($filepath) // save the archive to a file
->close(); // close archive
return response()->download($filepath, $filename)->deleteFileAfterSend(true);
}
// finish the zip stream
$zip->finish();
catch(\PhpZip\Exception\ZipException $e){
// handle exception
}
finally{
$zipFile->close();
}
}
}

View File

@ -28,8 +28,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Storage;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
@ -140,21 +138,38 @@ class QuoteController extends Controller
}, basename($file), ['Content-Type' => 'application/pdf']);
}
// enable output of HTTP headers
$options = new Archive();
$options->setSendHttpHeaders(true);
return $this->buildZip($quotes);
// create a new zipstream object
$zip = new ZipStream(date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip', $options);
}
foreach ($quotes as $quote) {
$zip->addFile(basename($quote->pdf_file_path()), file_get_contents($quote->pdf_file_path(null, 'url', true)));
private function buildZip($quotes)
{
// create new archive
$zipFile = new \PhpZip\ZipFile();
try{
foreach ($quotes as $quote) {
#add it to the zip
$zipFile->addFromString(basename($quote->pdf_file_path()), file_get_contents($quote->pdf_file_path(null, 'url', true)));
}
$filename = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.quotes')).'.zip';
$filepath = sys_get_temp_dir() . '/' . $filename;
$zipFile->saveAsFile($filepath) // save the archive to a file
->close(); // close archive
return response()->download($filepath, $filename)->deleteFileAfterSend(true);
// $zip->addFileFromPath(basename($quote->pdf_file_path()), TempFile::path($quote->pdf_file_path()));
}
// finish the zip stream
$zip->finish();
catch(\PhpZip\Exception\ZipException $e){
// handle exception
}
finally{
$zipFile->close();
}
}
protected function approve(array $ids, $process = false)

View File

@ -265,15 +265,16 @@ class MigrationController extends BaseController
foreach($request->all() as $input){
if($input instanceof UploadedFile)
nlog('is file');
if($input instanceof UploadedFile){
}
else
$companies[] = json_decode($input,1);
}
}
if (app()->environment() === 'local') {
nlog($request->all());
}
try {

View File

@ -43,7 +43,7 @@ class InvoicesTable extends Component
$local_status = [];
$query = Invoice::query()
->with('client.gateway_tokens','company','client.contacts')
->with('client.gateway_tokens','client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->where('company_id', $this->company->id)
->where('is_deleted', false);
@ -75,7 +75,7 @@ class InvoicesTable extends Component
}
$query = $query
->where('client_id', auth()->guard('contact')->user()->client->id)
->where('client_id', auth()->guard('contact')->user()->client_id)
->where('status_id', '<>', Invoice::STATUS_DRAFT)
->where('status_id', '<>', Invoice::STATUS_CANCELLED)
->withTrashed()

View File

@ -36,6 +36,10 @@ class PaymentMethodsTable extends Component
->with('gateway_type')
->where('company_id', $this->company->id)
->where('client_id', $this->client->id)
->whereHas('gateway', function ($query) {
$query->where('is_deleted',0)
->where('deleted_at', NULL);
})
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page);

View File

@ -33,7 +33,7 @@ class Locale
$locale = $request->input('lang');
App::setLocale($locale);
} elseif (auth()->guard('contact')->user()) {
App::setLocale(auth()->guard('contact')->user()->client->locale());
App::setLocale(auth()->guard('contact')->user()->client()->setEagerLoads([])->first()->locale());
} elseif (auth()->user()) {
try{

View File

@ -39,8 +39,6 @@ class SessionDomains
}
else{
// Cookie::queue(Cookie::forget('invoice_ninja_session', '/'));
config(['session.domain' => $domain_name]);
}

View File

@ -15,7 +15,8 @@ class ShowCreditRequest extends FormRequest
public function authorize()
{
return !$this->credit->is_deleted
&& auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS;
&& auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_CREDITS
&& auth()->guard('contact')->user()->client_id === $this->credit->client_id;
}
/**

View File

@ -27,9 +27,10 @@ class ShowDocumentRequest extends FormRequest
*/
public function authorize()
{
return auth()->guard('contact')->user()->client_id == $this->document->documentable_id
|| $this->document->documentable->client_id == auth()->guard('contact')->user()->client_id
|| $this->document->company_id == auth()->guard('contact')->user()->company_id;
}
/**

View File

@ -23,7 +23,7 @@ class ShowInvoiceRequest extends Request
*/
public function authorize() : bool
{
return auth()->guard('contact')->user()->client_id == $this->invoice->client_id
return auth()->guard('contact')->user()->client_id === $this->invoice->client_id
&& auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
}
}

View File

@ -19,7 +19,7 @@ class ShowQuoteRequest extends FormRequest
{
public function authorize()
{
return auth()->user()->client->id === $this->quote->client_id
return auth()->guard('contact')->user()->client->id === $this->quote->client_id
&& auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_QUOTES;
}

View File

@ -33,8 +33,6 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use Illuminate\Support\Facades\App;
class CompanyExport implements ShouldQueue

View File

@ -74,8 +74,6 @@ use Illuminate\Support\Str;
use JsonMachine\JsonDecoder\ExtJsonDecoder;
use JsonMachine\JsonMachine;
use ZipArchive;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use function GuzzleHttp\json_encode;

View File

@ -25,8 +25,6 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use ZipArchive;
class ZipInvoices implements ShouldQueue

View File

@ -132,8 +132,6 @@ class TemplateEmail extends Mailable
if($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)){
$ubl_string = CreateUbl::dispatchNow($this->invitation->invoice);
nlog($ubl_string);
if($ubl_string)
$this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml'));

View File

@ -26,10 +26,10 @@ class Backup extends BaseModel
return $this->belongsTo(Activity::class);
}
public function storeRemotely(string $html, Client $client)
public function storeRemotely(?string $html, Client $client)
{
if(strlen($html) == 0)
if(!$html || strlen($html) == 0)
return;
$path = $client->backup_path() . "/";

View File

@ -258,7 +258,7 @@ class BaseDriver extends AbstractPaymentDriver
$payment->client_contact_id = $client_contact_id;
$payment->saveQuietly();
/* Return early if the payment is no completed or pending*/
/* Return early if the payment is not completed or pending*/
if(!in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]) )
return $payment;

View File

@ -52,7 +52,19 @@ class Verify
if($this->stripe->stripe_connect && strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
throw new StripeConnectFailure('Stripe Connect has not been configured');
$customers = Customer::all([], $this->stripe->stripe_connect_auth);
$total_stripe_customers = 0;
$starting_after = null;
do {
$customers = Customer::all(['limit' => 100, 'starting_after' => $starting_after], $this->stripe->stripe_connect_auth);
$total_stripe_customers += count($customers->data);
$starting_after = end($customers->data)['id'];
} while($customers->has_more);
$stripe_customers = $this->stripe->company_gateway->client_gateway_tokens->map(function ($cgt){
@ -66,7 +78,7 @@ class Verify
});
$data = [
'stripe_customer_count' => count($customers),
'stripe_customer_count' => $total_stripe_customers,
'stripe_customers' => $stripe_customers,
];

View File

@ -55,13 +55,20 @@ class ImportCustomers
if(Ninja::isHosted() && strlen($this->stripe->company_gateway->getConfigField('account_id')) < 1)
throw new StripeConnectFailure('Stripe Connect has not been configured');
$customers = Customer::all([], $this->stripe->stripe_connect_auth);
$starting_after = null;
foreach($customers as $customer)
{
$this->addCustomer($customer);
}
do {
$customers = Customer::all(['limit' => 100, 'starting_after' => $starting_after], $this->stripe->stripe_connect_auth);
foreach($customers as $customer)
{
$this->addCustomer($customer);
}
$starting_after = end($customers->data)['id'];
} while($customers->has_more);
}
private function addCustomer(Customer $customer)
@ -72,7 +79,7 @@ class ImportCustomers
if(!$account->isPaidHostedClient() && Client::where('company_id', $this->stripe->company_gateway->company_id)->count() > config('ninja.quotas.free.clients'))
return;
nlog("search Stripe for {$customer->id}");
// nlog("search Stripe for {$customer->id}");
$existing_customer_token = $this->stripe
->company_gateway
@ -97,7 +104,7 @@ class ImportCustomers
return;
}
nlog("inserting a customer");
// nlog("inserting a customer");
//nlog($customer);
$client = ClientFactory::create($this->stripe->company_gateway->company_id, $this->stripe->company_gateway->user_id);

View File

@ -12,6 +12,7 @@
namespace App\Providers;
use App\Utils\CssInlinerPlugin;
use Illuminate\Container\Container;
use Illuminate\Mail\MailManager;
use Illuminate\Support\ServiceProvider;
@ -38,8 +39,18 @@ class MailCssInlinerServiceProvider extends ServiceProvider
*/
public function register()
{
$this->app->singleton(CssInlinerPlugin::class, function ($app) {
// $this->app->singleton(CssInlinerPlugin::class, function ($app) {
// return new CssInlinerPlugin([]);
// });
// $this->app->singleton(CssInlinerPlugin::class, function ($app) {
// return new CssInlinerPlugin([]);
// });
$this->app->bind(CssInlinerPlugin::class, function($app) {
return new CssInlinerPlugin([]);
});
}
}

View File

@ -70,25 +70,24 @@ class PaymentMethod
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
$this->gateways = $this->client
->company
->company_gateways
$this->gateways =
CompanyGateway::with('gateway')
->where('company_id', $this->client->company_id)
->whereIn('id', $transformed_ids)
->where('is_deleted', false)
->whereNull('deleted_at')
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
return array_search($model->id, $transformed_ids);// this closure sorts for us
});
})->get();
} else {
$this->gateways = $this->client
->company
->company_gateways
$this->gateways = CompanyGateway::with('gateway')
->where('company_id', $this->client->company_id)
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
->whereNull('deleted_at')
->where('is_deleted', false);
->where('is_deleted', false)->get();
}
@ -106,25 +105,23 @@ class PaymentMethod
$transformed_ids = $this->transformKeys(explode(',', $company_gateways));
$this->gateways = $this->client
->company
->company_gateways
$this->gateways = CompanyGateway::with('gateway')
->where('company_id', $this->client->company_id)
->whereIn('id', $transformed_ids)
->where('is_deleted', false)
->whereNull('deleted_at')
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
return array_search($model->id, $transformed_ids);// this closure sorts for us
});
})->get();
} else {
$this->gateways = $this->client
->company
->company_gateways
$this->gateways = CompanyGateway::with('gateway')
->where('company_id', $this->client->company_id)
->where('gateway_key', '54faab2ab6e3223dbe848b1686490baa')
->whereNull('deleted_at')
->where('is_deleted', false);
->where('is_deleted', false)->get();
}

View File

@ -307,8 +307,14 @@ class AutoBillInvoice extends AbstractService
{
//get all client gateway tokens and set the is_default one to the first record
$gateway_tokens = $this->client->gateway_tokens()->orderBy('is_default', 'DESC')->get();
// $gateway_tokens = $this->client->gateway_tokens;
$gateway_tokens = $this->client
->gateway_tokens()
->whereHas('gateway', function ($query) {
$query->where('is_deleted',0)
->where('deleted_at', NULL);
})->orderBy('is_default', 'DESC')
->get();
$filtered_gateways = $gateway_tokens->filter(function ($gateway_token) use($amount) {

View File

@ -87,23 +87,6 @@ class UpdateInvoicePayment
$this->payment->applied += $paid_amount;
// $invoice->service() //caution what if we amount paid was less than partial - we wipe it!
// ->clearPartial()
// ->updateBalance($paid_amount * -1)
// ->updatePaidToDate($paid_amount)
// ->updateStatus()
// ->save();
// $invoice->refresh();
// $invoice->service()
// ->touchPdf(true)
// ->workFlow()
// ->save();
});
/* Remove the event updater from within the loop to prevent race conditions */

View File

@ -262,7 +262,9 @@ class Helpers
}
}
return $value;
$x = str_replace(["\n", "<br>"], ["\r", "<br>"], $value);
return $x;
}
/**

View File

@ -165,7 +165,7 @@ class HtmlEngine
$data['$entity'] = ['value' => '', 'label' => ctrans('texts.quote')];
$data['$number'] = ['value' => $this->entity->number ?: '', 'label' => ctrans('texts.quote_number')];
$data['$number_short'] = ['value' => $this->entity->number ?: '', 'label' => ctrans('texts.quote_number_short')];
$data['$entity.terms'] = ['value' => $this->entity->terms ?: '', 'label' => ctrans('texts.quote_terms')];
$data['$entity.terms'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->terms), $this->client) ?: '', 'label' => ctrans('texts.quote_terms')];
$data['$terms'] = &$data['$entity.terms'];
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->invitation->getLink().'">'.ctrans('texts.view_quote').'</a>', 'label' => ctrans('texts.view_quote')];
$data['$viewLink'] = &$data['$view_link'];
@ -180,7 +180,7 @@ class HtmlEngine
$data['$entity'] = ['value' => '', 'label' => ctrans('texts.credit')];
$data['$number'] = ['value' => $this->entity->number ?: '', 'label' => ctrans('texts.credit_number')];
$data['$number_short'] = ['value' => $this->entity->number ?: '', 'label' => ctrans('texts.credit_number_short')];
$data['$entity.terms'] = ['value' => $this->entity->terms ?: '', 'label' => ctrans('texts.credit_terms')];
$data['$entity.terms'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->terms), $this->client) ?: '', 'label' => ctrans('texts.credit_terms')];
$data['$terms'] = &$data['$entity.terms'];
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->invitation->getLink().'">'.ctrans('texts.view_credit').'</a>', 'label' => ctrans('texts.view_credit')];
$data['$viewButton'] = &$data['$view_link'];

View File

@ -65,8 +65,8 @@
"league/fractal": "^0.17.0",
"league/omnipay": "^3.1",
"livewire/livewire": "^2.6",
"maennchen/zipstream-php": "^1.2",
"mollie/mollie-api-php": "^2.36",
"nelexa/zip": "^4.0",
"nwidart/laravel-modules": "^8.0",
"omnipay/paypal": "^3.0",
"payfast/payfast-php-sdk": "^1.1",
@ -149,4 +149,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}

75
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f430e1dc06c72464f547ba0bb71226cf",
"content-hash": "ebb191c91f4011a448605a0fd725faff",
"packages": [
{
"name": "apimatic/jsonmapper",
@ -5582,6 +5582,79 @@
],
"time": "2021-07-05T08:18:36+00:00"
},
{
"name": "nelexa/zip",
"version": "4.0.1",
"source": {
"type": "git",
"url": "https://github.com/Ne-Lexa/php-zip.git",
"reference": "a18f80db509b1b6e9798e2745dc100759107f50c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ne-Lexa/php-zip/zipball/a18f80db509b1b6e9798e2745dc100759107f50c",
"reference": "a18f80db509b1b6e9798e2745dc100759107f50c",
"shasum": ""
},
"require": {
"ext-zlib": "*",
"php": "^7.4 || ^8.0",
"psr/http-message": "*",
"symfony/finder": "*"
},
"require-dev": {
"ext-bz2": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-iconv": "*",
"ext-openssl": "*",
"ext-xml": "*",
"friendsofphp/php-cs-fixer": "^3.4.0",
"guzzlehttp/psr7": "^1.6",
"phpunit/phpunit": "^9",
"symfony/http-foundation": "*",
"symfony/var-dumper": "*",
"vimeo/psalm": "^4.6"
},
"suggest": {
"ext-bz2": "Needed to support BZIP2 compression",
"ext-fileinfo": "Needed to get mime-type file",
"ext-iconv": "Needed to support convert zip entry name to requested character encoding",
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpZip\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ne-Lexa",
"email": "alexey@nelexa.ru",
"role": "Developer"
}
],
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
"homepage": "https://github.com/Ne-Lexa/php-zip",
"keywords": [
"archive",
"extract",
"unzip",
"winzip",
"zip",
"ziparchive"
],
"support": {
"issues": "https://github.com/Ne-Lexa/php-zip/issues",
"source": "https://github.com/Ne-Lexa/php-zip/tree/4.0.1"
},
"time": "2021-12-12T09:50:45+00:00"
},
{
"name": "nesbot/carbon",
"version": "2.56.0",

View File

@ -24,6 +24,7 @@ const appendToElement = (parent, value) => {
_temp.hidden = true;
_parent.append(_temp);
};
window.appendToElement = appendToElement;

View File

@ -1,5 +1,5 @@
@php
$mobile = stripos($_SERVER['HTTP_USER_AGENT'], 'Android') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPod') || stripos($_SERVER['HTTP_USER_AGENT'], 'iPad');
$mobile = stripos(request()->server('HTTP_USER_AGENT'), 'Android') || stripos(request()->server('HTTP_USER_AGENT'), 'iPhone') || stripos(request()->server('HTTP_USER_AGENT'), 'iPod') || stripos(request()->server('HTTP_USER_AGENT'), 'iPad');
@endphp
@push('head')

View File

@ -1,7 +1,4 @@
@php
// $token_billing = $gateway instanceof \App\Models\CompanyGateway
// ? $gateway->token_billing !== 'always'
// : $gateway->company_gateway->token_billing !== 'always';
$gateway_instance = $gateway instanceof \App\Models\CompanyGateway ? $gateway : $gateway->company_gateway;
$token_billing = true;
@ -9,7 +6,7 @@
$checked_on = '';
$checked_off = 'checked';
if($gateway_instance->token_billing == 'off' || $gateway_instance->token_billing == 'always'){
if($gateway_instance->token_billing == 'off'){
$token_billing = false;
$token_billing_string = 'false';
}

View File

@ -1,5 +1,17 @@
@extends('portal.ninja2020.layout.payments', ['gateway_title' => 'Credit card', 'card_title' => 'Credit card'])
@php
$gateway_instance = $gateway instanceof \App\Models\CompanyGateway ? $gateway : $gateway->company_gateway;
$token_billing_string = 'true';
if($gateway_instance->token_billing == 'off' || $gateway_instance->token_billing == 'optin'){
$token_billing_string = 'false';
}
@endphp
@section('gateway_head')
@if($gateway->company_gateway->getConfigField('account_id'))
<meta name="stripe-account-id" content="{{ $gateway->company_gateway->getConfigField('account_id') }}">
@ -18,7 +30,7 @@
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
@csrf
<input type="hidden" name="gateway_response">
<input type="hidden" name="store_card">
<input type="hidden" name="store_card" value="{{ $token_billing_string }}">
<input type="hidden" name="payment_hash" value="{{ $payment_hash }}">
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">

View File

@ -105,18 +105,5 @@
var clipboard = new ClipboardJS('.btn');
// clipboard.on('success', function(e) {
// console.info('Action:', e.action);
// console.info('Text:', e.text);
// console.info('Trigger:', e.trigger);
// e.clearSelection();
// });
// clipboard.on('error', function(e) {
// console.error('Action:', e.action);
// console.error('Trigger:', e.trigger);
// });
</script>
@endsection