mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #4263 from turbo124/v5-develop
Fix for removing company logo from storage
This commit is contained in:
commit
5089f2183b
@ -516,8 +516,8 @@ class CreateSingleAccount extends Command
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->save();
|
||||
@ -527,8 +527,8 @@ class CreateSingleAccount extends Command
|
||||
// $cg->user_id = $user->id;
|
||||
// $cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
// $cg->require_cvv = true;
|
||||
// $cg->show_billing_address = true;
|
||||
// $cg->show_shipping_address = true;
|
||||
// $cg->require_billing_address = true;
|
||||
// $cg->require_shipping_address = true;
|
||||
// $cg->update_details = true;
|
||||
// $cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
// $cg->save();
|
||||
@ -540,8 +540,8 @@ class CreateSingleAccount extends Command
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.paypal'));
|
||||
$cg->save();
|
||||
@ -553,8 +553,8 @@ class CreateSingleAccount extends Command
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||
$cg->save();
|
||||
@ -566,8 +566,8 @@ class CreateSingleAccount extends Command
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.authorize'));
|
||||
$cg->save();
|
||||
|
@ -408,6 +408,10 @@ class CompanyController extends BaseController
|
||||
*/
|
||||
public function update(UpdateCompanyRequest $request, Company $company)
|
||||
{
|
||||
|
||||
if($request->hasFile('company_logo') || !array_key_exists('company_logo', $request->input('settings')))
|
||||
$this->removeLogo($company);
|
||||
|
||||
$company = $this->company_repo->save($request->all(), $company);
|
||||
|
||||
$company->saveSettings($request->input('settings'), $company);
|
||||
|
@ -7,8 +7,8 @@
|
||||
* @OA\Property(property="company_id", type="string", example="2", description="______"),
|
||||
* @OA\Property(property="gateway_key", type="string", example="2", description="______"),
|
||||
* @OA\Property(property="accepted_credit_cards", type="integer", example="32", description="Bitmask representation of cards"),
|
||||
* @OA\Property(property="show_billing_address", type="boolean", example=true, description="______"),
|
||||
* @OA\Property(property="show_shipping_address", type="boolean", example=true, description="______"),
|
||||
* @OA\Property(property="require_billing_address", type="boolean", example=true, description="______"),
|
||||
* @OA\Property(property="require_shipping_address", type="boolean", example=true, description="______"),
|
||||
* @OA\Property(property="config", type="string", example="dfadsfdsafsafd", description="The configuration map for the gateway"),
|
||||
* @OA\Property(property="update_details", type="boolean", example=true, description="______"),
|
||||
* @OA\Property(
|
||||
|
@ -18,7 +18,6 @@ use App\Models\Product;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Capsule\Eloquent;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
@ -27,11 +26,11 @@ class UpdateOrCreateProduct implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
private $products;
|
||||
public $products;
|
||||
|
||||
private $invoice;
|
||||
public $invoice;
|
||||
|
||||
private $company;
|
||||
public $company;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
@ -59,7 +58,14 @@ class UpdateOrCreateProduct implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDB($this->company->db);
|
||||
|
||||
foreach ($this->products as $item) {
|
||||
//only update / create products - not tasks or gateway fees
|
||||
$updateable_products = collect($this->products)->filter(function ($item) {
|
||||
|
||||
return $item->type_id == 1;
|
||||
|
||||
});
|
||||
|
||||
foreach ($updateable_products as $item) {
|
||||
if (empty($item->product_key)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -38,8 +38,12 @@ class CompanyGateway extends BaseModel
|
||||
'gateway_key',
|
||||
'accepted_credit_cards',
|
||||
'require_cvv',
|
||||
'show_billing_address',
|
||||
'show_shipping_address',
|
||||
'require_billing_address',
|
||||
'require_shipping_address',
|
||||
'require_client_name',
|
||||
'require_zip',
|
||||
'require_client_phone',
|
||||
'require_contact_name',
|
||||
'update_details',
|
||||
'config',
|
||||
'fees_and_limits',
|
||||
|
@ -26,6 +26,7 @@ use App\Utils\Traits\MakesInvoiceValues;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
|
||||
class Credit extends BaseModel
|
||||
|
@ -34,24 +34,6 @@ class BaseRepository
|
||||
use MakesHash;
|
||||
use SavesDocuments;
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function getInstance()
|
||||
{
|
||||
$className = $this->getClassName();
|
||||
|
||||
return new $className();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $type
|
||||
@ -153,25 +135,6 @@ class BaseRepository
|
||||
return count($entities);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findByPublicIds($ids)
|
||||
{
|
||||
return $this->getInstance()->scope($ids)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findByPublicIdsWithTrashed($ids)
|
||||
{
|
||||
return $this->getInstance()->scope($ids)->withTrashed()->get();
|
||||
}
|
||||
|
||||
public function getInvitation($invitation, $resource)
|
||||
{
|
||||
|
@ -40,16 +40,6 @@ class ClientRepository extends BaseRepository
|
||||
$this->contact_repo = $contact_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Client::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the client and its contacts.
|
||||
*
|
||||
|
@ -23,22 +23,12 @@ class CompanyRepository extends BaseRepository
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Company::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the client and its contacts.
|
||||
*
|
||||
* @param array $data The data
|
||||
* @param Company $company
|
||||
* @return Client|Company|null Company Object
|
||||
* @return Company|null Company Object
|
||||
*/
|
||||
public function save(array $data, Company $company) : ?Company
|
||||
{
|
||||
|
@ -30,15 +30,6 @@ class CreditRepository extends BaseRepository
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Credit::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the client and its contacts.
|
||||
|
@ -11,30 +11,10 @@
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Backup;
|
||||
use App\Models\Client;
|
||||
use App\Models\Design;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\User;
|
||||
use App\Utils\Traits\MakesInvoiceHtml;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class for activity repository.
|
||||
* Class for DesignRepository .
|
||||
*/
|
||||
class DesignRepository extends BaseRepository
|
||||
{
|
||||
use MakesInvoiceHtml;
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Design::class;
|
||||
}
|
||||
}
|
||||
|
@ -19,15 +19,6 @@ use App\Utils\Ninja;
|
||||
*/
|
||||
class DocumentRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Document::class;
|
||||
}
|
||||
|
||||
public function delete($document)
|
||||
{
|
||||
@ -43,8 +34,8 @@ class DocumentRepository extends BaseRepository
|
||||
|
||||
$document->restore();
|
||||
|
||||
if (class_exists($className)) {
|
||||
event(new $className($document, $document->company, Ninja::eventVars()));
|
||||
}
|
||||
// if (class_exists($className)) {
|
||||
// event(new $className($document, $document->company, Ninja::eventVars()));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -24,27 +24,14 @@ class ExpenseRepository extends BaseRepository
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Expense::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the expense and its contacts.
|
||||
*
|
||||
* @param array $data The data
|
||||
* @param \App\Models\expense $expense The expense
|
||||
* @param \App\Models\Expense $expense The expense
|
||||
*
|
||||
* @return expense|null expense Object
|
||||
* @return \App\Models\Expense|Null expense Object
|
||||
*/
|
||||
public function save(array $data, Expense $expense) : ?Expense
|
||||
{
|
||||
@ -63,7 +50,7 @@ class ExpenseRepository extends BaseRepository
|
||||
* Store expenses in bulk.
|
||||
*
|
||||
* @param array $expense
|
||||
* @return expense|null
|
||||
* @return \App\Models\Expense|null
|
||||
*/
|
||||
public function create($expense): ?Expense
|
||||
{
|
||||
|
@ -12,21 +12,9 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\GroupSetting;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class GroupSettingRepository extends BaseRepository
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return GroupSetting::class;
|
||||
}
|
||||
|
||||
public function save($data, GroupSetting $group_setting) :?GroupSetting
|
||||
{
|
||||
|
@ -27,23 +27,14 @@ class InvoiceRepository extends BaseRepository
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Invoice::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the invoices.
|
||||
*
|
||||
* @param array. $data The invoice data
|
||||
* @param InvoiceSum|Invoice $invoice The invoice
|
||||
* @param array $data The invoice data
|
||||
* @param Invoice $invoice The invoice
|
||||
*
|
||||
* @return Invoice|InvoiceSum|null Returns the invoice object
|
||||
* @return Invoice|null Returns the invoice object
|
||||
*/
|
||||
public function save($data, Invoice $invoice):?Invoice
|
||||
{
|
||||
@ -75,19 +66,17 @@ class InvoiceRepository extends BaseRepository
|
||||
* ie. invoice can be deleted from a business logic perspective.
|
||||
*
|
||||
* @param Invoice $invoice
|
||||
* @return void $invoice
|
||||
* @return Invoice $invoice
|
||||
*/
|
||||
public function delete($invoice)
|
||||
public function delete($invoice) :Invoice
|
||||
{
|
||||
if ($invoice->is_deleted) {
|
||||
return;
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
$invoice->service()->markDeleted()->handleCancellation()->save();
|
||||
|
||||
|
||||
|
||||
$invoice = parent::delete($invoice);
|
||||
parent::delete($invoice);
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class InvoiceMigrationRepository extends BaseRepository
|
||||
$invitations = collect($data['invitations']);
|
||||
|
||||
/* Get array of Keys which have been removed from the invitations array and soft delete each invitation */
|
||||
$model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) {
|
||||
$model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use($resource){
|
||||
$this->getInvitation($invitation, $resource)->delete();
|
||||
});
|
||||
|
||||
|
@ -48,11 +48,6 @@ class PaymentMigrationRepository extends BaseRepository
|
||||
$this->activity_repo = new ActivityRepository();
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return Payment::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves and updates a payment. //todo refactor to handle refunds and payments.
|
||||
*
|
||||
|
@ -41,15 +41,6 @@ class PaymentRepository extends BaseRepository
|
||||
$this->credit_repo = $credit_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return Payment::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves and updates a payment. //todo refactor to handle refunds and payments.
|
||||
*
|
||||
|
@ -19,11 +19,6 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
use SavesDocuments;
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return Product::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Product $product
|
||||
|
@ -19,13 +19,4 @@ use App\Models\Project;
|
||||
class ProjectRepository extends BaseRepository
|
||||
{
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Project::class;
|
||||
}
|
||||
}
|
||||
|
@ -27,12 +27,7 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class QuoteRepository extends BaseRepository
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return Quote::class;
|
||||
}
|
||||
|
||||
public function save($data, Quote $quote) : ?Quote
|
||||
{
|
||||
|
@ -20,10 +20,6 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class RecurringInvoiceRepository extends BaseRepository
|
||||
{
|
||||
public function getClassName()
|
||||
{
|
||||
return RecurringInvoice::class;
|
||||
}
|
||||
|
||||
public function save($data, RecurringInvoice $invoice) : ?RecurringInvoice
|
||||
{
|
||||
|
@ -20,10 +20,7 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class RecurringQuoteRepository extends BaseRepository
|
||||
{
|
||||
public function getClassName()
|
||||
{
|
||||
return RecurringQuote::class;
|
||||
}
|
||||
|
||||
|
||||
public function save(Request $request, RecurringQuote $quote) : ?RecurringQuote
|
||||
{
|
||||
@ -31,13 +28,10 @@ class RecurringQuoteRepository extends BaseRepository
|
||||
|
||||
$quote->save();
|
||||
|
||||
$quote_calc = new InvoiceSum($quote, $quote->settings);
|
||||
$quote_calc = new InvoiceSum($quote);
|
||||
|
||||
$quote = $quote_calc->build()->getQuote();
|
||||
|
||||
//fire events here that cascading from the saving of an Quote
|
||||
//ie. client balance update...
|
||||
|
||||
return $quote;
|
||||
}
|
||||
}
|
||||
|
@ -23,19 +23,6 @@ class TaskRepository extends BaseRepository
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Task::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the task and its contacts.
|
||||
|
@ -15,15 +15,7 @@ use App\Models\CompanyToken;
|
||||
|
||||
class TokenRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return CompanyToken::class;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves the companytoken.
|
||||
|
@ -27,24 +27,15 @@ class UserRepository extends BaseRepository
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the user and its contacts.
|
||||
*
|
||||
* @param array $data The data
|
||||
* @param \App\Models\user $user The user
|
||||
* @param \App\Models\User $user The user
|
||||
*
|
||||
* @param bool $unset_company_user
|
||||
* @return user|\App\Models\user|null user Object
|
||||
* @return \App\Models\User user Object
|
||||
*/
|
||||
public function save(array $data, User $user, $unset_company_user = false)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace App\Repositories;
|
||||
|
||||
use App\Factory\VendorFactory;
|
||||
use App\Models\Vendor;
|
||||
use App\Repositories\VSendorContactRepository;
|
||||
use App\Repositories\VendorContactRepository;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@ -23,37 +23,24 @@ use Illuminate\Http\Request;
|
||||
class VendorRepository extends BaseRepository
|
||||
{
|
||||
use GeneratesCounter;
|
||||
/**
|
||||
* @var vendorContactRepository
|
||||
*/
|
||||
|
||||
protected $contact_repo;
|
||||
|
||||
/**
|
||||
* vendorController constructor.
|
||||
* @param vendorContactRepository $contact_repo
|
||||
* VendorContactRepository constructor.
|
||||
*/
|
||||
public function __construct(VendorContactRepository $contact_repo)
|
||||
{
|
||||
$this->contact_repo = $contact_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class name.
|
||||
*
|
||||
* @return string The class name.
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return Vendor::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the vendor and its contacts.
|
||||
*
|
||||
* @param array $data The data
|
||||
* @param \App\Models\vendor $vendor The vendor
|
||||
* @param \App\Models\Vendor $vendor The vendor
|
||||
*
|
||||
* @return vendor|\App\Models\vendor|null vendor Object
|
||||
* @return vendor|\App\Models\Vendor|null Vendor Object
|
||||
* @throws \Laracasts\Presenter\Exceptions\PresenterException
|
||||
*/
|
||||
public function save(array $data, Vendor $vendor) : ?Vendor
|
||||
@ -70,7 +57,7 @@ class VendorRepository extends BaseRepository
|
||||
$vendor->save();
|
||||
|
||||
if (isset($data['contacts'])) {
|
||||
$contacts = $this->contact_repo->save($data, $vendor);
|
||||
$this->contact_repo->save($data, $vendor);
|
||||
}
|
||||
|
||||
if (empty($data['name'])) {
|
||||
|
@ -40,7 +40,7 @@ class CreateInvitations extends AbstractService
|
||||
$ii->credit_id = $this->credit->id;
|
||||
$ii->client_contact_id = $contact->id;
|
||||
$ii->save();
|
||||
} elseif ($invitation && ! $contact->send_email) {
|
||||
} elseif (! $contact->send_email) {
|
||||
$invitation->delete();
|
||||
}
|
||||
});
|
||||
|
@ -49,8 +49,15 @@ class CompanyGatewayTransformer extends EntityTransformer
|
||||
'gateway_key' => (string) $company_gateway->gateway_key ?: '',
|
||||
'accepted_credit_cards' => (int) $company_gateway->accepted_credit_cards,
|
||||
'require_cvv' => (bool) $company_gateway->require_cvv,
|
||||
'show_billing_address' => (bool) $company_gateway->show_billing_address,
|
||||
'show_shipping_address' => (bool) $company_gateway->show_shipping_address,
|
||||
'require_billing_address' => (bool) $company_gateway->require_billing_address,
|
||||
'require_shipping_address' => (bool) $company_gateway->require_shipping_address,
|
||||
'require_client_name' => (bool) $company_gateway->require_client_name,
|
||||
'require_zip' => (bool) $company_gateway->require_zip,
|
||||
'require_client_phone' => (bool) $company_gateway->require_client_phone,
|
||||
'require_contact_name' => (bool) $company_gateway->require_contact_name,
|
||||
'require_contact_email' => (bool) $company_gateway->require_contact_email,
|
||||
'show_billing_address' => (bool) $company_gateway->show_billing_address, //@deprecated
|
||||
'show_shipping_address' => (bool) $company_gateway->show_shipping_address, //@deprecated
|
||||
'update_details' => (bool) $company_gateway->update_details,
|
||||
'config' => (string) $company_gateway->getConfigTransformed(),
|
||||
'fees_and_limits' => $company_gateway->fees_and_limits ?: new stdClass,
|
||||
|
@ -11,13 +11,33 @@
|
||||
|
||||
namespace App\Utils\Traits;
|
||||
|
||||
use App\Jobs\Util\UnlinkFile;
|
||||
use App\Jobs\Util\UploadAvatar;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class Uploadable.
|
||||
*/
|
||||
trait Uploadable
|
||||
{
|
||||
|
||||
public function removeLogo($company)
|
||||
{
|
||||
$company_logo = $company->settings->company_logo;
|
||||
|
||||
info("company logo to be deleted = {$company_logo}");
|
||||
|
||||
$file_name = basename($company_logo);
|
||||
|
||||
$storage_path = $company->company_key . '/' . $file_name;
|
||||
|
||||
if (Storage::exists($storage_path)) {
|
||||
UnlinkFile::dispatchNow(config('filesystems.default'), $storage_path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function uploadLogo($file, $company, $entity)
|
||||
{
|
||||
if ($file) {
|
||||
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CompanyGatewayFieldsRefactor extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('company_gateways', function(Blueprint $table){
|
||||
$table->renameColumn('show_billing_address', 'require_billing_address');
|
||||
$table->renameColumn('show_shipping_address', 'require_shipping_address');
|
||||
$table->boolean('require_client_name')->default(false);
|
||||
$table->boolean('require_zip')->default(false);
|
||||
$table->boolean('require_client_phone')->default(false);
|
||||
$table->boolean('require_contact_name')->default(false);
|
||||
$table->boolean('require_contact_email')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -315,8 +315,8 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->save();
|
||||
@ -326,8 +326,8 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->save();
|
||||
@ -339,8 +339,8 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '38f2c48af60c7dd69e04248cbb24c36e';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.paypal'));
|
||||
$cg->save();
|
||||
@ -352,8 +352,8 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||
$cg->save();
|
||||
@ -365,8 +365,8 @@ class RandomDataSeeder extends Seeder
|
||||
$cg->user_id = $user->id;
|
||||
$cg->gateway_key = '3b6621f970ab18887c4f6dca78d3f8bb';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.authorize'));
|
||||
$cg->save();
|
||||
|
10
psalm.xml
10
psalm.xml
@ -61,6 +61,16 @@
|
||||
<directory name="app" />
|
||||
</errorLevel>
|
||||
</InvalidNullableReturnType>
|
||||
<ImplementedReturnTypeMismatch>
|
||||
<errorLevel type="suppress">
|
||||
<directory name="app" />
|
||||
</errorLevel>
|
||||
</ImplementedReturnTypeMismatch>
|
||||
<NoInterfaceProperties>
|
||||
<errorLevel type="suppress">
|
||||
<directory name="app" />
|
||||
</errorLevel>
|
||||
</NoInterfaceProperties>
|
||||
|
||||
|
||||
</issueHandlers>
|
||||
|
@ -101,8 +101,8 @@ class CompanyGatewayResolutionTest extends TestCase
|
||||
$this->cg->user_id = $this->user->id;
|
||||
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$this->cg->require_cvv = true;
|
||||
$this->cg->show_billing_address = true;
|
||||
$this->cg->show_shipping_address = true;
|
||||
$this->cg->require_billing_address = true;
|
||||
$this->cg->require_shipping_address = true;
|
||||
$this->cg->update_details = true;
|
||||
$this->cg->config = encrypt(json_encode($json_config));
|
||||
$this->cg->fees_and_limits = $data;
|
||||
|
@ -63,8 +63,8 @@ class CompanyGatewayTest extends TestCase
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->fees_and_limits = $data;
|
||||
@ -133,8 +133,8 @@ class CompanyGatewayTest extends TestCase
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->fees_and_limits = $data;
|
||||
@ -170,8 +170,8 @@ class CompanyGatewayTest extends TestCase
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->fees_and_limits = $data;
|
||||
|
@ -539,8 +539,8 @@ trait MockAccountData
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
$cg->fees_and_limits = $data;
|
||||
@ -551,8 +551,8 @@ trait MockAccountData
|
||||
$cg->user_id = $this->user->id;
|
||||
$cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
|
||||
$cg->require_cvv = true;
|
||||
$cg->show_billing_address = true;
|
||||
$cg->show_shipping_address = true;
|
||||
$cg->require_billing_address = true;
|
||||
$cg->require_shipping_address = true;
|
||||
$cg->update_details = true;
|
||||
$cg->fees_and_limits = $data;
|
||||
$cg->config = encrypt(config('ninja.testvars.stripe'));
|
||||
|
@ -65637,7 +65637,7 @@
|
||||
"gateway_key": "16dc1d3c8a865425421f64463faaf768",
|
||||
"accepted_credit_cards": 0,
|
||||
"require_cvv": 1,
|
||||
"show_billing_address": null,
|
||||
"require_billing_address": null,
|
||||
"show_shipping_address": 0,
|
||||
"update_details": null,
|
||||
"config": "{\"apiKey\":\"345345345\",\"publishableKey\":\"5435345\",\"plaidClientId\":\"\",\"plaidSecret\":\"\",\"plaidPublicKey\":\"\",\"enableAlipay\":false,\"enableSofort\":false,\"enableSepa\":false,\"enableBitcoin\":false,\"enableApplePay\":false,\"enableAch\":false}",
|
||||
@ -65666,7 +65666,7 @@
|
||||
"gateway_key": "16dc1d3c8a865425421f64463faaf768",
|
||||
"accepted_credit_cards": 0,
|
||||
"require_cvv": 1,
|
||||
"show_billing_address": null,
|
||||
"require_billing_address": null,
|
||||
"show_shipping_address": 0,
|
||||
"update_details": null,
|
||||
"config": "{\"apiKey\":\"345345345\",\"publishableKey\":\"5435345\",\"plaidClientId\":\"\",\"plaidSecret\":\"\",\"plaidPublicKey\":\"\",\"enableAlipay\":false,\"enableSofort\":false,\"enableSepa\":false,\"enableBitcoin\":false,\"enableApplePay\":false,\"enableAch\":false}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user